diff --git a/packages/docusaurus-theme/src/components/demo/demo.tsx b/packages/docusaurus-theme/src/components/demo/demo.tsx index 578c1033c2d..3321064358a 100644 --- a/packages/docusaurus-theme/src/components/demo/demo.tsx +++ b/packages/docusaurus-theme/src/components/demo/demo.tsx @@ -56,7 +56,7 @@ export interface DemoProps extends PropsWithChildren { const getDemoStyles = (euiTheme: UseEuiTheme) => ({ demo: css` - --docs-demo-border-color: ${euiTheme.euiTheme.colors.lightShade}; + --docs-demo-border-color: ${euiTheme.euiTheme.border.color}; --docs-demo-border-radius: ${euiTheme.euiTheme.size.s}; border: 1px solid var(--docs-demo-border-color); diff --git a/packages/docusaurus-theme/src/components/guideline/guideline.tsx b/packages/docusaurus-theme/src/components/guideline/guideline.tsx index 385c59beec3..59630a7bbee 100644 --- a/packages/docusaurus-theme/src/components/guideline/guideline.tsx +++ b/packages/docusaurus-theme/src/components/guideline/guideline.tsx @@ -6,6 +6,7 @@ import { useEuiMemoizedStyles, UseEuiTheme, } from '@elastic/eui'; +import { highContrastModeStyles } from '@elastic/eui/lib/global_styling/functions/high_contrast'; import { css } from '@emotion/react'; import { GuidelineType } from './types'; import { GuidelineText } from './guideline_text'; @@ -17,23 +18,38 @@ export interface GuidelineProps extends PropsWithChildren { panelStyle?: EuiPanelProps['style']; } -const getGuidelineStyles = ({ euiTheme }: UseEuiTheme) => ({ - root: css` - margin-block: var(--eui-theme-content-vertical-spacing); - `, - wrapper: css` - border-block-end: 2px solid ${euiTheme.colors.lightShade}; - `, - wrapperDo: css` - border-color: ${euiTheme.colors.success}; - `, - wrapperDont: css` - border-color: ${euiTheme.colors.danger}; - `, - textWrapper: css` - margin-block-start: var(--eui-size-xs); - `, -}); +const getGuidelineStyles = (euiThemeContext: UseEuiTheme) => { + const { euiTheme, highContrastMode } = euiThemeContext; + return { + root: css` + margin-block: var(--eui-theme-content-vertical-spacing); + `, + wrapper: css` + border-block-end: ${euiTheme.border.thick}; + border-start-start-radius: ${euiTheme.border.radius.medium}; + border-start-end-radius: ${euiTheme.border.radius.medium}; + overflow: hidden; + + ${highContrastModeStyles(euiThemeContext, { + // Code block is used within a panel which already has a border - skip doubling up + preferred: ` + & > .euiCodeBlock { + border: none; + } + `, + })} + `, + wrapperDo: css` + border-color: ${euiTheme.colors.success}; + `, + wrapperDont: css` + border-color: ${euiTheme.colors.danger}; + `, + textWrapper: css` + margin-block-start: var(--eui-size-xs); + `, + }; +}; export const Guideline = ({ children, diff --git a/packages/docusaurus-theme/src/theme/DocRoot/Layout/Sidebar/index.tsx b/packages/docusaurus-theme/src/theme/DocRoot/Layout/Sidebar/index.tsx index a6306448ef6..f726e35d48c 100644 --- a/packages/docusaurus-theme/src/theme/DocRoot/Layout/Sidebar/index.tsx +++ b/packages/docusaurus-theme/src/theme/DocRoot/Layout/Sidebar/index.tsx @@ -17,6 +17,7 @@ const getGlobalStyles = ({ euiTheme }: UseEuiTheme) => { sidebar: css` --doc-sidebar-width: 258px; --doc-sidebar-hidden-width: 30px; + --ifm-toc-border-color: ${euiTheme.border.color}; // ensure scrolling still works display: flex; @@ -28,7 +29,7 @@ const getGlobalStyles = ({ euiTheme }: UseEuiTheme) => { }; }; -// converted from css moduels to Emotion +// converted from css modules to Emotion const styles = { docSidebarContainer: css` display: none; diff --git a/packages/eui/.loki/reference/chrome_desktop_Display_EuiEmptyPrompt_High_Contrast.png b/packages/eui/.loki/reference/chrome_desktop_Display_EuiEmptyPrompt_High_Contrast.png new file mode 100644 index 00000000000..cb3bddf4fb8 Binary files /dev/null and b/packages/eui/.loki/reference/chrome_desktop_Display_EuiEmptyPrompt_High_Contrast.png differ diff --git a/packages/eui/.loki/reference/chrome_desktop_Display_EuiEmptyPrompt_High_Contrast_Transparent.png b/packages/eui/.loki/reference/chrome_desktop_Display_EuiEmptyPrompt_High_Contrast_Transparent.png new file mode 100644 index 00000000000..b38e25ae924 Binary files /dev/null and b/packages/eui/.loki/reference/chrome_desktop_Display_EuiEmptyPrompt_High_Contrast_Transparent.png differ diff --git a/packages/eui/.loki/reference/chrome_desktop_Display_EuiEmptyPrompt_Page_Template.png b/packages/eui/.loki/reference/chrome_desktop_Display_EuiEmptyPrompt_Page_Template.png index 67e09bb4f09..5f3f1911b4b 100644 Binary files a/packages/eui/.loki/reference/chrome_desktop_Display_EuiEmptyPrompt_Page_Template.png and b/packages/eui/.loki/reference/chrome_desktop_Display_EuiEmptyPrompt_Page_Template.png differ diff --git a/packages/eui/.loki/reference/chrome_desktop_Display_EuiEmptyPrompt_Playground.png b/packages/eui/.loki/reference/chrome_desktop_Display_EuiEmptyPrompt_Playground.png index 6fbdcd6d15f..3b12178f015 100644 Binary files a/packages/eui/.loki/reference/chrome_desktop_Display_EuiEmptyPrompt_Playground.png and b/packages/eui/.loki/reference/chrome_desktop_Display_EuiEmptyPrompt_Playground.png differ diff --git a/packages/eui/.loki/reference/chrome_desktop_Editors_Syntax_EuiMarkdownFormat_Text_Props.png b/packages/eui/.loki/reference/chrome_desktop_Editors_Syntax_EuiMarkdownFormat_Text_Props.png index ba617b01cd4..ec8c424ff96 100644 Binary files a/packages/eui/.loki/reference/chrome_desktop_Editors_Syntax_EuiMarkdownFormat_Text_Props.png and b/packages/eui/.loki/reference/chrome_desktop_Editors_Syntax_EuiMarkdownFormat_Text_Props.png differ diff --git a/packages/eui/.loki/reference/chrome_desktop_Layout_EuiFlyout_EuiFlyoutBody_Playground.png b/packages/eui/.loki/reference/chrome_desktop_Layout_EuiFlyout_EuiFlyoutBody_Playground.png index 7a31e99e06b..2ad0ad3e9bb 100644 Binary files a/packages/eui/.loki/reference/chrome_desktop_Layout_EuiFlyout_EuiFlyoutBody_Playground.png and b/packages/eui/.loki/reference/chrome_desktop_Layout_EuiFlyout_EuiFlyoutBody_Playground.png differ diff --git a/packages/eui/.loki/reference/chrome_desktop_Layout_EuiFlyout_EuiFlyoutFooter_Playground.png b/packages/eui/.loki/reference/chrome_desktop_Layout_EuiFlyout_EuiFlyoutFooter_Playground.png index bb49c5856ed..a5a71da4c35 100644 Binary files a/packages/eui/.loki/reference/chrome_desktop_Layout_EuiFlyout_EuiFlyoutFooter_Playground.png and b/packages/eui/.loki/reference/chrome_desktop_Layout_EuiFlyout_EuiFlyoutFooter_Playground.png differ diff --git a/packages/eui/.loki/reference/chrome_desktop_Layout_EuiFlyout_EuiFlyoutHeader_Playground.png b/packages/eui/.loki/reference/chrome_desktop_Layout_EuiFlyout_EuiFlyoutHeader_Playground.png index 82bd10e919d..d88d792c0cc 100644 Binary files a/packages/eui/.loki/reference/chrome_desktop_Layout_EuiFlyout_EuiFlyoutHeader_Playground.png and b/packages/eui/.loki/reference/chrome_desktop_Layout_EuiFlyout_EuiFlyoutHeader_Playground.png differ diff --git a/packages/eui/.loki/reference/chrome_desktop_Layout_EuiFlyout_EuiFlyoutResizable_Playground.png b/packages/eui/.loki/reference/chrome_desktop_Layout_EuiFlyout_EuiFlyoutResizable_Playground.png index da4f3504b6f..4182990a5d4 100644 Binary files a/packages/eui/.loki/reference/chrome_desktop_Layout_EuiFlyout_EuiFlyoutResizable_Playground.png and b/packages/eui/.loki/reference/chrome_desktop_Layout_EuiFlyout_EuiFlyoutResizable_Playground.png differ diff --git a/packages/eui/.loki/reference/chrome_desktop_Layout_EuiFlyout_EuiFlyout_High_Contrast.png b/packages/eui/.loki/reference/chrome_desktop_Layout_EuiFlyout_EuiFlyout_High_Contrast.png new file mode 100644 index 00000000000..b6762e4e72d Binary files /dev/null and b/packages/eui/.loki/reference/chrome_desktop_Layout_EuiFlyout_EuiFlyout_High_Contrast.png differ diff --git a/packages/eui/.loki/reference/chrome_desktop_Layout_EuiFlyout_EuiFlyout_Playground.png b/packages/eui/.loki/reference/chrome_desktop_Layout_EuiFlyout_EuiFlyout_Playground.png index 85f3304d2cd..c4fcc86036d 100644 Binary files a/packages/eui/.loki/reference/chrome_desktop_Layout_EuiFlyout_EuiFlyout_Playground.png and b/packages/eui/.loki/reference/chrome_desktop_Layout_EuiFlyout_EuiFlyout_Playground.png differ diff --git a/packages/eui/.loki/reference/chrome_desktop_Layout_EuiFlyout_EuiFlyout_Push_Flyouts.png b/packages/eui/.loki/reference/chrome_desktop_Layout_EuiFlyout_EuiFlyout_Push_Flyouts.png index f507bfc8552..0fa22cf3fed 100644 Binary files a/packages/eui/.loki/reference/chrome_desktop_Layout_EuiFlyout_EuiFlyout_Push_Flyouts.png and b/packages/eui/.loki/reference/chrome_desktop_Layout_EuiFlyout_EuiFlyout_Push_Flyouts.png differ diff --git a/packages/eui/.loki/reference/chrome_desktop_Layout_EuiSplitPanel_High_Contrast.png b/packages/eui/.loki/reference/chrome_desktop_Layout_EuiSplitPanel_High_Contrast.png new file mode 100644 index 00000000000..6d728c22bd5 Binary files /dev/null and b/packages/eui/.loki/reference/chrome_desktop_Layout_EuiSplitPanel_High_Contrast.png differ diff --git a/packages/eui/.loki/reference/chrome_desktop_Layout_EuiSplitPanel_Split_Panel_Inner.png b/packages/eui/.loki/reference/chrome_desktop_Layout_EuiSplitPanel_Split_Panel_Inner.png index 8434db2cf8c..19d149b3d94 100644 Binary files a/packages/eui/.loki/reference/chrome_desktop_Layout_EuiSplitPanel_Split_Panel_Inner.png and b/packages/eui/.loki/reference/chrome_desktop_Layout_EuiSplitPanel_Split_Panel_Inner.png differ diff --git a/packages/eui/.loki/reference/chrome_desktop_Layout_EuiSplitPanel_Split_Panel_Outer.png b/packages/eui/.loki/reference/chrome_desktop_Layout_EuiSplitPanel_Split_Panel_Outer.png index 904b22aea60..1ea65ce63c9 100644 Binary files a/packages/eui/.loki/reference/chrome_desktop_Layout_EuiSplitPanel_Split_Panel_Outer.png and b/packages/eui/.loki/reference/chrome_desktop_Layout_EuiSplitPanel_Split_Panel_Outer.png differ diff --git a/packages/eui/.loki/reference/chrome_desktop_Utilities_EuiErrorBoundary_High_Contrast.png b/packages/eui/.loki/reference/chrome_desktop_Utilities_EuiErrorBoundary_High_Contrast.png new file mode 100644 index 00000000000..52c98964a9d Binary files /dev/null and b/packages/eui/.loki/reference/chrome_desktop_Utilities_EuiErrorBoundary_High_Contrast.png differ diff --git a/packages/eui/.loki/reference/chrome_mobile_Display_EuiEmptyPrompt_High_Contrast.png b/packages/eui/.loki/reference/chrome_mobile_Display_EuiEmptyPrompt_High_Contrast.png new file mode 100644 index 00000000000..8ed62fefbd7 Binary files /dev/null and b/packages/eui/.loki/reference/chrome_mobile_Display_EuiEmptyPrompt_High_Contrast.png differ diff --git a/packages/eui/.loki/reference/chrome_mobile_Display_EuiEmptyPrompt_High_Contrast_Transparent.png b/packages/eui/.loki/reference/chrome_mobile_Display_EuiEmptyPrompt_High_Contrast_Transparent.png new file mode 100644 index 00000000000..db752c13a63 Binary files /dev/null and b/packages/eui/.loki/reference/chrome_mobile_Display_EuiEmptyPrompt_High_Contrast_Transparent.png differ diff --git a/packages/eui/.loki/reference/chrome_mobile_Display_EuiEmptyPrompt_Page_Template.png b/packages/eui/.loki/reference/chrome_mobile_Display_EuiEmptyPrompt_Page_Template.png index e7883f9b715..37c1489a8fb 100644 Binary files a/packages/eui/.loki/reference/chrome_mobile_Display_EuiEmptyPrompt_Page_Template.png and b/packages/eui/.loki/reference/chrome_mobile_Display_EuiEmptyPrompt_Page_Template.png differ diff --git a/packages/eui/.loki/reference/chrome_mobile_Display_EuiEmptyPrompt_Playground.png b/packages/eui/.loki/reference/chrome_mobile_Display_EuiEmptyPrompt_Playground.png index 27ecec8be9f..89feeddea08 100644 Binary files a/packages/eui/.loki/reference/chrome_mobile_Display_EuiEmptyPrompt_Playground.png and b/packages/eui/.loki/reference/chrome_mobile_Display_EuiEmptyPrompt_Playground.png differ diff --git a/packages/eui/.loki/reference/chrome_mobile_Editors_Syntax_EuiMarkdownFormat_Text_Props.png b/packages/eui/.loki/reference/chrome_mobile_Editors_Syntax_EuiMarkdownFormat_Text_Props.png index 7b4647919fd..ab81ce1596e 100644 Binary files a/packages/eui/.loki/reference/chrome_mobile_Editors_Syntax_EuiMarkdownFormat_Text_Props.png and b/packages/eui/.loki/reference/chrome_mobile_Editors_Syntax_EuiMarkdownFormat_Text_Props.png differ diff --git a/packages/eui/.loki/reference/chrome_mobile_Layout_EuiFlyout_EuiFlyoutBody_Playground.png b/packages/eui/.loki/reference/chrome_mobile_Layout_EuiFlyout_EuiFlyoutBody_Playground.png index 208419c7ea7..943e8813f8b 100644 Binary files a/packages/eui/.loki/reference/chrome_mobile_Layout_EuiFlyout_EuiFlyoutBody_Playground.png and b/packages/eui/.loki/reference/chrome_mobile_Layout_EuiFlyout_EuiFlyoutBody_Playground.png differ diff --git a/packages/eui/.loki/reference/chrome_mobile_Layout_EuiFlyout_EuiFlyoutFooter_Playground.png b/packages/eui/.loki/reference/chrome_mobile_Layout_EuiFlyout_EuiFlyoutFooter_Playground.png index 73d4019fef3..d12a47ff8c4 100644 Binary files a/packages/eui/.loki/reference/chrome_mobile_Layout_EuiFlyout_EuiFlyoutFooter_Playground.png and b/packages/eui/.loki/reference/chrome_mobile_Layout_EuiFlyout_EuiFlyoutFooter_Playground.png differ diff --git a/packages/eui/.loki/reference/chrome_mobile_Layout_EuiFlyout_EuiFlyoutHeader_Playground.png b/packages/eui/.loki/reference/chrome_mobile_Layout_EuiFlyout_EuiFlyoutHeader_Playground.png index c4be4de797f..142c2afc985 100644 Binary files a/packages/eui/.loki/reference/chrome_mobile_Layout_EuiFlyout_EuiFlyoutHeader_Playground.png and b/packages/eui/.loki/reference/chrome_mobile_Layout_EuiFlyout_EuiFlyoutHeader_Playground.png differ diff --git a/packages/eui/.loki/reference/chrome_mobile_Layout_EuiFlyout_EuiFlyoutResizable_Playground.png b/packages/eui/.loki/reference/chrome_mobile_Layout_EuiFlyout_EuiFlyoutResizable_Playground.png index 2037678c00a..91d825024b2 100644 Binary files a/packages/eui/.loki/reference/chrome_mobile_Layout_EuiFlyout_EuiFlyoutResizable_Playground.png and b/packages/eui/.loki/reference/chrome_mobile_Layout_EuiFlyout_EuiFlyoutResizable_Playground.png differ diff --git a/packages/eui/.loki/reference/chrome_mobile_Layout_EuiFlyout_EuiFlyout_High_Contrast.png b/packages/eui/.loki/reference/chrome_mobile_Layout_EuiFlyout_EuiFlyout_High_Contrast.png new file mode 100644 index 00000000000..f2a976b16c4 Binary files /dev/null and b/packages/eui/.loki/reference/chrome_mobile_Layout_EuiFlyout_EuiFlyout_High_Contrast.png differ diff --git a/packages/eui/.loki/reference/chrome_mobile_Layout_EuiFlyout_EuiFlyout_Playground.png b/packages/eui/.loki/reference/chrome_mobile_Layout_EuiFlyout_EuiFlyout_Playground.png index 2650e3f7e4b..5a4eb68f24b 100644 Binary files a/packages/eui/.loki/reference/chrome_mobile_Layout_EuiFlyout_EuiFlyout_Playground.png and b/packages/eui/.loki/reference/chrome_mobile_Layout_EuiFlyout_EuiFlyout_Playground.png differ diff --git a/packages/eui/.loki/reference/chrome_mobile_Layout_EuiFlyout_EuiFlyout_Push_Flyouts.png b/packages/eui/.loki/reference/chrome_mobile_Layout_EuiFlyout_EuiFlyout_Push_Flyouts.png index bd9b17b810a..559f1bd5cf1 100644 Binary files a/packages/eui/.loki/reference/chrome_mobile_Layout_EuiFlyout_EuiFlyout_Push_Flyouts.png and b/packages/eui/.loki/reference/chrome_mobile_Layout_EuiFlyout_EuiFlyout_Push_Flyouts.png differ diff --git a/packages/eui/.loki/reference/chrome_mobile_Layout_EuiSplitPanel_High_Contrast.png b/packages/eui/.loki/reference/chrome_mobile_Layout_EuiSplitPanel_High_Contrast.png new file mode 100644 index 00000000000..99cc3a5a043 Binary files /dev/null and b/packages/eui/.loki/reference/chrome_mobile_Layout_EuiSplitPanel_High_Contrast.png differ diff --git a/packages/eui/.loki/reference/chrome_mobile_Layout_EuiSplitPanel_Split_Panel_Inner.png b/packages/eui/.loki/reference/chrome_mobile_Layout_EuiSplitPanel_Split_Panel_Inner.png index 2a01ec4115b..23c13c5454a 100644 Binary files a/packages/eui/.loki/reference/chrome_mobile_Layout_EuiSplitPanel_Split_Panel_Inner.png and b/packages/eui/.loki/reference/chrome_mobile_Layout_EuiSplitPanel_Split_Panel_Inner.png differ diff --git a/packages/eui/.loki/reference/chrome_mobile_Layout_EuiSplitPanel_Split_Panel_Outer.png b/packages/eui/.loki/reference/chrome_mobile_Layout_EuiSplitPanel_Split_Panel_Outer.png index 9e6b49e8a65..0088517dbf0 100644 Binary files a/packages/eui/.loki/reference/chrome_mobile_Layout_EuiSplitPanel_Split_Panel_Outer.png and b/packages/eui/.loki/reference/chrome_mobile_Layout_EuiSplitPanel_Split_Panel_Outer.png differ diff --git a/packages/eui/.loki/reference/chrome_mobile_Utilities_EuiErrorBoundary_High_Contrast.png b/packages/eui/.loki/reference/chrome_mobile_Utilities_EuiErrorBoundary_High_Contrast.png new file mode 100644 index 00000000000..e0f05b16d4b Binary files /dev/null and b/packages/eui/.loki/reference/chrome_mobile_Utilities_EuiErrorBoundary_High_Contrast.png differ diff --git a/packages/eui/changelogs/upcoming/8234.md b/packages/eui/changelogs/upcoming/8234.md new file mode 100644 index 00000000000..d1347bb260a --- /dev/null +++ b/packages/eui/changelogs/upcoming/8234.md @@ -0,0 +1,2 @@ +- `useEuiShadow()` now accepts a second `options` argument +- `useEuiShadowFlat()` now accepts an `options` object instead of only a color diff --git a/packages/eui/src-docs/src/components/guide_section/guide_section_parts/guide_section_code.tsx b/packages/eui/src-docs/src/components/guide_section/guide_section_parts/guide_section_code.tsx index 7975bff217f..a69e2cce399 100644 --- a/packages/eui/src-docs/src/components/guide_section/guide_section_parts/guide_section_code.tsx +++ b/packages/eui/src-docs/src/components/guide_section/guide_section_parts/guide_section_code.tsx @@ -1,6 +1,10 @@ import React, { FunctionComponent, useState, useEffect, useMemo } from 'react'; -import { EuiCodeBlock } from '../../../../../src/components/code'; -import { EuiButtonEmpty } from '../../../../../src/components/button'; +import { + EuiCodeBlock, + EuiButtonEmpty, + EuiHorizontalRule, + useEuiTheme, +} from '../../../../../src'; // @ts-ignore Not TS import { CodeSandboxLink } from '../../codesandbox'; // @ts-ignore Not TS @@ -46,6 +50,8 @@ export const GuideSectionExampleCode: FunctionComponent< ) : undefined; + const { highContrastMode } = useEuiTheme(); + return ( <> {codeToRender} + {highContrastMode && } {codeSandboxLink} ); diff --git a/packages/eui/src-docs/src/components/guide_section/guide_section_parts/guide_section_example.tsx b/packages/eui/src-docs/src/components/guide_section/guide_section_parts/guide_section_example.tsx index bbe1b68ad9b..7408af54462 100644 --- a/packages/eui/src-docs/src/components/guide_section/guide_section_parts/guide_section_example.tsx +++ b/packages/eui/src-docs/src/components/guide_section/guide_section_parts/guide_section_example.tsx @@ -2,7 +2,7 @@ import React, { FunctionComponent, ReactNode } from 'react'; import classNames from 'classnames'; import { EuiSplitPanel } from '../../../../../src/components/panel'; import { _EuiSplitPanelInnerProps } from '../../../../../src/components/panel/split_panel/'; -import { EuiHorizontalRule } from '../../../../../src'; +import { EuiHorizontalRule, useEuiTheme } from '../../../../../src'; export interface GuideSectionExample { example: ReactNode; @@ -27,6 +27,8 @@ export const GuideSectionExample: FunctionComponent = ({ guideDemo__ghostBackground: ghostBackground, }); + const { highContrastMode } = useEuiTheme(); + return ( = ({ > {example} + {exampleToggles && !highContrastMode && ( + + )} {exampleToggles && ( - <> - - - {exampleToggles} - - + + {exampleToggles} + + )} + {exampleToggles && tabs && !highContrastMode && ( + )} - {exampleToggles && tabs && } {(tabs || tabContent) && ( {tabs} diff --git a/packages/eui/src-docs/src/components/guide_section/guide_section_parts/guide_section_props_description.tsx b/packages/eui/src-docs/src/components/guide_section/guide_section_parts/guide_section_props_description.tsx index c1d215babef..2e71703bf6b 100644 --- a/packages/eui/src-docs/src/components/guide_section/guide_section_parts/guide_section_props_description.tsx +++ b/packages/eui/src-docs/src/components/guide_section/guide_section_parts/guide_section_props_description.tsx @@ -63,23 +63,25 @@ export const GuideSectionPropsDescription: FunctionComponent< return ( <> -
- - - -

{componentName}

-
+ + + +

{componentName}

+
+
+ {extendedTypesElements.length > 0 && ( + + +

[ extends {extendedTypesElements} ]

+
- {extendedTypesElements.length > 0 && ( - - -

[ extends {extendedTypesElements} ]

-
-
- )} -
- {descriptionElement} -
+ )} + + {descriptionElement} ); }; diff --git a/packages/eui/src-docs/src/components/guide_section/guide_section_parts/guide_section_props_table.tsx b/packages/eui/src-docs/src/components/guide_section/guide_section_parts/guide_section_props_table.tsx index 1fed2a84684..c17c7f0a0e2 100644 --- a/packages/eui/src-docs/src/components/guide_section/guide_section_parts/guide_section_props_table.tsx +++ b/packages/eui/src-docs/src/components/guide_section/guide_section_parts/guide_section_props_table.tsx @@ -23,7 +23,7 @@ export const GuideSectionPropsTable: FunctionComponent< const { props } = docgenInfo; return ( -
+ <> {componentName && ( -
+ ); }; diff --git a/packages/eui/src-docs/src/components/guide_section/guide_section_parts/guide_section_snippets.tsx b/packages/eui/src-docs/src/components/guide_section/guide_section_parts/guide_section_snippets.tsx index fff2175e3b7..5575a3a836d 100644 --- a/packages/eui/src-docs/src/components/guide_section/guide_section_parts/guide_section_snippets.tsx +++ b/packages/eui/src-docs/src/components/guide_section/guide_section_parts/guide_section_snippets.tsx @@ -1,6 +1,10 @@ import React, { FunctionComponent } from 'react'; -import { EuiCodeBlock } from '../../../../../src/components/code'; -import { EuiSpacer } from '../../../../../src/components/spacer'; +import { + EuiCodeBlock, + EuiHorizontalRule, + EuiSpacer, + useEuiTheme, +} from '../../../../../src'; export type GuideSectionSnippets = { snippets: string | string[]; @@ -9,20 +13,29 @@ export type GuideSectionSnippets = { export const GuideSectionSnippets: FunctionComponent = ({ snippets, }) => { + const { highContrastMode } = useEuiTheme(); + const codeBlockProps = { + language: 'jsx', + fontSize: 'm', + paddingSize: 'm', + isCopyable: true, + // Code block is used within a panel which already has a border - skip doubling up + ...(highContrastMode && { css: { border: 'none' } }), + } as const; + let snippetCode; if (typeof snippets === 'string') { - snippetCode = ( - - {snippets} - - ); + snippetCode = {snippets}; } else { snippetCode = snippets.map((snip, index) => ( - - {snip} - - {index < snippets.length - 1 && } + {snip} + {index < snippets.length - 1 && + (highContrastMode ? ( + + ) : ( + + ))} )); } diff --git a/packages/eui/src-docs/src/services/playground/_index.scss b/packages/eui/src-docs/src/services/playground/_index.scss index 977aadec204..bc06493c253 100644 --- a/packages/eui/src-docs/src/services/playground/_index.scss +++ b/packages/eui/src-docs/src/services/playground/_index.scss @@ -1,2 +1 @@ @import './playground_compiler'; -@import './playground_knobs'; diff --git a/packages/eui/src-docs/src/services/playground/_playground_compiler.scss b/packages/eui/src-docs/src/services/playground/_playground_compiler.scss index 0434661ddf8..1c59e887421 100644 --- a/packages/eui/src-docs/src/services/playground/_playground_compiler.scss +++ b/packages/eui/src-docs/src/services/playground/_playground_compiler.scss @@ -11,10 +11,6 @@ flex-shrink: 0; } -.playground__tableWrapper { - background-color: $euiPageBackgroundColor; -} - .playground__title { padding: $euiSizeS $euiSize; } diff --git a/packages/eui/src-docs/src/services/playground/_playground_knobs.scss b/packages/eui/src-docs/src/services/playground/_playground_knobs.scss deleted file mode 100644 index 221dde4ad48..00000000000 --- a/packages/eui/src-docs/src/services/playground/_playground_knobs.scss +++ /dev/null @@ -1,6 +0,0 @@ -$knobTableRowMinHeight: 42px; - -.playgroundKnobs__rowCell { - min-height: $knobTableRowMinHeight; - display: block; -} diff --git a/packages/eui/src-docs/src/services/playground/knobs.js b/packages/eui/src-docs/src/services/playground/knobs.js index 22a2a33aea2..cc3ba291a19 100644 --- a/packages/eui/src-docs/src/services/playground/knobs.js +++ b/packages/eui/src-docs/src/services/playground/knobs.js @@ -1,6 +1,7 @@ import React, { useState, useEffect } from 'react'; import { assertUnreachable, PropTypes } from 'react-view'; import { + useEuiTheme, useIsWithinBreakpoints, EuiTitle, EuiCodeBlock, @@ -22,7 +23,6 @@ import { EuiTextArea, EuiFormRow, EuiText, - EuiPanel, EuiMarkdownFormat, } from '../../../../src'; import { @@ -480,7 +480,6 @@ const KnobColumn = ({ state, knobNames, error, set, isPlayground }) => { key={`modify__${name}-${idx}`} header={isPlayground ? 'Modify' : 'Default value'} textOnly={false} - className={isPlayground ? 'playgroundKnobs__rowCell' : undefined} > {isPlayground ? ( { }; const Knobs = ({ state, set, error, isPlayground = true }) => { + const { euiTheme } = useEuiTheme(); const isMobile = useIsWithinBreakpoints(['xs', 's']); const knobNames = Object.keys(state); @@ -532,12 +532,7 @@ const Knobs = ({ state, set, error, isPlayground = true }) => { }); return ( - +
{columns.map(({ name, width }, id) => { @@ -559,7 +554,7 @@ const Knobs = ({ state, set, error, isPlayground = true }) => { /> - +
); }; diff --git a/packages/eui/src-docs/src/services/playground/playground.js b/packages/eui/src-docs/src/services/playground/playground.js index 4b3b468d746..fb44ef31892 100644 --- a/packages/eui/src-docs/src/services/playground/playground.js +++ b/packages/eui/src-docs/src/services/playground/playground.js @@ -1,4 +1,5 @@ import React, { useState, useEffect } from 'react'; +import { css } from '@emotion/react'; import classNames from 'classnames'; import format from 'html-format'; @@ -7,7 +8,6 @@ import { EuiCodeBlock, EuiFlyoutBody, EuiFlyoutHeader, - EuiPanel, useEuiTheme, } from '../../../../src'; import { @@ -22,7 +22,6 @@ export default ({ setGhostBackground, playgroundClassName, playgroundCssStyles, - playgroundPanelProps, }) => { const getSnippet = (code) => { let regex = /return \(([\S\s]*?)(;)$/gm; @@ -84,27 +83,24 @@ export default ({ component={config.scope[config.componentName]} /> - - - - {thrownError && } - + + + {thrownError && } {getSnippet(params.editorProps.code)} diff --git a/packages/eui/src-docs/src/views/button/button_example.js b/packages/eui/src-docs/src/views/button/button_example.js index ae68720535b..de45613eb1f 100644 --- a/packages/eui/src-docs/src/views/button/button_example.js +++ b/packages/eui/src-docs/src/views/button/button_example.js @@ -15,7 +15,6 @@ import { EuiFlexGroup, EuiFlexItem, EuiCard, - EuiPanel, EuiSpacer, } from '../../../../src/components'; @@ -281,71 +280,56 @@ export const ButtonExample = { <> - - - - Primary action - -
- } - title="EuiButton" - titleSize="xs" - /> - - - - - Secondary action - - - } - title="EuiButton" - titleSize="xs" - /> - - - - - Tertiary action - - - } - title="EuiButtonEmpty" - titleSize="xs" - /> - - - - - - - - } - title="EuiButtonIcon" - titleSize="xs" - /> - + {[ + { + title: 'EuiButton', + children: Primary action, + href: '#/navigation/button#basic-button', + }, + { + title: 'EuiButton', + children: Secondary action, + href: '#/navigation/button#basic-button', + }, + { + title: 'EuiButtonEmpty', + children: Tertiary action, + href: '#/navigation/button#empty-button', + }, + { + title: 'EuiButtonIcon', + children: ( + + ), + href: '#/navigation/button#icon-buttons', + }, + // eslint-disable-next-line local/href-with-rel + ].map(({ title, children, href }) => ( + + ({ + padding: euiTheme.size.xl, + backgroundColor: euiTheme.colors.body, + borderBlockEnd: euiTheme.border.thin, + })} + > + {children} + + } + title={title} + titleSize="xs" + /> + + ))} ), diff --git a/packages/eui/src-docs/src/views/theme/_components/_theme_example.tsx b/packages/eui/src-docs/src/views/theme/_components/_theme_example.tsx index 895a2bc858d..82cda9c51b8 100644 --- a/packages/eui/src-docs/src/views/theme/_components/_theme_example.tsx +++ b/packages/eui/src-docs/src/views/theme/_components/_theme_example.tsx @@ -48,7 +48,7 @@ export const ThemeExample: FunctionComponent = ({ snippetLanguage = 'jsx', props, }) => { - const { euiTheme } = useEuiTheme(); + const { euiTheme, highContrastMode } = useEuiTheme(); const isLargeBreakpoint = useIsWithinBreakpoints(['m', 'l', 'xl']); const finalSnippet = @@ -146,6 +146,8 @@ export const ThemeExample: FunctionComponent = ({ language={ snippetLanguage === 'emotion' ? 'jsx' : snippetLanguage } + // Code block is used within a panel which already has a border - skip doubling up + {...(highContrastMode && { css: { border: 'none' } })} > {finalSnippet} diff --git a/packages/eui/src-docs/src/views/theme/_theme_section.tsx b/packages/eui/src-docs/src/views/theme/_theme_section.tsx index 23b85a412b1..9e064e174f1 100644 --- a/packages/eui/src-docs/src/views/theme/_theme_section.tsx +++ b/packages/eui/src-docs/src/views/theme/_theme_section.tsx @@ -70,6 +70,10 @@ export const ThemeSection: FunctionComponent = ({ paddingSize="none" transparentBackground={true} language="jsx" + // Code block is used within a panel which already has a border - skip doubling up + css={({ highContrastMode }) => + highContrastMode ? { border: 'none' } : undefined + } > {finalSnippet} diff --git a/packages/eui/src-docs/src/views/theme/color/_color_js.tsx b/packages/eui/src-docs/src/views/theme/color/_color_js.tsx index b4749bb0575..2669dd680fe 100644 --- a/packages/eui/src-docs/src/views/theme/color/_color_js.tsx +++ b/packages/eui/src-docs/src/views/theme/color/_color_js.tsx @@ -315,7 +315,7 @@ const cssStyles = [colorStyles['accent']]; type="hook" props={`color: '${BACKGROUND_COLORS.join("' | '")}'; -method? 'opaque' | 'transparent';`} +method?: 'opaque' | 'transparent';`} description={

Returns just the computed background color for the given{' '} diff --git a/packages/eui/src-docs/src/views/theme/color/contrast.tsx b/packages/eui/src-docs/src/views/theme/color/contrast.tsx index e9a96a4c286..f95c739afbb 100644 --- a/packages/eui/src-docs/src/views/theme/color/contrast.tsx +++ b/packages/eui/src-docs/src/views/theme/color/contrast.tsx @@ -115,7 +115,11 @@ export default () => { {/* This wrapping div for the sticky positioning */}

- +

Use the slider and toggle to adjust the color combinations shown diff --git a/packages/eui/src-docs/src/views/theme/color/tokens.tsx b/packages/eui/src-docs/src/views/theme/color/tokens.tsx index cf9433c7545..453f160c025 100644 --- a/packages/eui/src-docs/src/views/theme/color/tokens.tsx +++ b/packages/eui/src-docs/src/views/theme/color/tokens.tsx @@ -1,7 +1,7 @@ import React, { useContext, useMemo } from 'react'; import { Link } from 'react-router-dom'; -import { EuiCode, EuiSpacer, EuiText } from '../../../../../src'; +import { EuiCallOut, EuiCode, EuiSpacer, EuiText } from '../../../../../src'; import { GuideSection } from '../../../components/guide_section/guide_section'; import { ThemeContext } from '../../../components/with_theme'; @@ -33,20 +33,28 @@ export const colorsInfo = { notice: , showThemeLanguageToggle: true, intro: ( - -

- Elastic UI builds with a very limited palette. It uses a core set of - three colors with a green / orange / red qualitative set and combined - with a six-color grayscale. Variation beyond these colors is minimal and - always done with math manipulation against the original set. -

-

- When switching between light and dark color modes, the theme keys do not - change, only their values do. This is why most keys are not named for - their evaluated value but by their{' '} - purpose. -

-
+ <> + +

+ Elastic UI builds with a very limited palette. It uses a core set of + three colors with a green / orange / red qualitative set and combined + with a six-color grayscale. Variation beyond these colors is minimal + and always done with math manipulation against the original set. +

+
+ + + Never rely solely on color to convey meaning. Colors can be overridden + by{' '} + + system forced colors + + , or can be difficult to distinguish for different users. Always combine + color context with accompanying icons{' '} + or copy to indicate states such as + error, activity, etc. + + ), }; @@ -126,6 +134,12 @@ export default () => { statefulness like indicating between successful and dangerous actions.

+

+ When switching between light and dark color modes, the theme keys do + not change, only their values do. This is why most keys are not + named for their evaluated value but by their{' '} + purpose. +

diff --git a/packages/eui/src-docs/src/views/theme/other/_shadow_js.tsx b/packages/eui/src-docs/src/views/theme/other/_shadow_js.tsx index ff1b2f395e5..ac0f125023d 100644 --- a/packages/eui/src-docs/src/views/theme/other/_shadow_js.tsx +++ b/packages/eui/src-docs/src/views/theme/other/_shadow_js.tsx @@ -28,7 +28,7 @@ const RenderShadow = ({ size: _EuiThemeShadowSize; color?: string; }) => { - const style = useEuiShadow(size, color); + const style = useEuiShadow(size, { color }); return (
{ - const style = useEuiShadowFlat(color); + const style = useEuiShadowFlat({ color }); return (
{ /> useEuiShadow(size)} type="hook" + title={useEuiShadow(size, options)} + props={`size?: '${EuiThemeShadowSizes.join("' | '")}'; + +options?: { + color?: string; + property?: 'box-shadow' | 'filter'; + borderAllInHighContrastMode?: boolean; +};`} description={ <>

@@ -102,7 +109,7 @@ export default () => {

Usually you want to avoid putting shadows on containers with the - same background color of its parent (e.g. white on white); + same background color of its parent (e.g. white on white).

} @@ -131,7 +138,7 @@ export const ShadowValuesJS = () => { return { id: shadow, token: customColor - ? `useEuiShadow('${shadow}', euiTheme.colors.accent);` + ? `useEuiShadow('${shadow}', { color: euiTheme.colors.accent });` : `useEuiShadow('${shadow}');`, description: _EuiShadowSizesDescriptions[shadow], }; @@ -142,7 +149,7 @@ export const ShadowValuesJS = () => { // @ts-ignore TODO id: 'flat', token: customColor - ? 'useEuiShadowFlat(euiTheme.colors.accent);' + ? 'useEuiShadowFlat({ color: euiTheme.colors.accent });' : 'useEuiShadowFlat();', description: 'Similar to shadow medium but without the bottom depth. Useful for popovers that drop UP rather than DOWN.', diff --git a/packages/eui/src-docs/src/views/theme/other/other.tsx b/packages/eui/src-docs/src/views/theme/other/other.tsx index 68202c35c23..ec0c3518dbd 100644 --- a/packages/eui/src-docs/src/views/theme/other/other.tsx +++ b/packages/eui/src-docs/src/views/theme/other/other.tsx @@ -1,4 +1,5 @@ import React, { useContext, useMemo } from 'react'; +import { Link } from 'react-router-dom'; import { GuideTabbedPage } from '../../../components/guide_tabbed_page'; import { ThemeContext } from '../../../components/with_theme'; @@ -139,11 +140,7 @@ export default () => { - euiCanAnimate} - > + euiCanAnimate}>

For accessbility support, we highly recommend always wrapping animations and transitions with this{' '} @@ -174,6 +171,20 @@ export default () => {

{`${otherSections[1].title}`}

+ + +

+ Keep in mind that shadows will not render in{' '} + + forced high contrast modes + + . EUI's shadow utilities automatically replace shadows with bottom + borders, which will render better in high contrast modes. These + utilities can also be configured to render their high contrast + borders around the entire element. +

+
+ {shadowContent} diff --git a/packages/eui/src/components/code/code_block.stories.tsx b/packages/eui/src/components/code/code_block.stories.tsx index 082b01f7907..299105496c1 100644 --- a/packages/eui/src/components/code/code_block.stories.tsx +++ b/packages/eui/src/components/code/code_block.stories.tsx @@ -108,6 +108,7 @@ export const HighContrast: Story = { tags: ['vrt-only'], globals: { highContrastMode: true }, args: { + whiteSpace: 'pre', language: 'json', lineNumbers: { start: 32, diff --git a/packages/eui/src/components/code/code_block.styles.ts b/packages/eui/src/components/code/code_block.styles.ts index b9eebda59d6..cab4a1da792 100644 --- a/packages/eui/src/components/code/code_block.styles.ts +++ b/packages/eui/src/components/code/code_block.styles.ts @@ -30,6 +30,8 @@ export const euiCodeBlockStyles = (euiThemeContext: UseEuiTheme) => { background: ${codeSyntaxVariables.backgroundColor}; ${highContrastModeStyles(euiThemeContext, { preferred: `border: ${euiTheme.border.thin};`, + // Fix scrolling text occluding the border in Windows high contrast mode + forced: 'overflow: hidden;', })} ${codeSyntaxVariables.tokensCss} diff --git a/packages/eui/src/components/empty_prompt/empty_prompt.stories.tsx b/packages/eui/src/components/empty_prompt/empty_prompt.stories.tsx index db5e316f1e5..4b97fdf5fac 100644 --- a/packages/eui/src/components/empty_prompt/empty_prompt.stories.tsx +++ b/packages/eui/src/components/empty_prompt/empty_prompt.stories.tsx @@ -97,3 +97,18 @@ export const PageTemplate: Story = { ), }, }; + +export const HighContrast: Story = { + tags: ['vrt-only'], + globals: { highContrastMode: true }, + args: Playground.args, +}; + +export const HighContrastTransparent: Story = { + tags: ['vrt-only'], + globals: { highContrastMode: true }, + args: { + ...Playground.args, + color: 'transparent', + }, +}; diff --git a/packages/eui/src/components/empty_prompt/empty_prompt.styles.ts b/packages/eui/src/components/empty_prompt/empty_prompt.styles.ts index 07da2e3dddd..8f7e706a6d6 100644 --- a/packages/eui/src/components/empty_prompt/empty_prompt.styles.ts +++ b/packages/eui/src/components/empty_prompt/empty_prompt.styles.ts @@ -14,6 +14,7 @@ import { logicalCSS, mathWithUnits, } from '../../global_styling'; +import { highContrastModeStyles } from '../../global_styling/functions/high_contrast'; import { UseEuiTheme } from '../../services'; export const euiEmptyPromptStyles = (euiThemeContext: UseEuiTheme) => { @@ -141,9 +142,15 @@ export const euiEmptyPromptStyles = (euiThemeContext: UseEuiTheme) => { // Colors transparent: css` background-color: ${euiTheme.colors.body}; + ${highContrastModeStyles(euiThemeContext, { + preferred: `border: ${euiTheme.border.thin};`, + })} `, plain: css` background-color: ${euiTheme.colors.body}; + ${highContrastModeStyles(euiThemeContext, { + preferred: logicalCSS('border-top', generateFooterBorder('plain')), + })} `, subdued: css` ${logicalCSS('border-top', generateFooterBorder('subdued'))} diff --git a/packages/eui/src/components/error_boundary/error_boundary.stories.tsx b/packages/eui/src/components/error_boundary/error_boundary.stories.tsx index 535abafcdec..579941fc2b8 100644 --- a/packages/eui/src/components/error_boundary/error_boundary.stories.tsx +++ b/packages/eui/src/components/error_boundary/error_boundary.stories.tsx @@ -37,3 +37,9 @@ export const Playground: Story = { onError: console.log, }, }; + +export const HighContrast: Story = { + ...Playground, + tags: ['vrt-only'], + globals: { highContrastMode: true }, +}; diff --git a/packages/eui/src/components/error_boundary/error_boundary.styles.ts b/packages/eui/src/components/error_boundary/error_boundary.styles.ts index 27adf527c3a..f1c34cdc27a 100644 --- a/packages/eui/src/components/error_boundary/error_boundary.styles.ts +++ b/packages/eui/src/components/error_boundary/error_boundary.styles.ts @@ -8,24 +8,44 @@ import { css } from '@emotion/react'; import { logicalCSS } from '../../global_styling'; +import { highContrastModeStyles } from '../../global_styling/functions/high_contrast'; import { transparentize, UseEuiTheme } from '../../services'; -export const euiErrorBoundaryStyles = ({ euiTheme }: UseEuiTheme) => { - const color1 = transparentize(euiTheme.colors.danger, 0.25); - const color2 = transparentize(euiTheme.colors.danger, 0.05); +export const euiErrorBoundaryStyles = (euiThemeContext: UseEuiTheme) => { + const { euiTheme, highContrastMode } = euiThemeContext; + const color1 = transparentize( + euiTheme.colors.danger, + highContrastMode ? 1 : 0.25 + ); + const color2 = transparentize( + euiTheme.colors.danger, + highContrastMode ? 0.25 : 0.05 + ); return { euiErrorBoundary: css` - background-image: repeating-linear-gradient( - 45deg, - ${color1}, - ${color1} 1px, - ${color2} 1px, - ${color2} 19px - ); - background-size: 54px 54px; /* Fix for Safari 15.4+ */ ${logicalCSS('padding-horizontal', euiTheme.size.base)} ${logicalCSS('padding-vertical', euiTheme.size.base)} + + ${highContrastModeStyles(euiThemeContext, { + none: ` + background-image: repeating-linear-gradient( + 45deg, + ${color1}, + ${color1} 1px, + ${color2} 1px, + ${color2} 19px + ); + background-size: 54px 54px; /* Fix for Safari 15.4+ */ + `, + // Windows high contrast themes ignore background-images that aren't url()s. + // We can fake a basic danger-colored "border" with a little inline SVG trickery + forced: ` + background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg'%3E%3Crect width='100%25' height='100%25' fill='${encodeURIComponent( + euiTheme.colors.dangerText + )}' /%3E%3C/svg%3E"); + `, + })} `, }; }; diff --git a/packages/eui/src/components/flyout/flyout.stories.tsx b/packages/eui/src/components/flyout/flyout.stories.tsx index 3303996248c..42aca36117f 100644 --- a/packages/eui/src/components/flyout/flyout.stories.tsx +++ b/packages/eui/src/components/flyout/flyout.stories.tsx @@ -10,7 +10,7 @@ import React, { useState } from 'react'; import type { Meta, StoryObj } from '@storybook/react'; import { action } from '@storybook/addon-actions'; -import { EuiButton, EuiText, EuiTitle } from '../index'; +import { EuiButton, EuiCallOut, EuiText, EuiTitle } from '../index'; import { EuiFlyout, @@ -136,3 +136,25 @@ export const PushFlyouts: Story = { ); }, }; + +export const HighContrast: Story = { + tags: ['vrt-only'], + globals: { highContrastMode: true }, + args: { + children: ( + <> + + +

Flyout header

+
+
+ Flyout banner
}> + Flyout body + + + Flyout footer + + + ), + }, +}; diff --git a/packages/eui/src/components/flyout/flyout_body.styles.ts b/packages/eui/src/components/flyout/flyout_body.styles.ts index e039d7cc6e8..9420a24b4ac 100644 --- a/packages/eui/src/components/flyout/flyout_body.styles.ts +++ b/packages/eui/src/components/flyout/flyout_body.styles.ts @@ -13,8 +13,10 @@ import { logicalCSSWithFallback, euiYScrollWithShadows, } from '../../global_styling'; +import { highContrastModeStyles } from '../../global_styling/functions/high_contrast'; export const euiFlyoutBodyStyles = (euiThemeContext: UseEuiTheme) => { + const { euiTheme } = euiThemeContext; return { euiFlyoutBody: css` ${logicalCSSWithFallback('overflow-y', 'hidden')} @@ -31,6 +33,9 @@ export const euiFlyoutBodyStyles = (euiThemeContext: UseEuiTheme) => { }, euiFlyoutBody__banner: css` ${logicalCSSWithFallback('overflow-x', 'hidden')} + ${highContrastModeStyles(euiThemeContext, { + preferred: logicalCSS('border-bottom', euiTheme.border.thin), + })} `, }; }; diff --git a/packages/eui/src/components/flyout/flyout_footer.styles.ts b/packages/eui/src/components/flyout/flyout_footer.styles.ts index 8cb5b41ac31..ef35d5a5eb7 100644 --- a/packages/eui/src/components/flyout/flyout_footer.styles.ts +++ b/packages/eui/src/components/flyout/flyout_footer.styles.ts @@ -8,6 +8,8 @@ import { css } from '@emotion/react'; import { UseEuiTheme } from '../../services'; +import { logicalCSS } from '../../global_styling'; +import { highContrastModeStyles } from '../../global_styling/functions/high_contrast'; export const euiFlyoutFooterStyles = (euiThemeContext: UseEuiTheme) => { const euiTheme = euiThemeContext.euiTheme; @@ -16,6 +18,9 @@ export const euiFlyoutFooterStyles = (euiThemeContext: UseEuiTheme) => { euiFlyoutFooter: css` background-color: ${euiTheme.colors.lightestShade}; flex-grow: 0; + ${highContrastModeStyles(euiThemeContext, { + preferred: logicalCSS('border-top', euiTheme.border.thin), + })} `, }; }; diff --git a/packages/eui/src/components/image/image_button.styles.ts b/packages/eui/src/components/image/image_button.styles.ts index 39bc625e6a4..4c483e94df8 100644 --- a/packages/eui/src/components/image/image_button.styles.ts +++ b/packages/eui/src/components/image/image_button.styles.ts @@ -56,12 +56,16 @@ export const euiImageButtonStyles = (euiThemeContext: UseEuiTheme) => { `, shadowHover: css` &::before { - ${euiShadow(euiThemeContext, 's')} + ${euiShadow(euiThemeContext, 's', { + borderAllInHighContrastMode: true, + })} } `, hasShadowHover: css` &::before { - ${euiShadow(euiThemeContext, 'm')} + ${euiShadow(euiThemeContext, 'm', { + borderAllInHighContrastMode: true, + })} } `, }; diff --git a/packages/eui/src/components/markdown_editor/__snapshots__/markdown_format.styles.test.ts.snap b/packages/eui/src/components/markdown_editor/__snapshots__/markdown_format.styles.test.ts.snap index 1609571365e..ffcddccf5b0 100644 --- a/packages/eui/src/components/markdown_editor/__snapshots__/markdown_format.styles.test.ts.snap +++ b/packages/eui/src/components/markdown_editor/__snapshots__/markdown_format.styles.test.ts.snap @@ -337,10 +337,6 @@ exports[`euiMarkdownFormat text sizes m 1`] = ` " .euiMarkdownFormat__codeblockWrapper { margin-block-end: 1.1429rem; - - .euiCodeBlock__pre { - margin-block-end: 0; - } } .euiMarkdownFormat__table { @@ -359,10 +355,6 @@ exports[`euiMarkdownFormat text sizes relative 1`] = ` " .euiMarkdownFormat__codeblockWrapper { margin-block-end: 1em; - - .euiCodeBlock__pre { - margin-block-end: 0; - } } .euiMarkdownFormat__table { @@ -381,10 +373,6 @@ exports[`euiMarkdownFormat text sizes s 1`] = ` " .euiMarkdownFormat__codeblockWrapper { margin-block-end: 1.0000rem; - - .euiCodeBlock__pre { - margin-block-end: 0; - } } .euiMarkdownFormat__table { @@ -403,10 +391,6 @@ exports[`euiMarkdownFormat text sizes xs 1`] = ` " .euiMarkdownFormat__codeblockWrapper { margin-block-end: 0.8571rem; - - .euiCodeBlock__pre { - margin-block-end: 0; - } } .euiMarkdownFormat__table { diff --git a/packages/eui/src/components/markdown_editor/markdown_format.styles.ts b/packages/eui/src/components/markdown_editor/markdown_format.styles.ts index 0d5fd44c914..c229068e075 100644 --- a/packages/eui/src/components/markdown_editor/markdown_format.styles.ts +++ b/packages/eui/src/components/markdown_editor/markdown_format.styles.ts @@ -32,10 +32,6 @@ const euiScaleMarkdownFormatText = ( return ` .euiMarkdownFormat__codeblockWrapper { ${logicalCSS('margin-bottom', fontSize)} - - .euiCodeBlock__pre { - ${logicalCSS('margin-bottom', 0)} - } } .euiMarkdownFormat__table { diff --git a/packages/eui/src/components/panel/panel.styles.ts b/packages/eui/src/components/panel/panel.styles.ts index 27222c37d2a..77fe3216322 100644 --- a/packages/eui/src/components/panel/panel.styles.ts +++ b/packages/eui/src/components/panel/panel.styles.ts @@ -65,7 +65,7 @@ export const euiPanelStyles = (euiThemeContext: UseEuiTheme) => { ${highContrastModeStyles(euiThemeContext, { none: euiShadow(euiThemeContext, 'l'), // Windows high contrast themes ignore box-shadows - use a filter workaround instead - forced: ` + preferred: ` filter: drop-shadow(0 ${euiTheme.border.width.thick} 0 ${euiTheme.border.color}); `, })} diff --git a/packages/eui/src/components/panel/panel.tsx b/packages/eui/src/components/panel/panel.tsx index 6cc3d35fbb7..76cbcbcce1c 100644 --- a/packages/eui/src/components/panel/panel.tsx +++ b/packages/eui/src/components/panel/panel.tsx @@ -125,7 +125,7 @@ export const EuiPanel: FunctionComponent = ({ useEuiBackgroundColorCSS()[color], canHaveShadow && hasShadow === true && styles.hasShadow, canHaveBorder && hasBorder === true && styles.hasBorder, - ...(highContrastMode + ...(highContrastMode && _canRenderHighContrastBorder({ color, hasBorder }) ? [{ border: euiTheme.border.thin }, borderColors[color]] : []), rest.onClick && styles.isClickable, @@ -165,3 +165,11 @@ export const EuiPanel: FunctionComponent = ({
); }; + +// Do not render a high contrast border if the panel is transparent +// and does not have a default contrast border +export const _canRenderHighContrastBorder = ({ + color, + hasBorder, +}: Pick<_EuiPanelProps, 'color' | 'hasBorder'>) => + !(color === 'transparent' && !hasBorder); diff --git a/packages/eui/src/components/panel/split_panel/split_panel.styles.ts b/packages/eui/src/components/panel/split_panel/split_panel.styles.ts index 7352b5f7e1e..33ec61c988b 100644 --- a/packages/eui/src/components/panel/split_panel/split_panel.styles.ts +++ b/packages/eui/src/components/panel/split_panel/split_panel.styles.ts @@ -26,19 +26,40 @@ export const euiSplitPanelOuterStyles = { `, }; -export const euiSplitPanelInnerStyles = (euiThemeContext: UseEuiTheme) => ({ - euiSplitPanelInner: css` - /* Make sure they're evenly split */ - flex-basis: 0%; - - /* Ensure no movement if they have click handlers */ - /* stylelint-disable declaration-no-important */ - transform: none !important; - box-shadow: none !important; - - ${highContrastModeStyles(euiThemeContext, { - // Don't double up on borders in high contrast mode - preferred: 'border: none;', - })} - `, -}); +export const euiSplitPanelInnerStyles = (euiThemeContext: UseEuiTheme) => { + const { euiTheme } = euiThemeContext; + + return { + euiSplitPanelInner: css` + /* Make sure they're evenly split */ + flex-basis: 0%; + + /* Ensure no movement if they have click handlers */ + /* stylelint-disable declaration-no-important */ + transform: none !important; + box-shadow: none !important; + `, + + highContrastBorders: { + // Don't double up on borders in high contrast mode, but render + // border dividers between nested inner panels + _renderBorder: (direction: 'right' | 'bottom') => + highContrastModeStyles(euiThemeContext, { + preferred: ` + border: none; + + &:not(:last-child) { + ${logicalCSS(`border-${direction}`, euiTheme.border.thin)} + border-color: inherit; /* Attempt to inherit from parent panel */ + } + `, + }), + get column() { + return this._renderBorder('bottom'); + }, + get row() { + return this._renderBorder('right'); + }, + }, + }; +}; diff --git a/packages/eui/src/components/panel/split_panel/split_panel.tsx b/packages/eui/src/components/panel/split_panel/split_panel.tsx index e0e2f536263..4ac9c7b139c 100644 --- a/packages/eui/src/components/panel/split_panel/split_panel.tsx +++ b/packages/eui/src/components/panel/split_panel/split_panel.tsx @@ -6,7 +6,13 @@ * Side Public License, v 1. */ -import React, { FunctionComponent, ReactNode, HTMLAttributes } from 'react'; +import React, { + FunctionComponent, + ReactNode, + HTMLAttributes, + createContext, + useContext, +} from 'react'; import classNames from 'classnames'; import { @@ -15,7 +21,11 @@ import { } from '../../../services/breakpoint'; import { useEuiMemoizedStyles } from '../../../services'; -import { EuiPanel, _EuiPanelProps } from '../panel'; +import { + EuiPanel, + _EuiPanelProps, + _canRenderHighContrastBorder, +} from '../panel'; import { euiSplitPanelOuterStyles, euiSplitPanelInnerStyles, @@ -31,8 +41,14 @@ export type _EuiSplitPanelInnerProps = HTMLAttributes & export const _EuiSplitPanelInner: FunctionComponent< _EuiSplitPanelInnerProps > = ({ children, className, ...rest }) => { + const borderDirection = useContext(SplitPanelInnerBorderDirection); + const classes = classNames('euiSplitPanel__inner', className); const styles = useEuiMemoizedStyles(euiSplitPanelInnerStyles); + const cssStyles = [ + styles.euiSplitPanelInner, + borderDirection && styles.highContrastBorders[borderDirection], + ]; const panelProps: _EuiPanelProps = { hasShadow: false, @@ -45,7 +61,7 @@ export const _EuiSplitPanelInner: FunctionComponent< @@ -87,12 +103,14 @@ export const _EuiSplitPanelOuter: FunctionComponent< responsive as EuiBreakpointSize[], !!responsive ); + const responsiveDirection = + direction === 'row' && !isResponsive ? 'row' : 'column'; + const innerBorderDirection = _canRenderHighContrastBorder({ ...rest }) + ? responsiveDirection + : undefined; const styles = euiSplitPanelOuterStyles; - const cssStyles = [ - styles.euiSplitPanelOuter, - direction === 'row' && !isResponsive ? styles.row : styles.column, - ]; + const cssStyles = [styles.euiSplitPanelOuter, styles[responsiveDirection]]; const classes = classNames('euiSplitPanel', className); @@ -104,11 +122,16 @@ export const _EuiSplitPanelOuter: FunctionComponent< css={cssStyles} {...(rest as _EuiPanelProps)} > - {children} + + {children} + ); }; +const SplitPanelInnerBorderDirection = + createContext<_EuiSplitPanelOuterProps['direction']>(undefined); + export const EuiSplitPanel = { Outer: _EuiSplitPanelOuter, Inner: _EuiSplitPanelInner, diff --git a/packages/eui/src/components/panel/split_panel/split_panel_outer.stories.tsx b/packages/eui/src/components/panel/split_panel/split_panel_outer.stories.tsx index 474e1718634..5ba082ee390 100644 --- a/packages/eui/src/components/panel/split_panel/split_panel_outer.stories.tsx +++ b/packages/eui/src/components/panel/split_panel/split_panel_outer.stories.tsx @@ -34,3 +34,54 @@ export const SplitPanelOuter: Story = { ), }; + +export const HighContrast: Story = { + tags: ['vrt-only'], + globals: { highContrastMode: true }, + render: () => ( + <> + + + + Nested + Border test + + + Right panel + +
+ + + + Nested + + + Nested again + *inception noises* + + + + + Bottom panel + +
+ + + Transparent panels should not render border dividers + + + + But transparent panels + + with hasBorder should + + + + + + ), +}; diff --git a/packages/eui/src/components/text/__snapshots__/text.styles.test.ts.snap b/packages/eui/src/components/text/__snapshots__/text.styles.test.ts.snap index f4937379d57..dd8e4853c4a 100644 --- a/packages/eui/src/components/text/__snapshots__/text.styles.test.ts.snap +++ b/packages/eui/src/components/text/__snapshots__/text.styles.test.ts.snap @@ -143,6 +143,7 @@ exports[`euiTextStyles sizes m 1`] = ` font-size: .9em; /* 90% of parent font size */ } + kbd { padding-block-end: 4px; /* Ensures the shape still looks like a square when only one character */ @@ -304,6 +305,7 @@ exports[`euiTextStyles sizes relative 1`] = ` font-size: .9em; /* 90% of parent font size */ } + ;;label:relative;" `; @@ -450,6 +452,7 @@ exports[`euiTextStyles sizes s 1`] = ` font-size: .9em; /* 90% of parent font size */ } + ;;label:s;" `; @@ -596,5 +599,6 @@ exports[`euiTextStyles sizes xs 1`] = ` font-size: .9em; /* 90% of parent font size */ } + ;;label:xs;" `; diff --git a/packages/eui/src/components/text/text.styles.ts b/packages/eui/src/components/text/text.styles.ts index 060d23642e6..d0a63be5d57 100644 --- a/packages/eui/src/components/text/text.styles.ts +++ b/packages/eui/src/components/text/text.styles.ts @@ -203,6 +203,19 @@ const euiScaleText = ( code:not(.euiCode):not(.euiCodeBlock__code) { font-size: .9em; /* 90% of parent font size */ } + ${highContrastModeStyles(euiThemeContext, { + // For EuiCodeBlocks, set the margin on the wrapper instead of on the
+      // so that high contrast mode borders render as expected
+      preferred: `
+        .euiCodeBlock {
+          ${logicalCSS('margin-bottom', lineHeightSize)}
+
+          pre {
+            ${logicalCSS('margin-bottom', 0)}
+          }
+        }
+      `,
+    })}
     ${
       // when textSize is 'm', the 'kbd' element gets a line between the text and the border-bottom
       _customScale === 'm'
diff --git a/packages/eui/src/global_styling/variables/borders.ts b/packages/eui/src/global_styling/variables/borders.ts
index 10eda82eb9b..18ebe51ac78 100644
--- a/packages/eui/src/global_styling/variables/borders.ts
+++ b/packages/eui/src/global_styling/variables/borders.ts
@@ -37,7 +37,8 @@ export interface _EuiThemeBorderRadiusValues {
 
 export interface _EuiThemeBorderColorValues {
   /**
-   * Color for all borders; Default is `colors.lightShade`
+   * Color for all borders; Default is `colors.lightShade`.
+   * In high contrast mode, this value becomes `colors.fullShade` and cannot be overridden.
    */
   color: ColorModeSwitch;
 }
diff --git a/packages/eui/src/global_styling/variables/shadow.ts b/packages/eui/src/global_styling/variables/shadow.ts
index e8bd284645b..31bcedee7e7 100644
--- a/packages/eui/src/global_styling/variables/shadow.ts
+++ b/packages/eui/src/global_styling/variables/shadow.ts
@@ -21,9 +21,3 @@ export const _EuiShadowSizesDescriptions: Record<_EuiThemeShadowSize, string> =
     l: 'Primary shadow used in most cases to add visible depth.',
     xl: 'Very large shadows used for large portalled style containers like modals and flyouts.',
   };
-
-export interface _EuiThemeShadowCustomColor {
-  color?: string;
-  property?: 'box-shadow' | 'filter';
-  borderAllInHighContrastMode?: boolean;
-}
diff --git a/packages/eui/src/themes/amsterdam/global_styling/mixins/shadow.ts b/packages/eui/src/themes/amsterdam/global_styling/mixins/shadow.ts
index ea3d4253ee2..84e596c93eb 100644
--- a/packages/eui/src/themes/amsterdam/global_styling/mixins/shadow.ts
+++ b/packages/eui/src/themes/amsterdam/global_styling/mixins/shadow.ts
@@ -9,13 +9,15 @@
 import { useEuiTheme, UseEuiTheme } from '../../../../services/theme';
 import { getShadowColor } from '../functions';
 import { logicalCSS } from '../../../../global_styling';
-import {
-  _EuiThemeShadowSize,
-  _EuiThemeShadowCustomColor,
-} from '../../../../global_styling/variables/shadow';
+import { _EuiThemeShadowSize } from '../../../../global_styling/variables/shadow';
 
-export interface EuiShadowCustomColor {
+export interface EuiShadowOptions {
   color?: string;
+  /**
+   * Note: not supported by all shadow utilities.
+   */
+  property?: 'box-shadow' | 'filter';
+  borderAllInHighContrastMode?: boolean;
 }
 
 /**
@@ -23,7 +25,7 @@ export interface EuiShadowCustomColor {
  */
 export const euiShadowXSmall = (
   { euiTheme, colorMode, highContrastMode }: UseEuiTheme,
-  options?: _EuiThemeShadowCustomColor
+  options?: EuiShadowOptions
 ) => {
   if (highContrastMode) {
     return _highContrastBorder(euiTheme, options);
@@ -43,7 +45,7 @@ box-shadow:
  */
 export const euiShadowSmall = (
   { euiTheme, colorMode, highContrastMode }: UseEuiTheme,
-  options?: _EuiThemeShadowCustomColor
+  options?: EuiShadowOptions
 ) => {
   if (highContrastMode) {
     return _highContrastBorder(euiTheme, options);
@@ -64,7 +66,7 @@ box-shadow:
  */
 export const euiShadowMedium = (
   { euiTheme, colorMode, highContrastMode }: UseEuiTheme,
-  options?: _EuiThemeShadowCustomColor
+  options?: EuiShadowOptions
 ) => {
   if (highContrastMode) {
     return _highContrastBorder(euiTheme, options);
@@ -93,7 +95,7 @@ export const euiShadowMedium = (
  */
 export const euiShadowLarge = (
   { euiTheme, colorMode, highContrastMode }: UseEuiTheme,
-  options?: _EuiThemeShadowCustomColor
+  options?: EuiShadowOptions
 ) => {
   if (highContrastMode) {
     return _highContrastBorder(euiTheme, options);
@@ -113,7 +115,7 @@ box-shadow:
 /**
  * bottomShadowLarge
  */
-export interface EuiShadowXLarge extends _EuiThemeShadowCustomColor {
+export interface EuiShadowXLarge extends EuiShadowOptions {
   reverse?: boolean;
 }
 export const euiShadowXLarge = (
@@ -141,7 +143,7 @@ box-shadow:
  */
 export const euiSlightShadowHover = (
   { euiTheme, colorMode, highContrastMode }: UseEuiTheme,
-  options?: _EuiThemeShadowCustomColor
+  options?: EuiShadowOptions
 ) => {
   if (highContrastMode) {
     return _highContrastBorder(euiTheme, options);
@@ -157,11 +159,9 @@ box-shadow:
   0 23px 35px ${getShadowColor(color, 0.05, colorMode)};
 `;
 };
-export const useEuiSlightShadowHover = (
-  color?: _EuiThemeShadowCustomColor['color']
-) => {
+export const useEuiSlightShadowHover = (options?: EuiShadowOptions) => {
   const euiThemeContext = useEuiTheme();
-  return euiSlightShadowHover(euiThemeContext, { color });
+  return euiSlightShadowHover(euiThemeContext, options);
 };
 
 /**
@@ -172,10 +172,13 @@ export const useEuiSlightShadowHover = (
  */
 export const euiShadowFlat = (
   { euiTheme, colorMode, highContrastMode }: UseEuiTheme,
-  options?: _EuiThemeShadowCustomColor
+  options?: EuiShadowOptions
 ) => {
   if (highContrastMode) {
-    return _highContrastBorder(euiTheme, options);
+    return _highContrastBorder(euiTheme, {
+      borderAllInHighContrastMode: true,
+      ...options,
+    });
   }
 
   const color = options?.color || euiTheme.colors.shadow;
@@ -188,17 +191,15 @@ box-shadow:
   0 0 17px ${getShadowColor(color, 0.03, colorMode)};
 `;
 };
-export const useEuiShadowFlat = (
-  color?: _EuiThemeShadowCustomColor['color']
-) => {
+export const useEuiShadowFlat = (options?: EuiShadowOptions) => {
   const euiThemeContext = useEuiTheme();
-  return euiShadowFlat(euiThemeContext, { color });
+  return euiShadowFlat(euiThemeContext, options);
 };
 
 export const euiShadow = (
   euiThemeContext: UseEuiTheme,
   size: _EuiThemeShadowSize = 'l',
-  options?: _EuiThemeShadowCustomColor
+  options?: EuiShadowOptions
 ) => {
   if (euiThemeContext.highContrastMode) {
     return _highContrastBorder(euiThemeContext.euiTheme, options);
@@ -224,10 +225,10 @@ export const euiShadow = (
 
 export const useEuiShadow = (
   size: _EuiThemeShadowSize = 'l',
-  color?: _EuiThemeShadowCustomColor['color']
+  options?: EuiShadowOptions
 ) => {
   const euiThemeContext = useEuiTheme();
-  return euiShadow(euiThemeContext, size, { color });
+  return euiShadow(euiThemeContext, size, options);
 };
 
 /**
@@ -238,9 +239,11 @@ export const useEuiShadow = (
 
 const _highContrastBorder = (
   { border }: UseEuiTheme['euiTheme'],
-  { borderAllInHighContrastMode }: _EuiThemeShadowCustomColor = {}
+  { borderAllInHighContrastMode, color = border.color }: EuiShadowOptions = {}
 ) => {
+  const borderCSS = `${border.width.thin} solid ${color || border.color}`;
+
   return borderAllInHighContrastMode
-    ? `border: ${border.thin};`
-    : logicalCSS('border-bottom', border.thin);
+    ? `border: ${borderCSS};`
+    : logicalCSS('border-bottom', borderCSS);
 };
diff --git a/packages/website/docs/components/guidelines/writing/_category_.yml b/packages/website/docs/components/guidelines/writing/_category_.yml
index c64271ca370..95b785455dc 100644
--- a/packages/website/docs/components/guidelines/writing/_category_.yml
+++ b/packages/website/docs/components/guidelines/writing/_category_.yml
@@ -1,3 +1,3 @@
 link:
   type: doc
-  id: guidelines_writing_guidelines
+  id: guidelines_writing
diff --git a/packages/website/docs/components/guidelines/writing/guidelines.mdx b/packages/website/docs/components/guidelines/writing/guidelines.mdx
index 333ad17865f..ee278b22327 100644
--- a/packages/website/docs/components/guidelines/writing/guidelines.mdx
+++ b/packages/website/docs/components/guidelines/writing/guidelines.mdx
@@ -1,6 +1,6 @@
 ---
-slug: /guidelines/writing/guidelines
-id: guidelines_writing_guidelines
+slug: /guidelines/writing
+id: guidelines_writing
 title: Writing
 sidebar_position: 3
 ---
diff --git a/packages/website/docs/components/navigation/button/button_intro.tsx b/packages/website/docs/components/navigation/button/button_intro.tsx
index 98675315466..f62169a0bf8 100644
--- a/packages/website/docs/components/navigation/button/button_intro.tsx
+++ b/packages/website/docs/components/navigation/button/button_intro.tsx
@@ -52,8 +52,9 @@ export default () => {
           image={
             
{children} diff --git a/packages/website/docs/components/theming/borders.mdx b/packages/website/docs/components/theming/borders.mdx index 6dafa5fe800..e2c4ebb27e4 100644 --- a/packages/website/docs/components/theming/borders.mdx +++ b/packages/website/docs/components/theming/borders.mdx @@ -51,9 +51,10 @@ import { ColorPreview } from './borders/color_preview'; ### `euiTheme.border.color` token - Color for all borders; Default is `colors.lightShade` - You can apply this color directly to any `border-color` property. + - Default is `colors.lightShade` + - In high contrast mode, this value becomes `colors.fullShade` and cannot be overridden. + diff --git a/packages/website/docs/components/theming/colors/_forced_colors_warning.mdx b/packages/website/docs/components/theming/colors/_forced_colors_warning.mdx new file mode 100644 index 00000000000..caaabc67b4b --- /dev/null +++ b/packages/website/docs/components/theming/colors/_forced_colors_warning.mdx @@ -0,0 +1,6 @@ +:::info Colors and accessibility + +Never rely solely on color to convey meaning. Colors can be overridden by [system forced colors](../high_contrast_mode.mdx#forced-contrast-themes-and-colors), or can be difficult to distinguish for different users. +Always combine color context with accompanying [icons](../../display/icons/overview.mdx) or [copy](../../guidelines/writing/guidelines.mdx) to indicate states such as error, activity, etc. + +::: diff --git a/packages/website/docs/components/theming/colors/utilities.mdx b/packages/website/docs/components/theming/colors/utilities.mdx index a88a3b482e6..09c847dd039 100644 --- a/packages/website/docs/components/theming/colors/utilities.mdx +++ b/packages/website/docs/components/theming/colors/utilities.mdx @@ -5,6 +5,10 @@ id: theming_colors_utilities # Color utilities +import ForcedColorsWarning from './_forced_colors_warning.mdx'; + + + ## Background colors To all but ensure proper contrast of text to background, we recommend using our pre-defined shades of background colors based on the **EuiTheme** brand colors. You can also use [**EuiPanel**](/docs/layout/panel) for the same effect plus more options like padding and rounded corners. @@ -54,7 +58,7 @@ import { UseEuiBackgroundColorPreview } from './utilities/use_eui_background_col ``` color: 'transparent' | 'plain' | 'subdued' | 'accent' | 'primary' | 'success' | 'warning' | 'danger'; - method? 'opaque' | 'transparent'; + method?: 'opaque' | 'transparent'; ``` diff --git a/packages/website/docs/components/theming/colors/values.mdx b/packages/website/docs/components/theming/colors/values.mdx index 73ea3c043d4..b0fa503bd23 100644 --- a/packages/website/docs/components/theming/colors/values.mdx +++ b/packages/website/docs/components/theming/colors/values.mdx @@ -9,6 +9,10 @@ Elastic UI builds with a very limited palette. It uses a core set of three color When switching between light and dark color modes, the theme keys do not change, only their values do. This is why most keys are not named for their **evaluated** value but by their **purpose**. +import ForcedColorsWarning from './_forced_colors_warning.mdx'; + + + ## Brand colors Elastic has two main brand colors. The other three are used for statefulness like indicating between successful and dangerous actions. diff --git a/packages/website/src/components/example/example.tsx b/packages/website/src/components/example/example.tsx index aa00eb5d3db..adfc5063cb5 100644 --- a/packages/website/src/components/example/example.tsx +++ b/packages/website/src/components/example/example.tsx @@ -6,7 +6,13 @@ * Side Public License, v 1. */ -import { PropsWithChildren, ReactNode, useMemo, Children, ReactElement } from 'react'; +import { + PropsWithChildren, + ReactNode, + useMemo, + Children, + ReactElement, +} from 'react'; import { css } from '@emotion/react'; import { EuiSplitPanel, @@ -15,6 +21,7 @@ import { useEuiMemoizedStyles, euiFontSize, } from '@elastic/eui'; +import { highContrastModeStyles } from '@elastic/eui/lib/global_styling/functions/high_contrast'; import { isElement } from 'react-is'; export interface ExampleProps extends PropsWithChildren {} @@ -61,7 +68,8 @@ const ExamplePreview = ({ children }: PropsWithChildren) => children; */ export const Example = ({ children }: ExampleProps) => { const styles = useEuiMemoizedStyles(getExampleStyles); - const { euiTheme } = useEuiTheme(); + const euiThemeContext = useEuiTheme(); + const { euiTheme } = euiThemeContext; const { description, snippet, preview } = useMemo(() => { let description: ReactNode; let snippet: ReactNode; @@ -97,17 +105,24 @@ export const Example = ({ children }: ExampleProps) => { {description} - + {preview} .euiCodeBlock { + border: none; + } + `, + })} `} > {snippet} diff --git a/packages/website/src/components/homepage/highlights/index.tsx b/packages/website/src/components/homepage/highlights/index.tsx index e9957110530..c512ec106b9 100644 --- a/packages/website/src/components/homepage/highlights/index.tsx +++ b/packages/website/src/components/homepage/highlights/index.tsx @@ -162,11 +162,9 @@ const getStyles = ({ euiTheme, colorMode }: UseEuiTheme) => ({ } `, card: css` - background-color: transparent; - border: none; - &:hover { box-shadow: none; + filter: none; a { color: ${euiTheme.colors.link}; @@ -256,7 +254,7 @@ export const HomepageHighlights = () => { ) } paddingSize="s" - hasBorder + display="transparent" css={styles.card} >