From 5655f8092c72a822d0cd94ead24af6d1e69e4efe Mon Sep 17 00:00:00 2001 From: Amit Moryossef Date: Fri, 7 Apr 2017 17:54:54 +0300 Subject: [PATCH 01/11] feat(rtl): add text-alignment flip for rtl --- src/components/app/app.scss | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/components/app/app.scss b/src/components/app/app.scss index 350c049091c..d758fd4c649 100644 --- a/src/components/app/app.scss +++ b/src/components/app/app.scss @@ -293,7 +293,7 @@ ion-footer { // Text Alignment // -------------------------------------------------- -[text-left] { +[text-left], [dir="ltr"] [text-left] { text-align: left; } @@ -301,7 +301,7 @@ ion-footer { text-align: center; } -[text-right] { +[text-right], [dir="ltr"] [text-right] { text-align: right; } @@ -317,6 +317,14 @@ ion-footer { white-space: normal; } +[dir="rtl"] [text-left] { + text-align: right; +} + +[dir="rtl"] [text-right] { + text-align: left; +} + // Text Transformation // -------------------------------------------------- From 7541ec07b85dd55d408a8c33271035f0a0ab87cc Mon Sep 17 00:00:00 2001 From: Amit Moryossef Date: Fri, 7 Apr 2017 17:57:24 +0300 Subject: [PATCH 02/11] feat(pull): add bootstrap style pull attribute support --- src/components/app/app.scss | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/components/app/app.scss b/src/components/app/app.scss index d758fd4c649..1c12671af59 100644 --- a/src/components/app/app.scss +++ b/src/components/app/app.scss @@ -340,3 +340,14 @@ ion-footer { [text-capitalize] { text-transform: capitalize; } + +// Float +// -------------------------------------------------- + +[pull-left] { + float: left; +} + +[pull-right] { + float: right; +} \ No newline at end of file From 956e7c3560b53f9f7be0d854defe0facb4db889d Mon Sep 17 00:00:00 2001 From: Amit Moryossef Date: Fri, 7 Apr 2017 17:57:47 +0300 Subject: [PATCH 03/11] feat(rtl): add rtl support for pull --- src/components/app/app.scss | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/components/app/app.scss b/src/components/app/app.scss index 1c12671af59..7260a3e5482 100644 --- a/src/components/app/app.scss +++ b/src/components/app/app.scss @@ -344,10 +344,18 @@ ion-footer { // Float // -------------------------------------------------- -[pull-left] { +[pull-left], [dir="ltr"] [pull-left] { float: left; } -[pull-right] { +[pull-right], [dir="ltr"] [pull-right] { float: right; +} + +[dir="rtl"] [pull-left] { + float: right; +} + +[dir="rtl"] [pull-right] { + float: left; } \ No newline at end of file From 6aa66931fe99e70041cb9805aeb75e2c83bb7a2e Mon Sep 17 00:00:00 2001 From: Amit Moryossef Date: Fri, 7 Apr 2017 17:59:38 +0300 Subject: [PATCH 04/11] style(css): format css to follow code-style --- src/components/app/app.scss | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/components/app/app.scss b/src/components/app/app.scss index 7260a3e5482..956ef26d5dc 100644 --- a/src/components/app/app.scss +++ b/src/components/app/app.scss @@ -293,7 +293,8 @@ ion-footer { // Text Alignment // -------------------------------------------------- -[text-left], [dir="ltr"] [text-left] { +[text-left], +[dir="ltr"] [text-left] { text-align: left; } @@ -301,7 +302,8 @@ ion-footer { text-align: center; } -[text-right], [dir="ltr"] [text-right] { +[text-right], +[dir="ltr"] [text-right] { text-align: right; } @@ -344,11 +346,13 @@ ion-footer { // Float // -------------------------------------------------- -[pull-left], [dir="ltr"] [pull-left] { +[pull-left], +[dir="ltr"] [pull-left] { float: left; } -[pull-right], [dir="ltr"] [pull-right] { +[pull-right], +[dir="ltr"] [pull-right] { float: right; } @@ -358,4 +362,4 @@ ion-footer { [dir="rtl"] [pull-right] { float: left; -} \ No newline at end of file +} From e4cacb4a29f04c558a854ee4737877fb843aadd1 Mon Sep 17 00:00:00 2001 From: Amit Moryossef Date: Fri, 7 Apr 2017 18:45:53 +0300 Subject: [PATCH 05/11] feat(rtl): flip every icon except for logos and specific icons that are the same in rtl --- src/fonts/ionicons.scss | 65 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) diff --git a/src/fonts/ionicons.scss b/src/fonts/ionicons.scss index dc8e92c3867..7adedb2d450 100644 --- a/src/fonts/ionicons.scss +++ b/src/fonts/ionicons.scss @@ -33,3 +33,68 @@ ion-icon { text-transform: none; speak: none; } + +// RTL Support +// -------------------------- + +@function str-replace($string, $search, $replace: '') { + $index: str-index($string, $search); + + @if $index { + @return str-slice($string, 1, $index - 1) + $replace + str-replace(str-slice($string, $index + str-length($search)), $search, $replace); + } + + @return $string; +} + +@mixin notIn($attribute, $operator, $ignoreList...) { + // If only a single value given + @if (length($ignoreList) == 1) { + // It is probably a list variable so set ignore list to the variable + $ignoreList: nth($ignoreList, 1); + } + + // Set up an empty $notOutput variable + $notOutput: ''; + // For each item in the list + @each $not in $ignoreList { + // Generate a :not([attribute='ignored_item']) segment for each item in the ignore list and put them back to back + $notOutput: $notOutput + ":not([#{$attribute}#{$operator}='#{str-replace($not, '-', ' ')}'])"; + } + //output the full :not() rule including all ignored items + &#{$notOutput} { + @content; + } +} + +[flip] { + -moz-transform: scaleX(-1); + -o-transform: scaleX(-1); + -webkit-transform: scaleX(-1); + transform: scaleX(-1); +} + +$ltr-begin: "logo"; + +$ltr-icons: "at", "attach", +"bluetooth", +"checkbox", "checkbox-outline", "checkmark", "checkmark-circle", "checkmark-circle-outline", "chrome", +"closed-captioning", + // Adding cloud because of "cloud-done" & "thunderstorm" +"cloud", "cloud-circle", "cloud-done", "cloud-download", "cloud-outline", "cloud-upload", "thunderstorm", +"done-all", +"help", "help-circle", +"information", "information-circle", "ionic", +"musical-note", "musical-notes", +"no-smoking", +"play", +"timer", "trending-down", "trending-up", +"volume-down", "volume-mute", "volume-off", "volume-up"; + +[dir="rtl"] ion-icon { + @include notIn("aria-label", "^", $ltr-begin) { // Does not start with + @include notIn("aria-label", "", $ltr-icons) { // Does not equal + @extend [flip]; + } + } +} \ No newline at end of file From cd010255cfac88278483930b0c7885c28bdedd54 Mon Sep 17 00:00:00 2001 From: Amit Moryossef Date: Sat, 8 Apr 2017 00:10:55 +0300 Subject: [PATCH 06/11] fix(rtl): flip tabs behavior for rtl on iOS --- src/components/segment/segment.ios.scss | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/components/segment/segment.ios.scss b/src/components/segment/segment.ios.scss index 834e9625fe1..4a4da44389b 100644 --- a/src/components/segment/segment.ios.scss +++ b/src/components/segment/segment.ios.scss @@ -73,7 +73,8 @@ $segment-button-ios-toolbar-icon-size: 2.2rem !default; $segment-button-ios-toolbar-icon-line-height: 2.4rem !default; -.segment-ios .segment-button { +.segment-ios .segment-button, +[dir="ltr"] .segment-ios .segment-button { flex: 1; width: 0; @@ -130,6 +131,21 @@ $segment-button-ios-toolbar-icon-line-height: 2.4rem !default; } } +[dir="rtl"] .segment-ios .segment-button { + &:first-of-type { + margin-left: 0; + + border-radius: 0 $segment-button-ios-border-radius $segment-button-ios-border-radius 0; + } + + &:last-of-type { + margin-right: 0; + + border-left-width: $segment-button-ios-border-width; + border-radius: $segment-button-ios-border-radius 0 0 $segment-button-ios-border-radius; + } +} + .segment-ios.segment-disabled { opacity: .4; From 04bb57f4d3d568f39db16d3c1a5f06fa39952439 Mon Sep 17 00:00:00 2001 From: Amit Moryossef Date: Sat, 8 Apr 2017 00:31:56 +0300 Subject: [PATCH 07/11] fix(rtl): flip icon-left/right behavior --- src/components/button/button-icon.scss | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/components/button/button-icon.scss b/src/components/button/button-icon.scss index 1412e939df9..db61dbcb560 100644 --- a/src/components/button/button-icon.scss +++ b/src/components/button/button-icon.scss @@ -11,18 +11,34 @@ pointer-events: none; } -[icon-left] ion-icon { +[icon-left] ion-icon, +[dir="ltr"] [icon-left] ion-icon { @include button-icon; padding-right: .3em; } -[icon-right] ion-icon { +[icon-right] ion-icon, +[dir="ltr"] [icon-right] ion-icon { @include button-icon; padding-left: .4em; } +[dir="rtl"] [icon-left] ion-icon { + @include button-icon; + + padding-left: .4em; + padding-right: initial; +} + +[dir="rtl"] [icon-right] ion-icon { + @include button-icon; + + padding-right: .3em; + padding-left: initial; +} + .button[icon-only] { padding: 0; From 44d2577f7ee1469f1c3a8ee1ec9d019df215378a Mon Sep 17 00:00:00 2001 From: Amit Moryossef Date: Sun, 9 Apr 2017 17:07:34 +0300 Subject: [PATCH 08/11] feat(rtl): add text-start + text-end --- src/components/app/app.scss | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/src/components/app/app.scss b/src/components/app/app.scss index 956ef26d5dc..2e65fbbc130 100644 --- a/src/components/app/app.scss +++ b/src/components/app/app.scss @@ -293,8 +293,7 @@ ion-footer { // Text Alignment // -------------------------------------------------- -[text-left], -[dir="ltr"] [text-left] { +[text-left] { text-align: left; } @@ -302,11 +301,18 @@ ion-footer { text-align: center; } -[text-right], -[dir="ltr"] [text-right] { +[text-right] { text-align: right; } +[text-start] { + text-align: start; +} + +[text-end] { + text-align: end; +} + [text-justify] { text-align: justify; } @@ -319,15 +325,6 @@ ion-footer { white-space: normal; } -[dir="rtl"] [text-left] { - text-align: right; -} - -[dir="rtl"] [text-right] { - text-align: left; -} - - // Text Transformation // -------------------------------------------------- From 0fbd8a82e3cb2d021922b45c6629c77faa511e61 Mon Sep 17 00:00:00 2001 From: Amit Moryossef Date: Wed, 12 Apr 2017 12:42:11 +0300 Subject: [PATCH 09/11] chore(dev-dependencies): add scss functions for str-replace --- package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index e61e4cb1f9c..6200444e037 100644 --- a/package.json +++ b/package.json @@ -95,6 +95,7 @@ "gulp-uglify": "2.0.0", "gulp-util": "3.0.7", "gulp-watch": "4.3.9", + "hail2u-scss-functions": "^1.2.2", "html-entities": "1.2.0", "inquirer": "3.0.1", "ionic-cz-conventional-changelog": "1.0.0", @@ -144,4 +145,4 @@ "pre-push#master": [ "test" ] -} \ No newline at end of file +} From 89dc966a66124ac7791ec4b3fd5e1479733c770d Mon Sep 17 00:00:00 2001 From: Amit Moryossef Date: Wed, 12 Apr 2017 12:43:51 +0300 Subject: [PATCH 10/11] fix(icons): replace old str-replace with a better one new one is better for border case old one faced --- src/fonts/ionicons.scss | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/src/fonts/ionicons.scss b/src/fonts/ionicons.scss index 7adedb2d450..4344022b121 100644 --- a/src/fonts/ionicons.scss +++ b/src/fonts/ionicons.scss @@ -8,6 +8,7 @@ $ionicons-font-path: $font-path !default; @import "ionicons-icons"; @import "ionicons-variables"; +@import "~hail2u-scss-functions/string/_str-replace"; @font-face { @@ -37,16 +38,6 @@ ion-icon { // RTL Support // -------------------------- -@function str-replace($string, $search, $replace: '') { - $index: str-index($string, $search); - - @if $index { - @return str-slice($string, 1, $index - 1) + $replace + str-replace(str-slice($string, $index + str-length($search)), $search, $replace); - } - - @return $string; -} - @mixin notIn($attribute, $operator, $ignoreList...) { // If only a single value given @if (length($ignoreList) == 1) { From b8e690af8a108f7e81085b3e8fcaad8c3fc90920 Mon Sep 17 00:00:00 2001 From: Amit Moryossef Date: Wed, 12 Apr 2017 13:01:46 +0300 Subject: [PATCH 11/11] fix(icons): remove space on rtl icons --- src/fonts/ionicons.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fonts/ionicons.scss b/src/fonts/ionicons.scss index 4344022b121..d112e1d2012 100644 --- a/src/fonts/ionicons.scss +++ b/src/fonts/ionicons.scss @@ -50,7 +50,7 @@ ion-icon { // For each item in the list @each $not in $ignoreList { // Generate a :not([attribute='ignored_item']) segment for each item in the ignore list and put them back to back - $notOutput: $notOutput + ":not([#{$attribute}#{$operator}='#{str-replace($not, '-', ' ')}'])"; + $notOutput: #{"#{$notOutput}:not([#{$attribute}#{$operator}='#{str-replace($not, '-', ' ')}'])"}; } //output the full :not() rule including all ignored items &#{$notOutput} {