-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Expand file tree
/
Copy pathalert-interface.ts
More file actions
53 lines (47 loc) · 1.54 KB
/
alert-interface.ts
File metadata and controls
53 lines (47 loc) · 1.54 KB
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
import type { OverlayOptions } from '@utils/overlays-interface';
import type { LiteralUnion, TextFieldTypes } from '../../interface';
import type { IonicSafeString } from '../../utils/sanitization';
export interface AlertOptions extends OverlayOptions {
header?: string;
subHeader?: string;
message?: string | IonicSafeString;
cssClass?: string | string[];
inputs?: AlertInput[];
buttons?: (AlertButton | string)[];
backdropDismiss?: boolean;
translucent?: boolean;
htmlAttributes?: { [key: string]: any };
keyboardClose?: boolean;
}
export interface AlertInput {
type?: TextFieldTypes | 'checkbox' | 'radio' | 'textarea';
name?: string;
placeholder?: string;
value?: any; // TODO(FW-2832): type
/**
* The label text to display next to the input, if the input type is `radio` or `checkbox`.
*/
label?: string | HTMLElement;
checked?: boolean;
disabled?: boolean;
id?: string;
handler?: (input: AlertInput) => void;
min?: string | number;
max?: string | number;
cssClass?: string | string[];
attributes?: { [key: string]: any };
tabindex?: number;
startContent?: HTMLElement;
endContent?: HTMLElement;
description?: string;
}
type AlertButtonOverlayHandler = boolean | void | { [key: string]: any };
export interface AlertButton {
text: string;
role?: LiteralUnion<'cancel' | 'destructive', string>;
cssClass?: string | string[];
id?: string;
htmlAttributes?: { [key: string]: any };
// TODO(FW-2832): type
handler?: (value: any) => AlertButtonOverlayHandler | Promise<AlertButtonOverlayHandler>;
}