Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
a8adb74
[EuiPanel] Show drop-shadow on all high contrast modes for clickable …
cee-chen Dec 12, 2024
e0df7d4
[EuiSplitPanel] Render dividing border between inner panels
cee-chen Dec 12, 2024
527cd87
[EuiPanel] Avoid rendering borders for transparent panels that are ju…
cee-chen Dec 13, 2024
933edcd
[EuiEmptyPrompt] Update high contrast border behavior
cee-chen Dec 13, 2024
80f242c
[EuiFlyout] Improve high contrast borders
cee-chen Dec 13, 2024
f8689e6
[EuiErrorBoundary] Improve high contrast rendering
cee-chen Dec 13, 2024
98db0f8
[EuiImage] Grab missed high contrast shadows
cee-chen Dec 13, 2024
793d7f2
[EuiCodeBlock] Fix border/margin interaction with EuiText
cee-chen Dec 12, 2024
0e626e7
[EuiCodeBlock] Minor Windows high contrast mode fix
cee-chen Dec 13, 2024
5772135
[src-docs] Remove duplicate borders around demo code/snippets
cee-chen Dec 13, 2024
bbc40fd
[src-docs] Remove unnecessary extra border/wrappers on props tables
cee-chen Dec 12, 2024
46bba4f
[src-docs] Remove unnecessary min-height causing duplicate borders in…
cee-chen Dec 12, 2024
d9c5543
[src-docs] Reduce duplicate playground borders further
cee-chen Dec 12, 2024
05fa8fc
[src-docs] Clean up more borders in Theming section
cee-chen Dec 13, 2024
b322232
[eui+ docs] Fix duplicate code block borders and border-radius overflows
cee-chen Dec 13, 2024
b4247f2
[eui+ docs] Fix theme borders not inheriting from contrast-aware bord…
cee-chen Dec 13, 2024
d229c3d
[eui+ docs] clean up some card shenanigans on homepage
cee-chen Dec 13, 2024
9e1545c
[docs] Remove duplicate borders on button cards
cee-chen Dec 13, 2024
430fc4f
[docs] Update Borders page noting high contrast override
cee-chen Dec 13, 2024
3ae8cf0
[docs] Add forced colors warning to Colors page
cee-chen Dec 13, 2024
ec095b4
[eui+] Make writing guidelines URL less repetitive
cee-chen Dec 13, 2024
9f031ff
[Shadow utils] Update docs and improve options API
cee-chen Dec 13, 2024
015e001
werd
cee-chen Dec 13, 2024
55b107c
yeet
cee-chen Dec 13, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/docusaurus-theme/src/components/demo/demo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
50 changes: 33 additions & 17 deletions packages/docusaurus-theme/src/components/guideline/guideline.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions packages/eui/changelogs/upcoming/8234.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- `useEuiShadow()` now accepts a second `options` argument
- `useEuiShadowFlat()` now accepts an `options` object instead of only a color
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -46,6 +50,8 @@ export const GuideSectionExampleCode: FunctionComponent<
</CodeSandboxLink>
) : undefined;

const { highContrastMode } = useEuiTheme();

return (
<>
<EuiCodeBlock
Expand All @@ -56,9 +62,12 @@ export const GuideSectionExampleCode: FunctionComponent<
}
overflowHeight={400}
isCopyable
// Code block is used within a panel which already has a border - skip doubling up
{...(highContrastMode && { css: { border: 'none' } })}
>
{codeToRender}
</EuiCodeBlock>
{highContrastMode && <EuiHorizontalRule margin="none" />}
{codeSandboxLink}
</>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -27,6 +27,8 @@ export const GuideSectionExample: FunctionComponent<GuideSectionExample> = ({
guideDemo__ghostBackground: ghostBackground,
});

const { highContrastMode } = useEuiTheme();

return (
<EuiSplitPanel.Outer hasBorder hasShadow={false} data-eui-docs-example>
<EuiSplitPanel.Inner
Expand All @@ -36,15 +38,17 @@ export const GuideSectionExample: FunctionComponent<GuideSectionExample> = ({
>
{example}
</EuiSplitPanel.Inner>
{exampleToggles && !highContrastMode && (
<EuiHorizontalRule margin="none" />
)}
{exampleToggles && (
<>
<EuiHorizontalRule margin="none" />
<EuiSplitPanel.Inner paddingSize="m" color="subdued">
{exampleToggles}
</EuiSplitPanel.Inner>
</>
<EuiSplitPanel.Inner paddingSize="m" color="subdued">
{exampleToggles}
</EuiSplitPanel.Inner>
)}
{exampleToggles && tabs && !highContrastMode && (
<EuiHorizontalRule margin="none" />
)}
{exampleToggles && tabs && <EuiHorizontalRule margin="none" />}
{(tabs || tabContent) && (
<EuiSplitPanel.Inner paddingSize="none" color="subdued">
{tabs}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,23 +63,25 @@ export const GuideSectionPropsDescription: FunctionComponent<

return (
<>
<div className={classNames('guideSection__propsTableIntro', className)}>
<EuiFlexGroup alignItems="baseline" wrap>
<EuiFlexItem grow={false}>
<EuiTitle size="s">
<h3 id={componentName}>{componentName}</h3>
</EuiTitle>
<EuiFlexGroup
className={classNames('guideSection__propsTableIntro', className)}
alignItems="baseline"
wrap
>
<EuiFlexItem grow={false}>
<EuiTitle size="s">
<h3 id={componentName}>{componentName}</h3>
</EuiTitle>
</EuiFlexItem>
{extendedTypesElements.length > 0 && (
<EuiFlexItem>
<EuiText size="s">
<p>[ extends {extendedTypesElements} ]</p>
</EuiText>
</EuiFlexItem>
{extendedTypesElements.length > 0 && (
<EuiFlexItem>
<EuiText size="s">
<p>[ extends {extendedTypesElements} ]</p>
</EuiText>
</EuiFlexItem>
)}
</EuiFlexGroup>
{descriptionElement}
</div>
)}
</EuiFlexGroup>
{descriptionElement}
</>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export const GuideSectionPropsTable: FunctionComponent<
const { props } = docgenInfo;

return (
<div>
<>
{componentName && (
<GuideSectionPropsDescription
componentName={componentName}
Expand All @@ -38,7 +38,7 @@ export const GuideSectionPropsTable: FunctionComponent<
scope: component,
}}
/>
</div>
</>
);
};

Expand Down
Original file line number Diff line number Diff line change
@@ -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[];
Expand All @@ -9,20 +13,29 @@ export type GuideSectionSnippets = {
export const GuideSectionSnippets: FunctionComponent<GuideSectionSnippets> = ({
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 = (
<EuiCodeBlock language="jsx" fontSize="m" paddingSize="m" isCopyable>
{snippets}
</EuiCodeBlock>
);
snippetCode = <EuiCodeBlock {...codeBlockProps}>{snippets}</EuiCodeBlock>;
} else {
snippetCode = snippets.map((snip, index) => (
<React.Fragment key={`snippet${index}`}>
<EuiCodeBlock language="jsx" fontSize="m" paddingSize="m" isCopyable>
{snip}
</EuiCodeBlock>
{index < snippets.length - 1 && <EuiSpacer size="xs" />}
<EuiCodeBlock {...codeBlockProps}>{snip}</EuiCodeBlock>
{index < snippets.length - 1 &&
(highContrastMode ? (
<EuiHorizontalRule margin="xs" />
) : (
<EuiSpacer size="xs" />
))}
</React.Fragment>
));
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
@import './playground_compiler';
@import './playground_knobs';
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@
flex-shrink: 0;
}

.playground__tableWrapper {
background-color: $euiPageBackgroundColor;
}

.playground__title {
padding: $euiSizeS $euiSize;
}

This file was deleted.

13 changes: 4 additions & 9 deletions packages/eui/src-docs/src/services/playground/knobs.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, { useState, useEffect } from 'react';
import { assertUnreachable, PropTypes } from 'react-view';
import {
useEuiTheme,
useIsWithinBreakpoints,
EuiTitle,
EuiCodeBlock,
Expand All @@ -22,7 +23,6 @@ import {
EuiTextArea,
EuiFormRow,
EuiText,
EuiPanel,
EuiMarkdownFormat,
} from '../../../../src';
import {
Expand Down Expand Up @@ -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 ? (
<Knob
Expand Down Expand Up @@ -511,6 +510,7 @@ const KnobColumn = ({ state, knobNames, error, set, isPlayground }) => {
};

const Knobs = ({ state, set, error, isPlayground = true }) => {
const { euiTheme } = useEuiTheme();
const isMobile = useIsWithinBreakpoints(['xs', 's']);
const knobNames = Object.keys(state);

Expand All @@ -532,12 +532,7 @@ const Knobs = ({ state, set, error, isPlayground = true }) => {
});

return (
<EuiPanel
color="transparent"
paddingSize={isMobile ? 's' : 'none'}
hasBorder={false}
hasShadow={false}
>
<div style={isMobile ? { padding: euiTheme.size.s } : undefined}>
<EuiTable style={{ background: 'transparent' }}>
<EuiTableHeader>
{columns.map(({ name, width }, id) => {
Expand All @@ -559,7 +554,7 @@ const Knobs = ({ state, set, error, isPlayground = true }) => {
/>
</EuiTableBody>
</EuiTable>
</EuiPanel>
</div>
);
};

Expand Down
Loading