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
@@ -1,4 +1,5 @@
1
- // Copyright 2017 Google Inc. All Rights Reserved.
1
+ //
2
+ // Copyright 2016 Google Inc. All Rights Reserved.
2
3
  //
3
4
  // Licensed under the Apache License, Version 2.0 (the "License");
4
5
  // you may not use this file except in compliance with the License.
@@ -11,5 +12,7 @@
11
12
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
13
  // See the License for the specific language governing permissions and
13
14
  // limitations under the License.
15
+ //
14
16
 
15
- $mdc-fab-light-ripple-config: (base-color: white, opacity: .16);
17
+ $mdc-ripple-pressed-dark-ink-opacity: .16;
18
+ $mdc-ripple-pressed-light-ink-opacity: .32;
@@ -17,13 +17,14 @@
17
17
  @import "@material/animation/functions";
18
18
  @import "@material/theme/mixins";
19
19
  @import "./mixins";
20
+ @import "./variables";
20
21
 
21
22
  // postcss-bem-linter: define ripple-surface
22
23
 
23
24
  .mdc-ripple-surface {
24
- @include mdc-ripple-base;
25
- @include mdc-ripple-bg((pseudo: "::before"));
26
- @include mdc-ripple-fg((pseudo: "::after"));
25
+ @include mdc-ripple-surface;
26
+ @include mdc-ripple-color;
27
+ @include mdc-ripple-radius;
27
28
 
28
29
  position: relative;
29
30
  outline: none;
@@ -34,23 +35,11 @@
34
35
  }
35
36
 
36
37
  &--primary {
37
- &::before,
38
- &::after {
39
- @include mdc-theme-prop(background-color, primary);
40
- }
41
-
42
- @include mdc-ripple-bg((pseudo: "::before", theme-style: primary, opacity: .16));
43
- @include mdc-ripple-fg((pseudo: "::after", theme-style: primary, opacity: .16));
38
+ @include mdc-ripple-color(primary, $mdc-ripple-pressed-dark-ink-opacity);
44
39
  }
45
40
 
46
41
  &--accent {
47
- &::before,
48
- &::after {
49
- @include mdc-theme-prop(background-color, primary);
50
- }
51
-
52
- @include mdc-ripple-bg((pseudo: "::before", theme-style: secondary, opacity: .16));
53
- @include mdc-ripple-fg((pseudo: "::after", theme-style: secondary, opacity: .16));
42
+ @include mdc-ripple-color(secondary, $mdc-ripple-pressed-dark-ink-opacity);
54
43
  }
55
44
  }
56
45
 
@@ -28,6 +28,7 @@
28
28
  left: 50%;
29
29
  align-items: center;
30
30
  justify-content: flex-start;
31
+ box-sizing: border-box;
31
32
  padding-right: 24px;
32
33
  padding-left: 24px;
33
34
  transform: translate(-50%, 100%);
@@ -42,7 +43,7 @@
42
43
 
43
44
  @media (max-width: ($mdc-snackbar-tablet-breakpoint - 1)) {
44
45
  left: 0;
45
- width: calc(100% - 48px);
46
+ width: 100%;
46
47
  transform: translate(0, 100%);
47
48
  }
48
49
 
@@ -63,7 +64,7 @@
63
64
  @media (max-width: ($mdc-snackbar-tablet-breakpoint - 1)) {
64
65
  bottom: 0;
65
66
  left: 0;
66
- width: calc(100% - 48px);
67
+ width: 100%;
67
68
  transform: translate(0, 100%);
68
69
  }
69
70
  }
@@ -79,7 +80,7 @@
79
80
  @media (max-width: ($mdc-snackbar-tablet-breakpoint - 1)) {
80
81
  bottom: 0;
81
82
  left: 0;
82
- width: calc(100% - 48px);
83
+ width: 100%;
83
84
  transform: translate(0);
84
85
  }
85
86
  }
@@ -0,0 +1,21 @@
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/variables";
18
+
19
+ @function mdc-switch-transition($property) {
20
+ @return $property 90ms $mdc-animation-standard-curve-timing-function;
21
+ }
@@ -0,0 +1,74 @@
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/mixins";
18
+ @import "./variables";
19
+
20
+ //
21
+ // Public
22
+ //
23
+
24
+ @mixin mdc-switch-track-color($color) {
25
+ .mdc-switch__native-control:enabled:checked ~ .mdc-switch__background::before {
26
+ @include mdc-theme-prop(background-color, $color);
27
+ }
28
+ }
29
+
30
+ @mixin mdc-switch-knob-color($color) {
31
+ // stylelint-disable-next-line selector-max-specificity
32
+ .mdc-switch__native-control:enabled:checked ~ .mdc-switch__background .mdc-switch__knob {
33
+ @include mdc-theme-prop(background-color, $color);
34
+ }
35
+ }
36
+
37
+ @mixin mdc-switch-focus-indicator-color($color) {
38
+ // stylelint-disable-next-line selector-max-specificity
39
+ .mdc-switch__native-control:enabled:checked ~ .mdc-switch__background .mdc-switch__knob::before {
40
+ @include mdc-theme-prop(background-color, $color);
41
+ }
42
+ }
43
+
44
+ //
45
+ // Private
46
+ //
47
+
48
+ @mixin mdc-switch-unchecked-track-color_($color) {
49
+ .mdc-switch__native-control:enabled:not(:checked) ~ .mdc-switch__background::before {
50
+ @include mdc-theme-prop(background-color, $color);
51
+ }
52
+ }
53
+
54
+ @mixin mdc-switch-unchecked-knob-color_($color) {
55
+ // stylelint-disable-next-line selector-max-specificity
56
+ .mdc-switch__native-control:enabled:not(:checked) ~ .mdc-switch__background .mdc-switch__knob {
57
+ @include mdc-theme-prop(background-color, $color);
58
+ }
59
+ }
60
+
61
+ @mixin mdc-switch-unchecked-focus-indicator-color_($color) {
62
+ // stylelint-disable-next-line selector-max-specificity
63
+ .mdc-switch__native-control:enabled:not(:checked) ~ .mdc-switch__background .mdc-switch__knob::before {
64
+ @include mdc-theme-prop(background-color, $color);
65
+ }
66
+ }
67
+
68
+ @mixin mdc-switch-tap-target_ {
69
+ position: absolute;
70
+ top: -14px;
71
+ left: -14px;
72
+ width: $mdc-switch-focus-ring-diameter;
73
+ height: $mdc-switch-focus-ring-diameter;
74
+ }
@@ -1,18 +1,18 @@
1
- //
1
+ //
2
2
  // Copyright 2016 Google Inc. All Rights Reserved.
3
- //
3
+ //
4
4
  // Licensed under the Apache License, Version 2.0 (the "License");
5
5
  // you may not use this file except in compliance with the License.
6
6
  // You may obtain a copy of the License at
7
- //
7
+ //
8
8
  // http://www.apache.org/licenses/LICENSE-2.0
9
- //
9
+ //
10
10
  // Unless required by applicable law or agreed to in writing, software
11
11
  // distributed under the License is distributed on an "AS IS" BASIS,
12
12
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
13
  // See the License for the specific language governing permissions and
14
14
  // limitations under the License.
15
- //
15
+ //
16
16
 
17
17
  $mdc-switch-track-width: 34px;
18
18
  $mdc-switch-track-height: 14px;
@@ -28,3 +28,7 @@ $mdc-switch-unchecked-track-color-dark: #fff;
28
28
  $mdc-switch-unchecked-focus-ring-color-dark: #f1f1f1;
29
29
  $mdc-switch-disabled-knob-color: #bdbdbd;
30
30
  $mdc-switch-disabled-knob-color-dark: #424242;
31
+
32
+ $mdc-switch-baseline-theme-color: secondary;
33
+
34
+ $mdc-switch-knob-vertical-offset_: -3px;
@@ -1,3 +1,4 @@
1
+ //
1
2
  // Copyright 2016 Google Inc. All Rights Reserved.
2
3
  //
3
4
  // Licensed under the Apache License, Version 2.0 (the "License");
@@ -11,31 +12,46 @@
11
12
  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
13
  // See the License for the specific language governing permissions and
13
14
  // limitations under the License.
15
+ //
14
16
 
15
- @import "@material/animation/variables";
16
17
  @import "@material/elevation/mixins";
17
18
  @import "@material/theme/mixins";
19
+ @import "./functions";
20
+ @import "./mixins";
18
21
  @import "./variables";
19
22
 
20
- @function mdc-switch-transition($property) {
21
- @return $property 90ms $mdc-animation-standard-curve-timing-function;
22
- }
23
-
24
23
  // postcss-bem-linter: define switch
25
24
  .mdc-switch {
25
+ @include mdc-switch-unchecked-track-color_($mdc-switch-unchecked-track-color);
26
+ @include mdc-switch-unchecked-knob-color_($mdc-switch-unchecked-knob-color);
27
+ @include mdc-switch-unchecked-focus-indicator-color_($mdc-switch-unchecked-focus-ring-color);
28
+
29
+ @include mdc-theme-dark {
30
+ @include mdc-switch-unchecked-track-color_($mdc-switch-unchecked-track-color-dark);
31
+ @include mdc-switch-unchecked-knob-color_($mdc-switch-unchecked-knob-color-dark);
32
+ @include mdc-switch-unchecked-focus-indicator-color_($mdc-switch-unchecked-focus-ring-color-dark);
33
+ }
34
+
35
+ @include mdc-switch-track-color($mdc-switch-baseline-theme-color);
36
+ @include mdc-switch-knob-color($mdc-switch-baseline-theme-color);
37
+ @include mdc-switch-focus-indicator-color($mdc-switch-baseline-theme-color);
38
+
26
39
  display: inline-block;
27
40
  position: relative;
28
41
 
29
42
  &__native-control {
43
+ @include mdc-switch-tap-target_;
44
+
30
45
  display: inline-block;
31
- position: absolute;
32
- top: 0;
33
- left: 0;
34
- width: $mdc-switch-track-width;
35
- height: $mdc-switch-track-height;
46
+ margin-top: $mdc-switch-knob-vertical-offset_;
47
+ transition: mdc-switch-transition(transform);
36
48
  opacity: 0;
37
49
  cursor: pointer;
38
50
  z-index: 2;
51
+
52
+ &:checked {
53
+ transform: translateX($mdc-switch-knob-active-margin);
54
+ }
39
55
  }
40
56
 
41
57
  &__background {
@@ -45,14 +61,9 @@
45
61
  height: $mdc-switch-track-height;
46
62
  border-radius: 7px;
47
63
  outline: none;
48
- background-color: transparent;
49
- cursor: pointer;
50
64
  user-select: none;
51
65
 
52
- @include mdc-theme-dark(".mdc-switch") {
53
- background-color: transparent;
54
- }
55
-
66
+ // Track
56
67
  &::before {
57
68
  display: block;
58
69
  position: absolute;
@@ -64,12 +75,10 @@
64
75
  mdc-switch-transition(opacity),
65
76
  mdc-switch-transition(background-color);
66
77
  border-radius: 7px;
67
- background-color: $mdc-switch-unchecked-track-color;
68
78
  opacity: .38;
69
79
  content: "";
70
80
 
71
81
  @include mdc-theme-dark(".mdc-switch") {
72
- background-color: $mdc-switch-unchecked-track-color-dark;
73
82
  opacity: .3;
74
83
  }
75
84
  }
@@ -80,7 +89,7 @@
80
89
 
81
90
  display: block;
82
91
  position: absolute;
83
- top: -3px;
92
+ top: $mdc-switch-knob-vertical-offset_;
84
93
  left: 0;
85
94
  width: $mdc-switch-knob-diameter;
86
95
  height: $mdc-switch-knob-diameter;
@@ -89,26 +98,18 @@
89
98
  mdc-switch-transition(transform),
90
99
  mdc-switch-transition(background-color);
91
100
  border-radius: $mdc-switch-knob-diameter / 2;
92
- background-color: $mdc-switch-unchecked-knob-color;
93
101
  z-index: 1;
94
102
 
95
- @include mdc-theme-dark(".mdc-switch") {
96
- background-color: $mdc-switch-unchecked-knob-color-dark;
97
- }
98
-
103
+ // Focus indicator
99
104
  // postcss-bem-linter: ignore
100
105
  &::before {
101
- position: absolute;
102
- top: -14px;
103
- left: -14px;
104
- width: $mdc-switch-focus-ring-diameter;
105
- height: $mdc-switch-focus-ring-diameter;
106
+ @include mdc-switch-tap-target_;
107
+
106
108
  transform: scale(0);
107
109
  transition:
108
110
  mdc-switch-transition(transform),
109
111
  mdc-switch-transition(background-color);
110
112
  border-radius: $mdc-switch-focus-ring-diameter / 2;
111
- background-color: transparent;
112
113
  opacity: .2;
113
114
  content: "";
114
115
  }
@@ -118,6 +119,7 @@
118
119
 
119
120
  .mdc-switch__native-control:focus ~ .mdc-switch__background {
120
121
  .mdc-switch__knob {
122
+ // Focus indicator
121
123
  &::before {
122
124
  position: absolute;
123
125
  width: $mdc-switch-focus-ring-diameter;
@@ -127,10 +129,8 @@
127
129
  mdc-switch-transition(transform),
128
130
  mdc-switch-transition(background-color);
129
131
  border-radius: $mdc-switch-focus-ring-diameter / 2;
130
- background-color: $mdc-switch-unchecked-focus-ring-color;
131
132
 
132
133
  @include mdc-theme-dark(".mdc-switch") {
133
- background-color: $mdc-switch-unchecked-focus-ring-color-dark;
134
134
  opacity: .14;
135
135
  }
136
136
  }
@@ -138,27 +138,19 @@
138
138
  }
139
139
 
140
140
  .mdc-switch__native-control:checked ~ .mdc-switch__background {
141
+ // Track
141
142
  &::before {
142
- @include mdc-theme-prop(background-color, primary);
143
-
144
143
  opacity: .5;
145
144
  }
146
145
 
147
146
  .mdc-switch__knob {
148
- @include mdc-theme-prop(background-color, primary);
149
-
150
- transform: translateX($mdc-switch-track-width - $mdc-switch-knob-diameter);
147
+ transform: translateX($mdc-switch-knob-active-margin);
151
148
  transition:
152
149
  mdc-switch-transition(transform),
153
150
  mdc-switch-transition(background-color);
154
151
 
152
+ // Focus indicator
155
153
  &::before {
156
- @include mdc-theme-prop(background-color, primary);
157
-
158
- @include mdc-theme-dark(".mdc-switch") {
159
- @include mdc-theme-prop(background-color, primary);
160
- }
161
-
162
154
  opacity: .15;
163
155
  }
164
156
  }
@@ -171,6 +163,7 @@
171
163
  }
172
164
 
173
165
  .mdc-switch__native-control:disabled ~ .mdc-switch__background {
166
+ // Track
174
167
  &::before {
175
168
  background-color: $mdc-switch-unchecked-track-color;
176
169
  opacity: .12;
@@ -158,18 +158,16 @@ $mdc-tab-with-icon-and-text-height: 72px;
158
158
  // stylelint-enable plugin/selector-bem-pattern
159
159
 
160
160
  .mdc-tab.mdc-ripple-upgraded {
161
- @include mdc-ripple-base;
162
- @include mdc-ripple-fg((pseudo: "::after"));
163
- @include mdc-ripple-bg((pseudo: "::before"));
161
+ @include mdc-ripple-surface;
162
+ @include mdc-ripple-color;
163
+ @include mdc-ripple-radius;
164
164
 
165
165
  @include mdc-theme-dark(".mdc-tab-bar") {
166
- @include mdc-ripple-bg((pseudo: "::before", base-color: map-get($mdc-theme-property-values, text-primary-on-dark), opacity: .16));
167
- @include mdc-ripple-fg((pseudo: "::after", base-color: map-get($mdc-theme-property-values, text-primary-on-dark), opacity: .16));
166
+ @include mdc-ripple-color(text-primary-on-dark, .16);
168
167
  }
169
168
 
170
169
  .mdc-toolbar & {
171
- @include mdc-ripple-bg((pseudo: "::before", base-color: map-get($mdc-theme-property-values, text-primary-on-primary), opacity: .16));
172
- @include mdc-ripple-fg((pseudo: "::after", base-color: map-get($mdc-theme-property-values, text-primary-on-primary), opacity: .16));
170
+ @include mdc-ripple-color(text-primary-on-primary, .16);
173
171
  }
174
172
 
175
173
  // stylelint-disable plugin/selector-bem-pattern
@@ -14,6 +14,29 @@
14
14
  // limitations under the License.
15
15
  //
16
16
 
17
+ @mixin mdc-text-field-box-corner-radius($radius) {
18
+ border-radius: $radius $radius 0 0;
19
+ }
20
+
21
+ @mixin mdc-text-field-textarea-corner-radius($radius) {
22
+ border-radius: $radius;
23
+
24
+ .mdc-textfield__label {
25
+ // Bottom corners are square to prevent weird edge cases
26
+ // where text would be visible outside of the curve.
27
+ border-radius: $radius $radius 0 0;
28
+ }
29
+
30
+ .mdc-textfield__input {
31
+ // The input element is required to have 2 pixels shaved off
32
+ // of the radius of its parent. This prevents an ugly space of
33
+ // background between the two borders in each corner when the
34
+ // textarea is focused. This also means we need to guard against
35
+ // invalid output.
36
+ border-radius: max($radius - 2, 0);
37
+ }
38
+ }
39
+
17
40
  @mixin mdc-text-field-invalid-label-shake-keyframes_($modifier, $positionY) {
18
41
  @keyframes invalid-shake-float-above-#{$modifier} {
19
42
  0% {