@elastic/eui 60.1.2 → 60.2.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 (264) hide show
  1. package/dist/eui_charts_theme.js +330 -330
  2. package/dist/eui_charts_theme.js.map +1 -1
  3. package/dist/eui_theme_dark.css +0 -5
  4. package/dist/eui_theme_dark.min.css +1 -1
  5. package/dist/eui_theme_light.css +0 -5
  6. package/dist/eui_theme_light.min.css +1 -1
  7. package/es/components/accessibility/skip_link/skip_link.js +1 -1
  8. package/es/components/avatar/avatar.js +1 -1
  9. package/es/components/badge/badge.js +1 -1
  10. package/es/components/badge/beta_badge/beta_badge.js +1 -1
  11. package/es/components/basic_table/basic_table.js +1 -1
  12. package/es/components/basic_table/collapsed_item_actions.js +1 -1
  13. package/es/components/basic_table/in_memory_table.js +1 -1
  14. package/es/components/button/_button_content_deprecated.js +1 -1
  15. package/es/components/button/button.js +2 -2
  16. package/es/components/button/button_display/_button_display.js +1 -1
  17. package/es/components/button/button_display/_button_display_content.js +1 -1
  18. package/es/components/button/button_empty/button_empty.js +1 -1
  19. package/es/components/button/button_group/button_group.js +1 -1
  20. package/es/components/button/button_group/button_group_button.js +1 -1
  21. package/es/components/button/button_icon/button_icon.js +1 -1
  22. package/es/components/call_out/call_out.js +1 -1
  23. package/es/components/card/card.js +1 -1
  24. package/es/components/card/card_select.js +1 -1
  25. package/es/components/collapsible_nav/collapsible_nav_group/collapsible_nav_group.js +1 -1
  26. package/es/components/comment_list/comment.js +1 -1
  27. package/es/components/comment_list/comment_list.js +1 -1
  28. package/es/components/comment_list/comment_timeline.js +1 -1
  29. package/es/components/datagrid/body/data_grid_body.js +31 -25
  30. package/es/components/datagrid/body/data_grid_cell.js +52 -46
  31. package/es/components/datagrid/body/header/data_grid_header_cell.js +100 -31
  32. package/es/components/datagrid/body/header/data_grid_header_row.js +27 -24
  33. package/es/components/datagrid/controls/column_sorting_draggable.js +1 -1
  34. package/es/components/datagrid/data_grid.js +27 -24
  35. package/es/components/datagrid/utils/focus.js +19 -10
  36. package/es/components/datagrid/utils/in_memory.js +26 -23
  37. package/es/components/date_picker/date_picker.js +2 -2
  38. package/es/components/date_picker/date_picker_range.js +1 -1
  39. package/es/components/empty_prompt/empty_prompt.js +1 -1
  40. package/es/components/form/field_number/field_number.js +1 -1
  41. package/es/components/form/field_text/field_text.js +2 -2
  42. package/es/components/form/form_control_layout/form_control_layout.js +2 -2
  43. package/es/components/form/form_control_layout/form_control_layout_custom_icon.js +1 -1
  44. package/es/components/form/form_control_layout/form_control_layout_icons.js +2 -2
  45. package/es/components/header/header_links/header_link.js +1 -1
  46. package/es/components/header/header_links/header_links.js +9 -1
  47. package/es/components/header/header_logo.js +1 -1
  48. package/es/components/icon/assets/cluster.js +41 -0
  49. package/es/components/icon/assets/container.js +39 -0
  50. package/es/components/icon/assets/kubernetesNode.js +41 -0
  51. package/es/components/icon/assets/kubernetesPod.js +41 -0
  52. package/es/components/icon/assets/namespace.js +41 -0
  53. package/es/components/icon/icon.js +1 -1
  54. package/es/components/icon/icon_map.js +5 -0
  55. package/es/components/key_pad_menu/key_pad_menu_item.js +1 -1
  56. package/es/components/list_group/list_group.js +2 -2
  57. package/es/components/list_group/list_group_item.js +2 -2
  58. package/es/components/list_group/pinnable_list_group/pinnable_list_group.js +4 -4
  59. package/es/components/loading/loading_logo.js +1 -1
  60. package/es/components/markdown_editor/markdown_editor.js +1 -1
  61. package/es/components/markdown_editor/markdown_editor_drop_zone.js +1 -1
  62. package/es/components/markdown_editor/markdown_editor_footer.js +1 -1
  63. package/es/components/markdown_editor/markdown_editor_toolbar.js +1 -1
  64. package/es/components/notification/notification_event.js +2 -2
  65. package/es/components/notification/notification_event_meta.js +1 -1
  66. package/es/components/page/page_header/page_header.js +1 -1
  67. package/es/components/page/page_header/page_header_content.js +1 -1
  68. package/es/components/page/page_template.js +1 -1
  69. package/es/components/pagination/pagination_button.js +1 -1
  70. package/es/components/popover/popover.js +14 -4
  71. package/es/components/selectable/selectable_list/selectable_list.js +1 -1
  72. package/es/components/selectable/selectable_list/selectable_list_item.js +1 -1
  73. package/es/components/selectable/selectable_templates/selectable_template_sitewide.js +1 -1
  74. package/es/components/suggest/suggest.js +1 -1
  75. package/es/components/suggest/suggest_item.js +1 -1
  76. package/es/components/table/table_header_button.js +1 -1
  77. package/es/components/timeline/timeline_item_icon.js +1 -1
  78. package/es/components/toast/global_toast_list.js +1 -1
  79. package/es/components/toast/toast.js +1 -1
  80. package/es/components/token/token.js +1 -1
  81. package/es/components/tool_tip/icon_tip.js +1 -1
  82. package/es/components/tour/tour.js +8 -0
  83. package/es/components/tour/tour_step.js +8 -0
  84. package/eui.d.ts +93 -16
  85. package/i18ntokens.json +22 -6
  86. package/lib/components/accessibility/skip_link/skip_link.js +1 -1
  87. package/lib/components/avatar/avatar.js +1 -1
  88. package/lib/components/badge/badge.js +1 -1
  89. package/lib/components/badge/beta_badge/beta_badge.js +1 -1
  90. package/lib/components/basic_table/basic_table.js +1 -1
  91. package/lib/components/basic_table/collapsed_item_actions.js +1 -1
  92. package/lib/components/basic_table/in_memory_table.js +1 -1
  93. package/lib/components/button/_button_content_deprecated.js +1 -1
  94. package/lib/components/button/button.js +2 -2
  95. package/lib/components/button/button_display/_button_display.js +1 -1
  96. package/lib/components/button/button_display/_button_display_content.js +1 -1
  97. package/lib/components/button/button_empty/button_empty.js +1 -1
  98. package/lib/components/button/button_group/button_group.js +1 -1
  99. package/lib/components/button/button_group/button_group_button.js +1 -1
  100. package/lib/components/button/button_icon/button_icon.js +1 -1
  101. package/lib/components/call_out/call_out.js +1 -1
  102. package/lib/components/card/card.js +1 -1
  103. package/lib/components/card/card_select.js +1 -1
  104. package/lib/components/collapsible_nav/collapsible_nav_group/collapsible_nav_group.js +1 -1
  105. package/lib/components/comment_list/comment.js +1 -1
  106. package/lib/components/comment_list/comment_list.js +1 -1
  107. package/lib/components/comment_list/comment_timeline.js +1 -1
  108. package/lib/components/datagrid/body/data_grid_body.js +31 -25
  109. package/lib/components/datagrid/body/data_grid_cell.js +52 -46
  110. package/lib/components/datagrid/body/header/data_grid_header_cell.js +105 -31
  111. package/lib/components/datagrid/body/header/data_grid_header_row.js +27 -24
  112. package/lib/components/datagrid/controls/column_sorting_draggable.js +1 -1
  113. package/lib/components/datagrid/data_grid.js +27 -24
  114. package/lib/components/datagrid/utils/focus.js +19 -11
  115. package/lib/components/datagrid/utils/in_memory.js +26 -23
  116. package/lib/components/date_picker/date_picker.js +2 -2
  117. package/lib/components/date_picker/date_picker_range.js +1 -1
  118. package/lib/components/empty_prompt/empty_prompt.js +1 -1
  119. package/lib/components/form/field_number/field_number.js +1 -1
  120. package/lib/components/form/field_text/field_text.js +2 -2
  121. package/lib/components/form/form_control_layout/form_control_layout.js +2 -2
  122. package/lib/components/form/form_control_layout/form_control_layout_custom_icon.js +1 -1
  123. package/lib/components/form/form_control_layout/form_control_layout_icons.js +2 -2
  124. package/lib/components/header/header_links/header_link.js +1 -1
  125. package/lib/components/header/header_links/header_links.js +9 -1
  126. package/lib/components/header/header_logo.js +1 -1
  127. package/lib/components/icon/assets/cluster.js +48 -0
  128. package/lib/components/icon/assets/container.js +46 -0
  129. package/lib/components/icon/assets/kubernetesNode.js +48 -0
  130. package/lib/components/icon/assets/kubernetesPod.js +48 -0
  131. package/lib/components/icon/assets/namespace.js +48 -0
  132. package/lib/components/icon/icon.js +1 -1
  133. package/lib/components/icon/icon_map.js +5 -0
  134. package/lib/components/icon/svgs/cluster.svg +3 -0
  135. package/lib/components/icon/svgs/container.svg +3 -0
  136. package/lib/components/icon/svgs/kubernetesNode.svg +3 -0
  137. package/lib/components/icon/svgs/kubernetesPod.svg +3 -0
  138. package/lib/components/icon/svgs/namespace.svg +3 -0
  139. package/lib/components/key_pad_menu/key_pad_menu_item.js +1 -1
  140. package/lib/components/list_group/list_group.js +2 -2
  141. package/lib/components/list_group/list_group_item.js +2 -2
  142. package/lib/components/list_group/pinnable_list_group/pinnable_list_group.js +4 -4
  143. package/lib/components/loading/loading_logo.js +1 -1
  144. package/lib/components/markdown_editor/markdown_editor.js +1 -1
  145. package/lib/components/markdown_editor/markdown_editor_drop_zone.js +1 -1
  146. package/lib/components/markdown_editor/markdown_editor_footer.js +1 -1
  147. package/lib/components/markdown_editor/markdown_editor_toolbar.js +1 -1
  148. package/lib/components/notification/notification_event.js +2 -2
  149. package/lib/components/notification/notification_event_meta.js +1 -1
  150. package/lib/components/page/page_header/page_header.js +1 -1
  151. package/lib/components/page/page_header/page_header_content.js +1 -1
  152. package/lib/components/page/page_template.js +1 -1
  153. package/lib/components/popover/popover.js +14 -4
  154. package/lib/components/selectable/selectable_list/selectable_list.js +1 -1
  155. package/lib/components/selectable/selectable_list/selectable_list_item.js +1 -1
  156. package/lib/components/selectable/selectable_templates/selectable_template_sitewide.js +1 -1
  157. package/lib/components/suggest/suggest.js +1 -1
  158. package/lib/components/suggest/suggest_item.js +1 -1
  159. package/lib/components/table/table_header_button.js +1 -1
  160. package/lib/components/timeline/timeline_item_icon.js +1 -1
  161. package/lib/components/toast/global_toast_list.js +1 -1
  162. package/lib/components/toast/toast.js +1 -1
  163. package/lib/components/token/token.js +1 -1
  164. package/lib/components/tool_tip/icon_tip.js +1 -1
  165. package/optimize/es/components/datagrid/body/data_grid_body.js +4 -1
  166. package/optimize/es/components/datagrid/body/header/data_grid_header_cell.js +74 -8
  167. package/optimize/es/components/datagrid/utils/focus.js +19 -11
  168. package/optimize/es/components/icon/assets/cluster.js +37 -0
  169. package/optimize/es/components/icon/assets/container.js +35 -0
  170. package/optimize/es/components/icon/assets/kubernetesNode.js +37 -0
  171. package/optimize/es/components/icon/assets/kubernetesPod.js +37 -0
  172. package/optimize/es/components/icon/assets/namespace.js +37 -0
  173. package/optimize/es/components/icon/icon_map.js +5 -0
  174. package/optimize/es/components/popover/popover.js +6 -4
  175. package/optimize/lib/components/datagrid/body/data_grid_body.js +4 -1
  176. package/optimize/lib/components/datagrid/body/header/data_grid_header_cell.js +79 -8
  177. package/optimize/lib/components/datagrid/utils/focus.js +19 -11
  178. package/optimize/lib/components/icon/assets/cluster.js +47 -0
  179. package/optimize/lib/components/icon/assets/container.js +45 -0
  180. package/optimize/lib/components/icon/assets/kubernetesNode.js +47 -0
  181. package/optimize/lib/components/icon/assets/kubernetesPod.js +47 -0
  182. package/optimize/lib/components/icon/assets/namespace.js +47 -0
  183. package/optimize/lib/components/icon/icon_map.js +5 -0
  184. package/optimize/lib/components/icon/svgs/cluster.svg +3 -0
  185. package/optimize/lib/components/icon/svgs/container.svg +3 -0
  186. package/optimize/lib/components/icon/svgs/kubernetesNode.svg +3 -0
  187. package/optimize/lib/components/icon/svgs/kubernetesPod.svg +3 -0
  188. package/optimize/lib/components/icon/svgs/namespace.svg +3 -0
  189. package/optimize/lib/components/popover/popover.js +6 -4
  190. package/package.json +2 -2
  191. package/src/components/datagrid/body/header/_data_grid_header_row.scss +0 -9
  192. package/test-env/components/accessibility/skip_link/skip_link.js +1 -1
  193. package/test-env/components/avatar/avatar.js +1 -1
  194. package/test-env/components/badge/badge.js +1 -1
  195. package/test-env/components/badge/beta_badge/beta_badge.js +1 -1
  196. package/test-env/components/basic_table/basic_table.js +1 -1
  197. package/test-env/components/basic_table/collapsed_item_actions.js +1 -1
  198. package/test-env/components/basic_table/in_memory_table.js +1 -1
  199. package/test-env/components/button/_button_content_deprecated.js +1 -1
  200. package/test-env/components/button/button.js +2 -2
  201. package/test-env/components/button/button_display/_button_display.js +1 -1
  202. package/test-env/components/button/button_display/_button_display_content.js +1 -1
  203. package/test-env/components/button/button_empty/button_empty.js +1 -1
  204. package/test-env/components/button/button_group/button_group.js +1 -1
  205. package/test-env/components/button/button_group/button_group_button.js +1 -1
  206. package/test-env/components/button/button_icon/button_icon.js +1 -1
  207. package/test-env/components/call_out/call_out.js +1 -1
  208. package/test-env/components/card/card.js +1 -1
  209. package/test-env/components/card/card_select.js +1 -1
  210. package/test-env/components/collapsible_nav/collapsible_nav_group/collapsible_nav_group.js +1 -1
  211. package/test-env/components/comment_list/comment.js +1 -1
  212. package/test-env/components/comment_list/comment_list.js +1 -1
  213. package/test-env/components/comment_list/comment_timeline.js +1 -1
  214. package/test-env/components/datagrid/body/data_grid_body.js +31 -25
  215. package/test-env/components/datagrid/body/data_grid_cell.js +52 -46
  216. package/test-env/components/datagrid/body/header/data_grid_header_cell.js +105 -31
  217. package/test-env/components/datagrid/body/header/data_grid_header_row.js +27 -24
  218. package/test-env/components/datagrid/controls/column_sorting_draggable.js +1 -1
  219. package/test-env/components/datagrid/data_grid.js +27 -24
  220. package/test-env/components/datagrid/utils/focus.js +19 -11
  221. package/test-env/components/datagrid/utils/in_memory.js +26 -23
  222. package/test-env/components/date_picker/date_picker.js +2 -2
  223. package/test-env/components/date_picker/date_picker_range.js +1 -1
  224. package/test-env/components/empty_prompt/empty_prompt.js +1 -1
  225. package/test-env/components/form/field_number/field_number.js +1 -1
  226. package/test-env/components/form/field_text/field_text.js +2 -2
  227. package/test-env/components/form/form_control_layout/form_control_layout.js +2 -2
  228. package/test-env/components/form/form_control_layout/form_control_layout_custom_icon.js +1 -1
  229. package/test-env/components/form/form_control_layout/form_control_layout_icons.js +2 -2
  230. package/test-env/components/header/header_links/header_link.js +1 -1
  231. package/test-env/components/header/header_links/header_links.js +9 -1
  232. package/test-env/components/header/header_logo.js +1 -1
  233. package/test-env/components/icon/assets/cluster.js +47 -0
  234. package/test-env/components/icon/assets/container.js +45 -0
  235. package/test-env/components/icon/assets/kubernetesNode.js +47 -0
  236. package/test-env/components/icon/assets/kubernetesPod.js +47 -0
  237. package/test-env/components/icon/assets/namespace.js +47 -0
  238. package/test-env/components/icon/icon_map.js +5 -0
  239. package/test-env/components/key_pad_menu/key_pad_menu_item.js +1 -1
  240. package/test-env/components/list_group/list_group.js +2 -2
  241. package/test-env/components/list_group/list_group_item.js +2 -2
  242. package/test-env/components/list_group/pinnable_list_group/pinnable_list_group.js +4 -4
  243. package/test-env/components/loading/loading_logo.js +1 -1
  244. package/test-env/components/markdown_editor/markdown_editor.js +1 -1
  245. package/test-env/components/markdown_editor/markdown_editor_drop_zone.js +1 -1
  246. package/test-env/components/markdown_editor/markdown_editor_footer.js +1 -1
  247. package/test-env/components/markdown_editor/markdown_editor_toolbar.js +1 -1
  248. package/test-env/components/notification/notification_event.js +2 -2
  249. package/test-env/components/notification/notification_event_meta.js +1 -1
  250. package/test-env/components/page/page_header/page_header.js +1 -1
  251. package/test-env/components/page/page_header/page_header_content.js +1 -1
  252. package/test-env/components/page/page_template.js +1 -1
  253. package/test-env/components/popover/popover.js +14 -4
  254. package/test-env/components/selectable/selectable_list/selectable_list.js +1 -1
  255. package/test-env/components/selectable/selectable_list/selectable_list_item.js +1 -1
  256. package/test-env/components/selectable/selectable_templates/selectable_template_sitewide.js +1 -1
  257. package/test-env/components/suggest/suggest.js +1 -1
  258. package/test-env/components/suggest/suggest_item.js +1 -1
  259. package/test-env/components/table/table_header_button.js +1 -1
  260. package/test-env/components/timeline/timeline_item_icon.js +1 -1
  261. package/test-env/components/toast/global_toast_list.js +1 -1
  262. package/test-env/components/toast/toast.js +1 -1
  263. package/test-env/components/token/token.js +1 -1
  264. package/test-env/components/tool_tip/icon_tip.js +1 -1
@@ -10,10 +10,12 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
10
10
  * Side Public License, v 1.
11
11
  */
12
12
  import classnames from 'classnames';
13
- import React, { useContext, useState } from 'react';
13
+ import React, { useContext, useState, useRef, useCallback } from 'react';
14
+ import { tabbable } from 'tabbable';
15
+ import { keys } from '../../../../services';
14
16
  import { useGeneratedHtmlId } from '../../../../services/accessibility';
15
17
  import { EuiScreenReaderOnly } from '../../../accessibility';
16
- import { useEuiI18n } from '../../../i18n';
18
+ import { useEuiI18n, EuiI18n } from '../../../i18n';
17
19
  import { EuiIcon } from '../../../icon';
18
20
  import { EuiListGroup } from '../../../list_group';
19
21
  import { EuiPopover } from '../../../popover';
@@ -88,6 +90,7 @@ export var EuiDataGridHeaderCell = function EuiDataGridHeaderCell(_ref) {
88
90
  isPopoverOpen = _useState2[0],
89
91
  setIsPopoverOpen = _useState2[1];
90
92
 
93
+ var popoverArrowNavigationProps = usePopoverArrowNavigation();
91
94
  var columnActions = getColumnActions({
92
95
  column: column,
93
96
  columns: columns,
@@ -123,9 +126,11 @@ export var EuiDataGridHeaderCell = function EuiDataGridHeaderCell(_ref) {
123
126
  }) : null, sortString && ___EmotionJSX(EuiScreenReaderOnly, null, ___EmotionJSX("div", {
124
127
  id: screenReaderId
125
128
  }, sortString)), !showColumnActions ? ___EmotionJSX(React.Fragment, null, sortingArrow, ___EmotionJSX("div", {
126
- className: "euiDataGridHeaderCell__content"
127
- }, display || displayAsText || id)) : ___EmotionJSX(EuiPopover, {
128
- anchorClassName: "euiDataGridHeaderCell__anchor",
129
+ className: "euiDataGridHeaderCell__content",
130
+ title: displayAsText || id
131
+ }, display || displayAsText || id)) : ___EmotionJSX(EuiPopover, _extends({
132
+ className: "eui-fullWidth",
133
+ anchorClassName: "eui-fullWidth",
129
134
  panelPaddingSize: "none",
130
135
  offset: 7,
131
136
  button: ___EmotionJSX("button", {
@@ -137,7 +142,8 @@ export var EuiDataGridHeaderCell = function EuiDataGridHeaderCell(_ref) {
137
142
  });
138
143
  }
139
144
  }, sortingArrow, ___EmotionJSX("div", {
140
- className: "euiDataGridHeaderCell__content"
145
+ className: "euiDataGridHeaderCell__content",
146
+ title: displayAsText || id
141
147
  }, display || displayAsText || id), ___EmotionJSX(EuiIcon, {
142
148
  className: "euiDataGridHeaderCell__icon",
143
149
  type: "arrowDown",
@@ -150,9 +156,69 @@ export var EuiDataGridHeaderCell = function EuiDataGridHeaderCell(_ref) {
150
156
  closePopover: function closePopover() {
151
157
  return setIsPopoverOpen(false);
152
158
  }
153
- }, ___EmotionJSX("div", null, ___EmotionJSX(EuiListGroup, {
159
+ }, popoverArrowNavigationProps), ___EmotionJSX(EuiListGroup, {
154
160
  listItems: columnActions,
155
161
  gutterSize: "none",
156
162
  "data-test-subj": "dataGridHeaderCellActionGroup-".concat(id)
157
- }))));
163
+ })));
164
+ };
165
+ /**
166
+ * Add keyboard arrow navigation to the cell actions popover
167
+ * to match the UX of the rest of EuiDataGrid
168
+ */
169
+
170
+ export var usePopoverArrowNavigation = function usePopoverArrowNavigation() {
171
+ var popoverPanelRef = useRef(null);
172
+ var actionsRef = useRef(undefined);
173
+ var panelRef = useCallback(function (ref) {
174
+ popoverPanelRef.current = ref;
175
+ actionsRef.current = ref ? tabbable(ref) : undefined;
176
+ }, []);
177
+ var onKeyDown = useCallback(function (e) {
178
+ var _actionsRef$current;
179
+
180
+ if (e.key !== keys.ARROW_DOWN && e.key !== keys.ARROW_UP) return;
181
+ if (!((_actionsRef$current = actionsRef.current) !== null && _actionsRef$current !== void 0 && _actionsRef$current.length)) return;
182
+ e.preventDefault();
183
+ var initialState = document.activeElement === popoverPanelRef.current;
184
+ var currentIndex = !initialState ? actionsRef.current.findIndex(function (el) {
185
+ return document.activeElement === el;
186
+ }) : -1;
187
+ var lastIndex = actionsRef.current.length - 1;
188
+ var indexToFocus;
189
+
190
+ if (initialState) {
191
+ if (e.key === keys.ARROW_DOWN) {
192
+ indexToFocus = 0;
193
+ } else if (e.key === keys.ARROW_UP) {
194
+ indexToFocus = lastIndex;
195
+ }
196
+ } else {
197
+ if (e.key === keys.ARROW_DOWN) {
198
+ indexToFocus = currentIndex + 1;
199
+
200
+ if (indexToFocus > lastIndex) {
201
+ indexToFocus = 0;
202
+ }
203
+ } else if (e.key === keys.ARROW_UP) {
204
+ indexToFocus = currentIndex - 1;
205
+
206
+ if (indexToFocus < 0) {
207
+ indexToFocus = lastIndex;
208
+ }
209
+ }
210
+ }
211
+
212
+ actionsRef.current[indexToFocus].focus();
213
+ }, []);
214
+ return {
215
+ panelRef: panelRef,
216
+ panelProps: {
217
+ onKeyDown: onKeyDown
218
+ },
219
+ popoverScreenReaderText: ___EmotionJSX(EuiI18n, {
220
+ token: "euiDataGridHeaderCell.actionsPopoverScreenReaderText",
221
+ default: "To navigate through the list of column actions, press the Tab or Up and Down arrow keys."
222
+ })
223
+ };
158
224
  };
@@ -46,11 +46,17 @@ export var useFocus = function useFocus(_ref) {
46
46
  focusedCell = _useState4[0],
47
47
  _setFocusedCell = _useState4[1];
48
48
 
49
- var setFocusedCell = useCallback(function (focusedCell) {
50
- _setFocusedCell(focusedCell);
49
+ var setFocusedCell = useCallback(function (nextFocusedCell) {
50
+ // If the x/y coordinates remained the same, don't update. This keeps the focusedCell
51
+ // reference stable, and allows it to be used in places that need reference equality.
52
+ if (nextFocusedCell[0] === (focusedCell === null || focusedCell === void 0 ? void 0 : focusedCell[0]) && nextFocusedCell[1] === (focusedCell === null || focusedCell === void 0 ? void 0 : focusedCell[1])) {
53
+ return;
54
+ }
55
+
56
+ _setFocusedCell(nextFocusedCell);
51
57
 
52
58
  setIsFocusedCellInView(true); // scrolling.ts ensures focused cells are fully in view
53
- }, []);
59
+ }, [focusedCell]);
54
60
  var previousCell = useRef(undefined);
55
61
  useEffect(function () {
56
62
  if (previousCell.current) {
@@ -82,13 +88,16 @@ export var useFocus = function useFocus(_ref) {
82
88
  tabIndex: -1
83
89
  } : {
84
90
  tabIndex: 0,
85
- onFocus: function onFocus(e) {
86
- // if e.target (the source element of the `focus event`
87
- // matches e.currentTarget (always the div with this onFocus listener)
88
- // then the user has focused directly on the data grid wrapper (almost definitely by tabbing)
89
- // so shift focus to the first visible and interactive cell within the grid
90
- if (e.target === e.currentTarget) {
91
- focusFirstVisibleInteractiveCell();
91
+ onKeyUp: function onKeyUp(e) {
92
+ // Ensure we only manually focus into the grid via keyboard tab -
93
+ // mouse users can accidentally trigger focus by clicking on scrollbars
94
+ if (e.key === keys.TAB) {
95
+ // if e.target (the source element of the `focus event`) matches
96
+ // e.currentTarget (always the div with this onKeyUp listener)
97
+ // then the user has focused directly on the data grid wrapper
98
+ if (e.target === e.currentTarget) {
99
+ focusFirstVisibleInteractiveCell();
100
+ }
92
101
  }
93
102
  }
94
103
  };
@@ -141,7 +150,6 @@ export var createKeyDownHandler = function createKeyDownHandler(_ref2) {
141
150
 
142
151
  var key = event.key,
143
152
  ctrlKey = event.ctrlKey;
144
- console.log('???', event);
145
153
 
146
154
  if (key === keys.ARROW_DOWN) {
147
155
  event.preventDefault();
@@ -0,0 +1,37 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
+ var _excluded = ["title", "titleId"];
4
+
5
+ /*
6
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
7
+ * or more contributor license agreements. Licensed under the Elastic License
8
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
9
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
10
+ * Side Public License, v 1.
11
+ */
12
+ // THIS IS A GENERATED FILE. DO NOT MODIFY MANUALLY. @see scripts/compile-icons.js
13
+ import * as React from 'react';
14
+ import { jsx as ___EmotionJSX } from "@emotion/react";
15
+
16
+ var EuiIconCluster = function EuiIconCluster(_ref) {
17
+ var title = _ref.title,
18
+ titleId = _ref.titleId,
19
+ props = _objectWithoutProperties(_ref, _excluded);
20
+
21
+ return ___EmotionJSX("svg", _extends({
22
+ width: 16,
23
+ height: 16,
24
+ viewBox: "0 0 16 16",
25
+ fill: "none",
26
+ xmlns: "http://www.w3.org/2000/svg",
27
+ "aria-labelledby": titleId
28
+ }, props), title ? ___EmotionJSX("title", {
29
+ id: titleId
30
+ }, title) : null, ___EmotionJSX("path", {
31
+ fillRule: "evenodd",
32
+ clipRule: "evenodd",
33
+ d: "M4.5 7a2.5 2.5 0 100-5 2.5 2.5 0 000 5zm0-6a3.5 3.5 0 013.465 3h3.12a1.5 1.5 0 110 1h-3.12a3.482 3.482 0 01-.662 1.596l2.1 2.1A3.5 3.5 0 118.036 12h-3.12a1.5 1.5 0 110-.999h3.12a3.482 3.482 0 01.662-1.596l-2.1-2.1A3.5 3.5 0 114.5 1zM12 4.5a.5.5 0 101 0 .5.5 0 00-1 0zm-.5 9.5a2.5 2.5 0 110-5 2.5 2.5 0 010 5zM4 11.5a.5.5 0 11-1 0 .5.5 0 011 0z"
34
+ }));
35
+ };
36
+
37
+ export var icon = EuiIconCluster;
@@ -0,0 +1,35 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
+ var _excluded = ["title", "titleId"];
4
+
5
+ /*
6
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
7
+ * or more contributor license agreements. Licensed under the Elastic License
8
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
9
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
10
+ * Side Public License, v 1.
11
+ */
12
+ // THIS IS A GENERATED FILE. DO NOT MODIFY MANUALLY. @see scripts/compile-icons.js
13
+ import * as React from 'react';
14
+ import { jsx as ___EmotionJSX } from "@emotion/react";
15
+
16
+ var EuiIconContainer = function EuiIconContainer(_ref) {
17
+ var title = _ref.title,
18
+ titleId = _ref.titleId,
19
+ props = _objectWithoutProperties(_ref, _excluded);
20
+
21
+ return ___EmotionJSX("svg", _extends({
22
+ fill: "none",
23
+ xmlns: "http://www.w3.org/2000/svg",
24
+ viewBox: "0 0 16 16",
25
+ "aria-labelledby": titleId
26
+ }, props), title ? ___EmotionJSX("title", {
27
+ id: titleId
28
+ }, title) : null, ___EmotionJSX("path", {
29
+ fillRule: "evenodd",
30
+ clipRule: "evenodd",
31
+ d: "M0 2.5A.5.5 0 01.5 2h15a.5.5 0 010 1H15v10h.5a.5.5 0 010 1H.5a.5.5 0 010-1H1V3H.5a.5.5 0 01-.5-.5zM2 3h12v10H2V3zm3 2a.5.5 0 00-.5.5v5a.5.5 0 001 0v-5A.5.5 0 005 5zm5.5.5a.5.5 0 011 0v5a.5.5 0 01-1 0v-5zM8 5a.5.5 0 00-.5.5v5a.5.5 0 001 0v-5A.5.5 0 008 5z"
32
+ }));
33
+ };
34
+
35
+ export var icon = EuiIconContainer;
@@ -0,0 +1,37 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
+ var _excluded = ["title", "titleId"];
4
+
5
+ /*
6
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
7
+ * or more contributor license agreements. Licensed under the Elastic License
8
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
9
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
10
+ * Side Public License, v 1.
11
+ */
12
+ // THIS IS A GENERATED FILE. DO NOT MODIFY MANUALLY. @see scripts/compile-icons.js
13
+ import * as React from 'react';
14
+ import { jsx as ___EmotionJSX } from "@emotion/react";
15
+
16
+ var EuiIconKubernetesNode = function EuiIconKubernetesNode(_ref) {
17
+ var title = _ref.title,
18
+ titleId = _ref.titleId,
19
+ props = _objectWithoutProperties(_ref, _excluded);
20
+
21
+ return ___EmotionJSX("svg", _extends({
22
+ width: 16,
23
+ height: 16,
24
+ viewBox: "0 0 16 16",
25
+ fill: "none",
26
+ xmlns: "http://www.w3.org/2000/svg",
27
+ "aria-labelledby": titleId
28
+ }, props), title ? ___EmotionJSX("title", {
29
+ id: titleId
30
+ }, title) : null, ___EmotionJSX("path", {
31
+ fillRule: "evenodd",
32
+ clipRule: "evenodd",
33
+ d: "M14 11.42V4.58L8 1.152 2 4.58v6.84l6 3.428 6-3.428zM8 16l7-4V4L8 0 1 4v8l7 4zM8 4.607l3 1.714V9.68l-3 1.714-3-1.714V6.32l3-1.714zm4 1.134v4.518l-4 2.286-4-2.286V5.741l4-2.286 4 2.286z"
34
+ }));
35
+ };
36
+
37
+ export var icon = EuiIconKubernetesNode;
@@ -0,0 +1,37 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
+ var _excluded = ["title", "titleId"];
4
+
5
+ /*
6
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
7
+ * or more contributor license agreements. Licensed under the Elastic License
8
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
9
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
10
+ * Side Public License, v 1.
11
+ */
12
+ // THIS IS A GENERATED FILE. DO NOT MODIFY MANUALLY. @see scripts/compile-icons.js
13
+ import * as React from 'react';
14
+ import { jsx as ___EmotionJSX } from "@emotion/react";
15
+
16
+ var EuiIconKubernetesPod = function EuiIconKubernetesPod(_ref) {
17
+ var title = _ref.title,
18
+ titleId = _ref.titleId,
19
+ props = _objectWithoutProperties(_ref, _excluded);
20
+
21
+ return ___EmotionJSX("svg", _extends({
22
+ width: 16,
23
+ height: 16,
24
+ viewBox: "0 0 16 16",
25
+ fill: "none",
26
+ xmlns: "http://www.w3.org/2000/svg",
27
+ "aria-labelledby": titleId
28
+ }, props), title ? ___EmotionJSX("title", {
29
+ id: titleId
30
+ }, title) : null, ___EmotionJSX("path", {
31
+ fillRule: "evenodd",
32
+ clipRule: "evenodd",
33
+ d: "M14 5.151v6.269l-5.5 3.142V8.29L14 5.151zm-.508-.861L8 1.152 2.508 4.29 8 7.424l5.492-3.134zM2 5.151l5.5 3.14v6.272L2 11.42V5.15zM15 12l-7 4-7-4V4l7-4 7 4v8z"
34
+ }));
35
+ };
36
+
37
+ export var icon = EuiIconKubernetesPod;
@@ -0,0 +1,37 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
+ var _excluded = ["title", "titleId"];
4
+
5
+ /*
6
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
7
+ * or more contributor license agreements. Licensed under the Elastic License
8
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
9
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
10
+ * Side Public License, v 1.
11
+ */
12
+ // THIS IS A GENERATED FILE. DO NOT MODIFY MANUALLY. @see scripts/compile-icons.js
13
+ import * as React from 'react';
14
+ import { jsx as ___EmotionJSX } from "@emotion/react";
15
+
16
+ var EuiIconNamespace = function EuiIconNamespace(_ref) {
17
+ var title = _ref.title,
18
+ titleId = _ref.titleId,
19
+ props = _objectWithoutProperties(_ref, _excluded);
20
+
21
+ return ___EmotionJSX("svg", _extends({
22
+ width: 16,
23
+ height: 16,
24
+ viewBox: "0 0 16 16",
25
+ fill: "none",
26
+ xmlns: "http://www.w3.org/2000/svg",
27
+ "aria-labelledby": titleId
28
+ }, props), title ? ___EmotionJSX("title", {
29
+ id: titleId
30
+ }, title) : null, ___EmotionJSX("path", {
31
+ fillRule: "evenodd",
32
+ clipRule: "evenodd",
33
+ d: "M1 1h14v14H1V1zm13 12v1H2V2h12v11zM6 6h4v4H6V6zm-1 5V5h6v6H5z"
34
+ }));
35
+ };
36
+
37
+ export var icon = EuiIconNamespace;
@@ -49,11 +49,13 @@ export var typeToPathMap = {
49
49
  cloudDrizzle: 'cloudDrizzle',
50
50
  cloudStormy: 'cloudStormy',
51
51
  cloudSunny: 'cloudSunny',
52
+ cluster: 'cluster',
52
53
  codeApp: 'app_code',
53
54
  color: 'color',
54
55
  compute: 'compute',
55
56
  console: 'console',
56
57
  consoleApp: 'app_console',
58
+ container: 'container',
57
59
  continuityAbove: 'continuityAbove',
58
60
  continuityAboveBelow: 'continuityAboveBelow',
59
61
  continuityBelow: 'continuityBelow',
@@ -180,6 +182,8 @@ export var typeToPathMap = {
180
182
  kqlOperand: 'kql_operand',
181
183
  kqlSelector: 'kql_selector',
182
184
  kqlValue: 'kql_value',
185
+ kubernetesNode: 'kubernetesNode',
186
+ kubernetesPod: 'kubernetesPod',
183
187
  layers: 'layers',
184
188
  lensApp: 'app_lens',
185
189
  lettering: 'lettering',
@@ -277,6 +281,7 @@ export var typeToPathMap = {
277
281
  mobile: 'mobile',
278
282
  monitoringApp: 'app_monitoring',
279
283
  moon: 'moon',
284
+ namespace: 'namespace',
280
285
  nested: 'nested',
281
286
  node: 'node',
282
287
  notebookApp: 'app_notebook',
@@ -10,7 +10,7 @@ import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
10
10
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
11
11
  import _typeof from "@babel/runtime/helpers/typeof";
12
12
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
13
- var _excluded = ["anchorClassName", "anchorPosition", "button", "buttonRef", "insert", "isOpen", "ownFocus", "children", "className", "closePopover", "panelClassName", "panelPaddingSize", "panelProps", "panelRef", "panelStyle", "popoverRef", "hasArrow", "arrowChildren", "repositionOnScroll", "zIndex", "initialFocus", "attachToAnchor", "display", "onTrapDeactivation", "buffer", "aria-label", "aria-labelledby", "container", "focusTrapProps", "tabIndex"];
13
+ var _excluded = ["anchorClassName", "anchorPosition", "button", "buttonRef", "insert", "isOpen", "ownFocus", "children", "className", "closePopover", "panelClassName", "panelPaddingSize", "panelProps", "panelRef", "panelStyle", "popoverScreenReaderText", "popoverRef", "hasArrow", "arrowChildren", "repositionOnScroll", "zIndex", "initialFocus", "attachToAnchor", "display", "offset", "onTrapDeactivation", "buffer", "aria-label", "aria-labelledby", "container", "focusTrapProps", "tabIndex"];
14
14
 
15
15
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
16
16
 
@@ -496,6 +496,7 @@ export var EuiPopover = /*#__PURE__*/function (_Component) {
496
496
  panelProps = _this$props.panelProps,
497
497
  panelRef = _this$props.panelRef,
498
498
  panelStyle = _this$props.panelStyle,
499
+ popoverScreenReaderText = _this$props.popoverScreenReaderText,
499
500
  popoverRef = _this$props.popoverRef,
500
501
  hasArrow = _this$props.hasArrow,
501
502
  arrowChildren = _this$props.arrowChildren,
@@ -504,6 +505,7 @@ export var EuiPopover = /*#__PURE__*/function (_Component) {
504
505
  initialFocus = _this$props.initialFocus,
505
506
  attachToAnchor = _this$props.attachToAnchor,
506
507
  display = _this$props.display,
508
+ offset = _this$props.offset,
507
509
  onTrapDeactivation = _this$props.onTrapDeactivation,
508
510
  buffer = _this$props.buffer,
509
511
  ariaLabel = _this$props['aria-label'],
@@ -549,14 +551,14 @@ export var EuiPopover = /*#__PURE__*/function (_Component) {
549
551
 
550
552
  var focusTrapScreenReaderText;
551
553
 
552
- if (ownFocus) {
554
+ if (ownFocus || popoverScreenReaderText) {
553
555
  ariaDescribedby = this.descriptionId;
554
556
  focusTrapScreenReaderText = ___EmotionJSX(EuiScreenReaderOnly, null, ___EmotionJSX("p", {
555
557
  id: this.descriptionId
556
- }, ___EmotionJSX(EuiI18n, {
558
+ }, ownFocus && ___EmotionJSX(EuiI18n, {
557
559
  token: "euiPopover.screenReaderAnnouncement",
558
560
  default: "You are in a dialog. To close this dialog, hit escape."
559
- })));
561
+ }), popoverScreenReaderText));
560
562
  }
561
563
 
562
564
  var arrowClassNames = classNames('euiPopover__panelArrow', "euiPopover__panelArrow--".concat(this.state.arrowPosition));
@@ -419,13 +419,16 @@ var EuiDataGridBody = function EuiDataGridBody(props) {
419
419
  }
420
420
  }, (0, _react2.jsx)(_reactWindow.VariableSizeGrid, (0, _extends2.default)({}, virtualizationOptions ? virtualizationOptions : {}, {
421
421
  ref: gridRef,
422
+ className: (0, _classnames.default)('euiDataGrid__virtualized', virtualizationOptions === null || virtualizationOptions === void 0 ? void 0 : virtualizationOptions.className),
422
423
  onItemsRendered: function onItemsRendered(itemsRendered) {
424
+ var _virtualizationOption;
425
+
423
426
  gridItemsRendered.current = itemsRendered;
427
+ virtualizationOptions === null || virtualizationOptions === void 0 ? void 0 : (_virtualizationOption = virtualizationOptions.onItemsRendered) === null || _virtualizationOption === void 0 ? void 0 : _virtualizationOption.call(virtualizationOptions, itemsRendered);
424
428
  },
425
429
  innerElementType: InnerElement,
426
430
  outerRef: outerGridRef,
427
431
  innerRef: innerGridRef,
428
- className: "euiDataGrid__virtualized",
429
432
  columnCount: visibleColCount,
430
433
  width: finalWidth,
431
434
  columnWidth: getColumnWidth,
@@ -7,7 +7,7 @@ var _typeof = require("@babel/runtime/helpers/typeof");
7
7
  Object.defineProperty(exports, "__esModule", {
8
8
  value: true
9
9
  });
10
- exports.EuiDataGridHeaderCell = void 0;
10
+ exports.usePopoverArrowNavigation = exports.EuiDataGridHeaderCell = void 0;
11
11
 
12
12
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
13
13
 
@@ -19,6 +19,10 @@ var _classnames2 = _interopRequireDefault(require("classnames"));
19
19
 
20
20
  var _react = _interopRequireWildcard(require("react"));
21
21
 
22
+ var _tabbable = require("tabbable");
23
+
24
+ var _services = require("../../../../services");
25
+
22
26
  var _accessibility = require("../../../../services/accessibility");
23
27
 
24
28
  var _accessibility2 = require("../../../accessibility");
@@ -119,6 +123,7 @@ var EuiDataGridHeaderCell = function EuiDataGridHeaderCell(_ref) {
119
123
  isPopoverOpen = _useState2[0],
120
124
  setIsPopoverOpen = _useState2[1];
121
125
 
126
+ var popoverArrowNavigationProps = usePopoverArrowNavigation();
122
127
  var columnActions = (0, _column_actions.getColumnActions)({
123
128
  column: column,
124
129
  columns: columns,
@@ -154,9 +159,11 @@ var EuiDataGridHeaderCell = function EuiDataGridHeaderCell(_ref) {
154
159
  }) : null, sortString && (0, _react2.jsx)(_accessibility2.EuiScreenReaderOnly, null, (0, _react2.jsx)("div", {
155
160
  id: screenReaderId
156
161
  }, sortString)), !showColumnActions ? (0, _react2.jsx)(_react.default.Fragment, null, sortingArrow, (0, _react2.jsx)("div", {
157
- className: "euiDataGridHeaderCell__content"
158
- }, display || displayAsText || id)) : (0, _react2.jsx)(_popover.EuiPopover, {
159
- anchorClassName: "euiDataGridHeaderCell__anchor",
162
+ className: "euiDataGridHeaderCell__content",
163
+ title: displayAsText || id
164
+ }, display || displayAsText || id)) : (0, _react2.jsx)(_popover.EuiPopover, (0, _extends2.default)({
165
+ className: "eui-fullWidth",
166
+ anchorClassName: "eui-fullWidth",
160
167
  panelPaddingSize: "none",
161
168
  offset: 7,
162
169
  button: (0, _react2.jsx)("button", {
@@ -168,7 +175,8 @@ var EuiDataGridHeaderCell = function EuiDataGridHeaderCell(_ref) {
168
175
  });
169
176
  }
170
177
  }, sortingArrow, (0, _react2.jsx)("div", {
171
- className: "euiDataGridHeaderCell__content"
178
+ className: "euiDataGridHeaderCell__content",
179
+ title: displayAsText || id
172
180
  }, display || displayAsText || id), (0, _react2.jsx)(_icon.EuiIcon, {
173
181
  className: "euiDataGridHeaderCell__icon",
174
182
  type: "arrowDown",
@@ -181,11 +189,74 @@ var EuiDataGridHeaderCell = function EuiDataGridHeaderCell(_ref) {
181
189
  closePopover: function closePopover() {
182
190
  return setIsPopoverOpen(false);
183
191
  }
184
- }, (0, _react2.jsx)("div", null, (0, _react2.jsx)(_list_group.EuiListGroup, {
192
+ }, popoverArrowNavigationProps), (0, _react2.jsx)(_list_group.EuiListGroup, {
185
193
  listItems: columnActions,
186
194
  gutterSize: "none",
187
195
  "data-test-subj": "dataGridHeaderCellActionGroup-".concat(id)
188
- }))));
196
+ })));
197
+ };
198
+ /**
199
+ * Add keyboard arrow navigation to the cell actions popover
200
+ * to match the UX of the rest of EuiDataGrid
201
+ */
202
+
203
+
204
+ exports.EuiDataGridHeaderCell = EuiDataGridHeaderCell;
205
+
206
+ var usePopoverArrowNavigation = function usePopoverArrowNavigation() {
207
+ var popoverPanelRef = (0, _react.useRef)(null);
208
+ var actionsRef = (0, _react.useRef)(undefined);
209
+ var panelRef = (0, _react.useCallback)(function (ref) {
210
+ popoverPanelRef.current = ref;
211
+ actionsRef.current = ref ? (0, _tabbable.tabbable)(ref) : undefined;
212
+ }, []);
213
+ var onKeyDown = (0, _react.useCallback)(function (e) {
214
+ var _actionsRef$current;
215
+
216
+ if (e.key !== _services.keys.ARROW_DOWN && e.key !== _services.keys.ARROW_UP) return;
217
+ if (!((_actionsRef$current = actionsRef.current) !== null && _actionsRef$current !== void 0 && _actionsRef$current.length)) return;
218
+ e.preventDefault();
219
+ var initialState = document.activeElement === popoverPanelRef.current;
220
+ var currentIndex = !initialState ? actionsRef.current.findIndex(function (el) {
221
+ return document.activeElement === el;
222
+ }) : -1;
223
+ var lastIndex = actionsRef.current.length - 1;
224
+ var indexToFocus;
225
+
226
+ if (initialState) {
227
+ if (e.key === _services.keys.ARROW_DOWN) {
228
+ indexToFocus = 0;
229
+ } else if (e.key === _services.keys.ARROW_UP) {
230
+ indexToFocus = lastIndex;
231
+ }
232
+ } else {
233
+ if (e.key === _services.keys.ARROW_DOWN) {
234
+ indexToFocus = currentIndex + 1;
235
+
236
+ if (indexToFocus > lastIndex) {
237
+ indexToFocus = 0;
238
+ }
239
+ } else if (e.key === _services.keys.ARROW_UP) {
240
+ indexToFocus = currentIndex - 1;
241
+
242
+ if (indexToFocus < 0) {
243
+ indexToFocus = lastIndex;
244
+ }
245
+ }
246
+ }
247
+
248
+ actionsRef.current[indexToFocus].focus();
249
+ }, []);
250
+ return {
251
+ panelRef: panelRef,
252
+ panelProps: {
253
+ onKeyDown: onKeyDown
254
+ },
255
+ popoverScreenReaderText: (0, _react2.jsx)(_i18n.EuiI18n, {
256
+ token: "euiDataGridHeaderCell.actionsPopoverScreenReaderText",
257
+ default: "To navigate through the list of column actions, press the Tab or Up and Down arrow keys."
258
+ })
259
+ };
189
260
  };
190
261
 
191
- exports.EuiDataGridHeaderCell = EuiDataGridHeaderCell;
262
+ exports.usePopoverArrowNavigation = usePopoverArrowNavigation;
@@ -59,11 +59,17 @@ var useFocus = function useFocus(_ref) {
59
59
  focusedCell = _useState4[0],
60
60
  _setFocusedCell = _useState4[1];
61
61
 
62
- var setFocusedCell = (0, _react.useCallback)(function (focusedCell) {
63
- _setFocusedCell(focusedCell);
62
+ var setFocusedCell = (0, _react.useCallback)(function (nextFocusedCell) {
63
+ // If the x/y coordinates remained the same, don't update. This keeps the focusedCell
64
+ // reference stable, and allows it to be used in places that need reference equality.
65
+ if (nextFocusedCell[0] === (focusedCell === null || focusedCell === void 0 ? void 0 : focusedCell[0]) && nextFocusedCell[1] === (focusedCell === null || focusedCell === void 0 ? void 0 : focusedCell[1])) {
66
+ return;
67
+ }
68
+
69
+ _setFocusedCell(nextFocusedCell);
64
70
 
65
71
  setIsFocusedCellInView(true); // scrolling.ts ensures focused cells are fully in view
66
- }, []);
72
+ }, [focusedCell]);
67
73
  var previousCell = (0, _react.useRef)(undefined);
68
74
  (0, _react.useEffect)(function () {
69
75
  if (previousCell.current) {
@@ -95,13 +101,16 @@ var useFocus = function useFocus(_ref) {
95
101
  tabIndex: -1
96
102
  } : {
97
103
  tabIndex: 0,
98
- onFocus: function onFocus(e) {
99
- // if e.target (the source element of the `focus event`
100
- // matches e.currentTarget (always the div with this onFocus listener)
101
- // then the user has focused directly on the data grid wrapper (almost definitely by tabbing)
102
- // so shift focus to the first visible and interactive cell within the grid
103
- if (e.target === e.currentTarget) {
104
- focusFirstVisibleInteractiveCell();
104
+ onKeyUp: function onKeyUp(e) {
105
+ // Ensure we only manually focus into the grid via keyboard tab -
106
+ // mouse users can accidentally trigger focus by clicking on scrollbars
107
+ if (e.key === _services.keys.TAB) {
108
+ // if e.target (the source element of the `focus event`) matches
109
+ // e.currentTarget (always the div with this onKeyUp listener)
110
+ // then the user has focused directly on the data grid wrapper
111
+ if (e.target === e.currentTarget) {
112
+ focusFirstVisibleInteractiveCell();
113
+ }
105
114
  }
106
115
  }
107
116
  };
@@ -160,7 +169,6 @@ var createKeyDownHandler = function createKeyDownHandler(_ref2) {
160
169
 
161
170
  var key = event.key,
162
171
  ctrlKey = event.ctrlKey;
163
- console.log('???', event);
164
172
 
165
173
  if (key === _services.keys.ARROW_DOWN) {
166
174
  event.preventDefault();