You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

124 lines
3.9 KiB

@use 'sass:map';
@use '../core/style/private';
@use '../core/theming/theming';
@use '../core/typography/typography';
@use '../core/typography/typography-utils';
@use '../core/density/private/compatibility';
@use './button-toggle-variables';
@mixin color($config-or-theme) {
$config: theming.get-color-config($config-or-theme);
$foreground: map.get($config, foreground);
$background: map.get($config, background);
$divider-color: theming.get-color-from-palette($foreground, divider);
.mat-button-toggle-standalone,
.mat-button-toggle-group {
@include private.private-theme-elevation(2, $config);
}
.mat-button-toggle-standalone.mat-button-toggle-appearance-standard,
.mat-button-toggle-group-appearance-standard {
box-shadow: none;
}
.mat-button-toggle {
color: theming.get-color-from-palette($foreground, hint-text);
.mat-button-toggle-focus-overlay {
background-color: theming.get-color-from-palette($background, focused-button);
}
}
.mat-button-toggle-appearance-standard {
color: theming.get-color-from-palette($foreground, text);
background: theming.get-color-from-palette($background, card);
.mat-button-toggle-focus-overlay {
background-color: theming.get-color-from-palette($background, focused-button, 1);
}
}
.mat-button-toggle-group-appearance-standard .mat-button-toggle + .mat-button-toggle {
border-left: solid 1px $divider-color;
}
[dir='rtl'] .mat-button-toggle-group-appearance-standard .mat-button-toggle + .mat-button-toggle {
border-left: none;
border-right: solid 1px $divider-color;
}
.mat-button-toggle-group-appearance-standard.mat-button-toggle-vertical {
.mat-button-toggle + .mat-button-toggle {
border-left: none;
border-right: none;
border-top: solid 1px $divider-color;
}
}
.mat-button-toggle-checked {
background-color: theming.get-color-from-palette($background, selected-button);
color: theming.get-color-from-palette($foreground, secondary-text);
&.mat-button-toggle-appearance-standard {
color: theming.get-color-from-palette($foreground, text);
}
}
.mat-button-toggle-disabled {
color: theming.get-color-from-palette($foreground, disabled-button);
background-color: theming.get-color-from-palette($background, disabled-button-toggle);
&.mat-button-toggle-appearance-standard {
background: theming.get-color-from-palette($background, card);
}
&.mat-button-toggle-checked {
background-color: theming.get-color-from-palette($background, selected-disabled-button);
}
}
.mat-button-toggle-standalone.mat-button-toggle-appearance-standard,
.mat-button-toggle-group-appearance-standard {
border: solid 1px $divider-color;
}
}
@mixin typography($config-or-theme) {
$config: typography.private-typography-to-2014-config(
theming.get-typography-config($config-or-theme));
.mat-button-toggle {
font-family: typography-utils.font-family($config);
}
}
@mixin density($config-or-theme) {
$density-scale: theming.get-density-config($config-or-theme);
$standard-height: compatibility.private-density-prop-value(
button-toggle-variables.$standard-density-config, $density-scale, height);
@include compatibility.private-density-legacy-compatibility() {
.mat-button-toggle-appearance-standard .mat-button-toggle-label-content {
line-height: $standard-height;
}
}
}
@mixin theme($theme-or-color-config) {
$theme: theming.private-legacy-get-theme($theme-or-color-config);
@include theming.private-check-duplicate-theme-styles($theme, 'mat-button-toggle') {
$color: theming.get-color-config($theme);
$density: theming.get-density-config($theme);
$typography: theming.get-typography-config($theme);
@if $color != null {
@include color($color);
}
@if $density != null {
@include density($density);
}
@if $typography != null {
@include typography($typography);
}
}
}