UNPKG

@momentum-ui/react-collaboration

Version:

Cisco Momentum UI Framework for React Collaboration Applications

43 lines (42 loc) 2.14 kB
import { ToastContent, Id } from 'react-toastify'; import type { AttentionType, NotifyOptionsType, UpdateOptionsType } from './NotificationSystem.types'; /** * Generates the container id for the notifications to be placed in * @param id identifier for container * @param attention attention type of container * @returns the generated id */ export declare const getContainerID: (id: string, attention: AttentionType) => string; /** * Calculates the autoClose value, based on the passed in NotifyOptions * @param options notify options, which will decide about what value the autoClose will have * @returns a number or false, depended on the passed in options */ export declare const calculateAutoClose: (options: NotifyOptionsType) => number | false; /** * **notify** utility function, to trigger a notification with the provided `content` * in the defined notification system (`notificationSystemId`) * Other options are `attention`, `autoClose`, `toastId` (if u want to define a fixed toastId) * and more * @param content content to render in the Notification (React.ReactNode) * @param options several options to pass in (for details check type) * @returns the toastId of the triggered notification */ export declare const notify: (content: ToastContent, options: NotifyOptionsType) => Id; /** * **update** utility function, to update an existing notification in the defined notification system (`notificationSystemId`) * Other update options are `render` (to update the content), `autoClose`, `attention` and more * @param toastId id of the notification to update * @param options several options to pass in (for details check type) */ export declare const update: (toastId: Id, options: UpdateOptionsType) => void; /** * **dismiss** utility function, to dismiss an existing notification * @param toastId id of the notification to dismiss */ export declare const dismiss: (toastId: Id) => void; /** * **isActive** utility function, which returns true if notification is currently active (=shown) * @param toastId id of the notification to check for */ export declare const isActive: (toastId: Id) => boolean;