_notched-outline.scss 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. //
  2. // Copyright 2018 Google Inc.
  3. //
  4. // Permission is hereby granted, free of charge, to any person obtaining a copy
  5. // of this software and associated documentation files (the "Software"), to deal
  6. // in the Software without restriction, including without limitation the rights
  7. // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  8. // copies of the Software, and to permit persons to whom the Software is
  9. // furnished to do so, subject to the following conditions:
  10. //
  11. // The above copyright notice and this permission notice shall be included in
  12. // all copies or substantial portions of the Software.
  13. //
  14. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  19. // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  20. // THE SOFTWARE.
  21. //
  22. // stylelint-disable selector-class-pattern --
  23. // Selector '.mdc-*' should only be used in this project.
  24. @use '@material/feature-targeting/feature-targeting';
  25. @use '@material/rtl/rtl';
  26. @use './notched-outline-theme';
  27. @mixin core-styles($query: feature-targeting.all()) {
  28. @include static-styles($query);
  29. @include notched-outline-theme.theme-styles($query);
  30. }
  31. @mixin static-styles($query: feature-targeting.all()) {
  32. $feat-structure: feature-targeting.create-target($query, structure);
  33. .mdc-notched-outline {
  34. @include feature-targeting.targets($feat-structure) {
  35. display: flex;
  36. position: absolute;
  37. top: 0;
  38. right: 0;
  39. left: 0;
  40. box-sizing: border-box;
  41. width: 100%;
  42. max-width: 100%;
  43. height: 100%;
  44. @include rtl.ignore-next-line();
  45. text-align: left;
  46. pointer-events: none;
  47. @include rtl.rtl {
  48. @include rtl.ignore-next-line();
  49. text-align: right;
  50. }
  51. }
  52. &__leading,
  53. &__notch,
  54. &__trailing {
  55. @include feature-targeting.targets($feat-structure) {
  56. box-sizing: border-box;
  57. height: 100%;
  58. pointer-events: none;
  59. }
  60. }
  61. &__trailing {
  62. @include feature-targeting.targets($feat-structure) {
  63. flex-grow: 1;
  64. }
  65. }
  66. &__notch {
  67. @include feature-targeting.targets($feat-structure) {
  68. flex: 0 0 auto;
  69. width: auto;
  70. }
  71. }
  72. .mdc-floating-label {
  73. @include feature-targeting.targets($feat-structure) {
  74. display: inline-block;
  75. position: relative;
  76. max-width: 100%;
  77. }
  78. }
  79. .mdc-floating-label--float-above {
  80. @include feature-targeting.targets($feat-structure) {
  81. text-overflow: clip;
  82. }
  83. }
  84. &--upgraded .mdc-floating-label--float-above {
  85. @include feature-targeting.targets($feat-structure) {
  86. max-width: calc(100% / 0.75);
  87. }
  88. }
  89. }
  90. .mdc-notched-outline--notched {
  91. .mdc-notched-outline__notch {
  92. @include feature-targeting.targets($feat-structure) {
  93. @include rtl.reflexive-box(padding, right, 8px);
  94. border-top: none;
  95. }
  96. }
  97. }
  98. .mdc-notched-outline--no-label {
  99. .mdc-notched-outline__notch {
  100. @include feature-targeting.targets($feat-structure) {
  101. display: none;
  102. }
  103. }
  104. }
  105. }