[6a3a178] | 1 | @use 'sass:map';
|
---|
| 2 | @use '../core/theming/theming';
|
---|
| 3 | @use '../core/typography/typography';
|
---|
| 4 | @use '../core/typography/typography-utils';
|
---|
| 5 |
|
---|
| 6 | @mixin _color($palette) {
|
---|
| 7 | &.mat-radio-checked .mat-radio-outer-circle {
|
---|
| 8 | border-color: theming.get-color-from-palette($palette);
|
---|
| 9 | }
|
---|
| 10 |
|
---|
| 11 | .mat-radio-inner-circle,
|
---|
| 12 | .mat-radio-ripple .mat-ripple-element:not(.mat-radio-persistent-ripple),
|
---|
| 13 | &.mat-radio-checked .mat-radio-persistent-ripple,
|
---|
| 14 | &:active .mat-radio-persistent-ripple {
|
---|
| 15 | background-color: theming.get-color-from-palette($palette);
|
---|
| 16 | }
|
---|
| 17 | }
|
---|
| 18 |
|
---|
| 19 | @mixin color($config-or-theme) {
|
---|
| 20 | $config: theming.get-color-config($config-or-theme);
|
---|
| 21 | $primary: map.get($config, primary);
|
---|
| 22 | $accent: map.get($config, accent);
|
---|
| 23 | $warn: map.get($config, warn);
|
---|
| 24 | $background: map.get($config, background);
|
---|
| 25 | $foreground: map.get($config, foreground);
|
---|
| 26 |
|
---|
| 27 | .mat-radio-outer-circle {
|
---|
| 28 | border-color: theming.get-color-from-palette($foreground, secondary-text);
|
---|
| 29 | }
|
---|
| 30 |
|
---|
| 31 | .mat-radio-button {
|
---|
| 32 | &.mat-primary {
|
---|
| 33 | @include _color($primary);
|
---|
| 34 | }
|
---|
| 35 |
|
---|
| 36 | &.mat-accent {
|
---|
| 37 | @include _color($accent);
|
---|
| 38 | }
|
---|
| 39 |
|
---|
| 40 | &.mat-warn {
|
---|
| 41 | @include _color($warn);
|
---|
| 42 | }
|
---|
| 43 |
|
---|
| 44 | // This needs extra specificity, because the classes above are combined
|
---|
| 45 | // (e.g. `.mat-radio-button.mat-accent`) which increases their specificity a lot.
|
---|
| 46 | // TODO: consider making the selectors into descendants (`.mat-primary .mat-radio-button`).
|
---|
| 47 | &.mat-radio-disabled {
|
---|
| 48 | &.mat-radio-checked .mat-radio-outer-circle,
|
---|
| 49 | .mat-radio-outer-circle {
|
---|
| 50 | border-color: theming.get-color-from-palette($foreground, disabled);
|
---|
| 51 | }
|
---|
| 52 |
|
---|
| 53 | .mat-radio-ripple .mat-ripple-element,
|
---|
| 54 | .mat-radio-inner-circle {
|
---|
| 55 | background-color: theming.get-color-from-palette($foreground, disabled);
|
---|
| 56 | }
|
---|
| 57 |
|
---|
| 58 | .mat-radio-label-content {
|
---|
| 59 | color: theming.get-color-from-palette($foreground, disabled);
|
---|
| 60 | }
|
---|
| 61 | }
|
---|
| 62 |
|
---|
| 63 | // Switch this to a solid color since we're using `opacity`
|
---|
| 64 | // to control how opaque the ripple should be.
|
---|
| 65 | .mat-ripple-element {
|
---|
| 66 | background-color: map.get($foreground, base);
|
---|
| 67 | }
|
---|
| 68 | }
|
---|
| 69 | }
|
---|
| 70 |
|
---|
| 71 | @mixin typography($config-or-theme) {
|
---|
| 72 | $config: typography.private-typography-to-2014-config(
|
---|
| 73 | theming.get-typography-config($config-or-theme));
|
---|
| 74 | .mat-radio-button {
|
---|
| 75 | font-family: typography-utils.font-family($config);
|
---|
| 76 | }
|
---|
| 77 | }
|
---|
| 78 |
|
---|
| 79 | @mixin _density($config-or-theme) {}
|
---|
| 80 |
|
---|
| 81 | @mixin theme($theme-or-color-config) {
|
---|
| 82 | $theme: theming.private-legacy-get-theme($theme-or-color-config);
|
---|
| 83 | @include theming.private-check-duplicate-theme-styles($theme, 'mat-radio') {
|
---|
| 84 | $color: theming.get-color-config($theme);
|
---|
| 85 | $density: theming.get-density-config($theme);
|
---|
| 86 | $typography: theming.get-typography-config($theme);
|
---|
| 87 |
|
---|
| 88 | @if $color != null {
|
---|
| 89 | @include color($color);
|
---|
| 90 | }
|
---|
| 91 | @if $density != null {
|
---|
| 92 | @include _density($density);
|
---|
| 93 | }
|
---|
| 94 | @if $typography != null {
|
---|
| 95 | @include typography($typography);
|
---|
| 96 | }
|
---|
| 97 | }
|
---|
| 98 | }
|
---|