-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Expand file tree
/
Copy pathexpansion-panel.scss
More file actions
163 lines (133 loc) · 4.63 KB
/
expansion-panel.scss
File metadata and controls
163 lines (133 loc) · 4.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
@use '@angular/cdk';
@use './m3-expansion';
@use '../core/tokens/token-utils';
@use '../core/style/variables';
@use '../core/style/elevation';
$fallbacks: m3-expansion.get-tokens();
.mat-expansion-panel {
box-sizing: content-box;
display: block;
margin: 0;
overflow: hidden;
&.mat-expansion-panel-animations-enabled {
transition:
margin 225ms variables.$fast-out-slow-in-timing-function,
elevation.private-transition-property-value();
}
// Required so that the `box-shadow` works after the
// focus indicator relatively positions the header.
position: relative;
background: token-utils.slot(expansion-container-background-color, $fallbacks);
color: token-utils.slot(expansion-container-text-color, $fallbacks);
border-radius: token-utils.slot(expansion-container-shape, $fallbacks);
border-width: token-utils.slot(expansion-container-outline-width, $fallbacks);
border-color: token-utils.slot(expansion-container-outline-color, $fallbacks);
border-style: solid;
&:not([class*='#{elevation.$prefix}']) {
box-shadow: token-utils.slot(expansion-container-elevation-shadow, $fallbacks);
}
.mat-accordion & {
&:not(.mat-expanded),
&:not(.mat-expansion-panel-spacing) {
border-radius: 0;
}
&:first-of-type {
border-top-right-radius: token-utils.slot(expansion-container-shape, $fallbacks);
border-top-left-radius: token-utils.slot(expansion-container-shape, $fallbacks);
}
&:last-of-type {
border-bottom-right-radius: token-utils.slot(expansion-container-shape, $fallbacks);
border-bottom-left-radius: token-utils.slot(expansion-container-shape, $fallbacks);
}
}
@include cdk.high-contrast {
outline: solid 1px;
}
}
// Styles to use if grid isn't supported for some reason.
@mixin _fallback-styles {
height: 0;
.mat-expansion-panel.mat-expanded > & {
height: auto;
}
}
.mat-expansion-panel-content-wrapper {
// Note: we can't use `overflow: hidden` here, because it can clip content with
// ripples or box shadows. Instead we transition the `visibility` below.
// Based on https://css-tricks.com/css-grid-can-do-auto-height-transitions.
display: grid;
grid-template-rows: 0fr;
grid-template-columns: 100%;
.mat-expansion-panel-animations-enabled & {
transition: grid-template-rows 225ms cubic-bezier(0.4, 0, 0.2, 1);
}
.mat-expansion-panel.mat-expanded > & {
grid-template-rows: 1fr;
}
// All the browsers we support have support for `grid` as well, but
// given that these styles are load-bearing for the expansion panel,
// we have a fallback to `height` which doesn't animate, just in case.
// stylelint-disable material/no-prefixes
@supports not (grid-template-rows: 0fr) {
@include _fallback-styles;
}
// stylelint-enable material/no-prefixes
// Use the fallback styles when printing, otherwise closed panel appear open (see #32327).
@media print {
@include _fallback-styles;
}
}
.mat-expansion-panel-content {
display: flex;
flex-direction: column;
overflow: visible;
min-height: 0;
// The visibility here serves two purposes:
// 1. Hiding content from assistive technology.
// 2. Hiding any content that might be overflowing.
visibility: hidden;
.mat-expansion-panel-animations-enabled & {
// The duration here is slightly lower so the content
// goes away quicker than the collapse transition.
transition: visibility 190ms linear;
}
.mat-expansion-panel.mat-expanded > .mat-expansion-panel-content-wrapper > & {
visibility: visible;
}
font-family: token-utils.slot(expansion-container-text-font, $fallbacks);
font-size: token-utils.slot(expansion-container-text-size, $fallbacks);
font-weight: token-utils.slot(expansion-container-text-weight, $fallbacks);
line-height: token-utils.slot(expansion-container-text-line-height, $fallbacks);
letter-spacing: token-utils.slot(expansion-container-text-tracking, $fallbacks);
}
.mat-expansion-panel-body {
padding: 0 24px 16px;
}
.mat-expansion-panel-spacing {
margin: 16px 0;
.mat-accordion > &:first-child,
.mat-accordion > *:first-child:not(.mat-expansion-panel) & {
margin-top: 0;
}
.mat-accordion > &:last-child,
.mat-accordion > *:last-child:not(.mat-expansion-panel) & {
margin-bottom: 0;
}
}
.mat-action-row {
border-top-style: solid;
border-top-width: 1px;
display: flex;
flex-direction: row;
justify-content: flex-end;
padding: 16px 8px 16px 24px;
border-top-color: token-utils.slot(expansion-actions-divider-color, $fallbacks);
.mat-button-base,
.mat-mdc-button-base {
margin-left: 8px;
[dir='rtl'] & {
margin-left: 0;
margin-right: 8px;
}
}
}