| @import '../core/density/private/compatibility'; |
| @import '../core/theming/palette'; |
| @import '../core/theming/theming'; |
| @import '../core/style/private'; |
| @import '../core/typography/typography-utils'; |
| @import './expansion-variables'; |
| @import './expansion-mixins'; |
| |
| @mixin mat-expansion-panel-color($config-or-theme) { |
| $config: mat-get-color-config($config-or-theme); |
| $background: map-get($config, background); |
| $foreground: map-get($config, foreground); |
| |
| .mat-expansion-panel { |
| @include mat-private-theme-overridable-elevation(2, $config); |
| background: mat-color($background, card); |
| color: mat-color($foreground, text); |
| } |
| |
| .mat-action-row { |
| border-top-color: mat-color($foreground, divider); |
| } |
| |
| @include mat-private-expansion-focus { |
| background: mat-color($background, hover); |
| } |
| |
| // Disable the hover on touch devices since it can appear like it is stuck. We can't use |
| // `@media (hover)` above, because the desktop support browser support isn't great. |
| @media (hover: none) { |
| .mat-expansion-panel:not(.mat-expanded):not([aria-disabled='true']) |
| .mat-expansion-panel-header:hover { |
| background: mat-color($background, card); |
| } |
| } |
| |
| .mat-expansion-panel-header-title { |
| color: mat-color($foreground, text); |
| } |
| |
| .mat-expansion-panel-header-description, |
| .mat-expansion-indicator::after { |
| color: mat-color($foreground, secondary-text); |
| } |
| |
| .mat-expansion-panel-header[aria-disabled='true'] { |
| color: mat-color($foreground, disabled-button); |
| |
| .mat-expansion-panel-header-title, |
| .mat-expansion-panel-header-description { |
| color: inherit; |
| } |
| } |
| } |
| |
| @mixin mat-expansion-panel-typography($config-or-theme) { |
| $config: mat-get-typography-config($config-or-theme); |
| .mat-expansion-panel-header { |
| font: { |
| family: mat-font-family($config, subheading-1); |
| size: mat-font-size($config, subheading-1); |
| weight: mat-font-weight($config, subheading-1); |
| } |
| } |
| |
| .mat-expansion-panel-content { |
| @include mat-typography-level-to-styles($config, body-1); |
| } |
| } |
| |
| @mixin mat-expansion-panel-density($config-or-theme) { |
| $density-scale: mat-get-density-config($config-or-theme); |
| $expanded-height: mat-private-density-prop-value( |
| $mat-expansion-panel-header-density-config, $density-scale, expanded-height); |
| $collapsed-height: mat-private-density-prop-value( |
| $mat-expansion-panel-header-density-config, $density-scale, collapsed-height); |
| |
| @include mat-private-density-legacy-compatibility() { |
| .mat-expansion-panel-header { |
| height: $collapsed-height; |
| |
| &.mat-expanded { |
| height: $expanded-height; |
| } |
| } |
| } |
| } |
| |
| @mixin mat-expansion-panel-theme($theme-or-color-config) { |
| $theme: mat-private-legacy-get-theme($theme-or-color-config); |
| @include mat-private-check-duplicate-theme-styles($theme, 'mat-expansion-panel') { |
| $color: mat-get-color-config($theme); |
| $density: mat-get-density-config($theme); |
| $typography: mat-get-typography-config($theme); |
| |
| @if $color != null { |
| @include mat-expansion-panel-color($color); |
| } |
| @if $density != null { |
| @include mat-expansion-panel-density($density); |
| } |
| @if $typography != null { |
| @include mat-expansion-panel-typography($typography); |
| } |
| } |
| } |