|
6 | 6 |
|
7 | 7 | // Includes the structural styles for the form field inherited from MDC. |
8 | 8 | @mixin private-text-field-structure { |
9 | | - $filled-slots: (tokens-mdc-filled-text-field.$prefix, |
10 | | - tokens-mdc-filled-text-field.get-token-slots()); |
11 | | - $outlined-slots: (tokens-mdc-outlined-text-field.$prefix, |
12 | | - tokens-mdc-outlined-text-field.get-token-slots()); |
| 9 | + $filled-slots: ( |
| 10 | + tokens-mdc-filled-text-field.$prefix, |
| 11 | + tokens-mdc-filled-text-field.get-token-slots() |
| 12 | + ); |
| 13 | + $outlined-slots: ( |
| 14 | + tokens-mdc-outlined-text-field.$prefix, |
| 15 | + tokens-mdc-outlined-text-field.get-token-slots() |
| 16 | + ); |
13 | 17 |
|
14 | 18 | .mdc-text-field { |
15 | 19 | display: inline-flex; |
|
124 | 128 | .mdc-text-field--outlined { |
125 | 129 | height: 56px; |
126 | 130 | overflow: visible; |
127 | | - padding-left: 16px; |
128 | | - padding-right: 16px; |
129 | 131 |
|
130 | | - @include _supports-max { |
131 | | - @include token-utils.use-tokens($outlined-slots...) { |
132 | | - $shape-var: token-utils.get-token-variable(container-shape); |
133 | | - padding-right: max(16px, #{$shape-var}); |
134 | | - padding-left: max(16px, calc(#{$shape-var} + 4px)); |
| 132 | + @include token-utils.use-tokens($outlined-slots...) { |
| 133 | + $shape-var: token-utils.get-token-variable(container-shape); |
| 134 | + padding-right: max(16px, #{$shape-var}); |
| 135 | + padding-left: max(16px, calc(#{$shape-var} + 4px)); |
135 | 136 |
|
136 | | - [dir='rtl'] & { |
137 | | - padding-right: max(16px, calc(#{$shape-var} + 4px)); |
138 | | - padding-left: max(16px, #{$shape-var}); |
139 | | - } |
| 137 | + [dir='rtl'] & { |
| 138 | + padding-right: max(16px, calc(#{$shape-var} + 4px)); |
| 139 | + padding-left: max(16px, #{$shape-var}); |
140 | 140 | } |
141 | 141 | } |
142 | 142 | } |
|
336 | 336 | border-right: none; |
337 | 337 | border-top-right-radius: 0; |
338 | 338 | border-bottom-right-radius: 0; |
339 | | - width: 12px; |
340 | 339 |
|
341 | 340 | @include token-utils.use-tokens($outlined-slots...) { |
342 | 341 | @include token-utils.create-token-slot(border-top-left-radius, container-shape); |
343 | 342 | @include token-utils.create-token-slot(border-bottom-left-radius, container-shape); |
344 | 343 |
|
345 | | - @include _supports-max { |
346 | | - .mdc-text-field--outlined .mdc-notched-outline & { |
347 | | - $shape-var: token-utils.get-token-variable(container-shape); |
348 | | - width: max(12px, #{$shape-var}); |
349 | | - } |
| 344 | + .mdc-text-field--outlined .mdc-notched-outline & { |
| 345 | + $shape-var: token-utils.get-token-variable(container-shape); |
| 346 | + width: max(12px, #{$shape-var}); |
350 | 347 | } |
351 | 348 | } |
352 | 349 |
|
|
391 | 388 | .mdc-notched-outline__notch { |
392 | 389 | flex: 0 0 auto; |
393 | 390 | width: auto; |
394 | | - max-width: calc(100% - 24px); |
395 | 391 |
|
396 | 392 | @include token-utils.use-tokens($outlined-slots...) { |
397 | | - @include _supports-max { |
398 | | - .mdc-text-field--outlined .mdc-notched-outline & { |
399 | | - $shape-var: token-utils.get-token-variable(container-shape); |
400 | | - max-width: calc(100% - max(12px, #{$shape-var}) * 2); |
401 | | - } |
| 393 | + .mdc-text-field--outlined .mdc-notched-outline & { |
| 394 | + $shape-var: token-utils.get-token-variable(container-shape); |
| 395 | + max-width: min( |
| 396 | + var(--mat-form-field-notch-max-width, 100%), |
| 397 | + calc(100% - max(12px, #{$shape-var}) * 2) |
| 398 | + ); |
402 | 399 | } |
403 | 400 | } |
404 | 401 |
|
|
414 | 411 | padding-left: 0; |
415 | 412 | padding-right: 8px; |
416 | 413 | border-top: none; |
| 414 | + --mat-form-field-notch-max-width: 100%; |
417 | 415 | } |
418 | 416 |
|
419 | 417 | [dir='rtl'] .mdc-notched-outline--notched & { |
|
427 | 425 | } |
428 | 426 |
|
429 | 427 | .mdc-line-ripple { |
430 | | - &::before, &::after { |
| 428 | + &::before, |
| 429 | + &::after { |
431 | 430 | position: absolute; |
432 | 431 | bottom: 0; |
433 | 432 | left: 0; |
|
453 | 452 | } |
454 | 453 |
|
455 | 454 | .mdc-text-field--filled.mdc-text-field--disabled & { |
456 | | - @include token-utils.create-token-slot(border-bottom-color, |
457 | | - disabled-active-indicator-color); |
| 455 | + @include token-utils.create-token-slot( |
| 456 | + border-bottom-color, |
| 457 | + disabled-active-indicator-color |
| 458 | + ); |
458 | 459 | } |
459 | 460 |
|
460 | 461 | #{$enabled-field}.mdc-text-field--invalid & { |
461 | 462 | @include token-utils.create-token-slot(border-bottom-color, error-active-indicator-color); |
462 | 463 | } |
463 | 464 |
|
464 | 465 | #{$enabled-field}.mdc-text-field--invalid:not(.mdc-text-field--focused):hover & { |
465 | | - @include token-utils.create-token-slot(border-bottom-color, |
466 | | - error-hover-active-indicator-color); |
| 466 | + @include token-utils.create-token-slot( |
| 467 | + border-bottom-color, |
| 468 | + error-hover-active-indicator-color |
| 469 | + ); |
467 | 470 | } |
468 | 471 | } |
469 | 472 | } |
|
475 | 478 |
|
476 | 479 | @include token-utils.use-tokens($filled-slots...) { |
477 | 480 | .mdc-text-field--filled & { |
478 | | - @include token-utils.create-token-slot(border-bottom-width, |
479 | | - focus-active-indicator-height); |
| 481 | + @include token-utils.create-token-slot( |
| 482 | + border-bottom-width, |
| 483 | + focus-active-indicator-height |
| 484 | + ); |
480 | 485 | } |
481 | 486 |
|
482 | 487 | .mdc-text-field--filled:not(.mdc-text-field--disabled) & { |
483 | 488 | @include token-utils.create-token-slot(border-bottom-color, focus-active-indicator-color); |
484 | 489 | } |
485 | 490 |
|
486 | 491 | .mdc-text-field--filled.mdc-text-field--invalid:not(.mdc-text-field--disabled) & { |
487 | | - @include token-utils.create-token-slot(border-bottom-color, |
488 | | - error-focus-active-indicator-color); |
| 492 | + @include token-utils.create-token-slot( |
| 493 | + border-bottom-color, |
| 494 | + error-focus-active-indicator-color |
| 495 | + ); |
489 | 496 | } |
490 | 497 | } |
491 | 498 | } |
|
565 | 572 | } |
566 | 573 | } |
567 | 574 |
|
568 | | -// Wraps the content in a `@supports` query targeting the `max` CSS function. |
569 | | -@mixin _supports-max { |
570 | | - // stylelint-disable material/no-prefixes |
571 | | - @supports (top: max(0%)) { |
572 | | - @content; |
573 | | - } |
574 | | - // stylelint-enable |
575 | | -} |
576 | | - |
577 | 575 | // Includes the animation styles for the form field inherited from MDC. |
578 | 576 | @mixin private-text-field-animations { |
579 | 577 | $timing-curve: cubic-bezier(0.4, 0, 0.2, 1); |
580 | 578 |
|
581 | 579 | .mdc-floating-label { |
582 | | - transition: transform 150ms $timing-curve, color 150ms $timing-curve; |
| 580 | + transition: |
| 581 | + transform 150ms $timing-curve, |
| 582 | + color 150ms $timing-curve; |
583 | 583 | } |
584 | 584 |
|
585 | 585 | .mdc-text-field__input { |
|
605 | 605 | } |
606 | 606 |
|
607 | 607 | .mdc-line-ripple::after { |
608 | | - transition: transform 180ms $timing-curve, opacity 180ms $timing-curve; |
| 608 | + transition: |
| 609 | + transform 180ms $timing-curve, |
| 610 | + opacity 180ms $timing-curve; |
609 | 611 | } |
610 | 612 | } |
0 commit comments