_select-icon.scss 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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 './select-icon-theme';
  26. @mixin icon-core-styles($query: feature-targeting.all()) {
  27. $feat-structure: feature-targeting.create-target($query, structure);
  28. .mdc-select--with-leading-icon {
  29. @include _icon($query: $query);
  30. @include select-icon-theme.icon-horizontal-margins(
  31. $left: select-icon-theme.$icon-horizontal-margin,
  32. $right: select-icon-theme.$icon-horizontal-margin,
  33. $query: $query
  34. );
  35. }
  36. .mdc-select__icon:not([tabindex]),
  37. .mdc-select__icon[tabindex='-1'] {
  38. @include feature-targeting.targets($feat-structure) {
  39. cursor: default;
  40. pointer-events: none;
  41. }
  42. }
  43. }
  44. @mixin _icon($query: feature-targeting.all()) {
  45. $feat-structure: feature-targeting.create-target($query, structure);
  46. $feat-color: feature-targeting.create-target($query, color);
  47. .mdc-select__icon {
  48. @include feature-targeting.targets($feat-structure) {
  49. display: inline-block;
  50. box-sizing: border-box;
  51. border: none;
  52. text-decoration: none;
  53. cursor: pointer;
  54. user-select: none;
  55. flex-shrink: 0;
  56. align-self: center;
  57. }
  58. @include feature-targeting.targets($feat-color) {
  59. background-color: transparent;
  60. fill: currentColor;
  61. }
  62. }
  63. }