Files
ionic-framework/core/src/components/modal/modal-interface.ts
Liam DeBeasi 1f3ddf2370 refactor(modal): remove swipeToClose in favor of canDismiss (#26050)
BREAKING CHANGE:

- The `swipeToClose` property has been removed in favor of `canDismiss`.
- The `canDismiss` property now defaults to `true` and can no longer be set to `undefined`.
2022-09-29 17:19:53 -04:00

52 lines
1.3 KiB
TypeScript

import type { AnimationBuilder, ComponentProps, ComponentRef, FrameworkDelegate, Mode } from '../../interface';
export interface ModalOptions<T extends ComponentRef = ComponentRef> {
component: T;
componentProps?: ComponentProps<T>;
presentingElement?: HTMLElement;
showBackdrop?: boolean;
backdropDismiss?: boolean;
cssClass?: string | string[];
delegate?: FrameworkDelegate;
animated?: boolean;
canDismiss?: boolean | (() => Promise<boolean>);
mode?: Mode;
keyboardClose?: boolean;
id?: string;
htmlAttributes?: ModalAttributes;
enterAnimation?: AnimationBuilder;
leaveAnimation?: AnimationBuilder;
breakpoints?: number[];
initialBreakpoint?: number;
backdropBreakpoint?: number;
handle?: boolean;
handleBehavior?: ModalHandleBehavior;
}
export interface ModalAnimationOptions {
presentingEl?: HTMLElement;
currentBreakpoint?: number;
backdropBreakpoint?: number;
}
export interface ModalBreakpointChangeEventDetail {
breakpoint: number;
}
export interface ModalCustomEvent extends CustomEvent {
target: HTMLIonModalElement;
}
/**
* @deprecated - Use { [key: string]: any } directly instead.
*/
export type ModalAttributes = { [key: string]: any };
/**
* The behavior setting for modals when the handle is pressed.
*/
export type ModalHandleBehavior = 'none' | 'cycle';