1 | @use 'sass:map';
|
---|
2 | @use '../theming/theming';
|
---|
3 | @use '../typography/typography';
|
---|
4 | @use '../typography/typography-utils';
|
---|
5 |
|
---|
6 | @mixin color($config-or-theme) {
|
---|
7 | $config: theming.get-color-config($config-or-theme);
|
---|
8 | $foreground: map.get($config, foreground);
|
---|
9 | $background: map.get($config, background);
|
---|
10 | $primary: map.get($config, primary);
|
---|
11 | $accent: map.get($config, accent);
|
---|
12 | $warn: map.get($config, warn);
|
---|
13 |
|
---|
14 | .mat-option {
|
---|
15 | color: theming.get-color-from-palette($foreground, text);
|
---|
16 |
|
---|
17 | &:hover:not(.mat-option-disabled),
|
---|
18 | &:focus:not(.mat-option-disabled) {
|
---|
19 | background: theming.get-color-from-palette($background, hover);
|
---|
20 | }
|
---|
21 |
|
---|
22 | // In multiple mode there is a checkbox to show that the option is selected.
|
---|
23 | &.mat-selected:not(.mat-option-multiple):not(.mat-option-disabled) {
|
---|
24 | background: theming.get-color-from-palette($background, hover);
|
---|
25 | }
|
---|
26 |
|
---|
27 | &.mat-active {
|
---|
28 | background: theming.get-color-from-palette($background, hover);
|
---|
29 | color: theming.get-color-from-palette($foreground, text);
|
---|
30 | }
|
---|
31 |
|
---|
32 | &.mat-option-disabled {
|
---|
33 | color: theming.get-color-from-palette($foreground, hint-text);
|
---|
34 | }
|
---|
35 | }
|
---|
36 |
|
---|
37 | .mat-primary .mat-option.mat-selected:not(.mat-option-disabled) {
|
---|
38 | color: theming.get-color-from-palette($primary, text);
|
---|
39 | }
|
---|
40 |
|
---|
41 | .mat-accent .mat-option.mat-selected:not(.mat-option-disabled) {
|
---|
42 | color: theming.get-color-from-palette($accent, text);
|
---|
43 | }
|
---|
44 |
|
---|
45 | .mat-warn .mat-option.mat-selected:not(.mat-option-disabled) {
|
---|
46 | color: theming.get-color-from-palette($warn, text);
|
---|
47 | }
|
---|
48 | }
|
---|
49 |
|
---|
50 | @mixin typography($config-or-theme) {
|
---|
51 | $config: typography.private-typography-to-2014-config(
|
---|
52 | theming.get-typography-config($config-or-theme));
|
---|
53 | .mat-option {
|
---|
54 | font: {
|
---|
55 | family: typography-utils.font-family($config);
|
---|
56 | size: typography-utils.font-size($config, subheading-2);
|
---|
57 | }
|
---|
58 | }
|
---|
59 | }
|
---|
60 |
|
---|
61 | @mixin _density($config-or-theme) {}
|
---|
62 |
|
---|
63 | @mixin theme($theme-or-color-config) {
|
---|
64 | $theme: theming.private-legacy-get-theme($theme-or-color-config);
|
---|
65 | @include theming.private-check-duplicate-theme-styles($theme, 'mat-option') {
|
---|
66 | $color: theming.get-color-config($theme);
|
---|
67 | $density: theming.get-density-config($theme);
|
---|
68 | $typography: theming.get-typography-config($theme);
|
---|
69 |
|
---|
70 | @if $color != null {
|
---|
71 | @include color($color);
|
---|
72 | }
|
---|
73 | @if $density != null {
|
---|
74 | @include _density($density);
|
---|
75 | }
|
---|
76 | @if $typography != null {
|
---|
77 | @include typography($typography);
|
---|
78 | }
|
---|
79 | }
|
---|
80 | }
|
---|