Skip to content
This repository was archived by the owner on May 20, 2023. It is now read-only.

Commit 326e232

Browse files
Googlernshahan
authored andcommitted
Import MDC Web v0.38.0. This includes adding experimental list templates as well as the changes from all of the releases listed below.
0.38.0 (2018-07-30) Bug Fixes chips: Remove color change from selected filter chips (#3093) (19e3d7f) infrastructure: Rework goog.module positioning (#3098) (fbbf58a) theme: Allow CSS variables to be passed to mdc-theme-prop (#3086) (b47fe7d) Code Refactoring chips: Register handlers in component instead of foundation (#3146) (36e2755) Features floating-label: Add max-width mixin (#2956) (66f8bf7) icon-button: update event handling to new standard (#3165) (531867e) list: Add single selection (#2970) (cd1f972) list: Updated two-line list to use typography baseline to match spec. (#3085) (4d11b37) switch: Merge updated switch into master (#3214) (19724f1), closes #2825 typography: New mixin to set exact baseline height of text elements. (#3083) (dd3817a) BREAKING CHANGES switch: MDC Switch DOM structure and Sass APIs have changed, and JavaScript APIs have been added. See the documentation for more information. icon-button: Removed some adapter APIs (registerInteractionHandler, deregisterInteractionHandler) and shifted responsibility of event handling out of the foundation and into the component. chips: MDCChip/MDCChipSet registerEventHandler adapter methods were removed, and corresponding handlers were made public in MDCChipFoundation/MDCChipSetFoundation. 0.37.1 (2018-07-16) Bug Fixes hot-patching closure annotations. (#3024) (d5b95ab) button: Remove dense/stroked line-height tweaks to improve alignment (#3028) (8b5f595) notched-outline: Remove unused dependency from scss (#3044) (85ecf11) typography: Update variable reference to work for newer versions of ruby-sass (#3047) (0dfad9a) 0.37.0 (2018-07-02) Bug Fixes chips: Add an event typedef for chip interaction events (#2965) (153e737) icon-button: Remove unused styles, update docs, code cleanup (#2957) (32b5b9d) Features chips: Expose method to begin chip exit animation (#2845) (eb00fd3) chips: Make chip exit on trailing icon click optional (#2893) (9178d46) chips: Make event handlers on Chip public (#2997) (963e0c1) fab: Add Extended FAB (14cb0bf) fab: Enable padding customization (#2959) (1f5fd1f) list: Add arrow key a11y support. (#2871) (7c06e9f) ripple: Expose focus/blur handlers (#2905) (31d81ad) 0.36.1 (2018-06-18) Bug Fixes checkbox: support high contrast mode in Firefox on Windows (#2927) (8b7d77e) menu: Update adapter to check for focus before calling (#2880) (84fcc08) text-field: Hide extraneous border in FF in HC mode. (#2931) (bd4c563) PiperOrigin-RevId: 209690562
1 parent 2b45215 commit 326e232

File tree

3 files changed

+18
-19
lines changed

3 files changed

+18
-19
lines changed

lib/css/mdc_web/elevation/_mixins.scss

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,7 @@
3030
@error "$z-value must be between 0 and 24, but received '#{$z-value}'";
3131
}
3232

33-
@if map-has-key($mdc-theme-property-values, $color) {
34-
$color: map-get($mdc-theme-property-values, $color);
35-
}
36-
37-
@if type-of($color) != color {
38-
@error "$color must be a valid color, but '#{$color}' is of type #{type-of($color)}";
39-
}
33+
$color: mdc-theme-prop-value($color);
4034

4135
$umbra-z-value: map-get($mdc-elevation-umbra-map, $z-value);
4236
$penumbra-z-value: map-get($mdc-elevation-penumbra-map, $z-value);

lib/css/mdc_web/theme/_mixins.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@
1818

1919
// Applies the correct theme color style to the specified property.
2020
// $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), or a literal color value.
21+
// $style should be one of the map keys in $mdc-theme-property-values (_variables.scss), or a color value.
2222
// $edgeOptOut controls whether to feature-detect around Edge to avoid emitting CSS variables for it,
2323
// intended for use in cases where interactions with pseudo-element styles cause problems due to Edge bugs.
2424
@mixin mdc-theme-prop($property, $style, $important: false, $edgeOptOut: false) {
25-
@if type-of($style) == "color" or $style == "currentColor" {
25+
@if mdc-theme-is-valid-theme-prop-value_($style) {
2626
@if $important {
2727
#{$property}: $style !important;
2828
} @else {

lib/css/mdc_web/theme/_variables.scss

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -105,28 +105,28 @@ $mdc-theme-property-values: (
105105
text-icon-on-dark: mdc-theme-ink-color-for-fill_(icon, dark)
106106
);
107107

108-
// If `$property` is a literal color value (e.g., `blue`, `#fff`), it is returned verbatim. Otherwise, the value of the
109-
// corresponding theme property (from `$mdc-theme-property-values`) is returned. If `$property` is not a color and no
110-
// such theme property exists, an error is thrown.
108+
// If `$style` is a color (a literal color value, `currentColor`, or a CSS custom property), it is returned verbatim.
109+
// Otherwise, `$style` is treated as a theme property name, and the corresponding value from
110+
// `$mdc-theme-property-values` is returned. If this also fails, an error is thrown.
111111
//
112112
// This is mainly useful in situations where `mdc-theme-prop` cannot be used directly (e.g., `box-shadow`).
113113
//
114114
// Examples:
115115
//
116-
// 1. mdc-theme-prop-value(primary) => "#3f51b5"
116+
// 1. mdc-theme-prop-value(primary) => "#6200ee"
117117
// 2. mdc-theme-prop-value(blue) => "blue"
118118
//
119119
// NOTE: This function must be defined in _variables.scss instead of _functions.scss to avoid circular imports.
120-
@function mdc-theme-prop-value($property) {
121-
@if type-of($property) == "color" or $property == "currentColor" {
122-
@return $property;
120+
@function mdc-theme-prop-value($style) {
121+
@if mdc-theme-is-valid-theme-prop-value_($style) {
122+
@return $style;
123123
}
124124

125-
@if not map-has-key($mdc-theme-property-values, $property) {
126-
@error "Invalid theme property: '#{$property}'. Choose one of: #{map-keys($mdc-theme-property-values)}";
125+
@if not map-has-key($mdc-theme-property-values, $style) {
126+
@error "Invalid theme property: '#{$style}'. Choose one of: #{map-keys($mdc-theme-property-values)}";
127127
}
128128

129-
@return map-get($mdc-theme-property-values, $property);
129+
@return map-get($mdc-theme-property-values, $style);
130130
}
131131

132132
// NOTE: This function must be defined in _variables.scss instead of _functions.scss to avoid circular imports.
@@ -140,3 +140,8 @@ $mdc-theme-property-values: (
140140

141141
@return map-get($color-map-for-tone, $text-style);
142142
}
143+
144+
// NOTE: This function is depended upon by mdc-theme-prop-value (above) and thus must be defined in this file.
145+
@function mdc-theme-is-valid-theme-prop-value_($style) {
146+
@return type-of($style) == "color" or $style == "currentColor" or str_slice($style, 1, 4) == "var(";
147+
}

0 commit comments

Comments
 (0)