material_components_web-sass 0.19.0 → 0.20.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8bc374604a8e6e5c0784cb0dd4b49a1c31008ea7
4
- data.tar.gz: b272cd91af045421a3f3566b9e176e0bb3e29c4d
3
+ metadata.gz: d8ca8d42be1db8293e67a81ea8982e79f83a046c
4
+ data.tar.gz: d273a3510c91da3706a0d025f3c362d14efe8555
5
5
  SHA512:
6
- metadata.gz: 0a2cee9844bdf1c46f683e8000304160f0bab9aa208a531951a8af43506994ef435f16df8518b7e3f3e86e2f9ae025f91fed531dc8097255aabfad95f2fb9cc1
7
- data.tar.gz: a8d6f8c0566c203bc2cad947352bf3d82586fdd09fa0c2a8ebdc3ea8c9d46c150903069c9ff001c8f6aafa3c45bb8a26efe0fdf9950d6dee6fcb2d58fad6c7c2
6
+ metadata.gz: 42483b7070fc79daa3e449c3c67aa5fd8f50e960c103c22a5fe72af7126616d20262404ccf9455d3bbc1cd782ef24b6ddc9d1f69d9a9aa31f9abae1167202c5a
7
+ data.tar.gz: 6c66d8344e4ad7cff4f95a3591ee0ca481e7fae829ca349fb7de97d69fb21ff268a82c7d96ca7bcc2a969dee83455b54eb03a7002f6d5a572b71b9be4182d663
data/CHANGELOG.md CHANGED
@@ -1,3 +1,12 @@
1
+ ## 0.20.0 (2017-09-06)
2
+
3
+ - Update assets to match upstream version
4
+
5
+ Library version:
6
+
7
+ - Material Components for the web v0.20.0
8
+ - Material Icons v3.0.0
9
+
1
10
  ## 0.19.0 (2017-08-27)
2
11
 
3
12
  - Update assets to match upstream version
@@ -1,5 +1,5 @@
1
1
  module MaterialComponentsWeb
2
2
  module Sass
3
- VERSION = '0.19.0'.freeze
3
+ VERSION = '0.20.0'.freeze
4
4
  end
5
5
  end
@@ -1039,21 +1039,17 @@ function detectEdgePseudoVarBug(windowObj) {
1039
1039
  // Detect versions of Edge with buggy var() support
1040
1040
  // See: https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/11495448/
1041
1041
  var document = windowObj.document;
1042
- var className = 'test-edge-css-var';
1043
- var styleNode = document.createElement('style');
1044
- document.head.appendChild(styleNode);
1045
- var sheet = styleNode.sheet;
1046
- // Internet Explorer 11 requires indices to always be specified to insertRule
1047
- sheet.insertRule(':root { --' + className + ': 1px solid #000; }', 0);
1048
- sheet.insertRule('.' + className + ' { visibility: hidden; }', 1);
1049
- sheet.insertRule('.' + className + '::before { border: var(--' + className + '); }', 2);
1050
1042
  var node = document.createElement('div');
1051
- node.className = className;
1043
+ node.className = 'mdc-ripple-surface--test-edge-var-bug';
1052
1044
  document.body.appendChild(node);
1053
- // Bug exists if ::before style ends up propagating to the parent element
1054
- var hasPseudoVarBug = windowObj.getComputedStyle(node).borderTopStyle === 'solid';
1045
+
1046
+ // The bug exists if ::before style ends up propagating to the parent element.
1047
+ // Additionally, getComputedStyle returns null in iframes with display: "none" in Firefox,
1048
+ // but Firefox is known to support CSS custom properties correctly.
1049
+ // See: https://bugzilla.mozilla.org/show_bug.cgi?id=548397
1050
+ var computedStyle = windowObj.getComputedStyle(node);
1051
+ var hasPseudoVarBug = computedStyle !== null && computedStyle.borderTopStyle === 'solid';
1055
1052
  node.remove();
1056
- styleNode.remove();
1057
1053
  return hasPseudoVarBug;
1058
1054
  }
1059
1055
 
@@ -11872,6 +11868,11 @@ var MDCTextfield = function (_MDCComponent) {
11872
11868
  set: function set(disabled) {
11873
11869
  this.foundation_.setDisabled(disabled);
11874
11870
  }
11871
+ }, {
11872
+ key: 'valid',
11873
+ set: function set(valid) {
11874
+ this.foundation_.setValid(valid);
11875
+ }
11875
11876
  }], [{
11876
11877
  key: 'attachTo',
11877
11878
  value: function attachTo(root) {
@@ -11983,6 +11984,7 @@ var MDCTextfieldFoundation = function (_MDCFoundation) {
11983
11984
  _this.inputKeydownHandler_ = function () {
11984
11985
  return _this.receivedUserInput_ = true;
11985
11986
  };
11987
+ _this.useCustomValidityChecking_ = false;
11986
11988
  return _this;
11987
11989
  }
11988
11990
 
@@ -12039,27 +12041,34 @@ var MDCTextfieldFoundation = function (_MDCFoundation) {
12039
12041
  value: function deactivateFocus_() {
12040
12042
  var _MDCTextfieldFoundati2 = MDCTextfieldFoundation.cssClasses,
12041
12043
  FOCUSED = _MDCTextfieldFoundati2.FOCUSED,
12042
- INVALID = _MDCTextfieldFoundati2.INVALID,
12043
12044
  LABEL_FLOAT_ABOVE = _MDCTextfieldFoundati2.LABEL_FLOAT_ABOVE;
12044
12045
 
12045
12046
  var input = this.getNativeInput_();
12046
- var isValid = input.checkValidity();
12047
12047
 
12048
12048
  this.adapter_.removeClass(FOCUSED);
12049
12049
  if (!input.value && !this.isBadInput_()) {
12050
12050
  this.adapter_.removeClassFromLabel(LABEL_FLOAT_ABOVE);
12051
12051
  this.receivedUserInput_ = false;
12052
12052
  }
12053
+ if (!this.useCustomValidityChecking_) {
12054
+ this.changeValidity_(input.checkValidity());
12055
+ }
12056
+ }
12057
+ }, {
12058
+ key: 'changeValidity_',
12059
+ value: function changeValidity_(isValid) {
12060
+ var INVALID = MDCTextfieldFoundation.cssClasses.INVALID;
12061
+
12053
12062
  if (isValid) {
12054
12063
  this.adapter_.removeClass(INVALID);
12055
12064
  } else {
12056
12065
  this.adapter_.addClass(INVALID);
12057
12066
  }
12058
- this.updateHelptextOnDeactivation_(isValid);
12067
+ this.updateHelptext_(isValid);
12059
12068
  }
12060
12069
  }, {
12061
- key: 'updateHelptextOnDeactivation_',
12062
- value: function updateHelptextOnDeactivation_(isValid) {
12070
+ key: 'updateHelptext_',
12071
+ value: function updateHelptext_(isValid) {
12063
12072
  var _MDCTextfieldFoundati3 = MDCTextfieldFoundation.cssClasses,
12064
12073
  HELPTEXT_PERSISTENT = _MDCTextfieldFoundati3.HELPTEXT_PERSISTENT,
12065
12074
  HELPTEXT_VALIDATION_MSG = _MDCTextfieldFoundati3.HELPTEXT_VALIDATION_MSG;
@@ -12122,6 +12131,12 @@ var MDCTextfieldFoundation = function (_MDCFoundation) {
12122
12131
  badInput: false
12123
12132
  };
12124
12133
  }
12134
+ }, {
12135
+ key: 'setValid',
12136
+ value: function setValid(isValid) {
12137
+ this.useCustomValidityChecking_ = true;
12138
+ this.changeValidity_(isValid);
12139
+ }
12125
12140
  }]);
12126
12141
 
12127
12142
  return MDCTextfieldFoundation;
@@ -18,7 +18,7 @@
18
18
  @import "@material/theme/mixins";
19
19
  @import "@material/theme/variables";
20
20
 
21
- @mixin mdc-button-filled() {
21
+ @mixin mdc-button-filled_() {
22
22
  @include mdc-ripple-base;
23
23
  @include mdc-ripple-bg((pseudo: "::before", base-color: white, opacity: .32));
24
24
  @include mdc-ripple-fg((pseudo: "::after", base-color: white, opacity: .32));
@@ -77,7 +77,7 @@
77
77
 
78
78
  .mdc-button--raised,
79
79
  .mdc-button--unelevated {
80
- @include mdc-button-filled;
80
+ @include mdc-button-filled_;
81
81
  }
82
82
 
83
83
  .mdc-button--raised {
@@ -94,6 +94,23 @@
94
94
  }
95
95
  }
96
96
 
97
+ .mdc-button--stroked {
98
+ @include mdc-theme-prop(border-color, text-primary-on-light);
99
+
100
+ border-width: 2px;
101
+ border-style: solid;
102
+ line-height: 32px;
103
+
104
+ @include mdc-theme-dark(".mdc-button") {
105
+ @include mdc-theme-prop(border-color, text-primary-on-dark);
106
+ }
107
+
108
+ // postcss-bem-linter: ignore
109
+ &.mdc-button--dense {
110
+ line-height: 27px; // To accommodate odd font size of dense button
111
+ }
112
+ }
113
+
97
114
  .mdc-button--compact {
98
115
  padding: 0 8px;
99
116
  }
@@ -134,6 +151,14 @@
134
151
  @include mdc-theme-prop(background-color, $theme-style);
135
152
  @include mdc-theme-prop(color, text-primary-on-#{$theme-style});
136
153
  }
154
+ // postcss-bem-linter: ignore
155
+ &.mdc-button--stroked {
156
+ @include mdc-theme-prop(border-color, $theme-style);
157
+
158
+ @include mdc-theme-dark(".mdc-button") {
159
+ @include mdc-theme-prop(border-color, $theme-style);
160
+ }
161
+ }
137
162
  }
138
163
  }
139
164
 
@@ -168,4 +193,15 @@
168
193
  }
169
194
  }
170
195
  }
196
+
197
+ .mdc-button--stroked {
198
+ fieldset:disabled &,
199
+ &:disabled {
200
+ border-color: rgba(black, .38);
201
+
202
+ @include mdc-theme-dark(".mdc-button") {
203
+ @include mdc-theme-prop(border-color, text-disabled-on-dark);
204
+ }
205
+ }
206
+ }
171
207
  // postcss-bem-linter: end
@@ -14,6 +14,7 @@
14
14
  // limitations under the License.
15
15
  //
16
16
 
17
+ @import "@material/animation/variables";
17
18
  @import "@material/theme/mixins";
18
19
  @import "./variables";
19
20
 
@@ -74,7 +75,7 @@
74
75
  }
75
76
 
76
77
  50% {
77
- @include mdc-animation-deceleration-curve;
78
+ animation-timing-function: $mdc-animation-deceleration-curve-timing-function;
78
79
  }
79
80
 
80
81
  100% {
@@ -99,8 +100,7 @@
99
100
 
100
101
  @keyframes mdc-checkbox-checked-unchecked-checkmark-path {
101
102
  from {
102
- @include mdc-animation-acceleration-curve;
103
-
103
+ animation-timing-function: $mdc-animation-acceleration-curve-timing-function;
104
104
  opacity: 1;
105
105
  stroke-dashoffset: 0;
106
106
  }
@@ -113,10 +113,9 @@
113
113
 
114
114
  @keyframes mdc-checkbox-checked-indeterminate-checkmark {
115
115
  from {
116
+ animation-timing-function: $mdc-animation-deceleration-curve-timing-function;
116
117
  transform: rotate(0deg);
117
118
  opacity: 1;
118
-
119
- @include mdc-animation-deceleration-curve;
120
119
  }
121
120
 
122
121
  to {
@@ -140,10 +139,9 @@
140
139
 
141
140
  @keyframes mdc-checkbox-checked-indeterminate-mixedmark {
142
141
  from {
142
+ animation-timing-function: mdc-animation-deceleration-curve-timing-function;
143
143
  transform: rotate(-45deg);
144
144
  opacity: 0;
145
-
146
- @include mdc-animation-deceleration-curve;
147
145
  }
148
146
 
149
147
  to {
@@ -15,16 +15,11 @@
15
15
  //
16
16
 
17
17
  @import "@material/animation/functions";
18
- @import "@material/animation/mixins";
19
18
  @import "@material/ripple/mixins";
20
19
  @import "@material/rtl/mixins";
21
20
  @import "./variables";
22
21
  @import "./keyframes";
23
22
 
24
- @function mdc-checkbox-transition($property, $timing-function, $delay: 0ms, $duration: $mdc-checkbox-transition-duration) {
25
- @return $property $duration $timing-function $delay;
26
- }
27
-
28
23
  @function mdc-checkbox-transition-enter($property, $delay: 0ms, $duration: $mdc-checkbox-transition-duration) {
29
24
  @return mdc-animation-enter($property, $duration, $delay);
30
25
  }
@@ -39,7 +39,7 @@ $mdc-dialog-dark-theme-bg-color: #303030 !default;
39
39
  width: 100%;
40
40
  height: 100%;
41
41
  visibility: hidden;
42
- z-index: 2;
42
+ z-index: 5;
43
43
 
44
44
  &__backdrop {
45
45
  position: fixed;
@@ -141,10 +141,10 @@ $mdc-dialog-dark-theme-bg-color: #303030 !default;
141
141
  @include mdc-rtl-reflexive-box(margin, right, 0);
142
142
  }
143
143
  }
144
+ }
144
145
 
145
- &__action {
146
- @include mdc-theme-prop(color, secondary);
147
- }
146
+ &__action {
147
+ @include mdc-theme-prop(color, secondary);
148
148
  }
149
149
 
150
150
  // TODO: Replace with breakpoint variable
@@ -0,0 +1,99 @@
1
+ // Copyright 2016 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/animation/functions";
16
+ @import "@material/animation/variables";
17
+ @import "@material/elevation/mixins";
18
+ @import "@material/ripple/mixins";
19
+ @import "@material/theme/mixins";
20
+
21
+ @mixin mdc-fab-container-color($color) {
22
+ @include mdc-theme-prop(background-color, $color);
23
+ }
24
+
25
+ @mixin mdc-fab-ink-color($color) {
26
+ @include mdc-theme-prop(color, $color);
27
+ }
28
+
29
+ @mixin mdc-fab-ripple($ripple-config) {
30
+ @include mdc-ripple-bg(map-merge((pseudo: "::before"), $ripple-config));
31
+ @include mdc-ripple-fg(map-merge((pseudo: "::after"), $ripple-config));
32
+ }
33
+
34
+ @mixin mdc-fab-base_ {
35
+ @include mdc-ripple-base;
36
+
37
+ display: inline-flex;
38
+ position: relative;
39
+ justify-content: center;
40
+ width: 56px;
41
+ height: 56px;
42
+ padding: 0;
43
+ transition: box-shadow 280ms $mdc-animation-standard-curve-timing-function;
44
+ border: none;
45
+ border-radius: 50%;
46
+ cursor: pointer;
47
+ user-select: none;
48
+ box-sizing: border-box;
49
+ fill: currentColor;
50
+ -moz-appearance: none;
51
+ -webkit-appearance: none;
52
+ overflow: hidden;
53
+
54
+ @include mdc-elevation(6);
55
+
56
+ &:active {
57
+ @include mdc-elevation(12);
58
+ }
59
+
60
+ &:active,
61
+ &:focus {
62
+ // TODO(acdvorak): Should this be paired with states and/or ripple? We don't want to disable outline
63
+ // (an accessibility/usability feature) unless we're confident that there is also a visual indication that the
64
+ // element has focus. If the client has customized the DOM in some unexpected way, and is certain that another
65
+ // element will receive focus instead, they can always override this property manually in their CSS.
66
+ outline: none;
67
+ }
68
+
69
+ &:hover {
70
+ cursor: pointer;
71
+ }
72
+
73
+ &::-moz-focus-inner {
74
+ padding: 0;
75
+ border: 0;
76
+ }
77
+
78
+ // This allows for using SVGs within them to align properly in all browsers.
79
+ // Can remove once: https://bugzilla.mozilla.org/show_bug.cgi?id=1294515 is resolved.
80
+
81
+ // stylelint-disable selector-max-type
82
+ // postcss-bem-linter: ignore
83
+ > svg {
84
+ width: 100%;
85
+ }
86
+ // stylelint-enable selector-max-type
87
+ }
88
+
89
+ @mixin mdc-fab--mini_ {
90
+ width: 40px;
91
+ height: 40px;
92
+ }
93
+
94
+ @mixin mdc-fab__icon_ {
95
+ display: flex;
96
+ align-items: center;
97
+ justify-content: center;
98
+ width: 100%;
99
+ }
@@ -12,98 +12,34 @@
12
12
  // See the License for the specific language governing permissions and
13
13
  // limitations under the License.
14
14
 
15
- @import "@material/animation/functions";
16
- @import "@material/animation/variables";
17
- @import "@material/elevation/mixins";
18
- @import "@material/ripple/mixins";
19
- @import "@material/theme/mixins";
15
+ @import "@material/theme/variables";
16
+ @import "./mixins";
20
17
 
21
18
  // postcss-bem-linter: define fab
22
- .mdc-fab {
23
- @include mdc-ripple-base;
24
- @include mdc-ripple-bg((pseudo: "::before", base-color: white, opacity: .16));
25
- @include mdc-ripple-fg((pseudo: "::after", base-color: white, opacity: .16));
26
19
 
27
- display: inline-flex;
28
- position: relative;
29
- justify-content: center;
30
- width: 56px;
31
- height: 56px;
32
- padding: 0;
33
- transition: box-shadow 280ms $mdc-animation-standard-curve-timing-function;
34
- border: none;
35
- border-radius: 50%;
36
- cursor: pointer;
37
- user-select: none;
38
- box-sizing: border-box;
39
- fill: currentColor;
40
- -moz-appearance: none;
41
- -webkit-appearance: none;
42
- overflow: hidden;
20
+ .mdc-fab {
21
+ @include mdc-fab-base_;
22
+ @include mdc-fab-container-color(secondary);
23
+ @include mdc-fab-ink-color(text-primary-on-secondary);
24
+ @include mdc-fab-ripple((base-color: white, opacity: .16));
43
25
 
44
26
  &:not(.mdc-ripple-upgraded) {
45
27
  -webkit-tap-highlight-color: rgba(0, 0, 0, .18);
46
28
  }
29
+ }
47
30
 
48
- @include mdc-theme-prop(background-color, secondary);
49
- @include mdc-theme-prop(color, text-primary-on-secondary);
50
- @include mdc-elevation(6);
51
-
52
- &--mini {
53
- width: 40px;
54
- height: 40px;
55
- }
56
-
57
- &--plain {
58
- background-color: white;
59
-
60
- @include mdc-theme-prop(color, text-primary-on-light);
61
- @include mdc-ripple-bg((pseudo: "::before"));
62
- @include mdc-ripple-fg((pseudo: "::after"));
63
- }
64
-
65
- &:active,
66
- &:focus {
67
- outline: none;
68
- }
69
-
70
- &:active {
71
- @include mdc-elevation(12);
72
- }
73
-
74
- &:hover {
75
- cursor: pointer;
76
- }
77
-
78
- &::-moz-focus-inner {
79
- padding: 0;
80
- border: 0;
81
- }
82
-
83
- // This allows for using SVGs within them to align properly in all browsers.
84
- // Can remove once: https://bugzilla.mozilla.org/show_bug.cgi?id=1294515 is resolved.
85
-
86
- // stylelint-disable selector-max-type
87
- // postcss-bem-linter: ignore
88
- > svg {
89
- width: 100%;
90
- }
91
- // stylelint-enable selector-max-type
31
+ .mdc-fab--plain {
32
+ @include mdc-fab-container-color(white);
33
+ @include mdc-fab-ink-color(text-primary-on-light);
34
+ @include mdc-fab-ripple(()); // default dark ripple
35
+ }
92
36
 
93
- fieldset:disabled &,
94
- &:disabled {
95
- background-color: rgba(0, 0, 0, .12);
96
- color: rgba(0, 0, 0, .26);
97
- cursor: default;
98
- pointer-events: none;
99
- }
37
+ .mdc-fab--mini {
38
+ @include mdc-fab--mini_;
100
39
  }
101
40
 
102
41
  .mdc-fab__icon {
103
- display: flex;
104
- align-items: center;
105
- justify-content: center;
106
- width: 100%;
42
+ @include mdc-fab__icon_;
107
43
  }
108
44
 
109
45
  // postcss-bem-linter: end
@@ -54,4 +54,20 @@
54
54
  }
55
55
  }
56
56
 
57
+ // Styles used to detect buggy behavior of CSS custom properties in Edge
58
+ // See: https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/11495448/
59
+
60
+ .mdc-ripple-surface--test-edge-var-bug {
61
+ // stylelint-disable plugin/selector-bem-pattern
62
+ // bem linter is disabled because it cannot correctly reconcile mdc prefix for css variables.
63
+ --mdc-ripple-surface-test-edge-var: 1px solid #000;
64
+ // stylelint-enable plugin/selector-bem-pattern
65
+
66
+ visibility: hidden;
67
+
68
+ &::before {
69
+ border: var(--mdc-ripple-surface-test-edge-var);
70
+ }
71
+ }
72
+
57
73
  // postcss-bem-linter: end
@@ -28,6 +28,3 @@ $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-transition-duration: 175ms;
33
- $mdc-switch-transition-curve: cubic-bezier(.4, 0, .2, 1);
@@ -12,15 +12,13 @@
12
12
  // See the License for the specific language governing permissions and
13
13
  // limitations under the License.
14
14
 
15
- @import "@material/animation/functions";
16
15
  @import "@material/animation/variables";
17
16
  @import "@material/elevation/mixins";
18
17
  @import "@material/theme/mixins";
19
- @import "./mixins";
20
18
  @import "./variables";
21
19
 
22
20
  @function mdc-switch-transition($property) {
23
- @return $property 90ms $mdc-switch-transition-curve;
21
+ @return $property 90ms $mdc-animation-standard-curve-timing-function;
24
22
  }
25
23
 
26
24
  // postcss-bem-linter: define switch
@@ -16,6 +16,11 @@
16
16
 
17
17
  @import "./constants";
18
18
 
19
+ // Used by the functions below to shift a color's luminance by approximately
20
+ // one index within its tonal palette.
21
+ // E.g., shift from Red 500 to Red 400 or Red 600.
22
+ $_mdc-theme-tonal-offset: 7%;
23
+
19
24
  // Calculate the luminance for a color.
20
25
  // See https://www.w3.org/TR/WCAG20-TECHS/G17.html#G17-tests
21
26
  @function mdc-theme-luminance($color) {
@@ -51,3 +56,65 @@
51
56
  @return "light";
52
57
  }
53
58
  }
59
+
60
+ // lighten() and darken() require values to be between 0% and 100%.
61
+ @function mdc-theme-clamp-percentage_($percentage) {
62
+ @return max(0%, min(100%, $percentage));
63
+ }
64
+
65
+ // Generate light and dark variants of the given color, offset by approximately
66
+ // the specified number of indexes within the color's tonal palette.
67
+ @function mdc-theme-tonal-variants_($color, $num-indexes: 2) {
68
+ $luminance: mdc-theme-luminance($color) * 100%;
69
+ $amount-1x: mdc-theme-clamp-percentage_($_mdc-theme-tonal-offset * $num-indexes);
70
+ $amount-2x: mdc-theme-clamp-percentage_($_mdc-theme-tonal-offset * $num-indexes * 2);
71
+ $lower-bound: $amount-1x;
72
+ $upper-bound: 100% - $lower-bound;
73
+
74
+ @if $luminance <= $lower-bound {
75
+ @return (
76
+ dark: lighten($color, $amount-1x),
77
+ light: lighten($color, $amount-2x)
78
+ );
79
+ }
80
+
81
+ @else if $luminance >= $upper-bound {
82
+ @return (
83
+ dark: darken($color, $amount-2x),
84
+ light: darken($color, $amount-1x)
85
+ );
86
+ }
87
+
88
+ @else {
89
+ @return (
90
+ dark: darken($color, $amount-1x),
91
+ light: lighten($color, $amount-1x)
92
+ );
93
+ }
94
+ }
95
+
96
+ // Darken the given color by approximately the specified number of indexes
97
+ // within its tonal palette.
98
+ //
99
+ // If the color is already very dark, it will be lightened instead of darkened
100
+ // to ensure that the returned value is visually distinct from the input color.
101
+ //
102
+ // If the color is very light, it will be darkened twice as much as usual to
103
+ // ensure that the returned value is visually distinct from the light variant
104
+ // (which will actually end up being a dark shade).
105
+ @function mdc-theme-dark-variant($color, $num-indexes: 2) {
106
+ @return map-get(mdc-theme-tonal-variants_($color, $num-indexes), dark);
107
+ }
108
+
109
+ // Lighten the given color by approximately the specified number of indexes
110
+ // within its tonal palette.
111
+ //
112
+ // If the color is already very light, it will be darkened instead of lightened
113
+ // to ensure that the returned value is visually distinct from the input color.
114
+ //
115
+ // If the color is very dark, it will be lightened twice as much as usual to
116
+ // ensure that the returned value is visually distinct from the dark variant
117
+ // (which will actually end up being a light tint).
118
+ @function mdc-theme-light-variant($color, $num-indexes: 2) {
119
+ @return map-get(mdc-theme-tonal-variants_($color, $num-indexes), light);
120
+ }
@@ -18,22 +18,36 @@
18
18
 
19
19
  // Applies the correct theme color style to the specified property.
20
20
  // $property is typically color or background-color, but can be any CSS property that accepts color values.
21
- // $style should be one of the map keys in $mdc-theme-property-values (_variables.scss).
21
+ // $style should be one of the map keys in $mdc-theme-property-values (_variables.scss), or a literal color value.
22
22
  @mixin mdc-theme-prop($property, $style, $important: false) {
23
- @if not map-has-key($mdc-theme-property-values, $style) {
24
- @error "Invalid style: '#{$style}'. Choose one of: #{map-keys($mdc-theme-property-values)}";
25
- }
23
+ @if type-of($style) == "color" {
24
+ @if $important {
25
+ #{$property}: $style !important;
26
+ }
26
27
 
27
- @if $important {
28
- /* @alternate */
29
- #{$property}: map-get($mdc-theme-property-values, $style) !important;
30
- #{$property}: var(--mdc-theme-#{$style}, map-get($mdc-theme-property-values, $style)) !important;
28
+ @else {
29
+ #{$property}: $style;
30
+ }
31
31
  }
32
32
 
33
33
  @else {
34
- /* @alternate */
35
- #{$property}: map-get($mdc-theme-property-values, $style);
36
- #{$property}: var(--mdc-theme-#{$style}, map-get($mdc-theme-property-values, $style));
34
+ @if not map-has-key($mdc-theme-property-values, $style) {
35
+ @error "Invalid style: '#{$style}'. Choose one of: #{map-keys($mdc-theme-property-values)}";
36
+ }
37
+
38
+ $value: map-get($mdc-theme-property-values, $style);
39
+
40
+ @if $important {
41
+ /* @alternate */
42
+ #{$property}: $value !important;
43
+ #{$property}: var(--mdc-theme-#{$style}, $value) !important;
44
+ }
45
+
46
+ @else {
47
+ /* @alternate */
48
+ #{$property}: $value;
49
+ #{$property}: var(--mdc-theme-#{$style}, $value);
50
+ }
37
51
  }
38
52
  }
39
53
 
@@ -23,15 +23,15 @@
23
23
  //
24
24
 
25
25
  $mdc-theme-primary: #3f51b5 !default; // Indigo 500
26
- $mdc-theme-primary-light: lighten($mdc-theme-primary, 14%) !default;
27
- $mdc-theme-primary-dark: darken($mdc-theme-primary, 14%) !default;
26
+ $mdc-theme-primary-light: mdc-theme-light-variant($mdc-theme-primary) !default;
27
+ $mdc-theme-primary-dark: mdc-theme-dark-variant($mdc-theme-primary) !default;
28
28
 
29
29
  // The $mdc-theme-accent variable is DEPRECATED - it exists purely for backward compatibility.
30
30
  // The $mdc-theme-secondary* variables should be used for all new projects.
31
31
  $mdc-theme-accent: #ff4081 !default; // Pink A200
32
32
  $mdc-theme-secondary: $mdc-theme-accent !default;
33
- $mdc-theme-secondary-light: lighten($mdc-theme-secondary, 14%) !default;
34
- $mdc-theme-secondary-dark: darken($mdc-theme-secondary, 14%) !default;
33
+ $mdc-theme-secondary-light: mdc-theme-light-variant($mdc-theme-secondary) !default;
34
+ $mdc-theme-secondary-dark: mdc-theme-dark-variant($mdc-theme-secondary) !default;
35
35
 
36
36
  $mdc-theme-background: #fff !default; // White
37
37
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: material_components_web-sass
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.19.0
4
+ version: 0.20.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dmitriy Tarasov
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-08-27 00:00:00.000000000 Z
11
+ date: 2017-09-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: autoprefixer-rails
@@ -145,6 +145,7 @@ files:
145
145
  - vendor/assets/stylesheets/@material/elevation/_mixins.scss
146
146
  - vendor/assets/stylesheets/@material/elevation/_variables.scss
147
147
  - vendor/assets/stylesheets/@material/elevation/mdc-elevation.scss
148
+ - vendor/assets/stylesheets/@material/fab/_mixins.scss
148
149
  - vendor/assets/stylesheets/@material/fab/mdc-fab.scss
149
150
  - vendor/assets/stylesheets/@material/fonts/material-icons.scss
150
151
  - vendor/assets/stylesheets/@material/fonts/roboto.scss
@@ -169,7 +170,6 @@ files:
169
170
  - vendor/assets/stylesheets/@material/slider/mdc-slider.scss
170
171
  - vendor/assets/stylesheets/@material/snackbar/_variables.scss
171
172
  - vendor/assets/stylesheets/@material/snackbar/mdc-snackbar.scss
172
- - vendor/assets/stylesheets/@material/switch/_mixins.scss
173
173
  - vendor/assets/stylesheets/@material/switch/_variables.scss
174
174
  - vendor/assets/stylesheets/@material/switch/mdc-switch.scss
175
175
  - vendor/assets/stylesheets/@material/tabs/mdc-tabs.scss
@@ -210,7 +210,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
210
210
  version: '0'
211
211
  requirements: []
212
212
  rubyforge_project:
213
- rubygems_version: 2.6.12
213
+ rubygems_version: 2.6.13
214
214
  signing_key:
215
215
  specification_version: 4
216
216
  summary: Material Components for the web (MDC-Web) with Material Icons and Roboto
@@ -1,18 +0,0 @@
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, // 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
-
16
- @function mdc-switch-transition($property, $timing-function, $duration: $mdc-switch-transition-duration) {
17
- @return $property $duration $timing-function;
18
- }