[6a3a178] | 1 | @use 'sass:map';
|
---|
| 2 | @use '../core/density/private/compatibility';
|
---|
| 3 | @use '../core/theming/theming';
|
---|
| 4 | @use '../core/style/private';
|
---|
| 5 | @use '../core/typography/typography';
|
---|
| 6 | @use '../core/typography/typography-utils';
|
---|
| 7 | @use './expansion-variables';
|
---|
| 8 | @use './expansion-mixins';
|
---|
| 9 |
|
---|
| 10 | @mixin color($config-or-theme) {
|
---|
| 11 | $config: theming.get-color-config($config-or-theme);
|
---|
| 12 | $background: map.get($config, background);
|
---|
| 13 | $foreground: map.get($config, foreground);
|
---|
| 14 |
|
---|
| 15 | .mat-expansion-panel {
|
---|
| 16 | @include private.private-theme-overridable-elevation(2, $config);
|
---|
| 17 | background: theming.get-color-from-palette($background, card);
|
---|
| 18 | color: theming.get-color-from-palette($foreground, text);
|
---|
| 19 | }
|
---|
| 20 |
|
---|
| 21 | .mat-action-row {
|
---|
| 22 | border-top-color: theming.get-color-from-palette($foreground, divider);
|
---|
| 23 | }
|
---|
| 24 |
|
---|
| 25 | @include expansion-mixins.private-expansion-focus {
|
---|
| 26 | background: theming.get-color-from-palette($background, hover);
|
---|
| 27 | }
|
---|
| 28 |
|
---|
| 29 | // Disable the hover on touch devices since it can appear like it is stuck. We can't use
|
---|
| 30 | // `@media (hover)` above, because the desktop support browser support isn't great.
|
---|
| 31 | @media (hover: none) {
|
---|
| 32 | .mat-expansion-panel:not(.mat-expanded):not([aria-disabled='true'])
|
---|
| 33 | .mat-expansion-panel-header:hover {
|
---|
| 34 | background: theming.get-color-from-palette($background, card);
|
---|
| 35 | }
|
---|
| 36 | }
|
---|
| 37 |
|
---|
| 38 | .mat-expansion-panel-header-title {
|
---|
| 39 | color: theming.get-color-from-palette($foreground, text);
|
---|
| 40 | }
|
---|
| 41 |
|
---|
| 42 | .mat-expansion-panel-header-description,
|
---|
| 43 | .mat-expansion-indicator::after {
|
---|
| 44 | color: theming.get-color-from-palette($foreground, secondary-text);
|
---|
| 45 | }
|
---|
| 46 |
|
---|
| 47 | .mat-expansion-panel-header[aria-disabled='true'] {
|
---|
| 48 | color: theming.get-color-from-palette($foreground, disabled-button);
|
---|
| 49 |
|
---|
| 50 | .mat-expansion-panel-header-title,
|
---|
| 51 | .mat-expansion-panel-header-description {
|
---|
| 52 | color: inherit;
|
---|
| 53 | }
|
---|
| 54 | }
|
---|
| 55 | }
|
---|
| 56 |
|
---|
| 57 | @mixin typography($config-or-theme) {
|
---|
| 58 | $config: typography.private-typography-to-2014-config(
|
---|
| 59 | theming.get-typography-config($config-or-theme));
|
---|
| 60 | .mat-expansion-panel-header {
|
---|
| 61 | font: {
|
---|
| 62 | family: typography-utils.font-family($config, subheading-1);
|
---|
| 63 | size: typography-utils.font-size($config, subheading-1);
|
---|
| 64 | weight: typography-utils.font-weight($config, subheading-1);
|
---|
| 65 | }
|
---|
| 66 | }
|
---|
| 67 |
|
---|
| 68 | .mat-expansion-panel-content {
|
---|
| 69 | @include typography-utils.typography-level($config, body-1);
|
---|
| 70 | }
|
---|
| 71 | }
|
---|
| 72 |
|
---|
| 73 | @mixin density($config-or-theme) {
|
---|
| 74 | $density-scale: theming.get-density-config($config-or-theme);
|
---|
| 75 | $expanded-height: compatibility.private-density-prop-value(
|
---|
| 76 | expansion-variables.$header-density-config, $density-scale, expanded-height);
|
---|
| 77 | $collapsed-height: compatibility.private-density-prop-value(
|
---|
| 78 | expansion-variables.$header-density-config, $density-scale, collapsed-height);
|
---|
| 79 |
|
---|
| 80 | @include compatibility.private-density-legacy-compatibility() {
|
---|
| 81 | .mat-expansion-panel-header {
|
---|
| 82 | height: $collapsed-height;
|
---|
| 83 |
|
---|
| 84 | &.mat-expanded {
|
---|
| 85 | height: $expanded-height;
|
---|
| 86 | }
|
---|
| 87 | }
|
---|
| 88 | }
|
---|
| 89 | }
|
---|
| 90 |
|
---|
| 91 | @mixin theme($theme-or-color-config) {
|
---|
| 92 | $theme: theming.private-legacy-get-theme($theme-or-color-config);
|
---|
| 93 | @include theming.private-check-duplicate-theme-styles($theme, 'mat-expansion') {
|
---|
| 94 | $color: theming.get-color-config($theme);
|
---|
| 95 | $density: theming.get-density-config($theme);
|
---|
| 96 | $typography: theming.get-typography-config($theme);
|
---|
| 97 |
|
---|
| 98 | @if $color != null {
|
---|
| 99 | @include color($color);
|
---|
| 100 | }
|
---|
| 101 | @if $density != null {
|
---|
| 102 | @include density($density);
|
---|
| 103 | }
|
---|
| 104 | @if $typography != null {
|
---|
| 105 | @include typography($typography);
|
---|
| 106 | }
|
---|
| 107 | }
|
---|
| 108 | }
|
---|