|
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; |
195 | 205 | }
|
196 | 206 | }
|
197 | 207 |
|
|
209 | 219 | }
|
210 | 220 |
|
211 | 221 | .mat-vertical-content-container {
|
| 222 | + display: grid; |
| 223 | + grid-template-rows: 0fr; |
| 224 | + grid-template-columns: 100%; |
212 | 225 | margin-left: stepper-variables.$vertical-stepper-content-margin;
|
213 | 226 | border: 0;
|
214 | 227 | position: relative;
|
215 | 228 |
|
| 229 | + .mat-stepper-animations-enabled & { |
| 230 | + transition: grid-template-rows var(--mat-stepper-animation-duration, 0) |
| 231 | + cubic-bezier(0.4, 0, 0.2, 1); |
| 232 | + } |
| 233 | + |
| 234 | + &.mat-vertical-content-container-active { |
| 235 | + grid-template-rows: 1fr; |
| 236 | + } |
| 237 | + |
| 238 | + .mat-step:last-child & { |
| 239 | + border: none; |
| 240 | + } |
| 241 | + |
216 | 242 | @include cdk.high-contrast {
|
217 | 243 | outline: solid 1px;
|
218 | 244 | }
|
|
221 | 247 | margin-left: 0;
|
222 | 248 | margin-right: stepper-variables.$vertical-stepper-content-margin;
|
223 | 249 | }
|
| 250 | + |
| 251 | + |
| 252 | + // All the browsers we support have support for `grid` as well, but given that these styles are |
| 253 | + // load-bearing for the stepper, we have a fallback to height which doesn't animate, just in case. |
| 254 | + // stylelint-disable material/no-prefixes |
| 255 | + @supports not (grid-template-rows: 0fr) { |
| 256 | + height: 0; |
| 257 | + |
| 258 | + &.mat-vertical-content-container-active { |
| 259 | + height: auto; |
| 260 | + } |
| 261 | + } |
| 262 | + // stylelint-enable material/no-prefixes |
224 | 263 | }
|
225 | 264 |
|
226 | 265 | .mat-stepper-vertical-line::before {
|
|
252 | 291 | .mat-vertical-stepper-content {
|
253 | 292 | overflow: hidden;
|
254 | 293 | outline: 0;
|
| 294 | + visibility: hidden; |
255 | 295 |
|
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; |
| 296 | + .mat-stepper-animations-enabled & { |
| 297 | + transition: visibility var(--mat-stepper-animation-duration, 0) linear; |
| 298 | + } |
| 299 | + |
| 300 | + .mat-vertical-content-container-active > & { |
| 301 | + visibility: visible; |
263 | 302 | }
|
264 | 303 | }
|
265 | 304 |
|
266 | 305 | .mat-vertical-content {
|
267 | 306 | padding: 0 stepper-variables.$side-gap stepper-variables.$side-gap stepper-variables.$side-gap;
|
268 | 307 | }
|
269 |
| - |
270 |
| -.mat-step:last-child { |
271 |
| - .mat-vertical-content-container { |
272 |
| - border: none; |
273 |
| - } |
274 |
| -} |
|
0 commit comments