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

[Visual Refresh] Update color token mappings #8211

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
1798eed
refactor: remove base semantic colors from theme colors
mgadewoll Dec 4, 2024
307afaa
refactor: update primitive color values
mgadewoll Dec 4, 2024
50ef806
refactor: update legacy JSON token values
mgadewoll Dec 5, 2024
eb67a85
refactor: remove transparent scales, add specific transparent semanti…
mgadewoll Dec 5, 2024
0876442
fix: update subdued badge background mapping
mgadewoll Dec 5, 2024
45c76bc
refactor: fix docs sass and JSON token loading; remove unexpected dep…
mgadewoll Dec 5, 2024
74d9510
refactor: update text and title color token values
mgadewoll Dec 6, 2024
49a9d5c
refactor: update beacon successcolor mapping
mgadewoll Dec 6, 2024
ad469fd
refactor: update beta_badge mappings
mgadewoll Dec 6, 2024
813e38b
chore: update deprecation description
mgadewoll Dec 6, 2024
762cbf7
refactor: update select background color token mapping
mgadewoll Dec 8, 2024
27c8f2b
refactor: update datagrid border and select color mappings
mgadewoll Dec 8, 2024
aec9180
feat: add backgroundBaseHighlighted color token
mgadewoll Dec 9, 2024
e33d51f
feat: support generic highlighted background usage
mgadewoll Dec 9, 2024
bb9248a
refactor: update flyout footer to use highlighted background
mgadewoll Dec 9, 2024
9b5ace3
refactor: add highlighted background option control to comment stories
mgadewoll Dec 9, 2024
772325c
refactor: align default and subdued badge color mappings
mgadewoll Dec 9, 2024
27f4581
refactor: update legacy JSON warning color mappings
mgadewoll Dec 9, 2024
c8f257e
refactor: update plainLightAlpha6 to plainLightAlpha8
mgadewoll Dec 11, 2024
0a7507b
refactor: update white/black usages to full hex codes
mgadewoll Dec 11, 2024
99520c4
refactor: inherit base colors for alpha colors
mgadewoll Dec 11, 2024
0521dcb
chore: cleanup
mgadewoll Dec 11, 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
5 changes: 5 additions & 0 deletions packages/eui-theme-borealis/src/variables/_components.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,12 @@ const component_colors: _EuiThemeComponentColors = {
collapsibleNavGroupBackgroundDark:
dark_background_colors.backgroundBaseSubdued,

dataGridBorderColor: border_colors.borderBasePlain,
dataGridVerticalLineBorderColor: border_colors.borderBasePlain,
dataGridRowBackgroundStriped: background_colors.backgroundBaseSubdued,
dataGridRowBackgroundHover: background_colors.backgroundBaseInteractiveHover,
dataGridRowBackgroundSelect:
background_colors.backgroundBaseInteractiveSelect,

dragDropDraggingBackground: background_colors.backgroundBaseSuccess,
dragDropDraggingOverBackground: background_colors.backgroundLightSuccess,
Expand Down Expand Up @@ -207,6 +210,8 @@ export const components: _EuiThemeComponents = {
dataGridRowBackgroundStriped: dark_background_colors.backgroundBaseSubdued,
dataGridRowBackgroundHover:
dark_background_colors.backgroundBaseInteractiveHover,
dataGridRowBackgroundSelect:
dark_background_colors.backgroundBaseInteractiveSelect,

dragDropDraggingBackground: dark_background_colors.backgroundBaseSuccess,
dragDropDraggingOverBackground:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,11 @@ export type _EuiThemeComponentColors = {
collapsibleNavGroupBackground: ColorModeSwitch;
collapsibleNavGroupBackgroundDark: ColorModeSwitch;

dataGridBorderColor: ColorModeSwitch;
dataGridVerticalLineBorderColor: ColorModeSwitch;
dataGridRowBackgroundStriped: ColorModeSwitch;
dataGridRowBackgroundHover: ColorModeSwitch;
dataGridRowBackgroundSelect: ColorModeSwitch;

dragDropDraggingBackground: ColorModeSwitch;
dragDropDraggingOverBackground: ColorModeSwitch;
Expand Down
7 changes: 7 additions & 0 deletions packages/eui/src-docs/src/services/theme/theme.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,12 @@ export function applyTheme(newTheme, colorMode = 'LIGHT') {
Object.keys(themes).forEach((theme) =>
Object.values(themes[theme]).forEach((cssFile) => cssFile.unuse())
);

themes[newTheme]?.[colorMode]?.use();

if (newTheme.toLowerCase().includes('borealis')) {
document?.body.classList.add('euiTheme--borealis');
} else {
document?.body.classList.remove('euiTheme--borealis');
}
}
4 changes: 4 additions & 0 deletions packages/eui/src-docs/src/views/datagrid/_datagrid.scss
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,7 @@
.euiDataGridRow--rowClassesDemoSelected {
background: $euiColorHighlight;
}

.euiTheme--borealis .euiDataGridRow--rowClassesDemoSelected {
background: $euiColorBackgroundBaseInteractiveSelect;
}
31 changes: 18 additions & 13 deletions packages/eui/src/components/datagrid/data_grid.styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ export const euiDataGridStyles = (euiThemeContext: UseEuiTheme) => {
const { cellPadding, lineHeight, fontSize } =
euiDataGridVariables(euiThemeContext);

const border = `${euiTheme.border.width.thin} solid ${euiTheme.components.dataGridBorderColor}`;

return {
euiDataGrid: css`
display: flex;
Expand Down Expand Up @@ -133,24 +135,24 @@ export const euiDataGridStyles = (euiThemeContext: UseEuiTheme) => {
.euiDataGridRowCell:not(.euiDataGridFooterCell),
.euiDataGridFooter,
&:not(.euiDataGrid--headerUnderline) .euiDataGridHeader {
${logicalCSS('border-bottom', euiTheme.border.thin)}
${logicalCSS('border-bottom', border)}
}

&:not(.euiDataGrid--footerOverline) .euiDataGridFooter {
${logicalCSS('border-top', euiTheme.border.thin)}
${logicalCSS('border-top', border)}
${logicalCSS('margin-top', `-${euiTheme.border.width.thin}`)}
}

.euiDataGridHeader {
${logicalCSS('border-top', euiTheme.border.thin)}
${logicalCSS('border-top', border)}
}
`,
all: css`
label: borders;

.euiDataGridRowCell {
&:not(.euiDataGridFooterCell) {
${logicalCSS('border-bottom', euiTheme.border.thin)}
${logicalCSS('border-bottom', border)}
${logicalCSS(
'border-right',
// Visually lighten vertical borders
Expand All @@ -159,42 +161,45 @@ export const euiDataGridStyles = (euiThemeContext: UseEuiTheme) => {
}

&--firstColumn {
${logicalCSS('border-left', euiTheme.border.thin)}
${logicalCSS('border-left', border)}
}

&--lastColumn {
${logicalCSS('border-right-color', euiTheme.border.color)}
${logicalCSS(
'border-right-color',
euiTheme.components.dataGridBorderColor
)}
}
}

.euiDataGridFooterCell,
.euiDataGridHeaderCell {
${logicalCSS('border-right', euiTheme.border.thin)}
${logicalCSS('border-right', border)}

&:first-of-type {
${logicalCSS('border-left', euiTheme.border.thin)}
${logicalCSS('border-left', border)}
}
}

.euiDataGridFooter {
${logicalCSS('border-bottom', euiTheme.border.thin)}
${logicalCSS('border-bottom', border)}
}

&:not(.euiDataGrid--footerOverline) .euiDataGridFooter {
${logicalCSS('border-top', euiTheme.border.thin)}
${logicalCSS('border-top', border)}
${logicalCSS('margin-top', `-${euiTheme.border.width.thin}`)}
}

&:not(.euiDataGrid--headerUnderline) .euiDataGridHeader {
${logicalCSS('border-bottom', euiTheme.border.thin)}
${logicalCSS('border-bottom', border)}
}

&:is(.euiDataGrid--noControls) .euiDataGridHeader {
${logicalCSS('border-top', euiTheme.border.thin)}
${logicalCSS('border-top', border)}
}

.euiDataGrid__controls {
border: ${euiTheme.border.thin};
border: ${border};
background-color: ${euiTheme.colors.body};
}
`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ const component_colors: _EuiThemeComponentColors = {
['colors.darkestShade']
),

dataGridBorderColor: computed(([color]) => color, ['border.color']),
dataGridVerticalLineBorderColor: computed(
([color]) => tint(color, 0.3),
['border.color']
Expand All @@ -164,6 +165,10 @@ const component_colors: _EuiThemeComponentColors = {
([highlight]) => highlight,
['colors.highlight']
),
dataGridRowBackgroundSelect: computed(
([highlight]) => highlight,
['colors.highlight']
),

dragDropDraggingBackground: computed(
([success]) => transparentize(success, 0.1),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ import React, {
useState,
useMemo,
} from 'react';
import { EuiDataGrid, EuiCheckbox, EuiButtonEmpty } from '@elastic/eui';
import { EuiDataGrid, EuiCheckbox, EuiButtonEmpty, useEuiTheme } from '@elastic/eui';
import { faker } from '@faker-js/faker';

/**
Expand Down Expand Up @@ -256,6 +256,8 @@ const leadingControlColumns = [
* Data grid
*/
export default () => {
const { euiTheme } = useEuiTheme();

const [visibleColumns, setVisibleColumns] = useState(
columns.map(({ id }) => id)
);
Expand Down Expand Up @@ -300,6 +302,24 @@ export default () => {
additionalControls: <SelectionButton />,
}}
gridStyle={{ rowClasses, rowHover: 'none' }}
css={{
weronikaolejniczak marked this conversation as resolved.
Show resolved Hide resolved
'--datagridRow-stripeColor': euiTheme.colors.lightShade,
'.euiDataGridRow--rowClassesDemoSelected': {
backgroundColor: euiTheme.components.dataGridRowBackgroundSelect,
},
'.euiDataGridRow--rowClassesDemo': {
backgroundImage: `linear-gradient(135deg,
${euiTheme.colors.emptyShade} 41.67%,
var(--datagridRow-stripeColor) 41.67%,
var(--datagridRow-stripeColor) 50%,
${euiTheme.colors.emptyShade} 50%,
${euiTheme.colors.emptyShade} 91.67%,
var(--datagridRow-stripeColor) 91.67%,
var(--datagridRow-stripeColor) 100%
)`,
backgroundSize: '8.49px 8.49px',
}
}}
/>
</SelectionContext.Provider>
);
Expand Down