UNPKG

@axinom/mosaic-ui

Version:

UI components for building Axinom Mosaic applications

48 lines (34 loc) 1.34 kB
import { Component, ReactNode } from 'react'; export type ShowNotification = (notification: Notification) => NotificationId; export type UpdateNotification = ( id: NotificationId, notification: Notification, ) => void; export type DismissNotification = (id: NotificationId) => void; export interface Notification { /** Title shown in toast messages header */ title: string; /** Optional body of the notification */ body?: NotificationBody; /** Additional options for the notification */ options?: NotificationOptions; } export interface NotificationOptions { /** Type of the notification */ type?: NotificationType; /** Set to false to disable auto-closing of the notification, or specify a custom timeout in milliseconds */ autoClose?: number | false; } export type NotificationId = string | number; export type NotificationBody = string | ReactNode | Component; export type NotificationType = 'success' | 'error' | 'info' | 'warning'; export type IndicatorId = number; export type AddIndicator = (content: React.ReactNode) => IndicatorId; export type RemoveIndicator = (id: IndicatorId) => void; export type UpdateIndicator = ( id: IndicatorId, content: React.ReactNode, ) => void; export interface CustomEventEmitter { on(eventName: string, listener: (...args: unknown[]) => void): void; }