Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
181381a
refactor: remove Amsterdam theme
mgadewoll Oct 9, 2025
fd6ff58
refactor: update direct imports from removed themes folder
mgadewoll Oct 9, 2025
21454ec
build: remove copyFiles script
mgadewoll Oct 9, 2025
53eda5c
docs: remove theme selection from storybook and website
mgadewoll Oct 9, 2025
0bc6c5e
chore: add missing selected styles
mgadewoll Oct 16, 2025
affc3ff
refactor: remove hasGlobalFocusColor theme flag
mgadewoll Oct 9, 2025
9661d85
refactor: remove hasVisColorAdjustment theme flag and resolve usages
mgadewoll Oct 9, 2025
fcffdcc
refactor: remove buttonVariant theme flag and resolve usages
mgadewoll Oct 9, 2025
193ba44
test: update snapshots
mgadewoll Oct 9, 2025
9bdf908
test(vrt): update reference images
mgadewoll Oct 9, 2025
5de0bf9
refactor: remove formVariant theme flag and resolve usages
mgadewoll Oct 10, 2025
a168642
test: update snapshots
mgadewoll Oct 10, 2025
81300ab
chore: cleanup links and comments
mgadewoll Oct 10, 2025
84874ef
docs: remove Amsterdam specific output
mgadewoll Oct 13, 2025
593cab6
refactor: remove obsolte scss fils
mgadewoll Oct 13, 2025
349d895
chore: add changelogs
mgadewoll Oct 13, 2025
f1850db
chore: cleanup shadow updates after rebase
mgadewoll Oct 15, 2025
cd542d0
refactor: remove obsolete conditions in euiPanelBorderStyles
mgadewoll Oct 15, 2025
07ce781
chore: remove Amsterdam related comments
mgadewoll Oct 15, 2025
e49f4a6
chore: remove obsolete space
mgadewoll Oct 27, 2025
7386269
refactor: use regular eui import path
mgadewoll Oct 27, 2025
fefa005
chore: add docusaurus-theme changelog
mgadewoll Oct 27, 2025
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/docusaurus-theme/changelogs/upcoming/9090.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
- Added `HighContrastModeToggle` component and adds it as main navbar item

**Breaking changes**

- Removed `ThemeSwitcher` component
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { useContext } from 'react';
import { useEuiTheme } from '@elastic/eui';

import { NavbarItem } from '../navbar_item';
import { AppThemeContext } from '../theme_context';

export const HighContrastModeToggle = () => {
const euiThemeContext = useEuiTheme();

const appContext = useContext(AppThemeContext);
const { changeHighContrastMode } = appContext;

const isForcedContrastMode = euiThemeContext.highContrastMode === 'forced';
const _highContrastMode =
appContext.highContrastMode && !isForcedContrastMode
? appContext.highContrastMode
: euiThemeContext.highContrastMode;

return (
<NavbarItem
title={'Toggle high contrast mode'}
icon="contrast"
isMenuItem={false}
isSelected={!!_highContrastMode}
onClick={() => changeHighContrastMode(!_highContrastMode)}
/>
);
};
13 changes: 11 additions & 2 deletions packages/docusaurus-theme/src/components/navbar_item/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
EuiIcon,
ExclusiveUnion,
IconType,
mathWithUnits,
PropsForAnchor,
PropsForButton,
useEuiMemoizedStyles,
Expand All @@ -26,6 +27,7 @@ type SharedProps = {
icon: IconType;
showLabel?: boolean;
isMenuItem?: boolean;
isSelected?: boolean;
} & CommonProps;

type Props = ExclusiveUnion<
Expand All @@ -44,8 +46,7 @@ export const getStyles = ({ euiTheme }: UseEuiTheme) => ({
transition: background var(--ifm-transition-fast);

&:hover {
background-color: ${euiTheme.components.buttons
.backgroundTextHover};
background-color: ${euiTheme.components.buttons.backgroundTextHover};
color: currentColor;
}
`,
Expand Down Expand Up @@ -74,6 +75,10 @@ export const getStyles = ({ euiTheme }: UseEuiTheme) => ({
disabled: css`
cursor: not-allowed;
`,
selected: css`
background-color: ${euiTheme.colors.backgroundFilledText};
color: ${euiTheme.colors.textInverse};
`,
title: css`
@media (min-width: 997px) {
display: none;
Expand All @@ -97,6 +102,8 @@ export const NavbarItem = (props: Props) => {
target,
showLabel,
isMenuItem = true,
isSelected,
css,
} = props;

const isBrowser = useIsBrowser();
Expand All @@ -109,6 +116,7 @@ export const NavbarItem = (props: Props) => {
styles.item,
isMenuItem ? styles.menuItem : styles.navItem,
!isBrowser && styles.disabled,
isSelected && styles.selected,
isDarkMode && styles.darkMode,
];

Expand Down Expand Up @@ -148,6 +156,7 @@ export const NavbarItem = (props: Props) => {
title={title}
aria-label={title}
aria-live="polite"
aria-pressed={isSelected != null ? isSelected : undefined}
>
{content}
</button>
Expand Down
39 changes: 17 additions & 22 deletions packages/docusaurus-theme/src/components/theme_context/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,15 @@ import {
FunctionComponent,
PropsWithChildren,
useContext,
useLayoutEffect,
useEffect,
useState,
} from 'react';
import useIsBrowser from '@docusaurus/useIsBrowser';
import createCache from '@emotion/cache';
import { CacheProvider } from '@emotion/react';
import {
EUI_THEME,
EuiProvider,
EuiThemeAmsterdam,
EuiThemeColorMode,
} from '@elastic/eui';
import { EuiProvider, EuiThemeColorMode } from '@elastic/eui';
import { EuiThemeBorealis } from '@elastic/eui-theme-borealis';
import { type EUI_THEME } from '@elastic/eui-theme-common';

import { EuiThemeOverrides } from './theme_overrides';

Expand All @@ -33,11 +29,6 @@ export const AVAILABLE_THEMES: EUI_THEME[] = [
value: EuiThemeBorealis.key,
provider: EuiThemeBorealis,
},
{
text: 'Amsterdam',
value: EuiThemeAmsterdam.key,
provider: EuiThemeAmsterdam,
},
];

const EUI_COLOR_MODES = ['light', 'dark'] as const;
Expand Down Expand Up @@ -105,18 +96,22 @@ export const AppThemeProvider: FunctionComponent<PropsWithChildren> = ({
});

const [highContrastMode, setHighContrastMode] = useState<boolean | undefined>(
() => {
if (isBrowser) {
return localStorage.getItem('highContrastMode')
? localStorage.getItem('highContrastMode') === 'true'
: defaultState.highContrastMode;
}

return defaultState.highContrastMode;
}
false
);

const [theme, setTheme] = useState(defaultState.theme);
const getHighContrastModeSetting = () => {
return localStorage?.getItem('highContrastMode')
? localStorage?.getItem('highContrastMode') === 'true'
: defaultState.highContrastMode;
};

useEffect(() => {
if (isBrowser) {
setHighContrastMode(getHighContrastModeSetting());
}
}, [isBrowser]);

const [theme, setTheme] = useState<EUI_THEME>(defaultState.theme);

const handleChangeTheme = (themeValue: string) => {
const matchedTheme = AVAILABLE_THEMES.find((t) => t.value === themeValue);
Expand Down
127 changes: 0 additions & 127 deletions packages/docusaurus-theme/src/components/theme_switcher/index.tsx

This file was deleted.

10 changes: 6 additions & 4 deletions packages/docusaurus-theme/src/theme/EditThisPage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@ import { JSX } from 'react';
import { css } from '@emotion/react';
import Translate from '@docusaurus/Translate';
import type { Props } from '@theme-original/EditThisPage';
import { EuiButton, useEuiMemoizedStyles, UseEuiTheme } from '@elastic/eui';
// @ts-ignore - eui only has module declarations for '@elastic/eui/src/themes/amsterdam/global_styling/mixins/button'
// but importing from /src results in "Module not found" error
import { euiButtonColor } from '@elastic/eui/lib/global_styling/mixins/_button';
import {
EuiButton,
euiButtonColor,
useEuiMemoizedStyles,
UseEuiTheme,
} from '@elastic/eui';

const getStyles = (theme: UseEuiTheme) => {
const buttonColor = euiButtonColor(theme, 'primary');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import {
VersionSwitcher,
VersionSwitcherProps,
} from '../../../components/version_switcher';
import { ThemeSwitcher } from '../../../components/theme_switcher';
import { HighContrastModeToggle } from '../../../components/high_contrast_mode_toggle';

const DOCS_PATH = '/docs';

Expand Down Expand Up @@ -248,13 +248,12 @@ export default function NavbarContent({
</NavbarSearch>
)}
<NavbarColorModeToggle className="colorModeToggle" />
<NavbarItems items={rightItems} />

{isBrowser && (
<div css={styles.themeSwitcher}>
<ThemeSwitcher />
<HighContrastModeToggle />
</div>
)}
<NavbarItems items={rightItems} />
</>
}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ import { EuiIcon, useEuiMemoizedStyles, UseEuiTheme } from '@elastic/eui';
import { css } from '@emotion/react';
import useIsBrowser from '@docusaurus/useIsBrowser';

import { ThemeSwitcher } from '../../../../components/theme_switcher';
import {
VersionSwitcher,
VersionSwitcherProps,
} from '../../../../components/version_switcher';
import { HighContrastModeToggle } from '../../../../components/high_contrast_mode_toggle';

const getStyles = ({ euiTheme }: UseEuiTheme) => ({
sidebar: css`
Expand Down Expand Up @@ -81,8 +81,8 @@ export default function NavbarMobileSidebarHeader({
{isBrowser && versionSwitcherOptions && (
<VersionSwitcher {...versionSwitcherOptions} />
)}
{isBrowser && <ThemeSwitcher />}
<NavbarColorModeToggle />
{isBrowser && <HighContrastModeToggle />}
<CloseButton />
</div>
);
Expand Down
6 changes: 0 additions & 6 deletions packages/eui-theme-borealis/.stylelintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,6 @@ module.exports = {
{
// TODO: Remove Sass-specific config & rules once we're completely off Sass
files: ['**/*.scss'],
ignoreFiles: [
'generator-eui/**/*.scss',
'src/global_styling/react_date_picker/**/*.scss',
'src/themes/amsterdam/global_styling/react_date_picker/**/*.scss',
'src/components/date_picker/react-datepicker/**/*.scss',
],
extends: [
'stylelint-config-standard-scss',
'stylelint-config-prettier-scss',
Expand Down
6 changes: 6 additions & 0 deletions packages/eui-theme-borealis/changelogs/upcoming/9090.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
**Breaking changes**

- Removed `euiTheme.flags.hasGlobalFocusColor`
- Removed `euiTheme.flags.hasVisColorAdjustment`
- Removed `euiTheme.flags.buttonVariant` and `euiTheme.flags.formVariant`
- Removed `euiTheme.components.keyPadMenuItemBackgroundDisabledSelect`
4 changes: 0 additions & 4 deletions packages/eui-theme-borealis/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,6 @@ export const euiThemeBorealis: EuiThemeShape = {
focus,
components,
flags: {
hasGlobalFocusColor: true,
hasVisColorAdjustment: false,
buttonVariant: 'refresh',
formVariant: 'refresh',
shadowVariant: 'refresh',
},
overrides,
Expand Down
Loading