[HCM] High contrast mode style adjustments (#216964)

## Summary

This PR adds a couple of style fixes to ensure improved visual output in
high contrast mode.

The updates focus on borders, mainly removing duplicate borders due to
nested `EuiPanel` usages and ensuring custom borders are correctly
applied and receive a high contrast color.

### Changes

| Solution | Before | After |
|--------|-----|-----|
| discover | ![Screenshot 2025-04-03 at 09 48
20](https://github.com/user-attachments/assets/068c5dc7-be38-482a-9b60-74ec15ec0c69)
| ![Screenshot 2025-04-03 at 09 50
45](https://github.com/user-attachments/assets/3e06c775-6c4f-481f-9186-334803ee0f3b)
|
| dashboard | ![Screenshot 2025-04-03 at 09 32
56](https://github.com/user-attachments/assets/ca4cda9d-5607-4aff-9485-b9e5a864322f)
| ![Screenshot 2025-04-03 at 09 31
44](https://github.com/user-attachments/assets/0324d367-f86e-440b-950a-a4debd77962c)
|
| dashboard | ![Screenshot 2025-04-03 at 09 33
07](https://github.com/user-attachments/assets/3aac0640-1d34-4f03-8d47-32253d6f7092)
| ![Screenshot 2025-04-03 at 09 33
37](https://github.com/user-attachments/assets/9679e008-9aac-441c-ae0c-5d713eb83a61)
|
| elasticsearch | ![Screenshot 2025-04-03 at 09 40
26](https://github.com/user-attachments/assets/ced77757-086a-4dc6-ab9d-4befcd543177)
| ![Screenshot 2025-04-03 at 09 41
36](https://github.com/user-attachments/assets/39f51db1-fb0b-4231-9d58-cd3100e1f7f8)
|
| observability | ![Screenshot 2025-04-03 at 09 47
40](https://github.com/user-attachments/assets/568c9c60-63ea-4ffa-9155-26bd160600c5)
| ![Screenshot 2025-04-03 at 09 47
55](https://github.com/user-attachments/assets/be036721-fccc-4514-b7b0-67340087b020)
|
| security | ![Screenshot 2025-04-03 at 09 31
01](https://github.com/user-attachments/assets/01b24035-54bc-4471-a5b8-df3446fbc230)
| ![Screenshot 2025-04-03 at 09 30
46](https://github.com/user-attachments/assets/fbb3ac03-50fe-4ecc-aaeb-e0dfecabc566)
|

### Checklist

Check the PR satisfies following conditions. 

Reviewers should verify this PR satisfies this list as well.

- [ ] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)
- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [ ] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [ ] If a plugin configuration key changed, check if it needs to be
allowlisted in the cloud and added to the [docker
list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)
- [ ] This was checked for breaking HTTP API changes, and any breaking
changes have been approved by the breaking-change committee. The
`release_note:breaking` label should be applied in these situations.
- [ ] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
- [ ] The PR description includes the appropriate Release Notes section,
and the correct `release_note:*` label is applied per the
[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)

### Identify risks

Does this PR introduce any risks? For example, consider risks like hard
to test bugs, performance regression, potential of data loss.

Describe the risk, its severity, and mitigation for each identified
risk. Invite stakeholders and evaluate how to proceed before merging.

- [ ] [See some risk
examples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx)
- [ ] ...

---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
This commit is contained in:
Lene Gadewoll 2025-04-08 10:39:07 +02:00 committed by GitHub
parent 6ab8808d72
commit 0f4361d05d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 62 additions and 26 deletions

View file

@ -45,7 +45,7 @@ export const OverviewPanel: FC<PropsWithChildren<OverviewPanelProps>> = ({
<EuiFlexGroup alignItems="flexStart" gutterSize="xl">
{leftPanelContent && <EuiFlexItem grow={6}>{leftPanelContent}</EuiFlexItem>}
<EuiFlexItem grow={4}>
<EuiPanel paddingSize="none" color="subdued" {...overviewPanelProps}>
<EuiPanel paddingSize="none" color="transparent" {...overviewPanelProps}>
<EuiTitle size="s">
<h2>{title}</h2>
</EuiTitle>

View file

@ -1,6 +1,6 @@
.serverlessSearchSelectClientPanelSelectedBorder {
.serverlessSearchSelectClientPanelSelectedBorder::before {
border: 1px solid $euiColorPrimary;
}
.serverlessSearchSelectClientPanelBorder {
.serverlessSearchSelectClientPanelBorder::before {
border: 1px solid $euiColorLightShade;
}

View file

@ -7,13 +7,14 @@
* License v3.0 only", or the "Server Side Public License, v 1".
*/
import { useEuiTheme } from '@elastic/eui';
import { useEuiTheme, highContrastModeStyles } from '@elastic/eui';
import { css } from '@emotion/react';
import { useMemo } from 'react';
export const useHoverActionStyles = (isEditMode: boolean, showBorder?: boolean) => {
const { euiTheme } = useEuiTheme();
const euiThemeContext = useEuiTheme();
const { euiTheme } = euiThemeContext;
const containerStyles = useMemo(() => {
const editModeOutline = `${euiTheme.border.width.thin} dashed ${euiTheme.colors.borderBaseFormsControl}`;
@ -39,6 +40,12 @@ export const useHoverActionStyles = (isEditMode: boolean, showBorder?: boolean)
? css`
.embPanel {
outline: var(--internalBorderStyle);
${highContrastModeStyles(euiThemeContext, {
preferred: `
border: none;
`,
})},
}
`
: css`
@ -51,10 +58,20 @@ export const useHoverActionStyles = (isEditMode: boolean, showBorder?: boolean)
transition-delay: ${euiTheme.animation.fast};
}
&:hover .embPanel {
outline: var(--internalBorderStyle);
z-index: ${euiTheme.levels.menu};
transition: none; // apply transition on hover out only
&:hover {
.embPanel {
z-index: ${euiTheme.levels.menu};
transition: none; // apply transition on hover out only
${highContrastModeStyles(euiThemeContext, {
none: `
outline: var(--internalBorderStyle);
`,
preferred: `
border: var(--internalBorderStyle);
`,
})},
}
}
`}
@ -87,7 +104,7 @@ export const useHoverActionStyles = (isEditMode: boolean, showBorder?: boolean)
}
}
`;
}, [euiTheme, showBorder, isEditMode]);
}, [euiTheme, showBorder, isEditMode, euiThemeContext]);
const hoverActionStyles = useMemo(() => {
const singleWrapperStyles = css`

View file

@ -175,7 +175,12 @@ export const ToolbarSelector: React.FC<ToolbarSelectorProps> = ({
{(list, search) => (
<>
{search && (
<EuiPanel paddingSize="s" hasShadow={false} css={{ paddingBottom: 0 }}>
<EuiPanel
color="transparent"
paddingSize="s"
hasShadow={false}
css={{ paddingBottom: 0 }}
>
{search}
</EuiPanel>
)}

View file

@ -5,7 +5,7 @@
* 2.0.
*/
import { EuiFlexGrid, EuiFlexItem, EuiSpacer } from '@elastic/eui';
import { EuiFlexGrid, EuiFlexItem, EuiSpacer, useEuiTheme } from '@elastic/eui';
import React, { useContext } from 'react';
import { ThemeContext } from 'styled-components';
import { i18n } from '@kbn/i18n';
@ -21,6 +21,7 @@ export function EmptySections() {
const { http, serverless: isServerless } = useKibana().services;
const theme = useContext(ThemeContext);
const { hasDataMap } = useHasData();
const { euiTheme } = useEuiTheme();
const appEmptySections = getEmptySections({ http }).filter(({ id, showInServerless }) => {
const app = hasDataMap[id];
@ -47,6 +48,7 @@ export function EmptySections() {
key={app.id}
style={{
border: `${theme.eui.euiBorderEditable}`,
borderColor: euiTheme.border.color,
borderRadius: `${theme.eui.euiBorderRadius}`,
}}
>

View file

@ -1,6 +1,6 @@
.chooseEmbeddingModelSelectedBorder {
.chooseEmbeddingModelSelectedBorder::before {
border: 1px solid $euiColorPrimary;
}
.chooseEmbeddingModelBorder {
.chooseEmbeddingModelBorder::before {
border: 1px solid $euiColorLightShade;
}

View file

@ -75,7 +75,7 @@ export const GettingStarted: React.FC<GettingStartedProps> = ({
kibanaRunApiInConsole: docLinks.consoleGuide,
}}
isPanelLeft={isPanelLeft}
overviewPanelProps={{ color: 'plain', hasShadow: false }}
overviewPanelProps={{ hasShadow: false }}
application={services.application}
sharePlugin={services.share}
consolePlugin={services.console}
@ -101,7 +101,7 @@ export const GettingStarted: React.FC<GettingStartedProps> = ({
application={services.application}
sharePlugin={services.share}
isPanelLeft={isPanelLeft}
overviewPanelProps={{ color: 'plain', hasShadow: false }}
overviewPanelProps={{ hasShadow: false }}
/>
<OverviewPanel
@ -129,14 +129,14 @@ export const GettingStarted: React.FC<GettingStartedProps> = ({
defaultMessage: 'Generate an API key',
}
)}
overviewPanelProps={{ color: 'plain', hasShadow: false }}
overviewPanelProps={{ hasShadow: false }}
/>
<CloudDetailsPanel
cloudId={codeArgs.cloudId}
elasticsearchUrl={codeArgs.url}
isPanelLeft={isPanelLeft}
overviewPanelProps={{ color: 'plain', hasShadow: false }}
overviewPanelProps={{ hasShadow: false }}
/>
<OverviewPanel
@ -173,7 +173,7 @@ export const GettingStarted: React.FC<GettingStartedProps> = ({
defaultMessage: 'Configure your client',
}
)}
overviewPanelProps={{ color: 'plain', hasShadow: false }}
overviewPanelProps={{ hasShadow: false }}
/>
<OverviewPanel
@ -211,7 +211,7 @@ export const GettingStarted: React.FC<GettingStartedProps> = ({
defaultMessage: 'Test your connection',
}
)}
overviewPanelProps={{ color: 'plain', hasShadow: false }}
overviewPanelProps={{ hasShadow: false }}
/>
<OverviewPanel
description={i18n.translate(
@ -244,7 +244,7 @@ export const GettingStarted: React.FC<GettingStartedProps> = ({
title={i18n.translate('xpack.enterpriseSearch.overview.gettingStarted.ingestData.title', {
defaultMessage: 'Ingest Data',
})}
overviewPanelProps={{ color: 'plain', hasShadow: false }}
overviewPanelProps={{ hasShadow: false }}
/>
<OverviewPanel
@ -279,7 +279,7 @@ export const GettingStarted: React.FC<GettingStartedProps> = ({
title={i18n.translate('xpack.enterpriseSearch.overview.gettingStarted.searchQuery.title', {
defaultMessage: 'Build your first search query',
})}
overviewPanelProps={{ color: 'plain', hasShadow: false }}
overviewPanelProps={{ hasShadow: false }}
/>
{showPipelinesPanel && (
<OverviewPanel
@ -326,7 +326,7 @@ export const GettingStarted: React.FC<GettingStartedProps> = ({
}
leftPanelContent={<GettingStartedPipelinePanel />}
links={[]}
overviewPanelProps={{ color: 'plain', hasShadow: false }}
overviewPanelProps={{ hasShadow: false }}
title={i18n.translate('xpack.enterpriseSearch.pipeline.title', {
defaultMessage: 'Transform and enrich your data',
})}

View file

@ -16,8 +16,20 @@ export const OnboardingCardContentPanel = React.memo<PropsWithChildren<EuiPanelP
const nestedClassName = classnames(NESTED_PANEL_CLASS_NAME, className);
return (
<EuiPanel paddingSize="m" hasShadow={false} hasBorder={false} className={panelClassName}>
<EuiPanel hasShadow={false} paddingSize="l" {...panelProps} className={nestedClassName}>
<EuiPanel
color="transparent"
paddingSize="m"
hasShadow={false}
hasBorder={false}
className={panelClassName}
>
<EuiPanel
color="transparent"
hasShadow={false}
paddingSize="l"
{...panelProps}
className={nestedClassName}
>
{children}
</EuiPanel>
</EuiPanel>

View file

@ -16,7 +16,7 @@ interface MissingAIConnectorCalloutProps {
export const MissingAIConnectorCallout = React.memo<MissingAIConnectorCalloutProps>(
({ onExpandAiConnectorsCard }) => (
<EuiPanel hasShadow={false} paddingSize="none">
<EuiPanel color="transparent" hasShadow={false} paddingSize="none">
<CardCallOut
color="warning"
text={i18n.START_MIGRATION_CARD_CONNECTOR_MISSING_TEXT}