@elastic/eui 97.0.0 → 97.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 (161) hide show
  1. package/es/components/datagrid/body/cell/data_grid_cell.styles.js +4 -2
  2. package/es/components/datagrid/body/cell/focus_utils.js +14 -4
  3. package/es/components/datagrid/body/data_grid_body.js +2 -1
  4. package/es/components/datagrid/body/data_grid_body_custom.js +5 -2
  5. package/es/components/datagrid/body/data_grid_body_virtualized.js +8 -4
  6. package/es/components/datagrid/body/header/column_actions.js +262 -27
  7. package/es/components/datagrid/body/header/{data_grid_column_resizer.js → column_resizer.js} +10 -4
  8. package/es/components/datagrid/body/header/{data_grid_column_resizer.styles.js → column_resizer.styles.js} +6 -1
  9. package/es/components/datagrid/body/header/column_sorting.js +134 -0
  10. package/es/components/datagrid/body/header/data_grid_control_header_cell.js +3 -3
  11. package/es/components/datagrid/body/header/data_grid_header_cell.js +86 -305
  12. package/es/components/datagrid/body/header/data_grid_header_cell.styles.js +1 -1
  13. package/es/components/datagrid/body/header/data_grid_header_cell_wrapper.js +19 -17
  14. package/es/components/datagrid/body/header/data_grid_header_cell_wrapper.styles.js +1 -2
  15. package/es/components/datagrid/body/header/data_grid_header_row.js +25 -10
  16. package/es/components/datagrid/body/header/draggable_columns.js +301 -0
  17. package/es/components/datagrid/body/header/draggable_columns.styles.js +38 -0
  18. package/es/components/datagrid/data_grid.js +2 -1
  19. package/es/components/datagrid/data_grid.stories.utils.js +9 -6
  20. package/es/components/datagrid/utils/col_widths.js +4 -6
  21. package/es/components/datagrid/utils/focus.js +2 -2
  22. package/es/components/datagrid/utils/scrolling.js +13 -10
  23. package/es/components/date_picker/super_date_picker/date_popover/absolute_tab.js +8 -2
  24. package/es/components/date_picker/super_date_picker/date_popover/date_popover_button.js +8 -2
  25. package/es/components/date_picker/super_date_picker/date_popover/date_popover_content.js +8 -2
  26. package/es/components/date_picker/super_date_picker/super_date_picker.js +27 -5
  27. package/es/components/drag_and_drop/draggable.js +13 -5
  28. package/es/components/header/header.styles.js +6 -12
  29. package/es/components/header/header_links/header_links.js +1 -1
  30. package/es/components/header/header_links/header_links.styles.js +1 -0
  31. package/es/components/page_template/inner/page_inner.styles.js +3 -4
  32. package/es/components/tabs/tab.js +1 -1
  33. package/eui.d.ts +417 -307
  34. package/i18ntokens.json +175 -175
  35. package/lib/components/datagrid/body/cell/data_grid_cell.styles.js +4 -2
  36. package/lib/components/datagrid/body/cell/focus_utils.js +14 -4
  37. package/lib/components/datagrid/body/data_grid_body.js +2 -1
  38. package/lib/components/datagrid/body/data_grid_body_custom.js +5 -2
  39. package/lib/components/datagrid/body/data_grid_body_virtualized.js +8 -4
  40. package/lib/components/datagrid/body/header/column_actions.js +265 -29
  41. package/lib/components/datagrid/body/header/{data_grid_column_resizer.js → column_resizer.js} +11 -5
  42. package/{optimize/lib/components/datagrid/body/header/data_grid_column_resizer.styles.js → lib/components/datagrid/body/header/column_resizer.styles.js} +6 -1
  43. package/lib/components/datagrid/body/header/column_sorting.js +144 -0
  44. package/lib/components/datagrid/body/header/data_grid_control_header_cell.js +3 -3
  45. package/lib/components/datagrid/body/header/data_grid_header_cell.js +86 -305
  46. package/lib/components/datagrid/body/header/data_grid_header_cell.styles.js +1 -1
  47. package/lib/components/datagrid/body/header/data_grid_header_cell_wrapper.js +19 -17
  48. package/lib/components/datagrid/body/header/data_grid_header_cell_wrapper.styles.js +1 -2
  49. package/lib/components/datagrid/body/header/data_grid_header_row.js +24 -9
  50. package/lib/components/datagrid/body/header/draggable_columns.js +308 -0
  51. package/lib/components/datagrid/body/header/draggable_columns.styles.js +42 -0
  52. package/lib/components/datagrid/data_grid.js +2 -1
  53. package/lib/components/datagrid/data_grid.stories.utils.js +9 -6
  54. package/lib/components/datagrid/utils/col_widths.js +4 -6
  55. package/lib/components/datagrid/utils/focus.js +2 -2
  56. package/lib/components/datagrid/utils/scrolling.js +13 -10
  57. package/lib/components/date_picker/super_date_picker/date_popover/absolute_tab.js +8 -2
  58. package/lib/components/date_picker/super_date_picker/date_popover/date_popover_button.js +8 -2
  59. package/lib/components/date_picker/super_date_picker/date_popover/date_popover_content.js +8 -2
  60. package/lib/components/date_picker/super_date_picker/super_date_picker.js +27 -5
  61. package/lib/components/drag_and_drop/draggable.js +13 -5
  62. package/lib/components/header/header.styles.js +6 -12
  63. package/lib/components/header/header_links/header_links.js +1 -1
  64. package/lib/components/header/header_links/header_links.styles.js +1 -0
  65. package/lib/components/page_template/inner/page_inner.styles.js +3 -4
  66. package/lib/components/tabs/tab.js +1 -1
  67. package/optimize/es/components/datagrid/body/cell/data_grid_cell.styles.js +4 -2
  68. package/optimize/es/components/datagrid/body/cell/focus_utils.js +13 -4
  69. package/optimize/es/components/datagrid/body/data_grid_body_custom.js +3 -1
  70. package/optimize/es/components/datagrid/body/data_grid_body_virtualized.js +6 -3
  71. package/optimize/es/components/datagrid/body/header/column_actions.js +250 -26
  72. package/optimize/es/components/datagrid/body/header/{data_grid_column_resizer.js → column_resizer.js} +8 -3
  73. package/optimize/es/components/datagrid/body/header/{data_grid_column_resizer.styles.js → column_resizer.styles.js} +6 -1
  74. package/optimize/es/components/datagrid/body/header/column_sorting.js +134 -0
  75. package/optimize/es/components/datagrid/body/header/data_grid_control_header_cell.js +2 -2
  76. package/optimize/es/components/datagrid/body/header/data_grid_header_cell.js +82 -302
  77. package/optimize/es/components/datagrid/body/header/data_grid_header_cell.styles.js +1 -1
  78. package/optimize/es/components/datagrid/body/header/data_grid_header_cell_wrapper.js +15 -14
  79. package/optimize/es/components/datagrid/body/header/data_grid_header_cell_wrapper.styles.js +1 -2
  80. package/optimize/es/components/datagrid/body/header/data_grid_header_row.js +25 -10
  81. package/optimize/es/components/datagrid/body/header/draggable_columns.js +223 -0
  82. package/optimize/es/components/datagrid/body/header/draggable_columns.styles.js +38 -0
  83. package/optimize/es/components/datagrid/data_grid.js +2 -1
  84. package/optimize/es/components/datagrid/data_grid.stories.utils.js +7 -5
  85. package/optimize/es/components/datagrid/utils/col_widths.js +4 -6
  86. package/optimize/es/components/datagrid/utils/focus.js +2 -2
  87. package/optimize/es/components/datagrid/utils/scrolling.js +13 -10
  88. package/optimize/es/components/date_picker/super_date_picker/date_popover/absolute_tab.js +5 -1
  89. package/optimize/es/components/date_picker/super_date_picker/date_popover/date_popover_button.js +6 -2
  90. package/optimize/es/components/date_picker/super_date_picker/date_popover/date_popover_content.js +6 -2
  91. package/optimize/es/components/date_picker/super_date_picker/super_date_picker.js +11 -5
  92. package/optimize/es/components/drag_and_drop/draggable.js +8 -3
  93. package/optimize/es/components/header/header.styles.js +6 -12
  94. package/optimize/es/components/header/header_links/header_links.js +1 -1
  95. package/optimize/es/components/header/header_links/header_links.styles.js +1 -0
  96. package/optimize/es/components/page_template/inner/page_inner.styles.js +3 -4
  97. package/optimize/es/components/tabs/tab.js +1 -1
  98. package/optimize/lib/components/datagrid/body/cell/data_grid_cell.styles.js +4 -2
  99. package/optimize/lib/components/datagrid/body/cell/focus_utils.js +13 -4
  100. package/optimize/lib/components/datagrid/body/data_grid_body_custom.js +3 -1
  101. package/optimize/lib/components/datagrid/body/data_grid_body_virtualized.js +6 -3
  102. package/optimize/lib/components/datagrid/body/header/column_actions.js +253 -27
  103. package/optimize/lib/components/datagrid/body/header/{data_grid_column_resizer.js → column_resizer.js} +9 -4
  104. package/{test-env/components/datagrid/body/header/data_grid_column_resizer.styles.js → optimize/lib/components/datagrid/body/header/column_resizer.styles.js} +6 -1
  105. package/optimize/lib/components/datagrid/body/header/column_sorting.js +144 -0
  106. package/optimize/lib/components/datagrid/body/header/data_grid_control_header_cell.js +2 -2
  107. package/optimize/lib/components/datagrid/body/header/data_grid_header_cell.js +80 -300
  108. package/optimize/lib/components/datagrid/body/header/data_grid_header_cell.styles.js +1 -1
  109. package/optimize/lib/components/datagrid/body/header/data_grid_header_cell_wrapper.js +15 -14
  110. package/optimize/lib/components/datagrid/body/header/data_grid_header_cell_wrapper.styles.js +1 -2
  111. package/optimize/lib/components/datagrid/body/header/data_grid_header_row.js +24 -9
  112. package/optimize/lib/components/datagrid/body/header/draggable_columns.js +231 -0
  113. package/optimize/lib/components/datagrid/body/header/draggable_columns.styles.js +43 -0
  114. package/optimize/lib/components/datagrid/data_grid.js +2 -1
  115. package/optimize/lib/components/datagrid/data_grid.stories.utils.js +7 -5
  116. package/optimize/lib/components/datagrid/utils/col_widths.js +4 -6
  117. package/optimize/lib/components/datagrid/utils/focus.js +2 -2
  118. package/optimize/lib/components/datagrid/utils/scrolling.js +13 -10
  119. package/optimize/lib/components/date_picker/super_date_picker/date_popover/absolute_tab.js +5 -1
  120. package/optimize/lib/components/date_picker/super_date_picker/date_popover/date_popover_button.js +6 -2
  121. package/optimize/lib/components/date_picker/super_date_picker/date_popover/date_popover_content.js +6 -2
  122. package/optimize/lib/components/date_picker/super_date_picker/super_date_picker.js +11 -5
  123. package/optimize/lib/components/drag_and_drop/draggable.js +8 -3
  124. package/optimize/lib/components/header/header.styles.js +6 -12
  125. package/optimize/lib/components/header/header_links/header_links.js +1 -1
  126. package/optimize/lib/components/header/header_links/header_links.styles.js +1 -0
  127. package/optimize/lib/components/page_template/inner/page_inner.styles.js +3 -4
  128. package/optimize/lib/components/tabs/tab.js +1 -1
  129. package/package.json +1 -1
  130. package/test-env/components/datagrid/body/cell/data_grid_cell.styles.js +4 -2
  131. package/test-env/components/datagrid/body/cell/focus_utils.js +13 -4
  132. package/test-env/components/datagrid/body/data_grid_body.js +2 -1
  133. package/test-env/components/datagrid/body/data_grid_body_custom.js +5 -2
  134. package/test-env/components/datagrid/body/data_grid_body_virtualized.js +8 -4
  135. package/test-env/components/datagrid/body/header/column_actions.js +261 -27
  136. package/test-env/components/datagrid/body/header/{data_grid_column_resizer.js → column_resizer.js} +11 -5
  137. package/{lib/components/datagrid/body/header/data_grid_column_resizer.styles.js → test-env/components/datagrid/body/header/column_resizer.styles.js} +6 -1
  138. package/test-env/components/datagrid/body/header/column_sorting.js +144 -0
  139. package/test-env/components/datagrid/body/header/data_grid_control_header_cell.js +3 -3
  140. package/test-env/components/datagrid/body/header/data_grid_header_cell.js +82 -301
  141. package/test-env/components/datagrid/body/header/data_grid_header_cell.styles.js +1 -1
  142. package/test-env/components/datagrid/body/header/data_grid_header_cell_wrapper.js +19 -17
  143. package/test-env/components/datagrid/body/header/data_grid_header_cell_wrapper.styles.js +1 -2
  144. package/test-env/components/datagrid/body/header/data_grid_header_row.js +24 -9
  145. package/test-env/components/datagrid/body/header/draggable_columns.js +305 -0
  146. package/test-env/components/datagrid/body/header/draggable_columns.styles.js +43 -0
  147. package/test-env/components/datagrid/data_grid.js +2 -1
  148. package/test-env/components/datagrid/data_grid.stories.utils.js +9 -6
  149. package/test-env/components/datagrid/utils/col_widths.js +4 -6
  150. package/test-env/components/datagrid/utils/focus.js +2 -2
  151. package/test-env/components/datagrid/utils/scrolling.js +13 -10
  152. package/test-env/components/date_picker/super_date_picker/date_popover/absolute_tab.js +8 -2
  153. package/test-env/components/date_picker/super_date_picker/date_popover/date_popover_button.js +8 -2
  154. package/test-env/components/date_picker/super_date_picker/date_popover/date_popover_content.js +8 -2
  155. package/test-env/components/date_picker/super_date_picker/super_date_picker.js +27 -5
  156. package/test-env/components/drag_and_drop/draggable.js +13 -5
  157. package/test-env/components/header/header.styles.js +6 -12
  158. package/test-env/components/header/header_links/header_links.js +1 -1
  159. package/test-env/components/header/header_links/header_links.styles.js +1 -0
  160. package/test-env/components/page_template/inner/page_inner.styles.js +3 -4
  161. package/test-env/components/tabs/tab.js +1 -1
@@ -19,23 +19,18 @@ export var euiHeaderVariables = function euiHeaderVariables(euiThemeContext) {
19
19
  };
20
20
  };
21
21
  export var euiHeaderStyles = function euiHeaderStyles(euiThemeContext) {
22
- var euiTheme = euiThemeContext.euiTheme,
23
- colorMode = euiThemeContext.colorMode;
22
+ var euiTheme = euiThemeContext.euiTheme;
24
23
  var _euiHeaderVariables = euiHeaderVariables(euiThemeContext),
25
24
  height = _euiHeaderVariables.height,
26
25
  padding = _euiHeaderVariables.padding;
27
-
28
- // Curated border color to fade into the shadow without looking too much like a border
29
- // It adds separation between the header and flyout
30
- var borderColor = colorMode === 'DARK' ? shade(euiTheme.colors.emptyShade, 0.35) : shade(euiTheme.border.color, 0.03);
31
26
  return {
32
- euiHeader: /*#__PURE__*/css("display:flex;justify-content:space-between;", logicalCSS('height', height), " ", logicalCSS('padding-horizontal', padding), " ", euiShadowSmall(euiThemeContext), ";;label:euiHeader;"),
27
+ euiHeader: /*#__PURE__*/css("display:flex;justify-content:space-between;", logicalCSS('height', height), " ", logicalCSS('padding-horizontal', padding), " ", logicalCSS('border-bottom', euiTheme.border.thin), " ", euiShadowSmall(euiThemeContext), ";;label:euiHeader;"),
33
28
  // Position
34
29
  static: /*#__PURE__*/css("z-index:", Number(euiTheme.levels.header) - 1, ";position:relative;;label:static;"),
35
30
  fixed: /*#__PURE__*/css("z-index:", euiTheme.levels.header, ";position:fixed;", logicalCSS('top', 0), " ", logicalCSS('horizontal', 0), ";;label:fixed;"),
36
31
  // Theme
37
- default: /*#__PURE__*/css("background-color:", euiTheme.colors.emptyShade, ";", logicalCSS('border-bottom', "".concat(euiTheme.border.width.thin, " solid ").concat(borderColor)), ";;label:default;"),
38
- dark: /*#__PURE__*/css(euiHeaderDarkStyles(euiThemeContext, borderColor), ";label:dark;")
32
+ default: /*#__PURE__*/css("background-color:", euiTheme.colors.emptyShade, ";;label:default;"),
33
+ dark: /*#__PURE__*/css(euiHeaderDarkStyles(euiThemeContext), ";label:dark;")
39
34
  };
40
35
  };
41
36
 
@@ -49,12 +44,11 @@ export var euiHeaderStyles = function euiHeaderStyles(euiThemeContext) {
49
44
  * by Kibana in the near future, at which point we can remove this
50
45
  */
51
46
  import { euiFormVariables } from '../form/form.styles';
52
- var euiHeaderDarkStyles = function euiHeaderDarkStyles(euiThemeContext, defaultBorderColor) {
47
+ var euiHeaderDarkStyles = function euiHeaderDarkStyles(euiThemeContext) {
53
48
  var euiTheme = euiThemeContext.euiTheme,
54
49
  colorMode = euiThemeContext.colorMode;
55
50
  var _euiFormVariables = euiFormVariables(euiThemeContext),
56
51
  controlPlaceholderText = _euiFormVariables.controlPlaceholderText;
57
52
  var backgroundColor = colorMode === 'DARK' ? shade(euiTheme.colors.lightestShade, 0.5) : shade(euiTheme.colors.darkestShade, 0.28);
58
- var borderColor = colorMode === 'DARK' ? defaultBorderColor : backgroundColor;
59
- return "\n background-color: ".concat(backgroundColor, ";\n ").concat(logicalCSS('border-bottom-color', borderColor), "\n\n .euiHeaderLogo__text,\n .euiHeaderLink,\n .euiHeaderSectionItemButton {\n color: ").concat(euiTheme.colors.ghost, ";\n }\n\n .euiHeaderLink-isActive {\n color: ").concat(makeHighContrastColor(euiTheme.colors.primary)(backgroundColor), ";\n }\n\n .euiHeaderLogo,\n .euiHeaderLink,\n .euiHeaderSectionItemButton {\n &:focus {\n background-color: ").concat(shade(euiTheme.colors.primary, 0.5), ";\n }\n }\n\n .euiHeaderSectionItemButton__notification--badge {\n box-shadow: 0 0 0 ").concat(euiTheme.border.width.thin, " ").concat(backgroundColor, ";\n }\n\n .euiHeaderSectionItemButton__notification--dot {\n stroke: ").concat(backgroundColor, ";\n }\n\n .euiSelectableTemplateSitewide .euiFormControlLayout {\n background-color: transparent;\n\n &--group {\n border-color: ").concat(transparentize(euiTheme.colors.ghost, 0.3), ";\n }\n\n &:not(:focus-within) {\n /* Increase contrast of filled text to be more than placeholder text */\n color: ").concat(euiTheme.colors.ghost, ";\n\n input {\n /* Increase contrast of placeholder text */\n &::placeholder {\n color: ").concat(makeHighContrastColor(controlPlaceholderText, 8)(backgroundColor), ";\n }\n\n /* Inherit color from form control layout */\n color: inherit;\n background-color: transparent;\n }\n\n .euiFormControlLayout__append,\n .euiFormControlLayout__prepend {\n background-color: transparent;\n }\n\n .euiFormLabel {\n color: inherit;\n }\n }\n }\n ");
53
+ return "\n background-color: ".concat(backgroundColor, ";\n\n .euiHeaderLogo__text,\n .euiHeaderLink,\n .euiHeaderSectionItemButton {\n color: ").concat(euiTheme.colors.ghost, ";\n }\n\n .euiHeaderLink-isActive {\n color: ").concat(makeHighContrastColor(euiTheme.colors.primary)(backgroundColor), ";\n }\n\n .euiHeaderLogo,\n .euiHeaderLink,\n .euiHeaderSectionItemButton {\n &:focus {\n background-color: ").concat(shade(euiTheme.colors.primary, 0.5), ";\n }\n }\n\n .euiHeaderSectionItemButton__notification--badge {\n box-shadow: 0 0 0 ").concat(euiTheme.border.width.thin, " ").concat(backgroundColor, ";\n }\n\n .euiHeaderSectionItemButton__notification--dot {\n stroke: ").concat(backgroundColor, ";\n }\n\n .euiSelectableTemplateSitewide .euiFormControlLayout {\n background-color: transparent;\n\n &--group {\n border-color: ").concat(transparentize(euiTheme.colors.ghost, 0.3), ";\n }\n\n &:not(:focus-within) {\n /* Increase contrast of filled text to be more than placeholder text */\n color: ").concat(euiTheme.colors.ghost, ";\n\n input {\n /* Increase contrast of placeholder text */\n &::placeholder {\n color: ").concat(makeHighContrastColor(controlPlaceholderText, 8)(backgroundColor), ";\n }\n\n /* Inherit color from form control layout */\n color: inherit;\n background-color: transparent;\n }\n\n .euiFormControlLayout__append,\n .euiFormControlLayout__prepend {\n background-color: transparent;\n }\n\n .euiFormLabel {\n color: inherit;\n }\n }\n }\n ");
60
54
  };
@@ -21,7 +21,7 @@ import { EuiHeaderSectionItemButton } from '../header_section';
21
21
  import { EuiHideFor, EuiShowFor } from '../../responsive';
22
22
  import { euiHeaderLinksStyles } from './header_links.styles';
23
23
  import { jsx as ___EmotionJSX } from "@emotion/react";
24
- export var GUTTER_SIZES = ['xs', 's', 'm', 'l'];
24
+ export var GUTTER_SIZES = ['xxs', 'xs', 's', 'm', 'l'];
25
25
  export var EuiHeaderLinks = function EuiHeaderLinks(_ref) {
26
26
  var children = _ref.children,
27
27
  className = _ref.className,
@@ -31,6 +31,7 @@ export var euiHeaderLinksStyles = function euiHeaderLinksStyles(_ref3) {
31
31
  euiHeaderLinks: _ref2,
32
32
  euiHeaderLinks__list: _ref,
33
33
  gutterSizes: {
34
+ xxs: /*#__PURE__*/css("gap:", euiTheme.size.xs, ";;label:xxs;"),
34
35
  xs: /*#__PURE__*/css("gap:", euiTheme.size.s, ";;label:xs;"),
35
36
  s: /*#__PURE__*/css("gap:", euiTheme.size.m, ";;label:s;"),
36
37
  m: /*#__PURE__*/css("gap:", euiTheme.size.base, ";;label:m;"),
@@ -9,15 +9,14 @@
9
9
  import { css } from '@emotion/react';
10
10
  import { euiShadow } from '../../../themes/amsterdam/global_styling/mixins';
11
11
  import { euiBackgroundColor, logicalCSS } from '../../../global_styling';
12
- import { transparentize } from '../../../services';
13
12
  export var euiPageInnerStyles = function euiPageInnerStyles(euiThemeContext) {
14
- var borderColor = transparentize(euiThemeContext.euiTheme.colors.lightShade, 0.7);
13
+ var euiTheme = euiThemeContext.euiTheme;
15
14
  return {
16
15
  euiPageInner: /*#__PURE__*/css("display:flex;flex-direction:column;align-items:stretch;flex:1 1 100%;", logicalCSS('max-width', '100%'), " ", logicalCSS('min-width', '0'), ";;label:euiPageInner;"),
17
16
  panelled: /*#__PURE__*/css("background:", euiBackgroundColor(euiThemeContext, 'plain'), ";", euiShadow(euiThemeContext, 'm'), ";;label:panelled;"),
18
17
  border: {
19
- top: /*#__PURE__*/css(logicalCSS('border-top', "".concat(euiThemeContext.euiTheme.border.width.thin, " solid ").concat(borderColor)), ";;label:top;"),
20
- left: /*#__PURE__*/css(logicalCSS('border-left', "".concat(euiThemeContext.euiTheme.border.width.thin, " solid ").concat(borderColor)), ";;label:left;")
18
+ top: /*#__PURE__*/css(logicalCSS('border-top', euiTheme.border.thin), ";;label:top;"),
19
+ left: /*#__PURE__*/css(logicalCSS('border-left', euiTheme.border.thin), ";;label:left;")
21
20
  }
22
21
  };
23
22
  };
@@ -65,7 +65,7 @@ export var EuiTab = function EuiTab(_ref) {
65
65
  target: target,
66
66
  rel: secureRel
67
67
  }, rest), prependNode, ___EmotionJSX("span", {
68
- className: "euiTab__content",
68
+ className: "euiTab__content eui-textTruncate",
69
69
  css: cssTabContentStyles
70
70
  }, children), appendNode);
71
71
  }
@@ -47,6 +47,7 @@ var euiDataGridCellOutlineSelectors = exports.euiDataGridCellOutlineSelectors =
47
47
 
48
48
  // Cell header specific selectors
49
49
  var headerActionsOpen = '.euiDataGridHeaderCell--isActionsPopoverOpen';
50
+ var isMoving = '[data-column-moving]'; // prevents the header column actions hover animation from replaying on column move
50
51
 
51
52
  // Utils
52
53
  var selectors = function selectors() {
@@ -80,10 +81,11 @@ var euiDataGridCellOutlineSelectors = exports.euiDataGridCellOutlineSelectors =
80
81
  hoverAnimation: hoverNot(selectors(focus, isOpen, isClosing))
81
82
  },
82
83
  header: {
83
- focus: is(selectors(focus, focusWithin, headerActionsOpen)),
84
+ focus: is(selectors(focus, focusWithin, headerActionsOpen, isMoving)),
84
85
  // :focus-within here is primarily intended for when the column actions button has been clicked twice
85
86
  focusTrapped: _(isEntered),
86
- hideActions: not(selectors(hover, focusWithin, headerActionsOpen))
87
+ showActions: is(selectors(hover, focusWithin, headerActionsOpen, isMoving)),
88
+ hideActions: not(selectors(hover, focusWithin, headerActionsOpen, isMoving))
87
89
  }
88
90
  };
89
91
  };
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
8
  exports.HandleInteractiveChildren = exports.FocusTrappedChildren = void 0;
9
+ var _toArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toArray"));
9
10
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
10
11
  var _react = _interopRequireWildcard(require("react"));
11
12
  var _tabbable = require("tabbable");
@@ -101,16 +102,24 @@ var FocusTrappedChildren = exports.FocusTrappedChildren = function FocusTrappedC
101
102
 
102
103
  // direct DOM manipulation as workaround to attach required hints
103
104
  (0, _react.useEffect)(function () {
105
+ var _currentAriaDescribed;
104
106
  var currentAriaDescribedbyId = cellEl.getAttribute('aria-describedby');
105
- cellEl.setAttribute('aria-describedby', (0, _classnames.default)(currentAriaDescribedbyId, ariaDescribedById));
107
+ // A11y: splitting ids to be able to append the first hint (sorting)
108
+ // while other hints should follow the keyboard navigation hints
109
+ var _ref3 = (_currentAriaDescribed = currentAriaDescribedbyId === null || currentAriaDescribedbyId === void 0 ? void 0 : currentAriaDescribedbyId.split(' ')) !== null && _currentAriaDescribed !== void 0 ? _currentAriaDescribed : [],
110
+ _ref4 = (0, _toArray2.default)(_ref3),
111
+ sortingId = _ref4[0],
112
+ rest = _ref4.slice(1);
113
+ var remainingIds = rest.join(' ');
114
+ cellEl.setAttribute('aria-describedby', (0, _classnames.default)(sortingId, ariaDescribedById, !isCellEntered && remainingIds));
106
115
  return function () {
107
116
  if (currentAriaDescribedbyId) {
108
- cellEl.setAttribute('aria-descibedby', currentAriaDescribedbyId);
117
+ cellEl.setAttribute('aria-describedby', currentAriaDescribedbyId);
109
118
  } else {
110
119
  cellEl.removeAttribute('aria-describedby');
111
120
  }
112
121
  };
113
- }, [cellEl, ariaDescribedById]);
122
+ }, [cellEl, ariaDescribedById, isCellEntered]);
114
123
  (0, _react.useEffect)(function () {
115
124
  if (isCellEntered) {
116
125
  enableAndFocusInteractives(cellEl);
@@ -138,7 +147,7 @@ var FocusTrappedChildren = exports.FocusTrappedChildren = function FocusTrappedC
138
147
  } else if (
139
148
  // when opened content is closed, we don't want Escape to return to the cell
140
149
  // immediately but instead return focus to a trigger as expected
141
- isCellEntered === false && (0, _utils.isDOMNode)(event.target) && (0, _utils.isDOMNode)(event.currentTarget) && event.currentTarget.contains(event.target)) {
150
+ isCellEntered === false && (0, _utils.isDOMNode)(event.target) && (0, _utils.isDOMNode)(event.currentTarget) && event.currentTarget !== event.target && event.currentTarget.contains(event.target)) {
142
151
  return true;
143
152
  }
144
153
  return isCellEntered;
@@ -45,6 +45,7 @@ var EuiDataGridBodyCustomRender = exports.EuiDataGridBodyCustomRender = /*#__PUR
45
45
  columns = _ref.columns,
46
46
  setVisibleColumns = _ref.setVisibleColumns,
47
47
  switchColumnPos = _ref.switchColumnPos,
48
+ canDragAndDropColumns = _ref.canDragAndDropColumns,
48
49
  onColumnResize = _ref.onColumnResize,
49
50
  schema = _ref.schema,
50
51
  schemaDetectors = _ref.schemaDetectors,
@@ -98,12 +99,13 @@ var EuiDataGridBodyCustomRender = exports.EuiDataGridBodyCustomRender = /*#__PUR
98
99
  setVisibleColumns: setVisibleColumns,
99
100
  visibleColCount: visibleColCount,
100
101
  switchColumnPos: switchColumnPos,
102
+ canDragAndDropColumns: canDragAndDropColumns,
101
103
  sorting: sorting,
102
104
  schema: schema,
103
105
  schemaDetectors: schemaDetectors,
104
106
  gridStyles: gridStyles
105
107
  };
106
- }, [leadingControlColumns, trailingControlColumns, columns, columnWidths, defaultColumnWidth, setColumnWidth, visibleColCount, setVisibleColumns, switchColumnPos, sorting, schema, schemaDetectors, gridStyles]);
108
+ }, [leadingControlColumns, trailingControlColumns, columns, columnWidths, defaultColumnWidth, setColumnWidth, visibleColCount, setVisibleColumns, switchColumnPos, canDragAndDropColumns, sorting, schema, schemaDetectors, gridStyles]);
107
109
 
108
110
  /**
109
111
  * Header & footer
@@ -112,7 +112,8 @@ var EuiDataGridBodyVirtualized = exports.EuiDataGridBodyVirtualized = /*#__PURE_
112
112
  gridRef = _ref3.gridRef,
113
113
  gridItemsRendered = _ref3.gridItemsRendered,
114
114
  wrapperRef = _ref3.wrapperRef,
115
- className = _ref3.className;
115
+ className = _ref3.className,
116
+ canDragAndDropColumns = _ref3.canDragAndDropColumns;
116
117
  /**
117
118
  * Grid refs & observers
118
119
  */
@@ -163,7 +164,8 @@ var EuiDataGridBodyVirtualized = exports.EuiDataGridBodyVirtualized = /*#__PURE_
163
164
  sorting: sorting,
164
165
  schema: schema,
165
166
  schemaDetectors: schemaDetectors,
166
- gridStyles: gridStyles
167
+ gridStyles: gridStyles,
168
+ canDragAndDropColumns: canDragAndDropColumns
167
169
  }),
168
170
  headerRow = _useDataGridHeader.headerRow,
169
171
  headerRowHeight = _useDataGridHeader.headerRowHeight;
@@ -195,7 +197,8 @@ var EuiDataGridBodyVirtualized = exports.EuiDataGridBodyVirtualized = /*#__PURE_
195
197
  headerRowHeight: headerRowHeight,
196
198
  footerRowHeight: footerRowHeight,
197
199
  visibleRowCount: visibleRowCount,
198
- hasStickyFooter: !!(renderFooterCellValue && gridStyles.stickyFooter)
200
+ hasStickyFooter: !!(renderFooterCellValue && gridStyles.stickyFooter),
201
+ canDragAndDropColumns: canDragAndDropColumns
199
202
  });
200
203
 
201
204
  /**
@@ -1,18 +1,30 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ var _typeof3 = require("@babel/runtime/helpers/typeof");
4
5
  Object.defineProperty(exports, "__esModule", {
5
6
  value: true
6
7
  });
7
- exports.isColumnActionEnabled = exports.getSortColumnActions = exports.getHideColumnAction = exports.getColumnActions = exports.getColumnActionConfig = void 0;
8
+ exports.usePopoverArrowNavigation = exports.useHasColumnActions = exports.isColumnActionEnabled = exports.getSortColumnActions = exports.getHideColumnAction = exports.getColumnActions = exports.getColumnActionConfig = exports.ColumnActions = void 0;
8
9
  var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
9
10
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
10
11
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
11
- var _react = _interopRequireDefault(require("react"));
12
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
13
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
14
+ var _react = _interopRequireWildcard(require("react"));
15
+ var _tabbable = require("tabbable");
16
+ var _services = require("../../../../services");
12
17
  var _i18n = require("../../../i18n");
18
+ var _popover = require("../../../popover");
19
+ var _list_group = require("../../../list_group");
20
+ var _button = require("../../../button");
21
+ var _focus = require("../../utils/focus");
13
22
  var _data_grid_schema = require("../../utils/data_grid_schema");
14
23
  var _column_sorting_draggable = require("../../controls/column_sorting_draggable");
24
+ var _data_grid_header_cell = require("./data_grid_header_cell.styles");
15
25
  var _react2 = require("@emotion/react");
26
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
27
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof3(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
16
28
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
17
29
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } /*
18
30
  * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
@@ -20,20 +32,222 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
20
32
  * 2.0 and the Server Side Public License, v 1; you may not use this file except
21
33
  * in compliance with, at your election, the Elastic License 2.0 or the Server
22
34
  * Side Public License, v 1.
23
- */
24
- var getColumnActions = exports.getColumnActions = function getColumnActions(_ref) {
25
- var _column$actions;
26
- var column = _ref.column,
35
+ */ // Keep the i18n scope the same as EuiDataGridHeaderCell
36
+ /* eslint-disable local/i18n */
37
+ var useHasColumnActions = exports.useHasColumnActions = function useHasColumnActions(columnActions) {
38
+ return (0, _react.useMemo)(function () {
39
+ // By default, all column actions are enabled
40
+ if (columnActions === undefined) return true;
41
+ if (columnActions === false) return false;
42
+ if (columnActions.additional && columnActions.additional.length) return true;
43
+ // Check if all (currently 5) default column actions have been manually disabled
44
+ var disabledActions = Object.values(columnActions).filter(function (action) {
45
+ return action === false;
46
+ });
47
+ return disabledActions.length < 5;
48
+ }, [columnActions]);
49
+ };
50
+
51
+ // Props to pass back to EuiDataGridHeaderCell and set on EuiDataGridHeaderCellWrapper
52
+
53
+ var ColumnActions = exports.ColumnActions = /*#__PURE__*/(0, _react.memo)(function (_ref) {
54
+ var index = _ref.index,
55
+ id = _ref.id,
56
+ title = _ref.title,
57
+ column = _ref.column,
27
58
  columns = _ref.columns,
28
59
  schema = _ref.schema,
29
60
  schemaDetectors = _ref.schemaDetectors,
30
61
  setVisibleColumns = _ref.setVisibleColumns,
31
- focusFirstVisibleInteractiveCell = _ref.focusFirstVisibleInteractiveCell,
32
- setIsPopoverOpen = _ref.setIsPopoverOpen,
33
- sorting = _ref.sorting,
34
62
  switchColumnPos = _ref.switchColumnPos,
35
- setFocusedCell = _ref.setFocusedCell,
36
- columnFocusIndex = _ref.columnFocusIndex;
63
+ sorting = _ref.sorting,
64
+ hasFocusTrap = _ref.hasFocusTrap,
65
+ setPropsFromColumnActions = _ref.setPropsFromColumnActions,
66
+ actionsButtonRef = _ref.actionsButtonRef;
67
+ /**
68
+ * Popover logic and accessibility
69
+ */
70
+ var _useState = (0, _react.useState)(false),
71
+ _useState2 = (0, _slicedToArray2.default)(_useState, 2),
72
+ isPopoverOpen = _useState2[0],
73
+ setIsPopoverOpen = _useState2[1];
74
+ var togglePopover = (0, _react.useCallback)(function () {
75
+ setIsPopoverOpen(function (isOpen) {
76
+ return !isOpen;
77
+ });
78
+ }, []);
79
+ var closePopover = (0, _react.useCallback)(function () {
80
+ setIsPopoverOpen(false);
81
+ }, []);
82
+ var _useState3 = (0, _react.useState)(false),
83
+ _useState4 = (0, _slicedToArray2.default)(_useState3, 2),
84
+ isActionsButtonFocused = _useState4[0],
85
+ setIsActionsButtonFocused = _useState4[1];
86
+ var onFocus = (0, _react.useCallback)(function () {
87
+ return setIsActionsButtonFocused(true);
88
+ }, []);
89
+ var onBlur = (0, _react.useCallback)(function () {
90
+ return setIsActionsButtonFocused(false);
91
+ }, []);
92
+ var actionsButtonAriaLabel = (0, _i18n.useEuiI18n)('euiDataGridHeaderCell.actionsButtonAriaLabel', '{title}. Click to view column header actions.', {
93
+ title: title
94
+ });
95
+ var actionsEnterKeyInstructions = (0, _i18n.useEuiI18n)('euiDataGridHeaderCell.actionsEnterKeyInstructions', "Press the Enter key to view this column's actions");
96
+ var openActionsPopoverOnEnter = (0, _react.useCallback)(function (e) {
97
+ if (e.key === _services.keys.ENTER) {
98
+ setIsPopoverOpen(true);
99
+ }
100
+ }, []);
101
+ var popoverArrowNavigationProps = usePopoverArrowNavigation();
102
+
103
+ /**
104
+ * Props to set on parent EuiDataGridHeaderCell
105
+ */
106
+ var _useState5 = (0, _react.useState)(false),
107
+ _useState6 = (0, _slicedToArray2.default)(_useState5, 2),
108
+ isColumnMoving = _useState6[0],
109
+ setIsColumnMoving = _useState6[1];
110
+ (0, _react.useEffect)(function () {
111
+ setPropsFromColumnActions({
112
+ className: isPopoverOpen ? 'euiDataGridHeaderCell--isActionsPopoverOpen' : '',
113
+ onKeyDown: openActionsPopoverOnEnter,
114
+ 'data-column-moving': isColumnMoving || undefined
115
+ });
116
+ }, [setPropsFromColumnActions, isPopoverOpen, openActionsPopoverOnEnter, isColumnMoving]);
117
+
118
+ /**
119
+ * Get column actions as an array of EuiListGroup items
120
+ */
121
+ var _useContext = (0, _react.useContext)(_focus.DataGridFocusContext),
122
+ setFocusedCell = _useContext.setFocusedCell,
123
+ focusFirstVisibleInteractiveCell = _useContext.focusFirstVisibleInteractiveCell;
124
+ var columnActions = (0, _react.useMemo)(function () {
125
+ return getColumnActions({
126
+ column: column,
127
+ columns: columns,
128
+ schema: schema,
129
+ schemaDetectors: schemaDetectors,
130
+ setVisibleColumns: setVisibleColumns,
131
+ focusFirstVisibleInteractiveCell: focusFirstVisibleInteractiveCell,
132
+ sorting: sorting,
133
+ switchColumnPos: switchColumnPos,
134
+ setIsPopoverOpen: setIsPopoverOpen,
135
+ setIsColumnMoving: setIsColumnMoving,
136
+ setFocusedCell: setFocusedCell,
137
+ columnFocusIndex: index
138
+ });
139
+ }, [column, columns, schema, schemaDetectors, setVisibleColumns, focusFirstVisibleInteractiveCell, sorting, switchColumnPos, setFocusedCell, index]);
140
+
141
+ /**
142
+ * Rendering
143
+ */
144
+ var styles = (0, _services.useEuiMemoizedStyles)(_data_grid_header_cell.euiDataGridHeaderCellStyles);
145
+ return (0, _react2.jsx)(_popover.EuiPopover, (0, _extends2.default)({
146
+ display: "block",
147
+ panelPaddingSize: "none",
148
+ offset: 7,
149
+ anchorPosition: "downRight",
150
+ css: styles.euiDataGridHeaderCell__popover,
151
+ button: (0, _react2.jsx)(_button.EuiButtonIcon, {
152
+ iconType: "boxesVertical",
153
+ iconSize: "s",
154
+ color: "text",
155
+ css: styles.euiDataGridHeaderCell__actions,
156
+ className: "euiDataGridHeaderCell__button",
157
+ onClick: togglePopover,
158
+ buttonRef: actionsButtonRef,
159
+ onFocus: onFocus,
160
+ onBlur: onBlur,
161
+ tabIndex: 0 // Override EuiButtonIcon's conditional tabindex based on aria-hidden
162
+ ,
163
+ "aria-hidden": hasFocusTrap && !isActionsButtonFocused ? 'true' // prevent the actions button from being read on cell focus
164
+ : undefined,
165
+ "aria-label": hasFocusTrap ? actionsButtonAriaLabel : actionsEnterKeyInstructions,
166
+ "data-test-subj": "dataGridHeaderCellActionButton-".concat(id)
167
+ }),
168
+ isOpen: isPopoverOpen,
169
+ closePopover: closePopover
170
+ }, popoverArrowNavigationProps), (0, _react2.jsx)(_list_group.EuiListGroup, {
171
+ listItems: columnActions,
172
+ gutterSize: "none",
173
+ "data-test-subj": "dataGridHeaderCellActionGroup-".concat(id)
174
+ }));
175
+ });
176
+ ColumnActions.displayName = 'EuiDataGridHeaderCellColumnActions';
177
+
178
+ /**
179
+ * Add keyboard arrow navigation to the cell actions popover
180
+ * to match the UX of the rest of EuiDataGrid
181
+ */
182
+ var usePopoverArrowNavigation = exports.usePopoverArrowNavigation = function usePopoverArrowNavigation() {
183
+ var popoverPanelRef = (0, _react.useRef)(null);
184
+ var actionsRef = (0, _react.useRef)(undefined);
185
+ var panelRef = (0, _react.useCallback)(function (ref) {
186
+ popoverPanelRef.current = ref;
187
+ actionsRef.current = ref ? (0, _tabbable.tabbable)(ref) : undefined;
188
+ }, []);
189
+ var onKeyDown = (0, _react.useCallback)(function (e) {
190
+ var _actionsRef$current;
191
+ if (e.key !== _services.keys.ARROW_DOWN && e.key !== _services.keys.ARROW_UP) return;
192
+ if (!((_actionsRef$current = actionsRef.current) !== null && _actionsRef$current !== void 0 && _actionsRef$current.length)) return;
193
+ e.preventDefault();
194
+ var initialState = document.activeElement === popoverPanelRef.current;
195
+ var currentIndex = !initialState ? actionsRef.current.findIndex(function (el) {
196
+ return document.activeElement === el;
197
+ }) : -1;
198
+ var lastIndex = actionsRef.current.length - 1;
199
+ var indexToFocus;
200
+ if (initialState) {
201
+ if (e.key === _services.keys.ARROW_DOWN) {
202
+ indexToFocus = 0;
203
+ } else if (e.key === _services.keys.ARROW_UP) {
204
+ indexToFocus = lastIndex;
205
+ }
206
+ } else {
207
+ if (e.key === _services.keys.ARROW_DOWN) {
208
+ indexToFocus = currentIndex + 1;
209
+ if (indexToFocus > lastIndex) {
210
+ indexToFocus = 0;
211
+ }
212
+ } else if (e.key === _services.keys.ARROW_UP) {
213
+ indexToFocus = currentIndex - 1;
214
+ if (indexToFocus < 0) {
215
+ indexToFocus = lastIndex;
216
+ }
217
+ }
218
+ }
219
+ actionsRef.current[indexToFocus].focus();
220
+ }, []);
221
+ return {
222
+ panelRef: panelRef,
223
+ panelProps: {
224
+ onKeyDown: onKeyDown
225
+ },
226
+ popoverScreenReaderText: (0, _react2.jsx)(_i18n.EuiI18n, {
227
+ token: "euiDataGridHeaderCell.actionsPopoverScreenReaderText",
228
+ default: "To navigate through the list of column actions, press the Tab or Up and Down arrow keys."
229
+ })
230
+ };
231
+ };
232
+
233
+ /**
234
+ * Logic for returning an array of actions/items to pass to EuiListGroup
235
+ */
236
+
237
+ var getColumnActions = exports.getColumnActions = function getColumnActions(_ref2) {
238
+ var _column$actions;
239
+ var column = _ref2.column,
240
+ columns = _ref2.columns,
241
+ schema = _ref2.schema,
242
+ schemaDetectors = _ref2.schemaDetectors,
243
+ setVisibleColumns = _ref2.setVisibleColumns,
244
+ focusFirstVisibleInteractiveCell = _ref2.focusFirstVisibleInteractiveCell,
245
+ setIsPopoverOpen = _ref2.setIsPopoverOpen,
246
+ sorting = _ref2.sorting,
247
+ switchColumnPos = _ref2.switchColumnPos,
248
+ setIsColumnMoving = _ref2.setIsColumnMoving,
249
+ setFocusedCell = _ref2.setFocusedCell,
250
+ columnFocusIndex = _ref2.columnFocusIndex;
37
251
  if (column.actions === false) {
38
252
  return [];
39
253
  }
@@ -51,6 +265,7 @@ var getColumnActions = exports.getColumnActions = function getColumnActions(_ref
51
265
  column: column,
52
266
  columns: columns,
53
267
  switchColumnPos: switchColumnPos,
268
+ setIsColumnMoving: setIsColumnMoving,
54
269
  setFocusedCell: setFocusedCell,
55
270
  columnFocusIndex: columnFocusIndex
56
271
  })), (0, _toConsumableArray2.default)(((_column$actions = column.actions) === null || _column$actions === void 0 ? void 0 : _column$actions.additional) || []));
@@ -72,11 +287,11 @@ var getColumnActions = exports.getColumnActions = function getColumnActions(_ref
72
287
  * Hide column action
73
288
  */
74
289
 
75
- var getHideColumnAction = exports.getHideColumnAction = function getHideColumnAction(_ref2) {
76
- var column = _ref2.column,
77
- columns = _ref2.columns,
78
- setVisibleColumns = _ref2.setVisibleColumns,
79
- focusFirstVisibleInteractiveCell = _ref2.focusFirstVisibleInteractiveCell;
290
+ var getHideColumnAction = exports.getHideColumnAction = function getHideColumnAction(_ref3) {
291
+ var column = _ref3.column,
292
+ columns = _ref3.columns,
293
+ setVisibleColumns = _ref3.setVisibleColumns,
294
+ focusFirstVisibleInteractiveCell = _ref3.focusFirstVisibleInteractiveCell;
80
295
  var items = [];
81
296
  var onClickHideColumn = function onClickHideColumn() {
82
297
  setVisibleColumns(columns.filter(function (col) {
@@ -107,16 +322,25 @@ var getHideColumnAction = exports.getHideColumnAction = function getHideColumnAc
107
322
  * Move column actions
108
323
  */
109
324
 
110
- var getMoveColumnActions = function getMoveColumnActions(_ref3) {
111
- var column = _ref3.column,
112
- columns = _ref3.columns,
113
- switchColumnPos = _ref3.switchColumnPos,
114
- setFocusedCell = _ref3.setFocusedCell,
115
- columnFocusIndex = _ref3.columnFocusIndex;
325
+ var getMoveColumnActions = function getMoveColumnActions(_ref4) {
326
+ var column = _ref4.column,
327
+ columns = _ref4.columns,
328
+ switchColumnPos = _ref4.switchColumnPos,
329
+ setIsColumnMoving = _ref4.setIsColumnMoving,
330
+ setFocusedCell = _ref4.setFocusedCell,
331
+ columnFocusIndex = _ref4.columnFocusIndex;
116
332
  var items = [];
117
333
  var colIdx = columns.findIndex(function (col) {
118
334
  return col.id === column.id;
119
335
  });
336
+
337
+ // UX polish: prevent the column actions hover animation from flashing after column move
338
+ var handleAnimationFlash = function handleAnimationFlash() {
339
+ setIsColumnMoving(true);
340
+ requestAnimationFrame(function () {
341
+ return setIsColumnMoving(false);
342
+ });
343
+ };
120
344
  var moveFocus = function moveFocus(direction) {
121
345
  var newIndex = direction === 'left' ? -1 : 1;
122
346
  // Wait a beat to move focus, otherwise the EuiPopover's EuiFocusTrap's
@@ -130,6 +354,7 @@ var getMoveColumnActions = function getMoveColumnActions(_ref3) {
130
354
  var targetCol = columns[colIdx - 1];
131
355
  if (targetCol) {
132
356
  switchColumnPos(column.id, targetCol.id);
357
+ handleAnimationFlash();
133
358
  moveFocus('left');
134
359
  }
135
360
  };
@@ -151,6 +376,7 @@ var getMoveColumnActions = function getMoveColumnActions(_ref3) {
151
376
  var targetCol = columns[colIdx + 1];
152
377
  if (targetCol) {
153
378
  switchColumnPos(column.id, targetCol.id);
379
+ handleAnimationFlash();
154
380
  moveFocus('right');
155
381
  }
156
382
  };
@@ -174,11 +400,11 @@ var getMoveColumnActions = function getMoveColumnActions(_ref3) {
174
400
  * Sort column actions
175
401
  */
176
402
 
177
- var getSortColumnActions = exports.getSortColumnActions = function getSortColumnActions(_ref4) {
178
- var column = _ref4.column,
179
- sorting = _ref4.sorting,
180
- schema = _ref4.schema,
181
- schemaDetectors = _ref4.schemaDetectors;
403
+ var getSortColumnActions = exports.getSortColumnActions = function getSortColumnActions(_ref5) {
404
+ var column = _ref5.column,
405
+ sorting = _ref5.sorting,
406
+ schema = _ref5.schema,
407
+ schemaDetectors = _ref5.schemaDetectors;
182
408
  if (!sorting) return [];
183
409
  var items = [];
184
410
  var sortingIdx = sorting.columns.findIndex(function (col) {
@@ -15,7 +15,8 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
15
15
  var _react = _interopRequireWildcard(require("react"));
16
16
  var _services = require("../../../../services");
17
17
  var _global_styling = require("../../../../global_styling");
18
- var _data_grid_column_resizer = require("./data_grid_column_resizer.styles");
18
+ var _draggable_columns = require("./draggable_columns");
19
+ var _column_resizer = require("./column_resizer.styles");
19
20
  var _react2 = require("@emotion/react");
20
21
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
21
22
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
@@ -82,16 +83,20 @@ var EuiDataGridColumnResizer = exports.EuiDataGridColumnResizer = /*#__PURE__*/f
82
83
  value: function render() {
83
84
  var _this2 = this;
84
85
  var offset = this.state.offset;
86
+ var isLastColumn = this.props.isLastColumn;
85
87
  return (0, _react2.jsx)(_services.RenderWithEuiStylesMemoizer, null, function (stylesMemoizer) {
86
- var styles = stylesMemoizer(_data_grid_column_resizer.euiDataGridColumnResizerStyles);
87
- var cssStyles = [styles.euiDataGridColumnResizer, offset && styles.isDragging];
88
+ var styles = stylesMemoizer(_column_resizer.euiDataGridColumnResizerStyles);
89
+ var cssStyles = [styles.euiDataGridColumnResizer, isLastColumn && styles.isLastColumn, offset && styles.isDragging];
88
90
  return (0, _react2.jsx)("div", {
89
91
  css: cssStyles,
90
92
  className: "euiDataGridColumnResizer",
91
93
  "data-test-subj": "dataGridColumnResizer",
92
94
  style: offset ? (0, _global_styling.logicalStyle)('margin-right', "".concat(-offset, "px")) : undefined,
93
95
  onMouseDown: _this2.onMouseDown
94
- });
96
+ }, (0, _react2.jsx)(_draggable_columns.DragOverlay, {
97
+ isDragging: !!offset,
98
+ cursor: "ew-resize"
99
+ }));
95
100
  });
96
101
  }
97
102
  }]);
@@ -33,7 +33,12 @@ var euiDataGridColumnResizerStyles = exports.euiDataGridColumnResizerStyles = fu
33
33
  }); // Odd number because it straddles a border
34
34
  var indicatorOffset = "-".concat(euiTheme.border.width.thin);
35
35
  return {
36
- euiDataGridColumnResizer: /*#__PURE__*/(0, _react.css)("z-index:2;position:absolute;", (0, _global_styling.logicalCSS)('vertical', 0), " ", (0, _global_styling.logicalCSS)('right', positionOffset), " cursor:ew-resize;opacity:0;&:hover,&:active{opacity:1;}&::after{content:'';position:absolute;", (0, _global_styling.logicalCSS)('vertical', 0), " ", (0, _global_styling.logicalCSS)('left', positionOffset), " ", (0, _global_styling.logicalCSS)('margin-left', indicatorOffset), " ", (0, _global_styling.logicalCSS)('width', indicatorWidth), " background-color:", euiTheme.colors.primary, ";}.euiDataGridHeaderCell:last-child &{", (0, _global_styling.logicalCSS)('right', 0), " ", (0, _global_styling.logicalCSS)('width', euiTheme.size.s), " &::after{", (0, _global_styling.logicalCSS)('left', 'auto'), " ", (0, _global_styling.logicalCSS)('right', 0), ";}};label:euiDataGridColumnResizer;"),
36
+ euiDataGridColumnResizer: /*#__PURE__*/(0, _react.css)("z-index:2;position:absolute;", (0, _global_styling.logicalCSS)('vertical', 0), " ", (0, _global_styling.logicalCSS)('right', positionOffset), " cursor:ew-resize;opacity:0;&:hover,&:active{opacity:1;}&::after{content:'';position:absolute;", (0, _global_styling.logicalCSS)('vertical', 0), " ", (0, _global_styling.logicalCSS)('left', positionOffset), " ", (0, _global_styling.logicalCSS)('margin-left', indicatorOffset), " ", (0, _global_styling.logicalCSS)('width', indicatorWidth), " background-color:", euiTheme.colors.primary, ";};label:euiDataGridColumnResizer;"),
37
+ /* Because the resizer sits in the negative space to the right of the column,
38
+ * it can cause the full grid to be a few pixels longer than it actually is.
39
+ * So for the last cell, we don't use negative positioning and the borders from
40
+ * the cell will match the container. */
41
+ isLastColumn: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('right', 0), " ", (0, _global_styling.logicalCSS)('width', euiTheme.size.s), " &::after{", (0, _global_styling.logicalCSS)('left', 'auto'), " ", (0, _global_styling.logicalCSS)('right', 0), ";};label:isLastColumn;"),
37
42
  isDragging: _ref
38
43
  };
39
44
  };