diff --git a/CHANGELOG.md b/CHANGELOG.md index b9b8ad28bb7..b9ad07aca6b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,44 @@ + +# [0.32.0](https://github.com/material-components/material-components-web/compare/v0.31.0...v0.32.0) (2018-03-05) + + +### Bug Fixes + +* **chips:** Emit custom event from trailing icon ([#2286](https://github.com/material-components/material-components-web/issues/2286)) ([e849937](https://github.com/material-components/material-components-web/commit/e849937)) +* **ripple:** Fix selected opacity levels ([#2294](https://github.com/material-components/material-components-web/issues/2294)) ([06e39b1](https://github.com/material-components/material-components-web/commit/06e39b1)) +* **select:** add tests for select label package ([#2289](https://github.com/material-components/material-components-web/issues/2289)) ([b8ae66c](https://github.com/material-components/material-components-web/commit/b8ae66c)) +* **select:** Fix floating label for pre-selected option ([#2306](https://github.com/material-components/material-components-web/issues/2306)) ([d8dae34](https://github.com/material-components/material-components-web/commit/d8dae34)) +* **text-field:** disable validation check in setRequired ([#2201](https://github.com/material-components/material-components-web/issues/2201)) ([0ba7d10](https://github.com/material-components/material-components-web/commit/0ba7d10)) +* **toolbar:** Fix icon padding for ripples, and vertical alignment in FF/IE/Edge ([#2138](https://github.com/material-components/material-components-web/issues/2138)) ([d2c9726](https://github.com/material-components/material-components-web/commit/d2c9726)) +* Use `var` instead of `const` in demos/ready.js ([#2343](https://github.com/material-components/material-components-web/issues/2343)) ([78408bb](https://github.com/material-components/material-components-web/commit/78408bb)) + + +### Chores + +* **floating-label:** separate label module from text-field ([#2237](https://github.com/material-components/material-components-web/issues/2237)) ([4b24b51](https://github.com/material-components/material-components-web/commit/4b24b51)) + + +### Features + +* **chips:** Add `mdc-chip-set--choice` variant ([#2215](https://github.com/material-components/material-components-web/issues/2215)) ([f89cd10](https://github.com/material-components/material-components-web/commit/f89cd10)) +* **chips:** Change chip color when selected ([#2329](https://github.com/material-components/material-components-web/issues/2329)) ([ecf4060](https://github.com/material-components/material-components-web/commit/ecf4060)) +* **chips:** Create mixin to customize chip margins ([#2277](https://github.com/material-components/material-components-web/issues/2277)) ([b996b7f](https://github.com/material-components/material-components-web/commit/b996b7f)) +* **chips:** Handle multi-select for filter chips ([#2297](https://github.com/material-components/material-components-web/issues/2297)) ([807b6ce](https://github.com/material-components/material-components-web/commit/807b6ce)) +* **top app bar:** Add short top app bar always collapsed feature ([#2327](https://github.com/material-components/material-components-web/issues/2327)) ([bc17291](https://github.com/material-components/material-components-web/commit/bc17291)) +* **top-app-bar:** Baseline top app bar component ([#2225](https://github.com/material-components/material-components-web/issues/2225)) ([0ad69c4](https://github.com/material-components/material-components-web/commit/0ad69c4)) +* **top-app-bar:** Implement short top app bar ([#2290](https://github.com/material-components/material-components-web/issues/2290)) ([fd8d8d9](https://github.com/material-components/material-components-web/commit/fd8d8d9)) + + +### BREAKING CHANGES + +* **text-field:** removed setRequired and isRequired from foundation. +* **chips:** The `mdc-chip--activated` class, `mdc-chip-activated-ink-color` Sass mixin, and the `toggleActive` methods on `MDCChip`/`MDCChipSet` have been renamed to `mdc-chip--selected`, `mdc-chip-selected-ink-color`, and `toggleSelected`, respectively. +* **floating-label:** must use `.mdc-floating-label` selector instead of `.mdc-text-field__label` +* **chips:** Added `mdc-chip-set--filter` as a variant to be set in the HTML. +* **chips:** New MDCChipAdapter methods for handling trailing icons must be implemented. + + + # [0.31.0](https://github.com/material-components/material-components-web/compare/v0.30.0...v0.31.0) (2018-02-20) diff --git a/demos/button.html b/demos/button.html index e4d1ddd1c64..c2af876f093 100644 --- a/demos/button.html +++ b/demos/button.html @@ -112,9 +112,6 @@

Ripple Enabled

- @@ -137,9 +134,6 @@

Ripple Enabled

- @@ -162,9 +156,6 @@

Ripple Enabled

- @@ -187,9 +178,6 @@

Ripple Enabled

- @@ -225,9 +213,6 @@

CSS Only

- @@ -250,9 +235,6 @@

CSS Only

- @@ -275,9 +257,6 @@

CSS Only

- @@ -300,9 +279,6 @@

CSS Only

- diff --git a/demos/card.html b/demos/card.html index f4160fa5bf1..86eb4c7e9da 100644 --- a/demos/card.html +++ b/demos/card.html @@ -238,11 +238,7 @@

Asia's clean energ var rtlToggle = document.getElementById('toggle-rtl'); rtlToggle.addEventListener('change', function() { var docEl = document.documentElement; - if (rtlToggle.checked) { - docEl.setAttribute('dir', 'rtl'); - } else { - docEl.removeAttribute('dir'); - } + docEl.setAttribute('dir', rtlToggle.checked ? 'rtl' : 'ltr'); }); [].forEach.call(document.querySelectorAll('.mdc-button'), function(surface) { diff --git a/demos/checkbox.html b/demos/checkbox.html index 473c5a5f0f4..ac3bfd730d2 100644 --- a/demos/checkbox.html +++ b/demos/checkbox.html @@ -98,8 +98,8 @@

CSS Only

- - + +
@@ -210,8 +210,8 @@

With JavaScript

- - + +
@@ -235,8 +235,8 @@

With JavaScript

- - + +
diff --git a/demos/top-app-bar.scss b/demos/top-app-bar.scss index 698d4f36ba3..e82df46a5cd 100644 --- a/demos/top-app-bar.scss +++ b/demos/top-app-bar.scss @@ -29,3 +29,29 @@ padding: 16px; } } + +.demo-body { + padding: 0; + margin: 0; + box-sizing: border-box; +} + +.demo-main { + padding-left: 16px; + padding-right: 16px; + padding-bottom: 16px; + overflow: auto; +} + +.demo-controls-container { + @include mdc-elevation(4); + position: fixed; + bottom: 0; + right: 0; + background-color: white; + padding: 10px; +} + +input[type="checkbox"]:disabled + label { + opacity: .4; +} diff --git a/docs/docsite-index.md b/docs/docsite-index.md index 26f97ff772f..26473fe66a6 100644 --- a/docs/docsite-index.md +++ b/docs/docsite-index.md @@ -35,9 +35,9 @@ Get up and running with Material Components for web ``` 2. {: .step-list-item } ### Include the stylesheet - + Include the MDC Web stylesheet in the head of your file - + ```html @@ -56,14 +56,14 @@ Get up and running with Material Components for web

Hello, Material Components!

- +
``` 4. {: .step-list-item } ### Add scripts and instantiate - Add the MDC Web scripts and call MDC Auto Init. + Add the MDC Web scripts and call MDC Auto Init. ```html @@ -71,7 +71,7 @@ Get up and running with Material Components for web ``` A full example of the HTML could look like this: - + ```html @@ -84,7 +84,7 @@ Get up and running with Material Components for web

Hello, Material Components!

- +
diff --git a/docs/getting-started.md b/docs/getting-started.md index 1752bfb4814..2c58e67f041 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -67,7 +67,7 @@ module.exports = [{ output: { // This is necessary for webpack to compile // But we never use style-bundle.js - filename: 'style-bundle.js', + filename: 'style-bundle.js', }, module: { rules: [{ diff --git a/docs/migrating-from-mdl.md b/docs/migrating-from-mdl.md index 1f5f6d4a62a..af4c3fc3930 100644 --- a/docs/migrating-from-mdl.md +++ b/docs/migrating-from-mdl.md @@ -92,7 +92,7 @@ MDC Web: ```html
- +
``` @@ -118,7 +118,7 @@ element, with the component’s class name as the value. For example: ```html
- +
``` @@ -199,7 +199,7 @@ Like in MDL, styling components with CSS classes is simply a matter of applied t ```html
- +
``` diff --git a/lerna.json b/lerna.json index d16e6164a3b..8b212677df6 100644 --- a/lerna.json +++ b/lerna.json @@ -1,6 +1,6 @@ { "lerna": "2.0.0-beta.36", - "version": "0.31.0", + "version": "0.32.0", "commands": { "publish": { "ignore": [ diff --git a/package.json b/package.json index 073cf0c8713..39194f81308 100644 --- a/package.json +++ b/package.json @@ -130,6 +130,7 @@ "drawer", "elevation", "fab", + "floating-label", "form-field", "grid-list", "icon-toggle", @@ -168,6 +169,7 @@ "mdc-base", "mdc-checkbox", "mdc-chips", + "mdc-floating-label", "mdc-form-field", "mdc-icon-toggle", "mdc-line-ripple", diff --git a/packages/material-components-web/index.js b/packages/material-components-web/index.js index f6c42e70e47..a35f22f5a7c 100644 --- a/packages/material-components-web/index.js +++ b/packages/material-components-web/index.js @@ -20,6 +20,7 @@ import * as checkbox from '@material/checkbox/index'; import * as chips from '@material/chips/index'; import * as dialog from '@material/dialog/index'; import * as drawer from '@material/drawer/index'; +import * as floatingLabel from '@material/floating-label/index'; import * as formField from '@material/form-field/index'; import * as gridList from '@material/grid-list/index'; import * as iconToggle from '@material/icon-toggle/index'; @@ -44,6 +45,7 @@ autoInit.register('MDCChipSet', chips.MDCChipSet); autoInit.register('MDCDialog', dialog.MDCDialog); autoInit.register('MDCPersistentDrawer', drawer.MDCPersistentDrawer); autoInit.register('MDCTemporaryDrawer', drawer.MDCTemporaryDrawer); +autoInit.register('MDCFloatingLabel', floatingLabel.MDCFloatingLabel); autoInit.register('MDCFormField', formField.MDCFormField); autoInit.register('MDCRipple', ripple.MDCRipple); autoInit.register('MDCGridList', gridList.MDCGridList); @@ -69,6 +71,7 @@ export { chips, dialog, drawer, + floatingLabel, formField, gridList, iconToggle, diff --git a/packages/material-components-web/material-components-web.scss b/packages/material-components-web/material-components-web.scss index f8476666470..65f2a08f5da 100644 --- a/packages/material-components-web/material-components-web.scss +++ b/packages/material-components-web/material-components-web.scss @@ -22,6 +22,7 @@ @import "@material/drawer/mdc-drawer"; @import "@material/elevation/mdc-elevation"; @import "@material/fab/mdc-fab"; +@import "@material/floating-label/mdc-floating-label"; @import "@material/form-field/mdc-form-field"; @import "@material/grid-list/mdc-grid-list"; @import "@material/icon-toggle/mdc-icon-toggle"; diff --git a/packages/material-components-web/package.json b/packages/material-components-web/package.json index 96299c2e872..97a6cfdc2e7 100644 --- a/packages/material-components-web/package.json +++ b/packages/material-components-web/package.json @@ -1,7 +1,7 @@ { "name": "material-components-web", "description": "Modular and customizable Material Design UI components for the web", - "version": "0.31.0", + "version": "0.32.0", "license": "Apache-2.0", "keywords": [ "material components", @@ -14,37 +14,38 @@ }, "dependencies": { "@material/animation": "^0.25.0", - "@material/auto-init": "^0.30.0", + "@material/auto-init": "^0.32.0", "@material/base": "^0.29.0", - "@material/button": "^0.31.0", - "@material/card": "^0.31.0", - "@material/checkbox": "^0.31.0", - "@material/chips": "^0.31.0", - "@material/dialog": "^0.31.0", + "@material/button": "^0.32.0", + "@material/card": "^0.32.0", + "@material/checkbox": "^0.32.0", + "@material/chips": "^0.32.0", + "@material/dialog": "^0.32.0", "@material/drawer": "^0.30.0", "@material/elevation": "^0.28.0", - "@material/fab": "^0.31.0", - "@material/form-field": "^0.31.0", + "@material/fab": "^0.32.0", + "@material/floating-label": "^0.32.0", + "@material/form-field": "^0.32.0", "@material/grid-list": "^0.30.0", - "@material/icon-toggle": "^0.31.0", + "@material/icon-toggle": "^0.32.0", "@material/layout-grid": "^0.24.0", - "@material/line-ripple": "^0.30.0", + "@material/line-ripple": "^0.32.0", "@material/linear-progress": "^0.30.0", - "@material/list": "^0.31.0", + "@material/list": "^0.32.0", "@material/menu": "^0.31.0", - "@material/radio": "^0.31.0", - "@material/ripple": "^0.31.0", + "@material/radio": "^0.32.0", + "@material/ripple": "^0.32.0", "@material/rtl": "^0.30.0", - "@material/select": "^0.31.0", - "@material/selection-control": "^0.31.0", - "@material/slider": "^0.30.0", + "@material/select": "^0.32.0", + "@material/selection-control": "^0.32.0", + "@material/slider": "^0.32.0", "@material/snackbar": "^0.30.0", - "@material/switch": "^0.31.0", - "@material/tabs": "^0.31.0", - "@material/textfield": "^0.31.0", + "@material/switch": "^0.32.0", + "@material/tabs": "^0.32.0", + "@material/textfield": "^0.32.0", "@material/theme": "^0.30.0", - "@material/toolbar": "^0.30.0", - "@material/top-app-bar": "^0.0.0", + "@material/toolbar": "^0.32.0", + "@material/top-app-bar": "^0.32.0", "@material/typography": "^0.28.0" } } diff --git a/packages/mdc-auto-init/README.md b/packages/mdc-auto-init/README.md index af64a85296c..98e911c1346 100644 --- a/packages/mdc-auto-init/README.md +++ b/packages/mdc-auto-init/README.md @@ -32,7 +32,7 @@ writing the markup, simply insert a script tag that calls `mdc.autoInit()`. Make ```html
- +
@@ -52,7 +52,7 @@ using a property whose name is the value of `data-mdc-auto-init`. For example, g ```html
- +
``` diff --git a/packages/mdc-auto-init/package.json b/packages/mdc-auto-init/package.json index cb52614171c..cc689c1703d 100644 --- a/packages/mdc-auto-init/package.json +++ b/packages/mdc-auto-init/package.json @@ -1,7 +1,7 @@ { "name": "@material/auto-init", "description": "Declarative, easy-to-use auto-initialization for Material Components for the web", - "version": "0.30.0", + "version": "0.32.0", "main": "index.js", "license": "Apache-2.0", "repository": { diff --git a/packages/mdc-button/README.md b/packages/mdc-button/README.md index 5a70b7b7a39..ed114ba11fc 100644 --- a/packages/mdc-button/README.md +++ b/packages/mdc-button/README.md @@ -81,8 +81,6 @@ CSS Class | Description `mdc-button--unelevated` | Optional, a contained button that is flush with the surface `mdc-button--stroked` | Optional, a contained button that is flush with the surface and has a visible border `mdc-button--dense` | Optional, compresses the button text to make it slightly smaller -`mdc-button--compact` | Optional, reduces the amount of horizontal padding in the button - ### Disabled Button diff --git a/packages/mdc-button/_mixins.scss b/packages/mdc-button/_mixins.scss index f8de32db86c..4d76a44e8a7 100644 --- a/packages/mdc-button/_mixins.scss +++ b/packages/mdc-button/_mixins.scss @@ -16,6 +16,7 @@ @import "@material/elevation/mixins"; @import "@material/ripple/mixins"; +@import "@material/rtl/mixins"; @import "@material/theme/functions"; @import "@material/theme/mixins"; @import "@material/typography/mixins"; @@ -75,13 +76,6 @@ // Minus extra 1 to accommodate odd font size of dense button line-height: $mdc-dense-button-height - $stroke-width * 2 - 1; } - - &.mdc-button--compact { - $padding-compact-value: max($mdc-compact-button-horizontal-padding - $stroke-width, 0); - - padding-right: $padding-compact-value; - padding-left: $padding-compact-value; - } } @mixin mdc-button-base_() { @@ -127,10 +121,11 @@ } @mixin mdc-button__icon_ { + @include mdc-rtl-reflexive-box(margin, right, 8px); + display: inline-block; width: 18px; height: 18px; - margin-right: 8px; font-size: 18px; line-height: inherit; vertical-align: top; @@ -170,10 +165,6 @@ } } -@mixin mdc-button--compact_() { - padding: 0 $mdc-compact-button-horizontal-padding; -} - @mixin mdc-button--dense_() { height: $mdc-dense-button-height; font-size: .8125rem; // 13sp diff --git a/packages/mdc-button/_variables.scss b/packages/mdc-button/_variables.scss index 3347b353745..15b5923c8a9 100644 --- a/packages/mdc-button/_variables.scss +++ b/packages/mdc-button/_variables.scss @@ -17,4 +17,3 @@ $mdc-button-height: 36px; $mdc-button-horizontal-padding: 16px; $mdc-dense-button-height: 32px; -$mdc-compact-button-horizontal-padding: 8px; diff --git a/packages/mdc-button/mdc-button.scss b/packages/mdc-button/mdc-button.scss index 3faa2116d08..6e1f42b7821 100644 --- a/packages/mdc-button/mdc-button.scss +++ b/packages/mdc-button/mdc-button.scss @@ -54,10 +54,6 @@ @include mdc-button-stroke-color(primary); } -.mdc-button--compact { - @include mdc-button--compact_; -} - .mdc-button--dense { @include mdc-button--dense_; } diff --git a/packages/mdc-button/package.json b/packages/mdc-button/package.json index 49fa97f50ab..e181df377a0 100644 --- a/packages/mdc-button/package.json +++ b/packages/mdc-button/package.json @@ -1,7 +1,7 @@ { "name": "@material/button", "description": "The Material Components for the web button component", - "version": "0.31.0", + "version": "0.32.0", "license": "Apache 2.0", "keywords": [ "material components", @@ -14,7 +14,8 @@ }, "dependencies": { "@material/elevation": "^0.28.0", - "@material/ripple": "^0.31.0", + "@material/ripple": "^0.32.0", + "@material/rtl": "^0.30.0", "@material/theme": "^0.30.0", "@material/typography": "^0.28.0" } diff --git a/packages/mdc-card/package.json b/packages/mdc-card/package.json index dc7e552fadd..edaf937f8c0 100644 --- a/packages/mdc-card/package.json +++ b/packages/mdc-card/package.json @@ -1,6 +1,6 @@ { "name": "@material/card", - "version": "0.31.0", + "version": "0.32.0", "description": "The Material Components for the web card component", "license": "Apache-2.0", "keywords": [ @@ -15,7 +15,7 @@ "dependencies": { "@material/elevation": "^0.28.0", "@material/theme": "^0.30.0", - "@material/ripple": "^0.31.0", + "@material/ripple": "^0.32.0", "@material/rtl": "^0.30.0" } } diff --git a/packages/mdc-checkbox/package.json b/packages/mdc-checkbox/package.json index 7110e677708..3b6809d354f 100644 --- a/packages/mdc-checkbox/package.json +++ b/packages/mdc-checkbox/package.json @@ -1,7 +1,7 @@ { "name": "@material/checkbox", "description": "The Material Components for the web checkbox component", - "version": "0.31.0", + "version": "0.32.0", "license": "Apache-2.0", "keywords": [ "material components", @@ -16,8 +16,8 @@ "dependencies": { "@material/animation": "^0.25.0", "@material/base": "^0.29.0", - "@material/ripple": "^0.31.0", - "@material/selection-control": "^0.31.0", + "@material/ripple": "^0.32.0", + "@material/selection-control": "^0.32.0", "@material/rtl": "^0.30.0", "@material/theme": "^0.30.0" } diff --git a/packages/mdc-chips/README.md b/packages/mdc-chips/README.md index 1d692c2b684..b57d15f87ed 100644 --- a/packages/mdc-chips/README.md +++ b/packages/mdc-chips/README.md @@ -100,7 +100,7 @@ Mixin | Description `mdc-chip-fill-color-accessible($color)` | Customizes the background fill color for a chip, and updates the chip's ink and ripple color to meet accessibility standards `mdc-chip-fill-color($color)` | Customizes the background fill color for a chip `mdc-chip-ink-color($color)` | Customizes the text ink color for a chip, and updates the chip's ripple color to match -`mdc-chip-activated-ink-color($color)` | Customizes text ink color and updates the ripple opacity of a chip in the _activated_ state +`mdc-chip-selected-ink-color($color)` | Customizes text ink and ripple color of a chip in the _selected_ state `mdc-chip-stroke($width, $style, $color)` | Customizes the border stroke properties for a chip `mdc-chip-stroke-width($width)` | Customizes the border stroke width for a chip `mdc-chip-stroke-style($style)` | Customizes the border stroke style for a chip @@ -108,8 +108,6 @@ Mixin | Description > _NOTE_: `mdc-chip-set-spacing` also sets the amount of space between a chip and the edge of the set it's contained in. -> _NOTE_: `mdc-chip-ink-color` also updates the chip's text ink color for _hover_ and _activated_ states, and updates the ripple opacity of the chip in the _activated_ state. - ### `MDCChip` and `MDCChipSet` The MDC Chips module is comprised of two JavaScript classes: @@ -122,7 +120,7 @@ To use the `MDCChip` and `MDCChipSet` classes, [import](../../docs/importing-js. Method Signature | Description --- | --- -`toggleActive() => void` | Proxies to the foundation's `toggleActive` method +`toggleSelected() => void` | Proxies to the foundation's `toggleSelected` method Property | Value Type | Description --- | --- | --- @@ -164,7 +162,7 @@ Method Signature | Description Method Signature | Description --- | --- -`toggleActive() => void` | Toggles the activated class on the chip element +`toggleSelected() => void` | Toggles the selected class on the chip element #### `MDCChipSetFoundation` None yet, coming soon. diff --git a/packages/mdc-chips/_mixins.scss b/packages/mdc-chips/_mixins.scss index 45b02b9ccc6..87b8746d76f 100644 --- a/packages/mdc-chips/_mixins.scss +++ b/packages/mdc-chips/_mixins.scss @@ -29,10 +29,10 @@ @if ($fill-tone == "dark") { @include mdc-chip-ink-color(text-primary-on-dark); - @include mdc-chip-activated-ink-color(white); + @include mdc-chip-selected-ink-color(white); } @else { @include mdc-chip-ink-color(text-primary-on-light); - @include mdc-chip-activated-ink-color(black); + @include mdc-chip-selected-ink-color(black); } } @@ -42,7 +42,6 @@ @mixin mdc-chip-ink-color($color) { @include mdc-states($color); - @include mdc-chip-activated-ink-color($color); @include mdc-theme-prop(color, $color); &:hover { @@ -50,15 +49,17 @@ } } -@mixin mdc-chip-activated-ink-color($activated-ink-color) { +@mixin mdc-chip-selected-ink-color($color) { &.mdc-chip { - // This changes the opacity of the ripple based on whether $activated-ink-color is light or dark. - // It does not change the color of the ripple. - @include mdc-states-activated($activated-ink-color); + @include mdc-states-selected($color); } - &.mdc-chip--activated { - @include mdc-theme-prop(color, $activated-ink-color); + &.mdc-chip--selected { + @include mdc-theme-prop(color, $color); + + &:hover { + @include mdc-theme-prop(color, $color); + } } } diff --git a/packages/mdc-chips/chip-set/foundation.js b/packages/mdc-chips/chip-set/foundation.js index f0a12df7787..7b3b1f9f3d3 100644 --- a/packages/mdc-chips/chip-set/foundation.js +++ b/packages/mdc-chips/chip-set/foundation.js @@ -56,10 +56,10 @@ class MDCChipSetFoundation extends MDCFoundation { super(Object.assign(MDCChipSetFoundation.defaultAdapter, adapter)); /** - * The active chips in the set. Only used for choice chip set or filter chip set. + * The selected chips in the set. Only used for choice chip set or filter chip set. * @private {!Array} */ - this.activeChips_ = []; + this.selectedChips_ = []; /** @private {function(!Event): undefined} */ this.chipInteractionHandler_ = (evt) => this.handleChipInteraction_(evt); @@ -83,23 +83,23 @@ class MDCChipSetFoundation extends MDCFoundation { handleChipInteraction_(evt) { const {chip} = evt.detail; if (this.adapter_.hasClass(cssClasses.CHOICE)) { - if (this.activeChips_.length === 0) { - this.activeChips_[0] = chip; - } else if (this.activeChips_[0] !== chip) { - this.activeChips_[0].toggleActive(); - this.activeChips_[0] = chip; + if (this.selectedChips_.length === 0) { + this.selectedChips_[0] = chip; + } else if (this.selectedChips_[0] !== chip) { + this.selectedChips_[0].toggleSelected(); + this.selectedChips_[0] = chip; } else { - this.activeChips_ = []; + this.selectedChips_ = []; } - chip.toggleActive(); + chip.toggleSelected(); } else if (this.adapter_.hasClass(cssClasses.FILTER)) { - const index = this.activeChips_.indexOf(chip); + const index = this.selectedChips_.indexOf(chip); if (index >= 0) { - this.activeChips_.splice(index, 1); + this.selectedChips_.splice(index, 1); } else { - this.activeChips_.push(chip); + this.selectedChips_.push(chip); } - chip.toggleActive(); + chip.toggleSelected(); } } } diff --git a/packages/mdc-chips/chip/constants.js b/packages/mdc-chips/chip/constants.js index 6d4293f40e9..de8213ffd4f 100644 --- a/packages/mdc-chips/chip/constants.js +++ b/packages/mdc-chips/chip/constants.js @@ -24,7 +24,7 @@ const strings = { /** @enum {string} */ const cssClasses = { - ACTIVATED: 'mdc-chip--activated', + SELECTED: 'mdc-chip--selected', }; export {strings, cssClasses}; diff --git a/packages/mdc-chips/chip/foundation.js b/packages/mdc-chips/chip/foundation.js index f535884087e..4458d90bbe1 100644 --- a/packages/mdc-chips/chip/foundation.js +++ b/packages/mdc-chips/chip/foundation.js @@ -87,13 +87,13 @@ class MDCChipFoundation extends MDCFoundation { } /** - * Toggles the activated class on the chip element. + * Toggles the selected class on the chip element. */ - toggleActive() { - if (this.adapter_.hasClass(cssClasses.ACTIVATED)) { - this.adapter_.removeClass(cssClasses.ACTIVATED); + toggleSelected() { + if (this.adapter_.hasClass(cssClasses.SELECTED)) { + this.adapter_.removeClass(cssClasses.SELECTED); } else { - this.adapter_.addClass(cssClasses.ACTIVATED); + this.adapter_.addClass(cssClasses.SELECTED); } } diff --git a/packages/mdc-chips/chip/index.js b/packages/mdc-chips/chip/index.js index 953c63ceb1c..b262b653611 100644 --- a/packages/mdc-chips/chip/index.js +++ b/packages/mdc-chips/chip/index.js @@ -51,10 +51,10 @@ class MDCChip extends MDCComponent { } /** - * Toggles active state of the chip. + * Toggles selected state of the chip. */ - toggleActive() { - this.foundation_.toggleActive(); + toggleSelected() { + this.foundation_.toggleSelected(); } /** diff --git a/packages/mdc-chips/chip/mdc-chip.scss b/packages/mdc-chips/chip/mdc-chip.scss index 6c1d423b614..c530e088969 100644 --- a/packages/mdc-chips/chip/mdc-chip.scss +++ b/packages/mdc-chips/chip/mdc-chip.scss @@ -27,7 +27,7 @@ @include mdc-chip-corner-radius($mdc-chip-border-radius-default); @include mdc-chip-fill-color($mdc-chip-fill-color-default); @include mdc-chip-ink-color($mdc-chip-ink-color-default); - @include mdc-chip-activated-ink-color(black); + @include mdc-chip-selected-ink-color(primary); display: inline-flex; position: relative; @@ -42,6 +42,10 @@ } } +.mdc-chip--selected { + @include mdc-theme-prop(background-color, white); +} + .mdc-chip__text { // Set line-height to be <18px to force the content height of mdc-chip to be 18px. line-height: 17px; diff --git a/packages/mdc-chips/package.json b/packages/mdc-chips/package.json index 5f70a83be01..1628e9402ff 100644 --- a/packages/mdc-chips/package.json +++ b/packages/mdc-chips/package.json @@ -1,7 +1,7 @@ { "name": "@material/chips", "description": "The Material Components for the Web chips component", - "version": "0.31.0", + "version": "0.32.0", "license": "Apache 2.0", "keywords": [ "material components", @@ -17,6 +17,6 @@ }, "dependencies": { "@material/base": "^0.29.0", - "@material/ripple": "^0.31.0" + "@material/ripple": "^0.32.0" } } diff --git a/packages/mdc-dialog/package.json b/packages/mdc-dialog/package.json index 7610d63cbf9..243417dcd86 100644 --- a/packages/mdc-dialog/package.json +++ b/packages/mdc-dialog/package.json @@ -1,6 +1,6 @@ { "name": "@material/dialog", - "version": "0.31.0", + "version": "0.32.0", "description": "The Material Components Web dialog component", "license": "Apache-2.0", "keywords": [ @@ -18,7 +18,7 @@ "@material/animation": "^0.25.0", "@material/base": "^0.29.0", "@material/elevation": "^0.28.0", - "@material/ripple": "^0.31.0", + "@material/ripple": "^0.32.0", "@material/rtl": "^0.30.0", "@material/theme": "^0.30.0", "@material/typography": "^0.1.1", diff --git a/packages/mdc-fab/package.json b/packages/mdc-fab/package.json index 9176137707c..9e0ab79340b 100644 --- a/packages/mdc-fab/package.json +++ b/packages/mdc-fab/package.json @@ -1,7 +1,7 @@ { "name": "@material/fab", "description": "The Material Components for the web floating action button component", - "version": "0.31.0", + "version": "0.32.0", "license": "Apache-2.0", "keywords": [ "material components", @@ -16,7 +16,7 @@ "dependencies": { "@material/animation": "^0.25.0", "@material/elevation": "^0.28.0", - "@material/ripple": "^0.31.0", + "@material/ripple": "^0.32.0", "@material/theme": "^0.30.0" } } diff --git a/packages/mdc-floating-label/README.md b/packages/mdc-floating-label/README.md new file mode 100644 index 00000000000..8626044ac2d --- /dev/null +++ b/packages/mdc-floating-label/README.md @@ -0,0 +1,94 @@ + + +# Floating Label + +Floating labels display the type of input a field requires. Every text field and select should have a label. Labels are aligned with the input line and always visible. They can be resting (when a field is inactive and empty) or floating. The label is a text caption or description for the text field. + +## Design & API Documentation + + + +## Usage + +### HTML Structure + +```html + +``` + +### Usage within `mdc-text-field` + +```html +
+ + +
+
+``` + + + +#### Avoid Dynamic ID Generation + +If you're using the JavaScript-enabled version of floating label, you can avoid needing to assign +a unique `id` to each `` by wrapping `mdc-text-field__input` within a `