-
Notifications
You must be signed in to change notification settings - Fork 26
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
feat(checkbox): update component specs #846
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -80,9 +80,12 @@ hx-checkbox-control { | |
|
||
// ========== PRISTINE ========== | ||
hx-checkbox { | ||
background-color: $gray-0; | ||
background-color: var(--hxCheckbox-bgcolor, $gray-0); | ||
border-radius: 2px; | ||
border: 1px solid var(--hxCheckbox-border, $gray-500); | ||
border-color: $gray-500; | ||
border-color: var(--hxCheckbox-border, $gray-500); | ||
border-style: solid; | ||
border-width: 1px; | ||
} | ||
|
||
hx-checkbox-control { | ||
|
@@ -125,17 +128,22 @@ hx-checkbox-control { | |
|
||
&:checked, | ||
&:indeterminate { | ||
color: $blue-700; | ||
color: var(--hxCheckbox-indeterminate-color, $blue-700); | ||
|
||
~ label > hx-checkbox { | ||
background-color: $blue-700; | ||
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. @100stacks so i'm just asking in order to gain knowledge. I see we sometimes duplicate properties. So in this case we have the color variable here, and then the next line we have the same property, but with the CSS variable. This is required for browser compatibility and fallback, correct? So if the browser doesn't support CSS variables, then it will at least have the usual color var, correct? 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. @ssalinas24, yes that's correct. We're using duplicate properties for IE11 support fallback. It's cleaner and simpler than using a library to provide polyfills for IE11 CSS variables/custom property support. |
||
background-color: var(--hxCheckbox-indeterminate-label-bgcolor, $blue-700); | ||
border-color: $blue-700; | ||
border-color: var(--hxCheckbox-indeterminate-label-bordercolor, $blue-700); | ||
color: var(--hxCheckbox-indeterminate-label-color, $blue-700); | ||
color: $gray-0; | ||
color: var(--hxCheckbox-indeterminate-label-color, $gray-0); | ||
} | ||
} | ||
|
||
&:valid { | ||
~ label > hx-checkbox:hover { | ||
@include hxCheckboxFacade($pseudo-state: hover); | ||
@include hxCheckboxFacade($pseudo-state: null); // v2.0 specs | ||
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. we didn't still need the hover here? I guess because hover technically is supposed to look the same as the checked state, correct? 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. Yes, we need clarification from design on 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. @danielmdesigns, can you please provide design recommendations for 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. @ssalinas24, I'm leaving the hover state construct in place for now. |
||
} | ||
} | ||
} | ||
|
@@ -165,6 +173,20 @@ hx-checkbox-control.hxInvalid > input[type="checkbox"]:enabled { | |
@include hxCheckboxFacade(invalid, hover); | ||
} | ||
} | ||
|
||
// v2.0 specs | ||
&:checked, | ||
&:indeterminate { | ||
color: $red-status-500; | ||
color: var(--hxCheckbox-invalid-checked-color, $red-status-500); | ||
|
||
~ label > hx-checkbox { | ||
background-color: $red-status-100; | ||
background-color: var(--hxCheckbox-invalid-checked-bgcolor, $red-status-100); | ||
border-color: $red-status-500; | ||
border-color: var(--hxCheckbox-invalid-checked-label-bordercolor, $red-status-500); | ||
} | ||
} | ||
} | ||
|
||
// ========== DISABLED ========== | ||
|
@@ -184,6 +206,7 @@ hx-checkbox-control > input[type="checkbox"]:disabled { | |
} | ||
|
||
~ label { | ||
color: $gray-600; | ||
color: var(--hxCheckbox-disabled-label-color, $gray-600); | ||
|
||
> hx-checkbox { | ||
|
@@ -197,6 +220,19 @@ hx-checkbox-control > input[type="checkbox"]:disabled { | |
} | ||
} | ||
|
||
// v2.0 specs | ||
hx-checkbox-control > input[type="checkbox"]:indeterminate:disabled, | ||
hx-checkbox-control > input[type="checkbox"]:checked:disabled { | ||
~ label > hx-checkbox { | ||
background-color: $gray-500; | ||
background-color: var(--hxCheckbox-disabled-checked-label-bgcolor, $gray-500); | ||
border-color: $gray-500; | ||
border-color: var(--hxCheckbox-disabled-checked-label-bordercolor, $gray-500); | ||
color: $gray-0; | ||
color: var(--hxCheckbox-disabled-checked-label-color, $gray-0); | ||
} | ||
} | ||
|
||
// ----- Modern Browsers ----- | ||
@supports (--modern: true) { | ||
hx-checkbox-control { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,33 @@ | ||
// | ||
// ===== Mixins for <hx-checkbox-control> states ===== | ||
// | ||
// =================================================== // | ||
// ===== Mixins for <hx-checkbox-control> states ===== // | ||
// =================================================== // | ||
|
||
// ========== PRISTINE ========== | ||
@mixin __checkboxControl($pseudo-state: null) { | ||
@if $pseudo-state == focus { | ||
box-shadow: $focus-glow; | ||
|
||
&::-ms-check { | ||
border-color: $blue-700; | ||
border-color: var(--hxCheckbox-focus-bordercolor, $blue-700); | ||
} | ||
} | ||
@else if $pseudo-state == hover { | ||
color: $blue-700; | ||
color: var(--hxCheckbox-hover-color, $blue-700); | ||
|
||
&::-ms-check { | ||
background-color: var(--hxCheckbox-hover-bgcolor, $gray-0); | ||
color: var(--hxCheckbox-hover-ie-color, $blue-700); | ||
background-color: $gray-0; | ||
border-color: $blue-700; | ||
color: $blue-700; | ||
} | ||
} | ||
@else { | ||
color: $gray-500; | ||
color: var(--hxCheckbox-color, $gray-500); | ||
|
||
&::-ms-check { | ||
background-color: $gray-0; | ||
background-color: var(--hxCheckbox-bgcolor, $gray-0); | ||
border-color: currentColor; | ||
border-style: solid; | ||
|
@@ -38,21 +43,24 @@ | |
box-shadow: $focus-glow-invalid; | ||
|
||
&::-ms-check { | ||
border-color: var(--hxCheckbox-invalid-bordercolor, $red-status-900); | ||
border-color: $red-status-500; | ||
border-color: var(--hxCheckbox-invalid-bordercolor, $red-status-500); | ||
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. similar setup here. Let me know if this is correct, and I'm just wrong in my prior comment in first file. 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. That's right. This is our pattern to support IE11 fallbacks. |
||
} | ||
} | ||
@else if $pseudo-state == hover { | ||
&::-ms-check { | ||
background-color: var(--hxCheckbox-invalid-hover-bgcolor, $red-status-100); | ||
// v2.0 specs | ||
} | ||
} | ||
@else { | ||
color: var(--hxCheckbox-invalid-color, $red-status-900); | ||
color: $red-status-500; | ||
color: var(--hxCheckbox-invalid-color, $red-status-500); | ||
background-color: $red-status-100; | ||
|
||
&::-ms-check { | ||
border-width: 1px; | ||
border-color: $red-status-900 !important; | ||
color: $red-status-900 !important; | ||
border-color: $red-status-500 !important; | ||
color: $red-status-500 !important; | ||
} | ||
} | ||
} | ||
|
@@ -61,24 +69,26 @@ | |
@mixin __checkboxControl--disabled($pseudo-state: null) { | ||
@if $pseudo-state == focus { | ||
&::-ms-check { | ||
border-color: $gray-500; | ||
border-color: var(--hxCheckbox-disabled-bordercolor, $gray-500); | ||
box-shadow: $focus-glow-disabled; | ||
} | ||
} | ||
@else if $pseudo-state == hover { | ||
&::-ms-check { | ||
background-color: var(--hxCheckbox-disabled-hover-bgcolor, $gray-0); | ||
border-color: var(--hxCheckbox-disabled-hover-bordercolor, $gray-500); | ||
color: var(--hxCheckbox-disabled-hover-color, $gray-500); | ||
background-color: $gray-0; | ||
border-color: $gray-500; | ||
color: $gray-500; | ||
} | ||
} | ||
@else { | ||
color: var(--hxCheckbox-disabled-color, $gray-500); | ||
cursor: not-allowed; | ||
|
||
&::-ms-check { | ||
background-color: $gray-0 !important; // simplest way of styling | ||
border-color: $gray-500; | ||
border-width: 1px; | ||
color: $gray-500; | ||
} | ||
} | ||
} | ||
|
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.
This looks good to me. However, just make sure design includes this in their docs.
The focus states were left out of the checkbox states and missed. I think they were missed for radios and some other components as well.
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.
@danielmdesigns, can you provide design recommendations for
required
andinvalid
states. These states could occur during validation phase (for example, form validation).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.
@ssalinas24 @danielmdesigns we received confirmation from design to keep
required
andinvalid
states. I updated these states to match our v2.0 Checkbox component styled specifications.