@elastic/eui 93.3.0 → 93.4.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 (286) hide show
  1. package/dist/eui_charts_theme.d.ts +9 -0
  2. package/dist/eui_charts_theme.js +56 -14
  3. package/dist/eui_charts_theme.js.map +1 -1
  4. package/es/components/breadcrumbs/_breadcrumb_content.js +362 -0
  5. package/es/components/breadcrumbs/_breadcrumb_content.styles.js +48 -0
  6. package/es/components/breadcrumbs/breadcrumb.js +10 -327
  7. package/es/components/breadcrumbs/breadcrumb.styles.js +5 -27
  8. package/es/components/breadcrumbs/breadcrumbs.js +4 -4
  9. package/es/components/breadcrumbs/types.js +1 -0
  10. package/es/components/button/button_group/button_group.js +16 -2
  11. package/es/components/button/button_group/button_group.styles.js +1 -1
  12. package/es/components/button/button_group/button_group_button.js +59 -5
  13. package/es/components/button/button_group/button_group_button.styles.js +39 -3
  14. package/es/components/datagrid/body/cell/data_grid_cell.js +97 -58
  15. package/es/components/datagrid/body/cell/data_grid_cell_actions.js +24 -18
  16. package/es/components/datagrid/body/cell/data_grid_cell_popover.js +64 -56
  17. package/es/components/datagrid/body/cell/data_grid_cell_wrapper.js +32 -31
  18. package/es/components/datagrid/body/cell/index.js +1 -1
  19. package/es/components/datagrid/body/data_grid_body.js +13 -0
  20. package/es/components/datagrid/body/data_grid_body_custom.js +52 -36
  21. package/es/components/datagrid/body/data_grid_body_virtualized.js +84 -56
  22. package/es/components/datagrid/body/data_grid_row_manager.js +6 -4
  23. package/es/components/datagrid/body/footer/use_data_grid_footer.js +1 -2
  24. package/es/components/datagrid/body/header/data_grid_control_header_cell.js +5 -4
  25. package/es/components/datagrid/body/header/data_grid_header_cell.js +73 -53
  26. package/es/components/datagrid/body/header/data_grid_header_row.js +15 -551
  27. package/es/components/datagrid/body/header/use_data_grid_header.js +7 -6
  28. package/es/components/datagrid/controls/column_selector.js +126 -123
  29. package/es/components/datagrid/controls/column_sorting.js +605 -103
  30. package/es/components/datagrid/controls/column_sorting_draggable.js +24 -22
  31. package/es/components/datagrid/controls/display_selector.js +109 -107
  32. package/es/components/datagrid/data_grid.a11y.js +13 -12
  33. package/es/components/datagrid/data_grid.js +45 -22
  34. package/es/components/datagrid/utils/col_widths.js +12 -8
  35. package/es/components/datagrid/utils/focus.js +10 -8
  36. package/es/components/datagrid/utils/grid_height_width.js +31 -30
  37. package/es/components/datagrid/utils/ref.js +1 -1
  38. package/es/components/datagrid/utils/row_heights.js +2 -2
  39. package/es/components/datagrid/utils/sorting.js +29 -27
  40. package/es/components/date_picker/super_date_picker/super_date_picker.js +9 -0
  41. package/es/components/date_picker/super_date_picker/super_update_button.js +57 -29
  42. package/es/components/flex/flex_grid.js +22 -8
  43. package/es/components/flex/flex_grid.styles.js +13 -6
  44. package/es/components/flex/flex_group.js +10 -11
  45. package/es/components/flex/flex_item.js +9 -11
  46. package/es/components/flex/flex_item.styles.js +107 -122
  47. package/es/components/flyout/flyout.js +16 -18
  48. package/es/components/header/header_breadcrumbs/header_breadcrumbs.js +3 -5
  49. package/es/components/modal/confirm_modal.js +2 -1
  50. package/es/components/modal/modal.js +12 -3
  51. package/es/components/observer/resize_observer/resize_observer.js +15 -24
  52. package/es/components/spacer/spacer.js +2 -3
  53. package/es/components/toast/global_toast_list.js +70 -73
  54. package/es/components/toast/toast.js +27 -42
  55. package/es/components/toast/toast.styles.js +2 -17
  56. package/es/services/color/eui_palettes.js +21 -13
  57. package/es/services/color/index.js +1 -1
  58. package/es/services/hooks/index.js +1 -0
  59. package/es/services/hooks/useDeepEqual.js +23 -0
  60. package/es/services/index.js +1 -1
  61. package/eui.d.ts +2442 -2337
  62. package/i18ntokens.json +259 -259
  63. package/lib/components/breadcrumbs/_breadcrumb_content.js +372 -0
  64. package/lib/components/breadcrumbs/_breadcrumb_content.styles.js +55 -0
  65. package/lib/components/breadcrumbs/breadcrumb.js +11 -331
  66. package/lib/components/breadcrumbs/breadcrumb.styles.js +5 -29
  67. package/lib/components/breadcrumbs/breadcrumbs.js +3 -3
  68. package/lib/components/breadcrumbs/types.js +5 -0
  69. package/lib/components/button/button_group/button_group.js +16 -2
  70. package/lib/components/button/button_group/button_group.styles.js +1 -1
  71. package/lib/components/button/button_group/button_group_button.js +59 -5
  72. package/lib/components/button/button_group/button_group_button.styles.js +45 -11
  73. package/lib/components/datagrid/body/cell/data_grid_cell.js +95 -57
  74. package/lib/components/datagrid/body/cell/data_grid_cell_actions.js +24 -18
  75. package/lib/components/datagrid/body/cell/data_grid_cell_popover.js +63 -55
  76. package/lib/components/datagrid/body/cell/data_grid_cell_wrapper.js +32 -31
  77. package/lib/components/datagrid/body/cell/index.js +2 -2
  78. package/lib/components/datagrid/body/data_grid_body.js +13 -0
  79. package/lib/components/datagrid/body/data_grid_body_custom.js +51 -35
  80. package/lib/components/datagrid/body/data_grid_body_virtualized.js +83 -55
  81. package/lib/components/datagrid/body/data_grid_row_manager.js +5 -3
  82. package/lib/components/datagrid/body/footer/use_data_grid_footer.js +1 -2
  83. package/lib/components/datagrid/body/header/data_grid_control_header_cell.js +8 -4
  84. package/lib/components/datagrid/body/header/data_grid_header_cell.js +72 -52
  85. package/lib/components/datagrid/body/header/data_grid_header_row.js +14 -550
  86. package/lib/components/datagrid/body/header/use_data_grid_header.js +7 -6
  87. package/lib/components/datagrid/controls/column_selector.js +126 -123
  88. package/lib/components/datagrid/controls/column_sorting.js +615 -110
  89. package/lib/components/datagrid/controls/column_sorting_draggable.js +27 -22
  90. package/lib/components/datagrid/controls/display_selector.js +109 -107
  91. package/lib/components/datagrid/data_grid.a11y.js +13 -12
  92. package/lib/components/datagrid/data_grid.js +43 -20
  93. package/lib/components/datagrid/utils/col_widths.js +12 -8
  94. package/lib/components/datagrid/utils/focus.js +10 -8
  95. package/lib/components/datagrid/utils/grid_height_width.js +29 -28
  96. package/lib/components/datagrid/utils/ref.js +1 -1
  97. package/lib/components/datagrid/utils/row_heights.js +1 -1
  98. package/lib/components/datagrid/utils/sorting.js +31 -29
  99. package/lib/components/date_picker/super_date_picker/super_date_picker.js +9 -0
  100. package/lib/components/date_picker/super_date_picker/super_update_button.js +57 -29
  101. package/lib/components/flex/flex_grid.js +23 -7
  102. package/lib/components/flex/flex_grid.styles.js +13 -6
  103. package/lib/components/flex/flex_group.js +10 -10
  104. package/lib/components/flex/flex_item.js +13 -13
  105. package/lib/components/flex/flex_item.styles.js +107 -122
  106. package/lib/components/flyout/flyout.js +16 -18
  107. package/lib/components/header/header_breadcrumbs/header_breadcrumbs.js +3 -5
  108. package/lib/components/modal/confirm_modal.js +2 -1
  109. package/lib/components/modal/modal.js +12 -3
  110. package/lib/components/observer/resize_observer/resize_observer.js +15 -24
  111. package/lib/components/spacer/spacer.js +1 -2
  112. package/lib/components/toast/global_toast_list.js +68 -71
  113. package/lib/components/toast/toast.js +25 -40
  114. package/lib/components/toast/toast.styles.js +11 -25
  115. package/lib/services/color/eui_palettes.js +24 -14
  116. package/lib/services/color/index.js +14 -0
  117. package/lib/services/hooks/index.js +11 -0
  118. package/lib/services/hooks/useDeepEqual.js +30 -0
  119. package/lib/services/index.js +15 -1
  120. package/optimize/es/components/breadcrumbs/_breadcrumb_content.js +153 -0
  121. package/optimize/es/components/breadcrumbs/_breadcrumb_content.styles.js +48 -0
  122. package/optimize/es/components/breadcrumbs/breadcrumb.js +10 -110
  123. package/optimize/es/components/breadcrumbs/breadcrumb.styles.js +5 -27
  124. package/optimize/es/components/breadcrumbs/breadcrumbs.js +4 -4
  125. package/optimize/es/components/breadcrumbs/types.js +1 -0
  126. package/optimize/es/components/button/button_group/button_group.js +2 -2
  127. package/optimize/es/components/button/button_group/button_group.styles.js +1 -1
  128. package/optimize/es/components/button/button_group/button_group_button.js +36 -4
  129. package/optimize/es/components/button/button_group/button_group_button.styles.js +39 -3
  130. package/optimize/es/components/datagrid/body/cell/data_grid_cell.js +80 -55
  131. package/optimize/es/components/datagrid/body/cell/data_grid_cell_actions.js +24 -18
  132. package/optimize/es/components/datagrid/body/cell/data_grid_cell_popover.js +64 -56
  133. package/optimize/es/components/datagrid/body/cell/data_grid_cell_wrapper.js +32 -31
  134. package/optimize/es/components/datagrid/body/cell/index.js +1 -1
  135. package/optimize/es/components/datagrid/body/data_grid_body_custom.js +39 -36
  136. package/optimize/es/components/datagrid/body/data_grid_body_virtualized.js +69 -49
  137. package/optimize/es/components/datagrid/body/data_grid_row_manager.js +6 -4
  138. package/optimize/es/components/datagrid/body/footer/use_data_grid_footer.js +1 -2
  139. package/optimize/es/components/datagrid/body/header/data_grid_control_header_cell.js +4 -3
  140. package/optimize/es/components/datagrid/body/header/data_grid_header_cell.js +65 -49
  141. package/optimize/es/components/datagrid/body/header/data_grid_header_row.js +15 -13
  142. package/optimize/es/components/datagrid/body/header/use_data_grid_header.js +7 -6
  143. package/optimize/es/components/datagrid/controls/column_selector.js +126 -123
  144. package/optimize/es/components/datagrid/controls/column_sorting.js +121 -103
  145. package/optimize/es/components/datagrid/controls/column_sorting_draggable.js +24 -22
  146. package/optimize/es/components/datagrid/controls/display_selector.js +109 -107
  147. package/optimize/es/components/datagrid/data_grid.a11y.js +13 -12
  148. package/optimize/es/components/datagrid/data_grid.js +45 -22
  149. package/optimize/es/components/datagrid/utils/col_widths.js +9 -5
  150. package/optimize/es/components/datagrid/utils/focus.js +10 -8
  151. package/optimize/es/components/datagrid/utils/grid_height_width.js +31 -30
  152. package/optimize/es/components/datagrid/utils/ref.js +1 -1
  153. package/optimize/es/components/datagrid/utils/row_heights.js +2 -2
  154. package/optimize/es/components/datagrid/utils/sorting.js +29 -27
  155. package/optimize/es/components/date_picker/super_date_picker/super_update_button.js +49 -29
  156. package/optimize/es/components/flex/flex_grid.js +19 -8
  157. package/optimize/es/components/flex/flex_grid.styles.js +13 -6
  158. package/optimize/es/components/flex/flex_group.js +9 -10
  159. package/optimize/es/components/flex/flex_item.js +9 -11
  160. package/optimize/es/components/flex/flex_item.styles.js +107 -122
  161. package/optimize/es/components/flyout/flyout.js +16 -18
  162. package/optimize/es/components/header/header_breadcrumbs/header_breadcrumbs.js +3 -5
  163. package/optimize/es/components/modal/confirm_modal.js +2 -1
  164. package/optimize/es/components/modal/modal.js +6 -2
  165. package/optimize/es/components/observer/resize_observer/resize_observer.js +15 -24
  166. package/optimize/es/components/spacer/spacer.js +2 -3
  167. package/optimize/es/components/toast/global_toast_list.js +70 -73
  168. package/optimize/es/components/toast/toast.js +27 -42
  169. package/optimize/es/components/toast/toast.styles.js +2 -17
  170. package/optimize/es/services/color/eui_palettes.js +21 -13
  171. package/optimize/es/services/color/index.js +1 -1
  172. package/optimize/es/services/hooks/index.js +1 -0
  173. package/optimize/es/services/hooks/useDeepEqual.js +23 -0
  174. package/optimize/es/services/index.js +1 -1
  175. package/optimize/lib/components/breadcrumbs/_breadcrumb_content.js +163 -0
  176. package/optimize/lib/components/breadcrumbs/_breadcrumb_content.styles.js +55 -0
  177. package/optimize/lib/components/breadcrumbs/breadcrumb.js +10 -113
  178. package/optimize/lib/components/breadcrumbs/breadcrumb.styles.js +5 -29
  179. package/optimize/lib/components/breadcrumbs/breadcrumbs.js +3 -3
  180. package/optimize/lib/components/breadcrumbs/types.js +5 -0
  181. package/optimize/lib/components/button/button_group/button_group.js +2 -2
  182. package/optimize/lib/components/button/button_group/button_group.styles.js +1 -1
  183. package/optimize/lib/components/button/button_group/button_group_button.js +37 -5
  184. package/optimize/lib/components/button/button_group/button_group_button.styles.js +45 -11
  185. package/optimize/lib/components/datagrid/body/cell/data_grid_cell.js +78 -54
  186. package/optimize/lib/components/datagrid/body/cell/data_grid_cell_actions.js +24 -18
  187. package/optimize/lib/components/datagrid/body/cell/data_grid_cell_popover.js +63 -55
  188. package/optimize/lib/components/datagrid/body/cell/data_grid_cell_wrapper.js +32 -31
  189. package/optimize/lib/components/datagrid/body/cell/index.js +2 -2
  190. package/optimize/lib/components/datagrid/body/data_grid_body_custom.js +38 -35
  191. package/optimize/lib/components/datagrid/body/data_grid_body_virtualized.js +70 -50
  192. package/optimize/lib/components/datagrid/body/data_grid_row_manager.js +5 -3
  193. package/optimize/lib/components/datagrid/body/footer/use_data_grid_footer.js +1 -2
  194. package/optimize/lib/components/datagrid/body/header/data_grid_control_header_cell.js +8 -4
  195. package/optimize/lib/components/datagrid/body/header/data_grid_header_cell.js +65 -49
  196. package/optimize/lib/components/datagrid/body/header/data_grid_header_row.js +14 -12
  197. package/optimize/lib/components/datagrid/body/header/use_data_grid_header.js +7 -6
  198. package/optimize/lib/components/datagrid/controls/column_selector.js +126 -123
  199. package/optimize/lib/components/datagrid/controls/column_sorting.js +125 -107
  200. package/optimize/lib/components/datagrid/controls/column_sorting_draggable.js +27 -22
  201. package/optimize/lib/components/datagrid/controls/display_selector.js +109 -107
  202. package/optimize/lib/components/datagrid/data_grid.a11y.js +13 -12
  203. package/optimize/lib/components/datagrid/data_grid.js +43 -20
  204. package/optimize/lib/components/datagrid/utils/col_widths.js +9 -5
  205. package/optimize/lib/components/datagrid/utils/focus.js +10 -8
  206. package/optimize/lib/components/datagrid/utils/grid_height_width.js +29 -28
  207. package/optimize/lib/components/datagrid/utils/ref.js +1 -1
  208. package/optimize/lib/components/datagrid/utils/row_heights.js +1 -1
  209. package/optimize/lib/components/datagrid/utils/sorting.js +31 -29
  210. package/optimize/lib/components/date_picker/super_date_picker/super_update_button.js +49 -29
  211. package/optimize/lib/components/flex/flex_grid.js +21 -7
  212. package/optimize/lib/components/flex/flex_grid.styles.js +13 -6
  213. package/optimize/lib/components/flex/flex_group.js +9 -9
  214. package/optimize/lib/components/flex/flex_item.js +13 -13
  215. package/optimize/lib/components/flex/flex_item.styles.js +107 -122
  216. package/optimize/lib/components/flyout/flyout.js +16 -18
  217. package/optimize/lib/components/header/header_breadcrumbs/header_breadcrumbs.js +3 -5
  218. package/optimize/lib/components/modal/confirm_modal.js +2 -1
  219. package/optimize/lib/components/modal/modal.js +6 -2
  220. package/optimize/lib/components/observer/resize_observer/resize_observer.js +15 -24
  221. package/optimize/lib/components/spacer/spacer.js +1 -2
  222. package/optimize/lib/components/toast/global_toast_list.js +68 -71
  223. package/optimize/lib/components/toast/toast.js +25 -40
  224. package/optimize/lib/components/toast/toast.styles.js +11 -25
  225. package/optimize/lib/services/color/eui_palettes.js +24 -14
  226. package/optimize/lib/services/color/index.js +14 -0
  227. package/optimize/lib/services/hooks/index.js +11 -0
  228. package/optimize/lib/services/hooks/useDeepEqual.js +30 -0
  229. package/optimize/lib/services/index.js +15 -1
  230. package/package.json +2 -2
  231. package/test-env/components/breadcrumbs/_breadcrumb_content.js +363 -0
  232. package/test-env/components/breadcrumbs/_breadcrumb_content.styles.js +55 -0
  233. package/test-env/components/breadcrumbs/breadcrumb.js +11 -326
  234. package/test-env/components/breadcrumbs/breadcrumb.styles.js +5 -29
  235. package/test-env/components/breadcrumbs/breadcrumbs.js +3 -3
  236. package/test-env/components/breadcrumbs/types.js +5 -0
  237. package/test-env/components/button/button_group/button_group.js +16 -2
  238. package/test-env/components/button/button_group/button_group.styles.js +1 -1
  239. package/test-env/components/button/button_group/button_group_button.js +56 -5
  240. package/test-env/components/button/button_group/button_group_button.styles.js +45 -11
  241. package/test-env/components/datagrid/body/cell/data_grid_cell.js +95 -57
  242. package/test-env/components/datagrid/body/cell/data_grid_cell_actions.js +24 -18
  243. package/test-env/components/datagrid/body/cell/data_grid_cell_popover.js +63 -55
  244. package/test-env/components/datagrid/body/cell/data_grid_cell_wrapper.js +32 -31
  245. package/test-env/components/datagrid/body/cell/index.js +2 -2
  246. package/test-env/components/datagrid/body/data_grid_body.js +13 -0
  247. package/test-env/components/datagrid/body/data_grid_body_custom.js +51 -35
  248. package/test-env/components/datagrid/body/data_grid_body_virtualized.js +83 -55
  249. package/test-env/components/datagrid/body/data_grid_row_manager.js +5 -3
  250. package/test-env/components/datagrid/body/footer/use_data_grid_footer.js +1 -2
  251. package/test-env/components/datagrid/body/header/data_grid_control_header_cell.js +8 -4
  252. package/test-env/components/datagrid/body/header/data_grid_header_cell.js +72 -52
  253. package/test-env/components/datagrid/body/header/data_grid_header_row.js +14 -550
  254. package/test-env/components/datagrid/body/header/use_data_grid_header.js +7 -6
  255. package/test-env/components/datagrid/controls/column_selector.js +126 -123
  256. package/test-env/components/datagrid/controls/column_sorting.js +607 -106
  257. package/test-env/components/datagrid/controls/column_sorting_draggable.js +27 -22
  258. package/test-env/components/datagrid/controls/display_selector.js +109 -107
  259. package/test-env/components/datagrid/data_grid.a11y.js +13 -12
  260. package/test-env/components/datagrid/data_grid.js +43 -20
  261. package/test-env/components/datagrid/utils/col_widths.js +9 -5
  262. package/test-env/components/datagrid/utils/focus.js +10 -8
  263. package/test-env/components/datagrid/utils/grid_height_width.js +29 -28
  264. package/test-env/components/datagrid/utils/ref.js +1 -1
  265. package/test-env/components/datagrid/utils/row_heights.js +1 -1
  266. package/test-env/components/datagrid/utils/sorting.js +31 -29
  267. package/test-env/components/date_picker/super_date_picker/super_date_picker.js +9 -0
  268. package/test-env/components/date_picker/super_date_picker/super_update_button.js +57 -29
  269. package/test-env/components/flex/flex_grid.js +21 -7
  270. package/test-env/components/flex/flex_grid.styles.js +13 -6
  271. package/test-env/components/flex/flex_group.js +10 -10
  272. package/test-env/components/flex/flex_item.js +13 -13
  273. package/test-env/components/flex/flex_item.styles.js +107 -122
  274. package/test-env/components/header/header_breadcrumbs/header_breadcrumbs.js +3 -5
  275. package/test-env/components/modal/confirm_modal.js +2 -1
  276. package/test-env/components/modal/modal.js +12 -3
  277. package/test-env/components/spacer/spacer.js +1 -2
  278. package/test-env/components/toast/global_toast_list.js +68 -71
  279. package/test-env/components/toast/toast.js +25 -40
  280. package/test-env/components/toast/toast.styles.js +11 -25
  281. package/test-env/services/color/eui_palettes.js +24 -14
  282. package/test-env/services/color/index.js +14 -0
  283. package/test-env/services/hooks/index.js +11 -0
  284. package/test-env/services/hooks/useDeepEqual.js +30 -0
  285. package/test-env/services/index.js +15 -1
  286. package/src/themes/charts/theme.scss +0 -5
@@ -27,10 +27,11 @@ export var useDataGridHeader = function useDataGridHeader(props) {
27
27
  return ___EmotionJSX(EuiDataGridHeaderRow, _extends({
28
28
  ref: setHeaderRowRef
29
29
  }, props));
30
- }, Object.values(props)); // eslint-disable-line react-hooks/exhaustive-deps
31
-
32
- return {
33
- headerRow: headerRow,
34
- headerRowHeight: headerRowHeight
35
- };
30
+ }, [props]);
31
+ return useMemo(function () {
32
+ return {
33
+ headerRow: headerRow,
34
+ headerRowHeight: headerRowHeight
35
+ };
36
+ }, [headerRow, headerRowHeight]);
36
37
  };
@@ -71,10 +71,6 @@ export var useDataGridColumnSelector = function useDataGridColumnSelector(availa
71
71
  }, [sortedColumns, columnSearchText, displayValues]);
72
72
  var isDragEnabled = allowColumnReorder && columnSearchText.length === 0; // only allow drag-and-drop when not filtering columns
73
73
  var dragHandleAriaLabel = useEuiI18n('euiColumnSelector.dragHandleAriaLabel', 'Drag handle');
74
- var buttonText = ___EmotionJSX(EuiI18n, {
75
- token: "euiColumnSelector.button",
76
- default: "Columns"
77
- });
78
74
  var orderedVisibleColumns = useMemo(function () {
79
75
  return visibleColumns.map(function (columnId) {
80
76
  return availableColumns.find(function (_ref3) {
@@ -86,127 +82,132 @@ export var useDataGridColumnSelector = function useDataGridColumnSelector(availa
86
82
  return column != null;
87
83
  });
88
84
  }, [availableColumns, visibleColumns]);
89
- var columnSelector = allowColumnHiding || allowColumnReorder ? ___EmotionJSX(EuiPopover, {
90
- "data-test-subj": "dataGridColumnSelectorPopover",
91
- isOpen: isOpen,
92
- closePopover: function closePopover() {
93
- return setIsOpen(false);
94
- },
95
- anchorPosition: "downLeft",
96
- panelPaddingSize: "s",
97
- hasDragDrop: true,
98
- button: ___EmotionJSX(EuiDataGridToolbarControl, {
99
- badgeContent: numberOfHiddenFields > 0 ? "".concat(orderedVisibleColumns.length, "/").concat(availableColumns.length) : availableColumns.length,
100
- iconType: "tableDensityNormal",
101
- "data-test-subj": "dataGridColumnSelectorButton",
102
- onClick: function onClick() {
103
- return setIsOpen(!isOpen);
104
- }
105
- }, buttonText)
106
- }, allowColumnHiding && ___EmotionJSX(EuiPopoverTitle, null, ___EmotionJSX(EuiI18n, {
107
- tokens: ['euiColumnSelector.search', 'euiColumnSelector.searchcolumns'],
108
- defaults: ['Search', 'Search columns']
109
- }, function (_ref4) {
110
- var _ref5 = _slicedToArray(_ref4, 2),
111
- search = _ref5[0],
112
- searchcolumns = _ref5[1];
113
- return ___EmotionJSX(EuiFieldText, {
114
- compressed: true,
115
- placeholder: search,
116
- "aria-label": searchcolumns,
117
- value: columnSearchText,
118
- onChange: function onChange(e) {
119
- return setColumnSearchText(e.currentTarget.value);
85
+ var columnSelector = useMemo(function () {
86
+ return allowColumnHiding || allowColumnReorder ? ___EmotionJSX(EuiPopover, {
87
+ "data-test-subj": "dataGridColumnSelectorPopover",
88
+ isOpen: isOpen,
89
+ closePopover: function closePopover() {
90
+ return setIsOpen(false);
120
91
  },
121
- "data-test-subj": "dataGridColumnSelectorSearch"
122
- });
123
- })), ___EmotionJSX(EuiDragDropContext, {
124
- onDragEnd: onDragEnd
125
- }, ___EmotionJSX(EuiDroppable, {
126
- droppableId: "columnOrder",
127
- isDropDisabled: !isDragEnabled,
128
- className: "euiDataGrid__controlScroll"
129
- }, ___EmotionJSX(React.Fragment, null, filteredColumns.map(function (id, index) {
130
- return ___EmotionJSX(EuiDraggable, {
131
- key: id,
132
- draggableId: id,
133
- index: index,
134
- isDragDisabled: !isDragEnabled,
135
- hasInteractiveChildren: true,
136
- customDragHandle: true
137
- }, function (provided, state) {
138
- return ___EmotionJSX("div", {
139
- className: classNames('euiDataGridColumnSelector__item', {
140
- 'euiDataGridColumnSelector__item-isDragging': state.isDragging
141
- }),
142
- "data-test-subj": "dataGridColumnSelectorColumnItem-".concat(id)
143
- }, ___EmotionJSX(EuiFlexGroup, {
144
- responsive: false,
145
- gutterSize: "s",
146
- alignItems: "center"
147
- }, allowColumnHiding && ___EmotionJSX(EuiFlexItem, {
148
- grow: false
149
- }, ___EmotionJSX(EuiSwitch, {
150
- name: id,
151
- label: displayValues[id] || id,
152
- showLabel: false,
153
- checked: visibleColumnIds.has(id),
92
+ anchorPosition: "downLeft",
93
+ panelPaddingSize: "s",
94
+ hasDragDrop: true,
95
+ button: ___EmotionJSX(EuiDataGridToolbarControl, {
96
+ badgeContent: numberOfHiddenFields > 0 ? "".concat(orderedVisibleColumns.length, "/").concat(availableColumns.length) : availableColumns.length,
97
+ iconType: "tableDensityNormal",
98
+ "data-test-subj": "dataGridColumnSelectorButton",
99
+ onClick: function onClick() {
100
+ return setIsOpen(!isOpen);
101
+ }
102
+ }, ___EmotionJSX(EuiI18n, {
103
+ token: "euiColumnSelector.button",
104
+ default: "Columns"
105
+ }))
106
+ }, allowColumnHiding && ___EmotionJSX(EuiPopoverTitle, null, ___EmotionJSX(EuiI18n, {
107
+ tokens: ['euiColumnSelector.search', 'euiColumnSelector.searchcolumns'],
108
+ defaults: ['Search', 'Search columns']
109
+ }, function (_ref4) {
110
+ var _ref5 = _slicedToArray(_ref4, 2),
111
+ search = _ref5[0],
112
+ searchcolumns = _ref5[1];
113
+ return ___EmotionJSX(EuiFieldText, {
154
114
  compressed: true,
155
- className: "euiSwitch--mini",
156
- onChange: function onChange(event) {
157
- var checked = event.target.checked;
158
- var nextVisibleColumns = sortedColumns.filter(function (columnId) {
159
- return checked ? visibleColumnIds.has(columnId) || id === columnId : visibleColumnIds.has(columnId) && id !== columnId;
160
- });
161
- setVisibleColumns(nextVisibleColumns);
115
+ placeholder: search,
116
+ "aria-label": searchcolumns,
117
+ value: columnSearchText,
118
+ onChange: function onChange(e) {
119
+ return setColumnSearchText(e.currentTarget.value);
162
120
  },
163
- "data-test-subj": "dataGridColumnSelectorToggleColumnVisibility-".concat(id)
164
- })), ___EmotionJSX(EuiFlexItem
165
- // This extra column name flex item affords the column more grabbable real estate
166
- // for mouse users, while hiding repetition for keyboard/screen reader users
167
- , _extends({}, provided.dragHandleProps, {
168
- "aria-hidden": true,
169
- tabIndex: -1
170
- }), ___EmotionJSX("span", {
171
- className: "euiDataGridColumnSelector__itemLabel"
172
- }, displayValues[id] || id)), isDragEnabled && ___EmotionJSX(EuiFlexItem, _extends({
173
- grow: false
174
- }, provided.dragHandleProps, {
175
- "aria-label": dragHandleAriaLabel
176
- }), ___EmotionJSX(EuiIcon, {
177
- type: "grab",
178
- color: "subdued"
179
- }))));
180
- });
181
- })))), allowColumnHiding && ___EmotionJSX(EuiPopoverFooter, null, ___EmotionJSX(EuiFlexGroup, {
182
- gutterSize: "s",
183
- responsive: false,
184
- justifyContent: "spaceBetween"
185
- }, ___EmotionJSX(EuiFlexItem, {
186
- grow: false
187
- }, ___EmotionJSX(EuiButtonEmpty, {
188
- size: "xs",
189
- flush: "left",
190
- onClick: function onClick() {
191
- return setVisibleColumns(sortedColumns);
192
- },
193
- "data-test-subj": "dataGridColumnSelectorShowAllButton"
194
- }, ___EmotionJSX(EuiI18n, {
195
- token: "euiColumnSelector.selectAll",
196
- default: "Show all"
197
- }))), ___EmotionJSX(EuiFlexItem, {
198
- grow: false
199
- }, ___EmotionJSX(EuiButtonEmpty, {
200
- size: "xs",
201
- flush: "right",
202
- onClick: function onClick() {
203
- return setVisibleColumns([]);
204
- },
205
- "data-test-subj": "dataGridColumnSelectorHideAllButton"
206
- }, ___EmotionJSX(EuiI18n, {
207
- token: "euiColumnSelector.hideAll",
208
- default: "Hide all"
209
- })))))) : null;
121
+ "data-test-subj": "dataGridColumnSelectorSearch"
122
+ });
123
+ })), ___EmotionJSX(EuiDragDropContext, {
124
+ onDragEnd: onDragEnd
125
+ }, ___EmotionJSX(EuiDroppable, {
126
+ droppableId: "columnOrder",
127
+ isDropDisabled: !isDragEnabled,
128
+ className: "euiDataGrid__controlScroll"
129
+ }, ___EmotionJSX(React.Fragment, null, filteredColumns.map(function (id, index) {
130
+ return ___EmotionJSX(EuiDraggable, {
131
+ key: id,
132
+ draggableId: id,
133
+ index: index,
134
+ isDragDisabled: !isDragEnabled,
135
+ hasInteractiveChildren: true,
136
+ customDragHandle: true
137
+ }, function (provided, state) {
138
+ return ___EmotionJSX("div", {
139
+ className: classNames('euiDataGridColumnSelector__item', {
140
+ 'euiDataGridColumnSelector__item-isDragging': state.isDragging
141
+ }),
142
+ "data-test-subj": "dataGridColumnSelectorColumnItem-".concat(id)
143
+ }, ___EmotionJSX(EuiFlexGroup, {
144
+ responsive: false,
145
+ gutterSize: "s",
146
+ alignItems: "center"
147
+ }, allowColumnHiding && ___EmotionJSX(EuiFlexItem, {
148
+ grow: false
149
+ }, ___EmotionJSX(EuiSwitch, {
150
+ name: id,
151
+ label: displayValues[id] || id,
152
+ showLabel: false,
153
+ checked: visibleColumnIds.has(id),
154
+ compressed: true,
155
+ className: "euiSwitch--mini",
156
+ onChange: function onChange(event) {
157
+ var checked = event.target.checked;
158
+ var nextVisibleColumns = sortedColumns.filter(function (columnId) {
159
+ return checked ? visibleColumnIds.has(columnId) || id === columnId : visibleColumnIds.has(columnId) && id !== columnId;
160
+ });
161
+ setVisibleColumns(nextVisibleColumns);
162
+ },
163
+ "data-test-subj": "dataGridColumnSelectorToggleColumnVisibility-".concat(id)
164
+ })), ___EmotionJSX(EuiFlexItem
165
+ // This extra column name flex item affords the column more grabbable real estate
166
+ // for mouse users, while hiding repetition for keyboard/screen reader users
167
+ , _extends({}, provided.dragHandleProps, {
168
+ "aria-hidden": true,
169
+ tabIndex: -1
170
+ }), ___EmotionJSX("span", {
171
+ className: "euiDataGridColumnSelector__itemLabel"
172
+ }, displayValues[id] || id)), isDragEnabled && ___EmotionJSX(EuiFlexItem, _extends({
173
+ grow: false
174
+ }, provided.dragHandleProps, {
175
+ "aria-label": dragHandleAriaLabel
176
+ }), ___EmotionJSX(EuiIcon, {
177
+ type: "grab",
178
+ color: "subdued"
179
+ }))));
180
+ });
181
+ })))), allowColumnHiding && ___EmotionJSX(EuiPopoverFooter, null, ___EmotionJSX(EuiFlexGroup, {
182
+ gutterSize: "s",
183
+ responsive: false,
184
+ justifyContent: "spaceBetween"
185
+ }, ___EmotionJSX(EuiFlexItem, {
186
+ grow: false
187
+ }, ___EmotionJSX(EuiButtonEmpty, {
188
+ size: "xs",
189
+ flush: "left",
190
+ onClick: function onClick() {
191
+ return setVisibleColumns(sortedColumns);
192
+ },
193
+ "data-test-subj": "dataGridColumnSelectorShowAllButton"
194
+ }, ___EmotionJSX(EuiI18n, {
195
+ token: "euiColumnSelector.selectAll",
196
+ default: "Show all"
197
+ }))), ___EmotionJSX(EuiFlexItem, {
198
+ grow: false
199
+ }, ___EmotionJSX(EuiButtonEmpty, {
200
+ size: "xs",
201
+ flush: "right",
202
+ onClick: function onClick() {
203
+ return setVisibleColumns([]);
204
+ },
205
+ "data-test-subj": "dataGridColumnSelectorHideAllButton"
206
+ }, ___EmotionJSX(EuiI18n, {
207
+ token: "euiColumnSelector.hideAll",
208
+ default: "Hide all"
209
+ })))))) : null;
210
+ }, [availableColumns.length, numberOfHiddenFields, orderedVisibleColumns.length, allowColumnHiding, allowColumnReorder, isOpen, columnSearchText, displayValues, visibleColumnIds, sortedColumns, setVisibleColumns, setIsOpen, onDragEnd, isDragEnabled, dragHandleAriaLabel, filteredColumns]);
210
211
 
211
212
  /**
212
213
  * Used for moving columns left/right, available in the headers actions menu
@@ -222,5 +223,7 @@ export var useDataGridColumnSelector = function useDataGridColumnSelector(availa
222
223
  nextSortedColumns.splice(moveToIdx, 0, fromColId);
223
224
  setColumns(nextSortedColumns);
224
225
  }, [setColumns, sortedColumns]);
225
- return [columnSelector, orderedVisibleColumns, setVisibleColumns, switchColumnPos];
226
+ return useMemo(function () {
227
+ return [columnSelector, orderedVisibleColumns, setVisibleColumns, switchColumnPos];
228
+ }, [columnSelector, orderedVisibleColumns, setVisibleColumns, switchColumnPos]);
226
229
  };
@@ -1,5 +1,8 @@
1
1
  import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
2
2
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
+ import _extends from "@babel/runtime/helpers/extends";
4
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
5
+ var _excluded = ["sorting"];
3
6
  /*
4
7
  * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
5
8
  * or more contributor license agreements. Licensed under the Elastic License
@@ -8,7 +11,7 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
8
11
  * Side Public License, v 1.
9
12
  */
10
13
 
11
- import React, { useEffect, useState } from 'react';
14
+ import React, { useEffect, useState, useMemo, useCallback, memo } from 'react';
12
15
  import { EuiButtonEmpty } from '../../button';
13
16
  import { EuiDragDropContext, euiDragDropReorder, EuiDroppable } from '../../drag_and_drop';
14
17
  import { EuiFlexGroup, EuiFlexItem } from '../../flex';
@@ -20,79 +23,105 @@ import { EuiDataGridToolbarControl } from './data_grid_toolbar_control';
20
23
  import { EuiDataGridColumnSortingDraggable } from './column_sorting_draggable';
21
24
  import { getDetailsForSchema } from '../utils/data_grid_schema';
22
25
  import { jsx as ___EmotionJSX } from "@emotion/react";
23
- export var useDataGridColumnSorting = function useDataGridColumnSorting(columns, sorting, schema, schemaDetectors, displayValues) {
26
+ export var useDataGridColumnSorting = function useDataGridColumnSorting(_ref) {
27
+ var sorting = _ref.sorting,
28
+ rest = _objectWithoutProperties(_ref, _excluded);
29
+ return sorting == null ? null : ___EmotionJSX(DataGridSortingControl, _extends({
30
+ sorting: sorting
31
+ }, rest));
32
+ };
33
+ export var DataGridSortingControl = /*#__PURE__*/memo(function (_ref2) {
34
+ var columns = _ref2.columns,
35
+ sorting = _ref2.sorting,
36
+ schema = _ref2.schema,
37
+ schemaDetectors = _ref2.schemaDetectors,
38
+ displayValues = _ref2.displayValues;
24
39
  var _useState = useState(false),
25
40
  _useState2 = _slicedToArray(_useState, 2),
26
41
  isOpen = _useState2[0],
27
42
  setIsOpen = _useState2[1];
43
+ var sortingButtonText = useEuiI18n('euiColumnSorting.button', 'Sort fields');
44
+ var sortFieldAriaLabel = useEuiI18n('euiColumnSorting.sortFieldAriaLabel', 'Sort by: ');
28
45
  var _useState3 = useState(false),
29
46
  _useState4 = _slicedToArray(_useState3, 2),
30
47
  availableColumnsIsOpen = _useState4[0],
31
48
  setAvailableColumnsIsOpen = _useState4[1];
49
+ var availableColumnIds = useMemo(function () {
50
+ return new Set(columns.map(function (_ref3) {
51
+ var id = _ref3.id;
52
+ return id;
53
+ }));
54
+ }, [columns]);
55
+
32
56
  // prune any non-existent/hidden columns from sorting
33
57
  useEffect(function () {
34
- if (sorting) {
35
- var nextSortingColumns = [];
36
- var availableColumnIds = new Set(columns.map(function (_ref) {
37
- var id = _ref.id;
38
- return id;
39
- }));
40
- for (var i = 0; i < sorting.columns.length; i++) {
41
- var column = sorting.columns[i];
42
- if (availableColumnIds.has(column.id)) {
43
- nextSortingColumns.push(column);
44
- }
58
+ var nextSortingColumns = [];
59
+ for (var i = 0; i < sorting.columns.length; i++) {
60
+ var column = sorting.columns[i];
61
+ if (availableColumnIds.has(column.id)) {
62
+ nextSortingColumns.push(column);
45
63
  }
64
+ }
46
65
 
47
- // if the column array lengths differ then the sorting columns have been pruned
48
- if (nextSortingColumns.length !== sorting.columns.length) {
49
- sorting.onSort(nextSortingColumns);
50
- }
66
+ // if the column array lengths differ then the sorting columns have been pruned
67
+ if (nextSortingColumns.length !== sorting.columns.length) {
68
+ sorting.onSort(nextSortingColumns);
51
69
  }
52
- }, [columns, sorting]);
53
- var sortingButtonText = useEuiI18n('euiColumnSorting.button', 'Sort fields');
54
- if (sorting == null) return null;
55
- var activeColumnIds = new Set(sorting.columns.map(function (_ref2) {
56
- var id = _ref2.id;
57
- return id;
58
- }));
59
- var _columns$reduce = columns.reduce(function (acc, column) {
60
- if (activeColumnIds.has(column.id)) {
61
- acc.activeColumns.push(column);
62
- } else {
63
- acc.inactiveColumns.push(column);
64
- }
65
- return acc;
66
- }, {
67
- activeColumns: [],
68
- inactiveColumns: []
69
- }),
70
- inactiveColumns = _columns$reduce.inactiveColumns;
71
- var onDragEnd = function onDragEnd(_ref3) {
72
- var sourceIndex = _ref3.source.index,
73
- destination = _ref3.destination;
70
+ }, [availableColumnIds, sorting]);
71
+ var _useMemo = useMemo(function () {
72
+ var activeColumnIds = new Set(sorting.columns.map(function (_ref4) {
73
+ var id = _ref4.id;
74
+ return id;
75
+ }));
76
+ return columns.reduce(function (acc, column) {
77
+ if (activeColumnIds.has(column.id)) {
78
+ acc.activeColumns.push(column);
79
+ } else {
80
+ acc.inactiveColumns.push(column);
81
+ }
82
+ return acc;
83
+ }, {
84
+ activeColumns: [],
85
+ inactiveColumns: []
86
+ });
87
+ }, [columns, sorting]),
88
+ inactiveColumns = _useMemo.inactiveColumns;
89
+ var onDragEnd = useCallback(function (_ref5) {
90
+ var sourceIndex = _ref5.source.index,
91
+ destination = _ref5.destination;
74
92
  if (destination) {
75
93
  var destinationIndex = destination.index;
76
94
  var nextColumns = euiDragDropReorder(sorting.columns, sourceIndex, destinationIndex);
77
95
  sorting.onSort(nextColumns);
78
96
  }
79
- };
80
- var schemaDetails = function schemaDetails(id) {
97
+ }, [sorting]);
98
+ var schemaDetails = useCallback(function (id) {
81
99
  return schema.hasOwnProperty(id) && schema[id].columnType != null ? getDetailsForSchema(schemaDetectors, schema[id].columnType) : null;
82
- };
83
- var inactiveSortableColumns = inactiveColumns.filter(function (_ref4) {
84
- var id = _ref4.id,
85
- isSortable = _ref4.isSortable;
86
- var schemaDetail = schemaDetails(id);
87
- var sortable = true;
88
- if (isSortable != null) {
89
- sortable = isSortable;
90
- } else if (schemaDetail != null) {
91
- sortable = schemaDetail.hasOwnProperty('isSortable') ? schemaDetail.isSortable : true;
92
- }
93
- return sortable;
94
- });
95
- var columnSorting = ___EmotionJSX(EuiPopover, {
100
+ }, [schema, schemaDetectors]);
101
+ var inactiveSortableColumns = useMemo(function () {
102
+ return inactiveColumns.filter(function (_ref6) {
103
+ var id = _ref6.id,
104
+ isSortable = _ref6.isSortable;
105
+ var schemaDetail = schemaDetails(id);
106
+ var sortable = true;
107
+ if (isSortable != null) {
108
+ sortable = isSortable;
109
+ } else if (schemaDetail != null) {
110
+ sortable = schemaDetail.hasOwnProperty('isSortable') ? schemaDetail.isSortable : true;
111
+ }
112
+ return sortable;
113
+ });
114
+ }, [inactiveColumns, schemaDetails]);
115
+ var onButtonClick = useCallback(function (id, defaultSortDirection) {
116
+ var _schemaDetails;
117
+ var nextColumns = _toConsumableArray(sorting.columns);
118
+ nextColumns.push({
119
+ id: id,
120
+ direction: defaultSortDirection || ((_schemaDetails = schemaDetails(id)) === null || _schemaDetails === void 0 ? void 0 : _schemaDetails.defaultSortDirection) || 'asc'
121
+ });
122
+ sorting.onSort(nextColumns);
123
+ }, [sorting, schemaDetails]);
124
+ return ___EmotionJSX(EuiPopover, {
96
125
  "data-test-subj": "dataGridColumnSortingPopover",
97
126
  isOpen: isOpen,
98
127
  closePopover: function closePopover() {
@@ -114,9 +143,9 @@ export var useDataGridColumnSorting = function useDataGridColumnSorting(columns,
114
143
  }, ___EmotionJSX(EuiDroppable, {
115
144
  droppableId: "columnSorting",
116
145
  className: "euiDataGrid__controlScroll"
117
- }, ___EmotionJSX(React.Fragment, null, sorting.columns.map(function (_ref5, index) {
118
- var id = _ref5.id,
119
- direction = _ref5.direction;
146
+ }, ___EmotionJSX(React.Fragment, null, sorting.columns.map(function (_ref7, index) {
147
+ var id = _ref7.id,
148
+ direction = _ref7.direction;
120
149
  return ___EmotionJSX(EuiDataGridColumnSortingDraggable, {
121
150
  key: id,
122
151
  id: id,
@@ -162,49 +191,38 @@ export var useDataGridColumnSorting = function useDataGridColumnSorting(columns,
162
191
  token: "euiColumnSorting.pickFields",
163
192
  default: "Pick fields to sort by"
164
193
  }))
165
- }, ___EmotionJSX(EuiI18n, {
166
- token: "euiColumnSorting.sortFieldAriaLabel",
167
- default: "Sort by: "
168
- }, function (sortFieldAriaLabel) {
169
- return ___EmotionJSX("div", {
170
- className: "euiDataGridColumnSorting__fieldList",
171
- role: "listbox"
172
- }, inactiveSortableColumns.map(function (_ref6) {
173
- var id = _ref6.id,
174
- defaultSortDirection = _ref6.defaultSortDirection;
175
- return ___EmotionJSX("button", {
176
- key: id,
177
- className: "euiDataGridColumnSorting__field",
178
- "aria-label": "".concat(sortFieldAriaLabel, " ").concat(id),
179
- role: "option",
180
- "aria-selected": "false",
181
- "data-test-subj": "dataGridColumnSortingPopoverColumnSelection-".concat(id),
182
- onClick: function onClick() {
183
- var _schemaDetails;
184
- var nextColumns = _toConsumableArray(sorting.columns);
185
- nextColumns.push({
186
- id: id,
187
- direction: defaultSortDirection || ((_schemaDetails = schemaDetails(id)) === null || _schemaDetails === void 0 ? void 0 : _schemaDetails.defaultSortDirection) || 'asc'
188
- });
189
- sorting.onSort(nextColumns);
190
- }
191
- }, ___EmotionJSX(EuiFlexGroup, {
192
- alignItems: "center",
193
- gutterSize: "s",
194
- component: "span",
195
- responsive: false
196
- }, ___EmotionJSX(EuiFlexItem, {
197
- grow: false
198
- }, ___EmotionJSX(EuiToken, {
199
- iconType: schemaDetails(id) != null ? getDetailsForSchema(schemaDetectors, schema[id].columnType).icon : 'tokenString',
200
- color: schemaDetails(id) != null ? getDetailsForSchema(schemaDetectors, schema[id].columnType).color : undefined
201
- })), ___EmotionJSX(EuiFlexItem, {
202
- grow: false
203
- }, ___EmotionJSX(EuiText, {
204
- size: "xs"
205
- }, displayValues[id]))));
206
- }));
207
- }))), sorting.columns.length > 0 ? ___EmotionJSX(EuiFlexItem, {
194
+ }, ___EmotionJSX("div", {
195
+ className: "euiDataGridColumnSorting__fieldList",
196
+ role: "listbox"
197
+ }, inactiveSortableColumns.map(function (_ref8) {
198
+ var id = _ref8.id,
199
+ defaultSortDirection = _ref8.defaultSortDirection;
200
+ return ___EmotionJSX("button", {
201
+ key: id,
202
+ className: "euiDataGridColumnSorting__field",
203
+ "aria-label": "".concat(sortFieldAriaLabel, " ").concat(id),
204
+ role: "option",
205
+ "aria-selected": "false",
206
+ "data-test-subj": "dataGridColumnSortingPopoverColumnSelection-".concat(id),
207
+ onClick: function onClick() {
208
+ return onButtonClick(id, defaultSortDirection);
209
+ }
210
+ }, ___EmotionJSX(EuiFlexGroup, {
211
+ alignItems: "center",
212
+ gutterSize: "s",
213
+ component: "span",
214
+ responsive: false
215
+ }, ___EmotionJSX(EuiFlexItem, {
216
+ grow: false
217
+ }, ___EmotionJSX(EuiToken, {
218
+ iconType: schemaDetails(id) != null ? getDetailsForSchema(schemaDetectors, schema[id].columnType).icon : 'tokenString',
219
+ color: schemaDetails(id) != null ? getDetailsForSchema(schemaDetectors, schema[id].columnType).color : undefined
220
+ })), ___EmotionJSX(EuiFlexItem, {
221
+ grow: false
222
+ }, ___EmotionJSX(EuiText, {
223
+ size: "xs"
224
+ }, displayValues[id]))));
225
+ })))), sorting.columns.length > 0 ? ___EmotionJSX(EuiFlexItem, {
208
226
  grow: false
209
227
  }, ___EmotionJSX(EuiButtonEmpty, {
210
228
  size: "xs",
@@ -217,5 +235,5 @@ export var useDataGridColumnSorting = function useDataGridColumnSorting(columns,
217
235
  token: "euiColumnSorting.clearAll",
218
236
  default: "Clear sorting"
219
237
  }))) : null)));
220
- return columnSorting;
221
- };
238
+ });
239
+ DataGridSortingControl.displayName = 'DataGridSortingControl';
@@ -10,7 +10,7 @@ var _excluded = ["id", "display", "direction", "index", "sorting", "schema", "sc
10
10
  * Side Public License, v 1.
11
11
  */
12
12
 
13
- import React from 'react';
13
+ import React, { useCallback } from 'react';
14
14
  import classNames from 'classnames';
15
15
  import { EuiScreenReaderOnly } from '../../accessibility';
16
16
  import { EuiButtonGroup, EuiButtonIcon } from '../../button';
@@ -54,6 +54,27 @@ export var EuiDataGridColumnSortingDraggable = function EuiDataGridColumnSorting
54
54
  'data-test-subj': "euiDataGridColumnSorting-sortColumn-".concat(id, "-desc")
55
55
  }];
56
56
  var dragHandleAriaLabel = useEuiI18n('euiColumnSortingDraggable.dragHandleAriaLabel', 'Drag handle');
57
+ var removeSort = useCallback(function () {
58
+ var nextColumns = _toConsumableArray(sorting.columns);
59
+ var columnIndex = nextColumns.map(function (_ref2) {
60
+ var id = _ref2.id;
61
+ return id;
62
+ }).indexOf(id);
63
+ nextColumns.splice(columnIndex, 1);
64
+ sorting.onSort(nextColumns);
65
+ }, [id, sorting]);
66
+ var toggleLegendHandler = useCallback(function (_, direction) {
67
+ var nextColumns = _toConsumableArray(sorting.columns);
68
+ var columnIndex = nextColumns.map(function (_ref3) {
69
+ var id = _ref3.id;
70
+ return id;
71
+ }).indexOf(id);
72
+ nextColumns.splice(columnIndex, 1, {
73
+ id: id,
74
+ direction: direction
75
+ });
76
+ sorting.onSort(nextColumns);
77
+ }, [id, sorting]);
57
78
  return ___EmotionJSX(EuiDraggable, _extends({
58
79
  draggableId: id,
59
80
  index: index,
@@ -91,15 +112,7 @@ export var EuiDataGridColumnSortingDraggable = function EuiDataGridColumnSorting
91
112
  className: "euiDataGridColumnSorting__button",
92
113
  "aria-label": removeSortLabel,
93
114
  iconType: "cross",
94
- onClick: function onClick() {
95
- var nextColumns = _toConsumableArray(sorting.columns);
96
- var columnIndex = nextColumns.map(function (_ref2) {
97
- var id = _ref2.id;
98
- return id;
99
- }).indexOf(id);
100
- nextColumns.splice(columnIndex, 1);
101
- sorting.onSort(nextColumns);
102
- }
115
+ onClick: removeSort
103
116
  });
104
117
  })), ___EmotionJSX(EuiFlexItem, _extends({
105
118
  className: "euiDataGridColumnSorting__name"
@@ -134,18 +147,7 @@ export var EuiDataGridColumnSortingDraggable = function EuiDataGridColumnSorting
134
147
  buttonSize: "compressed",
135
148
  className: "euiDataGridColumnSorting__order",
136
149
  idSelected: direction === 'asc' ? "".concat(id, "Asc") : "".concat(id, "Desc"),
137
- onChange: function onChange(_, direction) {
138
- var nextColumns = _toConsumableArray(sorting.columns);
139
- var columnIndex = nextColumns.map(function (_ref3) {
140
- var id = _ref3.id;
141
- return id;
142
- }).indexOf(id);
143
- nextColumns.splice(columnIndex, 1, {
144
- id: id,
145
- direction: direction
146
- });
147
- sorting.onSort(nextColumns);
148
- }
150
+ onChange: toggleLegendHandler
149
151
  });
150
152
  })), ___EmotionJSX(EuiFlexItem, _extends({
151
153
  grow: false