material_components_web-sass 0.23.0 → 0.24.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +3 -3
  3. data/CHANGELOG.md +9 -0
  4. data/lib/material_components_web/sass/version.rb +1 -1
  5. data/vendor/assets/javascripts/material-components-web.js +12 -7
  6. data/vendor/assets/stylesheets/@material/button/_mixins.scss +5 -11
  7. data/vendor/assets/stylesheets/@material/button/mdc-button.scss +3 -2
  8. data/vendor/assets/stylesheets/@material/checkbox/_mixins.scss +0 -8
  9. data/vendor/assets/stylesheets/@material/checkbox/_variables.scss +1 -0
  10. data/vendor/assets/stylesheets/@material/checkbox/mdc-checkbox.scss +4 -2
  11. data/vendor/assets/stylesheets/@material/drawer/_mixins.scss +3 -3
  12. data/vendor/assets/stylesheets/@material/drawer/permanent/mdc-permanent-drawer.scss +9 -9
  13. data/vendor/assets/stylesheets/@material/drawer/persistent/mdc-persistent-drawer.scss +3 -3
  14. data/vendor/assets/stylesheets/@material/drawer/temporary/mdc-temporary-drawer.scss +8 -8
  15. data/vendor/assets/stylesheets/@material/fab/_mixins.scss +6 -9
  16. data/vendor/assets/stylesheets/@material/fab/mdc-fab.scss +3 -2
  17. data/vendor/assets/stylesheets/@material/icon-toggle/mdc-icon-toggle.scss +6 -9
  18. data/vendor/assets/stylesheets/@material/layout-grid/_mixins.scss +2 -0
  19. data/vendor/assets/stylesheets/@material/list/mdc-list.scss +4 -5
  20. data/vendor/assets/stylesheets/@material/radio/_functions.scss +26 -0
  21. data/vendor/assets/stylesheets/@material/radio/_mixins.scss +45 -0
  22. data/vendor/assets/stylesheets/@material/radio/_variables.scss +23 -0
  23. data/vendor/assets/stylesheets/@material/radio/mdc-radio.scss +15 -44
  24. data/vendor/assets/stylesheets/@material/ripple/_keyframes.scss +31 -29
  25. data/vendor/assets/stylesheets/@material/ripple/_mixins.scss +98 -177
  26. data/vendor/assets/stylesheets/@material/{fab → ripple}/_variables.scss +5 -2
  27. data/vendor/assets/stylesheets/@material/ripple/mdc-ripple.scss +6 -17
  28. data/vendor/assets/stylesheets/@material/snackbar/mdc-snackbar.scss +4 -3
  29. data/vendor/assets/stylesheets/@material/switch/_functions.scss +21 -0
  30. data/vendor/assets/stylesheets/@material/switch/_mixins.scss +74 -0
  31. data/vendor/assets/stylesheets/@material/switch/_variables.scss +9 -5
  32. data/vendor/assets/stylesheets/@material/switch/mdc-switch.scss +36 -43
  33. data/vendor/assets/stylesheets/@material/tabs/tab/mdc-tab.scss +5 -7
  34. data/vendor/assets/stylesheets/@material/textfield/_mixins.scss +23 -0
  35. data/vendor/assets/stylesheets/@material/textfield/_variables.scss +9 -0
  36. data/vendor/assets/stylesheets/@material/textfield/mdc-textfield.scss +20 -61
  37. data/vendor/assets/stylesheets/@material/theme/{_color_palette.scss → _color-palette.scss} +0 -0
  38. data/vendor/assets/stylesheets/@material/theme/_variables.scss +24 -0
  39. metadata +9 -4
@@ -22,7 +22,7 @@
22
22
 
23
23
  .mdc-icon-toggle {
24
24
  @include mdc-theme-prop(color, text-secondary-on-light);
25
- @include mdc-ripple-base;
25
+ @include mdc-ripple-surface;
26
26
  // NOTE: The spec denotes specific opacity values to use for different styles of icon buttons,
27
27
  // either "light", "dark", or "color". Because ripples are made up of two distinct elements,
28
28
  // we need to use an opacity value such that when two elements of the same color and opacity are
@@ -38,12 +38,11 @@
38
38
  // We simply solve this quadratic equation for the nonnegative root between [0, 1].
39
39
  // E.g. for black 12% opacity:
40
40
  // https://www.wolframalpha.com/input/?i=x+%2B+x(1+-+x)+%3D+.12,+x+%3C%3D+1,+x+%3E%3D+0
41
- @include mdc-ripple-bg((pseudo: "::before", opacity: .062));
42
- @include mdc-ripple-fg((pseudo: "::after", opacity: .062));
41
+ @include mdc-ripple-color(black, .062);
42
+ @include mdc-ripple-radius;
43
43
 
44
44
  @include mdc-theme-dark(".mdc-icon-toggle", true) {
45
- @include mdc-ripple-bg((pseudo: "::before", base-color: white, opacity: .16));
46
- @include mdc-ripple-fg((pseudo: "::after", base-color: white, opacity: .16));
45
+ @include mdc-ripple-color(white, .16);
47
46
  }
48
47
 
49
48
  display: flex;
@@ -76,14 +75,12 @@
76
75
 
77
76
  .mdc-icon-toggle--primary {
78
77
  @include mdc-theme-prop(color, primary);
79
- @include mdc-ripple-bg((pseudo: "::before", theme-style: primary, opacity: .14));
80
- @include mdc-ripple-fg((pseudo: "::after", theme-style: primary, opacity: .14));
78
+ @include mdc-ripple-color(primary, .14);
81
79
  }
82
80
 
83
81
  .mdc-icon-toggle--accent {
84
82
  @include mdc-theme-prop(color, secondary);
85
- @include mdc-ripple-bg((pseudo: "::before", theme-style: secondary, opacity: .14));
86
- @include mdc-ripple-fg((pseudo: "::after", theme-style: secondary, opacity: .14));
83
+ @include mdc-ripple-color(secondary, .14);
87
84
  }
88
85
 
89
86
  .mdc-icon-toggle--disabled {
@@ -12,6 +12,8 @@
12
12
  // See the License for the specific language governing permissions and
13
13
  // limitations under the License.
14
14
 
15
+ @import "./variables";
16
+
15
17
  // returns the lower grid boundary or null if the smallest grid is selected
16
18
  @function mdc-layout-grid-breakpoint-min($size) {
17
19
  @if not map-has-key($mdc-layout-grid-columns, $size) {
@@ -154,9 +154,9 @@ a.mdc-list-item {
154
154
  // stylelint-enable selector-max-type,selector-no-qualifying-type
155
155
 
156
156
  .mdc-list-item.mdc-ripple-upgraded {
157
- @include mdc-ripple-base;
158
- @include mdc-ripple-bg((pseudo: "::before"));
159
- @include mdc-ripple-fg((pseudo: "::after"));
157
+ @include mdc-ripple-surface;
158
+ @include mdc-ripple-color;
159
+ @include mdc-ripple-radius;
160
160
  @include mdc-rtl-reflexive-position(left, $mdc-list-side-padding * -1);
161
161
 
162
162
  position: relative;
@@ -171,8 +171,7 @@ a.mdc-list-item {
171
171
  }
172
172
 
173
173
  @include mdc-theme-dark(".mdc-list") {
174
- @include mdc-ripple-bg((pseudo: "::before", base-color: white, opacity: .12));
175
- @include mdc-ripple-fg((pseudo: "::after", base-color: white, opacity: .12));
174
+ @include mdc-ripple-color(white, .12);
176
175
  }
177
176
  }
178
177
 
@@ -0,0 +1,26 @@
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 "./variables";
19
+
20
+ @function mdc-radio-enter($name) {
21
+ @return mdc-animation-enter($name, $mdc-radio-transition-duration);
22
+ }
23
+
24
+ @function mdc-radio-exit($name) {
25
+ @return mdc-animation-exit-temporary($name, $mdc-radio-transition-duration);
26
+ }
@@ -0,0 +1,45 @@
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/variables";
18
+ @import "./variables";
19
+
20
+ @mixin mdc-radio-unchecked-stroke-color($color) {
21
+ // stylelint-disable-next-line selector-max-specificity
22
+ .mdc-radio__native-control:enabled:not(:checked) + .mdc-radio__background .mdc-radio__outer-circle {
23
+ @include mdc-theme-prop(border-color, $color);
24
+ }
25
+ }
26
+
27
+ @mixin mdc-radio-checked-stroke-color($color) {
28
+ // stylelint-disable-next-line selector-max-specificity
29
+ .mdc-radio__native-control:enabled:checked + .mdc-radio__background .mdc-radio__outer-circle {
30
+ @include mdc-theme-prop(border-color, $color);
31
+ }
32
+ }
33
+
34
+ @mixin mdc-radio-ink-color($color) {
35
+ // stylelint-disable-next-line selector-max-specificity
36
+ .mdc-radio__native-control:enabled + .mdc-radio__background .mdc-radio__inner-circle {
37
+ @include mdc-theme-prop(background-color, $color);
38
+ }
39
+ }
40
+
41
+ @mixin mdc-radio-focus-indicator-color($color) {
42
+ .mdc-radio__background::before {
43
+ @include mdc-theme-prop(background-color, $color, $edgeOptOut: true);
44
+ }
45
+ }
@@ -0,0 +1,23 @@
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
+ $mdc-radio-touch-area: 40px;
18
+ $mdc-radio-ui-size: 20px;
19
+ $mdc-radio-ui-pct: percentage($mdc-radio-ui-size / $mdc-radio-touch-area);
20
+ $mdc-radio-transition-duration: 120ms;
21
+ $mdc-radio-ripple-opacity: .14;
22
+ $mdc-radio-ripple-radius: 50%;
23
+ $mdc-radio-baseline-theme-color: secondary;
@@ -17,25 +17,24 @@
17
17
  @import "@material/animation/functions";
18
18
  @import "@material/ripple/mixins";
19
19
  @import "@material/theme/mixins";
20
-
21
- $mdc-radio-touch-area: 40px;
22
- $mdc-radio-ui-size: 20px;
23
- $mdc-radio-ui-pct: percentage($mdc-radio-ui-size / $mdc-radio-touch-area);
24
- $mdc-radio-transition-duration: 120ms;
25
-
26
- @function mdc-radio-enter($name) {
27
- @return mdc-animation-enter($name, $mdc-radio-transition-duration);
28
- }
29
-
30
- @function mdc-radio-exit($name) {
31
- @return mdc-animation-exit-temporary($name, $mdc-radio-transition-duration);
32
- }
20
+ @import "./functions";
21
+ @import "./mixins";
22
+ @import "./variables";
33
23
 
34
24
  // postcss-bem-linter: define radio
35
25
  .mdc-radio {
36
- @include mdc-ripple-base;
37
- @include mdc-ripple-bg((pseudo: "::before", theme-style: primary, opacity: .14));
38
- @include mdc-ripple-fg((pseudo: "::after", theme-style: primary, opacity: .14));
26
+ @include mdc-radio-unchecked-stroke-color(text-secondary-on-light);
27
+
28
+ @include mdc-theme-dark {
29
+ @include mdc-radio-unchecked-stroke-color(text-secondary-on-dark);
30
+ }
31
+
32
+ @include mdc-radio-checked-stroke-color($mdc-radio-baseline-theme-color);
33
+ @include mdc-radio-ink-color($mdc-radio-baseline-theme-color);
34
+ @include mdc-radio-focus-indicator-color($mdc-radio-baseline-theme-color);
35
+ @include mdc-ripple-surface;
36
+ @include mdc-ripple-color($mdc-radio-baseline-theme-color, $mdc-radio-ripple-opacity);
37
+ @include mdc-ripple-radius($mdc-radio-ripple-radius);
39
38
 
40
39
  display: inline-block;
41
40
  position: relative;
@@ -47,14 +46,6 @@ $mdc-radio-transition-duration: 120ms;
47
46
  cursor: pointer;
48
47
  will-change: opacity, transform, border-color, background-color, color;
49
48
 
50
- &::before,
51
- &::after {
52
- top: 0;
53
- left: 0;
54
- width: 100%;
55
- height: 100%;
56
- }
57
-
58
49
  // stylelint-disable plugin/selector-bem-pattern
59
50
  &.mdc-ripple-upgraded {
60
51
  .mdc-radio__background::before {
@@ -73,8 +64,6 @@ $mdc-radio-transition-duration: 120ms;
73
64
  height: $mdc-radio-ui-pct;
74
65
 
75
66
  &::before {
76
- @include mdc-theme-prop(background-color, primary, $edgeOptOut: true);
77
-
78
67
  position: absolute;
79
68
  top: 0;
80
69
  left: 0;
@@ -90,12 +79,6 @@ $mdc-radio-transition-duration: 120ms;
90
79
  }
91
80
 
92
81
  &__outer-circle {
93
- @include mdc-theme-prop(border-color, text-secondary-on-light);
94
-
95
- @include mdc-theme-dark(".mdc-radio") {
96
- @include mdc-theme-prop(border-color, text-secondary-on-dark);
97
- }
98
-
99
82
  position: absolute;
100
83
  top: 0;
101
84
  left: 0;
@@ -109,12 +92,6 @@ $mdc-radio-transition-duration: 120ms;
109
92
  }
110
93
 
111
94
  &__inner-circle {
112
- @include mdc-theme-prop(background-color, text-secondary-on-light);
113
-
114
- @include mdc-theme-dark(".mdc-radio") {
115
- @include mdc-theme-prop(background-color, text-secondary-on-dark);
116
- }
117
-
118
95
  position: absolute;
119
96
  top: 0;
120
97
  left: 0;
@@ -162,13 +139,7 @@ $mdc-radio-transition-duration: 120ms;
162
139
 
163
140
  .mdc-radio__native-control:checked {
164
141
  + .mdc-radio__background {
165
- .mdc-radio__outer-circle {
166
- @include mdc-theme-prop(border-color, primary);
167
- }
168
-
169
142
  .mdc-radio__inner-circle {
170
- @include mdc-theme-prop(background-color, primary);
171
-
172
143
  transform: scale(.5);
173
144
  transition: mdc-radio-enter(transform), mdc-radio-enter(background-color);
174
145
  }
@@ -14,43 +14,45 @@
14
14
  // limitations under the License.
15
15
  //
16
16
 
17
- /** MDC Ripple keyframes are split into their own file so that _mixins.scss can rely on them. */
17
+ // MDC Ripple keyframes are split into their own file so that _mixins.scss can rely on them.
18
18
 
19
19
  @import "@material/animation/variables";
20
20
 
21
- @keyframes mdc-ripple-fg-radius-in {
22
- from {
23
- animation-timing-function: $mdc-animation-standard-curve-timing-function;
24
- // NOTE: For these keyframes, we do not need custom property fallbacks because they are only
25
- // used in conjunction with `.mdc-ripple-upgraded`. Since MDCRippleFoundation checks to ensure
26
- // that custom properties are supported within the browser before adding this class, we can
27
- // safely use them without a fallback.
28
- transform: translate(var(--mdc-ripple-fg-translate-start, 0)) scale(1);
21
+ @mixin mdc-ripple-keyframes_ {
22
+ @keyframes mdc-ripple-fg-radius-in {
23
+ from {
24
+ animation-timing-function: $mdc-animation-standard-curve-timing-function;
25
+ // NOTE: For these keyframes, we do not need custom property fallbacks because they are only
26
+ // used in conjunction with `.mdc-ripple-upgraded`. Since MDCRippleFoundation checks to ensure
27
+ // that custom properties are supported within the browser before adding this class, we can
28
+ // safely use them without a fallback.
29
+ transform: translate(var(--mdc-ripple-fg-translate-start, 0)) scale(1);
30
+ }
31
+
32
+ to {
33
+ transform: translate(var(--mdc-ripple-fg-translate-end, 0)) scale(var(--mdc-ripple-fg-scale, 1));
34
+ }
29
35
  }
30
36
 
31
- to {
32
- transform: translate(var(--mdc-ripple-fg-translate-end, 0)) scale(var(--mdc-ripple-fg-scale, 1));
33
- }
34
- }
35
-
36
- @keyframes mdc-ripple-fg-opacity-in {
37
- from {
38
- animation-timing-function: linear;
39
- opacity: 0;
40
- }
37
+ @keyframes mdc-ripple-fg-opacity-in {
38
+ from {
39
+ animation-timing-function: linear;
40
+ opacity: 0;
41
+ }
41
42
 
42
- to {
43
- opacity: 1;
43
+ to {
44
+ opacity: 1;
45
+ }
44
46
  }
45
- }
46
47
 
47
- @keyframes mdc-ripple-fg-opacity-out {
48
- from {
49
- animation-timing-function: linear;
50
- opacity: 1;
51
- }
48
+ @keyframes mdc-ripple-fg-opacity-out {
49
+ from {
50
+ animation-timing-function: linear;
51
+ opacity: 1;
52
+ }
52
53
 
53
- to {
54
- opacity: 0;
54
+ to {
55
+ opacity: 0;
56
+ }
55
57
  }
56
58
  }
@@ -18,19 +18,34 @@
18
18
  @import "@material/theme/variables";
19
19
  @import "./keyframes";
20
20
 
21
- @function mdc-ripple-default-config_() {
22
- @return (
23
- pseudo: null,
24
- radius: 100%,
25
- base-color: black,
26
- opacity: .06,
27
- theme-style: null
28
- );
21
+ // Ensure that styles needed by any component using MDC Ripple are emitted, but only once.
22
+ // (Every component using MDC Ripple imports these mixins, but doesn't necessarily import mdc-ripple.scss.)
23
+
24
+ // This variable is not intended to be overridden externally; it uses !default to avoid being reset
25
+ // every time this file is imported.
26
+ $mdc-ripple-common-styles-emitted_: false !default;
27
+
28
+ @if not $mdc-ripple-common-styles-emitted_ {
29
+ $mdc-ripple-common-styles-emitted_: true;
30
+
31
+ @include mdc-ripple-keyframes_;
32
+
33
+ // Styles used to detect buggy behavior of CSS custom properties in Edge.
34
+ // See: https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/11495448/
35
+ // This is included in _mixins.scss rather than mdc-ripple.scss so that it will be
36
+ // present for other components which rely on ripple as well as mdc-ripple itself.
37
+ .mdc-ripple-surface--test-edge-var-bug {
38
+ --mdc-ripple-surface-test-edge-var: 1px solid #000;
39
+
40
+ visibility: hidden;
41
+
42
+ &::before {
43
+ border: var(--mdc-ripple-surface-test-edge-var);
44
+ }
45
+ }
29
46
  }
30
47
 
31
- @mixin mdc-ripple-base() {
32
- --mdc-ripple-surface-width: 0;
33
- --mdc-ripple-surface-height: 0;
48
+ @mixin mdc-ripple-surface() {
34
49
  --mdc-ripple-fg-size: 0;
35
50
  --mdc-ripple-left: 0;
36
51
  --mdc-ripple-top: 0;
@@ -41,6 +56,28 @@
41
56
  will-change: transform, opacity;
42
57
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
43
58
 
59
+ &::before,
60
+ &::after {
61
+ position: absolute;
62
+ transition: opacity 250ms linear;
63
+ border-radius: 50%;
64
+ pointer-events: none;
65
+ content: "";
66
+ }
67
+ }
68
+
69
+ @mixin mdc-ripple-color($color: black, $opacity: .06) {
70
+ // Opacity styles are here (rather than in mdc-ripple-surface) to ensure that opacity is re-initialized for
71
+ // cases where this mixin is used to override another inherited use of itself,
72
+ // without needing to re-include mdc-ripple-surface.
73
+ &::before,
74
+ &::after {
75
+ @include mdc-ripple-color_($color, $opacity);
76
+
77
+ opacity: 0;
78
+ }
79
+
80
+ // Note: when :active is applied, :focus is already applied, which will effectively double the effect.
44
81
  &:not(.mdc-ripple-upgraded) {
45
82
  &:hover::before,
46
83
  &:focus::before,
@@ -49,209 +86,93 @@
49
86
  opacity: .6;
50
87
  }
51
88
  }
52
- }
53
-
54
- @mixin mdc-ripple-color_($config) {
55
- $base-color: map-get($config, base-color);
56
- $opacity: map-get($config, opacity);
57
- $theme-style: map-get($config, theme-style);
58
-
59
- // stylelint-disable at-rule-empty-line-before, block-closing-brace-newline-after
60
- @if ($theme-style) {
61
- $theme-value: map-get($mdc-theme-property-values, $theme-style);
62
-
63
- /* @alternate */
64
- $css-var: $theme-value;
65
- $css-var: var(--mdc-theme-#{$theme-style}, $theme-value);
66
-
67
- background-color: rgba($theme-value, $opacity);
68
89
 
69
- // See: https://drafts.csswg.org/css-color/#modifying-colors
70
- // While this is currently unsupported as of now, it will begin to work by default as browsers
71
- // begin to implement the CSS 4 color spec.
72
- @supports (background-color: color(green a(10%))) {
73
- background-color: color(#{$css-var} a(#{percentage($opacity)}));
74
- }
75
- } @else {
76
- background-color: rgba($base-color, $opacity);
90
+ &.mdc-ripple-upgraded--background-focused::before {
91
+ opacity: .99999;
77
92
  }
78
93
 
79
- // stylelint-enable at-rule-empty-line-before, block-closing-brace-newline-after
80
- }
81
-
82
- @mixin mdc-ripple-bg-base_($config) {
83
- $radius: map-get($config, radius);
84
-
85
- @include mdc-ripple-color_($config);
94
+ &.mdc-ripple-upgraded--background-active-fill::before {
95
+ transition-duration: 120ms;
96
+ opacity: 1;
97
+ }
86
98
 
87
- position: absolute;
88
- top: calc(50% - #{$radius});
89
- left: calc(50% - #{$radius});
90
- width: $radius * 2;
91
- height: $radius * 2;
92
- transition: opacity 250ms linear;
93
- border-radius: 50%;
94
- opacity: 0;
95
- pointer-events: none;
96
- }
99
+ // Foreground ripple styles
97
100
 
98
- @mixin mdc-ripple-bg($config: ()) {
99
- $config: map-merge(mdc-ripple-default-config_(), $config);
100
- $pseudo: map-get($config, pseudo);
101
- $radius: map-get($config, radius);
101
+ &.mdc-ripple-upgraded::after {
102
+ opacity: 0;
103
+ }
102
104
 
103
- // stylelint-disable at-rule-empty-line-before, block-closing-brace-newline-after
104
- @if ($pseudo) {
105
- &#{$pseudo} {
106
- @include mdc-ripple-bg-base_($config);
105
+ &.mdc-ripple-upgraded--foreground-activation::after {
106
+ animation: 300ms mdc-ripple-fg-radius-in forwards, 83ms mdc-ripple-fg-opacity-in forwards;
107
+ }
107
108
 
108
- content: "";
109
- }
110
- } @else {
111
- @include mdc-ripple-bg-base_($config);
109
+ &.mdc-ripple-upgraded--foreground-deactivation::after {
110
+ animation: 83ms mdc-ripple-fg-opacity-out;
111
+ // Retain transform from mdc-ripple-fg-radius-in activation
112
+ transform: translate(var(--mdc-ripple-fg-translate-end, 0)) scale(var(--mdc-ripple-fg-scale, 1));
112
113
  }
113
- // stylelint-enable at-rule-empty-line-before, block-closing-brace-newline-after
114
+ }
114
115
 
115
- &.mdc-ripple-upgraded#{$pseudo} {
116
+ @mixin mdc-ripple-radius($radius: 100%) {
117
+ &::before,
118
+ &::after {
116
119
  top: calc(50% - #{$radius});
117
120
  left: calc(50% - #{$radius});
118
121
  width: $radius * 2;
119
122
  height: $radius * 2;
120
-
121
- /* @alternate */
122
- transform: scale(0);
123
- transform: scale(var(--mdc-ripple-fg-scale, 0));
124
123
  }
125
124
 
126
- &.mdc-ripple-upgraded--background-focused#{$pseudo} {
127
- opacity: .99999;
128
- }
125
+ // Background ripple styles
129
126
 
130
- &.mdc-ripple-upgraded--background-active-fill#{$pseudo} {
131
- transition-duration: 120ms;
132
- opacity: 1;
127
+ &.mdc-ripple-upgraded::before {
128
+ top: calc(50% - #{$radius});
129
+ left: calc(50% - #{$radius});
130
+ width: $radius * 2;
131
+ height: $radius * 2;
132
+ transform: scale(var(--mdc-ripple-fg-scale, 0));
133
133
  }
134
134
 
135
- &.mdc-ripple-upgraded--unbounded#{$pseudo} {
136
- /* @alternate */
137
- top: calc(50% - #{$radius / 2});
135
+ &.mdc-ripple-upgraded--unbounded::before {
138
136
  top: var(--mdc-ripple-top, calc(50% - #{$radius / 2}));
139
-
140
- /* @alternate */
141
- left: calc(50% - #{$radius / 2});
142
137
  left: var(--mdc-ripple-left, calc(50% - #{$radius / 2}));
143
-
144
- /* @alternate */
145
- width: $radius;
146
138
  width: var(--mdc-ripple-fg-size, $radius);
147
-
148
- /* @alternate */
149
- height: $radius;
150
139
  height: var(--mdc-ripple-fg-size, $radius);
151
-
152
- /* @alternate */
153
- transform: scale(0);
154
140
  transform: scale(var(--mdc-ripple-fg-scale, 0));
155
141
  }
156
- }
157
-
158
- @mixin mdc-ripple-fg-base_($config) {
159
- $radius: map-get($config, radius);
160
-
161
- @include mdc-ripple-color_($config);
162
-
163
- position: absolute;
164
- top: calc(50% - #{$radius});
165
- left: calc(50% - #{$radius});
166
- width: $radius * 2;
167
- height: $radius * 2;
168
- transition: opacity 250ms linear;
169
- border-radius: 50%;
170
- opacity: 0;
171
- pointer-events: none;
172
- }
173
-
174
- @mixin mdc-ripple-fg($config: ()) {
175
- $config: map-merge(mdc-ripple-default-config_(), $config);
176
- $pseudo: map-get($config, pseudo);
177
- $radius: map-get($config, radius);
178
-
179
- // stylelint-disable at-rule-empty-line-before, block-closing-brace-newline-after
180
- @if ($pseudo) {
181
- &#{$pseudo} {
182
- @include mdc-ripple-fg-base_($config);
183
-
184
- content: "";
185
- }
186
- } @else {
187
- @include mdc-ripple-fg-base_($config);
188
- }
189
- // stylelint-enable at-rule-empty-line-before, block-closing-brace-newline-after
190
-
191
- &.mdc-ripple-upgraded {
192
- &#{$pseudo} {
193
- top: 0;
194
- left: 0;
195
-
196
- /* @alternate */
197
- width: $radius;
198
- width: var(--mdc-ripple-fg-size, $radius);
199
-
200
- /* @alternate */
201
- height: $radius;
202
- height: var(--mdc-ripple-fg-size, $radius);
203
- transform: scale(0);
204
- transform-origin: center center;
205
- opacity: 0;
206
- }
207
- }
208
142
 
209
- &:not(.mdc-ripple-upgraded--unbounded)#{$pseudo} {
210
- transform-origin: center center;
211
- }
212
-
213
- &.mdc-ripple-upgraded--unbounded#{$pseudo} {
214
- /* @alternate */
143
+ // Foreground ripple styles
144
+ &.mdc-ripple-upgraded::after {
215
145
  top: 0;
216
- top: var(--mdc-ripple-top, 0);
217
-
218
- /* @alternate */
219
146
  left: 0;
220
- left: var(--mdc-ripple-left, 0);
221
-
222
- /* @alternate */
223
- width: $radius;
224
147
  width: var(--mdc-ripple-fg-size, $radius);
225
-
226
- /* @alternate */
227
- height: $radius;
228
148
  height: var(--mdc-ripple-fg-size, $radius);
229
149
  transform: scale(0);
230
150
  transform-origin: center center;
231
151
  }
232
152
 
233
- &.mdc-ripple-upgraded--foreground-activation#{$pseudo} {
234
- animation: 300ms mdc-ripple-fg-radius-in forwards, 83ms mdc-ripple-fg-opacity-in forwards;
235
- }
236
-
237
- &.mdc-ripple-upgraded--foreground-deactivation#{$pseudo} {
238
- animation: 83ms mdc-ripple-fg-opacity-out;
239
- // Retain transform from mdc-ripple-fg-radius-in activation
240
- transform: translate(var(--mdc-ripple-fg-translate-end, 0)) scale(var(--mdc-ripple-fg-scale, 1));
153
+ &.mdc-ripple-upgraded--unbounded::after {
154
+ top: var(--mdc-ripple-top, 0);
155
+ left: var(--mdc-ripple-left, 0);
241
156
  }
242
157
  }
243
158
 
244
- // Styles used to detect buggy behavior of CSS custom properties in Edge.
245
- // See: https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/11495448/
246
- // This is included in _mixins.scss rather than mdc-ripple.scss so that it will be
247
- // present for other components which rely on ripple as well as mdc-ripple itself.
248
-
249
- .mdc-ripple-surface--test-edge-var-bug {
250
- --mdc-ripple-surface-test-edge-var: 1px solid #000;
159
+ @mixin mdc-ripple-color_($color, $opacity) {
160
+ // stylelint-disable at-rule-empty-line-before, block-closing-brace-newline-after
161
+ @if type-of($color) == "color" {
162
+ background-color: rgba($color, $opacity);
163
+ } @else {
164
+ // Assume $color is a theme property name
165
+ $theme-value: map-get($mdc-theme-property-values, $color);
166
+ $css-var: var(--mdc-theme-#{$color}, $theme-value);
251
167
 
252
- visibility: hidden;
168
+ background-color: rgba($theme-value, $opacity);
253
169
 
254
- &::before {
255
- border: var(--mdc-ripple-surface-test-edge-var);
170
+ // See: https://drafts.csswg.org/css-color/#modifying-colors
171
+ // While this is currently unsupported as of now, it will begin to work by default as browsers
172
+ // begin to implement the CSS 4 color spec.
173
+ @supports (background-color: color(green a(10%))) {
174
+ background-color: color(#{$css-var} a(#{percentage($opacity)}));
175
+ }
256
176
  }
177
+ // stylelint-enable at-rule-empty-line-before, block-closing-brace-newline-after
257
178
  }