From a7330cdd4135d0ecaef535388e51cd27279e123f Mon Sep 17 00:00:00 2001 From: Max Lynch Date: Tue, 12 Nov 2013 23:55:48 -0600 Subject: [PATCH] More action sheet styles and animations --- dist/css/ionic.css | 47 ++++++++++++-- dist/js/ionic-angular.js | 13 ++-- .../angular/src/directive/ionicActionSheet.js | 2 +- .../angular/src/service/ionicActionSheet.js | 11 ++-- js/ext/angular/test/actionSheet.html | 2 +- scss/_action-sheet.scss | 65 +++++++++++++++++-- 6 files changed, 120 insertions(+), 20 deletions(-) diff --git a/dist/css/ionic.css b/dist/css/ionic.css index 5f3935fa9d..1b2062241f 100644 --- a/dist/css/ionic.css +++ b/dist/css/ionic.css @@ -2528,9 +2528,43 @@ a.subdued‎ { animation: fadeOutHalf 0.2s; -webkit-animation-fill-mode: forwards; } +@-webkit-keyframes actionSheetUp { + 0% { + -webkit-transform: translate3d(0, 100%, 0); + opacity: 0; } + + 100% { + -webkit-transform: translate3d(0, 0, 0); + opacity: 1; } } + +@-webkit-keyframes actionSheetOut { + 0% { + -webkit-transform: translate3d(0, 0, 0); + opacity: 1; } + + 100% { + -webkit-transform: translate3d(0, 100%, 0); + opacity: 0; } } + +.action-sheet-up { + opacity: 1; + -webkit-transform: translate3d(0, 0%, 0); } + .action-sheet-up.ng-enter, .action-sheet-up .ng-enter { + opacity: 0; + -webkit-transform: translate3d(0, 100%, 0); + -webkit-animation-duration: 200ms; + -webkit-animation-fill-mode: both; + -webkit-animation-timing-function: cubic-bezier(0.1, 0.7, 0.1, 1); } + .action-sheet-up.ng-enter-active, .action-sheet-up .ng-enter-active { + -webkit-animation-name: actionSheetUp; } + .action-sheet-up.ng-leave, .action-sheet-up .ng-leave { + -webkit-animation-duration: 200ms; + -webkit-animation-fill-mode: both; + -webkit-animation-timing-function: cubic-bezier(0.1, 0.7, 0.1, 1); } + .action-sheet-up.ng-leave-active, .action-sheet-up .ng-leave { + -webkit-animation-name: actionSheetOut; } + .action-sheet { - -webkit-transform: translate3d(0, 100%, 0); - transform: translate3d(0, 100%, 0); position: fixed; bottom: 0; left: 15px; @@ -2539,9 +2573,9 @@ a.subdued‎ { width: calc(100% - 30px); } .action-sheet .button { display: block; - padding: 6px; + padding: 1px; width: 100%; - border-radius: none; + border-radius: 0; background-color: transparent; color: #4a87ee; font-size: 18px; } @@ -2556,11 +2590,14 @@ a.subdued‎ { .action-sheet-group { background-color: #fff; - margin-bottom: 10px; + margin-bottom: 5px; border-radius: 3px 3px 3px 3px; } .action-sheet-group .button { border-radius: 0; border-width: 1px 0px 0px 0px; } + .action-sheet-group .button.active, .action-sheet-group .button:active { + background-color: transparent; + color: inherit; } .action-sheet-group .button:first-child:last-child { border-width: 0; } diff --git a/dist/js/ionic-angular.js b/dist/js/ionic-angular.js index 4c3d0c6c9f..520d5c0797 100644 --- a/dist/js/ionic-angular.js +++ b/dist/js/ionic-angular.js @@ -31,8 +31,8 @@ angular.module('ionic', [ ; angular.module('ionic.service.actionSheet', ['ionic.service.templateLoad', 'ionic.ui.actionSheet', 'ngAnimate']) -.factory('ActionSheet', ['$rootScope', '$document', '$compile', '$animate', 'TemplateLoader', - function($rootScope, $document, $compile, $animate, TemplateLoader) { +.factory('ActionSheet', ['$rootScope', '$document', '$compile', '$animate', '$timeout', 'TemplateLoader', + function($rootScope, $document, $compile, $animate, $timeout, TemplateLoader) { return { /** @@ -61,8 +61,11 @@ angular.module('ionic.service.actionSheet', ['ionic.service.templateLoad', 'ioni opts.cancel(); } }); - $animate.removeClass(element, 'active', function() { - scope.$destroy(); + + $timeout(function() { + $animate.removeClass(element, 'active', function() { + scope.$destroy(); + }); }); }; @@ -431,7 +434,7 @@ angular.module('ionic.ui.actionSheet', []) }); }, template: '
' + - '
' + + '
' + '
' + '
{{titleText}}
' + '' + diff --git a/js/ext/angular/src/directive/ionicActionSheet.js b/js/ext/angular/src/directive/ionicActionSheet.js index fff929c4f9..2aacd28852 100644 --- a/js/ext/angular/src/directive/ionicActionSheet.js +++ b/js/ext/angular/src/directive/ionicActionSheet.js @@ -21,7 +21,7 @@ angular.module('ionic.ui.actionSheet', []) }); }, template: '
' + - '
' + + '
' + '
' + '
{{titleText}}
' + '' + diff --git a/js/ext/angular/src/service/ionicActionSheet.js b/js/ext/angular/src/service/ionicActionSheet.js index 73ba6542df..38bee26b91 100644 --- a/js/ext/angular/src/service/ionicActionSheet.js +++ b/js/ext/angular/src/service/ionicActionSheet.js @@ -1,7 +1,7 @@ angular.module('ionic.service.actionSheet', ['ionic.service.templateLoad', 'ionic.ui.actionSheet', 'ngAnimate']) -.factory('ActionSheet', ['$rootScope', '$document', '$compile', '$animate', 'TemplateLoader', - function($rootScope, $document, $compile, $animate, TemplateLoader) { +.factory('ActionSheet', ['$rootScope', '$document', '$compile', '$animate', '$timeout', 'TemplateLoader', + function($rootScope, $document, $compile, $animate, $timeout, TemplateLoader) { return { /** @@ -30,8 +30,11 @@ angular.module('ionic.service.actionSheet', ['ionic.service.templateLoad', 'ioni opts.cancel(); } }); - $animate.removeClass(element, 'active', function() { - scope.$destroy(); + + $timeout(function() { + $animate.removeClass(element, 'active', function() { + scope.$destroy(); + }); }); }; diff --git a/js/ext/angular/test/actionSheet.html b/js/ext/angular/test/actionSheet.html index b72f9edbc1..9df0496e2f 100644 --- a/js/ext/angular/test/actionSheet.html +++ b/js/ext/angular/test/actionSheet.html @@ -15,7 +15,7 @@