oui-kit
Version:
🎯 *UI toolkit with a French touch* 🇫🇷
42 lines (38 loc) • 1.08 kB
text/typescript
/**
* Options for notifications.
*
* - By default they disappear ion `timeout`. `-1` stays forever.
* - Line feeds in `message` are preserved.
* - `onAction` is called if not `cancel` or `x` is clicked.
* - If `onCancel` is available, two buttons are shown.
* - `actionLabel` defaults to "OK" and `cancelLabel` to "Cancel"
* - `onClose` is called when notification disappeared.
* - The body is only clickable, if not buttons are shown.
*/
export interface AppNotificationSetup {
id?: string
mode?: 'warn' | 'error' | 'info'
active?: boolean
icon?: string
title: string
message?: string
/// Timeout in milliseconds, `-1` means forever
timeout?: number
onAction?: () => void
onAction2?: () => void
onCancel?: () => void
onClose?: () => void
actionLabel?: string
actionLabel2?: string
cancelLabel?: string
}
export interface AppNotificationInfo extends AppNotificationSetup {
id: string
mode: 'warn' | 'error' | 'info'
active: boolean
icon: string
timeout: number
close: () => void
action: () => void
action2: () => void
}