diff --git a/CHANGELOG.md b/CHANGELOG.md index 6889a40452..07e4ec2e6a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,7 +24,6 @@ * searchbar: class `focused` has become `searchbar-focused` - ##### `` renamed to `` * `primary` attribute `` now `` @@ -35,6 +34,12 @@ * If a menu is not given an `id`, then it is automatically assigned an id, such as `leftMenu` or `rightMenu`. * If the menu toggle/close directives are not given a value then it tries the menu ids of `leftMenu` then `rightMenu`. +##### `` renamed to `` + +* Consistent naming with Ionic v1 +* Reduce potential confusion with `ng-switch` + + ##### Bug Fixes * **item-sliding**: fixed item-sliding, onDragEnd on mouseout of sliding element [f9199fb](https://github.com/driftyco/ionic2/commit/f9199fb3be6ce6b0a693e2e3b944b47ed8575531), closes [#702](https://github.com/driftyco/ionic2/issues/702) diff --git a/demos/component-docs/inputs/switch/template.html b/demos/component-docs/inputs/switch/template.html index e9dc444909..f84f900273 100644 --- a/demos/component-docs/inputs/switch/template.html +++ b/demos/component-docs/inputs/switch/template.html @@ -10,53 +10,53 @@ - + Frodo Baggins - + - + Sam - + - + Éowyn - + - + Legolas - + - + Gimli - + - + Saruman - + - + Gandalf - + - + Arwen - + - + Treebeard - + - + Boromir - + - + Gollum - + - + Galadriel - + diff --git a/demos/component-docs/lists/icon/template.html b/demos/component-docs/lists/icon/template.html index b70d4e2045..ab2e9207a3 100644 --- a/demos/component-docs/lists/icon/template.html +++ b/demos/component-docs/lists/icon/template.html @@ -18,10 +18,10 @@ - + Muggle Studies - + @@ -54,10 +54,10 @@ Crucio! - + Quidditch Practice - + diff --git a/demos/icons/main.html b/demos/icons/main.html index 03246be55c..496b8eb773 100644 --- a/demos/icons/main.html +++ b/demos/icons/main.html @@ -11,10 +11,10 @@ Favorite Icons - + Wifi - + @@ -32,10 +32,10 @@ - + Magic - + diff --git a/demos/list/basic-list.html b/demos/list/basic-list.html index 857f63fc19..103400da27 100644 --- a/demos/list/basic-list.html +++ b/demos/list/basic-list.html @@ -19,10 +19,10 @@ List Header - + Wifi - + @@ -40,10 +40,10 @@ - + Magic - + diff --git a/demos/list/inset-list.html b/demos/list/inset-list.html index dc56d52d6c..9f54b77548 100644 --- a/demos/list/inset-list.html +++ b/demos/list/inset-list.html @@ -19,10 +19,10 @@ List Header - + Wifi - + @@ -40,10 +40,10 @@ - + Magic - + diff --git a/demos/list/no-lines-list.html b/demos/list/no-lines-list.html index 088124fac6..ba3fb78953 100644 --- a/demos/list/no-lines-list.html +++ b/demos/list/no-lines-list.html @@ -19,10 +19,10 @@ List Header - + Wifi - + @@ -40,10 +40,10 @@ - + Magic - + diff --git a/demos/switch/main.html b/demos/switch/main.html index 2862acac89..0b233fd475 100644 --- a/demos/switch/main.html +++ b/demos/switch/main.html @@ -4,53 +4,53 @@ - + Frodo Baggins - + - + Sam - + - + Éowyn - + - + Legolas - + - + Gimli - + - + Saruman - + - + Gandalf - + - + Arwen - + - + Treebeard - + - + Boromir - + - + Gollum - + - + Galadriel - + diff --git a/ionic/components.ios.scss b/ionic/components.ios.scss index 23d2e93074..d996f55c20 100644 --- a/ionic/components.ios.scss +++ b/ionic/components.ios.scss @@ -20,7 +20,7 @@ "components/radio/radio.ios", "components/searchbar/searchbar.ios", "components/segment/segment.ios", - "components/switch/switch.ios", "components/tabs/tabs.ios", "components/text-input/text-input.ios", + "components/toggle/toggle.ios", "components/toolbar/toolbar.ios"; diff --git a/ionic/components.md.scss b/ionic/components.md.scss index fa01a3ae44..c23171cd42 100644 --- a/ionic/components.md.scss +++ b/ionic/components.md.scss @@ -21,7 +21,7 @@ "components/tap-click/ripple", "components/searchbar/searchbar.md", "components/segment/segment.md", - "components/switch/switch.md", "components/tabs/tabs.md", "components/text-input/text-input.md", + "components/toggle/toggle.md", "components/toolbar/toolbar.md"; diff --git a/ionic/components/card/test/list/main.html b/ionic/components/card/test/list/main.html index 75d7978682..83f89ea809 100644 --- a/ionic/components/card/test/list/main.html +++ b/ionic/components/card/test/list/main.html @@ -11,10 +11,10 @@ Card List - + Wifi - + @@ -44,10 +44,10 @@ Card List Without Lines - + Wifi - + @@ -75,10 +75,10 @@ Card With Items (No List) - + Wifi - + diff --git a/ionic/components/list/test/headers/main.html b/ionic/components/list/test/headers/main.html index ee99360090..f34b0f1a2d 100644 --- a/ionic/components/list/test/headers/main.html +++ b/ionic/components/list/test/headers/main.html @@ -8,10 +8,10 @@ List Header - + Wifi - + @@ -38,10 +38,10 @@ List Header - + Magic - + diff --git a/ionic/components/list/test/inset/main.html b/ionic/components/list/test/inset/main.html index 7c8e6735ee..5a22689aff 100644 --- a/ionic/components/list/test/inset/main.html +++ b/ionic/components/list/test/inset/main.html @@ -20,9 +20,9 @@ List Link Item 2 - - Switch - + + Toggle + Checkbox diff --git a/ionic/components/list/test/no-lines/main.html b/ionic/components/list/test/no-lines/main.html index 6c78172f03..47df913df1 100644 --- a/ionic/components/list/test/no-lines/main.html +++ b/ionic/components/list/test/no-lines/main.html @@ -6,10 +6,10 @@ List With No Lines - + Wifi - + diff --git a/ionic/components/switch/switch.ios.scss b/ionic/components/switch/switch.ios.scss deleted file mode 100644 index 81e783bb9f..0000000000 --- a/ionic/components/switch/switch.ios.scss +++ /dev/null @@ -1,184 +0,0 @@ -@import "../../globals.ios"; - -// iOS Switch -// -------------------------------------------------- - -$switch-ios-width: 51px !default; -$switch-ios-height: 32px !default; -$switch-ios-border-width: 2px !default; -$switch-ios-border-radius: $switch-ios-height / 2 !default; - -$switch-ios-background-color-off: $list-ios-background-color !default; -$switch-ios-border-color-off: grayscale(lighten($list-ios-border-color, 11%)) !default; - -$switch-ios-background-color-on: map-get($colors-ios, primary) !default; - -$switch-ios-handle-width: $switch-ios-height - ($switch-ios-border-width * 2) !default; -$switch-ios-handle-height: $switch-ios-handle-width !default; -$switch-ios-handle-border-radius: $switch-ios-handle-height / 2 !default; -$switch-ios-handle-box-shadow: 0 3px 12px rgba(0, 0, 0, 0.16), 0 3px 1px rgba(0, 0, 0, 0.1) !default; - -$switch-ios-handle-background-color: $switch-ios-background-color-off !default; - -$switch-ios-media-margin: 0 !default; -$switch-ios-media-padding: 6px ($item-ios-padding-right / 2) 5px ($item-ios-padding-left) !default; - -$switch-ios-transition-duration: 300ms !default; - -$switch-ios-disabled-opacity: 0.5 !default; -$switch-ios-disabled-text-color: $subdued-text-ios-color !default; - - -// Switch -// ----------------------------------------- - -ion-switch { - display: block; - @include user-select-none(); - - &.item.activated { - background: $list-ios-background-color; - } -} - - -// Switch Wrapper -// ----------------------------------------- - -.switch-media { - margin: $switch-ios-media-margin; - padding: $switch-ios-media-padding; - cursor: pointer; -} - - -// Switch Background Track -// ----------------------------------------- - -.switch-icon { - // bg track, when not checked - position: relative; - display: block; - width: $switch-ios-width; - height: $switch-ios-height; - border-radius: $switch-ios-border-radius; - pointer-events: none; - - background-color: $switch-ios-border-color-off; - transition: background-color $switch-ios-transition-duration; -} - - -// Switch Background Track, Inner Oval -// ----------------------------------------- - -.switch-icon:before { - // inner bg track's oval, when not checked - content: ''; - position: absolute; - top: $switch-ios-border-width; - right: $switch-ios-border-width; - left: $switch-ios-border-width; - bottom: $switch-ios-border-width; - - border-radius: $switch-ios-border-radius; - background-color: $switch-ios-background-color-off; - - transform: scale3d(1, 1, 1); - transition: transform $switch-ios-transition-duration; -} - - -// Switch Knob -// ----------------------------------------- - -.switch-icon:after { - // knob, when not checked - content: ''; - position: absolute; - top: $switch-ios-border-width; - left: $switch-ios-border-width; - - width: $switch-ios-handle-width; - height: $switch-ios-handle-height; - - border-radius: $switch-ios-handle-border-radius; - background-color: $switch-ios-handle-background-color; - box-shadow: $switch-ios-handle-box-shadow; - - transition: transform $switch-ios-transition-duration, width 120ms ease-in-out 80ms, left 110ms ease-in-out 80ms; -} - - -// Switch Checked -// ----------------------------------------- - -ion-switch[aria-checked=true] { - .switch-icon { - // bg track, when checked - background-color: $switch-ios-background-color-on; - - &:before { - // inner bg track's oval, when checked - transform: scale3d(0, 0, 0); - } - - &:after { - // knob, when checked - transform: translate3d($switch-ios-width - $switch-ios-handle-width - ($switch-ios-border-width * 2), 0, 0); - } - } - - .switch-activated .switch-icon { - &:before { - // inner bg track's oval, when checked - transform: scale3d(0, 0, 0); - } - - &:after { - // when pressing down on the switch and IS checked - // make the knob wider and move it left a bit - left: $switch-ios-border-width - 6; - - // when pressing down on the switch and NOT checked - // then make the knob wider - width: $switch-ios-handle-width + 6; - } - } -} - - -// Switch Disabled -// ----------------------------------------- - -ion-switch[aria-disabled=true] { - opacity: $switch-ios-disabled-opacity; - color: $switch-ios-disabled-text-color; - pointer-events: none; -} - - -// iOS Switch Color Mixin -// -------------------------------------------------- - -@mixin switch-theme-ios($color-name, $bg-on) { - - ion-switch[#{$color-name}] { - - &[aria-checked=true] .switch-icon { - background-color: $bg-on; - } - - } - -} - - -// Generate iOS Switch Auxiliary Colors -// -------------------------------------------------- - -@each $color-name, $value in $colors-ios { - - @include switch-theme-ios($color-name, $value); - -} diff --git a/ionic/components/switch/switch.md.scss b/ionic/components/switch/switch.md.scss deleted file mode 100644 index 4200de3b3c..0000000000 --- a/ionic/components/switch/switch.md.scss +++ /dev/null @@ -1,140 +0,0 @@ -@import "../../globals.md"; - -// Material Design Switch -// -------------------------------------------------- - -$switch-md-active-color: map-get($colors-md, primary) !default; - -$switch-md-track-width: 36px !default; -$switch-md-track-height: 14px !default; -$switch-md-track-background-color-off: $list-md-border-color !default; -$switch-md-track-background-color-on: lighten($switch-md-active-color, 25%) !default; - -$switch-md-handle-width: 20px !default; -$switch-md-handle-height: 20px !default; -$switch-md-handle-background-color-off: $background-md-color !default; -$switch-md-handle-background-color-on: $switch-md-active-color !default; -$switch-md-handle-box-shadow: 0 2px 2px 0 rgba(0,0,0,.14), 0 3px 1px -2px rgba(0,0,0,.2), 0 1px 5px 0 rgba(0,0,0,.12) !default; -$switch-md-handle-border-radius: 50% !default; - -$switch-md-media-margin: 0 !default; -$switch-md-media-padding: 12px ($item-md-padding-right / 2) 12px $item-md-padding-left !default; - -$switch-md-transition-duration: 300ms !default; - -$switch-md-disabled-opacity: 0.5 !default; -$switch-md-disabled-text-color: $subdued-text-md-color !default; - - -// Switch -// ----------------------------------------- - -ion-switch { - display: block; - @include user-select-none(); -} - - -// Switch Wrapper -// ----------------------------------------- - -.switch-media { - margin: $switch-md-media-margin; - padding: $switch-md-media-padding; - cursor: pointer; -} - - -// Switch Background Track -// ----------------------------------------- - -.switch-icon { - // bg track, when not checked - position: relative; - display: block; - width: $switch-md-track-width; - height: $switch-md-track-height; - pointer-events: none; - border-radius: $switch-md-track-height; - - background-color: $switch-md-track-background-color-off; - transition: background-color $switch-md-transition-duration -} - - -// Switch Knob -// ----------------------------------------- - -.switch-icon:after { - // knob, when not checked - content: ''; - position: absolute; - top: ($switch-md-handle-height - $switch-md-track-height) / -2; - left: 0; - - width: $switch-md-handle-width; - height: $switch-md-handle-height; - - border-radius: $switch-md-handle-border-radius; - box-shadow: $switch-md-handle-box-shadow; - - background-color: $switch-md-handle-background-color-off; - - transition-property: transform, background-color; - transition-duration: $switch-md-transition-duration; -} - - -// Switch Checked -// ----------------------------------------- - -ion-switch[aria-checked=true] .switch-icon { - // bg track, when not checked - background-color: $switch-md-track-background-color-on; - - &:after { - // knob, when not checked - background-color: $switch-md-handle-background-color-on; - transform: translate3d($switch-md-track-width - $switch-md-handle-width, 0, 0); - } -} - - -// Switch Disabled -// ----------------------------------------- - -ion-switch[aria-disabled=true] { - opacity: $switch-md-disabled-opacity; - color: $switch-md-disabled-text-color; - pointer-events: none; -} - - -// Material Design Color Mixin -// -------------------------------------------------- - -@mixin switch-theme-md($color-name, $bg-on) { - - ion-switch[#{$color-name}] { - - &[aria-checked=true] .switch-icon { - background-color: lighten($bg-on, 25%); - } - - &[aria-checked=true] .switch-icon:after { - background-color: $bg-on; - } - - } - -} - - -// Generate Material Design Switch Auxiliary Colors -// -------------------------------------------------- - -@each $color-name, $value in $colors-md { - - @include switch-theme-md($color-name, $value); - -} diff --git a/ionic/components/switch/test/basic/e2e.ts b/ionic/components/toggle/test/basic/e2e.ts similarity index 81% rename from ionic/components/switch/test/basic/e2e.ts rename to ionic/components/toggle/test/basic/e2e.ts index 6c4ea1b431..ad46dc3984 100644 --- a/ionic/components/switch/test/basic/e2e.ts +++ b/ionic/components/toggle/test/basic/e2e.ts @@ -1,6 +1,6 @@ it('should check apple via switch element click', function() { - element(by.css('[ng-control=appleCtrl] .switch-media')).click(); + element(by.css('[ng-control=appleCtrl] .toggle-media')).click(); }); diff --git a/ionic/components/switch/test/basic/index.ts b/ionic/components/toggle/test/basic/index.ts similarity index 100% rename from ionic/components/switch/test/basic/index.ts rename to ionic/components/toggle/test/basic/index.ts diff --git a/ionic/components/switch/test/basic/main.html b/ionic/components/toggle/test/basic/main.html similarity index 74% rename from ionic/components/switch/test/basic/main.html rename to ionic/components/toggle/test/basic/main.html index c640bfeb06..6f8bc74bd9 100644 --- a/ionic/components/switch/test/basic/main.html +++ b/ionic/components/toggle/test/basic/main.html @@ -1,5 +1,5 @@ -Switches +Toggles @@ -8,29 +8,29 @@ - + Apple, value=apple, init checked - + - + Banana, init no checked/value attributes - + - + Cherry, value=cherry, init disabled - + - + Grape, value=grape, init checked, disabled - + - + Secondary color - + - + I'm an NgModel - + diff --git a/ionic/components/toggle/toggle.ios.scss b/ionic/components/toggle/toggle.ios.scss new file mode 100644 index 0000000000..e222eae2f4 --- /dev/null +++ b/ionic/components/toggle/toggle.ios.scss @@ -0,0 +1,182 @@ +@import "../../globals.ios"; + +// iOS Toggle +// -------------------------------------------------- + +$toggle-ios-width: 51px !default; +$toggle-ios-height: 32px !default; +$toggle-ios-border-width: 2px !default; +$toggle-ios-border-radius: $toggle-ios-height / 2 !default; + +$toggle-ios-background-color-off: $list-ios-background-color !default; +$toggle-ios-border-color-off: grayscale(lighten($list-ios-border-color, 11%)) !default; + +$toggle-ios-background-color-on: map-get($colors-ios, primary) !default; + +$toggle-ios-handle-width: $toggle-ios-height - ($toggle-ios-border-width * 2) !default; +$toggle-ios-handle-height: $toggle-ios-handle-width !default; +$toggle-ios-handle-border-radius: $toggle-ios-handle-height / 2 !default; +$toggle-ios-handle-box-shadow: 0 3px 12px rgba(0, 0, 0, 0.16), 0 3px 1px rgba(0, 0, 0, 0.1) !default; + +$toggle-ios-handle-background-color: $toggle-ios-background-color-off !default; + +$toggle-ios-media-margin: 0 !default; +$toggle-ios-media-padding: 6px ($item-ios-padding-right / 2) 5px ($item-ios-padding-left) !default; + +$toggle-ios-transition-duration: 300ms !default; + +$toggle-ios-disabled-opacity: 0.5 !default; +$toggle-ios-disabled-text-color: $subdued-text-ios-color !default; + + +// Toggle +// ----------------------------------------- + +ion-toggle { + display: block; + @include user-select-none(); + + &.item.activated { + background: $list-ios-background-color; + } +} + + +// Toggle Wrapper +// ----------------------------------------- + +.toggle-media { + margin: $toggle-ios-media-margin; + padding: $toggle-ios-media-padding; + cursor: pointer; +} + + +// Toggle Background Track +// ----------------------------------------- + +.toggle-icon { + // bg track, when not checked + position: relative; + display: block; + width: $toggle-ios-width; + height: $toggle-ios-height; + border-radius: $toggle-ios-border-radius; + pointer-events: none; + + background-color: $toggle-ios-border-color-off; + transition: background-color $toggle-ios-transition-duration; +} + + +// Toggle Background Track, Inner Oval +// ----------------------------------------- + +.toggle-icon:before { + // inner bg track's oval, when not checked + content: ''; + position: absolute; + top: $toggle-ios-border-width; + right: $toggle-ios-border-width; + left: $toggle-ios-border-width; + bottom: $toggle-ios-border-width; + + border-radius: $toggle-ios-border-radius; + background-color: $toggle-ios-background-color-off; + + transform: scale3d(1, 1, 1); + transition: transform $toggle-ios-transition-duration; +} + + +// Toggle Knob +// ----------------------------------------- + +.toggle-icon:after { + // knob, when not checked + content: ''; + position: absolute; + top: $toggle-ios-border-width; + left: $toggle-ios-border-width; + + width: $toggle-ios-handle-width; + height: $toggle-ios-handle-height; + + border-radius: $toggle-ios-handle-border-radius; + background-color: $toggle-ios-handle-background-color; + box-shadow: $toggle-ios-handle-box-shadow; + + transition: transform $toggle-ios-transition-duration, width 120ms ease-in-out 80ms, left 110ms ease-in-out 80ms; +} + + +// Toggle Checked +// ----------------------------------------- + +ion-toggle[aria-checked=true] { + .toggle-icon { + // bg track, when checked + background-color: $toggle-ios-background-color-on; + + &:before { + // inner bg track's oval, when checked + transform: scale3d(0, 0, 0); + } + + &:after { + // knob, when checked + transform: translate3d($toggle-ios-width - $toggle-ios-handle-width - ($toggle-ios-border-width * 2), 0, 0); + } + } + + .toggle-activated .toggle-icon { + &:before { + // inner bg track's oval, when checked + transform: scale3d(0, 0, 0); + } + + &:after { + // when pressing down on the toggle and IS checked + // make the knob wider and move it left a bit + left: $toggle-ios-border-width - 6; + + // when pressing down on the toggle and NOT checked + // then make the knob wider + width: $toggle-ios-handle-width + 6; + } + } +} + + +// Toggle Disabled +// ----------------------------------------- + +ion-toggle[aria-disabled=true] { + opacity: $toggle-ios-disabled-opacity; + color: $toggle-ios-disabled-text-color; + pointer-events: none; +} + + +// iOS Toggle Color Mixin +// -------------------------------------------------- + +@mixin ios-toggle-theme($color-name, $bg-on) { + + ion-toggle[#{$color-name}] { + + &[aria-checked=true] .toggle-icon { + background-color: $bg-on; + } + + } + +} + + +// Generate iOS Toggle Colors +// -------------------------------------------------- + +@each $color-name, $value in $colors-ios { + @include ios-toggle-theme($color-name, $value); +} diff --git a/ionic/components/toggle/toggle.md.scss b/ionic/components/toggle/toggle.md.scss new file mode 100644 index 0000000000..230dbb6476 --- /dev/null +++ b/ionic/components/toggle/toggle.md.scss @@ -0,0 +1,140 @@ +@import "../../globals.md"; + +// Material Design Toggle +// -------------------------------------------------- + +$toggle-md-active-color: map-get($colors-md, primary) !default; + +$toggle-md-track-width: 36px !default; +$toggle-md-track-height: 14px !default; +$toggle-md-track-background-color-off: $list-md-border-color !default; +$toggle-md-track-background-color-on: lighten($toggle-md-active-color, 25%) !default; + +$toggle-md-handle-width: 20px !default; +$toggle-md-handle-height: 20px !default; +$toggle-md-handle-background-color-off: $background-md-color !default; +$toggle-md-handle-background-color-on: $toggle-md-active-color !default; +$toggle-md-handle-box-shadow: 0 2px 2px 0 rgba(0,0,0,.14), 0 3px 1px -2px rgba(0,0,0,.2), 0 1px 5px 0 rgba(0,0,0,.12) !default; +$toggle-md-handle-border-radius: 50% !default; + +$toggle-md-media-margin: 0 !default; +$toggle-md-media-padding: 12px ($item-md-padding-right / 2) 12px $item-md-padding-left !default; + +$toggle-md-transition-duration: 300ms !default; + +$toggle-md-disabled-opacity: 0.5 !default; +$toggle-md-disabled-text-color: $subdued-text-md-color !default; + + +// Toggle +// ----------------------------------------- + +ion-toggle { + display: block; + @include user-select-none(); +} + + +// Toggle Wrapper +// ----------------------------------------- + +.toggle-media { + margin: $toggle-md-media-margin; + padding: $toggle-md-media-padding; + cursor: pointer; +} + + +// Toggle Background Track +// ----------------------------------------- + +.toggle-icon { + // bg track, when not checked + position: relative; + display: block; + width: $toggle-md-track-width; + height: $toggle-md-track-height; + pointer-events: none; + border-radius: $toggle-md-track-height; + + background-color: $toggle-md-track-background-color-off; + transition: background-color $toggle-md-transition-duration +} + + +// Toggle Knob +// ----------------------------------------- + +.toggle-icon:after { + // knob, when not checked + content: ''; + position: absolute; + top: ($toggle-md-handle-height - $toggle-md-track-height) / -2; + left: 0; + + width: $toggle-md-handle-width; + height: $toggle-md-handle-height; + + border-radius: $toggle-md-handle-border-radius; + box-shadow: $toggle-md-handle-box-shadow; + + background-color: $toggle-md-handle-background-color-off; + + transition-property: transform, background-color; + transition-duration: $toggle-md-transition-duration; +} + + +// Toggle Checked +// ----------------------------------------- + +ion-toggle[aria-checked=true] .toggle-icon { + // bg track, when not checked + background-color: $toggle-md-track-background-color-on; + + &:after { + // knob, when not checked + background-color: $toggle-md-handle-background-color-on; + transform: translate3d($toggle-md-track-width - $toggle-md-handle-width, 0, 0); + } +} + + +// Toggle Disabled +// ----------------------------------------- + +ion-toggle[aria-disabled=true] { + opacity: $toggle-md-disabled-opacity; + color: $toggle-md-disabled-text-color; + pointer-events: none; +} + + +// Material Design Color Mixin +// -------------------------------------------------- + +@mixin toggle-theme-md($color-name, $bg-on) { + + ion-toggle[#{$color-name}] { + + &[aria-checked=true] .toggle-icon { + background-color: lighten($bg-on, 25%); + } + + &[aria-checked=true] .toggle-icon:after { + background-color: $bg-on; + } + + } + +} + + +// Generate Material Design Toggle Auxiliary Colors +// -------------------------------------------------- + +@each $color-name, $value in $colors-md { + + @include toggle-theme-md($color-name, $value); + +} diff --git a/ionic/components/switch/switch.ts b/ionic/components/toggle/toggle.ts similarity index 67% rename from ionic/components/switch/switch.ts rename to ionic/components/toggle/toggle.ts index bdbce9c3cf..de620b9e67 100644 --- a/ionic/components/switch/switch.ts +++ b/ionic/components/toggle/toggle.ts @@ -9,69 +9,69 @@ import {pointerCoord} from '../../util/dom'; * @private */ @Directive({ - selector: '.switch-media', + selector: '.toggle-media', host: { - '[class.switch-activated]': 'swtch.isActivated' + '[class.toggle-activated]': 'toggle.isActivated' } }) -class MediaSwitch { +class MediaToggle { /** * TODO - * @param {Switch} swtch TODO + * @param {Toggle} toggle TODO * @param {} elementRef TODO * @param {Config} config TODO */ constructor( - @Host() @Inject(forwardRef(() => Switch)) swtch: Switch, + @Host() @Inject(forwardRef(() => Toggle)) toggle: Toggle, elementRef: ElementRef ) { - swtch.switchEle = elementRef.nativeElement; - this.swtch = swtch; + toggle.toggleEle = elementRef.nativeElement; + this.toggle = toggle; } } /** - * @name Switch + * @name Toggle * @description - * A switch technically is the same thing as an HTML checkbox input, except it looks different and is easier to use on a touch device. Ionic prefers to wrap the checkbox input with the `