@elastic/eui 97.1.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.
- package/es/components/context_menu/context_menu_panel.js +17 -1
- package/es/components/datagrid/body/cell/data_grid_cell.js +31 -8
- package/es/components/datagrid/body/data_grid_body.js +8 -0
- package/es/components/datagrid/body/data_grid_body_custom.js +8 -1
- package/es/components/datagrid/body/data_grid_body_virtualized.js +8 -1
- package/es/components/datagrid/controls/data_grid_toolbar.styles.js +2 -2
- package/es/components/datagrid/controls/display_selector.js +277 -207
- package/es/components/datagrid/data_grid.stories.utils.js +28 -2
- package/es/components/datagrid/data_grid.styles.js +1 -1
- package/es/components/datagrid/utils/col_widths.js +7 -13
- package/es/components/datagrid/utils/grid_height_width.js +1 -1
- package/es/components/datagrid/utils/row_heights.js +29 -13
- package/es/components/header/header.styles.js +8 -1
- package/es/components/header/header_links/header_links.js +1 -1
- package/es/components/header/header_links/header_links.styles.js +1 -0
- package/es/services/hooks/useDeepEqual.js +18 -6
- package/eui.d.ts +40 -11
- package/i18ntokens.json +92 -110
- package/lib/components/context_menu/context_menu_panel.js +17 -1
- package/lib/components/datagrid/body/cell/data_grid_cell.js +31 -8
- package/lib/components/datagrid/body/data_grid_body.js +8 -0
- package/lib/components/datagrid/body/data_grid_body_custom.js +8 -1
- package/lib/components/datagrid/body/data_grid_body_virtualized.js +8 -1
- package/lib/components/datagrid/controls/data_grid_toolbar.styles.js +2 -2
- package/lib/components/datagrid/controls/display_selector.js +275 -204
- package/lib/components/datagrid/data_grid.stories.utils.js +28 -2
- package/lib/components/datagrid/data_grid.styles.js +1 -1
- package/lib/components/datagrid/utils/col_widths.js +7 -13
- package/lib/components/datagrid/utils/grid_height_width.js +1 -1
- package/lib/components/datagrid/utils/row_heights.js +29 -13
- package/lib/components/header/header.styles.js +8 -1
- package/lib/components/header/header_links/header_links.js +1 -1
- package/lib/components/header/header_links/header_links.styles.js +1 -0
- package/lib/services/hooks/useDeepEqual.js +17 -7
- package/optimize/es/components/context_menu/context_menu_panel.js +11 -1
- package/optimize/es/components/datagrid/body/cell/data_grid_cell.js +15 -8
- package/optimize/es/components/datagrid/body/data_grid_body_custom.js +0 -1
- package/optimize/es/components/datagrid/body/data_grid_body_virtualized.js +0 -1
- package/optimize/es/components/datagrid/controls/data_grid_toolbar.styles.js +2 -2
- package/optimize/es/components/datagrid/controls/display_selector.js +277 -207
- package/optimize/es/components/datagrid/data_grid.styles.js +1 -1
- package/optimize/es/components/datagrid/utils/col_widths.js +7 -13
- package/optimize/es/components/datagrid/utils/grid_height_width.js +1 -1
- package/optimize/es/components/datagrid/utils/row_heights.js +29 -13
- package/optimize/es/components/header/header.styles.js +8 -1
- package/optimize/es/components/header/header_links/header_links.js +1 -1
- package/optimize/es/components/header/header_links/header_links.styles.js +1 -0
- package/optimize/es/services/hooks/useDeepEqual.js +13 -6
- package/optimize/lib/components/context_menu/context_menu_panel.js +11 -1
- package/optimize/lib/components/datagrid/body/cell/data_grid_cell.js +15 -8
- package/optimize/lib/components/datagrid/body/data_grid_body_custom.js +0 -1
- package/optimize/lib/components/datagrid/body/data_grid_body_virtualized.js +0 -1
- package/optimize/lib/components/datagrid/controls/data_grid_toolbar.styles.js +2 -2
- package/optimize/lib/components/datagrid/controls/display_selector.js +274 -204
- package/optimize/lib/components/datagrid/data_grid.styles.js +1 -1
- package/optimize/lib/components/datagrid/utils/col_widths.js +7 -13
- package/optimize/lib/components/datagrid/utils/grid_height_width.js +1 -1
- package/optimize/lib/components/datagrid/utils/row_heights.js +29 -13
- package/optimize/lib/components/header/header.styles.js +8 -1
- package/optimize/lib/components/header/header_links/header_links.js +1 -1
- package/optimize/lib/components/header/header_links/header_links.styles.js +1 -0
- package/optimize/lib/services/hooks/useDeepEqual.js +12 -5
- package/package.json +1 -1
- package/test-env/components/context_menu/context_menu_panel.js +17 -1
- package/test-env/components/datagrid/body/cell/data_grid_cell.js +31 -8
- package/test-env/components/datagrid/body/data_grid_body.js +8 -0
- package/test-env/components/datagrid/body/data_grid_body_custom.js +8 -1
- package/test-env/components/datagrid/body/data_grid_body_virtualized.js +8 -1
- package/test-env/components/datagrid/controls/data_grid_toolbar.styles.js +2 -2
- package/test-env/components/datagrid/controls/display_selector.js +274 -204
- package/test-env/components/datagrid/data_grid.stories.utils.js +28 -2
- package/test-env/components/datagrid/data_grid.styles.js +1 -1
- package/test-env/components/datagrid/utils/col_widths.js +7 -13
- package/test-env/components/datagrid/utils/grid_height_width.js +1 -1
- package/test-env/components/datagrid/utils/row_heights.js +29 -13
- package/test-env/components/header/header.styles.js +8 -1
- package/test-env/components/header/header_links/header_links.js +1 -1
- package/test-env/components/header/header_links/header_links.styles.js +1 -0
- package/test-env/services/hooks/useDeepEqual.js +12 -5
|
@@ -164,7 +164,7 @@ export var EuiContextMenuPanelClass = /*#__PURE__*/function (_Component) {
|
|
|
164
164
|
items: _this.props.items
|
|
165
165
|
},
|
|
166
166
|
menuItems: [],
|
|
167
|
-
focusedItemIndex: props.onClose && props.initialFocusedItemIndex != null ? props.initialFocusedItemIndex + 1 // Account for panel title back button
|
|
167
|
+
focusedItemIndex: props.onClose && props.initialFocusedItemIndex != null && props.initialFocusedItemIndex !== -1 ? props.initialFocusedItemIndex + 1 // Account for panel title back button
|
|
168
168
|
: props.initialFocusedItemIndex,
|
|
169
169
|
currentHeight: undefined,
|
|
170
170
|
waitingForInitialPopover: false,
|
|
@@ -207,6 +207,16 @@ export var EuiContextMenuPanelClass = /*#__PURE__*/function (_Component) {
|
|
|
207
207
|
return;
|
|
208
208
|
}
|
|
209
209
|
|
|
210
|
+
// `initialFocusedItemIndex={-1}` should only be used when preventing initial item focus is desired
|
|
211
|
+
if (_this2.state.focusedItemIndex === -1) {
|
|
212
|
+
// Resetting the focusedItemIndex to 0 allows keyboard up/down behavior to
|
|
213
|
+
// still work correctly later if the panel is manually tabbed into
|
|
214
|
+
return _this2.setState({
|
|
215
|
+
tookInitialFocus: true,
|
|
216
|
+
focusedItemIndex: 0
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
|
|
210
220
|
// If an item should be focused, focus it (if it exists)
|
|
211
221
|
if (_this2.state.focusedItemIndex != null && _this2.state.menuItems.length) {
|
|
212
222
|
var focusedItem = _this2.state.menuItems[_this2.state.focusedItemIndex];
|
|
@@ -399,6 +409,12 @@ EuiContextMenuPanelClass.propTypes = {
|
|
|
399
409
|
"aria-label": PropTypes.string,
|
|
400
410
|
"data-test-subj": PropTypes.string,
|
|
401
411
|
css: PropTypes.any,
|
|
412
|
+
/**
|
|
413
|
+
* Determines the initially focused menu item for keyboard and screen reader users.
|
|
414
|
+
*
|
|
415
|
+
* Can be set to `-1` to prevent autofocus (an uncommon case that must have
|
|
416
|
+
* keyboard accessibility accounted for manually if used)
|
|
417
|
+
*/
|
|
402
418
|
initialFocusedItemIndex: PropTypes.number,
|
|
403
419
|
items: PropTypes.arrayOf(PropTypes.element.isRequired),
|
|
404
420
|
onClose: PropTypes.func,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
-
var _excluded = ["renderCellValue", "cellContext", "column", "setCellContentsRef", "rowIndex", "colIndex", "
|
|
2
|
+
var _excluded = ["renderCellValue", "cellContext", "column", "setCellContentsRef", "rowIndex", "colIndex", "rowHeightsOptions", "rowHeightUtils", "isControlColumn"],
|
|
3
3
|
_excluded2 = ["width", "popoverContext", "interactiveCellId", "columnType", "className", "column", "style", "rowHeightUtils", "rowHeightsOptions", "rowManager", "pagination"],
|
|
4
4
|
_excluded3 = ["isExpandable", "style", "className", "data-test-subj"],
|
|
5
5
|
_excluded4 = ["columnId", "columnIndex", "rowIndex", "visibleRowIndex"];
|
|
@@ -58,15 +58,20 @@ var EuiDataGridCellContent = /*#__PURE__*/memo(function (_ref) {
|
|
|
58
58
|
setCellContentsRef = _ref.setCellContentsRef,
|
|
59
59
|
rowIndex = _ref.rowIndex,
|
|
60
60
|
colIndex = _ref.colIndex,
|
|
61
|
-
|
|
61
|
+
rowHeightsOptions = _ref.rowHeightsOptions,
|
|
62
62
|
rowHeightUtils = _ref.rowHeightUtils,
|
|
63
63
|
isControlColumn = _ref.isControlColumn,
|
|
64
64
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
65
65
|
// React is more permissive than the TS types indicate
|
|
66
66
|
var CellElement = renderCellValue;
|
|
67
|
+
|
|
68
|
+
// Cell height type
|
|
69
|
+
var rowHeight = rowHeightUtils === null || rowHeightUtils === void 0 ? void 0 : rowHeightUtils.getRowHeightOption(rowIndex, rowHeightsOptions);
|
|
67
70
|
var cellHeightType = useMemo(function () {
|
|
68
|
-
return (rowHeightUtils === null || rowHeightUtils === void 0 ? void 0 : rowHeightUtils.getHeightType(rowHeight)) || 'default';
|
|
69
|
-
}, [rowHeightUtils, rowHeight]);
|
|
71
|
+
return rowHeightUtils !== null && rowHeightUtils !== void 0 && rowHeightUtils.isAutoBelowLineCount(rowHeightsOptions, rowHeight) ? 'autoBelowLineCount' : (rowHeightUtils === null || rowHeightUtils === void 0 ? void 0 : rowHeightUtils.getHeightType(rowHeight)) || 'default';
|
|
72
|
+
}, [rowHeightUtils, rowHeight, rowHeightsOptions]);
|
|
73
|
+
|
|
74
|
+
// Classes and styles
|
|
70
75
|
var classes = useMemo(function () {
|
|
71
76
|
return classNames('euiDataGridRowCell__content', "euiDataGridRowCell__content--".concat(cellHeightType, "Height"), !isControlColumn && {
|
|
72
77
|
'eui-textBreakWord': cellHeightType !== 'default',
|
|
@@ -77,9 +82,9 @@ var EuiDataGridCellContent = /*#__PURE__*/memo(function (_ref) {
|
|
|
77
82
|
var cssStyles = [styles.content.euiDataGridRowCell__content].concat(_toConsumableArray(isControlColumn ? [styles.content.controlColumn, styles.content.autoHeight] : [
|
|
78
83
|
// Regular data cells should always inherit height from the row wrapper,
|
|
79
84
|
// except for auto height
|
|
80
|
-
cellHeightType === 'auto' ? styles.content.autoHeight : styles.content.defaultHeight]));
|
|
85
|
+
cellHeightType === 'auto' || cellHeightType === 'autoBelowLineCount' ? styles.content.autoHeight : styles.content.defaultHeight]));
|
|
81
86
|
return ___EmotionJSX(RenderTruncatedCellContent, {
|
|
82
|
-
hasLineCountTruncation: cellHeightType === 'lineCount' && !isControlColumn,
|
|
87
|
+
hasLineCountTruncation: (cellHeightType === 'lineCount' || cellHeightType === 'autoBelowLineCount') && !isControlColumn,
|
|
83
88
|
rowHeight: rowHeight
|
|
84
89
|
}, ___EmotionJSX("div", {
|
|
85
90
|
ref: setCellContentsRef,
|
|
@@ -512,6 +517,14 @@ EuiDataGridCellContent.propTypes = {
|
|
|
512
517
|
lineCount: PropTypes.number,
|
|
513
518
|
height: PropTypes.number
|
|
514
519
|
}).isRequired]),
|
|
520
|
+
/**
|
|
521
|
+
* Feature flag for custom `lineCount` behavior, where `lineCount` acts like a
|
|
522
|
+
* *max* number of lines (instead of a set number of lines for all rows).
|
|
523
|
+
*
|
|
524
|
+
* This functionality is in beta and has performance implications;
|
|
525
|
+
* we do not yet fully recommend/support it for heavy production usage.
|
|
526
|
+
*/
|
|
527
|
+
autoBelowLineCount: PropTypes.bool,
|
|
515
528
|
/**
|
|
516
529
|
* Defines the height for a specific row. It can be line count or just height.
|
|
517
530
|
*
|
|
@@ -652,6 +665,9 @@ export var EuiDataGridCell = /*#__PURE__*/function (_Component) {
|
|
|
652
665
|
rowHeightsOptions = _this$props3.rowHeightsOptions,
|
|
653
666
|
rowIndex = _this$props3.rowIndex;
|
|
654
667
|
var rowHeightOption = rowHeightUtils === null || rowHeightUtils === void 0 ? void 0 : rowHeightUtils.getRowHeightOption(rowIndex, rowHeightsOptions);
|
|
668
|
+
if (rowHeightUtils !== null && rowHeightUtils !== void 0 && rowHeightUtils.isAutoBelowLineCount(rowHeightsOptions, rowHeightOption)) {
|
|
669
|
+
return; // Using auto height instead
|
|
670
|
+
}
|
|
655
671
|
var isSingleLine = rowHeightOption == null; // Undefined rowHeightsOptions default to a single line
|
|
656
672
|
var lineCount = isSingleLine ? 1 : rowHeightUtils === null || rowHeightUtils === void 0 ? void 0 : rowHeightUtils.getLineCount(rowHeightOption);
|
|
657
673
|
if (lineCount) {
|
|
@@ -956,7 +972,6 @@ export var EuiDataGridCell = /*#__PURE__*/function (_Component) {
|
|
|
956
972
|
// column width, can be undefined
|
|
957
973
|
lineHeight: (_rowHeightsOptions$li = rowHeightsOptions === null || rowHeightsOptions === void 0 ? void 0 : rowHeightsOptions.lineHeight) !== null && _rowHeightsOptions$li !== void 0 ? _rowHeightsOptions$li : undefined
|
|
958
974
|
}, cellPropsStyle);
|
|
959
|
-
var rowHeight = rowHeightUtils === null || rowHeightUtils === void 0 ? void 0 : rowHeightUtils.getRowHeightOption(rowIndex, rowHeightsOptions);
|
|
960
975
|
var row = rowManager && !IS_JEST_ENVIRONMENT ? rowManager.getRow({
|
|
961
976
|
rowIndex: rowIndex,
|
|
962
977
|
visibleRowIndex: visibleRowIndex,
|
|
@@ -988,7 +1003,7 @@ export var EuiDataGridCell = /*#__PURE__*/function (_Component) {
|
|
|
988
1003
|
isExpandable: isExpandable,
|
|
989
1004
|
isExpanded: popoverIsOpen,
|
|
990
1005
|
setCellContentsRef: this.setCellContentsRef,
|
|
991
|
-
|
|
1006
|
+
rowHeightsOptions: rowHeightsOptions,
|
|
992
1007
|
rowHeightUtils: rowHeightUtils,
|
|
993
1008
|
isControlColumn: isControlColumn,
|
|
994
1009
|
rowIndex: rowIndex,
|
|
@@ -1373,6 +1388,14 @@ EuiDataGridCell.propTypes = {
|
|
|
1373
1388
|
lineCount: PropTypes.number,
|
|
1374
1389
|
height: PropTypes.number
|
|
1375
1390
|
}).isRequired]),
|
|
1391
|
+
/**
|
|
1392
|
+
* Feature flag for custom `lineCount` behavior, where `lineCount` acts like a
|
|
1393
|
+
* *max* number of lines (instead of a set number of lines for all rows).
|
|
1394
|
+
*
|
|
1395
|
+
* This functionality is in beta and has performance implications;
|
|
1396
|
+
* we do not yet fully recommend/support it for heavy production usage.
|
|
1397
|
+
*/
|
|
1398
|
+
autoBelowLineCount: PropTypes.bool,
|
|
1376
1399
|
/**
|
|
1377
1400
|
* Defines the height for a specific row. It can be line count or just height.
|
|
1378
1401
|
*
|
|
@@ -573,6 +573,14 @@ EuiDataGridBody.propTypes = {
|
|
|
573
573
|
lineCount: PropTypes.number,
|
|
574
574
|
height: PropTypes.number
|
|
575
575
|
}).isRequired]),
|
|
576
|
+
/**
|
|
577
|
+
* Feature flag for custom `lineCount` behavior, where `lineCount` acts like a
|
|
578
|
+
* *max* number of lines (instead of a set number of lines for all rows).
|
|
579
|
+
*
|
|
580
|
+
* This functionality is in beta and has performance implications;
|
|
581
|
+
* we do not yet fully recommend/support it for heavy production usage.
|
|
582
|
+
*/
|
|
583
|
+
autoBelowLineCount: PropTypes.bool,
|
|
576
584
|
/**
|
|
577
585
|
* Defines the height for a specific row. It can be line count or just height.
|
|
578
586
|
*
|
|
@@ -83,7 +83,6 @@ export var EuiDataGridBodyCustomRender = /*#__PURE__*/memo(function (_ref) {
|
|
|
83
83
|
*/
|
|
84
84
|
var rowHeightUtils = useRowHeightUtils({
|
|
85
85
|
rowHeightsOptions: rowHeightsOptions,
|
|
86
|
-
gridStyles: gridStyles,
|
|
87
86
|
columns: columns
|
|
88
87
|
});
|
|
89
88
|
var _useDefaultRowHeight = useDefaultRowHeight({
|
|
@@ -738,6 +737,14 @@ EuiDataGridBodyCustomRender.propTypes = {
|
|
|
738
737
|
lineCount: PropTypes.number,
|
|
739
738
|
height: PropTypes.number
|
|
740
739
|
}).isRequired]),
|
|
740
|
+
/**
|
|
741
|
+
* Feature flag for custom `lineCount` behavior, where `lineCount` acts like a
|
|
742
|
+
* *max* number of lines (instead of a set number of lines for all rows).
|
|
743
|
+
*
|
|
744
|
+
* This functionality is in beta and has performance implications;
|
|
745
|
+
* we do not yet fully recommend/support it for heavy production usage.
|
|
746
|
+
*/
|
|
747
|
+
autoBelowLineCount: PropTypes.bool,
|
|
741
748
|
/**
|
|
742
749
|
* Defines the height for a specific row. It can be line count or just height.
|
|
743
750
|
*
|
|
@@ -216,7 +216,6 @@ export var EuiDataGridBodyVirtualized = /*#__PURE__*/memo(function (_ref3) {
|
|
|
216
216
|
gridItemsRenderedRef: gridItemsRendered
|
|
217
217
|
},
|
|
218
218
|
rowHeightsOptions: rowHeightsOptions,
|
|
219
|
-
gridStyles: gridStyles,
|
|
220
219
|
columns: columns
|
|
221
220
|
});
|
|
222
221
|
var _useDefaultRowHeight = useDefaultRowHeight({
|
|
@@ -863,6 +862,14 @@ EuiDataGridBodyVirtualized.propTypes = {
|
|
|
863
862
|
lineCount: PropTypes.number,
|
|
864
863
|
height: PropTypes.number
|
|
865
864
|
}).isRequired]),
|
|
865
|
+
/**
|
|
866
|
+
* Feature flag for custom `lineCount` behavior, where `lineCount` acts like a
|
|
867
|
+
* *max* number of lines (instead of a set number of lines for all rows).
|
|
868
|
+
*
|
|
869
|
+
* This functionality is in beta and has performance implications;
|
|
870
|
+
* we do not yet fully recommend/support it for heavy production usage.
|
|
871
|
+
*/
|
|
872
|
+
autoBelowLineCount: PropTypes.bool,
|
|
866
873
|
/**
|
|
867
874
|
* Defines the height for a specific row. It can be line count or just height.
|
|
868
875
|
*
|
|
@@ -12,7 +12,7 @@ export var euiDataGridToolbarStyles = function euiDataGridToolbarStyles(_ref) {
|
|
|
12
12
|
var euiTheme = _ref.euiTheme;
|
|
13
13
|
return {
|
|
14
14
|
euiDataGrid__controls: /*#__PURE__*/css("z-index:2;position:relative;display:flex;justify-content:space-between;align-items:center;gap:", euiTheme.size.base, ";", logicalCSS('padding-vertical', euiTheme.size.xs), " background-color:", euiTheme.colors.emptyShade, ";;label:euiDataGrid__controls;"),
|
|
15
|
-
euiDataGrid__rightControls: /*#__PURE__*/css("display:flex;justify-content:flex-end;flex-wrap:wrap;column-gap:", euiTheme.size.s, ";", logicalCSS('padding-right', euiTheme.size.xs), "&:only-child{", logicalCSS('margin-left', 'auto'), ";};label:euiDataGrid__rightControls;"),
|
|
16
|
-
euiDataGrid__leftControls: /*#__PURE__*/css("display:flex;flex-wrap:wrap;gap:", euiTheme.size.xxs, ";;label:euiDataGrid__leftControls;")
|
|
15
|
+
euiDataGrid__rightControls: /*#__PURE__*/css("display:flex;justify-content:flex-end;align-items:center;flex-wrap:wrap;column-gap:", euiTheme.size.s, ";", logicalCSS('padding-right', euiTheme.size.xs), "&:only-child{", logicalCSS('margin-left', 'auto'), ";};label:euiDataGrid__rightControls;"),
|
|
16
|
+
euiDataGrid__leftControls: /*#__PURE__*/css("display:flex;flex-wrap:wrap;align-items:center;gap:", euiTheme.size.xxs, ";;label:euiDataGrid__leftControls;")
|
|
17
17
|
};
|
|
18
18
|
};
|