Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Emotion] Convert final EuiDataGrid cell styles (Part 5) #8013

Merged
merged 28 commits into from
Sep 12, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
175b2f8
Convert remaining `.euiDataGridRowCell` styles
cee-chen Sep 10, 2024
046bfef
Convert remaining `.euiDataGridRowCell__content` styles
cee-chen Sep 10, 2024
ba408b6
Update downstream snapshots
cee-chen Sep 9, 2024
91a349c
Convert remaining `.euiDataGridHeaderCell` styles
cee-chen Sep 10, 2024
89ad354
[refactor] Remove unnecessary `CellContent` FC
cee-chen Sep 10, 2024
45aeb31
Convert `.euiDataGridHeaderCell__content` styles
cee-chen Sep 10, 2024
95548bb
[refactor] Clean up column actions button/icon DOM+CSS
cee-chen Sep 10, 2024
ccde288
Convert `.euiDataGridHeaderCell__button` styles
cee-chen Sep 10, 2024
c9327ca
Add VRT/E2E tests for header styles
cee-chen Sep 10, 2024
8320712
[refactor] clean up header control column DOM
cee-chen Sep 10, 2024
25d92ff
Update downstream tests/snapshots
cee-chen Sep 10, 2024
480f098
[Enhancement] Replace unused header cell actions CSS
cee-chen Sep 1, 2024
22f27c8
Convert column resizer styles
cee-chen Sep 1, 2024
18ce982
Convert remaining `.euiDataGridFooterCell` styles
cee-chen Sep 9, 2024
2a80790
changelog
cee-chen Sep 10, 2024
64d3ce5
Delete all data grid Sass files
cee-chen Sep 1, 2024
9e68f6f
Final component Sass deletions 🥲
cee-chen Sep 10, 2024
d70c124
[tech debt] Address various Emotion component post-conversion TODOs
cee-chen Sep 10, 2024
5d47175
Final EuiDataGrid VRT updates
cee-chen Sep 10, 2024
d7d70c2
Fix Storybook control docgen for `gridStyle`/`rowHeightsOptions`/`too…
cee-chen Sep 10, 2024
456f5ef
Fix Cypress axe test
cee-chen Sep 10, 2024
64f1748
[PR feedback] Fix column actions button sizing
cee-chen Sep 11, 2024
fb0178c
[PR feedback] Remove `export` on internal consts
cee-chen Sep 11, 2024
3e6c32b
[refactor] avoid render prop + unmemoized array by creating a new fun…
cee-chen Sep 11, 2024
7594ac8
[a11y] Fix VO not correctly reading out SR text due to newlines in JSX
cee-chen Sep 11, 2024
bf7853e
[refactor] remove non-content children out of EuiDataGridCellContent
cee-chen Sep 11, 2024
f53c710
[cleanup] Replace `hidden` attribute with conditional JSX
cee-chen Sep 12, 2024
0b29898
[refactor] clean up focus trap aria-describedby text
cee-chen Sep 12, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,18 @@ exports[`EuiDataGridHeaderCell renders 1`] = `
>
<button
aria-label="Press the Enter key to view this column's actions"
class="euiDataGridHeaderCell__button css-wvewty"
class="euiButtonIcon euiDataGridHeaderCell__button emotion-euiButtonIcon-xs-empty-text"
data-euigrid-tab-managed="true"
data-test-subj="dataGridHeaderCellActionButton-someColumn"
tabindex="-1"
type="button"
>
<div
class="euiDataGridHeaderCell__icon"
>
<span
color="text"
data-euiicon-type="boxesVertical"
/>
</div>
<span
aria-hidden="true"
class="euiButtonIcon__icon"
color="inherit"
data-euiicon-type="boxesVertical"
/>
</button>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,51 +2,17 @@
// We only truncate if the cell is not a control column.
&:not(.euiDataGridHeaderCell--controlColumn) {
.euiDataGridHeaderCell__button {
position: relative;
display: flex;
align-items: center;
gap: $euiSizeXS;
width: 100%;
border-radius: $euiBorderRadiusSmall;
font-weight: $euiFontWeightBold;
outline: none;

&:focus-visible {
outline: none;
}
}

[data-focus-lock-disabled='false'] .euiDataGridHeaderCell__button {
@include euiFocusRing;
color: $euiFocusRingColor;
}

.euiDataGridHeaderCell__icon {
flex: 0 0 auto; // Ensure icon doesn't shrink
margin-left: auto; // Aligns the icon to the right
// Center the icon
display: flex;
align-items: center;
justify-content: center;
width: 0;
height: $euiSize;
overflow: hidden;
opacity: 0;

transition: width $euiAnimSpeedFast ease-in, opacity $euiAnimSpeedSlow ease-in;
transform: none !important; // Unset EuiButtonIcon animations
animation: none;
}

&:focus-within,
&:hover,
.euiPopover-isOpen {
&:not(:hover, :focus-within, .euiDataGridHeaderCell--isActionsPopoverOpen) {
.euiDataGridHeaderCell__button {
padding: $euiSizeXS;
// balance out additional button target size in header height, prevents increased header cell height
margin-block: -$euiSizeXS;
}

.euiDataGridHeaderCell__icon {
width: $euiSize;
opacity: 1;
width: 0;
opacity: 0;
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ import { EuiI18n, useEuiI18n } from '../../../i18n';
import { EuiIcon } from '../../../icon';
import { EuiListGroup } from '../../../list_group';
import { EuiPopover } from '../../../popover';
import { _emptyHoverStyles } from '../../../button/button_icon/button_icon.styles';
import { EuiButtonIcon } from '../../../button';

import { DataGridFocusContext } from '../../utils/focus';
import {
EuiDataGridHeaderCellProps,
EuiDataGridSorting,
} from '../../data_grid_types';

import { getColumnActions } from './column_actions';
import { EuiDataGridColumnResizer } from './data_grid_column_resizer';
import { EuiDataGridHeaderCellWrapper } from './data_grid_header_cell_wrapper';
Expand Down Expand Up @@ -153,7 +153,6 @@ export const EuiDataGridHeaderCell: FunctionComponent<EuiDataGridHeaderCellProps
? styles.right
: styles.left,
];
const emptyHoverStyles = useEuiMemoizedStyles(_emptyHoverStyles);

return (
<EuiDataGridHeaderCellWrapper
Expand Down Expand Up @@ -201,13 +200,16 @@ export const EuiDataGridHeaderCell: FunctionComponent<EuiDataGridHeaderCellProps
anchorPosition="downRight"
css={{ marginInlineStart: 'auto' }} // Align to right
button={
<button
ref={actionsButtonRef}
<EuiButtonIcon
iconType="boxesVertical"
iconSize="s"
color="text"
className="euiDataGridHeaderCell__button"
css={emptyHoverStyles.text}
buttonRef={actionsButtonRef}
onClick={togglePopover}
onFocus={() => setIsActionsButtonFocused(true)}
onBlur={() => setIsActionsButtonFocused(false)}
tabIndex={0} // Override EuiButtonIcon's conditional tabindex based on aria-hidden
aria-hidden={
hasFocusTrap && !isActionsButtonFocused
? 'true' // prevent the actions button from being read on cell focus
Expand All @@ -219,11 +221,7 @@ export const EuiDataGridHeaderCell: FunctionComponent<EuiDataGridHeaderCellProps
: actionsEnterKeyInstructions
}
data-test-subj={`dataGridHeaderCellActionButton-${id}`}
>
<div className="euiDataGridHeaderCell__icon">
<EuiIcon type="boxesVertical" size="s" color="text" />
</div>
</button>
/>
}
isOpen={isPopoverOpen}
closePopover={closePopover}
Expand Down
4 changes: 4 additions & 0 deletions packages/eui/src/components/datagrid/data_grid.styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,10 @@ export const euiDataGridStyles = (euiThemeContext: UseEuiTheme) => {
font-size: ${fontSize[size]};
line-height: ${lineHeight[size]};
}

.euiDataGridHeaderCell__button {
${logicalSizeCSS(lineHeight[size])}
mgadewoll marked this conversation as resolved.
Show resolved Hide resolved
}
`,
get s() {
return css(this.fontSize('s'));
Expand Down