diff --git a/packages/mdc-layout-grid/_mixins.scss b/packages/mdc-layout-grid/_mixins.scss
index 9ca857974f7..fc6223dc172 100644
--- a/packages/mdc-layout-grid/_mixins.scss
+++ b/packages/mdc-layout-grid/_mixins.scss
@@ -12,6 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.
+@import "./variables";
+
// returns the lower grid boundary or null if the smallest grid is selected
@function mdc-layout-grid-breakpoint-min($size) {
@if not map-has-key($mdc-layout-grid-columns, $size) {
diff --git a/packages/mdc-layout-grid/package.json b/packages/mdc-layout-grid/package.json
index bc3e13151b4..70559e2557e 100644
--- a/packages/mdc-layout-grid/package.json
+++ b/packages/mdc-layout-grid/package.json
@@ -1,6 +1,6 @@
{
"name": "@material/layout-grid",
- "version": "0.23.0",
+ "version": "0.24.0",
"description": "The Material Components for the web layout grid component",
"license": "Apache-2.0",
"keywords": [
diff --git a/packages/mdc-linear-progress/package.json b/packages/mdc-linear-progress/package.json
index be0d6bdb00d..0a5f71ece5c 100644
--- a/packages/mdc-linear-progress/package.json
+++ b/packages/mdc-linear-progress/package.json
@@ -1,7 +1,7 @@
{
"name": "@material/linear-progress",
"description": "The Material Components for the web linear progress indicator component",
- "version": "0.1.11",
+ "version": "0.24.0",
"license": "Apache-2.0",
"keywords": [
"material components",
@@ -14,8 +14,8 @@
},
"dependencies": {
"@material/animation": "^0.4.1",
- "@material/base": "^0.2.6",
- "@material/theme": "^0.4.0"
+ "@material/base": "^0.24.0",
+ "@material/theme": "^0.24.0"
},
"publishConfig": {
"access": "public"
diff --git a/packages/mdc-list/mdc-list.scss b/packages/mdc-list/mdc-list.scss
index 7d7ac8d2fda..966e8d8879d 100644
--- a/packages/mdc-list/mdc-list.scss
+++ b/packages/mdc-list/mdc-list.scss
@@ -154,9 +154,9 @@ a.mdc-list-item {
// stylelint-enable selector-max-type,selector-no-qualifying-type
.mdc-list-item.mdc-ripple-upgraded {
- @include mdc-ripple-base;
- @include mdc-ripple-bg((pseudo: "::before"));
- @include mdc-ripple-fg((pseudo: "::after"));
+ @include mdc-ripple-surface;
+ @include mdc-ripple-color;
+ @include mdc-ripple-radius;
@include mdc-rtl-reflexive-position(left, $mdc-list-side-padding * -1);
position: relative;
@@ -171,8 +171,7 @@ a.mdc-list-item {
}
@include mdc-theme-dark(".mdc-list") {
- @include mdc-ripple-bg((pseudo: "::before", base-color: white, opacity: .12));
- @include mdc-ripple-fg((pseudo: "::after", base-color: white, opacity: .12));
+ @include mdc-ripple-color(white, .12);
}
}
diff --git a/packages/mdc-list/package.json b/packages/mdc-list/package.json
index 004aed4840d..14c000e765a 100644
--- a/packages/mdc-list/package.json
+++ b/packages/mdc-list/package.json
@@ -1,7 +1,7 @@
{
"name": "@material/list",
"description": "The Material Components for the web list component",
- "version": "0.23.0",
+ "version": "0.24.0",
"license": "Apache-2.0",
"keywords": [
"material components",
@@ -15,7 +15,7 @@
"dependencies": {
"@material/rtl": "^0.1.8",
"@material/typography": "^0.3.0",
- "@material/ripple": "^0.23.0",
- "@material/theme": "^0.4.0"
+ "@material/ripple": "^0.24.0",
+ "@material/theme": "^0.24.0"
}
}
diff --git a/packages/mdc-menu/package.json b/packages/mdc-menu/package.json
index 5350f1c3885..7f3882cec9b 100644
--- a/packages/mdc-menu/package.json
+++ b/packages/mdc-menu/package.json
@@ -1,6 +1,6 @@
{
"name": "@material/menu",
- "version": "0.23.0",
+ "version": "0.24.0",
"description": "The Material Components for the web menu component",
"license": "Apache-2.0",
"keywords": [
@@ -15,9 +15,9 @@
},
"dependencies": {
"@material/animation": "^0.4.1",
- "@material/base": "^0.2.6",
+ "@material/base": "^0.24.0",
"@material/elevation": "^0.1.13",
- "@material/theme": "^0.4.0",
+ "@material/theme": "^0.24.0",
"@material/typography": "^0.3.0"
}
}
diff --git a/packages/mdc-radio/README.md b/packages/mdc-radio/README.md
index bf1863a33db..06badee4f24 100644
--- a/packages/mdc-radio/README.md
+++ b/packages/mdc-radio/README.md
@@ -211,9 +211,8 @@ Mixin | Description
`mdc-radio-checked-stroke-color($color)` | Sets the stroke color of a checked radio
`mdc-radio-ink-color($color)` | Sets the ink color
`mdc-radio-focus-indicator-color($color)` | Sets the color of the focus indicator
-`mdc-radio-ripple-color($ripple-config)` | Sets the ripple to the given [ripple configuration][ripple-readme]
-[ripple-readme]: https://github.com/material-components/material-components-web/blob/master/packages/mdc-ripple/README.md
+The ripple effect for the Radio Button component is styled using [MDC Ripple](../mdc-ripple) mixins.
### Caveat: Edge and CSS Variables
diff --git a/packages/mdc-radio/_mixins.scss b/packages/mdc-radio/_mixins.scss
index 9508e9715fb..18df1067aab 100644
--- a/packages/mdc-radio/_mixins.scss
+++ b/packages/mdc-radio/_mixins.scss
@@ -43,10 +43,3 @@
@include mdc-theme-prop(background-color, $color, $edgeOptOut: true);
}
}
-
-@mixin mdc-radio-ripple($ripple-config) {
- $ripple-config: map-merge((opacity: $mdc-radio-ripple-opacity, radius: 50%), $ripple-config);
-
- @include mdc-ripple-bg(map-merge($ripple-config, (pseudo: "::before")));
- @include mdc-ripple-fg(map-merge($ripple-config, (pseudo: "::after")));
-}
diff --git a/packages/mdc-radio/_variables.scss b/packages/mdc-radio/_variables.scss
index ae30c606a33..8fc397980d2 100644
--- a/packages/mdc-radio/_variables.scss
+++ b/packages/mdc-radio/_variables.scss
@@ -19,4 +19,5 @@ $mdc-radio-ui-size: 20px;
$mdc-radio-ui-pct: percentage($mdc-radio-ui-size / $mdc-radio-touch-area);
$mdc-radio-transition-duration: 120ms;
$mdc-radio-ripple-opacity: .14;
+$mdc-radio-ripple-radius: 50%;
$mdc-radio-baseline-theme-color: secondary;
diff --git a/packages/mdc-radio/mdc-radio.scss b/packages/mdc-radio/mdc-radio.scss
index f2341799871..2436db170ff 100644
--- a/packages/mdc-radio/mdc-radio.scss
+++ b/packages/mdc-radio/mdc-radio.scss
@@ -23,7 +23,6 @@
// postcss-bem-linter: define radio
.mdc-radio {
- @include mdc-ripple-base;
@include mdc-radio-unchecked-stroke-color(text-secondary-on-light);
@include mdc-theme-dark {
@@ -33,7 +32,9 @@
@include mdc-radio-checked-stroke-color($mdc-radio-baseline-theme-color);
@include mdc-radio-ink-color($mdc-radio-baseline-theme-color);
@include mdc-radio-focus-indicator-color($mdc-radio-baseline-theme-color);
- @include mdc-radio-ripple((theme-style: $mdc-radio-baseline-theme-color));
+ @include mdc-ripple-surface;
+ @include mdc-ripple-color($mdc-radio-baseline-theme-color, $mdc-radio-ripple-opacity);
+ @include mdc-ripple-radius($mdc-radio-ripple-radius);
display: inline-block;
position: relative;
diff --git a/packages/mdc-radio/package.json b/packages/mdc-radio/package.json
index 2792e562f3a..8ff53f715f9 100644
--- a/packages/mdc-radio/package.json
+++ b/packages/mdc-radio/package.json
@@ -1,7 +1,7 @@
{
"name": "@material/radio",
"description": "The Material Components for the web radio component",
- "version": "0.23.0",
+ "version": "0.24.0",
"license": "Apache-2.0",
"keywords": [
"material components",
@@ -15,9 +15,9 @@
},
"dependencies": {
"@material/animation": "^0.4.1",
- "@material/base": "^0.2.6",
- "@material/ripple": "^0.23.0",
- "@material/selection-control": "^0.23.0",
- "@material/theme": "^0.4.0"
+ "@material/base": "^0.24.0",
+ "@material/ripple": "^0.24.0",
+ "@material/selection-control": "^0.24.0",
+ "@material/theme": "^0.24.0"
}
}
diff --git a/packages/mdc-ripple/README.md b/packages/mdc-ripple/README.md
index ae050ab532b..64998d61ba9 100644
--- a/packages/mdc-ripple/README.md
+++ b/packages/mdc-ripple/README.md
@@ -9,36 +9,31 @@ path: /catalog/ripples/
# Ripples
-- [MDC Ripple](#mdc-ripple)
- - [An aside regarding browser support](#an-aside-regarding-browser-support)
- - [Installation](#installation)
- - [Usage](#usage)
- - [Adding the ripple Sass](#adding-the-ripple-sass)
- - [The full Sass API](#the-full-sass-api)
- - [Adding the ripple JS](#adding-the-ripple-js)
- - [ES2015](#es2015)
- - [CommonJS](#commonjs)
- - [AMD](#amd)
- - [Global](#global)
- - [Unbounded Ripples](#unbounded-ripples)
- - [Using JS](#using-js)
- - [Using DOM (Component Only)](#using-dom-component-only)
- - [The mdc-ripple-surface class](#the-mdc-ripple-surface-class)
- - [Using the foundation](#using-the-foundation)
- - [Using the vanilla DOM adapter](#using-the-vanilla-DOM-adapter)
- - [Tips/Tricks](#tipstricks)
- - [Integrating ripples into MDC-Web components](#integrating-ripples-into-mdc-web-components)
- - [Using a sentinel element for a ripple](#using-a-sentinel-element-for-a-ripple)
- - [Keyboard interaction for custom UI components](#keyboard-interaction-for-custom-ui-components)
- - [Specifying known element dimensions](#specifying-known-element-dimensions)
- - [Caveat: Edge](#caveat-edge)
- - [Caveat: Safari](#caveat-safari)
- - [Caveat: Theme Custom Variables](#caveat-theme-custom-variables)
- - [The util API](#the-util-api)
-
-MDC Ripple provides the Javascript and CSS required to provide components (or any element at all) with a material "ink ripple" interaction effect. It is designed to be efficient, uninvasive, and usable without adding any extra DOM to your elements.
-
-MDC Ripple also works without javascript, where it gracefully degrades to a simpler CSS-Only implementation.
+MDC Ripple provides the JavaScript and CSS required to provide components (or any element at all) with a material "ink ripple" interaction effect. It is designed to be efficient, uninvasive, and usable without adding any extra DOM to your elements.
+
+MDC Ripple also works without JavaScript, where it gracefully degrades to a simpler CSS-Only implementation.
+
+## Table of Contents
+
+- [An aside regarding browser support](#an-aside-regarding-browser-support)
+- [Installation](#installation)
+- [Usage](#usage)
+ - [Adding Ripple styles](#adding-ripple-styles)
+ - [Adding Ripple JS](#adding-ripple-js)
+ - [Ripple JS API](#ripple-js-api)
+ - [Unbounded Ripples](#unbounded-ripples)
+ - [The mdc-ripple-surface class](#the-mdc-ripple-surface-class)
+ - [Using the foundation](#using-the-foundation)
+ - [Using the vanilla DOM adapter](#using-the-vanilla-dom-adapter)
+- [Tips/Tricks](#tipstricks)
+ - [Integrating ripples into MDC-Web components](#integrating-ripples-into-mdc-web-components)
+ - [Using a sentinel element for a ripple](#using-a-sentinel-element-for-a-ripple)
+ - [Keyboard interaction for custom UI components](#keyboard-interaction-for-custom-ui-components)
+ - [Specifying known element dimensions](#specifying-known-element-dimensions)
+- [Caveat: Edge](#caveat-edge)
+- [Caveat: Safari](#caveat-safari)
+- [Caveat: Theme Custom Variables](#caveat-theme-custom-variables)
+- [The util API](#the-util-api)
### An aside regarding browser support
@@ -56,73 +51,30 @@ npm install --save @material/ripple
## Usage
-For many components, providing a ripple interaction is straightforward.
+### Adding Ripple styles
-Let's say we have a `surface` element that represents a basic surface.
+General notes:
-```html
-
-```
-
-We also have some basic styles for our surface that
-use [mdc-elevation](../mdc-elevation) to raise it up off of its background.
-
-```scss
-@import "@material/elevation/mixins";
-
-.surface {
- @include mdc-elevation(2);
-
- position: relative;
- border-radius: 2px;
- text-align: center;
- /* Indicate to user element is interactive. */
- cursor: pointer;
-```
-
-#### Adding the ripple Sass
-
-To add a ripple to our surface, first we include the proper Sass mixins within our surface's styles. We also add a few additional properties that ensure the ripple's UX is correct.
-
-```scss
-@import "@material/elevation/mixins";
-@import "@material/ripple/mixins";
-
-.surface {
- @include mdc-ripple-base;
- @include mdc-ripple-bg((pseudo: "::before"));
- @include mdc-ripple-fg((pseudo: "::after"));
- // ...
-
- /* "Bound" the ripple, preventing the pseudo-elements from bleeding out of the box. */
- overflow: hidden;
-}
-```
-
-This code sets up `.surface` with the correct css variables as well as `will-change` properties to support the ripple. It then dynamically generates the correct selectors such that the surface's `::before` element functions as a background ripple, and the surface's `::after` element functions as a foreground ripple.
-
-When a ripple is successfully initialized on an element, it dynamically adds a `mdc-ripple-upgraded` class to that element. If ripple is not initialized but Sass mixins are included within our surface, the ripple will still work, but it would use a simpler, CSS-Only implementation which relies on `:hover`, `:active`, and `:focus`.
+* Ripple mixins can be applied to a variety of elements representing interactive surfaces. These mixins are also used by other MDC Web components such as Button, FAB, Checkbox, Radio, etc.
+* Surfaces for bounded ripples should have `overflow` set to `hidden`, while surfaces for unbounded ripples should have it set to `visible`
+* When a ripple is successfully initialized on an element using JS, it dynamically adds a `mdc-ripple-upgraded` class to that element. If ripple JS is not initialized but Sass mixins are included on the surface, the ripple will still work, but it uses a simpler, CSS-only implementation which relies on `:hover`, `:focus`, and `:active`.
-##### The full Sass API
+#### Sass API
-Both `mdc-ripple-bg` and `mdc-ripple-fg` take an `$config` map as an optional
-argument, with which you can specify the following parameters:
+These APIs implicitly use pseudo-elements for the ripple effect: `::before` for the background, and `::after` for the foreground.
+All three of the following mixins are mandatory in order to fully style the ripple effect; from that point, it is feasible to further override only the parts necessary (e.g. `mdc-ripple-color` specifically) for variants of a component.
-| Parameter | Description | Default |
-| --- | --- | --- |
-| `pseudo` | The name of the pseudo-element you want to use to style the ripple. Using pseudo-elements to style ripples obviates the need for any extra DOM and is recommended. However, if given `null` it will style the element directly, rather than attaching styles to the pseudo element. | `null` |
-| `radius` | For _bounded_ ripples, specifies radii of the ripple circles. Can be any valid numeric CSS unit. | `100%` |
-| `theme-style` | When provided, will use a style specified by `mdc-theme` to provide colors to the ripple. For example, passing `(theme-style: primary)` would make the ripples the color of the theme's primary color. Note that there are some current limitations here. See [below](#caveat-theme-custom-variables) | `null` |
-| `base-color` | The RGB color (_without_ an alpha component) of the ripple. This will only be used if `theme-style` isn't specified. | `black` |
-| `opacity` | A unitless number from `0-1` specifying the opacity that either the `base-color` or the `theme-style` color will take on. | `.06` |
+Mixin | Description
+--- | ---
+`mdc-ripple-surface` | Adds base styles for a ripple surface
+`mdc-ripple-color($color, $opacity)` | Adds styles for the color and opacity of the ripple effect
+`mdc-ripple-radius($radius)` | Adds styles for the radius of the ripple effect,
for both bounded and unbounded ripples
-#### Adding the ripple JS
+### Adding Ripple JS
-First import the ripple JS
+First import the ripple JS.
-##### ES2015
+#### ES2015
```javascript
import {MDCRipple, MDCRippleFoundation, util} from '@material/ripple';
@@ -134,7 +86,7 @@ import {MDCRipple, MDCRippleFoundation, util} from '@material/ripple';
const {MDCRipple, MDCRippleFoundation, util} = require('@material/ripple');
```
-##### AMD
+#### AMD
```javascript
require('path/to/@material/ripple', function(mdcRipple) {
@@ -144,7 +96,7 @@ require('path/to/@material/ripple', function(mdcRipple) {
});
```
-##### Global
+#### Global
```javascript
const MDCRipple = mdc.ripple.MDCRipple;
@@ -166,7 +118,7 @@ ripple.
MDCRipple.attachTo(document.querySelector('.surface'));
```
-### Ripple API
+### Ripple JS API
The component allows for programmatic activation / deactivation of the ripple, for interdependent interaction between
components. This is used for making form field labels trigger the ripples in their corresponding input elements, for
diff --git a/packages/mdc-ripple/_keyframes.scss b/packages/mdc-ripple/_keyframes.scss
index 14f56907b78..934f6198c78 100644
--- a/packages/mdc-ripple/_keyframes.scss
+++ b/packages/mdc-ripple/_keyframes.scss
@@ -14,43 +14,45 @@
// limitations under the License.
//
-/** MDC Ripple keyframes are split into their own file so that _mixins.scss can rely on them. */
+// MDC Ripple keyframes are split into their own file so that _mixins.scss can rely on them.
@import "@material/animation/variables";
-@keyframes mdc-ripple-fg-radius-in {
- from {
- animation-timing-function: $mdc-animation-standard-curve-timing-function;
- // NOTE: For these keyframes, we do not need custom property fallbacks because they are only
- // used in conjunction with `.mdc-ripple-upgraded`. Since MDCRippleFoundation checks to ensure
- // that custom properties are supported within the browser before adding this class, we can
- // safely use them without a fallback.
- transform: translate(var(--mdc-ripple-fg-translate-start, 0)) scale(1);
+@mixin mdc-ripple-keyframes_ {
+ @keyframes mdc-ripple-fg-radius-in {
+ from {
+ animation-timing-function: $mdc-animation-standard-curve-timing-function;
+ // NOTE: For these keyframes, we do not need custom property fallbacks because they are only
+ // used in conjunction with `.mdc-ripple-upgraded`. Since MDCRippleFoundation checks to ensure
+ // that custom properties are supported within the browser before adding this class, we can
+ // safely use them without a fallback.
+ transform: translate(var(--mdc-ripple-fg-translate-start, 0)) scale(1);
+ }
+
+ to {
+ transform: translate(var(--mdc-ripple-fg-translate-end, 0)) scale(var(--mdc-ripple-fg-scale, 1));
+ }
}
- to {
- transform: translate(var(--mdc-ripple-fg-translate-end, 0)) scale(var(--mdc-ripple-fg-scale, 1));
- }
-}
-
-@keyframes mdc-ripple-fg-opacity-in {
- from {
- animation-timing-function: linear;
- opacity: 0;
- }
+ @keyframes mdc-ripple-fg-opacity-in {
+ from {
+ animation-timing-function: linear;
+ opacity: 0;
+ }
- to {
- opacity: 1;
+ to {
+ opacity: 1;
+ }
}
-}
-@keyframes mdc-ripple-fg-opacity-out {
- from {
- animation-timing-function: linear;
- opacity: 1;
- }
+ @keyframes mdc-ripple-fg-opacity-out {
+ from {
+ animation-timing-function: linear;
+ opacity: 1;
+ }
- to {
- opacity: 0;
+ to {
+ opacity: 0;
+ }
}
}
diff --git a/packages/mdc-ripple/_mixins.scss b/packages/mdc-ripple/_mixins.scss
index 6d0c8077af9..5477b975073 100644
--- a/packages/mdc-ripple/_mixins.scss
+++ b/packages/mdc-ripple/_mixins.scss
@@ -18,19 +18,34 @@
@import "@material/theme/variables";
@import "./keyframes";
-@function mdc-ripple-default-config_() {
- @return (
- pseudo: null,
- radius: 100%,
- base-color: black,
- opacity: .06,
- theme-style: null
- );
+// Ensure that styles needed by any component using MDC Ripple are emitted, but only once.
+// (Every component using MDC Ripple imports these mixins, but doesn't necessarily import mdc-ripple.scss.)
+
+// This variable is not intended to be overridden externally; it uses !default to avoid being reset
+// every time this file is imported.
+$mdc-ripple-common-styles-emitted_: false !default;
+
+@if not $mdc-ripple-common-styles-emitted_ {
+ $mdc-ripple-common-styles-emitted_: true;
+
+ @include mdc-ripple-keyframes_;
+
+ // Styles used to detect buggy behavior of CSS custom properties in Edge.
+ // See: https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/11495448/
+ // This is included in _mixins.scss rather than mdc-ripple.scss so that it will be
+ // present for other components which rely on ripple as well as mdc-ripple itself.
+ .mdc-ripple-surface--test-edge-var-bug {
+ --mdc-ripple-surface-test-edge-var: 1px solid #000;
+
+ visibility: hidden;
+
+ &::before {
+ border: var(--mdc-ripple-surface-test-edge-var);
+ }
+ }
}
-@mixin mdc-ripple-base() {
- --mdc-ripple-surface-width: 0;
- --mdc-ripple-surface-height: 0;
+@mixin mdc-ripple-surface() {
--mdc-ripple-fg-size: 0;
--mdc-ripple-left: 0;
--mdc-ripple-top: 0;
@@ -41,6 +56,28 @@
will-change: transform, opacity;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
+ &::before,
+ &::after {
+ position: absolute;
+ transition: opacity 250ms linear;
+ border-radius: 50%;
+ pointer-events: none;
+ content: "";
+ }
+}
+
+@mixin mdc-ripple-color($color: black, $opacity: .06) {
+ // Opacity styles are here (rather than in mdc-ripple-surface) to ensure that opacity is re-initialized for
+ // cases where this mixin is used to override another inherited use of itself,
+ // without needing to re-include mdc-ripple-surface.
+ &::before,
+ &::after {
+ @include mdc-ripple-color_($color, $opacity);
+
+ opacity: 0;
+ }
+
+ // Note: when :active is applied, :focus is already applied, which will effectively double the effect.
&:not(.mdc-ripple-upgraded) {
&:hover::before,
&:focus::before,
@@ -49,209 +86,93 @@
opacity: .6;
}
}
-}
-
-@mixin mdc-ripple-color_($config) {
- $base-color: map-get($config, base-color);
- $opacity: map-get($config, opacity);
- $theme-style: map-get($config, theme-style);
-
- // stylelint-disable at-rule-empty-line-before, block-closing-brace-newline-after
- @if ($theme-style) {
- $theme-value: map-get($mdc-theme-property-values, $theme-style);
-
- /* @alternate */
- $css-var: $theme-value;
- $css-var: var(--mdc-theme-#{$theme-style}, $theme-value);
-
- background-color: rgba($theme-value, $opacity);
- // See: https://drafts.csswg.org/css-color/#modifying-colors
- // While this is currently unsupported as of now, it will begin to work by default as browsers
- // begin to implement the CSS 4 color spec.
- @supports (background-color: color(green a(10%))) {
- background-color: color(#{$css-var} a(#{percentage($opacity)}));
- }
- } @else {
- background-color: rgba($base-color, $opacity);
+ &.mdc-ripple-upgraded--background-focused::before {
+ opacity: .99999;
}
- // stylelint-enable at-rule-empty-line-before, block-closing-brace-newline-after
-}
-
-@mixin mdc-ripple-bg-base_($config) {
- $radius: map-get($config, radius);
-
- @include mdc-ripple-color_($config);
+ &.mdc-ripple-upgraded--background-active-fill::before {
+ transition-duration: 120ms;
+ opacity: 1;
+ }
- position: absolute;
- top: calc(50% - #{$radius});
- left: calc(50% - #{$radius});
- width: $radius * 2;
- height: $radius * 2;
- transition: opacity 250ms linear;
- border-radius: 50%;
- opacity: 0;
- pointer-events: none;
-}
+ // Foreground ripple styles
-@mixin mdc-ripple-bg($config: ()) {
- $config: map-merge(mdc-ripple-default-config_(), $config);
- $pseudo: map-get($config, pseudo);
- $radius: map-get($config, radius);
+ &.mdc-ripple-upgraded::after {
+ opacity: 0;
+ }
- // stylelint-disable at-rule-empty-line-before, block-closing-brace-newline-after
- @if ($pseudo) {
- {$pseudo} {
- @include mdc-ripple-bg-base_($config);
+ &.mdc-ripple-upgraded--foreground-activation::after {
+ animation: 300ms mdc-ripple-fg-radius-in forwards, 83ms mdc-ripple-fg-opacity-in forwards;
+ }
- content: "";
- }
- } @else {
- @include mdc-ripple-bg-base_($config);
+ &.mdc-ripple-upgraded--foreground-deactivation::after {
+ animation: 83ms mdc-ripple-fg-opacity-out;
+ // Retain transform from mdc-ripple-fg-radius-in activation
+ transform: translate(var(--mdc-ripple-fg-translate-end, 0)) scale(var(--mdc-ripple-fg-scale, 1));
}
- // stylelint-enable at-rule-empty-line-before, block-closing-brace-newline-after
+}
- &.mdc-ripple-upgraded#{$pseudo} {
+@mixin mdc-ripple-radius($radius: 100%) {
+ &::before,
+ &::after {
top: calc(50% - #{$radius});
left: calc(50% - #{$radius});
width: $radius * 2;
height: $radius * 2;
-
- /* @alternate */
- transform: scale(0);
- transform: scale(var(--mdc-ripple-fg-scale, 0));
}
- &.mdc-ripple-upgraded--background-focused#{$pseudo} {
- opacity: .99999;
- }
+ // Background ripple styles
- &.mdc-ripple-upgraded--background-active-fill#{$pseudo} {
- transition-duration: 120ms;
- opacity: 1;
+ &.mdc-ripple-upgraded::before {
+ top: calc(50% - #{$radius});
+ left: calc(50% - #{$radius});
+ width: $radius * 2;
+ height: $radius * 2;
+ transform: scale(var(--mdc-ripple-fg-scale, 0));
}
- &.mdc-ripple-upgraded--unbounded#{$pseudo} {
- /* @alternate */
- top: calc(50% - #{$radius / 2});
+ &.mdc-ripple-upgraded--unbounded::before {
top: var(--mdc-ripple-top, calc(50% - #{$radius / 2}));
-
- /* @alternate */
- left: calc(50% - #{$radius / 2});
left: var(--mdc-ripple-left, calc(50% - #{$radius / 2}));
-
- /* @alternate */
- width: $radius;
width: var(--mdc-ripple-fg-size, $radius);
-
- /* @alternate */
- height: $radius;
height: var(--mdc-ripple-fg-size, $radius);
-
- /* @alternate */
- transform: scale(0);
transform: scale(var(--mdc-ripple-fg-scale, 0));
}
-}
-
-@mixin mdc-ripple-fg-base_($config) {
- $radius: map-get($config, radius);
-
- @include mdc-ripple-color_($config);
-
- position: absolute;
- top: calc(50% - #{$radius});
- left: calc(50% - #{$radius});
- width: $radius * 2;
- height: $radius * 2;
- transition: opacity 250ms linear;
- border-radius: 50%;
- opacity: 0;
- pointer-events: none;
-}
-
-@mixin mdc-ripple-fg($config: ()) {
- $config: map-merge(mdc-ripple-default-config_(), $config);
- $pseudo: map-get($config, pseudo);
- $radius: map-get($config, radius);
-
- // stylelint-disable at-rule-empty-line-before, block-closing-brace-newline-after
- @if ($pseudo) {
- {$pseudo} {
- @include mdc-ripple-fg-base_($config);
-
- content: "";
- }
- } @else {
- @include mdc-ripple-fg-base_($config);
- }
- // stylelint-enable at-rule-empty-line-before, block-closing-brace-newline-after
-
- &.mdc-ripple-upgraded {
- {$pseudo} {
- top: 0;
- left: 0;
-
- /* @alternate */
- width: $radius;
- width: var(--mdc-ripple-fg-size, $radius);
-
- /* @alternate */
- height: $radius;
- height: var(--mdc-ripple-fg-size, $radius);
- transform: scale(0);
- transform-origin: center center;
- opacity: 0;
- }
- }
- &:not(.mdc-ripple-upgraded--unbounded)#{$pseudo} {
- transform-origin: center center;
- }
-
- &.mdc-ripple-upgraded--unbounded#{$pseudo} {
- /* @alternate */
+ // Foreground ripple styles
+ &.mdc-ripple-upgraded::after {
top: 0;
- top: var(--mdc-ripple-top, 0);
-
- /* @alternate */
left: 0;
- left: var(--mdc-ripple-left, 0);
-
- /* @alternate */
- width: $radius;
width: var(--mdc-ripple-fg-size, $radius);
-
- /* @alternate */
- height: $radius;
height: var(--mdc-ripple-fg-size, $radius);
transform: scale(0);
transform-origin: center center;
}
- &.mdc-ripple-upgraded--foreground-activation#{$pseudo} {
- animation: 300ms mdc-ripple-fg-radius-in forwards, 83ms mdc-ripple-fg-opacity-in forwards;
- }
-
- &.mdc-ripple-upgraded--foreground-deactivation#{$pseudo} {
- animation: 83ms mdc-ripple-fg-opacity-out;
- // Retain transform from mdc-ripple-fg-radius-in activation
- transform: translate(var(--mdc-ripple-fg-translate-end, 0)) scale(var(--mdc-ripple-fg-scale, 1));
+ &.mdc-ripple-upgraded--unbounded::after {
+ top: var(--mdc-ripple-top, 0);
+ left: var(--mdc-ripple-left, 0);
}
}
-// Styles used to detect buggy behavior of CSS custom properties in Edge.
-// See: https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/11495448/
-// This is included in _mixins.scss rather than mdc-ripple.scss so that it will be
-// present for other components which rely on ripple as well as mdc-ripple itself.
-
-.mdc-ripple-surface--test-edge-var-bug {
- --mdc-ripple-surface-test-edge-var: 1px solid #000;
+@mixin mdc-ripple-color_($color, $opacity) {
+ // stylelint-disable at-rule-empty-line-before, block-closing-brace-newline-after
+ @if type-of($color) == "color" {
+ background-color: rgba($color, $opacity);
+ } @else {
+ // Assume $color is a theme property name
+ $theme-value: map-get($mdc-theme-property-values, $color);
+ $css-var: var(--mdc-theme-#{$color}, $theme-value);
- visibility: hidden;
+ background-color: rgba($theme-value, $opacity);
- &::before {
- border: var(--mdc-ripple-surface-test-edge-var);
+ // See: https://drafts.csswg.org/css-color/#modifying-colors
+ // While this is currently unsupported as of now, it will begin to work by default as browsers
+ // begin to implement the CSS 4 color spec.
+ @supports (background-color: color(green a(10%))) {
+ background-color: color(#{$css-var} a(#{percentage($opacity)}));
+ }
}
+ // stylelint-enable at-rule-empty-line-before, block-closing-brace-newline-after
}
diff --git a/packages/mdc-fab/_variables.scss b/packages/mdc-ripple/_variables.scss
similarity index 79%
rename from packages/mdc-fab/_variables.scss
rename to packages/mdc-ripple/_variables.scss
index a4720bd64f1..5392f44a54a 100644
--- a/packages/mdc-fab/_variables.scss
+++ b/packages/mdc-ripple/_variables.scss
@@ -1,4 +1,5 @@
-// Copyright 2017 Google Inc. All Rights Reserved.
+//
+// Copyright 2016 Google Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -11,5 +12,7 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
+//
-$mdc-fab-light-ripple-config: (base-color: white, opacity: .16);
+$mdc-ripple-pressed-dark-ink-opacity: .16;
+$mdc-ripple-pressed-light-ink-opacity: .32;
diff --git a/packages/mdc-ripple/constants.js b/packages/mdc-ripple/constants.js
index 623c6610476..028d291c6ab 100644
--- a/packages/mdc-ripple/constants.js
+++ b/packages/mdc-ripple/constants.js
@@ -28,8 +28,6 @@ const cssClasses = {
};
const strings = {
- VAR_SURFACE_WIDTH: '--mdc-ripple-surface-width',
- VAR_SURFACE_HEIGHT: '--mdc-ripple-surface-height',
VAR_FG_SIZE: '--mdc-ripple-fg-size',
VAR_LEFT: '--mdc-ripple-left',
VAR_TOP: '--mdc-ripple-top',
diff --git a/packages/mdc-ripple/foundation.js b/packages/mdc-ripple/foundation.js
index 14104782b96..f867ed06d68 100644
--- a/packages/mdc-ripple/foundation.js
+++ b/packages/mdc-ripple/foundation.js
@@ -494,12 +494,9 @@ class MDCRippleFoundation extends MDCFoundation {
/** @private */
updateLayoutCssVars_() {
const {
- VAR_SURFACE_WIDTH, VAR_SURFACE_HEIGHT, VAR_FG_SIZE,
- VAR_LEFT, VAR_TOP, VAR_FG_SCALE,
+ VAR_FG_SIZE, VAR_LEFT, VAR_TOP, VAR_FG_SCALE,
} = MDCRippleFoundation.strings;
- this.adapter_.updateCssVariable(VAR_SURFACE_WIDTH, `${this.frame_.width}px`);
- this.adapter_.updateCssVariable(VAR_SURFACE_HEIGHT, `${this.frame_.height}px`);
this.adapter_.updateCssVariable(VAR_FG_SIZE, `${this.initialSize_}px`);
this.adapter_.updateCssVariable(VAR_FG_SCALE, this.fgScale_);
diff --git a/packages/mdc-ripple/mdc-ripple.scss b/packages/mdc-ripple/mdc-ripple.scss
index 1d5d15a334c..88568b3c7d5 100644
--- a/packages/mdc-ripple/mdc-ripple.scss
+++ b/packages/mdc-ripple/mdc-ripple.scss
@@ -17,13 +17,14 @@
@import "@material/animation/functions";
@import "@material/theme/mixins";
@import "./mixins";
+@import "./variables";
// postcss-bem-linter: define ripple-surface
.mdc-ripple-surface {
- @include mdc-ripple-base;
- @include mdc-ripple-bg((pseudo: "::before"));
- @include mdc-ripple-fg((pseudo: "::after"));
+ @include mdc-ripple-surface;
+ @include mdc-ripple-color;
+ @include mdc-ripple-radius;
position: relative;
outline: none;
@@ -34,23 +35,11 @@
}
&--primary {
- &::before,
- &::after {
- @include mdc-theme-prop(background-color, primary);
- }
-
- @include mdc-ripple-bg((pseudo: "::before", theme-style: primary, opacity: .16));
- @include mdc-ripple-fg((pseudo: "::after", theme-style: primary, opacity: .16));
+ @include mdc-ripple-color(primary, $mdc-ripple-pressed-dark-ink-opacity);
}
&--accent {
- &::before,
- &::after {
- @include mdc-theme-prop(background-color, primary);
- }
-
- @include mdc-ripple-bg((pseudo: "::before", theme-style: secondary, opacity: .16));
- @include mdc-ripple-fg((pseudo: "::after", theme-style: secondary, opacity: .16));
+ @include mdc-ripple-color(secondary, $mdc-ripple-pressed-dark-ink-opacity);
}
}
diff --git a/packages/mdc-ripple/package.json b/packages/mdc-ripple/package.json
index c554dc453b5..c8da21849b9 100644
--- a/packages/mdc-ripple/package.json
+++ b/packages/mdc-ripple/package.json
@@ -1,7 +1,7 @@
{
"name": "@material/ripple",
"description": "The Material Components for the web Ink Ripple effect for web element interactions",
- "version": "0.23.0",
+ "version": "0.24.0",
"license": "Apache-2.0",
"keywords": [
"material components",
@@ -14,7 +14,7 @@
"url": "https://github.com/material-components/material-components-web.git"
},
"dependencies": {
- "@material/base": "^0.2.6",
- "@material/theme": "^0.4.0"
+ "@material/base": "^0.24.0",
+ "@material/theme": "^0.24.0"
}
}
diff --git a/packages/mdc-select/package.json b/packages/mdc-select/package.json
index ad2fc1b02e2..ddeecbcf8a0 100644
--- a/packages/mdc-select/package.json
+++ b/packages/mdc-select/package.json
@@ -1,7 +1,7 @@
{
"name": "@material/select",
"description": "The Material Components web select (textfield drop-down) component",
- "version": "0.23.0",
+ "version": "0.24.0",
"license": "Apache-2.0",
"keywords": [
"material components",
@@ -16,12 +16,12 @@
},
"dependencies": {
"@material/animation": "^0.4.1",
- "@material/base": "^0.2.6",
+ "@material/base": "^0.24.0",
+ "@material/list": "^0.24.0",
+ "@material/menu": "^0.24.0",
"@material/ripple": "^0.8.8",
- "@material/list": "^0.23.0",
- "@material/menu": "^0.23.0",
"@material/rtl": "^0.1.8",
- "@material/theme": "^0.4.0",
+ "@material/theme": "^0.24.0",
"@material/typography": "^0.3.0"
}
}
diff --git a/packages/mdc-selection-control/package.json b/packages/mdc-selection-control/package.json
index 70e801426e4..89c3fbdfcf5 100644
--- a/packages/mdc-selection-control/package.json
+++ b/packages/mdc-selection-control/package.json
@@ -1,7 +1,7 @@
{
"name": "@material/selection-control",
"description": "The set of base classes for Material selection controls",
- "version": "0.23.0",
+ "version": "0.24.0",
"license": "Apache-2.0",
"main": "index.js",
"repository": {
@@ -9,7 +9,7 @@
"url": "https://github.com/material-components/material-components-web.git"
},
"dependencies": {
- "@material/ripple": "^0.23.0"
+ "@material/ripple": "^0.24.0"
},
"publishConfig": {
"access": "public"
diff --git a/packages/mdc-slider/package.json b/packages/mdc-slider/package.json
index c76351d1ab2..6b56b345809 100644
--- a/packages/mdc-slider/package.json
+++ b/packages/mdc-slider/package.json
@@ -1,6 +1,6 @@
{
"name": "@material/slider",
- "version": "0.23.0",
+ "version": "0.24.0",
"description": "The Material Components for the web slider component",
"main": "index.js",
"license": "Apache-2.0",
@@ -18,8 +18,8 @@
},
"dependencies": {
"@material/animation": "^0.4.1",
- "@material/base": "^0.2.6",
+ "@material/base": "^0.24.0",
"@material/rtl": "^0.1.8",
- "@material/theme": "^0.4.0"
+ "@material/theme": "^0.24.0"
}
}
diff --git a/packages/mdc-snackbar/mdc-snackbar.scss b/packages/mdc-snackbar/mdc-snackbar.scss
index cba31378c4d..aca071de405 100644
--- a/packages/mdc-snackbar/mdc-snackbar.scss
+++ b/packages/mdc-snackbar/mdc-snackbar.scss
@@ -28,6 +28,7 @@
left: 50%;
align-items: center;
justify-content: flex-start;
+ box-sizing: border-box;
padding-right: 24px;
padding-left: 24px;
transform: translate(-50%, 100%);
@@ -42,7 +43,7 @@
@media (max-width: ($mdc-snackbar-tablet-breakpoint - 1)) {
left: 0;
- width: calc(100% - 48px);
+ width: 100%;
transform: translate(0, 100%);
}
@@ -63,7 +64,7 @@
@media (max-width: ($mdc-snackbar-tablet-breakpoint - 1)) {
bottom: 0;
left: 0;
- width: calc(100% - 48px);
+ width: 100%;
transform: translate(0, 100%);
}
}
@@ -79,7 +80,7 @@
@media (max-width: ($mdc-snackbar-tablet-breakpoint - 1)) {
bottom: 0;
left: 0;
- width: calc(100% - 48px);
+ width: 100%;
transform: translate(0);
}
}
diff --git a/packages/mdc-snackbar/package.json b/packages/mdc-snackbar/package.json
index 2a575edb50f..a130d46a951 100644
--- a/packages/mdc-snackbar/package.json
+++ b/packages/mdc-snackbar/package.json
@@ -1,7 +1,7 @@
{
"name": "@material/snackbar",
"description": "The Material Components for the web snackbar component",
- "version": "0.4.1",
+ "version": "0.24.0",
"license": "Apache-2.0",
"keywords": [
"material components",
@@ -15,9 +15,9 @@
},
"dependencies": {
"@material/animation": "^0.4.1",
- "@material/base": "^0.2.6",
+ "@material/base": "^0.24.0",
"@material/rtl": "^0.1.8",
- "@material/theme": "^0.4.0",
+ "@material/theme": "^0.24.0",
"@material/typography": "^0.3.0"
}
}
diff --git a/packages/mdc-switch/package.json b/packages/mdc-switch/package.json
index 6c025b716e9..f16736db308 100644
--- a/packages/mdc-switch/package.json
+++ b/packages/mdc-switch/package.json
@@ -1,7 +1,7 @@
{
"name": "@material/switch",
"description": "The Material Components for the web switch component",
- "version": "0.1.15",
+ "version": "0.24.0",
"license": "Apache-2.0",
"keywords": [
"material components",
@@ -15,7 +15,7 @@
"dependencies": {
"@material/animation": "^0.4.1",
"@material/elevation": "^0.1.13",
- "@material/theme": "^0.4.0"
+ "@material/theme": "^0.24.0"
},
"publishConfig": {
"access": "public"
diff --git a/packages/mdc-tabs/package.json b/packages/mdc-tabs/package.json
index ff1fc3506e6..525b3930ba9 100644
--- a/packages/mdc-tabs/package.json
+++ b/packages/mdc-tabs/package.json
@@ -1,6 +1,6 @@
{
"name": "@material/tabs",
- "version": "0.23.0",
+ "version": "0.24.0",
"description": "The Material Components for the web tabs component",
"license": "Apache-2.0",
"repository": {
@@ -16,11 +16,11 @@
"access": "public"
},
"dependencies": {
- "@material/base": "^0.2.6",
- "@material/ripple": "^0.23.0",
+ "@material/base": "^0.24.0",
+ "@material/ripple": "^0.24.0",
"@material/animation": "^0.4.1",
"@material/typography": "^0.3.0",
"@material/rtl": "^0.1.8",
- "@material/theme": "^0.4.0"
+ "@material/theme": "^0.24.0"
}
}
diff --git a/packages/mdc-tabs/tab/mdc-tab.scss b/packages/mdc-tabs/tab/mdc-tab.scss
index 16025d09cfb..4b6d8377109 100644
--- a/packages/mdc-tabs/tab/mdc-tab.scss
+++ b/packages/mdc-tabs/tab/mdc-tab.scss
@@ -158,18 +158,16 @@ $mdc-tab-with-icon-and-text-height: 72px;
// stylelint-enable plugin/selector-bem-pattern
.mdc-tab.mdc-ripple-upgraded {
- @include mdc-ripple-base;
- @include mdc-ripple-fg((pseudo: "::after"));
- @include mdc-ripple-bg((pseudo: "::before"));
+ @include mdc-ripple-surface;
+ @include mdc-ripple-color;
+ @include mdc-ripple-radius;
@include mdc-theme-dark(".mdc-tab-bar") {
- @include mdc-ripple-bg((pseudo: "::before", base-color: map-get($mdc-theme-property-values, text-primary-on-dark), opacity: .16));
- @include mdc-ripple-fg((pseudo: "::after", base-color: map-get($mdc-theme-property-values, text-primary-on-dark), opacity: .16));
+ @include mdc-ripple-color(text-primary-on-dark, .16);
}
.mdc-toolbar & {
- @include mdc-ripple-bg((pseudo: "::before", base-color: map-get($mdc-theme-property-values, text-primary-on-primary), opacity: .16));
- @include mdc-ripple-fg((pseudo: "::after", base-color: map-get($mdc-theme-property-values, text-primary-on-primary), opacity: .16));
+ @include mdc-ripple-color(text-primary-on-primary, .16);
}
// stylelint-disable plugin/selector-bem-pattern
diff --git a/packages/mdc-textfield/README.md b/packages/mdc-textfield/README.md
index 383dbbd5f68..2439ac3f52b 100644
--- a/packages/mdc-textfield/README.md
+++ b/packages/mdc-textfield/README.md
@@ -279,6 +279,20 @@ text, validation, and dense UI.
```
+### Sass Mixins
+
+To customize a Filled Text Field or a Text Field `textarea`'s border radius, you can use the following mixins.
+Alternatively, if you would like to change the border radius for every instance of MDC Text Field uniformly, regardless
+of the variant, you can override $mdc-text-field-border-radius in Sass.
+
+#### `mdc-text-field-box-corner-radius($radius)`
+
+This mixin customizes the border radius for a Text Field Box.
+
+#### `mdc-text-field-textarea-corner-radius($radius)`
+
+This mixin customizes the border radius for a Text Field `textarea`.
+
### Using the JS component
MDC Textfield ships with Component / Foundation classes which are used to provide a full-fidelity
diff --git a/packages/mdc-textfield/_mixins.scss b/packages/mdc-textfield/_mixins.scss
index b7ed93a38ba..22ac94ff9f1 100644
--- a/packages/mdc-textfield/_mixins.scss
+++ b/packages/mdc-textfield/_mixins.scss
@@ -14,6 +14,29 @@
// limitations under the License.
//
+@mixin mdc-text-field-box-corner-radius($radius) {
+ border-radius: $radius $radius 0 0;
+}
+
+@mixin mdc-text-field-textarea-corner-radius($radius) {
+ border-radius: $radius;
+
+ .mdc-textfield__label {
+ // Bottom corners are square to prevent weird edge cases
+ // where text would be visible outside of the curve.
+ border-radius: $radius $radius 0 0;
+ }
+
+ .mdc-textfield__input {
+ // The input element is required to have 2 pixels shaved off
+ // of the radius of its parent. This prevents an ugly space of
+ // background between the two borders in each corner when the
+ // textarea is focused. This also means we need to guard against
+ // invalid output.
+ border-radius: max($radius - 2, 0);
+ }
+}
+
@mixin mdc-text-field-invalid-label-shake-keyframes_($modifier, $positionY) {
@keyframes invalid-shake-float-above-#{$modifier} {
0% {
diff --git a/packages/mdc-textfield/_variables.scss b/packages/mdc-textfield/_variables.scss
index ef9efd854c1..f2564ed53a5 100644
--- a/packages/mdc-textfield/_variables.scss
+++ b/packages/mdc-textfield/_variables.scss
@@ -49,3 +49,5 @@ $mdc-textarea-light-background: rgba(white, 1);
$mdc-textarea-dark-background: rgba(48, 48, 48, 1);
$mdc-textarea-disabled-background-on-light: rgba(249, 249, 249, 1);
$mdc-textarea-disabled-background-on-dark: rgba(47, 47, 47, 1);
+
+$mdc-text-field-border-radius: 4px !default;
diff --git a/packages/mdc-textfield/constants.js b/packages/mdc-textfield/constants.js
index db23ea1c274..a35e398f34b 100644
--- a/packages/mdc-textfield/constants.js
+++ b/packages/mdc-textfield/constants.js
@@ -1,4 +1,5 @@
/**
+ * @license
* Copyright 2016 Google Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
diff --git a/packages/mdc-textfield/foundation.js b/packages/mdc-textfield/foundation.js
index b5be380169c..76691eca7ab 100644
--- a/packages/mdc-textfield/foundation.js
+++ b/packages/mdc-textfield/foundation.js
@@ -1,4 +1,5 @@
/**
+ * @license
* Copyright 2016 Google Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
diff --git a/packages/mdc-textfield/index.js b/packages/mdc-textfield/index.js
index a7c72491ad6..821d36471d4 100644
--- a/packages/mdc-textfield/index.js
+++ b/packages/mdc-textfield/index.js
@@ -1,4 +1,5 @@
/**
+ * @license
* Copyright 2016 Google Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
diff --git a/packages/mdc-textfield/mdc-textfield.scss b/packages/mdc-textfield/mdc-textfield.scss
index 10e36ee37c3..556215003aa 100644
--- a/packages/mdc-textfield/mdc-textfield.scss
+++ b/packages/mdc-textfield/mdc-textfield.scss
@@ -163,10 +163,14 @@
}
.mdc-textfield--box {
+ @include mdc-ripple-surface;
+ @include mdc-ripple-color(black, .04);
+ @include mdc-ripple-radius;
+ @include mdc-text-field-box-corner-radius($mdc-text-field-border-radius);
+
display: inline-flex;
position: relative;
height: 56px;
- border-radius: 4px 4px 0 0;
background-color: $mdc-textfield-box-background;
overflow: hidden;
@@ -174,41 +178,15 @@
background-color: $mdc-textfield-box-background-dark;
}
- &::before,
- &::after {
- position: absolute;
- top: 0;
- left: 0;
- width: 100%;
- height: 100%;
- border-radius: 50%;
- background-color: inherit;
- opacity: 0;
- pointer-events: none;
- content: "";
+ @include mdc-theme-dark(".mdc-textfield", true) {
+ @include mdc-ripple-color(white, .05);
}
- // NOTE: For some reasons, stylelint complains that the two patterns below don't follow BEM.
+ // NOTE: For some reason, stylelint complains that the patterns below don't follow BEM.
// However, it seems to emit the wrong selector for that pattern. Thus, we disable it above where
- // we would normally disable it (&.mdc-textfield--disabled) as a workaround.
+ // we would normally disable it (on combined selectors) as a workaround.
// stylelint-disable plugin/selector-bem-pattern
- // TODO: Refactor this out once #194 lands
- $opacity-duration: 83ms;
-
- &::before {
- transition: opacity 17ms linear, transform 0ms $opacity-duration+2 linear;
- }
-
- &:hover {
- &::before {
- transition:
- opacity $opacity-duration linear 17ms,
- transform 250ms $mdc-animation-deceleration-curve-timing-function 17ms;
- opacity: 1;
- }
- }
-
.mdc-textfield__input {
align-self: flex-end;
box-sizing: border-box;
@@ -246,28 +224,6 @@
}
}
- &.mdc-ripple-upgraded {
- @include mdc-ripple-base;
- // TODO: Add ::before as ripple bg once #194 lands
- @include mdc-ripple-fg((pseudo: "::after", opacity: .04));
-
- &::before {
- top: calc(50% - var(--mdc-ripple-fg-size, 100%) / 2);
- left: calc(50% - var(--mdc-ripple-fg-size, 100%) / 2);
- width: var(--mdc-ripple-fg-size, 100%);
- height: var(--mdc-ripple-fg-size, 100%);
- transform: scale(.8);
- }
-
- &:hover::before {
- transform: scale(calc(var(--mdc-ripple-fg-scale, 1) + .1));
- }
-
- @include mdc-theme-dark(".mdc-textfield", true) {
- @include mdc-ripple-fg((pseudo: "::after", base-color: white, opacity: .05));
- }
- }
-
&.mdc-textfield--disabled {
@include mdc-theme-prop(color, $mdc-textfield-light-placeholder);
@@ -502,6 +458,8 @@
}
.mdc-textfield--textarea {
+ @include mdc-text-field-textarea-corner-radius($mdc-text-field-border-radius);
+
$padding-inset: 16px;
$label-offset-y: $padding-inset + 2;
$label-offset-x: $padding-inset;
@@ -510,7 +468,7 @@
height: initial;
transition: none;
border: 1px solid $mdc-textarea-border-on-light;
- border-radius: 4px;
+ overflow: hidden;
@include mdc-theme-dark(".mdc-textfield") {
border-color: $mdc-textarea-border-on-dark;
@@ -521,7 +479,6 @@
padding: $padding-inset;
padding-top: $padding-inset * 2;
border: 1px solid transparent;
- border-radius: 2px;
&:focus {
@include mdc-theme-prop(border-color, primary);
diff --git a/packages/mdc-textfield/package.json b/packages/mdc-textfield/package.json
index 8b7b9d28943..605554b66fb 100644
--- a/packages/mdc-textfield/package.json
+++ b/packages/mdc-textfield/package.json
@@ -1,7 +1,7 @@
{
"name": "@material/textfield",
"description": "The Material Components for the web text field component",
- "version": "0.23.0",
+ "version": "0.24.0",
"license": "Apache-2.0",
"keywords": [
"material components",
@@ -15,10 +15,10 @@
},
"dependencies": {
"@material/animation": "^0.4.1",
- "@material/base": "^0.2.6",
- "@material/ripple": "^0.23.0",
+ "@material/base": "^0.24.0",
+ "@material/ripple": "^0.24.0",
"@material/rtl": "^0.1.8",
- "@material/theme": "^0.4.0",
+ "@material/theme": "^0.24.0",
"@material/typography": "^0.3.0"
}
}
diff --git a/packages/mdc-theme/README.md b/packages/mdc-theme/README.md
index 52982d20135..25adb2fe43b 100644
--- a/packages/mdc-theme/README.md
+++ b/packages/mdc-theme/README.md
@@ -166,7 +166,7 @@ Property Name | Description
`text-