diff --git a/packages/eui/src/components/datagrid/__snapshots__/data_grid.test.tsx.snap b/packages/eui/src/components/datagrid/__snapshots__/data_grid.test.tsx.snap index f197ca1bf0b..cc6c8c465c9 100644 --- a/packages/eui/src/components/datagrid/__snapshots__/data_grid.test.tsx.snap +++ b/packages/eui/src/components/datagrid/__snapshots__/data_grid.test.tsx.snap @@ -457,11 +457,11 @@ exports[`EuiDataGrid rendering renders additional toolbar controls 1`] = ` tabindex="-1" />
{ + const { euiTheme } = euiThemeContext; + + return { + euiDataGrid: css` + display: flex; + flex-direction: column; + align-items: stretch; + ${logicalCSS('height', '100%')} + overflow: hidden; + `, + // Sits below the controls above it and pagination below it + euiDataGrid__content: css` + z-index: 1; + position: relative; + flex-grow: 1; + ${logicalSizeCSS('100%')} + ${logicalCSS('max-width', '100%')} + overflow: hidden; + background-color: ${euiTheme.colors.body}; + font-feature-settings: 'tnum' 1; /* Tabular numbers */ + `, + // Wrapper around EuiDataGrid + euiDataGrid__focusWrap: css` + ${logicalCSS('height', '100%')} + `, + }; +}; diff --git a/packages/eui/src/components/datagrid/data_grid.tsx b/packages/eui/src/components/datagrid/data_grid.tsx index f3c7341df39..89bd611a559 100644 --- a/packages/eui/src/components/datagrid/data_grid.tsx +++ b/packages/eui/src/components/datagrid/data_grid.tsx @@ -19,7 +19,7 @@ import { VariableSizeGrid as Grid, GridOnItemsRenderedProps, } from 'react-window'; -import { useGeneratedHtmlId } from '../../services'; +import { useGeneratedHtmlId, useEuiMemoizedStyles } from '../../services'; import { useEuiTablePaginationDefaults } from '../table/table_pagination'; import { EuiFocusTrap } from '../focus_trap'; import { EuiI18n, useEuiI18n } from '../i18n'; @@ -67,6 +67,7 @@ import { EuiDataGridStyleHeader, EuiDataGridStyleRowHover, } from './data_grid_types'; +import { euiDataGridStyles } from './data_grid.styles'; // Each gridStyle object above sets a specific CSS select to .euiGrid const fontSizesToClassMap: { [size in EuiDataGridStyleFontSizes]: string } = { @@ -427,6 +428,8 @@ export const EuiDataGrid = memo( ] ); + const styles = useEuiMemoizedStyles(euiDataGridStyles); + return ( @@ -434,8 +437,10 @@ export const EuiDataGrid = memo(