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

[EuiButtonGroup] Improve interaction states #4142

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
38e121c
Improved EuiButtonGroup focus and selected states when compressed is …
elizabetdev Oct 15, 2020
a9467e6
Fixing amsterdam
elizabetdev Oct 15, 2020
d027e6f
disabled and selected
elizabetdev Oct 15, 2020
40ba2c1
Amsterdam theme
elizabetdev Oct 15, 2020
4c6a8e0
More changes
elizabetdev Oct 15, 2020
242465d
Merge remote-tracking branch 'upstream/master' into EuiButtonGroup-co…
elizabetdev Oct 15, 2020
cb473d7
CL
elizabetdev Oct 15, 2020
464aae1
Merge remote-tracking branch 'upstream/master' into EuiButtonGroup-co…
elizabetdev Oct 19, 2020
dee9a6c
New structure compressed styles
elizabetdev Oct 19, 2020
33ae958
Merge remote-tracking branch 'upstream/master' into EuiButtonGroup-co…
elizabetdev Oct 19, 2020
1846d38
Small details
elizabetdev Oct 19, 2020
d5052f5
Merge remote-tracking branch 'upstream/master' into EuiButtonGroup-co…
elizabetdev Oct 19, 2020
c0a2b25
Highlight bg
elizabetdev Oct 19, 2020
4e71b03
Making all button group states to behave similarly
elizabetdev Oct 20, 2020
a141bd8
Removing unnecessary styles
elizabetdev Oct 20, 2020
085b703
Merge remote-tracking branch 'upstream/master' into EuiButtonGroup-co…
elizabetdev Oct 21, 2020
212203c
CL
elizabetdev Oct 21, 2020
ddd3a4d
Adding comment
elizabetdev Oct 21, 2020
ff7f926
Fixing cl issue
elizabetdev Oct 21, 2020
73ee0d3
Adding comment
elizabetdev Oct 21, 2020
6317558
removing unecessary sass-lint comment
elizabetdev Oct 21, 2020
252de08
More consistent darken and transparentize values
elizabetdev Oct 22, 2020
ec7a2a4
Merge remote-tracking branch 'upstream/master' into EuiButtonGroup-co…
elizabetdev Oct 22, 2020
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
## [`master`](https://github.com/elastic/eui/tree/master)

- Improved `EuiButtonGroup` focus, hover, selected and disabled states ([#4142](https://github.com/elastic/eui/pull/4142))
- Added `display` prop to `EuiToolTip` for common display block needs ([#4148](https://github.com/elastic/eui/pull/4148))

**Bug fixes**
Expand Down
5 changes: 0 additions & 5 deletions src/components/button/button_group/_button_group.scss
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,4 @@
border: 1px solid $euiFormBorderColor;
overflow: visible;
}

.euiButtonGroupButton {
// Add 2 to the border radius to account for the background-clip
border-radius: $euiFormControlCompressedBorderRadius + 2;
}
}
93 changes: 33 additions & 60 deletions src/components/button/button_group/_button_group_button.scss
Original file line number Diff line number Diff line change
Expand Up @@ -45,41 +45,7 @@
color: $euiButtonColorDisabledText;

&.euiButtonGroupButton-isSelected {
// Only increase the contrast of background color to text to 2.0 for disabled
color: makeHighContrastColor($euiButtonColorDisabled, $euiButtonColorDisabled, 2);
}
}
}

.euiButtonGroupButton__textShift {
@include euiTextShift;
}

/**
* Medium and Small sizing (regular button style)
*/

// sass-lint:disable nesting-depth
.euiButtonGroup--medium,
.euiButtonGroup--small {
.euiButtonGroupButton {
border: $euiBorderThin;

&:not(:first-child) {
margin-left: -1px;
}

&:first-child {
border-radius: $euiBorderRadius 0 0 $euiBorderRadius;
}

&:last-child {
border-radius: 0 $euiBorderRadius $euiBorderRadius 0;
}
}

.euiButtonGroupButton-isDisabled {
&.euiButtonGroupButton-isSelected {
background-color: $euiButtonColorDisabled;
border-color: $euiButtonColorDisabled;

Expand All @@ -93,9 +59,10 @@
}

@each $name, $color in $euiButtonTypes {
.euiButtonGroupButton--#{$name}:not([class*='isDisabled']) {
&.euiButtonGroupButton--#{$name}:not([class*='isDisabled']) {
@if ($name == 'ghost') {
// Ghost is unique and ALWAYS sits against a dark background.
// Compressed styles don't support ghost color, it defaults to the text color
color: $color;
} @else if ($name == 'text') {
// The default color is lighter than the normal text color, make the it the text color
Expand All @@ -117,8 +84,10 @@
&:hover,
&:focus,
&:focus-within {
background-color: darken($color, 5%);
border-color: darken($color, 5%);
$darkHighlightBg: darken($color, 5%);

background-color: $darkHighlightBg;
border-color: $darkHighlightBg;
}
}

Expand All @@ -129,6 +98,33 @@
}
}
}
}

.euiButtonGroupButton__textShift {
@include euiTextShift;
}

/**
* Medium and Small sizing (regular button style)
*/

.euiButtonGroup--medium,
.euiButtonGroup--small {
.euiButtonGroupButton {
border: $euiBorderThin;

&:not(:first-child) {
margin-left: -1px;
}

&:first-child {
border-radius: $euiBorderRadius 0 0 $euiBorderRadius;
}

&:last-child {
border-radius: 0 $euiBorderRadius $euiBorderRadius 0;
}
}

// Fix ghost/disabled look specifically
.euiButtonGroupButton.euiButtonGroupButton-isDisabled.euiButtonGroupButton--ghost {
Expand Down Expand Up @@ -180,36 +176,13 @@

&.euiButtonGroupButton-isSelected {
font-weight: $euiFontWeightSemiBold;
background-color: $euiFormInputGroupLabelBackground;
}

&:not([class*='isDisabled']) {
color: $euiColorDarkShade;

&:hover,
&:focus,
&:focus-within {
background-color: transparentize($euiFormInputGroupLabelBackground, .5);
}

&:focus,
&:focus-within {
outline: 2px solid $euiFocusRingColor;
}
}
}

@each $name, $color in $euiButtonTypes {
.euiButtonGroupButton--#{$name}:not([class*='isDisabled']) {
elizabetdev marked this conversation as resolved.
Show resolved Hide resolved
&.euiButtonGroupButton-isSelected {
@if ($name == 'text') {
// The default color is lighter than the normal text color, make the it the text color
color: $euiTextColor;
} @else {
// Other colors need to check their contrast against the page background color.
color: makeHighContrastColor($color, $euiPageBackgroundColor);
}
}
}
}
}
2 changes: 1 addition & 1 deletion src/components/button/button_group/button_group.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ export type EuiButtonGroupProps = CommonProps & {
}
);

type Props = Omit<HTMLAttributes<HTMLFieldSetElement>, 'onChange'> &
type Props = Omit<HTMLAttributes<HTMLFieldSetElement>, 'onChange' | 'color'> &
EuiButtonGroupProps;

const groupSizeToClassNameMap = {
Expand Down