Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions packages/eui/changelogs/upcoming/8806.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
- Added `theme` prop to `EuiSelectableTemplateSitewide` to support granular control over the applied `colorMode` for the search and popover components

**Breaking changes**

- Removed custom style overrides for `EuiSelectableTemplateSitewide` search inside `EuiHeader` - Use the `theme` prop on `EuiSelectableTemplateSitewide` instead to control the color mode output.

8 changes: 8 additions & 0 deletions packages/eui/src/components/header/header.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,10 @@ export const DarkThemeWithSitewideSearch: Story = {
isOpen: true,
repositionOnScroll: true, // Necessary when placing search in a fixed component
}}
colorModes={{
search: 'dark',
popover: 'global',
}}
/>,
],
},
Expand Down Expand Up @@ -477,6 +481,10 @@ const ElasticNavigationPatternExample = () => {
const search = (
<EuiSelectableTemplateSitewide
options={[]}
colorModes={{
search: 'dark',
popover: 'global',
}}
searchProps={{
append: '⌘K',
compressed: true,
Expand Down
76 changes: 44 additions & 32 deletions packages/eui/src/components/header/header.styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ import { css } from '@emotion/react';
import { euiShadowXSmall } from '@elastic/eui-theme-common';

import { logicalCSS } from '../../global_styling';
import { UseEuiTheme, makeHighContrastColor } from '../../services';
import {
UseEuiTheme,
isEuiThemeRefreshVariant,
makeHighContrastColor,
} from '../../services';

export const euiHeaderVariables = (euiThemeContext: UseEuiTheme) => {
const { euiTheme } = euiThemeContext;
Expand Down Expand Up @@ -69,6 +73,10 @@ import { euiFormVariables } from '../form/form.styles';

const euiHeaderDarkStyles = (euiThemeContext: UseEuiTheme) => {
const { euiTheme, highContrastMode } = euiThemeContext;
const isRefreshVariant = isEuiThemeRefreshVariant(
euiThemeContext,
'formVariant'
);
const { controlPlaceholderText } = euiFormVariables(euiThemeContext);

const backgroundColor = euiTheme.components.headerDarkBackground;
Expand All @@ -83,37 +91,7 @@ const euiHeaderDarkStyles = (euiThemeContext: UseEuiTheme) => {
)(backgroundColor),
};

return `
background-color: ${backgroundColor};

.euiHeaderLogo__text,
.euiHeaderLink,
.euiHeaderSectionItemButton {
color: ${euiTheme.colors.ghost};
}

.euiHeaderLink-isActive {
color: ${makeHighContrastColor(euiTheme.colors.primary)(backgroundColor)};
}

.euiHeaderLogo,
.euiHeaderLink,
.euiHeaderSectionItemButton {
&:focus {
background-color: ${
euiTheme.components.headerDarkSectionItemBackgroundFocus
};
}
}

.euiHeaderSectionItemButton__notification--badge {
box-shadow: 0 0 0 ${euiTheme.border.width.thin} ${backgroundColor};
}

.euiHeaderSectionItemButton__notification--dot {
stroke: ${backgroundColor};
}

const formLayoutStyles = `
.euiSelectableTemplateSitewide .euiFormControlLayout {
background-color: transparent;

Expand Down Expand Up @@ -165,6 +143,40 @@ const euiHeaderDarkStyles = (euiThemeContext: UseEuiTheme) => {
color: inherit;
}
}
}
`;

return `
background-color: ${backgroundColor};

.euiHeaderLogo__text,
.euiHeaderLink,
.euiHeaderSectionItemButton {
color: ${euiTheme.colors.ghost};
}

.euiHeaderLink-isActive {
color: ${makeHighContrastColor(euiTheme.colors.primary)(backgroundColor)};
}

.euiHeaderLogo,
.euiHeaderLink,
.euiHeaderSectionItemButton {
&:focus {
background-color: ${
euiTheme.components.headerDarkSectionItemBackgroundFocus
};
}
}

.euiHeaderSectionItemButton__notification--badge {
box-shadow: 0 0 0 ${euiTheme.border.width.thin} ${backgroundColor};
}

.euiHeaderSectionItemButton__notification--dot {
stroke: ${backgroundColor};
}

${!isRefreshVariant && formLayoutStyles}
`;
};
Loading