forked from ionic-team/ionic-framework
-
Notifications
You must be signed in to change notification settings - Fork 0
/
toast-interface.ts
58 lines (48 loc) · 1.55 KB
/
toast-interface.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import type { AnimationBuilder, Color, LiteralUnion, Mode } from '../../interface';
import type { IonicSafeString } from '../../utils/sanitization';
export interface ToastOptions {
header?: string;
message?: string | IonicSafeString;
cssClass?: string | string[];
duration?: number;
buttons?: (ToastButton | string)[];
position?: 'top' | 'bottom' | 'middle';
positionAnchor?: HTMLElement | string;
swipeGesture?: ToastSwipeGestureDirection;
translucent?: boolean;
animated?: boolean;
icon?: string;
htmlAttributes?: { [key: string]: any };
layout?: ToastLayout;
color?: Color;
mode?: Mode;
keyboardClose?: boolean;
id?: string;
enterAnimation?: AnimationBuilder;
leaveAnimation?: AnimationBuilder;
}
export type ToastLayout = 'baseline' | 'stacked';
// TODO FW-4923 remove cssClass property
export interface ToastButton {
text?: string;
icon?: string;
side?: 'start' | 'end';
role?: LiteralUnion<'cancel', string>;
/**
* @deprecated Use the toast button's CSS Shadow Parts instead.
*/
cssClass?: string | string[];
htmlAttributes?: { [key: string]: any };
handler?: () => boolean | void | Promise<boolean | void>;
}
export type ToastPosition = 'top' | 'bottom' | 'middle';
interface ToastPositionAlias {
position: ToastPosition;
}
export interface ToastAnimationPosition {
top: string;
bottom: string;
}
export type ToastPresentOptions = ToastPositionAlias & ToastAnimationPosition;
export type ToastDismissOptions = ToastPositionAlias & ToastAnimationPosition;
export type ToastSwipeGestureDirection = 'vertical';