1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 | @use '@material/feature-targeting/feature-targeting';
|
27 | @use '@material/ripple/ripple';
|
28 | @use '@material/ripple/ripple-theme';
|
29 | @use '@material/touch-target/mixins' as touch-target-mixins;
|
30 | @use './icon-button-theme';
|
31 |
|
32 | @mixin core-styles($query: feature-targeting.all()) {
|
33 | @include without-ripple($query);
|
34 | @include ripple($query);
|
35 | }
|
36 |
|
37 | @mixin static-styles($query: feature-targeting.all()) {
|
38 | $feat-structure: feature-targeting.create-target($query, structure);
|
39 |
|
40 |
|
41 | .mdc-icon-button {
|
42 | @include feature-targeting.targets($feat-structure) {
|
43 | display: inline-block;
|
44 | position: relative;
|
45 | box-sizing: border-box;
|
46 | border: none;
|
47 | outline: none;
|
48 | background-color: transparent;
|
49 | fill: currentColor;
|
50 | color: inherit;
|
51 | text-decoration: none;
|
52 | cursor: pointer;
|
53 | user-select: none;
|
54 | z-index: 0;
|
55 | overflow: visible;
|
56 | }
|
57 |
|
58 | .mdc-icon-button__touch {
|
59 | @include touch-target-mixins.touch-target(
|
60 | $set-width: true,
|
61 | $query: $query
|
62 | );
|
63 | }
|
64 |
|
65 | @include if-disabled_ {
|
66 | @include feature-targeting.targets($feat-structure) {
|
67 | cursor: default;
|
68 | pointer-events: none;
|
69 | }
|
70 | }
|
71 | }
|
72 |
|
73 | .mdc-icon-button--display-flex {
|
74 | @include feature-targeting.targets($feat-structure) {
|
75 | align-items: center;
|
76 | display: inline-flex;
|
77 | justify-content: center;
|
78 | }
|
79 | }
|
80 |
|
81 | .mdc-icon-button__icon {
|
82 | @include feature-targeting.targets($feat-structure) {
|
83 | display: inline-block;
|
84 | }
|
85 |
|
86 | &.mdc-icon-button__icon--on {
|
87 | @include feature-targeting.targets($feat-structure) {
|
88 | display: none;
|
89 | }
|
90 | }
|
91 | }
|
92 |
|
93 | .mdc-icon-button--on {
|
94 | .mdc-icon-button__icon {
|
95 | @include feature-targeting.targets($feat-structure) {
|
96 | display: none;
|
97 | }
|
98 |
|
99 | &.mdc-icon-button__icon--on {
|
100 | @include feature-targeting.targets($feat-structure) {
|
101 | display: inline-block;
|
102 | }
|
103 | }
|
104 | }
|
105 | }
|
106 |
|
107 |
|
108 | .mdc-icon-button__link {
|
109 | @include feature-targeting.targets($feat-structure) {
|
110 | height: 100%;
|
111 | left: 0;
|
112 | outline: none;
|
113 | position: absolute;
|
114 | top: 0;
|
115 | width: 100%;
|
116 | }
|
117 | }
|
118 | }
|
119 |
|
120 | @mixin without-ripple($query: feature-targeting.all()) {
|
121 | $feat-structure: feature-targeting.create-target($query, structure);
|
122 |
|
123 | .mdc-icon-button {
|
124 | @include feature-targeting.targets($feat-structure) {
|
125 | font-size: icon-button-theme.$icon-size;
|
126 | }
|
127 |
|
128 | @include icon-button-theme.density(0, $query: $query);
|
129 |
|
130 | @include icon-button-theme.disabled-ink-color(
|
131 | text-disabled-on-light,
|
132 | $query: $query
|
133 | );
|
134 |
|
135 | svg,
|
136 | img {
|
137 | @include feature-targeting.targets($feat-structure) {
|
138 | width: icon-button-theme.$icon-size;
|
139 | height: icon-button-theme.$icon-size;
|
140 | }
|
141 | }
|
142 | }
|
143 |
|
144 | @include static-styles($query: $query);
|
145 | }
|
146 |
|
147 | @mixin ripple($query: feature-targeting.all()) {
|
148 | @include ripple.common($query);
|
149 |
|
150 | .mdc-icon-button {
|
151 | @include ripple.surface(
|
152 | $query: $query,
|
153 | $ripple-target: icon-button-theme.$ripple-target
|
154 | );
|
155 | @include ripple.radius-unbounded(
|
156 | $query: $query,
|
157 | $ripple-target: icon-button-theme.$ripple-target
|
158 | );
|
159 | @include ripple-theme.states(
|
160 | $query: $query,
|
161 | $ripple-target: icon-button-theme.$ripple-target
|
162 | );
|
163 |
|
164 | .mdc-icon-button__ripple {
|
165 | $feat-structure: feature-targeting.create-target($query, structure);
|
166 | @include feature-targeting.targets($feat-structure) {
|
167 | height: 100%;
|
168 | left: 0px;
|
169 | pointer-events: none;
|
170 | position: absolute;
|
171 | top: 0px;
|
172 | width: 100%;
|
173 | z-index: -1;
|
174 | }
|
175 | }
|
176 | }
|
177 | }
|
178 |
|
179 |
|
180 |
|
181 |
|
182 |
|
183 | @mixin if-disabled_ {
|
184 | &:disabled {
|
185 | @content;
|
186 | }
|
187 | }
|