material_components_web-sass 0.22.0 → 0.23.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,33 @@
1
+ //
2
+ // Copyright 2016 Google Inc. All Rights Reserved.
3
+ //
4
+ // Licensed under the Apache License, Version 2.0 (the "License");
5
+ // you may not use this file except in compliance with the License.
6
+ // You may obtain a copy of the License at
7
+ //
8
+ // http://www.apache.org/licenses/LICENSE-2.0
9
+ //
10
+ // Unless required by applicable law or agreed to in writing, software
11
+ // distributed under the License is distributed on an "AS IS" BASIS,
12
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ // See the License for the specific language governing permissions and
14
+ // limitations under the License.
15
+ //
16
+
17
+ @import "@material/theme/functions";
18
+
19
+ $mdc-checkbox-container-keyframes-uid_: -1;
20
+
21
+ @function mdc-checkbox-transition-enter($property, $delay: 0ms, $duration: $mdc-checkbox-transition-duration) {
22
+ @return mdc-animation-enter($property, $duration, $delay);
23
+ }
24
+
25
+ @function mdc-checkbox-transition-exit($property, $delay: 0ms, $duration: $mdc-checkbox-transition-duration) {
26
+ @return mdc-animation-exit-temporary($property, $duration, $delay);
27
+ }
28
+
29
+ @function mdc-checkbox-container-keyframes-uid_() {
30
+ $mdc-checkbox-container-keyframes-uid_: $mdc-checkbox-container-keyframes-uid_ + 1 !global;
31
+
32
+ @return $mdc-checkbox-container-keyframes-uid_;
33
+ }
@@ -18,60 +18,42 @@
18
18
  @import "@material/theme/mixins";
19
19
  @import "./variables";
20
20
 
21
- @keyframes mdc-checkbox-fade-in-background {
22
- 0% {
23
- border-color: $mdc-checkbox-border-color;
24
- background-color: transparent;
25
- }
26
-
27
- 50% {
28
- @include mdc-theme-prop(border-color, primary);
29
- @include mdc-theme-prop(background-color, primary);
30
- }
31
- }
32
-
33
- @keyframes mdc-checkbox-fade-out-background {
34
- 0%,
35
- 80% {
36
- @include mdc-theme-prop(border-color, primary);
37
- @include mdc-theme-prop(background-color, primary);
38
- }
39
-
40
- 100% {
41
- border-color: $mdc-checkbox-border-color;
42
- background-color: transparent;
43
- }
44
- }
45
-
46
- @keyframes mdc-checkbox-fade-in-background-dark {
47
- 0% {
48
- border-color: $mdc-checkbox-border-color-dark;
49
- background-color: transparent;
50
- }
51
-
52
- 50% {
53
- @include mdc-theme-prop(border-color, primary);
54
- @include mdc-theme-prop(background-color, primary);
55
- }
56
- }
57
-
58
- @keyframes mdc-checkbox-fade-out-background-dark {
59
- 0%,
60
- 80% {
61
- @include mdc-theme-prop(border-color, primary);
62
- @include mdc-theme-prop(background-color, primary);
63
- }
64
-
65
- 100% {
66
- border-color: $mdc-checkbox-border-color-dark;
67
- background-color: transparent;
21
+ @mixin mdc-checkbox-container-keyframes_(
22
+ $from-stroke-color,
23
+ $to-stroke-color,
24
+ $from-fill-color,
25
+ $to-fill-color,
26
+ $uid) {
27
+ @keyframes mdc-checkbox-fade-in-background-#{$uid} {
28
+ 0% {
29
+ @include mdc-theme-prop(border-color, $from-stroke-color);
30
+ @include mdc-theme-prop(background-color, $from-fill-color);
31
+ }
32
+
33
+ 50% {
34
+ @include mdc-theme-prop(border-color, $to-stroke-color);
35
+ @include mdc-theme-prop(background-color, $to-fill-color);
36
+ }
37
+ }
38
+
39
+ @keyframes mdc-checkbox-fade-out-background-#{$uid} {
40
+ 0%,
41
+ 80% {
42
+ @include mdc-theme-prop(border-color, $to-stroke-color);
43
+ @include mdc-theme-prop(background-color, $to-fill-color);
44
+ }
45
+
46
+ 100% {
47
+ @include mdc-theme-prop(border-color, $from-stroke-color);
48
+ @include mdc-theme-prop(background-color, $from-fill-color);
49
+ }
68
50
  }
69
51
  }
70
52
 
71
53
  @keyframes mdc-checkbox-unchecked-checked-checkmark-path {
72
54
  0%,
73
55
  50% {
74
- stroke-dashoffset: $_mdc-checkbox-mark-path-length;
56
+ stroke-dashoffset: $mdc-checkbox-mark-path-length_;
75
57
  }
76
58
 
77
59
  50% {
@@ -107,7 +89,7 @@
107
89
 
108
90
  to {
109
91
  opacity: 0;
110
- stroke-dashoffset: $_mdc-checkbox-mark-path-length * -1;
92
+ stroke-dashoffset: $mdc-checkbox-mark-path-length_ * -1;
111
93
  }
112
94
  }
113
95
 
@@ -126,7 +108,7 @@
126
108
 
127
109
  @keyframes mdc-checkbox-indeterminate-checked-checkmark {
128
110
  from {
129
- animation-timing-function: $_mdc-checkbox-indeterminate-checked-easing-function;
111
+ animation-timing-function: $mdc-checkbox-indeterminate-checked-easing-function_;
130
112
  transform: rotate(45deg);
131
113
  opacity: 0;
132
114
  }
@@ -152,7 +134,7 @@
152
134
 
153
135
  @keyframes mdc-checkbox-indeterminate-checked-mixedmark {
154
136
  from {
155
- animation-timing-function: $_mdc-checkbox-indeterminate-checked-easing-function;
137
+ animation-timing-function: $mdc-checkbox-indeterminate-checked-easing-function_;
156
138
  transform: rotate(0deg);
157
139
  opacity: 1;
158
140
  }
@@ -0,0 +1,395 @@
1
+ //
2
+ // Copyright 2016 Google Inc. All Rights Reserved.
3
+ //
4
+ // Licensed under the Apache License, Version 2.0 (the "License");
5
+ // you may not use this file except in compliance with the License.
6
+ // You may obtain a copy of the License at
7
+ //
8
+ // http://www.apache.org/licenses/LICENSE-2.0
9
+ //
10
+ // Unless required by applicable law or agreed to in writing, software
11
+ // distributed under the License is distributed on an "AS IS" BASIS,
12
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ // See the License for the specific language governing permissions and
14
+ // limitations under the License.
15
+ //
16
+
17
+ @import "@material/animation/functions";
18
+ @import "@material/ripple/mixins";
19
+ @import "@material/rtl/mixins";
20
+ @import "./functions";
21
+ @import "./keyframes";
22
+ @import "./variables";
23
+
24
+ //
25
+ // Public
26
+ //
27
+
28
+ @mixin mdc-checkbox-container-colors(
29
+ $unmarked-stroke-color: $mdc-checkbox-border-color,
30
+ $unmarked-fill-color: transparent,
31
+ $marked-fill-color: $mdc-checkbox-baseline-theme-color,
32
+ $generate-keyframes: true) {
33
+ @include mdc-checkbox-unmarked-background-selector-enabled_ {
34
+ @include mdc-theme-prop(border-color, $unmarked-stroke-color);
35
+ @include mdc-theme-prop(background-color, $unmarked-fill-color);
36
+ }
37
+
38
+ @include mdc-checkbox-marked-background-selector-enabled_ {
39
+ @include mdc-theme-prop(border-color, $marked-fill-color);
40
+ @include mdc-theme-prop(background-color, $marked-fill-color);
41
+ }
42
+
43
+ @if $generate-keyframes {
44
+ $uid: mdc-checkbox-container-keyframes-uid_();
45
+
46
+ @include mdc-checkbox-container-keyframes_(
47
+ $from-stroke-color: $unmarked-stroke-color,
48
+ $to-stroke-color: $marked-fill-color,
49
+ $from-fill-color: $unmarked-fill-color,
50
+ $to-fill-color: $marked-fill-color,
51
+ $uid: $uid);
52
+
53
+ &.mdc-checkbox--anim {
54
+ &-unchecked-checked,
55
+ &-unchecked-indeterminate {
56
+ .mdc-checkbox__native-control:enabled ~ .mdc-checkbox__background {
57
+ animation-name: mdc-checkbox-fade-in-background-#{$uid};
58
+ }
59
+ }
60
+
61
+ &-checked-unchecked,
62
+ &-indeterminate-unchecked {
63
+ .mdc-checkbox__native-control:enabled ~ .mdc-checkbox__background {
64
+ animation-name: mdc-checkbox-fade-out-background-#{$uid};
65
+ }
66
+ }
67
+ }
68
+ }
69
+ }
70
+
71
+ @mixin mdc-checkbox-ink-color($color) {
72
+ .mdc-checkbox__checkmark__path {
73
+ // !important is needed here because a stroke must be set as an attribute on the SVG in order
74
+ // for line animation to work properly.
75
+ @include mdc-theme-prop(stroke, $color, $important: true);
76
+ }
77
+
78
+ .mdc-checkbox__mixedmark {
79
+ @include mdc-theme-prop(background-color, $color);
80
+ }
81
+ }
82
+
83
+ @mixin mdc-checkbox-focus-indicator-color($color) {
84
+ // The ::before element is used as a focus indicator for the checkbox
85
+ .mdc-checkbox__background::before {
86
+ @include mdc-theme-prop(background-color, $color, $edgeOptOut: true);
87
+ }
88
+ }
89
+
90
+ @mixin mdc-checkbox-ripple($ripple-config) {
91
+ $ripple-config: map-merge((opacity: $mdc-checkbox-ripple-opacity, radius: 50%), $ripple-config);
92
+
93
+ @include mdc-ripple-bg(map-merge((pseudo: "::before"), $ripple-config));
94
+ @include mdc-ripple-fg(map-merge((pseudo: "::after"), $ripple-config));
95
+ }
96
+
97
+ //
98
+ // Private
99
+ //
100
+
101
+ @mixin mdc-checkbox-base_ {
102
+ display: inline-block;
103
+ position: relative;
104
+ flex: 0 0 $mdc-checkbox-size;
105
+ box-sizing: content-box;
106
+ width: $mdc-checkbox-size;
107
+ height: $mdc-checkbox-size;
108
+ padding: ($mdc-checkbox-touch-area - $mdc-checkbox-size) / 2;
109
+ line-height: 0;
110
+ white-space: nowrap;
111
+ cursor: pointer;
112
+ vertical-align: bottom;
113
+
114
+ @include mdc-checkbox-unmarked-background-selector-disabled_ {
115
+ @include mdc-theme-prop(border-color, $mdc-checkbox-disabled-color);
116
+ }
117
+
118
+ @include mdc-checkbox-marked-background-selector-disabled_ {
119
+ @include mdc-theme-prop(border-color, transparent);
120
+ @include mdc-theme-prop(background-color, $mdc-checkbox-disabled-color);
121
+ }
122
+
123
+ @include mdc-theme-dark {
124
+ @include mdc-checkbox-unmarked-background-selector-disabled_ {
125
+ @include mdc-theme-prop(border-color, $mdc-checkbox-disabled-color-dark);
126
+ }
127
+
128
+ @include mdc-checkbox-marked-background-selector-disabled_ {
129
+ @include mdc-theme-prop(background-color, $mdc-checkbox-disabled-color-dark);
130
+ }
131
+ }
132
+ }
133
+
134
+ @mixin mdc-checkbox--disabled_ {
135
+ cursor: default;
136
+ pointer-events: none;
137
+ }
138
+
139
+ @mixin mdc-checkbox__child--cover-parent_ {
140
+ position: absolute;
141
+ top: 0;
142
+ right: 0;
143
+ bottom: 0;
144
+ left: 0;
145
+ }
146
+
147
+ @mixin mdc-checkbox__child--upgraded_ {
148
+ // Due to the myriad of selector combos used to properly style a CSS-only checkbox, all of
149
+ // which have varying selector precedence and make use of transitions, it is cleaner and more
150
+ // efficient here to simply use !important, since the mdc-checkbox--anim-* classes will take
151
+ // over from here.
152
+ transition: none !important;
153
+ }
154
+
155
+ // Animation
156
+
157
+ @mixin mdc-checkbox--anim_ {
158
+ $mdc-checkbox-indeterminate-change-duration_: 500ms;
159
+
160
+ // stylelint-disable selector-max-type
161
+
162
+ &-unchecked-checked,
163
+ &-unchecked-indeterminate,
164
+ &-checked-unchecked,
165
+ &-indeterminate-unchecked {
166
+ .mdc-checkbox__background {
167
+ animation-duration: $mdc-checkbox-transition-duration * 2;
168
+ animation-timing-function: linear;
169
+ }
170
+ }
171
+
172
+ &-unchecked-checked {
173
+ .mdc-checkbox__checkmark__path {
174
+ // Instead of delaying the animation, we simply multiply its length by 2 and begin the
175
+ // animation at 50% in order to prevent a flash of styles applied to a checked checkmark
176
+ // as the background is fading in before the animation begins.
177
+ animation: $mdc-checkbox-transition-duration * 2 linear 0s mdc-checkbox-unchecked-checked-checkmark-path;
178
+ transition: none;
179
+ }
180
+ }
181
+
182
+ &-unchecked-indeterminate {
183
+ .mdc-checkbox__mixedmark {
184
+ animation: $mdc-checkbox-transition-duration linear 0s mdc-checkbox-unchecked-indeterminate-mixedmark;
185
+ transition: none;
186
+ }
187
+ }
188
+
189
+ &-checked-unchecked {
190
+ .mdc-checkbox__checkmark__path {
191
+ animation: $mdc-checkbox-transition-duration linear 0s mdc-checkbox-checked-unchecked-checkmark-path;
192
+ transition: none;
193
+ }
194
+ }
195
+
196
+ &-checked-indeterminate {
197
+ .mdc-checkbox__checkmark {
198
+ animation: $mdc-checkbox-transition-duration linear 0s mdc-checkbox-checked-indeterminate-checkmark;
199
+ transition: none;
200
+ }
201
+
202
+ .mdc-checkbox__mixedmark {
203
+ animation: $mdc-checkbox-transition-duration linear 0s mdc-checkbox-checked-indeterminate-mixedmark;
204
+ transition: none;
205
+ }
206
+ }
207
+
208
+ &-indeterminate-checked {
209
+ .mdc-checkbox__checkmark {
210
+ animation: $mdc-checkbox-indeterminate-change-duration_ linear 0s mdc-checkbox-indeterminate-checked-checkmark;
211
+ transition: none;
212
+ }
213
+
214
+ .mdc-checkbox__mixedmark {
215
+ animation: $mdc-checkbox-indeterminate-change-duration_ linear 0s mdc-checkbox-indeterminate-checked-mixedmark;
216
+ transition: none;
217
+ }
218
+ }
219
+
220
+ &-indeterminate-unchecked {
221
+ .mdc-checkbox__mixedmark {
222
+ animation: $mdc-checkbox-indeterminate-change-duration_ * .6 linear 0s mdc-checkbox-indeterminate-unchecked-mixedmark;
223
+ transition: none;
224
+ }
225
+ }
226
+
227
+ // stylelint-enable selector-max-type
228
+ }
229
+
230
+ // Background
231
+
232
+ @mixin mdc-checkbox-unmarked-background-selector-enabled_ {
233
+ // stylelint-disable-next-line selector-max-specificity
234
+ .mdc-checkbox__native-control:enabled:not(:checked):not(:indeterminate) ~ .mdc-checkbox__background {
235
+ @content;
236
+ }
237
+ }
238
+
239
+ @mixin mdc-checkbox-unmarked-background-selector-disabled_ {
240
+ // stylelint-disable-next-line selector-max-specificity
241
+ .mdc-checkbox__native-control:disabled:not(:checked):not(:indeterminate) ~ .mdc-checkbox__background {
242
+ @content;
243
+ }
244
+ }
245
+
246
+ @mixin mdc-checkbox-marked-background-selector-enabled_ {
247
+ .mdc-checkbox__native-control:enabled:checked ~ .mdc-checkbox__background,
248
+ .mdc-checkbox__native-control:enabled:indeterminate ~ .mdc-checkbox__background {
249
+ @content;
250
+ }
251
+ }
252
+
253
+ @mixin mdc-checkbox-marked-background-selector-disabled_ {
254
+ .mdc-checkbox__native-control:disabled:checked ~ .mdc-checkbox__background,
255
+ .mdc-checkbox__native-control:disabled:indeterminate ~ .mdc-checkbox__background {
256
+ @content;
257
+ }
258
+ }
259
+
260
+ @mixin mdc-checkbox__background_ {
261
+ @include mdc-checkbox__child--cover-parent_;
262
+ @include mdc-rtl-reflexive-position(
263
+ left, ($mdc-checkbox-touch-area - $mdc-checkbox-size) / 2, ".mdc-checkbox");
264
+
265
+ display: inline-flex;
266
+ top: ($mdc-checkbox-touch-area - $mdc-checkbox-size) / 2;
267
+ align-items: center;
268
+ justify-content: center;
269
+ box-sizing: border-box;
270
+ width: $mdc-checkbox-ui-pct;
271
+ height: $mdc-checkbox-ui-pct;
272
+ transition:
273
+ mdc-checkbox-transition-exit(background-color),
274
+ mdc-checkbox-transition-exit(border-color);
275
+ // border-color is overridden by the mdc-checkbox-unmarked-stroke-color() mixin
276
+ border: $mdc-checkbox-border-width solid currentColor;
277
+ border-radius: 2px;
278
+ background-color: transparent;
279
+ pointer-events: none;
280
+ will-change: background-color, border-color;
281
+ }
282
+
283
+ @mixin mdc-checkbox__background--marked_ {
284
+ transition:
285
+ mdc-checkbox-transition-enter(border-color),
286
+ mdc-checkbox-transition-enter(background-color);
287
+ }
288
+
289
+ // Focus indicator
290
+
291
+ @mixin mdc-checkbox__focus-indicator_ {
292
+ @include mdc-checkbox__child--cover-parent_;
293
+
294
+ width: 100%;
295
+ height: 100%;
296
+ transform: scale(0, 0);
297
+ transition: mdc-checkbox-transition-exit(opacity), mdc-checkbox-transition-exit(transform);
298
+ border-radius: 50%;
299
+ opacity: 0;
300
+ pointer-events: none;
301
+ content: "";
302
+ will-change: opacity, transform;
303
+ }
304
+
305
+ @mixin mdc-checkbox__focus-indicator--focused_ {
306
+ transform: scale(2.75, 2.75);
307
+ transition:
308
+ mdc-checkbox-transition-enter(opacity, 0ms, 80ms),
309
+ mdc-checkbox-transition-enter(transform, 0ms, 80ms);
310
+ opacity: $mdc-checkbox-focus-indicator-opacity;
311
+ }
312
+
313
+ @mixin mdc-checkbox__focus-indicator--ripple-upgraded-unbounded_ {
314
+ content: none;
315
+ }
316
+
317
+ // Native input
318
+
319
+ @mixin mdc-checkbox__native-control_ {
320
+ position: absolute;
321
+ top: 0;
322
+ left: 0;
323
+ width: 100%;
324
+ height: 100%;
325
+ margin: 0;
326
+ padding: 0;
327
+ opacity: 0;
328
+ cursor: inherit;
329
+ }
330
+
331
+ // Check mark
332
+
333
+ @mixin mdc-checkbox__checkmark_ {
334
+ @include mdc-checkbox__child--cover-parent_;
335
+
336
+ width: 100%;
337
+ transition: mdc-checkbox-transition-exit(opacity, 0ms, $mdc-checkbox-transition-duration * 2);
338
+ opacity: 0;
339
+
340
+ .mdc-checkbox--upgraded & {
341
+ opacity: 1;
342
+ }
343
+ }
344
+
345
+ @mixin mdc-checkbox__checkmark--checked_ {
346
+ transition:
347
+ mdc-checkbox-transition-enter(opacity, 0ms, $mdc-checkbox-transition-duration * 2),
348
+ mdc-checkbox-transition-enter(transform, 0ms, $mdc-checkbox-transition-duration * 2);
349
+ opacity: 1;
350
+ }
351
+
352
+ @mixin mdc-checkbox__checkmark--indeterminate_ {
353
+ transform: rotate(45deg);
354
+ transition:
355
+ mdc-checkbox-transition-exit(opacity, 0ms, $mdc-checkbox-transition-duration),
356
+ mdc-checkbox-transition-exit(transform, 0ms, $mdc-checkbox-transition-duration);
357
+ opacity: 0;
358
+ }
359
+
360
+ // Check mark path
361
+
362
+ @mixin mdc-checkbox__checkmark__path_ {
363
+ transition:
364
+ mdc-checkbox-transition-exit(
365
+ stroke-dashoffset,
366
+ 0ms,
367
+ $mdc-checkbox-transition-duration * 2
368
+ );
369
+ stroke-width: $mdc-checkbox-mark-stroke-size * 1.3;
370
+ stroke-dashoffset: $mdc-checkbox-mark-path-length_;
371
+ stroke-dasharray: $mdc-checkbox-mark-path-length_;
372
+ }
373
+
374
+ @mixin mdc-checkbox__checkmark__path--marked_ {
375
+ stroke-dashoffset: 0;
376
+ }
377
+
378
+ // Mixed mark
379
+
380
+ @mixin mdc-checkbox__mixedmark_ {
381
+ width: 100%;
382
+ height: floor($mdc-checkbox-mark-stroke-size);
383
+ transform: scaleX(0) rotate(0deg);
384
+ transition: mdc-checkbox-transition-exit(opacity), mdc-checkbox-transition-exit(transform);
385
+ opacity: 0;
386
+ }
387
+
388
+ @mixin mdc-checkbox__mixedmark--checked_ {
389
+ transform: scaleX(1) rotate(-45deg);
390
+ }
391
+
392
+ @mixin mdc-checkbox__mixedmark--indeterminate_ {
393
+ transform: scaleX(1) rotate(0deg);
394
+ opacity: 1;
395
+ }