[6a3a178] | 1 | @use 'sass:map';
|
---|
| 2 | @use '../core/style/private';
|
---|
| 3 | @use '../core/theming/theming';
|
---|
| 4 | @use '../core/typography/typography';
|
---|
| 5 | @use '../core/typography/typography-utils';
|
---|
| 6 | @use '../core/density/private/compatibility';
|
---|
| 7 | @use './button-toggle-variables';
|
---|
| 8 |
|
---|
| 9 | @mixin color($config-or-theme) {
|
---|
| 10 | $config: theming.get-color-config($config-or-theme);
|
---|
| 11 | $foreground: map.get($config, foreground);
|
---|
| 12 | $background: map.get($config, background);
|
---|
| 13 | $divider-color: theming.get-color-from-palette($foreground, divider);
|
---|
| 14 |
|
---|
| 15 | .mat-button-toggle-standalone,
|
---|
| 16 | .mat-button-toggle-group {
|
---|
| 17 | @include private.private-theme-elevation(2, $config);
|
---|
| 18 | }
|
---|
| 19 |
|
---|
| 20 | .mat-button-toggle-standalone.mat-button-toggle-appearance-standard,
|
---|
| 21 | .mat-button-toggle-group-appearance-standard {
|
---|
| 22 | box-shadow: none;
|
---|
| 23 | }
|
---|
| 24 |
|
---|
| 25 | .mat-button-toggle {
|
---|
| 26 | color: theming.get-color-from-palette($foreground, hint-text);
|
---|
| 27 |
|
---|
| 28 | .mat-button-toggle-focus-overlay {
|
---|
| 29 | background-color: theming.get-color-from-palette($background, focused-button);
|
---|
| 30 | }
|
---|
| 31 | }
|
---|
| 32 |
|
---|
| 33 | .mat-button-toggle-appearance-standard {
|
---|
| 34 | color: theming.get-color-from-palette($foreground, text);
|
---|
| 35 | background: theming.get-color-from-palette($background, card);
|
---|
| 36 |
|
---|
| 37 | .mat-button-toggle-focus-overlay {
|
---|
| 38 | background-color: theming.get-color-from-palette($background, focused-button, 1);
|
---|
| 39 | }
|
---|
| 40 | }
|
---|
| 41 |
|
---|
| 42 | .mat-button-toggle-group-appearance-standard .mat-button-toggle + .mat-button-toggle {
|
---|
| 43 | border-left: solid 1px $divider-color;
|
---|
| 44 | }
|
---|
| 45 |
|
---|
| 46 | [dir='rtl'] .mat-button-toggle-group-appearance-standard .mat-button-toggle + .mat-button-toggle {
|
---|
| 47 | border-left: none;
|
---|
| 48 | border-right: solid 1px $divider-color;
|
---|
| 49 | }
|
---|
| 50 |
|
---|
| 51 | .mat-button-toggle-group-appearance-standard.mat-button-toggle-vertical {
|
---|
| 52 | .mat-button-toggle + .mat-button-toggle {
|
---|
| 53 | border-left: none;
|
---|
| 54 | border-right: none;
|
---|
| 55 | border-top: solid 1px $divider-color;
|
---|
| 56 | }
|
---|
| 57 | }
|
---|
| 58 |
|
---|
| 59 | .mat-button-toggle-checked {
|
---|
| 60 | background-color: theming.get-color-from-palette($background, selected-button);
|
---|
| 61 | color: theming.get-color-from-palette($foreground, secondary-text);
|
---|
| 62 |
|
---|
| 63 | &.mat-button-toggle-appearance-standard {
|
---|
| 64 | color: theming.get-color-from-palette($foreground, text);
|
---|
| 65 | }
|
---|
| 66 | }
|
---|
| 67 |
|
---|
| 68 | .mat-button-toggle-disabled {
|
---|
| 69 | color: theming.get-color-from-palette($foreground, disabled-button);
|
---|
| 70 | background-color: theming.get-color-from-palette($background, disabled-button-toggle);
|
---|
| 71 |
|
---|
| 72 | &.mat-button-toggle-appearance-standard {
|
---|
| 73 | background: theming.get-color-from-palette($background, card);
|
---|
| 74 | }
|
---|
| 75 |
|
---|
| 76 | &.mat-button-toggle-checked {
|
---|
| 77 | background-color: theming.get-color-from-palette($background, selected-disabled-button);
|
---|
| 78 | }
|
---|
| 79 | }
|
---|
| 80 |
|
---|
| 81 | .mat-button-toggle-standalone.mat-button-toggle-appearance-standard,
|
---|
| 82 | .mat-button-toggle-group-appearance-standard {
|
---|
| 83 | border: solid 1px $divider-color;
|
---|
| 84 | }
|
---|
| 85 | }
|
---|
| 86 |
|
---|
| 87 | @mixin typography($config-or-theme) {
|
---|
| 88 | $config: typography.private-typography-to-2014-config(
|
---|
| 89 | theming.get-typography-config($config-or-theme));
|
---|
| 90 | .mat-button-toggle {
|
---|
| 91 | font-family: typography-utils.font-family($config);
|
---|
| 92 | }
|
---|
| 93 | }
|
---|
| 94 |
|
---|
| 95 | @mixin density($config-or-theme) {
|
---|
| 96 | $density-scale: theming.get-density-config($config-or-theme);
|
---|
| 97 | $standard-height: compatibility.private-density-prop-value(
|
---|
| 98 | button-toggle-variables.$standard-density-config, $density-scale, height);
|
---|
| 99 |
|
---|
| 100 | @include compatibility.private-density-legacy-compatibility() {
|
---|
| 101 | .mat-button-toggle-appearance-standard .mat-button-toggle-label-content {
|
---|
| 102 | line-height: $standard-height;
|
---|
| 103 | }
|
---|
| 104 | }
|
---|
| 105 | }
|
---|
| 106 |
|
---|
| 107 | @mixin theme($theme-or-color-config) {
|
---|
| 108 | $theme: theming.private-legacy-get-theme($theme-or-color-config);
|
---|
| 109 | @include theming.private-check-duplicate-theme-styles($theme, 'mat-button-toggle') {
|
---|
| 110 | $color: theming.get-color-config($theme);
|
---|
| 111 | $density: theming.get-density-config($theme);
|
---|
| 112 | $typography: theming.get-typography-config($theme);
|
---|
| 113 |
|
---|
| 114 | @if $color != null {
|
---|
| 115 | @include color($color);
|
---|
| 116 | }
|
---|
| 117 | @if $density != null {
|
---|
| 118 | @include density($density);
|
---|
| 119 | }
|
---|
| 120 | @if $typography != null {
|
---|
| 121 | @include typography($typography);
|
---|
| 122 | }
|
---|
| 123 | }
|
---|
| 124 | }
|
---|