diff --git a/packages/mdc-chips/_mixins.scss b/packages/mdc-chips/_mixins.scss index 8ccfe68c793..c997e110377 100644 --- a/packages/mdc-chips/_mixins.scss +++ b/packages/mdc-chips/_mixins.scss @@ -20,111 +20,438 @@ // THE SOFTWARE. // +@import "@material/animation/functions"; +@import "@material/animation/variables"; +@import "@material/checkbox/functions"; +@import "@material/checkbox/variables"; @import "@material/elevation/mixins"; +@import "@material/feature-targeting/functions"; +@import "@material/feature-targeting/mixins"; @import "@material/ripple/mixins"; @import "@material/rtl/mixins"; @import "@material/theme/functions"; @import "@material/theme/mixins"; +@import "@material/typography/mixins"; @import "@material/shape/mixins"; @import "@material/shape/functions"; @import "./variables"; -@mixin mdc-chip-shape-radius($radius, $rtl-reflexive: false) { - @include mdc-shape-radius(mdc-shape-resolve-percentage-radius($mdc-chip-height-default, $radius), $rtl-reflexive); +@mixin mdc-chip-core-styles($query: mdc-feature-all()) { + @include mdc-chip-without-ripple($query: $query); + @include mdc-chip-ripple($query: $query); } -@mixin mdc-chip-fill-color-accessible($color) { +@mixin mdc-chip-without-ripple($query: mdc-feature-all()) { + $feat-animation: mdc-feature-create-target($query, animation); + $feat-color: mdc-feature-create-target($query, color); + $feat-structure: mdc-feature-create-target($query, structure); + + @include mdc-chip-leading-icon-color($mdc-chip-icon-color, $query: $query); + @include mdc-chip-trailing-icon-color($mdc-chip-icon-color, $query: $query); + @include mdc-chip-leading-icon-size($mdc-chip-leading-icon-size, $query: $query); + @include mdc-chip-trailing-icon-size($mdc-chip-trailing-icon-size, $query: $query); + @include mdc-chip-trailing-icon-margin($query: $query); + + .mdc-chip { + @include mdc-chip-shape-radius(50%, $query: $query); + @include mdc-chip-fill-color($mdc-chip-fill-color-default, $query: $query); + @include mdc-chip-ink-color-without-ripple_($mdc-chip-ink-color-default, $query: $query); + @include mdc-typography(body2, $query: $query); + @include mdc-chip-height($mdc-chip-height-default, $query: $query); + @include mdc-chip-leading-icon-margin($query: $query); + + @include mdc-feature-targets($feat-structure) { + display: inline-flex; + position: relative; + align-items: center; + box-sizing: border-box; + padding: $mdc-chip-vertical-padding $mdc-chip-horizontal-padding; + outline: none; + cursor: pointer; + overflow: hidden; + } + + &:hover { + @include mdc-feature-targets($feat-color) { + @include mdc-theme-prop(color, on-surface); + } + } + } + + .mdc-chip--exit { + @include mdc-feature-targets($feat-color) { + transition: $mdc-chip-exit-transition; + } + + @include mdc-feature-targets($feat-structure) { + opacity: 0; + } + } + + .mdc-chip__text { + @include mdc-feature-targets($feat-structure) { + white-space: nowrap; + } + } + + .mdc-chip__icon { + @include mdc-feature-targets($feat-structure) { + border-radius: 50%; + outline: none; + vertical-align: middle; + } + } + + .mdc-chip__checkmark { + @include mdc-feature-targets($feat-structure) { + height: $mdc-chip-leading-icon-size; + } + } + + .mdc-chip__checkmark-path { + @include mdc-feature-targets($feat-animation) { + transition: + mdc-checkbox-transition-exit( + stroke-dashoffset, + $mdc-chip-checkmark-animation-delay, + $mdc-chip-checkmark-animation-duration + ); + } + + @include mdc-feature-targets($feat-structure) { + stroke-width: 2px; + stroke-dashoffset: $mdc-checkbox-mark-path-length_; + stroke-dasharray: $mdc-checkbox-mark-path-length_; + } + } + + .mdc-chip--selected .mdc-chip__checkmark-path { + @include mdc-feature-targets($feat-structure) { + stroke-dashoffset: 0; + } + } + + // Change color of selected choice chips + + .mdc-chip-set--choice { + .mdc-chip { + @include mdc-chip-selected-ink-color-without-ripple_(primary, $query: $query); + } + + .mdc-chip--selected { + @include mdc-feature-targets($feat-color) { + @include mdc-theme-prop(background-color, surface); + } + } + } + + // Add leading checkmark to filter chips with no leading icon + + .mdc-chip__checkmark-svg { + @include mdc-feature-targets($feat-structure) { + width: 0; + height: $mdc-chip-leading-icon-size; + } + + @include mdc-feature-targets($feat-animation) { + transition: width $mdc-chip-width-animation-duration $mdc-animation-standard-curve-timing-function; + } + } + + .mdc-chip--selected .mdc-chip__checkmark-svg { + @include mdc-feature-targets($feat-structure) { + width: $mdc-chip-leading-icon-size; + } + } + + // Add leading checkmark to filter chips with a leading icon + + .mdc-chip-set--filter { + .mdc-chip__icon--leading { + @include mdc-feature-targets($feat-animation) { + transition: opacity $mdc-chip-opacity-animation-duration linear; + transition-delay: $mdc-chip-leading-icon-delay; + } + + @include mdc-feature-targets($feat-structure) { + opacity: 1; + } + + + .mdc-chip__checkmark { + @include mdc-feature-targets($feat-animation) { + transition: opacity $mdc-chip-opacity-animation-duration linear; + + // Delay the checkmark transition. + transition-delay: $mdc-chip-checkmark-with-leading-icon-delay; + } + + @include mdc-feature-targets($feat-structure) { + opacity: 0; + } + + .mdc-chip__checkmark-svg { + // stylelint-disable max-nesting-depth + + @include mdc-feature-targets($feat-animation) { + transition: width 0ms; + } + + // stylelint-enable max-nesting-depth + } + } + } + + .mdc-chip--selected .mdc-chip__icon--leading { + @include mdc-feature-targets($feat-structure) { + opacity: 0; + } + + + .mdc-chip__checkmark { + @include mdc-feature-targets($feat-structure) { + // This ensures that the checkmark has zero width while the leading icon is still animating. + width: 0; + opacity: 1; + } + } + } + + .mdc-chip__icon--leading-hidden.mdc-chip__icon--leading { + @include mdc-feature-targets($feat-structure) { + width: 0; + } + + @include mdc-feature-targets($feat-structure) { + // This ensures that the leading icon doesn't fade in while the checkmark is fading out. + opacity: 0; + } + + + .mdc-chip__checkmark { + @include mdc-feature-targets($feat-structure) { + width: $mdc-chip-leading-icon-size; + } + } + } + } +} + +@mixin mdc-chip-ripple($query: mdc-feature-all()) { + @include mdc-ripple-common($query); + + .mdc-chip { + @include mdc-ripple-surface($query: $query); + @include mdc-ripple-radius-bounded($query: $query); + @include mdc-chip-ink-color-ripple_($mdc-chip-ink-color-default, $query: $query); + } + + .mdc-chip-set--choice { + .mdc-chip { + @include mdc-chip-selected-ink-color-ripple_(primary, $query: $query); + } + } +} + +@mixin mdc-chip-set-core-styles($query: mdc-feature-all()) { + $feat-animation: mdc-feature-create-target($query, animation); + $feat-structure: mdc-feature-create-target($query, structure); + + @include mdc-feature-targets($feat-animation) { + @keyframes mdc-chip-entry { + from { + transform: scale(.8); + opacity: .4; + } + + to { + transform: scale(1); + opacity: 1; + } + } + } + + .mdc-chip-set { + @include mdc-chip-set-spacing(8px, $query: $query); + + @include mdc-feature-targets($feat-structure) { + display: flex; + flex-wrap: wrap; + box-sizing: border-box; + } + } + + .mdc-chip-set--input .mdc-chip { + @include mdc-feature-targets($feat-animation) { + animation: mdc-chip-entry 100ms $mdc-animation-deceleration-curve-timing-function; + } + } +} + +@mixin mdc-chip-shape-radius($radius, $rtl-reflexive: false, $query: mdc-feature-all()) { + @include mdc-shape-radius( + mdc-shape-resolve-percentage-radius($mdc-chip-height-default, $radius), + $rtl-reflexive, + $query: $query); +} + +@mixin mdc-chip-fill-color-accessible($color, $query: mdc-feature-all()) { $fill-tone: mdc-theme-tone($color); - @include mdc-chip-fill-color($color); + @include mdc-chip-fill-color($color, $query: $query); @if ($fill-tone == "dark") { - @include mdc-chip-ink-color(text-primary-on-dark); - @include mdc-chip-selected-ink-color(text-primary-on-dark); - @include mdc-chip-leading-icon-color(text-primary-on-dark); - @include mdc-chip-trailing-icon-color(text-primary-on-dark); + @include mdc-chip-ink-color(text-primary-on-dark, $query: $query); + @include mdc-chip-selected-ink-color(text-primary-on-dark, $query: $query); + @include mdc-chip-leading-icon-color(text-primary-on-dark, $query: $query); + @include mdc-chip-trailing-icon-color(text-primary-on-dark, $query: $query); } @else { - @include mdc-chip-ink-color(text-primary-on-light); - @include mdc-chip-selected-ink-color(text-primary-on-light); - @include mdc-chip-leading-icon-color(text-primary-on-light); - @include mdc-chip-trailing-icon-color(text-primary-on-light); + @include mdc-chip-ink-color(text-primary-on-light, $query: $query); + @include mdc-chip-selected-ink-color(text-primary-on-light, $query: $query); + @include mdc-chip-leading-icon-color(text-primary-on-light, $query: $query); + @include mdc-chip-trailing-icon-color(text-primary-on-light, $query: $query); + } +} + +@mixin mdc-chip-fill-color($color, $query: mdc-feature-all()) { + $feat-color: mdc-feature-create-target($query, color); + + @include mdc-feature-targets($feat-color) { + @include mdc-theme-prop(background-color, $color); } } -@mixin mdc-chip-fill-color($color) { - @include mdc-theme-prop(background-color, $color); +@mixin mdc-chip-ink-color($color, $query: mdc-feature-all()) { + @include mdc-chip-ink-color-ripple_($color, $query: $query); + @include mdc-chip-ink-color-without-ripple_($color, $query: $query); } -@mixin mdc-chip-ink-color($color) { - @include mdc-states($color); - @include mdc-theme-prop(color, $color); +@mixin mdc-chip-ink-color-without-ripple_($color, $query) { + $feat-color: mdc-feature-create-target($query, color); - &:hover { + @include mdc-feature-targets($feat-color) { @include mdc-theme-prop(color, $color); } -} -@mixin mdc-chip-selected-ink-color($color) { - &.mdc-chip { - @include mdc-states-selected($color); + &:hover { + @include mdc-feature-targets($feat-color) { + @include mdc-theme-prop(color, $color); + } } +} + +@mixin mdc-chip-ink-color-ripple_($color, $query) { + @include mdc-states($color, $query: $query); +} + +@mixin mdc-chip-selected-ink-color($color, $query: mdc-feature-all()) { + @include mdc-chip-selected-ink-color-ripple_($color, $query: $query); + @include mdc-chip-selected-ink-color-without-ripple_($color, $query: $query); +} + +@mixin mdc-chip-selected-ink-color-without-ripple_($color, $query) { + $feat-color: mdc-feature-create-target($query, color); &.mdc-chip--selected { - @include mdc-theme-prop(color, $color); - @include mdc-chip-leading-icon-color($color); + @include mdc-feature-targets($feat-color) { + @include mdc-theme-prop(color, $color); + } + + @include mdc-chip-leading-icon-color($color, $query: $query); &:hover { - @include mdc-theme-prop(color, $color); + @include mdc-feature-targets($feat-color) { + @include mdc-theme-prop(color, $color); + } } } .mdc-chip__checkmark-path { - @include mdc-theme-prop(stroke, $color); + @include mdc-feature-targets($feat-color) { + @include mdc-theme-prop(stroke, $color); + } } } -@mixin mdc-chip-outline($width: 1px, $style: solid, $color: mdc-theme-prop-value(on-surface)) { - @include mdc-chip-outline-width($width); - @include mdc-chip-outline-style($style); - @include mdc-chip-outline-color($color); +@mixin mdc-chip-selected-ink-color-ripple_($color, $query) { + &.mdc-chip { + @include mdc-states-selected($color, $query: $query); + } } -@mixin mdc-chip-outline-color($color) { - @include mdc-theme-prop(border-color, $color); +@mixin mdc-chip-outline( + $width: 1px, + $style: solid, + $color: mdc-theme-prop-value(on-surface), + $query: mdc-feature-all()) { + @include mdc-chip-outline-width($width, $query: $query); + @include mdc-chip-outline-style($style, $query: $query); + @include mdc-chip-outline-color($color, $query: $query); } -@mixin mdc-chip-outline-style($style) { - border-style: $style; +@mixin mdc-chip-outline-color($color, $query: mdc-feature-all()) { + $feat-color: mdc-feature-create-target($query, color); + + @include mdc-feature-targets($feat-color) { + @include mdc-theme-prop(border-color, $color); + } } -@mixin mdc-chip-outline-width($width, $horizontal-padding: $mdc-chip-horizontal-padding) { +@mixin mdc-chip-outline-style($style, $query: mdc-feature-all()) { + $feat-structure: mdc-feature-create-target($query, structure); + + @include mdc-feature-targets($feat-structure) { + border-style: $style; + } +} + +@mixin mdc-chip-outline-width($width, $horizontal-padding: $mdc-chip-horizontal-padding, $query: mdc-feature-all()) { + $feat-structure: mdc-feature-create-target($query, structure); + // Note: Adjust padding to maintain consistent width with non-outlined chips $horizontal-padding-value: max($horizontal-padding - $width, 0); $vertical-padding-value: max($mdc-chip-vertical-padding - $width, 0); - padding: $vertical-padding-value $horizontal-padding-value; - border-width: $width; + @include mdc-feature-targets($feat-structure) { + padding: $vertical-padding-value $horizontal-padding-value; + border-width: $width; + } } -@mixin mdc-chip-horizontal-padding($padding) { - padding: $mdc-chip-vertical-padding $padding; +@mixin mdc-chip-horizontal-padding($padding, $query: mdc-feature-all()) { + $feat-structure: mdc-feature-create-target($query, structure); + + @include mdc-feature-targets($feat-structure) { + padding: $mdc-chip-vertical-padding $padding; + } } -@mixin mdc-chip-height($height) { - height: $height; +@mixin mdc-chip-height($height, $query: mdc-feature-all()) { + $feat-structure: mdc-feature-create-target($query, structure); + + @include mdc-feature-targets($feat-structure) { + height: $height; + } } -@mixin mdc-chip-set-spacing($gap-size) { - padding: $gap-size / 2; +@mixin mdc-chip-set-spacing($gap-size, $query: mdc-feature-all()) { + $feat-structure: mdc-feature-create-target($query, structure); + + @include mdc-feature-targets($feat-structure) { + padding: $gap-size / 2; + } .mdc-chip { - margin: $gap-size / 2; + @include mdc-feature-targets($feat-structure) { + margin: $gap-size / 2; + } } } -@mixin mdc-chip-leading-icon-color($color, $opacity: $mdc-chip-icon-opacity) { +@mixin mdc-chip-leading-icon-color($color, $opacity: $mdc-chip-icon-opacity, $query: mdc-feature-all()) { + $feat-color: mdc-feature-create-target($query, color); + .mdc-chip__icon--leading { - color: rgba(mdc-theme-prop-value($color), $opacity); + @include mdc-feature-targets($feat-color) { + color: rgba(mdc-theme-prop-value($color), $opacity); + } } } @@ -132,16 +459,25 @@ $color, $opacity: $mdc-chip-icon-opacity, $hover-opacity: $mdc-chip-trailing-icon-hover-opacity, - $focus-opacity: $mdc-chip-trailing-icon-focus-opacity) { + $focus-opacity: $mdc-chip-trailing-icon-focus-opacity, + $query: mdc-feature-all()) { + $feat-color: mdc-feature-create-target($query, color); + .mdc-chip__icon--trailing { - color: rgba(mdc-theme-prop-value($color), $opacity); + @include mdc-feature-targets($feat-color) { + color: rgba(mdc-theme-prop-value($color), $opacity); + } &:hover { - color: rgba(mdc-theme-prop-value($color), $hover-opacity); + @include mdc-feature-targets($feat-color) { + color: rgba(mdc-theme-prop-value($color), $hover-opacity); + } } &:focus { - color: rgba(mdc-theme-prop-value($color), $focus-opacity); + @include mdc-feature-targets($feat-color) { + color: rgba(mdc-theme-prop-value($color), $focus-opacity); + } } } } @@ -150,35 +486,44 @@ // overrides apply. Styles defined in the .material-icons CSS class are // loaded separately, so the order of CSS definitions is not guaranteed. -@mixin mdc-chip-leading-icon-size($size) { +@mixin mdc-chip-leading-icon-size($size, $query: mdc-feature-all()) { .mdc-chip__icon.mdc-chip__icon--leading:not(.mdc-chip__icon--leading-hidden) { - @include mdc-chip-icon-size_($size); + @include mdc-chip-icon-size_($size, $query: $query); } } -@mixin mdc-chip-trailing-icon-size($size) { +@mixin mdc-chip-trailing-icon-size($size, $query: mdc-feature-all()) { .mdc-chip__icon.mdc-chip__icon--trailing { - @include mdc-chip-icon-size_($size); + @include mdc-chip-icon-size_($size, $query: $query); } } -@mixin mdc-chip-icon-size_($size) { - width: $size; - height: $size; - font-size: $size; +@mixin mdc-chip-icon-size_($size, $query) { + $feat-structure: mdc-feature-create-target($query, structure); + + @include mdc-feature-targets($feat-structure) { + width: $size; + height: $size; + font-size: $size; + } } @mixin mdc-chip-leading-icon-margin( $top: $mdc-chip-leading-icon-margin-top, $right: $mdc-chip-leading-icon-margin-right, $bottom: $mdc-chip-leading-icon-margin-bottom, - $left: $mdc-chip-leading-icon-margin-left) { + $left: $mdc-chip-leading-icon-margin-left, + $query: mdc-feature-all()) { + $feat-structure: mdc-feature-create-target($query, structure); + &.mdc-chip--selected .mdc-chip__checkmark, .mdc-chip__icon--leading:not(.mdc-chip__icon--leading-hidden) { - @include mdc-rtl-reflexive-property(margin, $left, $right); + @include mdc-feature-targets($feat-structure) { + @include mdc-rtl-reflexive-property(margin, $left, $right); - margin-top: $top; - margin-bottom: $bottom; + margin-top: $top; + margin-bottom: $bottom; + } } } @@ -186,18 +531,29 @@ $top: $mdc-chip-trailing-icon-margin-top, $right: $mdc-chip-trailing-icon-margin-right, $bottom: $mdc-chip-trailing-icon-margin-bottom, - $left: $mdc-chip-trailing-icon-margin-left) { + $left: $mdc-chip-trailing-icon-margin-left, + $query: mdc-feature-all()) { + $feat-structure: mdc-feature-create-target($query, structure); + .mdc-chip__icon--trailing { - margin: $top $right $bottom $left; + @include mdc-feature-targets($feat-structure) { + margin: $top $right $bottom $left; + } } } -@mixin mdc-chip-elevation-transition() { - transition: mdc-elevation-transition-value(); +@mixin mdc-chip-elevation-transition($query: mdc-feature-all()) { + $feat-animation: mdc-feature-create-target($query, animation); + + @include mdc-feature-targets($feat-animation) { + transition: mdc-elevation-transition-value(); + } &.mdc-chip--exit { - transition: - mdc-elevation-transition-value(), - $mdc-chip-exit-transition; + @include mdc-feature-targets($feat-animation) { + transition: + mdc-elevation-transition-value(), + $mdc-chip-exit-transition; + } } } diff --git a/packages/mdc-chips/chip-set/mdc-chip-set.scss b/packages/mdc-chips/chip-set/mdc-chip-set.scss index 1ebd04b914c..1773b4ce048 100644 --- a/packages/mdc-chips/chip-set/mdc-chip-set.scss +++ b/packages/mdc-chips/chip-set/mdc-chip-set.scss @@ -20,29 +20,5 @@ // THE SOFTWARE. // -@import "@material/animation/variables"; @import "../mixins"; - -@keyframes mdc-chip-entry { - from { - transform: scale(.8); - opacity: .4; - } - - to { - transform: scale(1); - opacity: 1; - } -} - -.mdc-chip-set { - @include mdc-chip-set-spacing(8px); - - display: flex; - flex-wrap: wrap; - box-sizing: border-box; -} - -.mdc-chip-set--input .mdc-chip { - animation: mdc-chip-entry 100ms $mdc-animation-deceleration-curve-timing-function; -} +@include mdc-chip-set-core-styles; diff --git a/packages/mdc-chips/chip/mdc-chip.scss b/packages/mdc-chips/chip/mdc-chip.scss index 2e553ba3310..e9a82709ad2 100644 --- a/packages/mdc-chips/chip/mdc-chip.scss +++ b/packages/mdc-chips/chip/mdc-chip.scss @@ -20,146 +20,5 @@ // THE SOFTWARE. // -@import "@material/animation/functions"; -@import "@material/checkbox/functions"; -@import "@material/checkbox/variables"; -@import "@material/ripple/common"; -@import "@material/ripple/mixins"; -@import "@material/theme/mixins"; -@import "@material/typography/mixins"; @import "../mixins"; -@import "../variables"; - -.mdc-chip { - @include mdc-ripple-surface; - @include mdc-ripple-radius-bounded; - @include mdc-chip-shape-radius(50%); - @include mdc-chip-fill-color($mdc-chip-fill-color-default); - @include mdc-chip-ink-color($mdc-chip-ink-color-default); - @include mdc-typography(body2); - @include mdc-chip-height($mdc-chip-height-default); - @include mdc-chip-leading-icon-margin(); - - display: inline-flex; - position: relative; - align-items: center; - box-sizing: border-box; - padding: $mdc-chip-vertical-padding $mdc-chip-horizontal-padding; - outline: none; - cursor: pointer; - overflow: hidden; - - &:hover { - @include mdc-theme-prop(color, on-surface); - } -} - -@at-root { - @include mdc-chip-leading-icon-color($mdc-chip-icon-color); - @include mdc-chip-trailing-icon-color($mdc-chip-icon-color); - @include mdc-chip-leading-icon-size($mdc-chip-leading-icon-size); - @include mdc-chip-trailing-icon-size($mdc-chip-trailing-icon-size); - @include mdc-chip-trailing-icon-margin(); -} - -.mdc-chip--exit { - transition: $mdc-chip-exit-transition; - opacity: 0; -} - -.mdc-chip__text { - white-space: nowrap; -} - -.mdc-chip__icon { - border-radius: 50%; - outline: none; - vertical-align: middle; -} - -.mdc-chip__checkmark { - height: $mdc-chip-leading-icon-size; -} - -.mdc-chip__checkmark-path { - transition: - mdc-checkbox-transition-exit( - stroke-dashoffset, - $mdc-chip-checkmark-animation-delay, - $mdc-chip-checkmark-animation-duration - ); - stroke-width: 2px; - stroke-dashoffset: $mdc-checkbox-mark-path-length_; - stroke-dasharray: $mdc-checkbox-mark-path-length_; -} - -.mdc-chip--selected .mdc-chip__checkmark-path { - stroke-dashoffset: 0; -} - -// Change color of selected choice chips - -.mdc-chip-set--choice { - .mdc-chip { - @include mdc-chip-selected-ink-color(primary); - } - - .mdc-chip--selected { - @include mdc-theme-prop(background-color, surface); - } -} - -// Add leading checkmark to filter chips with no leading icon - -.mdc-chip__checkmark-svg { - width: 0; - height: $mdc-chip-leading-icon-size; - transition: width $mdc-chip-width-animation-duration $mdc-animation-standard-curve-timing-function; -} - -.mdc-chip--selected .mdc-chip__checkmark-svg { - width: $mdc-chip-leading-icon-size; -} - -// Add leading checkmark to filter chips with a leading icon - -.mdc-chip-set--filter { - .mdc-chip__icon--leading { - transition: opacity $mdc-chip-opacity-animation-duration linear; - transition-delay: $mdc-chip-leading-icon-delay; - opacity: 1; - - + .mdc-chip__checkmark { - transition: opacity $mdc-chip-opacity-animation-duration linear; - - // Delay the checkmark transition. - transition-delay: $mdc-chip-checkmark-with-leading-icon-delay; - opacity: 0; - - .mdc-chip__checkmark-svg { - transition: width 0ms; - } - } - } - - .mdc-chip--selected .mdc-chip__icon--leading { - opacity: 0; - - + .mdc-chip__checkmark { - // This ensures that the checkmark has zero width while the leading icon is still animating. - width: 0; - opacity: 1; - } - } - - .mdc-chip__icon--leading-hidden.mdc-chip__icon--leading { - width: 0; - - // This ensures that the leading icon doesn't fade in while the checkmark is fading out. - opacity: 0; - - + .mdc-chip__checkmark { - width: $mdc-chip-leading-icon-size; - } - } -} +@include mdc-chip-core-styles; diff --git a/packages/mdc-chips/package.json b/packages/mdc-chips/package.json index 0f728ecd6b5..480ae83945b 100644 --- a/packages/mdc-chips/package.json +++ b/packages/mdc-chips/package.json @@ -24,6 +24,7 @@ "@material/base": "^1.0.0", "@material/checkbox": "^2.1.1", "@material/elevation": "^1.1.0", + "@material/feature-targeting": "^0.44.1", "@material/ripple": "^2.1.1", "@material/shape": "^1.1.1", "@material/theme": "^1.1.0", diff --git a/test/scss/_feature-targeting-test.scss b/test/scss/_feature-targeting-test.scss index afeffaab067..ec8e6609f63 100644 --- a/test/scss/_feature-targeting-test.scss +++ b/test/scss/_feature-targeting-test.scss @@ -1,6 +1,7 @@ @import "@material/button/mixins"; @import "@material/card/mixins"; @import "@material/checkbox/mixins"; +@import "@material/chips/mixins"; @import "@material/dialog/mixins"; @import "@material/elevation/mixins"; @import "@material/fab/mixins"; @@ -50,6 +51,31 @@ @include mdc-checkbox-ripple($query: $query); @include mdc-checkbox-without-ripple($query: $query); + // Chips + @include mdc-chip-core-styles($query: $query); + @include mdc-chip-elevation-transition($query: $query); + @include mdc-chip-fill-color(red, $query: $query); + @include mdc-chip-fill-color-accessible(red, $query: $query); + @include mdc-chip-height(0, $query: $query); + @include mdc-chip-horizontal-padding(0, $query: $query); + @include mdc-chip-ink-color(red, $query: $query); + @include mdc-chip-leading-icon-color(red, $query: $query); + @include mdc-chip-leading-icon-margin($query: $query); + @include mdc-chip-leading-icon-size(0, $query: $query); + @include mdc-chip-outline($query: $query); + @include mdc-chip-outline-color(red, $query: $query); + @include mdc-chip-outline-style(soild, $query: $query); + @include mdc-chip-outline-width(0, $query: $query); + @include mdc-chip-ripple($query: $query); + @include mdc-chip-selected-ink-color(red, $query: $query); + @include mdc-chip-set-core-styles($query: $query); + @include mdc-chip-set-spacing(0, $query: $query); + @include mdc-chip-shape-radius(0, $query: $query); + @include mdc-chip-trailing-icon-color(red, $query: $query); + @include mdc-chip-trailing-icon-margin($query: $query); + @include mdc-chip-trailing-icon-size(0, $query: $query); + @include mdc-chip-without-ripple($query: $query); + // Dialog @include mdc-dialog-core-styles($query: $query); @include mdc-dialog-container-fill-color(red, $query: $query);