@elastic/eui 97.2.0 → 97.3.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 (64) hide show
  1. package/es/components/context_menu/context_menu_panel.js +17 -1
  2. package/es/components/datagrid/body/cell/data_grid_cell.js +31 -8
  3. package/es/components/datagrid/body/data_grid_body.js +8 -0
  4. package/es/components/datagrid/body/data_grid_body_custom.js +8 -1
  5. package/es/components/datagrid/body/data_grid_body_virtualized.js +8 -1
  6. package/es/components/datagrid/controls/data_grid_toolbar.styles.js +2 -2
  7. package/es/components/datagrid/controls/display_selector.js +277 -207
  8. package/es/components/datagrid/data_grid.stories.utils.js +28 -2
  9. package/es/components/datagrid/data_grid.styles.js +1 -1
  10. package/es/components/datagrid/utils/grid_height_width.js +1 -1
  11. package/es/components/datagrid/utils/row_heights.js +29 -13
  12. package/es/components/header/header.styles.js +8 -1
  13. package/es/services/hooks/useDeepEqual.js +18 -6
  14. package/eui.d.ts +38 -10
  15. package/i18ntokens.json +88 -106
  16. package/lib/components/context_menu/context_menu_panel.js +17 -1
  17. package/lib/components/datagrid/body/cell/data_grid_cell.js +31 -8
  18. package/lib/components/datagrid/body/data_grid_body.js +8 -0
  19. package/lib/components/datagrid/body/data_grid_body_custom.js +8 -1
  20. package/lib/components/datagrid/body/data_grid_body_virtualized.js +8 -1
  21. package/lib/components/datagrid/controls/data_grid_toolbar.styles.js +2 -2
  22. package/lib/components/datagrid/controls/display_selector.js +275 -204
  23. package/lib/components/datagrid/data_grid.stories.utils.js +28 -2
  24. package/lib/components/datagrid/data_grid.styles.js +1 -1
  25. package/lib/components/datagrid/utils/grid_height_width.js +1 -1
  26. package/lib/components/datagrid/utils/row_heights.js +29 -13
  27. package/lib/components/header/header.styles.js +8 -1
  28. package/lib/services/hooks/useDeepEqual.js +17 -7
  29. package/optimize/es/components/context_menu/context_menu_panel.js +11 -1
  30. package/optimize/es/components/datagrid/body/cell/data_grid_cell.js +15 -8
  31. package/optimize/es/components/datagrid/body/data_grid_body_custom.js +0 -1
  32. package/optimize/es/components/datagrid/body/data_grid_body_virtualized.js +0 -1
  33. package/optimize/es/components/datagrid/controls/data_grid_toolbar.styles.js +2 -2
  34. package/optimize/es/components/datagrid/controls/display_selector.js +277 -207
  35. package/optimize/es/components/datagrid/data_grid.styles.js +1 -1
  36. package/optimize/es/components/datagrid/utils/grid_height_width.js +1 -1
  37. package/optimize/es/components/datagrid/utils/row_heights.js +29 -13
  38. package/optimize/es/components/header/header.styles.js +8 -1
  39. package/optimize/es/services/hooks/useDeepEqual.js +13 -6
  40. package/optimize/lib/components/context_menu/context_menu_panel.js +11 -1
  41. package/optimize/lib/components/datagrid/body/cell/data_grid_cell.js +15 -8
  42. package/optimize/lib/components/datagrid/body/data_grid_body_custom.js +0 -1
  43. package/optimize/lib/components/datagrid/body/data_grid_body_virtualized.js +0 -1
  44. package/optimize/lib/components/datagrid/controls/data_grid_toolbar.styles.js +2 -2
  45. package/optimize/lib/components/datagrid/controls/display_selector.js +274 -204
  46. package/optimize/lib/components/datagrid/data_grid.styles.js +1 -1
  47. package/optimize/lib/components/datagrid/utils/grid_height_width.js +1 -1
  48. package/optimize/lib/components/datagrid/utils/row_heights.js +29 -13
  49. package/optimize/lib/components/header/header.styles.js +8 -1
  50. package/optimize/lib/services/hooks/useDeepEqual.js +12 -5
  51. package/package.json +1 -1
  52. package/test-env/components/context_menu/context_menu_panel.js +17 -1
  53. package/test-env/components/datagrid/body/cell/data_grid_cell.js +31 -8
  54. package/test-env/components/datagrid/body/data_grid_body.js +8 -0
  55. package/test-env/components/datagrid/body/data_grid_body_custom.js +8 -1
  56. package/test-env/components/datagrid/body/data_grid_body_virtualized.js +8 -1
  57. package/test-env/components/datagrid/controls/data_grid_toolbar.styles.js +2 -2
  58. package/test-env/components/datagrid/controls/display_selector.js +274 -204
  59. package/test-env/components/datagrid/data_grid.stories.utils.js +28 -2
  60. package/test-env/components/datagrid/data_grid.styles.js +1 -1
  61. package/test-env/components/datagrid/utils/grid_height_width.js +1 -1
  62. package/test-env/components/datagrid/utils/row_heights.js +29 -13
  63. package/test-env/components/header/header.styles.js +8 -1
  64. package/test-env/services/hooks/useDeepEqual.js +12 -5
@@ -74,7 +74,7 @@ export var RowHeightUtils = /*#__PURE__*/function () {
74
74
  }
75
75
  }, {
76
76
  key: "getCalculatedHeight",
77
- value: function getCalculatedHeight(heightOption, defaultHeight, rowIndex, isRowHeightOverride) {
77
+ value: function getCalculatedHeight(heightOption, defaultHeight, rowIndex, rowHeightsOptions) {
78
78
  if (isObject(heightOption) && heightOption.height) {
79
79
  return Math.max(heightOption.height, defaultHeight);
80
80
  }
@@ -82,8 +82,13 @@ export var RowHeightUtils = /*#__PURE__*/function () {
82
82
  return Math.max(heightOption, defaultHeight);
83
83
  }
84
84
  if (isObject(heightOption) && heightOption.lineCount) {
85
- if (isRowHeightOverride) {
86
- return this.getRowHeight(rowIndex) || defaultHeight; // lineCount overrides are stored in the heights cache
85
+ var _ref = rowHeightsOptions || {},
86
+ autoBelowLineCount = _ref.autoBelowLineCount; // uses auto height cache
87
+ var isRowHeightOverride =
88
+ // lineCount overrides are stored in the heights cache
89
+ rowIndex != null && this.isRowHeightOverride(rowIndex, rowHeightsOptions);
90
+ if (autoBelowLineCount || isRowHeightOverride) {
91
+ return this.getRowHeight(rowIndex) || defaultHeight;
87
92
  } else {
88
93
  return defaultHeight; // default lineCount height is set in minRowHeight state in grid_row_body
89
94
  }
@@ -114,6 +119,14 @@ export var RowHeightUtils = /*#__PURE__*/function () {
114
119
  // Assumes both padding-top and bottom are the same
115
120
  return contentHeight + padding * 2;
116
121
  }
122
+ }, {
123
+ key: "isAutoBelowLineCount",
124
+ value: function isAutoBelowLineCount(options, option) {
125
+ var _this$getLineCount;
126
+ if (!(options !== null && options !== void 0 && options.autoBelowLineCount)) return false;
127
+ if (((_this$getLineCount = this.getLineCount(option)) !== null && _this$getLineCount !== void 0 ? _this$getLineCount : 0) > 1) return true;
128
+ return false;
129
+ }
117
130
 
118
131
  /**
119
132
  * Auto height utils
@@ -125,6 +138,9 @@ export var RowHeightUtils = /*#__PURE__*/function () {
125
138
  if (height === AUTO_HEIGHT) {
126
139
  return true;
127
140
  }
141
+ if (this.isAutoBelowLineCount(rowHeightsOptions, height)) {
142
+ return true;
143
+ }
128
144
  return false;
129
145
  }
130
146
  }, {
@@ -154,8 +170,8 @@ export var RowHeightUtils = /*#__PURE__*/function () {
154
170
  }, {
155
171
  key: "pruneHiddenColumnHeights",
156
172
  value: function pruneHiddenColumnHeights(visibleColumns) {
157
- var visibleColumnIds = new Set(visibleColumns.map(function (_ref) {
158
- var id = _ref.id;
173
+ var visibleColumnIds = new Set(visibleColumns.map(function (_ref2) {
174
+ var id = _ref2.id;
159
175
  return id;
160
176
  }));
161
177
  var didModify = false;
@@ -267,10 +283,10 @@ export var RowHeightVirtualizationUtils = /*#__PURE__*/function (_RowHeightUtils
267
283
  * Hook for instantiating RowHeightUtils, setting internal class vars,
268
284
  * and setting up various row-height-related side effects
269
285
  */
270
- export var useRowHeightUtils = function useRowHeightUtils(_ref2) {
271
- var virtualization = _ref2.virtualization,
272
- rowHeightsOptions = _ref2.rowHeightsOptions,
273
- columns = _ref2.columns;
286
+ export var useRowHeightUtils = function useRowHeightUtils(_ref3) {
287
+ var virtualization = _ref3.virtualization,
288
+ rowHeightsOptions = _ref3.rowHeightsOptions,
289
+ columns = _ref3.columns;
274
290
  var forceRenderRef = useLatest(useForceRender());
275
291
  var _useState = useState(function () {
276
292
  if (virtualization) {
@@ -303,9 +319,9 @@ export var useRowHeightUtils = function useRowHeightUtils(_ref2) {
303
319
  }, [rowHeightUtils, columns]);
304
320
  return rowHeightUtils;
305
321
  };
306
- export var useDefaultRowHeight = function useDefaultRowHeight(_ref3) {
307
- var rowHeightsOptions = _ref3.rowHeightsOptions,
308
- rowHeightUtils = _ref3.rowHeightUtils;
322
+ export var useDefaultRowHeight = function useDefaultRowHeight(_ref4) {
323
+ var rowHeightsOptions = _ref4.rowHeightsOptions,
324
+ rowHeightUtils = _ref4.rowHeightUtils;
309
325
  var _useContext = useContext(DataGridSortedContext),
310
326
  getCorrectRowIndex = _useContext.getCorrectRowIndex;
311
327
 
@@ -329,7 +345,7 @@ export var useDefaultRowHeight = function useDefaultRowHeight(_ref3) {
329
345
  // Account for row-specific height overrides
330
346
  var rowHeightOption = rowHeightUtils.getRowHeightOption(correctRowIndex, rowHeightsOptions);
331
347
  if (rowHeightOption) {
332
- rowHeight = rowHeightUtils.getCalculatedHeight(rowHeightOption, minRowHeight, correctRowIndex, rowHeightUtils.isRowHeightOverride(correctRowIndex, rowHeightsOptions));
348
+ rowHeight = rowHeightUtils.getCalculatedHeight(rowHeightOption, minRowHeight, correctRowIndex, rowHeightsOptions);
333
349
  }
334
350
 
335
351
  // Use the row-specific height if it exists, if not, fall back to the default
@@ -50,5 +50,12 @@ var euiHeaderDarkStyles = function euiHeaderDarkStyles(euiThemeContext) {
50
50
  var _euiFormVariables = euiFormVariables(euiThemeContext),
51
51
  controlPlaceholderText = _euiFormVariables.controlPlaceholderText;
52
52
  var backgroundColor = colorMode === 'DARK' ? shade(euiTheme.colors.lightestShade, 0.5) : shade(euiTheme.colors.darkestShade, 0.28);
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 ");
53
+
54
+ // Specific color overrides for EuiSelectableTemplateSitewide
55
+ var selectableSitewide = {
56
+ color: euiTheme.colors.ghost,
57
+ borderColor: transparentize(euiTheme.colors.ghost, 0.3),
58
+ placeholderColor: makeHighContrastColor(controlPlaceholderText, 8)(backgroundColor)
59
+ };
60
+ 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 input {\n box-shadow: inset 0 0 0 ").concat(euiTheme.border.width.thin, " ").concat(selectableSitewide.borderColor, ";\n }\n\n &--group {\n border-color: ").concat(selectableSitewide.borderColor, ";\n\n input {\n box-shadow: none;\n }\n }\n\n &:not(:focus-within) {\n /* Increase contrast of filled text to be more than placeholder text */\n color: ").concat(selectableSitewide.color, ";\n\n input {\n /* Increase contrast of placeholder text */\n &::placeholder {\n color: ").concat(selectableSitewide.placeholderColor, ";\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 ");
54
61
  };
@@ -1,3 +1,9 @@
1
+ function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
2
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
4
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
5
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
6
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
1
7
  /*
2
8
  * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3
9
  * or more contributor license agreements. Licensed under the Elastic License
@@ -6,8 +12,9 @@
6
12
  * Side Public License, v 1.
7
13
  */
8
14
 
9
- import { useRef } from 'react';
15
+ import { useState } from 'react';
10
16
  import isEqual from 'lodash/isEqual';
17
+ import { useUpdateEffect } from './useUpdateEffect';
11
18
 
12
19
  /**
13
20
  * This hook is mostly a performance concern for third-party objs/arrays that EUI
@@ -15,9 +22,14 @@ import isEqual from 'lodash/isEqual';
15
22
  * reference on every rerender unless passed through this hook).
16
23
  */
17
24
  export var useDeepEqual = function useDeepEqual(object) {
18
- var ref = useRef(object);
19
- if (!isEqual(object, ref.current)) {
20
- ref.current = object;
21
- }
22
- return ref.current;
25
+ var _useState = useState(object),
26
+ _useState2 = _slicedToArray(_useState, 2),
27
+ memoizedObject = _useState2[0],
28
+ setMemoizedObject = _useState2[1];
29
+ useUpdateEffect(function () {
30
+ if (!isEqual(object, memoizedObject)) {
31
+ setMemoizedObject(object);
32
+ }
33
+ }, [object]);
34
+ return memoizedObject;
23
35
  };
package/eui.d.ts CHANGED
@@ -4579,6 +4579,12 @@ declare module '@elastic/eui/src/components/context_menu/context_menu_panel' {
4579
4579
  export type EuiContextMenuPanelShowPanelCallback = (currentPanelIndex?: number) => void;
4580
4580
  export const SIZES: readonly ["s", "m"];
4581
4581
  export type EuiContextMenuPanelProps = PropsWithChildren & CommonProps & Omit<HTMLAttributes<HTMLDivElement>, 'onKeyDown' | 'tabIndex' | 'onAnimationEnd' | 'title'> & {
4582
+ /**
4583
+ * Determines the initially focused menu item for keyboard and screen reader users.
4584
+ *
4585
+ * Can be set to `-1` to prevent autofocus (an uncommon case that must have
4586
+ * keyboard accessibility accounted for manually if used)
4587
+ */
4582
4588
  initialFocusedItemIndex?: number;
4583
4589
  items?: ReactElement[];
4584
4590
  onClose?: NoArgCallback<void>;
@@ -14211,9 +14217,10 @@ declare module '@elastic/eui/src/components/comment_list/comment_timeline' {
14211
14217
  }
14212
14218
  declare module '@elastic/eui/src/components/comment_list/comment' {
14213
14219
  import { FunctionComponent } from 'react';
14220
+ import { EuiTimelineItemProps } from '@elastic/eui/src/components/timeline';
14214
14221
  import { EuiCommentEventProps } from '@elastic/eui/src/components/comment_list/comment_event';
14215
14222
  import { EuiCommentTimelineProps } from '@elastic/eui/src/components/comment_list/comment_timeline';
14216
- export interface EuiCommentProps extends EuiCommentEventProps, EuiCommentTimelineProps {
14223
+ export interface EuiCommentProps extends EuiCommentEventProps, EuiCommentTimelineProps, Omit<EuiTimelineItemProps, 'children' | 'icon' | 'iconAriaLabel'> {
14217
14224
  }
14218
14225
  export const EuiComment: FunctionComponent<EuiCommentProps>;
14219
14226
 
@@ -14294,12 +14301,12 @@ declare module '@elastic/eui/src/components/datagrid/utils/sorting' {
14294
14301
  declare module '@elastic/eui/src/components/datagrid/utils/row_heights' {
14295
14302
  import { MutableRefObject } from 'react';
14296
14303
  import { GridOnItemsRenderedProps } from 'react-window';
14297
- import { EuiDataGridColumn, EuiDataGridRowHeightOption, EuiDataGridRowHeightsOptions, EuiDataGridScrollAnchorRow, EuiDataGridStyle, ImperativeGridApi } from '@elastic/eui/src/components/datagrid/data_grid_types';
14304
+ import { EuiDataGridColumn, EuiDataGridRowHeightOption, EuiDataGridRowHeightsOptions, EuiDataGridScrollAnchorRow, ImperativeGridApi } from '@elastic/eui/src/components/datagrid/data_grid_types';
14298
14305
  export type RowHeightUtilsType = RowHeightUtils | RowHeightVirtualizationUtils;
14299
14306
  export class RowHeightUtils {
14300
14307
  getRowHeightOption(rowIndex: number, rowHeightsOptions?: EuiDataGridRowHeightsOptions): EuiDataGridRowHeightOption | undefined;
14301
14308
  isRowHeightOverride(rowIndex: number, rowHeightsOptions?: EuiDataGridRowHeightsOptions): boolean;
14302
- getCalculatedHeight(heightOption: EuiDataGridRowHeightOption, defaultHeight: number, rowIndex?: number, isRowHeightOverride?: boolean): number;
14309
+ getCalculatedHeight(heightOption: EuiDataGridRowHeightOption, defaultHeight: number, rowIndex?: number, rowHeightsOptions?: EuiDataGridRowHeightsOptions): number;
14303
14310
  /**
14304
14311
  * Height types
14305
14312
  */
@@ -14309,6 +14316,7 @@ declare module '@elastic/eui/src/components/datagrid/utils/row_heights' {
14309
14316
  */
14310
14317
  getLineCount(option?: EuiDataGridRowHeightOption): number | undefined;
14311
14318
  calculateHeightForLineCount(cellRef: HTMLElement, lineCount: number): number;
14319
+ isAutoBelowLineCount(options?: EuiDataGridRowHeightsOptions, option?: EuiDataGridRowHeightOption): boolean;
14312
14320
  /**
14313
14321
  * Auto height utils
14314
14322
  */
@@ -14353,7 +14361,6 @@ declare module '@elastic/eui/src/components/datagrid/utils/row_heights' {
14353
14361
  gridItemsRenderedRef: MutableRefObject<GridOnItemsRenderedProps | null>;
14354
14362
  } | undefined;
14355
14363
  rowHeightsOptions?: EuiDataGridRowHeightsOptions | undefined;
14356
- gridStyles: EuiDataGridStyle;
14357
14364
  columns: EuiDataGridColumn[];
14358
14365
  }) => RowHeightUtils;
14359
14366
  export const useDefaultRowHeight: ({ rowHeightsOptions, rowHeightUtils, }: {
@@ -15288,7 +15295,18 @@ declare module '@elastic/eui/src/components/datagrid/data_grid_types' {
15288
15295
  * Allows appending additional content to the bottom of the display settings popover
15289
15296
  */
15290
15297
  additionalDisplaySettings?: ReactNode;
15298
+ /**
15299
+ * Allows completely custom rendering of the display selector popover via render prop.
15300
+ * Passes back the default controls as arguments for optional rendering.
15301
+ */
15302
+ customRender?: EuiDataGridDisplaySelectorCustomRender;
15291
15303
  }
15304
+ export type EuiDataGridDisplaySelectorCustomRender = (args: {
15305
+ densityControl: ReactNode;
15306
+ rowHeightControl: ReactNode;
15307
+ additionalDisplaySettings: ReactNode;
15308
+ resetButton: ReactNode;
15309
+ }) => ReactNode;
15292
15310
  export interface EuiDataGridToolBarVisibilityOptions {
15293
15311
  /**
15294
15312
  * Allows the ability for the user to hide fields and sort columns, boolean or a #EuiDataGridToolBarVisibilityColumnSelectorOptions
@@ -15428,6 +15446,14 @@ declare module '@elastic/eui/src/components/datagrid/data_grid_types' {
15428
15446
  * Defines the default size for all rows. It can be line count or just height.
15429
15447
  */
15430
15448
  defaultHeight?: EuiDataGridRowHeightOption;
15449
+ /**
15450
+ * Feature flag for custom `lineCount` behavior, where `lineCount` acts like a
15451
+ * *max* number of lines (instead of a set number of lines for all rows).
15452
+ *
15453
+ * This functionality is in beta and has performance implications;
15454
+ * we do not yet fully recommend/support it for heavy production usage.
15455
+ */
15456
+ autoBelowLineCount?: boolean;
15431
15457
  /**
15432
15458
  * Defines the height for a specific row. It can be line count or just height.
15433
15459
  *
@@ -16463,7 +16489,10 @@ declare module '@elastic/eui/src/components/datagrid/controls/display_selector'
16463
16489
  import { ReactNode } from 'react';
16464
16490
  import { EuiDataGridToolBarVisibilityOptions, EuiDataGridStyle, EuiDataGridRowHeightsOptions } from '@elastic/eui/src/components/datagrid/data_grid_types';
16465
16491
  export const startingStyles: EuiDataGridStyle;
16466
- export const useDataGridDisplaySelector: (showDisplaySelector: EuiDataGridToolBarVisibilityOptions['showDisplaySelector'], initialStyles: EuiDataGridStyle, initialRowHeightsOptions?: EuiDataGridRowHeightsOptions | undefined) => [ReactNode, EuiDataGridStyle, EuiDataGridRowHeightsOptions];
16492
+ /**
16493
+ * Display settings/selector popover
16494
+ */
16495
+ export const useDataGridDisplaySelector: (showDisplaySelector: EuiDataGridToolBarVisibilityOptions['showDisplaySelector'], passedGridStyles: EuiDataGridStyle, passedRowHeightsOptions?: EuiDataGridRowHeightsOptions) => [ReactNode, EuiDataGridStyle, EuiDataGridRowHeightsOptions];
16467
16496
 
16468
16497
  }
16469
16498
  declare module '@elastic/eui/src/components/description_list/description_list_types' {
@@ -31290,17 +31319,16 @@ declare module '@elastic/eui' {
31290
31319
  "euiColumnSorting.pickFields": any;
31291
31320
  "euiColumnSorting.clearAll": any;
31292
31321
  "euiDataGridToolbarControl.badgeAriaLabel": any;
31293
- "euiDisplaySelector.buttonText": any;
31294
- "euiDisplaySelector.resetButtonText": any;
31295
31322
  "euiDisplaySelector.densityLabel": any;
31296
31323
  "euiDisplaySelector.labelCompact": any;
31297
31324
  "euiDisplaySelector.labelNormal": any;
31298
31325
  "euiDisplaySelector.labelExpanded": any;
31299
31326
  "euiDisplaySelector.rowHeightLabel": any;
31300
- "euiDisplaySelector.labelSingle": any;
31301
31327
  "euiDisplaySelector.labelAuto": any;
31302
- "euiDisplaySelector.labelCustom": any;
31303
- "euiDisplaySelector.lineCountLabel": any;
31328
+ "euiDisplaySelector.labelStatic": any;
31329
+ "euiDisplaySelector.labelMax": any;
31330
+ "euiDisplaySelector.buttonText": any;
31331
+ "euiDisplaySelector.resetButtonText": any;
31304
31332
  "euiFullscreenSelector.fullscreenButton": any;
31305
31333
  "euiFullscreenSelector.fullscreenButtonActive": any;
31306
31334
  "euiKeyboardShortcuts.title": any;
package/i18ntokens.json CHANGED
@@ -1031,14 +1031,14 @@
1031
1031
  "highlighting": "string",
1032
1032
  "loc": {
1033
1033
  "start": {
1034
- "line": 738,
1034
+ "line": 748,
1035
1035
  "column": 23,
1036
- "index": 23328
1036
+ "index": 23788
1037
1037
  },
1038
1038
  "end": {
1039
- "line": 742,
1039
+ "line": 752,
1040
1040
  "column": 3,
1041
- "index": 23475
1041
+ "index": 23935
1042
1042
  }
1043
1043
  },
1044
1044
  "filepath": "src/components/datagrid/body/cell/data_grid_cell.tsx"
@@ -1049,14 +1049,14 @@
1049
1049
  "highlighting": "string",
1050
1050
  "loc": {
1051
1051
  "start": {
1052
- "line": 743,
1052
+ "line": 753,
1053
1053
  "column": 25,
1054
- "index": 23502
1054
+ "index": 23962
1055
1055
  },
1056
1056
  "end": {
1057
- "line": 746,
1057
+ "line": 756,
1058
1058
  "column": 3,
1059
- "index": 23608
1059
+ "index": 24068
1060
1060
  }
1061
1061
  },
1062
1062
  "filepath": "src/components/datagrid/body/cell/data_grid_cell.tsx"
@@ -1710,199 +1710,181 @@
1710
1710
  "filepath": "src/components/datagrid/controls/data_grid_toolbar_control.tsx"
1711
1711
  },
1712
1712
  {
1713
- "token": "euiDisplaySelector.buttonText",
1714
- "defString": "Display options",
1715
- "highlighting": "string",
1716
- "loc": {
1717
- "start": {
1718
- "line": 228,
1719
- "column": 22,
1720
- "index": 7412
1721
- },
1722
- "end": {
1723
- "line": 231,
1724
- "column": 3,
1725
- "index": 7486
1726
- }
1727
- },
1728
- "filepath": "src/components/datagrid/controls/display_selector.tsx"
1729
- },
1730
- {
1731
- "token": "euiDisplaySelector.resetButtonText",
1732
- "defString": "Reset to default",
1713
+ "token": "euiDisplaySelector.densityLabel",
1714
+ "defString": "Density",
1733
1715
  "highlighting": "string",
1734
1716
  "loc": {
1735
1717
  "start": {
1736
- "line": 232,
1737
- "column": 27,
1738
- "index": 7515
1718
+ "line": 96,
1719
+ "column": 4,
1720
+ "index": 2610
1739
1721
  },
1740
1722
  "end": {
1741
- "line": 235,
1742
- "column": 3,
1743
- "index": 7595
1723
+ "line": 104,
1724
+ "column": 5,
1725
+ "index": 2883
1744
1726
  }
1745
1727
  },
1746
1728
  "filepath": "src/components/datagrid/controls/display_selector.tsx"
1747
1729
  },
1748
1730
  {
1749
- "token": "euiDisplaySelector.densityLabel",
1750
- "defString": "Density",
1731
+ "token": "euiDisplaySelector.labelCompact",
1732
+ "defString": "Compact",
1751
1733
  "highlighting": "string",
1752
1734
  "loc": {
1753
1735
  "start": {
1754
- "line": 272,
1755
- "column": 10,
1756
- "index": 8779
1736
+ "line": 96,
1737
+ "column": 4,
1738
+ "index": 2610
1757
1739
  },
1758
1740
  "end": {
1759
- "line": 280,
1760
- "column": 11,
1761
- "index": 9100
1741
+ "line": 104,
1742
+ "column": 5,
1743
+ "index": 2883
1762
1744
  }
1763
1745
  },
1764
1746
  "filepath": "src/components/datagrid/controls/display_selector.tsx"
1765
1747
  },
1766
1748
  {
1767
- "token": "euiDisplaySelector.labelCompact",
1768
- "defString": "Compact",
1749
+ "token": "euiDisplaySelector.labelNormal",
1750
+ "defString": "Normal",
1769
1751
  "highlighting": "string",
1770
1752
  "loc": {
1771
1753
  "start": {
1772
- "line": 272,
1773
- "column": 10,
1774
- "index": 8779
1754
+ "line": 96,
1755
+ "column": 4,
1756
+ "index": 2610
1775
1757
  },
1776
1758
  "end": {
1777
- "line": 280,
1778
- "column": 11,
1779
- "index": 9100
1759
+ "line": 104,
1760
+ "column": 5,
1761
+ "index": 2883
1780
1762
  }
1781
1763
  },
1782
1764
  "filepath": "src/components/datagrid/controls/display_selector.tsx"
1783
1765
  },
1784
1766
  {
1785
- "token": "euiDisplaySelector.labelNormal",
1786
- "defString": "Normal",
1767
+ "token": "euiDisplaySelector.labelExpanded",
1768
+ "defString": "Expanded",
1787
1769
  "highlighting": "string",
1788
1770
  "loc": {
1789
1771
  "start": {
1790
- "line": 272,
1791
- "column": 10,
1792
- "index": 8779
1772
+ "line": 96,
1773
+ "column": 4,
1774
+ "index": 2610
1793
1775
  },
1794
1776
  "end": {
1795
- "line": 280,
1796
- "column": 11,
1797
- "index": 9100
1777
+ "line": 104,
1778
+ "column": 5,
1779
+ "index": 2883
1798
1780
  }
1799
1781
  },
1800
1782
  "filepath": "src/components/datagrid/controls/display_selector.tsx"
1801
1783
  },
1802
1784
  {
1803
- "token": "euiDisplaySelector.labelExpanded",
1804
- "defString": "Expanded",
1785
+ "token": "euiDisplaySelector.rowHeightLabel",
1786
+ "defString": "Lines per row",
1805
1787
  "highlighting": "string",
1806
1788
  "loc": {
1807
1789
  "start": {
1808
- "line": 272,
1809
- "column": 10,
1810
- "index": 8779
1790
+ "line": 227,
1791
+ "column": 4,
1792
+ "index": 6476
1811
1793
  },
1812
1794
  "end": {
1813
- "line": 280,
1814
- "column": 11,
1815
- "index": 9100
1795
+ "line": 235,
1796
+ "column": 5,
1797
+ "index": 6741
1816
1798
  }
1817
1799
  },
1818
1800
  "filepath": "src/components/datagrid/controls/display_selector.tsx"
1819
1801
  },
1820
1802
  {
1821
- "token": "euiDisplaySelector.rowHeightLabel",
1822
- "defString": "Row height",
1803
+ "token": "euiDisplaySelector.labelAuto",
1804
+ "defString": "Auto",
1823
1805
  "highlighting": "string",
1824
1806
  "loc": {
1825
1807
  "start": {
1826
- "line": 315,
1827
- "column": 10,
1828
- "index": 10207
1808
+ "line": 227,
1809
+ "column": 4,
1810
+ "index": 6476
1829
1811
  },
1830
1812
  "end": {
1831
- "line": 330,
1832
- "column": 11,
1833
- "index": 10680
1813
+ "line": 235,
1814
+ "column": 5,
1815
+ "index": 6741
1834
1816
  }
1835
1817
  },
1836
1818
  "filepath": "src/components/datagrid/controls/display_selector.tsx"
1837
1819
  },
1838
1820
  {
1839
- "token": "euiDisplaySelector.labelSingle",
1840
- "defString": "Single",
1821
+ "token": "euiDisplaySelector.labelStatic",
1822
+ "defString": "Static",
1841
1823
  "highlighting": "string",
1842
1824
  "loc": {
1843
1825
  "start": {
1844
- "line": 315,
1845
- "column": 10,
1846
- "index": 10207
1826
+ "line": 227,
1827
+ "column": 4,
1828
+ "index": 6476
1847
1829
  },
1848
1830
  "end": {
1849
- "line": 330,
1850
- "column": 11,
1851
- "index": 10680
1831
+ "line": 235,
1832
+ "column": 5,
1833
+ "index": 6741
1852
1834
  }
1853
1835
  },
1854
1836
  "filepath": "src/components/datagrid/controls/display_selector.tsx"
1855
1837
  },
1856
1838
  {
1857
- "token": "euiDisplaySelector.labelAuto",
1858
- "defString": "Auto fit",
1839
+ "token": "euiDisplaySelector.labelMax",
1840
+ "defString": "Max",
1859
1841
  "highlighting": "string",
1860
1842
  "loc": {
1861
1843
  "start": {
1862
- "line": 315,
1863
- "column": 10,
1864
- "index": 10207
1844
+ "line": 227,
1845
+ "column": 4,
1846
+ "index": 6476
1865
1847
  },
1866
1848
  "end": {
1867
- "line": 330,
1868
- "column": 11,
1869
- "index": 10680
1849
+ "line": 235,
1850
+ "column": 5,
1851
+ "index": 6741
1870
1852
  }
1871
1853
  },
1872
1854
  "filepath": "src/components/datagrid/controls/display_selector.tsx"
1873
1855
  },
1874
1856
  {
1875
- "token": "euiDisplaySelector.labelCustom",
1876
- "defString": "Custom",
1857
+ "token": "euiDisplaySelector.buttonText",
1858
+ "defString": "Display options",
1877
1859
  "highlighting": "string",
1878
1860
  "loc": {
1879
1861
  "start": {
1880
- "line": 315,
1881
- "column": 10,
1882
- "index": 10207
1862
+ "line": 393,
1863
+ "column": 22,
1864
+ "index": 11825
1883
1865
  },
1884
1866
  "end": {
1885
- "line": 330,
1886
- "column": 11,
1887
- "index": 10680
1867
+ "line": 396,
1868
+ "column": 3,
1869
+ "index": 11899
1888
1870
  }
1889
1871
  },
1890
1872
  "filepath": "src/components/datagrid/controls/display_selector.tsx"
1891
1873
  },
1892
1874
  {
1893
- "token": "euiDisplaySelector.lineCountLabel",
1894
- "defString": "Lines per row",
1875
+ "token": "euiDisplaySelector.resetButtonText",
1876
+ "defString": "Reset to default",
1895
1877
  "highlighting": "string",
1896
1878
  "loc": {
1897
1879
  "start": {
1898
- "line": 315,
1899
- "column": 10,
1900
- "index": 10207
1880
+ "line": 472,
1881
+ "column": 27,
1882
+ "index": 14023
1901
1883
  },
1902
1884
  "end": {
1903
- "line": 330,
1904
- "column": 11,
1905
- "index": 10680
1885
+ "line": 475,
1886
+ "column": 3,
1887
+ "index": 14103
1906
1888
  }
1907
1889
  },
1908
1890
  "filepath": "src/components/datagrid/controls/display_selector.tsx"
@@ -171,7 +171,7 @@ var EuiContextMenuPanelClass = exports.EuiContextMenuPanelClass = /*#__PURE__*/f
171
171
  items: _this.props.items
172
172
  },
173
173
  menuItems: [],
174
- focusedItemIndex: props.onClose && props.initialFocusedItemIndex != null ? props.initialFocusedItemIndex + 1 // Account for panel title back button
174
+ focusedItemIndex: props.onClose && props.initialFocusedItemIndex != null && props.initialFocusedItemIndex !== -1 ? props.initialFocusedItemIndex + 1 // Account for panel title back button
175
175
  : props.initialFocusedItemIndex,
176
176
  currentHeight: undefined,
177
177
  waitingForInitialPopover: false,
@@ -214,6 +214,16 @@ var EuiContextMenuPanelClass = exports.EuiContextMenuPanelClass = /*#__PURE__*/f
214
214
  return;
215
215
  }
216
216
 
217
+ // `initialFocusedItemIndex={-1}` should only be used when preventing initial item focus is desired
218
+ if (_this2.state.focusedItemIndex === -1) {
219
+ // Resetting the focusedItemIndex to 0 allows keyboard up/down behavior to
220
+ // still work correctly later if the panel is manually tabbed into
221
+ return _this2.setState({
222
+ tookInitialFocus: true,
223
+ focusedItemIndex: 0
224
+ });
225
+ }
226
+
217
227
  // If an item should be focused, focus it (if it exists)
218
228
  if (_this2.state.focusedItemIndex != null && _this2.state.menuItems.length) {
219
229
  var focusedItem = _this2.state.menuItems[_this2.state.focusedItemIndex];
@@ -406,6 +416,12 @@ EuiContextMenuPanelClass.propTypes = {
406
416
  "aria-label": _propTypes.default.string,
407
417
  "data-test-subj": _propTypes.default.string,
408
418
  css: _propTypes.default.any,
419
+ /**
420
+ * Determines the initially focused menu item for keyboard and screen reader users.
421
+ *
422
+ * Can be set to `-1` to prevent autofocus (an uncommon case that must have
423
+ * keyboard accessibility accounted for manually if used)
424
+ */
409
425
  initialFocusedItemIndex: _propTypes.default.number,
410
426
  items: _propTypes.default.arrayOf(_propTypes.default.element.isRequired),
411
427
  onClose: _propTypes.default.func,