import { NotificationProps } from '@mantine/core'; import { MantineStore } from '@mantine/store'; export type NotificationPosition = 'top-left' | 'top-right' | 'top-center' | 'bottom-left' | 'bottom-right' | 'bottom-center'; export interface NotificationData extends Omit, Record<`data-${string}`, any> { /** Notification id, can be used to close or update notification */ id?: string; /** Position of the notification, if not set, the position is determined based on `position` prop on Notifications component */ position?: NotificationPosition; /** Notification message, required for all notifications */ message: React.ReactNode; /** Display priority. Higher numbers are shown before lower ones when the number of * active notifications exceeds `limit`. Notifications with equal priority keep insertion * order (FIFO). @default 0 */ priority?: number; /** Determines whether notification should be closed automatically, * number is auto close timeout in ms, overrides `autoClose` from `Notifications` * */ autoClose?: boolean | number; /** Determines whether notification can be closed with close button, drag or horizontal scroll swipe, `true` by default */ allowClose?: boolean; /** Determines whether a progress line that fills up until the notification auto closes is displayed at the bottom of the notification, overrides `withAutoCloseProgress` from `Notifications` */ withAutoCloseProgress?: boolean; /** Called when notification closes */ onClose?: (props: NotificationData) => void; /** Called when notification opens */ onOpen?: (props: NotificationData) => void; /** Custom render function that replaces the default notification, overrides `renderNotification` from `Notifications`. Set to `null` to use default rendering when a global `renderNotification` is set. */ renderNotification?: ((notification: NotificationData) => React.ReactNode) | null; } export interface NotificationsState { notifications: NotificationData[]; queue: NotificationData[]; defaultPosition: NotificationPosition; limit: number; } export type NotificationsStore = MantineStore; export interface SequencedNotificationData extends NotificationData { __sequence?: number; } export declare const createNotificationsStore: () => MantineStore; export declare const notificationsStore: MantineStore; export declare const useNotifications: (store?: NotificationsStore) => NotificationsState; export declare function updateNotificationsState(store: NotificationsStore, update: (notifications: NotificationData[]) => NotificationData[]): void; export declare function showNotification(notification: NotificationData, store?: NotificationsStore): string; export declare function hideNotification(id: string, store?: NotificationsStore): string; export declare function updateNotification(notification: NotificationData, store?: NotificationsStore): string | undefined; export type PromiseNotificationData = Omit; export interface PromiseNotificationOptions { /** Notification id, used for all three states, by default `id` is randomly generated */ id?: string; /** Notification displayed while the promise is pending, `loading: true` and `autoClose: false` are applied by default */ loading: PromiseNotificationData; /** Notification displayed when the promise resolves, `color: 'teal'` is applied by default. Function receives the resolved value. */ success: PromiseNotificationData | ((value: T) => PromiseNotificationData); /** Notification displayed when the promise rejects, `color: 'red'` is applied by default. Function receives the rejection reason. */ error: PromiseNotificationData | ((error: unknown) => PromiseNotificationData); } export declare function promiseNotification(promise: Promise, options: PromiseNotificationOptions, store?: NotificationsStore): Promise; export declare function cleanNotifications(store?: NotificationsStore): void; export declare function cleanNotificationsQueue(store?: NotificationsStore): void; export declare const notifications: { readonly show: typeof showNotification; readonly hide: typeof hideNotification; readonly update: typeof updateNotification; readonly promise: typeof promiseNotification; readonly clean: typeof cleanNotifications; readonly cleanQueue: typeof cleanNotificationsQueue; readonly updateState: typeof updateNotificationsState; };