diff --git a/packages/web/src/scss/components/Radio/_Radio.scss b/packages/web/src/scss/components/Radio/_Radio.scss index e185d1f7fa..2fbc910fa9 100644 --- a/packages/web/src/scss/components/Radio/_Radio.scss +++ b/packages/web/src/scss/components/Radio/_Radio.scss @@ -20,11 +20,19 @@ $_field-name: 'Radio'; margin: theme.$input-margin; font: inherit; border-radius: theme.$input-border-radius; - background-color: transparent; + background-color: form-fields-theme.$input-background-color; place-content: center; + &:hover { + background-color: form-fields-theme.$input-background-color-hover; + } + + &:active { + background-color: form-fields-theme.$input-background-color-active; + } + &:checked { - border-color: form-fields-theme.$inline-field-input-color-checked; + border-color: form-fields-theme.$inline-field-input-border-color-checked; } &::before { @@ -84,10 +92,11 @@ $_field-name: 'Radio'; .Radio--disabled > .Radio__input, .Radio > .Radio__input:disabled { - border-color: form-fields-theme.$input-color-disabled; + border-color: form-fields-theme.$input-border-color-disabled; + background-color: form-fields-theme.$input-background-color-disabled; &:checked { - border-color: form-fields-theme.$input-color-disabled; + border-color: form-fields-theme.$input-border-color-disabled; } } @@ -106,17 +115,21 @@ $_field-name: 'Radio'; @include form-fields-tools.item-disabled(); } -// stylelint-disable selector-max-class, selector-max-compound-selectors, selector-max-specificity -- We need to override the default styles for the label in Item. -.Radio--item .Radio__input:checked ~ .Radio__label, -.Radio--item .Radio__input:checked ~ .Radio__text > .Radio__label { - // stylelint-enable selector-max-class, selector-max-compound-selectors, selector-max-specificity - @include form-fields-tools.item-label-checked(); +.Radio--item .Radio__label { + @include form-fields-tools.item-label(); } .Radio--item .Radio__helperText { @include form-fields-tools.item-helper-text(); } +// stylelint-disable selector-max-specificity -- We need to override the default styles, but not in disabled state +.Radio--item:not(.Radio--disabled) .Radio__input:hover:not(:checked), +.Radio--item:not(.Radio--disabled) .Radio__input:active:not(:checked) { + background-color: form-fields-theme.$input-background-color; +} +// stylelint-enable selector-max-specificity + .Radio--item:not(.Radio--disabled):hover .Radio__helperText, .Radio--item:not(.Radio--disabled):active .Radio__helperText { color: inherit; diff --git a/packages/web/src/scss/components/Radio/_theme.scss b/packages/web/src/scss/components/Radio/_theme.scss index f4e43062c4..985bc36c72 100644 --- a/packages/web/src/scss/components/Radio/_theme.scss +++ b/packages/web/src/scss/components/Radio/_theme.scss @@ -1,16 +1,16 @@ -@use '@tokens' as tokens; +@use '@global' as global-tokens; @use '../../settings/transitions'; @use '../../theme/form-fields' as form-fields-theme; -$input-border-radius: 50%; +$input-border-radius: global-tokens.$radius-full; $input-size: 20px; -$input-margin: 2px; +$input-margin: global-tokens.$space-200; $input-inner-dot-size: 10px; -$input-box-shadow-x: tokens.$space-600; -$input-box-shadow-y: tokens.$space-600; +$input-box-shadow-x: global-tokens.$space-700; +$input-box-shadow-y: global-tokens.$space-700; $input-box-shadow-before: inset $input-box-shadow-x $input-box-shadow-y - form-fields-theme.$inline-field-input-color-checked; + form-fields-theme.$inline-field-input-background-color-checked; $input-box-shadow-disabled: inset $input-box-shadow-x $input-box-shadow-y form-fields-theme.$input-color-disabled; $input-transition-duration: transitions.$duration-100; $input-transition-timing: transitions.$timing-eased-in-out; -$input-focus-shadow: tokens.$focus; +$input-focus-shadow: global-tokens.$focus; diff --git a/packages/web/src/scss/components/index.scss b/packages/web/src/scss/components/index.scss index e559d4541c..8f4179b03b 100644 --- a/packages/web/src/scss/components/index.scss +++ b/packages/web/src/scss/components/index.scss @@ -21,8 +21,7 @@ // @forward 'Pill'; @forward 'ProductLogo'; - -// @forward 'Radio'; +@forward 'Radio'; @forward 'ScrollView'; // @forward 'Select'; diff --git a/tests/e2e/demo-components-compare.spec.ts b/tests/e2e/demo-components-compare.spec.ts index 1a4ad3410a..3080a2cc75 100644 --- a/tests/e2e/demo-components-compare.spec.ts +++ b/tests/e2e/demo-components-compare.spec.ts @@ -16,7 +16,6 @@ const IGNORED_TESTS: string[] = [ 'Item', 'Link', 'Pill', - 'Radio', 'Select', 'Spinner', 'Stack', diff --git a/tests/e2e/demo-components-compare.spec.ts-snapshots/radio-chromium-linux.png b/tests/e2e/demo-components-compare.spec.ts-snapshots/radio-chromium-linux.png index cdc054aefe..1b93aee64b 100644 Binary files a/tests/e2e/demo-components-compare.spec.ts-snapshots/radio-chromium-linux.png and b/tests/e2e/demo-components-compare.spec.ts-snapshots/radio-chromium-linux.png differ