-
Notifications
You must be signed in to change notification settings - Fork 841
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
New Radio & Checkbox styles #407
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
f1da9af
New sizing and states for checkboxes and radios
10acde6
Adjusting switch’s size to be a bit smaller and using same coloring a…
ce7941a
Darker icon for disabled
ad31bc3
Updated range slider to match custom input styles
ea5392c
Fixed background of disabled switch
b93dc36
Adjusting for dark color scheme
5938cd2
Removed extra element and added indeterminate styles
cd13b30
Forgot to swap out generic label selector for specific class
68ce007
Fixing data-uri svg coloring - needs to be RGB values in FF
85f489b
Addressing PR comments
d6a39b9
changelog
79c55a0
Merge branch 'master' into new-radio-checkboxes
cchaos File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,12 @@ | ||
.euiScreenReaderOnly { | ||
@mixin euiScreenReaderOnly() { | ||
position: absolute; | ||
left: -10000px; | ||
top: auto; | ||
width: 1px; | ||
height: 1px; | ||
overflow: hidden; | ||
} | ||
|
||
.euiScreenReaderOnly { | ||
@include euiScreenReaderOnly; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
$euiFormMaxWidth: 400px; | ||
$euiFormBackgroundColor: tintOrShade($euiColorLightestShade, 60%, 25%); | ||
$euiFormCustomControlDisabledIconColor: shadeOrTint($euiColorMediumShade, 38%, 48.5%); // exact 508c foreground for $euiColorLightShade | ||
|
||
@mixin euiFormControlSize { | ||
max-width: $euiFormMaxWidth; | ||
|
@@ -87,6 +88,48 @@ $euiFormBackgroundColor: tintOrShade($euiColorLightestShade, 60%, 25%); | |
} | ||
} | ||
|
||
// CUSTOM STYLES & STATES | ||
@mixin euiCustomControl($type: null, $size: $euiSize){ | ||
|
||
@if $size { | ||
$size: $size - 2px; // subtract 2px from size to account for border size | ||
padding: $size/2; | ||
} | ||
|
||
border: 1px solid shadeOrTint($euiColorLightestShade, 18%, 30%); | ||
background: $euiColorEmptyShade no-repeat center; | ||
box-shadow: 0 2px 2px -1px rgba(0, 0, 0, 0.1); | ||
|
||
@if $type == 'round' { | ||
border-radius: $size; | ||
} @else if $type == 'square' { | ||
border-radius: $euiBorderRadius; | ||
} | ||
|
||
transition: background-color $euiAnimSpeedFast ease-in, | ||
border-color $euiAnimSpeedFast ease-in, | ||
background-image 0s ease-out $euiAnimSpeedFast; | ||
} | ||
|
||
@mixin euiCustomControl--selected($type: null){ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. TY for cleaning this up. |
||
border-color: $euiColorPrimary; | ||
background-color: $euiColorPrimary; | ||
@include euiIconBackground($type, $euiColorEmptyShade); | ||
} | ||
|
||
@mixin euiCustomControl--disabled($type: null){ | ||
border-color: $euiColorLightShade; | ||
background-color: $euiColorLightShade; | ||
@include euiIconBackground($type, $euiFormCustomControlDisabledIconColor); | ||
box-shadow: none; | ||
} | ||
|
||
@mixin euiCustomControl--focused(){ | ||
border-color: $euiColorPrimary; | ||
@include euiFocusRing; | ||
} | ||
|
||
|
||
@import 'checkbox/index'; | ||
@import 'field_number/index'; | ||
@import 'field_password/index'; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,96 +1,93 @@ | ||
.euiCheckbox { | ||
position: relative; | ||
min-height: $euiSizeL; | ||
|
||
/** | ||
* 1. Float above the visual checkbox and match its dimension, so that when users try to click it | ||
* they actually click this input. | ||
*/ | ||
.euiCheckbox__input { | ||
position: absolute; /* 1 */ | ||
opacity: 0; /* 1 */ | ||
height: $euiSizeL; /* 1 */ | ||
width: $euiSizeL; /* 1 */ | ||
z-index: 1; /* 1 */ | ||
margin: 0; /* 1 */ | ||
cursor: pointer; | ||
@include euiScreenReaderOnly; | ||
|
||
&:checked ~ .euiCheckbox__square { | ||
background: $euiColorPrimary; | ||
border-color: $euiColorPrimary; | ||
|
||
.euiCheckbox__check { | ||
border-color: $euiColorPrimary; | ||
background-color: $euiColorEmptyShade; | ||
// This path is relative to ~/src-docs/postcss.config.js, which uses | ||
// the postcss-line-svg plugin. | ||
mask: svg-load('../src/components/icon/assets/check.svg') center center no-repeat; | ||
} | ||
~ .euiCheckbox__label { | ||
display: block; | ||
padding-left: ($euiCheckBoxSize * 1.5); | ||
line-height: $euiSizeL; | ||
font-size: $euiFontSizeS; | ||
position: relative; | ||
z-index: 2; | ||
cursor: pointer; | ||
} | ||
|
||
&:focus ~ .euiCheckbox__square, | ||
&:active:not(:disabled) ~ .euiCheckbox__square { | ||
box-shadow: 0 4px 4px -2px rgba(0, 0, 0, 0.1); | ||
border-color: $euiColorPrimary; | ||
border-width: $euiSizeXS / 2; | ||
+ .euiCheckbox__square { | ||
display: inline-block; | ||
position: absolute; | ||
left: 0; | ||
top: ($euiSizeL - $euiCheckBoxSize)/2; | ||
@include euiCustomControl($type: 'square', $size: $euiCheckBoxSize); | ||
} | ||
|
||
&:focus:checked ~.euiCheckbox__square { | ||
border-color: darken($euiColorPrimary, 10%); | ||
&:checked { | ||
+ .euiCheckbox__square { | ||
@include euiCustomControl--selected($type: 'check'); | ||
} | ||
} | ||
|
||
&:disabled, | ||
&:disabled ~ .euiCheckbox__label { | ||
cursor: not-allowed; | ||
&:indeterminate { | ||
+ .euiCheckbox__square { | ||
@include euiCustomControl--selected($type: 'dot'); | ||
} | ||
} | ||
|
||
&:disabled:checked ~ .euiCheckbox__square { | ||
background-color: $euiColorLightShade; | ||
border-color: $euiColorLightShade; | ||
} | ||
&[disabled] { | ||
cursor: not-allowed !important; | ||
|
||
&:disabled:not(:checked) ~ .euiCheckbox__square { | ||
background-color: $euiColorLightestShade; | ||
~ .euiCheckbox__label { | ||
color: $euiColorDarkShade; | ||
cursor: not-allowed !important; | ||
} | ||
|
||
+ .euiCheckbox__square { | ||
@include euiCustomControl--disabled(); | ||
} | ||
} | ||
} | ||
|
||
.euiCheckbox__square { | ||
position: absolute; | ||
height: $euiSizeL; | ||
width: $euiSizeL; | ||
border-radius: $euiBorderRadius; | ||
border: $euiBorderThin; | ||
background: $euiFormBackgroundColor; | ||
z-index: 0; | ||
box-shadow: 0 2px 2px -1px rgba(0, 0, 0, 0.1); | ||
} | ||
&:checked[disabled] { | ||
+ .euiCheckbox__square { | ||
@include euiCustomControl--disabled($type: 'check'); | ||
} | ||
} | ||
|
||
.euiCheckbox__check { | ||
height: 100%; | ||
width: 100%; | ||
&:indeterminate[disabled] { | ||
+ .euiCheckbox__square { | ||
@include euiCustomControl--disabled($type: 'dot'); | ||
} | ||
} | ||
|
||
.euiCheckbox__label { | ||
padding-left: $euiSizeXL; | ||
line-height: $euiSizeL; | ||
display: block; | ||
font-weight: $euiFontWeightRegular; | ||
z-index: 2; | ||
font-size: $euiFontSizeS; | ||
cursor: pointer; | ||
&:focus, | ||
&:active:not(:disabled) { | ||
+ .euiCheckbox__square { | ||
@include euiCustomControl--focused; | ||
} | ||
} | ||
} | ||
|
||
/** | ||
* 1. Float above the visual radio and match its dimension, so that when users try to click it | ||
* they actually click this input. | ||
*/ | ||
|
||
&.euiCheckbox--inList { | ||
min-height: $euiSize; | ||
min-height: $euiCheckBoxSize; | ||
min-width: $euiCheckBoxSize; | ||
|
||
.euiCheckbox__square { | ||
height: $euiSize; | ||
width: $euiSize; | ||
top: 0; | ||
} | ||
|
||
.euiCheckbox__input { | ||
height: $euiSize; | ||
width: $euiSize; | ||
position: absolute; /* 1 */ | ||
opacity: 0; /* 1 */ | ||
@include size($euiCheckBoxSize); /* 1 */ | ||
z-index: 1; /* 1 */ | ||
margin: 0; /* 1 */ | ||
left: 0; /* 1 */ | ||
cursor: pointer; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
$euiCheckBoxSize: $euiSize; | ||
|
||
@import 'checkbox'; | ||
@import 'checkbox_group'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍