Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Visual Refresh] Fix computed border token mapping #8170

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions packages/eui-theme-borealis/src/variables/_borders.scss

This file was deleted.

1 change: 0 additions & 1 deletion packages/eui-theme-borealis/src/variables/_index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
@import 'states';

@import './colors/colors_vis';
@import 'borders';
@import 'form';
@import 'page';
@import 'font_weight';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
$euiBorderWidthThin: 1px !default;
$euiBorderWidthThick: 2px !default;

$euiBorderColor: $euiColorLightShade !default;
$euiBorderColor: $euiColorBorderBaseSubdued !default;
$euiBorderRadius: $euiSizeS * .75 !default;
$euiBorderRadiusSmall: $euiSizeS * .5 !default;
$euiBorderThick: $euiBorderWidthThick solid $euiBorderColor !default;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,14 @@ exports[`useEuiBorderColorCSS hook returns an object of Emotion border-color pro

exports[`useEuiBorderColorCSS hook returns an object of Emotion border-color properties for each color: danger 1`] = `"border-color:#e5a9a5;label:danger;"`;

exports[`useEuiBorderColorCSS hook returns an object of Emotion border-color properties for each color: plain 1`] = `"border-color:color:#D3DAE6;width{thin:1px;thick:2px;}radius{medium:NaNpx;small:NaNpx;}thin:1px solid [object Object];thick:2px solid [object Object];editable:2px dotted [object Object];;label:plain;"`;
exports[`useEuiBorderColorCSS hook returns an object of Emotion border-color properties for each color: plain 1`] = `"border-color:#D3DAE6;label:plain;"`;

exports[`useEuiBorderColorCSS hook returns an object of Emotion border-color properties for each color: primary 1`] = `"border-color:#99c9eb;label:primary;"`;

exports[`useEuiBorderColorCSS hook returns an object of Emotion border-color properties for each color: subdued 1`] = `"border-color:color:#D3DAE6;width{thin:1px;thick:2px;}radius{medium:NaNpx;small:NaNpx;}thin:1px solid [object Object];thick:2px solid [object Object];editable:2px dotted [object Object];;label:subdued;"`;
exports[`useEuiBorderColorCSS hook returns an object of Emotion border-color properties for each color: subdued 1`] = `"border-color:#D3DAE6;label:subdued;"`;

exports[`useEuiBorderColorCSS hook returns an object of Emotion border-color properties for each color: success 1`] = `"border-color:#99e5e1;label:success;"`;

exports[`useEuiBorderColorCSS hook returns an object of Emotion border-color properties for each color: transparent 1`] = `"border-color:;label:transparent;"`;
exports[`useEuiBorderColorCSS hook returns an object of Emotion border-color properties for each color: transparent 1`] = `"border-color:#D3DAE6;label:transparent;"`;

exports[`useEuiBorderColorCSS hook returns an object of Emotion border-color properties for each color: warning 1`] = `"border-color:#fedc72;label:warning;"`;
10 changes: 7 additions & 3 deletions packages/eui/src/global_styling/mixins/_color.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ export const euiBorderColor = (
return euiTheme.border.color;
default: {
const tokenName = getTokenName(
'borderStrong',
'borderBase',
color
) as keyof _EuiThemeBorderColors;

Expand All @@ -171,12 +171,16 @@ const _euiBorderColors = (euiThemeContext: UseEuiTheme) =>
const borderToken = getTokenName(
'borderBase',
color
) as keyof _EuiThemeBackgroundColors;
) as keyof _EuiThemeBorderColors;
const borderColor =
color === 'transparent'
? euiThemeContext.euiTheme.border.color
: euiThemeContext.euiTheme.colors[borderToken];

return {
...acc,
[color]: css`
border-color: ${euiThemeContext.euiTheme.colors[borderToken]};
border-color: ${borderColor};
label: ${color};
`,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ import { sizeToPixel } from '../../../../global_styling/functions';
import { computed } from '../../../../services/theme/utils';

export const border: _EuiThemeBorder = {
color: computed(([lightShade]) => lightShade, ['colors.lightShade']),
color: computed(
([borderBaseSubdued]) => borderBaseSubdued,
['colors.borderBaseSubdued']
),
width: {
thin: '1px',
thick: '2px',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -276,12 +276,18 @@ export const border_colors: _EuiThemeBorderColors = {
['colors.danger']
),

borderBaseSubdued: computed(([color]) => color, ['border.color']),
borderBaseSubdued: computed(
([lightShade]) => lightShade,
['colors.lightShade']
),
borderBaseDisabled: computed(
([lightShade]) => transparentize(darken(lightShade, 0.4), 0.1),
['colors.lightShade']
),
borderBasePlain: computed(([color]) => color, ['border.color']),
borderBasePlain: computed(
([lightShade]) => lightShade,
['colors.lightShade']
),
borderBaseFloating: 'transparent',

borderBaseFormsColorSwatch: computed(
Expand Down Expand Up @@ -486,12 +492,18 @@ export const dark_border_colors: _EuiThemeBorderColors = {
['colors.danger']
),

borderBaseSubdued: computed(([color]) => color, ['border.color']),
borderBaseSubdued: computed(
([lightShade]) => lightShade,
['colors.lightShade']
),
borderBaseDisabled: computed(
([ghost]) => transparentize(ghost, 0.1),
['colors.ghost']
),
borderBasePlain: computed(([color]) => color, ['border.color']),
borderBasePlain: computed(
([lightShade]) => lightShade,
['colors.lightShade']
),
borderBaseFloating: 'transparent',

borderBaseFormsColorSwatch: computed(
Expand Down
Loading