material_components_web-sass 0.24.0 → 0.25.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (26) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +9 -0
  3. data/lib/material_components_web/sass/version.rb +1 -1
  4. data/vendor/assets/javascripts/material-components-web.js +138 -143
  5. data/vendor/assets/stylesheets/@material/button/_mixins.scss +16 -5
  6. data/vendor/assets/stylesheets/@material/button/_variables.scss +2 -0
  7. data/vendor/assets/stylesheets/@material/dialog/mdc-dialog.scss +1 -1
  8. data/vendor/assets/stylesheets/@material/elevation/_mixins.scss +27 -8
  9. data/vendor/assets/stylesheets/@material/elevation/_variables.scss +4 -3
  10. data/vendor/assets/stylesheets/@material/fab/_mixins.scss +3 -4
  11. data/vendor/assets/stylesheets/@material/linear-progress/_mixins.scss +52 -0
  12. data/vendor/assets/stylesheets/@material/linear-progress/_variables.scss +15 -0
  13. data/vendor/assets/stylesheets/@material/linear-progress/mdc-linear-progress.scss +5 -11
  14. data/vendor/assets/stylesheets/@material/menu/simple/mdc-simple-menu.scss +1 -0
  15. data/vendor/assets/stylesheets/@material/slider/_keyframes.scss +30 -0
  16. data/vendor/assets/stylesheets/@material/slider/_mixins.scss +129 -0
  17. data/vendor/assets/stylesheets/@material/slider/_variables.scss +2 -0
  18. data/vendor/assets/stylesheets/@material/slider/mdc-slider.scss +21 -121
  19. data/vendor/assets/stylesheets/@material/snackbar/mdc-snackbar.scss +8 -0
  20. data/vendor/assets/stylesheets/@material/textfield/_mixins.scss +2 -2
  21. data/vendor/assets/stylesheets/@material/textfield/_variables.scss +27 -27
  22. data/vendor/assets/stylesheets/@material/textfield/{mdc-textfield.scss → mdc-text-field.scss} +165 -165
  23. data/vendor/assets/stylesheets/@material/theme/_functions.scss +19 -5
  24. data/vendor/assets/stylesheets/@material/theme/_variables.scss +8 -8
  25. data/vendor/assets/stylesheets/_material-components-web.scss +1 -1
  26. metadata +7 -3
@@ -22,11 +22,11 @@
22
22
  @import "./variables";
23
23
 
24
24
  @mixin mdc-button-filled-accessible($container-fill-color) {
25
- $light-or-dark: mdc-theme-light-or-dark($container-fill-color);
25
+ $fill-tone: mdc-theme-tone($container-fill-color);
26
26
 
27
27
  @include mdc-button-container-fill-color($container-fill-color);
28
28
 
29
- @if ($light-or-dark == "light") {
29
+ @if ($fill-tone == "dark") {
30
30
  @include mdc-button-ink-color(text-primary-on-dark);
31
31
  @include mdc-ripple-color(text-primary-on-dark, $mdc-filled-button-ripple-opacity);
32
32
  } @else {
@@ -60,6 +60,11 @@
60
60
  }
61
61
 
62
62
  @mixin mdc-button-stroke-width($stroke-width) {
63
+ // Note: Adjust padding to maintain consistent width with non-stroked buttons
64
+ $padding-value: max($mdc-button-horizontal-padding - $stroke-width, 0);
65
+
66
+ padding-right: $padding-value;
67
+ padding-left: $padding-value;
63
68
  border-width: $stroke-width;
64
69
  // Note: line height is adjusted for stroke button because borders are not
65
70
  // considered as space available to text on the Web
@@ -70,6 +75,13 @@
70
75
  // Minus extra 1 to accommodate odd font size of dense button
71
76
  line-height: $mdc-dense-button-height - $stroke-width * 2 - 1;
72
77
  }
78
+
79
+ &.mdc-button--compact {
80
+ $padding-compact-value: max($mdc-compact-button-horizontal-padding - $stroke-width, 0);
81
+
82
+ padding-right: $padding-compact-value;
83
+ padding-left: $padding-compact-value;
84
+ }
73
85
  }
74
86
 
75
87
  @mixin mdc-button-base_() {
@@ -82,13 +94,12 @@
82
94
  box-sizing: border-box;
83
95
  min-width: 64px;
84
96
  height: $mdc-button-height;
85
- padding: 0 16px;
97
+ padding: 0 $mdc-button-horizontal-padding;
86
98
  border: none;
87
99
  outline: none;
88
100
  text-align: center;
89
101
  user-select: none;
90
102
  -webkit-appearance: none;
91
- -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
92
103
  overflow: hidden;
93
104
  vertical-align: middle;
94
105
 
@@ -172,7 +183,7 @@
172
183
  }
173
184
 
174
185
  @mixin mdc-button--compact_() {
175
- padding: 0 8px;
186
+ padding: 0 $mdc-compact-button-horizontal-padding;
176
187
  }
177
188
 
178
189
  @mixin mdc-button--dense_() {
@@ -15,7 +15,9 @@
15
15
  //
16
16
 
17
17
  $mdc-button-height: 36px;
18
+ $mdc-button-horizontal-padding: 16px;
18
19
  $mdc-dense-button-height: 32px;
20
+ $mdc-compact-button-horizontal-padding: 8px;
19
21
 
20
22
  $mdc-unfilled-button-ripple-opacity: .16;
21
23
  $mdc-filled-button-ripple-opacity: .32;
@@ -108,7 +108,7 @@ $mdc-dialog-dark-theme-bg-color: #303030 !default;
108
108
  margin-top: 20px;
109
109
  padding: 0 24px 24px;
110
110
 
111
- @include mdc-theme-dark(".mdc-dialog", true) {
111
+ @include mdc-theme-dark(".mdc-dialog") {
112
112
  @include mdc-theme-prop(color, text-secondary-on-dark);
113
113
  }
114
114
 
@@ -14,25 +14,44 @@
14
14
  // limitations under the License.
15
15
  //
16
16
 
17
+ @import "@material/theme/variables";
17
18
  @import "./variables";
18
19
 
19
20
  /**
20
- * Applies the correct css rules to an element to give it the elevation specified by $z-value.
21
+ * Applies the correct CSS rules to an element to give it the elevation specified by $z-value.
21
22
  * The $z-value must be between 0 and 24.
23
+ * If $color has an alpha channel, it will be ignored and overridden. To increase the opacity of the shadow, use
24
+ * $opacity-boost.
22
25
  */
23
- @mixin mdc-elevation($z-value) {
26
+ @mixin mdc-elevation($z-value, $color: $mdc-elevation-baseline-color, $opacity-boost: 0) {
24
27
  @if type-of($z-value) != number or not unitless($z-value) {
25
- @error "$z-value must be a unitless number";
28
+ @error "$z-value must be a unitless number, but received '#{$z-value}'";
26
29
  }
27
30
 
28
31
  @if $z-value < 0 or $z-value > 24 {
29
- @error "$z-value must be between 0 and 24";
32
+ @error "$z-value must be between 0 and 24, but received '#{$z-value}'";
30
33
  }
31
34
 
32
- #{$mdc-elevation-property}:
33
- #{"#{map-get($mdc-elevation-umbra-map, $z-value)} #{$mdc-elevation-umbra-color}"},
34
- #{"#{map-get($mdc-elevation-penumbra-map, $z-value)} #{$mdc-elevation-penumbra-color}"},
35
- #{map-get($mdc-elevation-ambient-map, $z-value)} $mdc-elevation-ambient-color;
35
+ @if map-has-key($mdc-theme-property-values, $color) {
36
+ $color: map-get($mdc-theme-property-values, $color);
37
+ }
38
+
39
+ @if type-of($color) != color {
40
+ @error "$color must be a valid color, but '#{$color}' is of type #{type-of($color)}";
41
+ }
42
+
43
+ $umbra-z-value: map-get($mdc-elevation-umbra-map, $z-value);
44
+ $penumbra-z-value: map-get($mdc-elevation-penumbra-map, $z-value);
45
+ $ambient-z-value: map-get($mdc-elevation-ambient-map, $z-value);
46
+
47
+ $umbra-color: rgba($color, $mdc-elevation-umbra-opacity + $opacity-boost);
48
+ $penumbra-color: rgba($color, $mdc-elevation-penumbra-opacity + $opacity-boost);
49
+ $ambient-color: rgba($color, $mdc-elevation-ambient-opacity + $opacity-boost);
50
+
51
+ box-shadow:
52
+ #{"#{$umbra-z-value} #{$umbra-color}"},
53
+ #{"#{$penumbra-z-value} #{$penumbra-color}"},
54
+ #{$ambient-z-value} $ambient-color;
36
55
  }
37
56
 
38
57
  /**
@@ -16,9 +16,10 @@
16
16
 
17
17
  @import "@material/animation/variables";
18
18
 
19
- $mdc-elevation-umbra-color: rgba(black, .2);
20
- $mdc-elevation-penumbra-color: rgba(black, .14);
21
- $mdc-elevation-ambient-color: rgba(black, .12);
19
+ $mdc-elevation-baseline-color: black;
20
+ $mdc-elevation-umbra-opacity: .2;
21
+ $mdc-elevation-penumbra-opacity: .14;
22
+ $mdc-elevation-ambient-opacity: .12;
22
23
 
23
24
  $mdc-elevation-umbra-map: (
24
25
  0: "0px 0px 0px 0px",
@@ -21,12 +21,11 @@
21
21
  @import "@material/theme/mixins";
22
22
 
23
23
  @mixin mdc-fab-accessible($container-color) {
24
- @include mdc-fab-container-color($container-color);
24
+ $fill-tone: mdc-theme-tone($container-color);
25
25
 
26
- // Calculate whether to use dark or light text on top of given color.
27
- $light-or-dark-text: mdc-theme-light-or-dark($container-color);
26
+ @include mdc-fab-container-color($container-color);
28
27
 
29
- @if ($light-or-dark-text == "light") {
28
+ @if ($fill-tone == "dark") {
30
29
  @include mdc-fab-ink-color(text-primary-on-dark);
31
30
  @include mdc-ripple-color(text-primary-on-dark, $mdc-ripple-pressed-light-ink-opacity);
32
31
  } @else {
@@ -0,0 +1,52 @@
1
+ // Copyright 2017 Google Inc. All Rights Reserved.
2
+ //
3
+ // Licensed under the Apache License, Version 2.0 (the "License");
4
+ // you may not use this file except in compliance with the License.
5
+ // You may obtain a copy of the License at
6
+ //
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ //
9
+ // Unless required by applicable law or agreed to in writing, software
10
+ // distributed under the License is distributed on an "AS IS" BASIS,
11
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ // See the License for the specific language governing permissions and
13
+ // limitations under the License.
14
+
15
+ @import "@material/theme/mixins";
16
+ @import "@material/theme/variables"; // for mdc-theme-prop-value
17
+
18
+ @mixin mdc-linear-progress-bar-color($color) {
19
+ .mdc-linear-progress__bar-inner {
20
+ @include mdc-theme-prop(background-color, $color);
21
+ }
22
+ }
23
+
24
+ @mixin mdc-linear-progress-buffer-color($color) {
25
+ // We need to escape the '#' character as "%23" for SVG because '#' is a reserved character in URIs.
26
+ $color-value-for-css: mdc-theme-prop-value($color);
27
+ $color-value-for-svg: mdc-linear-progress-str-replace_(#{$color-value-for-css}, "#", "%23");
28
+
29
+ .mdc-linear-progress__buffering-dots {
30
+ // SVG is optimized for data URI (https://codepen.io/tigt/post/optimizing-svgs-in-data-uris)
31
+ // stylelint-disable-next-line function-url-quotes
32
+ background-image: url("data:image/svg+xml,%3Csvg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' x='0px' y='0px' enable-background='new 0 0 5 2' xml:space='preserve' viewBox='0 0 5 2' preserveAspectRatio='none slice'%3E%3Ccircle cx='1' cy='1' r='1' fill='#{$color-value-for-svg}'/%3E%3C/svg%3E");
33
+ }
34
+
35
+ .mdc-linear-progress__buffer {
36
+ background-color: $color-value-for-css;
37
+ }
38
+ }
39
+
40
+ // Based on https://css-tricks.com/snippets/sass/str-replace-function/
41
+ @function mdc-linear-progress-str-replace_($string, $search, $replace) {
42
+ $index: str-index($string, $search);
43
+
44
+ @if $index {
45
+ $head: str-slice($string, 1, $index - 1);
46
+ $tail: mdc-linear-progress-str-replace_(str-slice($string, $index + str-length($search)), $search, $replace);
47
+
48
+ @return $head + $replace + $tail;
49
+ }
50
+
51
+ @return $string;
52
+ }
@@ -0,0 +1,15 @@
1
+ // Copyright 2017 Google Inc. All Rights Reserved.
2
+ //
3
+ // Licensed under the Apache License, Version 2.0 (the "License");
4
+ // you may not use this file except in compliance with the License.
5
+ // You may obtain a copy of the License at
6
+ //
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ //
9
+ // Unless required by applicable law or agreed to in writing, software
10
+ // distributed under the License is distributed on an "AS IS" BASIS,
11
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ // See the License for the specific language governing permissions and
13
+ // limitations under the License.
14
+
15
+ $mdc-linear-progress-baseline-buffer-color: #e6e6e6;
@@ -13,10 +13,14 @@
13
13
  // limitations under the License.
14
14
 
15
15
  @import "@material/animation/functions";
16
- @import "@material/theme/mixins";
17
16
  @import "./keyframes";
17
+ @import "./mixins";
18
+ @import "./variables";
18
19
 
19
20
  .mdc-linear-progress {
21
+ @include mdc-linear-progress-bar-color(primary);
22
+ @include mdc-linear-progress-buffer-color($mdc-linear-progress-baseline-buffer-color);
23
+
20
24
  position: relative;
21
25
  width: 100%;
22
26
  height: 4px;
@@ -34,8 +38,6 @@
34
38
  }
35
39
 
36
40
  &__bar-inner {
37
- @include mdc-theme-prop(background-color, primary);
38
-
39
41
  display: inline-block;
40
42
  position: absolute;
41
43
  width: 100%;
@@ -43,18 +45,11 @@
43
45
  animation: none;
44
46
  }
45
47
 
46
- &--accent .mdc-linear-progress__bar-inner {
47
- @include mdc-theme-prop(background-color, secondary);
48
- }
49
-
50
48
  &__buffering-dots {
51
49
  position: absolute;
52
50
  width: 100%;
53
51
  height: 100%;
54
52
  animation: buffering 250ms infinite linear;
55
- // SVG is optimized for data URI (https://codepen.io/tigt/post/optimizing-svgs-in-data-uris)
56
- // stylelint-disable-next-line function-url-quotes
57
- background-image: url("data:image/svg+xml,%3Csvg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' x='0px' y='0px' enable-background='new 0 0 5 2' xml:space='preserve' viewBox='0 0 5 2' preserveAspectRatio='none slice'%3E%3Ccircle cx='1' cy='1' r='1' fill='%23e6e6e6'/%3E%3C/svg%3E");
58
53
  background-repeat: repeat-x;
59
54
  background-size: 10px 4px;
60
55
  }
@@ -65,7 +60,6 @@
65
60
  height: 100%;
66
61
  transform-origin: top left;
67
62
  transition: mdc-animation-exit-temporary(transform, 250ms);
68
- background-color: #e6e6e6;
69
63
  }
70
64
 
71
65
  &__secondary-bar {
@@ -61,6 +61,7 @@ $mdc-simple-menu-item-fade-duration: .3s;
61
61
 
62
62
  &--animating {
63
63
  display: inline-block;
64
+ overflow-y: hidden;
64
65
  transition: opacity $mdc-simple-menu-fade-duration $mdc-animation-deceleration-curve-timing-function;
65
66
  }
66
67
 
@@ -0,0 +1,30 @@
1
+ //
2
+ // Copyright 2017 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
+ @keyframes mdc-slider-emphasize {
18
+ 0% {
19
+ animation-timing-function: ease-out;
20
+ }
21
+
22
+ 50% {
23
+ animation-timing-function: ease-in;
24
+ transform: scale(.85);
25
+ }
26
+
27
+ 100% {
28
+ transform: scale(.571);
29
+ }
30
+ }
@@ -0,0 +1,129 @@
1
+ //
2
+ // Copyright 2017 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
+ @import "@material/theme/mixins";
19
+ @import "@material/theme/variables"; // for mdc-theme-prop-value
20
+ @import "./variables";
21
+
22
+ //
23
+ // Public
24
+ //
25
+
26
+ @mixin mdc-slider-highlight-color($color) {
27
+ &:not(.mdc-slider--disabled) {
28
+ @include mdc-slider-highlight-color_($color);
29
+ }
30
+ }
31
+
32
+ @mixin mdc-slider-rail-color($color, $opacity: $mdc-slider-baseline-rail-opacity) {
33
+ &:not(.mdc-slider--disabled) {
34
+ @include mdc-slider-rail-color_($color, $opacity);
35
+ }
36
+ }
37
+
38
+ @mixin mdc-slider-rail-tick-mark-color($color) {
39
+ &:not(.mdc-slider--disabled) {
40
+ @include mdc-slider-rail-tick-mark-color_($color);
41
+ }
42
+ }
43
+
44
+ @mixin mdc-slider-thumb-color($color) {
45
+ &:not(.mdc-slider--disabled) {
46
+ @include mdc-slider-thumb-color_($color);
47
+ }
48
+ }
49
+
50
+ @mixin mdc-slider-focus-halo-color($color) {
51
+ &:not(.mdc-slider--disabled) {
52
+ .mdc-slider__focus-ring {
53
+ @include mdc-theme-prop(background-color, $color);
54
+ }
55
+ }
56
+ }
57
+
58
+ @mixin mdc-slider-value-pin-ink-color($color) {
59
+ &:not(.mdc-slider--disabled) {
60
+ .mdc-slider__pin {
61
+ @include mdc-theme-prop(color, $color);
62
+ }
63
+ }
64
+ }
65
+
66
+ @mixin mdc-slider-value-pin-fill-color($color) {
67
+ &:not(.mdc-slider--disabled) {
68
+ .mdc-slider__pin {
69
+ @include mdc-theme-prop(background-color, $color);
70
+ }
71
+ }
72
+ }
73
+
74
+ @mixin mdc-slider-value-pin-fill-color-accessible($color) {
75
+ $color-value: mdc-theme-prop-value($color);
76
+ $ink-color: if(mdc-theme-tone($color-value) == "light", text-primary-on-light, text-primary-on-dark);
77
+
78
+ @include mdc-slider-value-pin-fill-color($color);
79
+ @include mdc-slider-value-pin-ink-color($ink-color);
80
+ }
81
+
82
+ // NOTE: This mixin sets the color of ALL customizable elements in the slider. If new elements are added, this mixin
83
+ // should be updated to cover those additional elements.
84
+ @mixin mdc-slider-color-accessible($color) {
85
+ @include mdc-slider-highlight-color($color);
86
+ @include mdc-slider-rail-color($color);
87
+ @include mdc-slider-rail-tick-mark-color($color);
88
+ @include mdc-slider-thumb-color($color);
89
+ @include mdc-slider-focus-halo-color($color);
90
+ @include mdc-slider-value-pin-fill-color-accessible($color);
91
+ }
92
+
93
+ //
94
+ // Private
95
+ //
96
+
97
+ @mixin mdc-slider-highlight-color_($color) {
98
+ .mdc-slider__track {
99
+ @include mdc-theme-prop(background-color, $color);
100
+ }
101
+ }
102
+
103
+ @mixin mdc-slider-rail-color_($color, $opacity: $mdc-slider-baseline-rail-opacity) {
104
+ .mdc-slider__track-container {
105
+ @include mdc-theme-prop(background-color, rgba(mdc-theme-prop-value($color), $opacity));
106
+ }
107
+ }
108
+
109
+ @mixin mdc-slider-rail-tick-mark-color_($color) {
110
+ .mdc-slider__track-marker::after,
111
+ .mdc-slider__track-marker-container::after {
112
+ @include mdc-theme-prop(background-color, $color);
113
+ }
114
+ }
115
+
116
+ @mixin mdc-slider-thumb-color_($color) {
117
+ .mdc-slider__thumb {
118
+ @include mdc-theme-prop(fill, $color);
119
+ @include mdc-theme-prop(stroke, $color);
120
+ }
121
+ }
122
+
123
+ @mixin mdc-slider-thumb-stroke-cutout_($color) {
124
+ .mdc-slider__thumb {
125
+ /* @alternate */
126
+ stroke: $color;
127
+ stroke: var(--mdc-slider-bg-color-behind-component, $color);
128
+ }
129
+ }