Skip to content
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# [`master`](https://github.com/elastic/eui/tree/master)

- Modifying drop shadow intensities and color. ([607](https://github.com/elastic/eui/pull/607))

**Bug fixes**

- Visual fix for the focus state of disabled `EuiButton` ([603](https://github.com/elastic/eui/pull/603))
Expand Down
4 changes: 3 additions & 1 deletion src-docs/src/components/guide_components.scss
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,9 @@ $guideZLevelHighest: $euiZLevel9 + 1000;
}

.guideDemo__ghostBackground {
background: #444;
@if (lightness($euiTextColor) < 50) {
background: $euiColorDarkestShade;
}
padding: $euiSizeL;
}

Expand Down
1 change: 1 addition & 0 deletions src-docs/src/views/guidelines/colors.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const allowedColors = [
'euiColorDarkShade',
'euiColorDarkestShade',
'euiColorFullShade',
'euiColorSlightHue',
'euiColorPrimary',
'euiColorSecondary',
'euiColorWarning',
Expand Down
30 changes: 22 additions & 8 deletions src/components/button/_button.scss
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,9 @@
}
}

&:hover {
@include euiSlightShadowHover;
}

&:hover,
&:active {
@include euiSlightShadowActive;
@include euiSlightShadowHover;
}

&:enabled {
Expand Down Expand Up @@ -64,7 +61,6 @@

&:hover, &:focus {
@include euiSlightShadow;

text-decoration: none;
}
}
Expand All @@ -90,10 +86,9 @@ $buttonTypes: (
border-color: $color;

$textColor: #FFF;

@if ($name == 'ghost') {
$textColor: #000;
} @elseif (lightness($euiTextColor) > 50) {
} @else if (lightness($euiTextColor) > 50) {
$textColor: $euiTextColor;
}

Expand All @@ -112,13 +107,32 @@ $buttonTypes: (
}

&:enabled {
$shadowColor: $euiShadowColor;
@if ($name == 'ghost') {
$shadowColor: #000;
} @else if (lightness($euiTextColor) < 50) {
// Only if this is the light theme do we use the button variant color to colorize the shadow
$shadowColor: desaturate($color, 60%);
}

@include euiSlightShadow($shadowColor);

&:hover, &:focus {
@include euiSlightShadowHover($shadowColor);
background-color: transparentize($color, .9);

@if ($name == 'disabled') {
cursor: not-allowed;
}
}
}

&:disabled,
&:disabled:hover,
&:disabled:focus {
@if ($name == 'ghost') {
@include euiSlightShadow(#000);
}
}
}
}
2 changes: 1 addition & 1 deletion src/components/button/_index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ $euiButtonColorDisabled: tintOrShade($euiTextColor, 70%, 70%);
animation: euiButtonActive $euiAnimSpeedNormal $euiAnimSlightBounce;
}

&:active {
&:active:not(:disabled) {
transform: translateY(1px);
}
}
Expand Down
1 change: 0 additions & 1 deletion src/components/context_menu/_context_menu_panel.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
.euiContextMenuPanel {
width: 100%;
visibility: visible;
background-color: $euiColorEmptyShade;

&.euiContextMenuPanel-txInLeft {
pointer-events: none;
Expand Down
6 changes: 4 additions & 2 deletions src/components/flyout/_flyout.scss
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
$euiFlyoutBorderColor: tintOrShade($euiShadowColorLarge, 50%, 0%) !default; // match shadow

.euiFlyout {
@include euiBottomShadowLarge;
position: fixed;
top: 0;
bottom: 0;
right: 0;
border-left: $euiBorderThin;
border-left: 1px solid $euiFlyoutBorderColor;
z-index: $euiZModal;
background: $euiColorEmptyShade;
animation: euiFlyout $euiAnimSpeedNormal $euiAnimSlightResistance;
display: flex;
flex-direction: column;
align-items: stretch;
box-shadow: -$euiSizeS $euiSizeXS $euiSizeM 0px rgba(0,0,0,.05);
}

/**
Expand Down
8 changes: 4 additions & 4 deletions src/components/form/_index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@ $euiFormCustomControlDisabledIconColor: shadeOrTint($euiColorMediumShade, 38%, 4

@mixin euiFormControlDefaultShadow {
box-shadow:
0 2px 2px -1px rgba(0, 0, 0, 0.1),
0 2px 2px -1px rgba($euiShadowColor, 0.2),
0 0 0 1px transparentize($euiColorFullShade, .92),
inset #{-$euiFormMaxWidth} 0 0 0 $euiFormBackgroundColor;
}

@mixin euiFormControlInvalidStyle {
box-shadow:
0 $euiSizeXS $euiSizeXS (-$euiSizeXS / 2) rgba(0, 0, 0, 0.1),
0 $euiSizeXS $euiSizeXS (-$euiSizeXS / 2) rgba($euiShadowColor, 0.2),
0 0 0 1px transparentize($euiColorFullShade, .84),
inset 0 0 0 0 $euiColorEmptyShade,
inset 0 (-$euiSizeXS / 2) 0 0 $euiColorDanger;
Expand All @@ -52,7 +52,7 @@ $euiFormCustomControlDisabledIconColor: shadeOrTint($euiColorMediumShade, 38%, 4
@mixin euiFormControlFocusStyle {
background: tintOrShade($euiColorEmptyShade, 0%, 20%);
box-shadow:
0 4px 4px -2px rgba(0, 0, 0, 0.1),
0 4px 4px -2px rgba($euiShadowColor, 0.2),
0 0 0 1px transparentize($euiColorFullShade, .84),
inset 0 0 0 0 tintOrShade($euiColorEmptyShade, 0%, 20%),
inset 0 -2px 0 0 $euiColorPrimary;
Expand Down Expand Up @@ -114,7 +114,7 @@ $euiFormCustomControlDisabledIconColor: shadeOrTint($euiColorMediumShade, 38%, 4

border: 1px solid shadeOrTint($euiColorLightestShade, 18%, 30%);
background: $euiColorEmptyShade no-repeat center;
box-shadow: 0 2px 2px -1px rgba(0, 0, 0, 0.1);
@include euiSlightShadow;

@if $type == 'round' {
border-radius: $size;
Expand Down
1 change: 1 addition & 0 deletions src/components/key_pad_menu/_key_pad_menu.scss
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

&:hover, &:focus {
border-color: $euiBorderColor;
@include euiSlightShadowHover;

.euiKeyPadMenuItem__icon {
transform: translateY(0);
Expand Down
9 changes: 6 additions & 3 deletions src/components/modal/_modal.scss
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
$euiModalBorderColor: tintOrShade($euiShadowColorLarge, 50%, 0%) !default; // match shadow

.euiModal {
@include euiBottomShadow;
@include euiBottomShadowLarge;

display: flex;
flex-direction: column;
max-height: 75vh; // We overflow the modal body based off this
position: relative;
background-color: $euiColorEmptyShade;
border: $euiBorderThin;
border: 1px solid $euiModalBorderColor;
border-top-color: tintOrShade($euiModalBorderColor, 50%, 0%);
border-radius: $euiBorderRadius;
z-index: $euiZModal;
min-width: 50%;
Expand Down Expand Up @@ -91,7 +94,7 @@
bottom: 0;
top: 0;
border-radius: 0;
box-shadow: 0 -8px 16px -8px rgba(0, 0, 0, 0.1);
box-shadow: none;
border: none;
}

Expand Down
11 changes: 7 additions & 4 deletions src/components/panel/_mixins.scss
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
text-align: left;

// transition the shadow
@include euiSlightShadow;
transition: all $euiAnimSpeedFast $euiAnimSlightResistance;

&:hover,
Expand All @@ -37,9 +36,13 @@
}

&.#{$selector}--shadow {
&,
&:hover,
&:focus {
@if (lightness($euiTextColor) < 50) {
border-bottom-color: rgba($euiShadowColor, .6);
}
@include euiBottomShadowMedium;

&.#{$selector}--isClickable:hover,
&.#{$selector}--isClickable:focus {
@include euiBottomShadow;
}
}
Expand Down
4 changes: 3 additions & 1 deletion src/components/panel/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@ $euiPanelPaddingModifiers: (
"paddingSmall": $euiSizeS,
"paddingMedium": $euiSize,
"paddingLarge": $euiSizeL
) !default;
) !default;

$euiPanelBorderColor: tintOrShade($euiShadowColor, 40%, 0%) !default; // match shadow
3 changes: 2 additions & 1 deletion src/components/steps/_steps_horizontal.scss
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@
@include createStepsNumber;
position: relative; /* 2 */
z-index: $euiZLevel1; /* 2 */
transition: all $euiAnimSpeedFast ease-in-out;

// if it contains an icon, it needs to shift up a couple px
> .euiIcon {
Expand Down Expand Up @@ -121,7 +122,7 @@
// Selected state
.euiStepHorizontal-isSelected {
.euiStepHorizontal__number {
@include euiBottomShadowMedium;
@include euiSlightShadow(desaturate($euiColorPrimary, 20%));
}

&::before {
Expand Down
5 changes: 4 additions & 1 deletion src/components/toast/_toast.scss
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
.euiToast {
@include euiBottomShadow;
@include euiBottomShadowLarge;

position: relative;
padding: $euiSize;
background-color: $euiColorEmptyShade;
border: $euiBorderThin;
@if (lightness($euiTextColor) < 50) {
border-bottom-color: rgba($euiShadowColor, .6);
}
width: 100%;

&:hover .euiToast__closeButton,
Expand Down
46 changes: 34 additions & 12 deletions src/global_styling/mixins/_shadow.scss
Original file line number Diff line number Diff line change
@@ -1,28 +1,50 @@
@mixin euiBottomShadow {
box-shadow: 0 16px 16px -8px rgba(0, 0, 0, 0.1);
$euiShadowColor: $euiColorMediumShade !default;
$euiShadowColorLarge: $euiColorSlightHue !default;


@mixin euiSlightShadow($color: $euiShadowColor, $opacity: .3) {
box-shadow: 0 2px 2px -1px rgba($color, $opacity);
}

@mixin euiBottomShadowSmall {
box-shadow: 0 2px 2px -1px rgba(0, 0, 0, 0.1);
@mixin euiBottomShadowSmall($color: $euiShadowColor, $opacity: .3) {
box-shadow:
0 2px 2px -1px rgba($color, $opacity),
0 1px 5px -2px rgba($color, $opacity);
}

@mixin euiBottomShadowMedium {
box-shadow: 0 4px 4px -2px rgba(0, 0, 0, 0.2);
@mixin euiBottomShadowMedium($color: $euiShadowColor, $opacity: .2) {
box-shadow:
0 6px 12px -1px rgba($color, $opacity),
0 4px 4px -1px rgba($color, $opacity),
0 2px 2px 0 rgba($color, $opacity);
}

@mixin euiSlightShadow {
@mixin euiBottomShadow($color: $euiShadowColor, $opacity: .2) {
box-shadow:
0 2px 2px -1px rgba(0, 0, 0, 0.15),
0 12px 24px 0 rgba($color, $opacity),
0 6px 12px 0 rgba($color, $opacity),
0 4px 4px 0 rgba($color, $opacity),
0 2px 2px 0 rgba($color, $opacity);
}

@mixin euiSlightShadowHover {
@mixin euiBottomShadowLarge($color: $euiShadowColorLarge, $opacity: .2) {
box-shadow:
0 4px 4px -2px rgba(0, 0, 0, 0.1),
0 64px 64px 0 rgba($color, $opacity),
0 32px 32px 0 rgba($color, $opacity),
0 16px 16px 0 rgba($color, $opacity),
0 8px 8px 0 rgba($color, $opacity),
0 4px 4px 0 rgba($color, $opacity),
0 2px 2px 0 rgba($color, $opacity);
}

@mixin euiSlightShadowActive {
@mixin euiSlightShadowHover($color: $euiShadowColor, $opacity: .3) {
box-shadow:
0 1px 1px 0px rgba(0, 0, 0, 0.2),
0 4px 8px 0px rgba($color, $opacity/2),
0 2px 2px -1px rgba($color, $opacity);
}

@mixin euiSlightShadowActive($color: $euiShadowColor, $opacity: .3) {
@include euiSlightShadowHover($color, $opacity);
}

@mixin euiOverflowShadowTop {
Expand Down
1 change: 1 addition & 0 deletions src/global_styling/variables/_colors.scss
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ $euiColorMediumShade: #999 !default;
$euiColorDarkShade: #666 !default;
$euiColorDarkestShade: #3F3F3F !default;
$euiColorFullShade: #000 !default;
$euiColorSlightHue: #909AA1 !default;

// Every color below must be based mathmatically on the set above.

Expand Down
5 changes: 5 additions & 0 deletions src/themes/eui/eui_colors_dark.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,17 @@ $euiColorMediumShade: #444;
$euiColorDarkShade: #D9D9D9;
$euiColorDarkestShade: #F5F5F5;
$euiColorFullShade: #FFF;
$euiColorSlightHue: #494E51;
$euiColorPrimary: #4da1c0;
$euiColorWarning: #e45c29;
$euiColorDanger: #bf4d4d;
$euiTextColor: #DDD;

$euiFocusBackgroundColor: #191919;
$euiShadowColor: #000;
$euiShadowColorLarge: #000;
$euiModalBorderColor: $euiColorLightShade;
$euiFlyoutBorderColor: $euiColorLightShade;

// Code

Expand Down
4 changes: 4 additions & 0 deletions src/themes/k6/k6_colors_dark.scss
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ $euiColorDanger: #bf4d4d;
$euiTextColor: #DDD;

$euiFocusBackgroundColor: #191919;
$euiShadowColor: #000;
$euiShadowColorLarge: #000;
$euiModalBorderColor: $euiColorLightShade;
$euiFlyoutBorderColor: $euiColorLightShade;

// Code

Expand Down