UNPKG

@musica-sacra/notifications

Version:

Complex notification system for MusicaSacra apps

38 lines (33 loc) 1.31 kB
import * as react_jsx_runtime from 'react/jsx-runtime'; import * as react from 'react'; import { ReactNode } from 'react'; declare const NotificationTypes: Readonly<{ INFO: "info"; WARNING: "warning"; ERROR: "error"; SUCCESS: "success"; LOADING: "loading"; }>; type NotificationTypeType = (typeof NotificationTypes)[keyof typeof NotificationTypes]; type NotificationType = { id: string; message: string; type: NotificationTypeType; timeout: number; }; type NotificationsProps = { notifications: NotificationType[]; }; declare function Notifications({ notifications }: NotificationsProps): react_jsx_runtime.JSX.Element; type NotificationsContextType = { notifications: NotificationType[]; addNotification: (message: string, type?: NotificationTypeType, timeout?: number) => string; removeNotification: (id: string) => void; }; type NotificationsContextProviderProps = { children: ReactNode; }; declare const NotificationsContext: react.Context<NotificationsContextType>; declare function NotificationsContextProvider({ children, }: NotificationsContextProviderProps): react_jsx_runtime.JSX.Element; export { NotificationTypes, Notifications, NotificationsContext, NotificationsContextProvider }; export type { NotificationType, NotificationTypeType };