From cc21f216b5d8b28e8bda762dfc4dbca67ee2a8d7 Mon Sep 17 00:00:00 2001 From: Andrey Prigogin Date: Mon, 5 Mar 2018 12:56:05 -0800 Subject: [PATCH 1/4] fix(rtl): Adding noflip annotations to fix downstream rtl issues --- packages/mdc-button/_mixins.scss | 11 ++++++----- packages/mdc-ripple/_mixins.scss | 10 ++++++++++ packages/mdc-rtl/_mixins.scss | 6 ++++++ 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/packages/mdc-button/_mixins.scss b/packages/mdc-button/_mixins.scss index 7df15b06ba9..9b34995d93c 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"; @@ -63,8 +64,8 @@ // Note: Adjust padding to maintain consistent width with non-stroked buttons $padding-value: max($mdc-button-horizontal-padding - $stroke-width, 0); - padding-right: $padding-value; - padding-left: $padding-value; + @include mdc-rtl-reflexive-property(padding, $padding-value, $padding-value); + border-width: $stroke-width; // Note: line height is adjusted for stroke button because borders are not // considered as space available to text on the Web @@ -79,8 +80,7 @@ &.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; + @include mdc-rtl-reflexive-property(padding, $padding-compact-value, $padding-compact-value); } } @@ -131,10 +131,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; diff --git a/packages/mdc-ripple/_mixins.scss b/packages/mdc-ripple/_mixins.scss index 9d4af2f33b5..c30de6a8368 100644 --- a/packages/mdc-ripple/_mixins.scss +++ b/packages/mdc-ripple/_mixins.scss @@ -47,6 +47,8 @@ &.mdc-ripple-upgraded::after { top: 0; + + /* @noflip */ left: 0; transform: scale(0); transform-origin: center center; @@ -54,6 +56,8 @@ &.mdc-ripple-upgraded--unbounded::after { top: var(--mdc-ripple-top, 0); + + /* @noflip */ left: var(--mdc-ripple-left, 0); } @@ -170,6 +174,8 @@ &::before, &::after { top: calc(50% - #{$radius}); + + /* @noflip */ left: calc(50% - #{$radius}); width: $radius * 2; height: $radius * 2; @@ -179,6 +185,8 @@ &.mdc-ripple-upgraded::before { top: calc(50% - #{$radius}); + + /* @noflip */ left: calc(50% - #{$radius}); width: $radius * 2; height: $radius * 2; @@ -187,6 +195,8 @@ &.mdc-ripple-upgraded--unbounded::before { top: var(--mdc-ripple-top, calc(50% - #{$radius / 2})); + + /* @noflip */ left: var(--mdc-ripple-left, calc(50% - #{$radius / 2})); width: var(--mdc-ripple-fg-size, $radius); height: var(--mdc-ripple-fg-size, $radius); diff --git a/packages/mdc-rtl/_mixins.scss b/packages/mdc-rtl/_mixins.scss index 798e55729f3..006c770b2a9 100644 --- a/packages/mdc-rtl/_mixins.scss +++ b/packages/mdc-rtl/_mixins.scss @@ -227,11 +227,17 @@ $right-value, $root-selector: null ) { + /* @noflip */ #{$left-property}: $left-value; + + /* @noflip */ #{$right-property}: $right-value; @include mdc-rtl($root-selector) { + /* @noflip */ #{$left-property}: $right-value; + + /* @noflip */ #{$right-property}: $left-value; } } From 86f75b75ef5bbc22163b1cfa9961f6e18f2914db Mon Sep 17 00:00:00 2001 From: Andrey Prigogin Date: Mon, 5 Mar 2018 14:11:37 -0800 Subject: [PATCH 2/4] fix(rtl): remove changes to button, will be in separate PR --- packages/mdc-button/_mixins.scss | 36 +++++++++++++++++++++----------- 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/packages/mdc-button/_mixins.scss b/packages/mdc-button/_mixins.scss index d2159c6bcb3..7df15b06ba9 100644 --- a/packages/mdc-button/_mixins.scss +++ b/packages/mdc-button/_mixins.scss @@ -16,7 +16,6 @@ @import "@material/elevation/mixins"; @import "@material/ripple/mixins"; -@import "@material/rtl/mixins"; @import "@material/theme/functions"; @import "@material/theme/mixins"; @import "@material/typography/mixins"; @@ -64,8 +63,8 @@ // Note: Adjust padding to maintain consistent width with non-stroked buttons $padding-value: max($mdc-button-horizontal-padding - $stroke-width, 0); - @include mdc-rtl-reflexive-property(padding, $padding-value, $padding-value); - + padding-right: $padding-value; + padding-left: $padding-value; border-width: $stroke-width; // Note: line height is adjusted for stroke button because borders are not // considered as space available to text on the Web @@ -80,14 +79,15 @@ &.mdc-button--compact { $padding-compact-value: max($mdc-compact-button-horizontal-padding - $stroke-width, 0); - @include mdc-rtl-reflexive-property(padding, $padding-compact-value, $padding-compact-value); + padding-right: $padding-compact-value; + padding-left: $padding-compact-value; } } @mixin mdc-button-base_() { @include mdc-typography(button); @include mdc-ripple-surface; - @include mdc-ripple-radius-bounded; + @include mdc-ripple-radius; display: inline-block; position: relative; @@ -103,11 +103,6 @@ overflow: hidden; vertical-align: middle; - &::-moz-focus-inner { - padding: 0; - border: 0; - } - // postcss-bem-linter: ignore &:active { outline: none; @@ -117,21 +112,29 @@ cursor: pointer; } + &::-moz-focus-inner { + padding: 0; + border: 0; + } + &:disabled { @include mdc-theme-prop(background-color, transparent); @include mdc-theme-prop(color, text-disabled-on-light); cursor: default; pointer-events: none; + + @include mdc-theme-dark(".mdc-button") { + @include mdc-theme-prop(color, text-disabled-on-dark); + } } } @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; @@ -142,6 +145,10 @@ &:disabled { @include mdc-theme-prop(border-color, text-disabled-on-light); + + @include mdc-theme-dark(".mdc-button") { + @include mdc-theme-prop(border-color, text-disabled-on-dark); + } } } @@ -149,6 +156,11 @@ &:disabled { @include mdc-theme-prop(background-color, rgba(black, .12)); @include mdc-theme-prop(color, text-disabled-on-light); + + @include mdc-theme-dark(".mdc-button") { + @include mdc-theme-prop(background-color, rgba(white, .12)); + @include mdc-theme-prop(color, text-disabled-on-light); + } } } From ff97fdd0ff766edbd818cbc1ae723002d864d5df Mon Sep 17 00:00:00 2001 From: Andrey Prigogin Date: Mon, 5 Mar 2018 14:18:55 -0800 Subject: [PATCH 3/4] fix(rtl): remove changes to button, will be in separate PR - second attempt. --- packages/mdc-button/_mixins.scss | 25 ++++++------------------- 1 file changed, 6 insertions(+), 19 deletions(-) diff --git a/packages/mdc-button/_mixins.scss b/packages/mdc-button/_mixins.scss index 7df15b06ba9..f8de32db86c 100644 --- a/packages/mdc-button/_mixins.scss +++ b/packages/mdc-button/_mixins.scss @@ -87,7 +87,7 @@ @mixin mdc-button-base_() { @include mdc-typography(button); @include mdc-ripple-surface; - @include mdc-ripple-radius; + @include mdc-ripple-radius-bounded; display: inline-block; position: relative; @@ -103,6 +103,11 @@ overflow: hidden; vertical-align: middle; + &::-moz-focus-inner { + padding: 0; + border: 0; + } + // postcss-bem-linter: ignore &:active { outline: none; @@ -112,21 +117,12 @@ cursor: pointer; } - &::-moz-focus-inner { - padding: 0; - border: 0; - } - &:disabled { @include mdc-theme-prop(background-color, transparent); @include mdc-theme-prop(color, text-disabled-on-light); cursor: default; pointer-events: none; - - @include mdc-theme-dark(".mdc-button") { - @include mdc-theme-prop(color, text-disabled-on-dark); - } } } @@ -145,10 +141,6 @@ &:disabled { @include mdc-theme-prop(border-color, text-disabled-on-light); - - @include mdc-theme-dark(".mdc-button") { - @include mdc-theme-prop(border-color, text-disabled-on-dark); - } } } @@ -156,11 +148,6 @@ &:disabled { @include mdc-theme-prop(background-color, rgba(black, .12)); @include mdc-theme-prop(color, text-disabled-on-light); - - @include mdc-theme-dark(".mdc-button") { - @include mdc-theme-prop(background-color, rgba(white, .12)); - @include mdc-theme-prop(color, text-disabled-on-light); - } } } From eccc7621f7072f271fd52712ba7d7685be2b0be0 Mon Sep 17 00:00:00 2001 From: Andrey Prigogin Date: Mon, 5 Mar 2018 14:52:45 -0800 Subject: [PATCH 4/4] fix(rtl): removed extra whitespace --- packages/mdc-ripple/_mixins.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/mdc-ripple/_mixins.scss b/packages/mdc-ripple/_mixins.scss index 95bf160f43c..e0cf236bad7 100644 --- a/packages/mdc-ripple/_mixins.scss +++ b/packages/mdc-ripple/_mixins.scss @@ -196,7 +196,7 @@ &::before, &::after { top: calc(50% - #{$radius / 2}); - + /* @noflip */ left: calc(50% - #{$radius / 2}); width: $radius;