|
| 1 | +@import '@material/list/mixins.import'; |
| 2 | +@import '@material/list/variables.import'; |
| 3 | +@import '@material/theme/functions.import'; |
| 4 | +@import '../../mdc-helpers/mdc-helpers'; |
| 5 | +@import '../../../material/core/theming/check-duplicate-styles'; |
| 6 | + |
| 7 | +@mixin mat-mdc-option-color($config-or-theme) { |
| 8 | + $config: mat-get-color-config($config-or-theme); |
| 9 | + |
| 10 | + @include mat-using-mdc-theme($config) { |
| 11 | + .mat-mdc-option { |
| 12 | + // Since this will usually be rendered in an overlay, |
| 13 | + // we have explicitly set the default color. |
| 14 | + @include mdc-theme-prop(color, text-primary-on-background); |
| 15 | + @include mdc-list-item-disabled-text-color($mdc-list-text-disabled-color, |
| 16 | + $query: $mat-theme-styles-query); |
| 17 | + |
| 18 | + &:hover:not(.mdc-list-item--disabled), |
| 19 | + &:focus:not(.mdc-list-item--disabled), |
| 20 | + &.mat-mdc-option-active, |
| 21 | + |
| 22 | + // In multiple mode there is a checkbox to show that the option is selected. |
| 23 | + &.mdc-list-item--selected:not(.mat-mdc-option-multiple):not(.mdc-list-item--disabled) { |
| 24 | + $color: $mdc-theme-on-surface; |
| 25 | + background: rgba($color, mdc-states-opacity($color, hover)); |
| 26 | + } |
| 27 | + } |
| 28 | + |
| 29 | + .mat-primary .mat-mdc-option.mdc-list-item--selected:not(.mdc-list-item--disabled) { |
| 30 | + @include mdc-list-item-primary-text-ink-color(primary, $query: $mat-theme-styles-query); |
| 31 | + } |
| 32 | + |
| 33 | + .mat-accent .mat-mdc-option.mdc-list-item--selected:not(.mdc-list-item--disabled) { |
| 34 | + @include mdc-list-item-primary-text-ink-color(secondary, $query: $mat-theme-styles-query); |
| 35 | + } |
| 36 | + |
| 37 | + .mat-warn .mat-mdc-option.mdc-list-item--selected:not(.mdc-list-item--disabled) { |
| 38 | + @include mdc-list-item-primary-text-ink-color(error, $query: $mat-theme-styles-query); |
| 39 | + } |
| 40 | + } |
| 41 | +} |
| 42 | + |
| 43 | +@mixin mat-mdc-option-typography($config-or-theme) { |
| 44 | + $config: mat-get-typography-config($config-or-theme); |
| 45 | +} |
| 46 | + |
| 47 | +@mixin mat-mdc-option-density($config-or-theme) { |
| 48 | + $density-scale: mat-get-density-config($config-or-theme); |
| 49 | +} |
| 50 | + |
| 51 | +@mixin mat-mdc-option-theme($theme-or-color-config) { |
| 52 | + $theme: _mat-legacy-get-theme($theme-or-color-config); |
| 53 | + @include _mat-check-duplicate-theme-styles($theme, 'mat-mdc-option') { |
| 54 | + $color: mat-get-color-config($theme); |
| 55 | + $density: mat-get-density-config($theme); |
| 56 | + $typography: mat-get-typography-config($theme); |
| 57 | + |
| 58 | + @if $color != null { |
| 59 | + @include mat-mdc-option-color($color); |
| 60 | + } |
| 61 | + @if $density != null { |
| 62 | + @include mat-mdc-option-density($density); |
| 63 | + } |
| 64 | + @if $typography != null { |
| 65 | + @include mat-mdc-option-typography($typography); |
| 66 | + } |
| 67 | + } |
| 68 | +} |
0 commit comments