|
178 | 178 | }
|
179 | 179 |
|
180 | 180 | .mat-horizontal-stepper-content {
|
| 181 | + visibility: hidden; |
| 182 | + overflow: hidden; |
181 | 183 | outline: 0;
|
| 184 | + height: 0; |
182 | 185 |
|
183 |
| - &.mat-horizontal-stepper-content-inactive { |
184 |
| - height: 0; |
185 |
| - overflow: hidden; |
| 186 | + .mat-stepper-animations-enabled & { |
| 187 | + transition: transform var(--mat-stepper-animation-duration, 0) cubic-bezier(0.35, 0, 0.25, 1); |
| 188 | + } |
| 189 | + |
| 190 | + &.mat-horizontal-stepper-content-previous { |
| 191 | + transform: translate3d(-100%, 0, 0); |
| 192 | + } |
| 193 | + |
| 194 | + &.mat-horizontal-stepper-content-next { |
| 195 | + transform: translate3d(100%, 0, 0); |
186 | 196 | }
|
187 | 197 |
|
188 |
| - // Used to avoid an issue where when the stepper is nested inside a component that |
189 |
| - // changes the `visibility` as a part of an Angular animation, the stepper's content |
190 |
| - // stays hidden (see #25925). The value has to be `!important` to override the incorrect |
191 |
| - // `visibility` from the animations package. This can also be solved using `visibility: visible` |
192 |
| - // on `.mat-horizontal-stepper-content`, but it can allow tabbing into hidden content. |
193 |
| - &:not(.mat-horizontal-stepper-content-inactive) { |
194 |
| - visibility: inherit !important; |
| 198 | + &.mat-horizontal-stepper-content-current { |
| 199 | + // TODO(crisbeto): the height and visibility switches are a bit jarring, but that's how the |
| 200 | + // animation was set up when we still used the Animations module. We should be able to make |
| 201 | + // it a bit smoother. |
| 202 | + visibility: visible; |
| 203 | + transform: none; |
| 204 | + height: auto; |
| 205 | + } |
| 206 | + |
| 207 | + .mat-stepper-horizontal:not(.mat-stepper-animating) &.mat-horizontal-stepper-content-current { |
| 208 | + overflow: visible; |
195 | 209 | }
|
196 | 210 | }
|
197 | 211 |
|
|
209 | 223 | }
|
210 | 224 |
|
211 | 225 | .mat-vertical-content-container {
|
| 226 | + display: grid; |
| 227 | + grid-template-rows: 0fr; |
| 228 | + grid-template-columns: 100%; |
212 | 229 | margin-left: stepper-variables.$vertical-stepper-content-margin;
|
213 | 230 | border: 0;
|
214 | 231 | position: relative;
|
215 | 232 |
|
| 233 | + .mat-stepper-animations-enabled & { |
| 234 | + transition: grid-template-rows var(--mat-stepper-animation-duration, 0) |
| 235 | + cubic-bezier(0.4, 0, 0.2, 1); |
| 236 | + } |
| 237 | + |
| 238 | + &.mat-vertical-content-container-active { |
| 239 | + grid-template-rows: 1fr; |
| 240 | + } |
| 241 | + |
| 242 | + .mat-step:last-child & { |
| 243 | + border: none; |
| 244 | + } |
| 245 | + |
216 | 246 | @include cdk.high-contrast {
|
217 | 247 | outline: solid 1px;
|
218 | 248 | }
|
|
221 | 251 | margin-left: 0;
|
222 | 252 | margin-right: stepper-variables.$vertical-stepper-content-margin;
|
223 | 253 | }
|
| 254 | + |
| 255 | + |
| 256 | + // All the browsers we support have support for `grid` as well, but given that these styles are |
| 257 | + // load-bearing for the stepper, we have a fallback to height which doesn't animate, just in case. |
| 258 | + // stylelint-disable material/no-prefixes |
| 259 | + @supports not (grid-template-rows: 0fr) { |
| 260 | + height: 0; |
| 261 | + |
| 262 | + &.mat-vertical-content-container-active { |
| 263 | + height: auto; |
| 264 | + } |
| 265 | + } |
| 266 | + // stylelint-enable material/no-prefixes |
224 | 267 | }
|
225 | 268 |
|
226 | 269 | .mat-stepper-vertical-line::before {
|
|
252 | 295 | .mat-vertical-stepper-content {
|
253 | 296 | overflow: hidden;
|
254 | 297 | outline: 0;
|
| 298 | + visibility: hidden; |
| 299 | + |
| 300 | + .mat-stepper-animations-enabled & { |
| 301 | + transition: visibility var(--mat-stepper-animation-duration, 0) linear; |
| 302 | + } |
255 | 303 |
|
256 |
| - // Used to avoid an issue where when the stepper is nested inside a component that |
257 |
| - // changes the `visibility` as a part of an Angular animation, the stepper's content |
258 |
| - // stays hidden (see #25925). The value has to be `!important` to override the incorrect |
259 |
| - // `visibility` from the animations package. This can also be solved using `visibility: visible` |
260 |
| - // on `.mat-vertical-stepper-content`, but it can allow tabbing into hidden content. |
261 |
| - &:not(.mat-vertical-stepper-content-inactive) { |
262 |
| - visibility: inherit !important; |
| 304 | + .mat-vertical-content-container-active > & { |
| 305 | + visibility: visible; |
263 | 306 | }
|
264 | 307 | }
|
265 | 308 |
|
266 | 309 | .mat-vertical-content {
|
267 | 310 | padding: 0 stepper-variables.$side-gap stepper-variables.$side-gap stepper-variables.$side-gap;
|
268 | 311 | }
|
269 |
| - |
270 |
| -.mat-step:last-child { |
271 |
| - .mat-vertical-content-container { |
272 |
| - border: none; |
273 |
| - } |
274 |
| -} |
|
0 commit comments