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 +} diff --git a/src/components/app/app.scss b/src/components/app/app.scss index 350c049091c..2e65fbbc130 100644 --- a/src/components/app/app.scss +++ b/src/components/app/app.scss @@ -305,6 +305,14 @@ ion-footer { text-align: right; } +[text-start] { + text-align: start; +} + +[text-end] { + text-align: end; +} + [text-justify] { text-align: justify; } @@ -317,7 +325,6 @@ ion-footer { white-space: normal; } - // Text Transformation // -------------------------------------------------- @@ -332,3 +339,24 @@ ion-footer { [text-capitalize] { text-transform: capitalize; } + +// Float +// -------------------------------------------------- + +[pull-left], +[dir="ltr"] [pull-left] { + float: left; +} + +[pull-right], +[dir="ltr"] [pull-right] { + float: right; +} + +[dir="rtl"] [pull-left] { + float: right; +} + +[dir="rtl"] [pull-right] { + float: left; +} 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; 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; diff --git a/src/fonts/ionicons.scss b/src/fonts/ionicons.scss index dc8e92c3867..d112e1d2012 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 { @@ -33,3 +34,58 @@ ion-icon { text-transform: none; speak: none; } + +// RTL Support +// -------------------------- + +@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