Skip to content

Commit

Permalink
Feat(web): Switch Radio component to v3 design tokens #DS-1447
Browse files Browse the repository at this point in the history
  • Loading branch information
crishpeen committed Sep 5, 2024
1 parent 0cf82e1 commit fd0517c
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 10 deletions.
5 changes: 3 additions & 2 deletions packages/web/src/scss/components/Radio/_Radio.scss
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,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;
}
}

Expand Down
12 changes: 6 additions & 6 deletions packages/web/src/scss/components/Radio/_theme.scss
Original file line number Diff line number Diff line change
@@ -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;
$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;
3 changes: 2 additions & 1 deletion packages/web/src/scss/components/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
// @forward 'Modal';
// @forward 'Pagination';
// @forward 'Pill';
// @forward 'Radio';
@forward 'Radio';

// @forward 'ScrollView';
// @forward 'Select';
@forward 'Stack';
Expand Down
3 changes: 3 additions & 0 deletions packages/web/src/scss/theme/_form-fields.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
$gap: global-tokens.$space-500;
$input-typography: global-tokens.$body-medium-regular;
$input-color-disabled: var(--#{globals.$prefix}color-disabled-text);
$input-background: var(--#{globals.$prefix}color-background-form-field-default);
$input-background-hover: var(--#{globals.$prefix}color-background-form-field-hover);
$input-background-active: var(--#{globals.$prefix}color-background-form-field-active);
$input-background-color-disabled: var(--#{globals.$prefix}color-disabled-background);
$input-border-color-success: var(--#{globals.$prefix}color-border-interactive-success);
$input-border-color-warning: var(--#{globals.$prefix}color-border-interactive-warning);
Expand Down
11 changes: 11 additions & 0 deletions packages/web/src/scss/tools/_form-fields.scss
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,23 @@
appearance: none;
color: form-fields-theme.$inline-field-input-color-unchecked;
border: form-fields-theme.$inline-field-input-outline-width solid currentcolor;
background-color: form-fields-theme.$input-background;
cursor: cursors.$form-fields;

&:focus-visible {
outline: 0;
box-shadow: form-fields-theme.$input-focus-shadow;
}

@media (hover: hover) {
&:hover {
background-color: form-fields-theme.$input-background-hover;
}
}

&:active {
background-color: form-fields-theme.$input-background-active;
}
}

@mixin box-field-input() {
Expand Down
1 change: 0 additions & 1 deletion tests/e2e/demo-components-compare.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ const IGNORED_TESTS: string[] = [
'Modal',
'Pagination',
'Pill',
'Radio',
'ScrollView',
'Select',
'Spinner',
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit fd0517c

Please sign in to comment.