Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(shape): Fix errors related to multi-value shape categories #4547

Merged
merged 13 commits into from
Apr 2, 2019
7 changes: 7 additions & 0 deletions packages/mdc-notched-outline/_mixins.scss
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,13 @@
@mixin mdc-notched-outline-shape-radius($radius, $rtl-reflexive: false) {
$radius: mdc-shape-prop-value($radius);

@if (length($radius) > 1) {
// stylelint-disable-next-line max-line-length
@warn "mdc-notched-outline-shape-radius currently only supports a single radius value. Follow https://github.com/material-components/material-components-web/issues/4140 for updates.";
}

$radius: nth($radius, 1);

.mdc-notched-outline__leading {
@include mdc-shape-radius(mdc-shape-mask-radius($radius, 1 0 0 1), $rtl-reflexive: true);

Expand Down
15 changes: 9 additions & 6 deletions packages/mdc-select/_mixins.scss
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,12 @@
}

@mixin mdc-select-outline-shape-radius($radius, $rtl-reflexive: false) {
$resolved-radius: mdc-shape-resolve-percentage-radius($mdc-select-height, $radius);
$resolved-radius: nth(mdc-shape-resolve-percentage-radius($mdc-select-height, mdc-shape-prop-value($radius)), 1);

@if (length(mdc-shape-prop-value($radius)) > 1) {
// stylelint-disable-next-line max-line-length
@warn "mdc-select-outline-shape-radius currently only supports a single radius value. Follow https://github.com/material-components/material-components-web/issues/4140 for updates.";
kfranqueiro marked this conversation as resolved.
Show resolved Hide resolved
}

.mdc-notched-outline {
@include mdc-notched-outline-shape-radius($resolved-radius, $rtl-reflexive);
Expand All @@ -118,21 +123,19 @@
@include mdc-shape-radius($resolved-radius, $rtl-reflexive);
}

$radius-pixels: mdc-shape-prop-value($resolved-radius);

@if ($radius-pixels > $mdc-notched-outline-leading-width) {
@if ($resolved-radius > $mdc-notched-outline-leading-width) {
.mdc-select__native-control {
@include mdc-rtl-reflexive-property(
padding,
$radius-pixels + $mdc-notched-outline-padding,
$resolved-radius + $mdc-notched-outline-padding,
$mdc-select-arrow-padding
);
}

+ .mdc-select-helper-text {
@include mdc-rtl-reflexive-property(
margin,
$radius-pixels + $mdc-notched-outline-padding,
$resolved-radius + $mdc-notched-outline-padding,
$mdc-select-outline-label-offset
);
}
Expand Down
15 changes: 9 additions & 6 deletions packages/mdc-textfield/_mixins.scss
Original file line number Diff line number Diff line change
Expand Up @@ -217,21 +217,24 @@
}

@mixin mdc-text-field-outline-shape-radius($radius, $rtl-reflexive: false) {
$resolved-radius: mdc-shape-resolve-percentage-radius($mdc-text-field-height, $radius);
$resolved-radius: nth(mdc-shape-resolve-percentage-radius($mdc-text-field-height, mdc-shape-prop-value($radius)), 1);

@if (length(mdc-shape-prop-value($radius)) > 1) {
// stylelint-disable-next-line max-line-length
@warn "mdc-text-field-outline-shape-radius currently only supports a single radius value. Follow https://github.com/material-components/material-components-web/issues/4140 for updates.";
kfranqueiro marked this conversation as resolved.
Show resolved Hide resolved
}

.mdc-notched-outline {
@include mdc-notched-outline-shape-radius($resolved-radius, $rtl-reflexive);
}

$radius-pixels: mdc-shape-prop-value($resolved-radius);

@if ($radius-pixels > $mdc-notched-outline-leading-width) {
@if ($resolved-radius > $mdc-notched-outline-leading-width) {
.mdc-text-field__input {
@include mdc-rtl-reflexive-property(padding, $radius-pixels + $mdc-notched-outline-padding, 0);
@include mdc-rtl-reflexive-property(padding, $resolved-radius + $mdc-notched-outline-padding, 0);
}

+ .mdc-text-field-helper-line {
@include mdc-rtl-reflexive-property(padding, $radius-pixels + $mdc-notched-outline-padding, $radius-pixels);
@include mdc-rtl-reflexive-property(padding, $resolved-radius + $mdc-notched-outline-padding, $radius-pixels);
}
}
}
Expand Down