_select-filled.scss 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. //
  2. // Copyright 2020 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/menu-surface/mixins' as menu-surface-mixins;
  26. @use '@material/rtl/rtl';
  27. @use './select-icon-theme';
  28. @use './select-theme';
  29. @mixin static-styles($query: feature-targeting.all()) {
  30. $feat-structure: feature-targeting.create-target($query, structure);
  31. .mdc-select--filled {
  32. @include menu-surface-mixins.flatten-top-when-opened-below($query: $query);
  33. &.mdc-select--focused.mdc-line-ripple::after {
  34. @include feature-targeting.targets($feat-structure) {
  35. transform: scale(1, 2);
  36. opacity: 1;
  37. }
  38. }
  39. }
  40. }
  41. @mixin core-styles($query: feature-targeting.all()) {
  42. @include static-styles($query);
  43. $feat-structure: feature-targeting.create-target($query, structure);
  44. .mdc-select--filled {
  45. @include select-theme.filled-height(select-theme.$height, $query: $query);
  46. @include select-theme.filled-shape-radius(
  47. select-theme.$shape-radius,
  48. $query: $query
  49. );
  50. @include select-theme.container-fill-color(
  51. (
  52. default: select-theme.$fill-color,
  53. disabled: select-theme.$disabled-fill-color,
  54. ),
  55. $query: $query
  56. );
  57. @include select-theme.bottom-line-color(
  58. (
  59. default: select-theme.$bottom-line-idle-color,
  60. focus: primary,
  61. hover: select-theme.$bottom-line-hover-color,
  62. disabled: select-theme.$disabled-bottom-line-color,
  63. ),
  64. $query: $query
  65. );
  66. @include select-theme.truncate-floating-label-max-width(
  67. $leading-icon-size: 0,
  68. $dropdown-icon-size: select-icon-theme.$icon-size,
  69. $query: $query
  70. );
  71. .mdc-floating-label {
  72. @include feature-targeting.targets($feat-structure) {
  73. @include rtl.reflexive-position(
  74. left,
  75. select-theme.$outline-label-offset
  76. );
  77. }
  78. }
  79. &.mdc-select--with-leading-icon {
  80. @include select-theme.leading-icon-floating-label-position(
  81. select-icon-theme.$icon-size,
  82. $query: $query
  83. );
  84. @include select-theme.truncate-floating-label-max-width(
  85. $leading-icon-size: select-icon-theme.$icon-size,
  86. $dropdown-icon-size: select-icon-theme.$icon-size,
  87. $query: $query
  88. );
  89. }
  90. }
  91. .mdc-select--invalid {
  92. @include select-theme.bottom-line-color(
  93. (
  94. default: select-theme.$error-color,
  95. hover: select-theme.$error-color,
  96. focus: select-theme.$error-color,
  97. ),
  98. $query: $query
  99. );
  100. }
  101. }