-
Notifications
You must be signed in to change notification settings - Fork 14
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(styles): tokenise radio buttons #3540
Changes from all commits
846df53
4fcf664
9fbb62f
b9f1095
4bea63d
578f4b0
9d0b7df
98f4e93
98afc4a
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@swisspost/design-system-styles': patch | ||
--- | ||
|
||
Started adapting the radio-button styles to match v2 design. | ||
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -9,14 +9,29 @@ | |||||||||
@use '../mixins/color' as color-mx; | ||||||||||
@use '../mixins/icons' as icons-mx; | ||||||||||
@use '../mixins/utilities' as utility-mx; | ||||||||||
@use '../tokens/components' as components; | ||||||||||
@use '../functions/tokens' as tokens; | ||||||||||
Comment on lines
+12
to
+13
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. This is not necessary:
Suggested change
|
||||||||||
|
||||||||||
tokens.$default-map: components.$post-radio-button; | ||||||||||
|
||||||||||
.form-check { | ||||||||||
display: flex; | ||||||||||
flex-wrap: wrap; | ||||||||||
row-gap: form-check.$form-check-row-gap; | ||||||||||
margin-bottom: form-check.$form-check-margin-bottom; | ||||||||||
|
||||||||||
@include utility-mx.focus-style() { | ||||||||||
@include utility-mx.focus-style-custom() { | ||||||||||
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. You can use the |
||||||||||
outline: tokens.get('radio-button-focus-border-width') solid | ||||||||||
tokens.get('radio-button-focus-stroke'); | ||||||||||
color: tokens.get('radio-button-selected-fg'); | ||||||||||
background-color: tokens.get('radio-button-selected-bg'); | ||||||||||
|
||||||||||
.form-check-input[type='radio'] { | ||||||||||
border-color: tokens.get('radio-button-selected-stroke'); | ||||||||||
} | ||||||||||
|
||||||||||
// TODO: Use tokens for these (not yet provided) | ||||||||||
outline-offset: 3px !important; | ||||||||||
border-radius: commons.$border-radius; | ||||||||||
} | ||||||||||
|
||||||||||
|
@@ -30,16 +45,19 @@ | |||||||||
|
||||||||||
&-input, | ||||||||||
&-label { | ||||||||||
color: rgba(var(--post-contrast-color-rgb), 0.8); | ||||||||||
transition: color animation.$transition-base-timing; | ||||||||||
color: tokens.get('radio-button-enabled-fg'); | ||||||||||
background-color: tokens.get('radio-button-enabled-bg'); | ||||||||||
transition: color #{animation.$transition-base-timing}; | ||||||||||
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.
Suggested change
|
||||||||||
|
||||||||||
@include utility-mx.high-contrast-mode { | ||||||||||
transition: none; | ||||||||||
} | ||||||||||
|
||||||||||
&:hover:not([disabled]), | ||||||||||
&:hover:not([disabled]) ~ &-label { | ||||||||||
color: var(--post-contrast-color); | ||||||||||
color: tokens.get('radio-button-hover-fg'); | ||||||||||
background-color: tokens.get('radio-button-hover-bg'); | ||||||||||
border-color: tokens.get('radio-button-hover-stroke'); | ||||||||||
|
||||||||||
@include utility-mx.high-contrast-mode() { | ||||||||||
border-color: Highlight; | ||||||||||
|
@@ -48,20 +66,22 @@ | |||||||||
} | ||||||||||
|
||||||||||
&-input { | ||||||||||
&:not([disabled]), | ||||||||||
&:not([disabled]) ~ .form-check-label { | ||||||||||
cursor: pointer; | ||||||||||
} | ||||||||||
|
||||||||||
@include utility-mx.focus-style-none(); | ||||||||||
|
||||||||||
display: inline-flex; | ||||||||||
flex: 0 auto; | ||||||||||
appearance: none; | ||||||||||
background: transparent; | ||||||||||
height: form-check.$form-check-input-size; | ||||||||||
width: form-check.$form-check-input-size; | ||||||||||
border: form-check.$form-check-input-border-width solid currentColor; | ||||||||||
height: tokens.get('radio-button-icon-ring'); | ||||||||||
width: tokens.get('radio-button-icon-ring'); | ||||||||||
border: tokens.get('radio-button-icon-border-width') solid | ||||||||||
tokens.get('radio-button-enabled-stroke'); | ||||||||||
margin-top: 1px; | ||||||||||
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. What is this margin for? Can it be removed? |
||||||||||
@include utility-mx.focus-style-none(); | ||||||||||
|
||||||||||
&:not([disabled]), | ||||||||||
&:not([disabled]) ~ .form-check-label { | ||||||||||
cursor: pointer; | ||||||||||
} | ||||||||||
|
||||||||||
@include utility-mx.high-contrast-mode { | ||||||||||
border-color: FieldText; // For blink-browser as otherwise the default color (which is not a full color) will be converted to Highlight | ||||||||||
|
@@ -92,10 +112,11 @@ | |||||||||
} | ||||||||||
|
||||||||||
&[type='radio'] { | ||||||||||
border-radius: 50%; | ||||||||||
border-radius: tokens.get('radio-button-icon-border-radius-round'); | ||||||||||
|
||||||||||
&:checked::after { | ||||||||||
border: spacing.$size-micro solid transparent; | ||||||||||
// TODO: Use tokens | ||||||||||
border: 3px solid transparent; | ||||||||||
Comment on lines
+118
to
+119
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. Did you contact @Vandapanda to create the missing tokens? |
||||||||||
background-color: currentColor; | ||||||||||
border-radius: inherit; | ||||||||||
background-clip: padding-box; | ||||||||||
|
@@ -121,9 +142,6 @@ | |||||||||
} | ||||||||||
|
||||||||||
&[disabled] { | ||||||||||
border: 0; | ||||||||||
background-image: url('#{form-check.$form-check-input-disabled-background-url-light-lg}'); | ||||||||||
|
||||||||||
&[type='checkbox'], | ||||||||||
&[type='radio'] { | ||||||||||
@include utility-mx.high-contrast-mode { | ||||||||||
|
@@ -149,6 +167,9 @@ | |||||||||
} | ||||||||||
} | ||||||||||
|
||||||||||
border: 0; | ||||||||||
background-image: url('#{form-check.$form-check-input-disabled-background-url-light-lg}'); | ||||||||||
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. Is this still correct or do we simply use a dashed border now? |
||||||||||
|
||||||||||
@include color-mx.on-dark-background { | ||||||||||
background-image: url('#{form-check.$form-check-input-disabled-background-url-dark-lg}'); | ||||||||||
} | ||||||||||
|
@@ -172,8 +193,8 @@ | |||||||||
|
||||||||||
&[disabled], | ||||||||||
&[disabled] ~ .form-check-label { | ||||||||||
text-decoration: line-through; | ||||||||||
color: color.$black-alpha-60; | ||||||||||
color: tokens.get('radio-button-disabled-fg'); | ||||||||||
background-color: tokens.get('radio-button-disabled-bg'); | ||||||||||
|
||||||||||
@include color-mx.on-dark-background() { | ||||||||||
color: color.$white-alpha-80; | ||||||||||
|
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.