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/elevation/elevation';
|
27 | @use '@material/elevation/elevation-theme';
|
28 | @use '@material/feature-targeting/feature-targeting';
|
29 | @use '@material/ripple/ripple-theme';
|
30 | @use '@material/rtl/rtl';
|
31 | @use '@material/dom/dom';
|
32 | @use '@material/touch-target/touch-target';
|
33 | @use '@material/focus-ring/focus-ring';
|
34 | @use '@material/typography/typography';
|
35 | @use './button-shared-theme';
|
36 |
|
37 | @mixin static-styles($query: feature-targeting.all()) {
|
38 | @include _static-styles-base($query: $query);
|
39 | @include _typography-styles($query: $query);
|
40 | }
|
41 |
|
42 | @mixin _static-styles-base($query: feature-targeting.all()) {
|
43 | $feat-structure: feature-targeting.create-target($query, structure);
|
44 |
|
45 | @include touch-target.wrapper($query);
|
46 |
|
47 | @include elevation.overlay-common($query);
|
48 |
|
49 |
|
50 | .mdc-button {
|
51 | @include _root-structure($query);
|
52 |
|
53 |
|
54 |
|
55 |
|
56 | .mdc-button__icon {
|
57 | @include feature-targeting.targets($feat-structure) {
|
58 | @include _icon-structure;
|
59 | }
|
60 | }
|
61 |
|
62 | .mdc-button__label {
|
63 | @include feature-targeting.targets($feat-structure) {
|
64 |
|
65 |
|
66 |
|
67 | position: relative;
|
68 | }
|
69 | }
|
70 |
|
71 | .mdc-button__focus-ring {
|
72 | @include feature-targeting.targets($feat-structure) {
|
73 | display: none;
|
74 | }
|
75 | }
|
76 |
|
77 | @include ripple-theme.focus {
|
78 | .mdc-button__focus-ring {
|
79 | @include dom.forced-colors-mode($exclude-ie11: true) {
|
80 | @include focus-ring.focus-ring($query: $query);
|
81 |
|
82 | @include feature-targeting.targets($feat-structure) {
|
83 | display: block;
|
84 | }
|
85 | }
|
86 | }
|
87 | }
|
88 |
|
89 | .mdc-button__touch {
|
90 | @include touch-target.touch-target($query: $query);
|
91 | }
|
92 | }
|
93 |
|
94 | .mdc-button__label + .mdc-button__icon {
|
95 | @include feature-targeting.targets($feat-structure) {
|
96 | @include icon-trailing;
|
97 | }
|
98 | }
|
99 |
|
100 | svg.mdc-button__icon {
|
101 | @include feature-targeting.targets($feat-structure) {
|
102 | @include icon-svg;
|
103 | }
|
104 | }
|
105 |
|
106 | .mdc-button--touch {
|
107 |
|
108 |
|
109 | @include touch-target.margin(
|
110 | $component-height: button-shared-theme.$height,
|
111 | $query: $query
|
112 | );
|
113 | }
|
114 |
|
115 | }
|
116 |
|
117 | @mixin _typography-styles($query) {
|
118 | .mdc-button {
|
119 |
|
120 | @include typography.typography(
|
121 | button,
|
122 | $exclude-props: (
|
123 | font-size,
|
124 | line-height,
|
125 | font-weight,
|
126 | letter-spacing,
|
127 | text-transform
|
128 | ),
|
129 | $query: $query
|
130 | );
|
131 | }
|
132 | }
|
133 |
|
134 |
|
135 | @mixin deprecated-static-styles-without-ripple(
|
136 | $query: feature-targeting.all()
|
137 | ) {
|
138 | @include _deprecated-typography-styles($query: $query);
|
139 | @include _static-styles-base($query: $query);
|
140 | }
|
141 |
|
142 | @mixin _deprecated-typography-styles($query) {
|
143 | .mdc-button {
|
144 | @include typography.typography(button, $query);
|
145 | }
|
146 | }
|
147 |
|
148 | @mixin deprecated-base($query) {
|
149 | @include base($query);
|
150 | }
|
151 |
|
152 | @mixin base($query) {
|
153 | @include typography.typography(button, $query);
|
154 | @include _root-structure($query: $query);
|
155 | }
|
156 |
|
157 | @mixin _root-structure($query) {
|
158 | $feat-structure: feature-targeting.create-target($query, structure);
|
159 |
|
160 | @include elevation-theme.overlay-surface-position($query: $query);
|
161 | @include elevation-theme.overlay-dimensions(100%, $query: $query);
|
162 |
|
163 | @include feature-targeting.targets($feat-structure) {
|
164 | display: inline-flex;
|
165 |
|
166 | align-items: center;
|
167 | justify-content: center;
|
168 | box-sizing: border-box;
|
169 | min-width: 64px;
|
170 | border: none;
|
171 | outline: none;
|
172 |
|
173 | line-height: inherit;
|
174 | user-select: none;
|
175 | -webkit-appearance: none;
|
176 |
|
177 |
|
178 | overflow: visible;
|
179 | vertical-align: middle;
|
180 | background: transparent;
|
181 | }
|
182 |
|
183 | &::-moz-focus-inner {
|
184 | @include feature-targeting.targets($feat-structure) {
|
185 | padding: 0;
|
186 | border: 0;
|
187 | }
|
188 | }
|
189 |
|
190 |
|
191 | &:active {
|
192 | @include feature-targeting.targets($feat-structure) {
|
193 | outline: none;
|
194 | }
|
195 | }
|
196 |
|
197 | &:hover {
|
198 | @include feature-targeting.targets($feat-structure) {
|
199 | cursor: pointer;
|
200 | }
|
201 | }
|
202 |
|
203 | &:disabled {
|
204 | @include feature-targeting.targets($feat-structure) {
|
205 | cursor: default;
|
206 | pointer-events: none;
|
207 | }
|
208 | }
|
209 | }
|
210 |
|
211 | @mixin icon {
|
212 | @include _icon-structure;
|
213 | @include _icon-size(18px);
|
214 | }
|
215 |
|
216 | @mixin _icon-structure {
|
217 | @include rtl.reflexive-box(margin, right, 8px);
|
218 |
|
219 | display: inline-block;
|
220 | position: relative;
|
221 | vertical-align: top;
|
222 | }
|
223 |
|
224 | @mixin _icon-size($size-px) {
|
225 | $icon-size: typography.px-to-rem($size-px);
|
226 |
|
227 | font-size: $icon-size;
|
228 | height: $icon-size;
|
229 | width: $icon-size;
|
230 | }
|
231 |
|
232 | @mixin icon-trailing {
|
233 | @include rtl.reflexive-box(margin, left, 8px);
|
234 | }
|
235 |
|
236 | @mixin icon-svg {
|
237 | fill: currentColor;
|
238 | }
|
239 |
|
240 | @mixin icon-contained {
|
241 | @include rtl.reflexive-property(margin, -4px, 8px);
|
242 | }
|
243 |
|
244 | @mixin icon-contained-trailing {
|
245 | @include rtl.reflexive-property(margin, 8px, -4px);
|
246 | }
|
247 |
|
248 | @mixin raised-transition($query: feature-targeting.all()) {
|
249 | $feat-animation: feature-targeting.create-target($query, animation);
|
250 |
|
251 | @include feature-targeting.targets($feat-animation) {
|
252 | transition: elevation-theme.transition-value();
|
253 | }
|
254 | }
|
255 |
|
256 |
|
257 | @mixin deprecated-icon {
|
258 | @include icon;
|
259 | }
|
260 |
|
261 |
|
262 | @mixin deprecated-icon-trailing {
|
263 | @include icon-trailing;
|
264 | }
|
265 |
|
266 |
|
267 | @mixin deprecated-icon-svg {
|
268 | @include icon-svg;
|
269 | }
|
270 |
|
271 |
|
272 | @mixin deprecated-icon-contained {
|
273 | @include icon-contained;
|
274 | }
|
275 |
|
276 |
|
277 | @mixin deprecated-icon-contained-trailing {
|
278 | @include icon-contained-trailing;
|
279 | }
|