|
20 | 20 | // THE SOFTWARE.
|
21 | 21 | //
|
22 | 22 |
|
23 |
| -@import "@material/ripple/common"; |
| 23 | +@import "@material/feature-targeting/functions"; |
| 24 | +@import "@material/feature-targeting/mixins"; |
24 | 25 | @import "@material/ripple/mixins";
|
25 | 26 | @import "@material/theme/mixins";
|
26 | 27 | @import "./variables";
|
27 | 28 |
|
28 |
| -@mixin mdc-icon-button-size($width, $height: $width, $padding: max($width, $height)/2) { |
29 |
| - width: $width + $padding * 2; |
30 |
| - height: $height + $padding * 2; |
31 |
| - padding: $padding; |
32 |
| - font-size: max($width, $height); |
| 29 | +@mixin mdc-icon-button-core-styles($query: mdc-feature-all()) { |
| 30 | + @include mdc-icon-button-without-ripple($query); |
| 31 | + @include mdc-icon-button-ripple($query); |
| 32 | +} |
| 33 | + |
| 34 | +@mixin mdc-icon-button-without-ripple($query: mdc-feature-all()) { |
| 35 | + $feat-structure: mdc-feature-create-target($query, structure); |
| 36 | + |
| 37 | + // postcss-bem-linter: define icon-button |
| 38 | + .mdc-icon-button { |
| 39 | + @include mdc-icon-button-base_($query: $query); |
| 40 | + } |
| 41 | + |
| 42 | + .mdc-icon-button__icon { |
| 43 | + @include mdc-feature-targets($feat-structure) { |
| 44 | + display: inline-block; |
| 45 | + } |
| 46 | + |
| 47 | + // stylelint-disable-next-line plugin/selector-bem-pattern |
| 48 | + &.mdc-icon-button__icon--on { |
| 49 | + @include mdc-feature-targets($feat-structure) { |
| 50 | + display: none; |
| 51 | + } |
| 52 | + } |
| 53 | + } |
| 54 | + |
| 55 | + .mdc-icon-button--on { |
| 56 | + .mdc-icon-button__icon { |
| 57 | + @include mdc-feature-targets($feat-structure) { |
| 58 | + display: none; |
| 59 | + } |
| 60 | + |
| 61 | + // stylelint-disable-next-line plugin/selector-bem-pattern |
| 62 | + &.mdc-icon-button__icon--on { |
| 63 | + @include mdc-feature-targets($feat-structure) { |
| 64 | + display: inline-block; |
| 65 | + } |
| 66 | + } |
| 67 | + } |
| 68 | + } |
| 69 | + // postcss-bem-linter: end |
| 70 | +} |
| 71 | + |
| 72 | +@mixin mdc-icon-button-ripple($query: mdc-feature-all()) { |
| 73 | + @include mdc-ripple-common($query); |
| 74 | + |
| 75 | + .mdc-icon-button { |
| 76 | + @include mdc-ripple-surface($query: $query); |
| 77 | + @include mdc-ripple-radius-unbounded($query: $query); |
| 78 | + @include mdc-states($query: $query); |
| 79 | + } |
| 80 | +} |
| 81 | + |
| 82 | +@mixin mdc-icon-button-size($width, $height: $width, $padding: max($width, $height)/2, $query: mdc-feature-all()) { |
| 83 | + $feat-structure: mdc-feature-create-target($query, structure); |
| 84 | + |
| 85 | + @include mdc-feature-targets($feat-structure) { |
| 86 | + width: $width + $padding * 2; |
| 87 | + height: $height + $padding * 2; |
| 88 | + padding: $padding; |
| 89 | + font-size: max($width, $height); |
| 90 | + } |
33 | 91 |
|
34 | 92 | // stylelint-disable-next-line selector-max-type
|
35 | 93 | svg,
|
36 | 94 | img {
|
37 |
| - width: $width; |
38 |
| - height: $height; |
| 95 | + @include mdc-feature-targets($feat-structure) { |
| 96 | + width: $width; |
| 97 | + height: $height; |
| 98 | + } |
39 | 99 | }
|
40 | 100 | }
|
41 | 101 |
|
42 |
| -@mixin mdc-icon-button-ink-color($color) { |
43 |
| - @include mdc-theme-prop(color, $color); |
44 |
| - @include mdc-states($color); |
| 102 | +@mixin mdc-icon-button-ink-color($color, $query: mdc-feature-all()) { |
| 103 | + $feat-color: mdc-feature-create-target($query, color); |
| 104 | + |
| 105 | + @include mdc-feature-targets($feat-color) { |
| 106 | + @include mdc-theme-prop(color, $color); |
| 107 | + } |
| 108 | + |
| 109 | + @include mdc-states($color, $query: $query); |
45 | 110 | }
|
46 | 111 |
|
47 |
| -@mixin mdc-icon-button-base_() { |
48 |
| - @include mdc-ripple-surface; |
49 |
| - @include mdc-ripple-radius-unbounded; |
50 |
| - @include mdc-icon-button-size($mdc-icon-button-size); |
51 |
| - |
52 |
| - display: inline-block; |
53 |
| - position: relative; |
54 |
| - box-sizing: border-box; |
55 |
| - border: none; |
56 |
| - outline: none; |
57 |
| - background-color: transparent; |
58 |
| - fill: currentColor; |
59 |
| - color: inherit; |
60 |
| - text-decoration: none; |
61 |
| - cursor: pointer; |
62 |
| - user-select: none; |
| 112 | +@mixin mdc-icon-button-base_($query: mdc-feature-all()) { |
| 113 | + $feat-color: mdc-feature-create-target($query, color); |
| 114 | + $feat-structure: mdc-feature-create-target($query, structure); |
| 115 | + |
| 116 | + @include mdc-icon-button-size($mdc-icon-button-size, $query: $query); |
| 117 | + |
| 118 | + @include mdc-feature-targets($feat-structure) { |
| 119 | + display: inline-block; |
| 120 | + position: relative; |
| 121 | + box-sizing: border-box; |
| 122 | + border: none; |
| 123 | + outline: none; |
| 124 | + background-color: transparent; |
| 125 | + fill: currentColor; |
| 126 | + color: inherit; |
| 127 | + text-decoration: none; |
| 128 | + cursor: pointer; |
| 129 | + user-select: none; |
| 130 | + } |
63 | 131 |
|
64 | 132 | &:disabled {
|
65 |
| - @include mdc-theme-prop(color, text-disabled-on-light); |
| 133 | + @include mdc-feature-targets($feat-color) { |
| 134 | + @include mdc-theme-prop(color, text-disabled-on-light); |
| 135 | + } |
66 | 136 |
|
67 |
| - cursor: default; |
68 |
| - pointer-events: none; |
| 137 | + @include mdc-feature-targets($feat-structure) { |
| 138 | + cursor: default; |
| 139 | + pointer-events: none; |
| 140 | + } |
69 | 141 | }
|
70 | 142 | }
|
0 commit comments