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.
@@ -19,6 +19,7 @@ $mdc-checkbox-border-color: rgba(black, .54) !default;
19
19
  $mdc-checkbox-border-color-dark: white !default;
20
20
  $mdc-checkbox-disabled-color: rgba(black, .26) !default;
21
21
  $mdc-checkbox-disabled-color-dark: rgba(white, .3) !default;
22
+ $mdc-checkbox-baseline-theme-color: secondary !default;
22
23
 
23
24
  $mdc-checkbox-touch-area: 40px;
24
25
  $mdc-checkbox-size: 18px;
@@ -27,7 +28,9 @@ $mdc-checkbox-mark-stroke-size: 2/15 * $mdc-checkbox-size;
27
28
  $mdc-checkbox-border-width: 2px;
28
29
  $mdc-checkbox-transition-duration: 90ms;
29
30
  $mdc-checkbox-item-spacing: 4px;
31
+ $mdc-checkbox-ripple-opacity: .14;
32
+ $mdc-checkbox-focus-indicator-opacity: .26;
30
33
 
31
- /* Manual calculation done on SVG */
32
- $_mdc-checkbox-mark-path-length: 29.7833385;
33
- $_mdc-checkbox-indeterminate-checked-easing-function: cubic-bezier(.14, 0, 0, 1);
34
+ // Manual calculation done on SVG
35
+ $mdc-checkbox-mark-path-length_: 29.7833385;
36
+ $mdc-checkbox-indeterminate-checked-easing-function_: cubic-bezier(.14, 0, 0, 1);
@@ -14,334 +14,105 @@
14
14
  // limitations under the License.
15
15
  //
16
16
 
17
- @import "@material/animation/functions";
18
- @import "@material/ripple/mixins";
19
- @import "@material/rtl/mixins";
17
+ @import "@material/theme/mixins";
18
+ @import "./mixins";
20
19
  @import "./variables";
21
- @import "./keyframes";
22
-
23
- @function mdc-checkbox-transition-enter($property, $delay: 0ms, $duration: $mdc-checkbox-transition-duration) {
24
- @return mdc-animation-enter($property, $duration, $delay);
25
- }
26
-
27
- @function mdc-checkbox-transition-exit($property, $delay: 0ms, $duration: $mdc-checkbox-transition-duration) {
28
- @return mdc-animation-exit-temporary($property, $duration, $delay);
29
- }
30
-
31
- @mixin mdc-checkbox-cover-element {
32
- position: absolute;
33
- top: 0;
34
- right: 0;
35
- bottom: 0;
36
- left: 0;
37
- }
38
20
 
39
21
  // postcss-bem-linter: define checkbox
22
+
40
23
  .mdc-checkbox {
24
+ @include mdc-checkbox-base_;
41
25
  @include mdc-ripple-base;
42
- @include mdc-ripple-bg((pseudo: "::before", theme-style: primary, opacity: .14));
43
- @include mdc-ripple-fg((pseudo: "::after", theme-style: primary, opacity: .14));
44
-
45
- display: inline-block;
46
- position: relative;
47
- flex: 0 0 $mdc-checkbox-size;
48
- box-sizing: content-box;
49
- width: $mdc-checkbox-size;
50
- height: $mdc-checkbox-size;
51
- padding: ($mdc-checkbox-touch-area - $mdc-checkbox-size) / 2;
52
- line-height: 0;
53
- white-space: nowrap;
54
- cursor: pointer;
55
- vertical-align: bottom;
56
-
57
- &::before,
58
- &::after {
59
- top: 0;
60
- left: 0;
61
- width: 100%;
62
- height: 100%;
63
- }
64
-
65
- // stylelint-disable plugin/selector-bem-pattern
66
- &.mdc-ripple-upgraded--unbounded {
67
- .mdc-checkbox__background::before {
68
- content: none;
69
- }
70
- }
71
- // stylelint-enable plugin/selector-bem-pattern
72
-
73
- &__background {
74
- @include mdc-checkbox-cover-element;
75
- @include mdc-rtl-reflexive-position(
76
- left, ($mdc-checkbox-touch-area - $mdc-checkbox-size) / 2, ".mdc-checkbox");
77
-
78
- display: inline-flex;
79
- top: ($mdc-checkbox-touch-area - $mdc-checkbox-size) / 2;
80
- align-items: center;
81
- justify-content: center;
82
- box-sizing: border-box;
83
- width: $mdc-checkbox-ui-pct;
84
- height: $mdc-checkbox-ui-pct;
85
- transition:
86
- mdc-checkbox-transition-exit(background-color),
87
- mdc-checkbox-transition-exit(border-color);
88
- border: $mdc-checkbox-border-width solid $mdc-checkbox-border-color;
89
- border-radius: 2px;
90
- background-color: transparent;
91
- pointer-events: none;
92
- will-change: background-color, border-color;
93
-
94
- @include mdc-theme-dark(".mdc-checkbox") {
95
- border-color: $mdc-checkbox-border-color-dark;
96
- }
97
-
98
- // The frame's ::before element is used as a focus indicator for the checkbox
99
- &::before {
100
- @include mdc-checkbox-cover-element;
101
- @include mdc-theme-prop(background, primary, $edgeOptOut: true);
102
-
103
- width: 100%;
104
- height: 100%;
105
- transform: scale(0, 0);
106
- transition: mdc-checkbox-transition-exit(opacity), mdc-checkbox-transition-exit(transform);
107
- border-radius: 50%;
108
- opacity: 0;
109
- pointer-events: none;
110
- content: "";
111
- will-change: opacity, transform;
112
- }
113
- }
114
-
115
- &__native-control {
116
- position: absolute;
117
- top: 0;
118
- left: 0;
119
- width: 100%;
120
- height: 100%;
121
- margin: 0;
122
- padding: 0;
123
- opacity: 0;
124
- cursor: inherit;
125
- }
126
-
127
- &__checkmark {
128
- @include mdc-checkbox-cover-element;
129
-
130
- width: 100%;
131
- transition: mdc-checkbox-transition-exit(opacity, 0ms, $mdc-checkbox-transition-duration * 2);
132
- fill: $mdc-checkbox-mark-color;
133
- opacity: 0;
134
-
135
- &__path {
136
- transition:
137
- mdc-checkbox-transition-exit(
138
- stroke-dashoffset,
139
- 0ms,
140
- $mdc-checkbox-transition-duration * 2
141
- );
142
- // !important is needed here because a stroke must be set as an attribute on the SVG in order
143
- // for line animation to work properly.
144
- stroke: $mdc-checkbox-mark-color !important;
145
- stroke-width: $mdc-checkbox-mark-stroke-size * 1.3;
146
- stroke-dashoffset: $_mdc-checkbox-mark-path-length;
147
- stroke-dasharray: $_mdc-checkbox-mark-path-length;
148
- }
149
- }
150
-
151
- &__mixedmark {
152
- width: 100%;
153
- height: floor($mdc-checkbox-mark-stroke-size);
154
- transform: scaleX(0) rotate(0deg);
155
- transition: mdc-checkbox-transition-exit(opacity), mdc-checkbox-transition-exit(transform);
156
- background-color: $mdc-checkbox-mark-color;
157
- opacity: 0;
158
- }
159
- }
160
-
161
- .mdc-checkbox__native-control:focus {
162
- ~ .mdc-checkbox__background::before {
163
- transform: scale(2.75, 2.75);
164
- transition:
165
- mdc-checkbox-transition-enter(opacity, 0ms, 80ms),
166
- mdc-checkbox-transition-enter(transform, 0ms, 80ms);
167
- opacity: .26;
168
- }
169
- }
170
-
171
- .mdc-checkbox__native-control:checked {
172
- ~ .mdc-checkbox__background {
173
- @include mdc-theme-prop(border-color, primary);
174
- @include mdc-theme-prop(background-color, primary);
175
-
176
- transition:
177
- mdc-checkbox-transition-enter(border-color),
178
- mdc-checkbox-transition-enter(background-color);
179
-
180
- .mdc-checkbox__checkmark {
181
- transition:
182
- mdc-checkbox-transition-enter(opacity, 0ms, $mdc-checkbox-transition-duration * 2),
183
- mdc-checkbox-transition-enter(transform, 0ms, $mdc-checkbox-transition-duration * 2);
184
- opacity: 1;
26
+ @include mdc-checkbox-ink-color($mdc-checkbox-mark-color);
27
+ @include mdc-checkbox-focus-indicator-color($mdc-checkbox-baseline-theme-color);
28
+ @include mdc-checkbox-ripple((theme-style: $mdc-checkbox-baseline-theme-color, opacity: $mdc-checkbox-ripple-opacity));
29
+ @include mdc-checkbox-container-colors();
185
30
 
186
- &__path {
187
- stroke-dashoffset: 0;
188
- }
189
- }
190
-
191
- .mdc-checkbox__mixedmark {
192
- transform: scaleX(1) rotate(-45deg);
193
- }
194
- }
195
- }
196
-
197
- .mdc-checkbox__native-control:indeterminate {
198
- ~ .mdc-checkbox__background {
199
- @include mdc-theme-prop(border-color, primary);
200
- @include mdc-theme-prop(background-color, primary);
201
-
202
- .mdc-checkbox__checkmark {
203
- transform: rotate(45deg);
204
- transition:
205
- mdc-checkbox-transition-exit(opacity, 0ms, $mdc-checkbox-transition-duration),
206
- mdc-checkbox-transition-exit(transform, 0ms, $mdc-checkbox-transition-duration);
207
- opacity: 0;
208
-
209
- &__path {
210
- stroke-dashoffset: 0;
211
- }
212
- }
213
-
214
- .mdc-checkbox__mixedmark {
215
- transform: scaleX(1) rotate(0deg);
216
- opacity: 1;
217
- }
218
- }
219
- }
220
-
221
- .mdc-checkbox__native-control:disabled,
222
- fieldset:disabled .mdc-checkbox__native-control,
223
- [aria-disabled="true"] .mdc-checkbox__native-control {
224
- cursor: default;
225
-
226
- // postcss-bem-linter: ignore
227
- ~ .mdc-checkbox__background {
228
- border-color: $mdc-checkbox-disabled-color;
229
-
230
- @include mdc-theme-dark(".mdc-checkbox") {
231
- border-color: $mdc-checkbox-disabled-color-dark;
232
- }
233
- }
234
-
235
- &:checked,
236
- &:indeterminate {
237
- ~ .mdc-checkbox__background {
238
- border-color: transparent;
239
- background-color: $mdc-checkbox-disabled-color;
240
- // stylelint-disable selector-max-compound-selectors, selector-max-specificity
241
- @include mdc-theme-dark(".mdc-checkbox") {
242
- background-color: $mdc-checkbox-disabled-color-dark;
243
- }
244
- // stylelint-enable selector-max-compound-selectors, selector-max-specificity
245
- }
31
+ @include mdc-theme-dark {
32
+ @include mdc-checkbox-container-colors($unmarked-stroke-color: $mdc-checkbox-border-color-dark);
246
33
  }
247
34
  }
248
35
 
36
+ // Needed to disable hover effects on CSS-only (non-JS) checkboxes
249
37
  .mdc-checkbox--disabled {
250
- cursor: default;
251
- pointer-events: none;
38
+ @include mdc-checkbox--disabled_;
252
39
  }
253
40
 
41
+ // JS checkbox
254
42
  .mdc-checkbox--upgraded {
255
43
  .mdc-checkbox__background,
256
44
  .mdc-checkbox__checkmark,
257
45
  .mdc-checkbox__checkmark__path,
258
46
  .mdc-checkbox__mixedmark {
259
- // Due to the myriad of selector combos used to properly style a CSS-only checkbox, all of
260
- // which have varying selector precedence and make use of transitions, it is cleaner and more
261
- // efficient here to simply use !important, since the mdc-checkbox--anim-* classes will take
262
- // over from here.
263
- transition: none !important;
47
+ @include mdc-checkbox__child--upgraded_;
264
48
  }
265
49
  }
266
50
 
267
51
  .mdc-checkbox--anim {
268
- $_mdc-checkbox-indeterminate-change-duration: 500ms;
52
+ @include mdc-checkbox--anim_;
53
+ }
269
54
 
270
- &-unchecked-checked,
271
- &-unchecked-indeterminate {
272
- .mdc-checkbox__background {
273
- animation: mdc-checkbox-fade-in-background $mdc-checkbox-transition-duration * 2 linear;
55
+ .mdc-checkbox__background {
56
+ @include mdc-checkbox__background_;
274
57
 
275
- @include mdc-theme-dark(".mdc-checkbox") {
276
- animation-name: mdc-checkbox-fade-in-background-dark;
277
- }
278
- }
58
+ .mdc-checkbox__native-control:enabled:checked ~ &,
59
+ .mdc-checkbox__native-control:enabled:indeterminate ~ & {
60
+ @include mdc-checkbox__background--marked_;
279
61
  }
62
+ }
63
+
64
+ // The frame's ::before element is used as a focus indicator for the checkbox
65
+ .mdc-checkbox__background::before {
66
+ @include mdc-checkbox__focus-indicator_;
280
67
 
281
- &-checked-unchecked,
282
- &-indeterminate-unchecked {
283
- .mdc-checkbox__background {
284
- animation: mdc-checkbox-fade-out-background $mdc-checkbox-transition-duration * 2 linear;
68
+ .mdc-checkbox__native-control:focus ~ & {
69
+ @include mdc-checkbox__focus-indicator--focused_;
70
+ }
285
71
 
286
- @include mdc-theme-dark(".mdc-checkbox") {
287
- animation-name: mdc-checkbox-fade-out-background-dark;
288
- }
289
- }
72
+ .mdc-ripple-upgraded--unbounded & {
73
+ @include mdc-checkbox__focus-indicator--ripple-upgraded-unbounded_;
290
74
  }
75
+ }
76
+
77
+ .mdc-checkbox__native-control {
78
+ @include mdc-checkbox__native-control_;
291
79
 
292
- &-unchecked-checked {
293
- .mdc-checkbox__checkmark__path {
294
- // Instead of delaying the animation, we simply multiply its length by 2 and begin the
295
- // animation at 50% in order to prevent a flash of styles applied to a checked checkmark
296
- // as the background is fading in before the animation begins.
297
- animation: $mdc-checkbox-transition-duration * 2 linear 0s mdc-checkbox-unchecked-checked-checkmark-path;
298
- transition: none;
299
- }
80
+ &:disabled {
81
+ @include mdc-checkbox--disabled_;
300
82
  }
83
+ }
84
+
85
+ .mdc-checkbox__checkmark {
86
+ @include mdc-checkbox__checkmark_;
301
87
 
302
- &-unchecked-indeterminate {
303
- .mdc-checkbox__mixedmark {
304
- animation: $mdc-checkbox-transition-duration linear 0s mdc-checkbox-unchecked-indeterminate-mixedmark;
305
- transition: none;
306
- }
88
+ .mdc-checkbox__native-control:checked ~ .mdc-checkbox__background & {
89
+ @include mdc-checkbox__checkmark--checked_;
307
90
  }
308
91
 
309
- &-checked-unchecked {
310
- .mdc-checkbox__checkmark__path {
311
- animation: $mdc-checkbox-transition-duration linear 0s mdc-checkbox-checked-unchecked-checkmark-path;
312
- transition: none;
313
- }
92
+ .mdc-checkbox__native-control:indeterminate ~ .mdc-checkbox__background & {
93
+ @include mdc-checkbox__checkmark--indeterminate_;
314
94
  }
95
+ }
315
96
 
316
- &-checked-indeterminate {
317
- .mdc-checkbox__checkmark {
318
- animation: $mdc-checkbox-transition-duration linear 0s mdc-checkbox-checked-indeterminate-checkmark;
319
- transition: none;
320
- }
97
+ .mdc-checkbox__checkmark__path {
98
+ @include mdc-checkbox__checkmark__path_;
321
99
 
322
- .mdc-checkbox__mixedmark {
323
- animation: $mdc-checkbox-transition-duration linear 0s mdc-checkbox-checked-indeterminate-mixedmark;
324
- transition: none;
325
- }
100
+ .mdc-checkbox__native-control:checked ~ .mdc-checkbox__background &,
101
+ .mdc-checkbox__native-control:indeterminate ~ .mdc-checkbox__background & {
102
+ @include mdc-checkbox__checkmark__path--marked_;
326
103
  }
104
+ }
327
105
 
328
- &-indeterminate-checked {
329
- .mdc-checkbox__checkmark {
330
- animation: $_mdc-checkbox-indeterminate-change-duration linear 0s mdc-checkbox-indeterminate-checked-checkmark;
331
- transition: none;
332
- }
106
+ .mdc-checkbox__mixedmark {
107
+ @include mdc-checkbox__mixedmark_;
333
108
 
334
- .mdc-checkbox__mixedmark {
335
- animation: $_mdc-checkbox-indeterminate-change-duration linear 0s mdc-checkbox-indeterminate-checked-mixedmark;
336
- transition: none;
337
- }
109
+ .mdc-checkbox__native-control:checked ~ .mdc-checkbox__background & {
110
+ @include mdc-checkbox__mixedmark--checked_;
338
111
  }
339
112
 
340
- &-indeterminate-unchecked {
341
- .mdc-checkbox__mixedmark {
342
- animation: $_mdc-checkbox-indeterminate-change-duration * .6 linear 0s mdc-checkbox-indeterminate-unchecked-mixedmark;
343
- transition: none;
344
- }
113
+ .mdc-checkbox__native-control:indeterminate ~ .mdc-checkbox__background & {
114
+ @include mdc-checkbox__mixedmark--indeterminate_;
345
115
  }
346
116
  }
117
+
347
118
  // postcss-bem-linter: end
@@ -67,6 +67,8 @@ $mdc-list-side-padding: 16px;
67
67
  // postcss-bem-linter: define list-item
68
68
 
69
69
  .mdc-list-item {
70
+ @include mdc-typography-overflow-ellipsis;
71
+
70
72
  display: flex;
71
73
  align-items: center;
72
74
  justify-content: flex-start;
@@ -177,6 +177,7 @@ $mdc-simple-menu-item-fade-duration: .3s;
177
177
  background: currentColor;
178
178
  content: "";
179
179
  opacity: 0;
180
+ pointer-events: none;
180
181
  }
181
182
 
182
183
  .mdc-list-item:focus::before {
@@ -176,7 +176,6 @@ $mdc-radio-transition-duration: 120ms;
176
176
  }
177
177
 
178
178
  .mdc-radio__native-control:disabled,
179
- fieldset:disabled .mdc-radio__native-control,
180
179
  [aria-disabled="true"] .mdc-radio__native-control {
181
180
  + .mdc-radio__background {
182
181
  cursor: default;
@@ -646,9 +646,11 @@
646
646
  border-bottom-style: dotted;
647
647
  }
648
648
 
649
+ // stylelint-disable selector-max-specificity
649
650
  &:invalid:not(:focus) {
650
651
  border-color: $mdc-textfield-error-on-light;
651
652
  }
653
+ // stylelint-enable selector-max-specificity
652
654
  }
653
655
 
654
656
  @include mdc-theme-dark {
@@ -664,9 +666,11 @@
664
666
  background-color: $mdc-textarea-disabled-background-on-dark;
665
667
  }
666
668
 
669
+ // stylelint-disable selector-max-specificity
667
670
  &:invalid:not(:focus) {
668
671
  border-color: $mdc-textfield-error-on-dark;
669
672
  }
673
+ // stylelint-enable selector-max-specificity
670
674
  }
671
675
  }
672
676
  }