UNPKG

piral-notifications

Version:

Plugin for triggering notifications in Piral.

39 lines (38 loc) 1.21 kB
import { ComponentType, ReactElement } from 'react'; import { PiralPlugin } from 'piral-core'; import { PiletNotificationsApi, NotificationOptions, BareNotificationProps } from './types'; export type NotificationContent = string | ReactElement<any> | ComponentType<BareNotificationProps>; export interface InitialNotification { /** * The content of the notification. */ content: NotificationContent; /** * The optional options for the notification. */ options?: NotificationOptions; } /** * Available configuration options for the notifications plugin. */ export interface NotificationsConfig { /** * Describes the default notification options to use. * @default {} */ defaultOptions?: NotificationOptions; /** * Defines how the next ID for the key is selected. * By default a random number is used. */ selectId?(): string; /** * Sets the initial notifications. * @default [] */ messages?: Array<InitialNotification>; } /** * Creates new Pilet API extensions for showing notifications. */ export declare function createNotificationsApi(config?: NotificationsConfig): PiralPlugin<PiletNotificationsApi>;