Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(modal): update iOS design, add swipe gesture #19428

Merged
merged 50 commits into from Dec 10, 2019
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
90280a8
update animation
manucorporat Sep 12, 2019
32dc3ae
merge 1
manucorporat Sep 12, 2019
9007a46
commit
manucorporat Sep 12, 2019
1b41551
wip
manucorporat Sep 12, 2019
efb479a
wip
manucorporat Sep 12, 2019
ffda359
revert menu
manucorporat Sep 12, 2019
5712020
wip
manucorporat Sep 17, 2019
a6fa6e5
Merge branch 'master' into fix-animation-manu-2
manucorporat Sep 20, 2019
6a48397
wip
manucorporat Sep 23, 2019
ed98612
Merge branch 'master' into fix-animation-manu-2
manucorporat Sep 23, 2019
a1ccbd8
wip
manucorporat Sep 23, 2019
6f41212
wip
manucorporat Sep 23, 2019
0c95251
feat(modal): new modal gestures
manucorporat Sep 23, 2019
e021370
sync with master
liamdebeasi Nov 20, 2019
a78504c
one more thing
liamdebeasi Nov 20, 2019
e4e1509
begin fixing swipe modal
liamdebeasi Nov 20, 2019
853948c
rounding errors
liamdebeasi Nov 20, 2019
483ee17
fix test
liamdebeasi Nov 21, 2019
dddd619
sync with master:
liamdebeasi Nov 21, 2019
c21df96
revert hide caret changes
liamdebeasi Nov 21, 2019
ff1578d
remove non-modal css changes
liamdebeasi Nov 21, 2019
da3d9d8
one more fix
liamdebeasi Nov 21, 2019
c5e27c8
more clean up
liamdebeasi Nov 21, 2019
df80e53
fix a few small issues
liamdebeasi Nov 21, 2019
78d2533
remove old code
liamdebeasi Nov 21, 2019
0c2282a
remove running animations
liamdebeasi Nov 21, 2019
78c3830
add initial animation clean up fix
liamdebeasi Nov 21, 2019
88f8376
clamp out of bounds values
liamdebeasi Nov 22, 2019
e8e00e5
fix safari bug, fix dismiss via modalcontroller
liamdebeasi Nov 22, 2019
7d33588
clear styles after in case user dismisses quickly
liamdebeasi Nov 22, 2019
8d39031
update transition effect to avoid additional paints on modal
liamdebeasi Nov 22, 2019
894100a
remove unused velocity
liamdebeasi Nov 22, 2019
edfdec3
add role
liamdebeasi Nov 22, 2019
f6d2750
revert old style changes
liamdebeasi Nov 22, 2019
74e5139
remove old styles
liamdebeasi Nov 22, 2019
703c2a5
update tests
liamdebeasi Nov 22, 2019
ae44cf7
fix dir
liamdebeasi Nov 25, 2019
46d5c1e
update api
liamdebeasi Nov 25, 2019
e7025bf
make native el public
liamdebeasi Nov 25, 2019
11eab87
update API, fix bug with multiple modals
liamdebeasi Nov 25, 2019
d51e8b2
fix interface
liamdebeasi Nov 25, 2019
5cb91d9
usage docs
liamdebeasi Nov 25, 2019
e5212ec
chore(docs): updating react swipable modal doc
Nov 26, 2019
e60f230
clean up code, remove online imgs, run build
liamdebeasi Dec 2, 2019
eec775e
only modify transform on card style modals
liamdebeasi Dec 2, 2019
6723751
update comment
liamdebeasi Dec 2, 2019
67654ba
cleanup
liamdebeasi Dec 10, 2019
3dab6ab
add border radius animation
liamdebeasi Dec 10, 2019
4e3bb95
Merge remote-tracking branch 'origin/master' into new-modal-swipe
liamdebeasi Dec 10, 2019
c35c97d
fix background color removal
liamdebeasi Dec 10, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 16 additions & 0 deletions core/src/components.d.ts
Expand Up @@ -1515,9 +1515,17 @@ export namespace Components {
*/
'present': () => Promise<void>;
/**
* The element that presented the modal. This is used for card presentation effects and for stacking multiple modals on top of each other.
*/
'presentingElement'?: HTMLElement;
/**
* If `true`, a backdrop will be displayed behind the modal.
*/
'showBackdrop': boolean;
/**
* If `true`, the modal will support a swipe and pan drag gesture to close. Only supported on iOS as Android does not use this type of interaction.
*/
'swipeGesture': boolean;
}
interface IonModalController {
/**
Expand Down Expand Up @@ -4943,9 +4951,17 @@ declare namespace LocalJSX {
*/
'onIonModalWillPresent'?: (event: CustomEvent<void>) => void;
/**
* The element that presented the modal. This is used for card presentation effects and for stacking multiple modals on top of each other.
*/
'presentingElement'?: HTMLElement;
/**
* If `true`, a backdrop will be displayed behind the modal.
*/
'showBackdrop'?: boolean;
/**
* If `true`, the modal will support a swipe and pan drag gesture to close. Only supported on iOS as Android does not use this type of interaction.
*/
'swipeGesture'?: boolean;
}
interface IonModalController extends JSXBase.HTMLAttributes<HTMLIonModalControllerElement> {}
interface IonNav extends JSXBase.HTMLAttributes<HTMLIonNavElement> {
Expand Down
4 changes: 4 additions & 0 deletions core/src/components/action-sheet/action-sheet.ios.scss
Expand Up @@ -157,3 +157,7 @@

font-weight: $action-sheet-ios-button-cancel-font-weight;
}

ion-backdrop {
opacity: 0.4;
}
4 changes: 4 additions & 0 deletions core/src/components/action-sheet/action-sheet.md.scss
Expand Up @@ -78,3 +78,7 @@
.action-sheet-selected {
font-weight: bold;
}

ion-backdrop {
opacity: 0.32;
}
1 change: 0 additions & 1 deletion core/src/components/action-sheet/action-sheet.scss
Expand Up @@ -47,7 +47,6 @@
.action-sheet-wrapper {
@include position(null, 0, 0, 0);
@include margin(auto);
@include transform(translate3d(0, 100%, 0));

display: block;
position: absolute;
Expand Down
4 changes: 2 additions & 2 deletions core/src/components/action-sheet/animations/ios.enter.ts
Expand Up @@ -10,11 +10,11 @@ export const iosEnterAnimation = (baseEl: HTMLElement): IonicAnimation => {
const wrapperAnimation = createAnimation();

backdropAnimation
.addElement(baseEl.querySelector('ion-backdrop'))
.addElement(baseEl.querySelector('ion-backdrop')!)
.fromTo('opacity', 0.01, 0.4);

wrapperAnimation
.addElement(baseEl.querySelector('.action-sheet-wrapper'))
.addElement(baseEl.querySelector('.action-sheet-wrapper')!)
.fromTo('transform', 'translateY(100%)', 'translateY(0%)');

return baseAnimation
Expand Down
4 changes: 2 additions & 2 deletions core/src/components/action-sheet/animations/ios.leave.ts
Expand Up @@ -10,11 +10,11 @@ export const iosLeaveAnimation = (baseEl: HTMLElement): IonicAnimation => {
const wrapperAnimation = createAnimation();

backdropAnimation
.addElement(baseEl.querySelector('ion-backdrop'))
.addElement(baseEl.querySelector('ion-backdrop')!)
.fromTo('opacity', 0.4, 0);

wrapperAnimation
.addElement(baseEl.querySelector('.action-sheet-wrapper'))
.addElement(baseEl.querySelector('.action-sheet-wrapper')!)
.fromTo('transform', 'translateY(0%)', 'translateY(100%)');

return baseAnimation
Expand Down
4 changes: 2 additions & 2 deletions core/src/components/action-sheet/animations/md.enter.ts
Expand Up @@ -10,11 +10,11 @@ export const mdEnterAnimation = (baseEl: HTMLElement): IonicAnimation => {
const wrapperAnimation = createAnimation();

backdropAnimation
.addElement(baseEl.querySelector('ion-backdrop'))
.addElement(baseEl.querySelector('ion-backdrop')!)
.fromTo('opacity', 0.01, 0.32);

wrapperAnimation
.addElement(baseEl.querySelector('.action-sheet-wrapper'))
.addElement(baseEl.querySelector('.action-sheet-wrapper')!)
.fromTo('transform', 'translateY(100%)', 'translateY(0%)');

return baseAnimation
Expand Down
4 changes: 2 additions & 2 deletions core/src/components/action-sheet/animations/md.leave.ts
Expand Up @@ -10,11 +10,11 @@ export const mdLeaveAnimation = (baseEl: HTMLElement): IonicAnimation => {
const wrapperAnimation = createAnimation();

backdropAnimation
.addElement(baseEl.querySelector('ion-backdrop'))
.addElement(baseEl.querySelector('ion-backdrop')!)
.fromTo('opacity', 0.32, 0);

wrapperAnimation
.addElement(baseEl.querySelector('.action-sheet-wrapper'))
.addElement(baseEl.querySelector('.action-sheet-wrapper')!)
.fromTo('transform', 'translateY(0%)', 'translateY(100%)');

return baseAnimation
Expand Down
4 changes: 4 additions & 0 deletions core/src/components/alert/alert.ios.scss
Expand Up @@ -300,3 +300,7 @@
.alert-button.activated {
background-color: $alert-ios-button-background-color-activated;
}

ion-backdrop {
opacity: 0.3;
}
4 changes: 4 additions & 0 deletions core/src/components/alert/alert.md.scss
Expand Up @@ -291,3 +291,7 @@
.alert-button-inner {
justify-content: $alert-md-button-group-justify-content;
}

ion-backdrop {
opacity: 0.32;
}
1 change: 0 additions & 1 deletion core/src/components/alert/alert.scss
Expand Up @@ -64,7 +64,6 @@
background: var(--background);

contain: content;
opacity: 0;
z-index: $z-index-overlay-wrapper;
}

Expand Down
3 changes: 1 addition & 2 deletions core/src/components/alert/alert.tsx
@@ -1,7 +1,7 @@
import { Component, ComponentInterface, Element, Event, EventEmitter, Host, Method, Prop, Watch, h } from '@stencil/core';

import { getIonMode } from '../../global/ionic-global';
import { AlertButton, AlertInput, Animation, AnimationBuilder, CssClassMap, OverlayEventDetail, OverlayInterface } from '../../interface';
import { AlertButton, AlertInput, AnimationBuilder, CssClassMap, OverlayEventDetail, OverlayInterface } from '../../interface';
import { BACKDROP, dismiss, eventMethod, isCancel, prepareOverlay, present, safeCall } from '../../utils/overlays';
import { sanitizeDOMString } from '../../utils/sanitization';
import { getClassMap } from '../../utils/theme';
Expand Down Expand Up @@ -30,7 +30,6 @@ export class Alert implements ComponentInterface, OverlayInterface {
private processedButtons: AlertButton[] = [];

presented = false;
animation?: Animation;
mode = getIonMode(this);

@Element() el!: HTMLIonAlertElement;
Expand Down
8 changes: 4 additions & 4 deletions core/src/components/alert/animations/ios.enter.ts
Expand Up @@ -10,14 +10,14 @@ export const iosEnterAnimation = (baseEl: HTMLElement): IonicAnimation => {
const wrapperAnimation = createAnimation();

backdropAnimation
.addElement(baseEl.querySelector('ion-backdrop'))
.addElement(baseEl.querySelector('ion-backdrop')!)
.fromTo('opacity', 0.01, 0.3);

wrapperAnimation
.addElement(baseEl.querySelector('.alert-wrapper'))
.addElement(baseEl.querySelector('.alert-wrapper')!)
.keyframes([
{ offset: 0, opacity: 0.01, transform: 'scale(1.1)' },
{ offset: 1, opacity: 1, transform: 'scale(1)' }
{ opacity: '0.01', transform: 'scale(1.1)' },
{ opacity: '1', transform: 'scale(1)' }
]);

return baseAnimation
Expand Down
4 changes: 2 additions & 2 deletions core/src/components/alert/animations/ios.leave.ts
Expand Up @@ -10,11 +10,11 @@ export const iosLeaveAnimation = (baseEl: HTMLElement): IonicAnimation => {
const wrapperAnimation = createAnimation();

backdropAnimation
.addElement(baseEl.querySelector('ion-backdrop'))
.addElement(baseEl.querySelector('ion-backdrop')!)
.fromTo('opacity', 0.3, 0);

wrapperAnimation
.addElement(baseEl.querySelector('.alert-wrapper'))
.addElement(baseEl.querySelector('.alert-wrapper')!)
.keyframes([
{ offset: 0, opacity: 0.99, transform: 'scale(1)' },
{ offset: 1, opacity: 0, transform: 'scale(0.9)' }
Expand Down
8 changes: 4 additions & 4 deletions core/src/components/alert/animations/md.enter.ts
Expand Up @@ -10,14 +10,14 @@ export const mdEnterAnimation = (baseEl: HTMLElement): IonicAnimation => {
const wrapperAnimation = createAnimation();

backdropAnimation
.addElement(baseEl.querySelector('ion-backdrop'))
.addElement(baseEl.querySelector('ion-backdrop')!)
.fromTo('opacity', 0.01, 0.32);

wrapperAnimation
.addElement(baseEl.querySelector('.alert-wrapper'))
.addElement(baseEl.querySelector('.alert-wrapper')!)
.keyframes([
{ offset: 0, opacity: 0.01, transform: 'scale(0.9)' },
{ offset: 1, opacity: 1, transform: 'scale(1)' }
{ offset: 0, opacity: '0.01', transform: 'scale(0.9)' },
{ offset: 1, opacity: '1', transform: 'scale(1)' }
]);

return baseAnimation
Expand Down
4 changes: 2 additions & 2 deletions core/src/components/alert/animations/md.leave.ts
Expand Up @@ -10,11 +10,11 @@ export const mdLeaveAnimation = (baseEl: HTMLElement): IonicAnimation => {
const wrapperAnimation = createAnimation();

backdropAnimation
.addElement(baseEl.querySelector('ion-backdrop'))
.addElement(baseEl.querySelector('ion-backdrop')!)
.fromTo('opacity', 0.32, 0);

wrapperAnimation
.addElement(baseEl.querySelector('.alert-wrapper'))
.addElement(baseEl.querySelector('.alert-wrapper')!)
.fromTo('opacity', 0.99, 0);

return baseAnimation
Expand Down
2 changes: 1 addition & 1 deletion core/src/components/input/test/basic/index.html
Expand Up @@ -96,7 +96,7 @@
<ion-label position="fixed">Type #</ion-label>
<div type="number" value="333" class="input input-md hydrated">
<!---->
<input aria-disabled="false" autocapitalize="none" autocomplete="off" autocorrect="off" autofocus="false" class="native-input native-input-md"
<input style="caret-color: red" aria-disabled="false" autocapitalize="none" autocomplete="off" autocorrect="off" autofocus="false" class="native-input native-input-md"
spellcheck="false" type="number">
<button type="button" class="input-clear-icon" hidden=""></button>
</div>
Expand Down
4 changes: 2 additions & 2 deletions core/src/components/loading/animations/ios.enter.ts
Expand Up @@ -10,11 +10,11 @@ export const iosEnterAnimation = (baseEl: HTMLElement): IonicAnimation => {
const wrapperAnimation = createAnimation();

backdropAnimation
.addElement(baseEl.querySelector('ion-backdrop'))
.addElement(baseEl.querySelector('ion-backdrop')!)
.fromTo('opacity', 0.01, 0.3);

wrapperAnimation
.addElement(baseEl.querySelector('.loading-wrapper'))
.addElement(baseEl.querySelector('.loading-wrapper')!)
.keyframes([
{ offset: 0, opacity: 0.01, transform: 'scale(1.1)' },
{ offset: 1, opacity: 1, transform: 'scale(1)' }
Expand Down
4 changes: 2 additions & 2 deletions core/src/components/loading/animations/ios.leave.ts
Expand Up @@ -10,11 +10,11 @@ export const iosLeaveAnimation = (baseEl: HTMLElement): IonicAnimation => {
const wrapperAnimation = createAnimation();

backdropAnimation
.addElement(baseEl.querySelector('ion-backdrop'))
.addElement(baseEl.querySelector('ion-backdrop')!)
.fromTo('opacity', 0.3, 0);

wrapperAnimation
.addElement(baseEl.querySelector('.loading-wrapper'))
.addElement(baseEl.querySelector('.loading-wrapper')!)
.keyframes([
{ offset: 0, opacity: 0.99, transform: 'scale(1)' },
{ offset: 1, opacity: 0, transform: 'scale(0.9)' }
Expand Down
4 changes: 2 additions & 2 deletions core/src/components/loading/animations/md.enter.ts
Expand Up @@ -10,11 +10,11 @@ export const mdEnterAnimation = (baseEl: HTMLElement): IonicAnimation => {
const wrapperAnimation = createAnimation();

backdropAnimation
.addElement(baseEl.querySelector('ion-backdrop'))
.addElement(baseEl.querySelector('ion-backdrop')!)
.fromTo('opacity', 0.01, 0.32);

wrapperAnimation
.addElement(baseEl.querySelector('.loading-wrapper'))
.addElement(baseEl.querySelector('.loading-wrapper')!)
.keyframes([
{ offset: 0, opacity: 0.01, transform: 'scale(1.1)' },
{ offset: 1, opacity: 1, transform: 'scale(1)' }
Expand Down
4 changes: 2 additions & 2 deletions core/src/components/loading/animations/md.leave.ts
Expand Up @@ -10,11 +10,11 @@ export const mdLeaveAnimation = (baseEl: HTMLElement): IonicAnimation => {
const wrapperAnimation = createAnimation();

backdropAnimation
.addElement(baseEl.querySelector('ion-backdrop'))
.addElement(baseEl.querySelector('ion-backdrop')!)
.fromTo('opacity', 0.32, 0);

wrapperAnimation
.addElement(baseEl.querySelector('.loading-wrapper'))
.addElement(baseEl.querySelector('.loading-wrapper')!)
.keyframes([
{ offset: 0, opacity: 0.99, transform: 'scale(1)' },
{ offset: 1, opacity: 0, transform: 'scale(0.9)' }
Expand Down
4 changes: 4 additions & 0 deletions core/src/components/loading/loading.ios.scss
Expand Up @@ -42,3 +42,7 @@
.loading-spinner + .loading-content {
@include margin-horizontal(16px, null);
}

ion-backdrop {
opacity: 0.3;
}
4 changes: 4 additions & 0 deletions core/src/components/loading/loading.md.scss
Expand Up @@ -29,3 +29,7 @@
.loading-spinner + .loading-content {
@include margin-horizontal(16px, null);
}

ion-backdrop {
opacity: 0.32;
}
1 change: 0 additions & 1 deletion core/src/components/loading/loading.scss
Expand Up @@ -59,7 +59,6 @@

background: var(--background);

opacity: 0;
z-index: $z-index-overlay-wrapper;
}

Expand Down
3 changes: 1 addition & 2 deletions core/src/components/loading/loading.tsx
Expand Up @@ -2,7 +2,7 @@ import { Component, ComponentInterface, Element, Event, EventEmitter, Host, Meth

import { config } from '../../global/config';
import { getIonMode } from '../../global/ionic-global';
import { Animation, AnimationBuilder, OverlayEventDetail, OverlayInterface, SpinnerTypes } from '../../interface';
import { AnimationBuilder, OverlayEventDetail, OverlayInterface, SpinnerTypes } from '../../interface';
import { BACKDROP, dismiss, eventMethod, prepareOverlay, present } from '../../utils/overlays';
import { sanitizeDOMString } from '../../utils/sanitization';
import { getClassMap } from '../../utils/theme';
Expand All @@ -27,7 +27,6 @@ export class Loading implements ComponentInterface, OverlayInterface {
private durationTimeout: any;

presented = false;
animation?: Animation;
mode = getIonMode(this);

@Element() el!: HTMLIonLoadingElement;
Expand Down
2 changes: 1 addition & 1 deletion core/src/components/menu-controller/menu-controller.ts
Expand Up @@ -151,6 +151,6 @@ export class MenuController {
*/
@Method()
async registerAnimation(name: string, animation: AnimationBuilder | ((menu: MenuI) => IonicAnimation)) {
return menuController.registerAnimation(name, animation);
return menuController.registerAnimation(name, animation as any);
}
}
8 changes: 4 additions & 4 deletions core/src/components/menu/menu.tsx
Expand Up @@ -434,10 +434,10 @@ export class Menu implements ComponentInterface, MenuI {

this.animation
.easing('cubic-bezier(0.4, 0.0, 0.6, 1)')
.onFinish(() => this.afterAnimation(shouldOpen), {
oneTimeCallback: true
})
.progressEnd(shouldComplete, newStepValue, 300);
.onFinish(
() => this.afterAnimation(shouldOpen),
{ oneTimeCallback: true })
.progressEnd(shouldComplete ? 1 : 0, newStepValue, 300);
}

private beforeAnimation(shouldOpen: boolean) {
Expand Down