import { SvelteComponentTyped } from "svelte"; export type NotificationAction = { /** The action button text */ label: string; /** Called when the action is clicked. The toast then closes, unless the handler calls `event.preventDefault()`. */ onClick?: (event: MouseEvent) => void; /** Render the action as a link */ href?: string; }; export type NotificationData = { /** Optional id for deduplication */ id?: string; kind?: "error" | "info" | "info-square" | "success" | "warning" | "warning-alt"; title?: string; subtitle?: string; caption?: string; /** Ignored when the notification has an `action` or is `actionable` */ timeout?: number; lowContrast?: boolean; closeButtonDescription?: string; statusIconDescription?: string; hideCloseButton?: boolean; pauseOnHover?: boolean; role?: "alert" | "log" | "status"; fullWidth?: boolean; /** Render as an `alertdialog` that takes focus and closes on Escape */ actionable?: boolean; focusOnOpen?: boolean; closeOnEscape?: boolean; /** Add an action button. The toast keeps focus where it is and does not time out. */ action?: NotificationAction; }; export type QueuedNotification = NotificationData & { id: string, placeholder?: undefined }; export interface Placeholder { id?: undefined, placeholder: { height: number } } export type CarbonNotificationQueueContext = { paused: import("svelte/store").Writable; }; export type NotificationQueueProps = { /** * Specify the position of the notification queue. * @default "top-right" */ position?: "top-left" | "top-center" | "top-right" | "bottom-left" | "bottom-center" | "bottom-right"; /** * Specify the top offset (CSS value) * @default "3rem" */ offsetTop?: string; /** * Specify the bottom offset (CSS value) * @default "1rem" */ offsetBottom?: string; /** * Specify the left offset (CSS value) * @default "1rem" */ offsetLeft?: string; /** * Specify the right offset (CSS value) * @default "1rem" */ offsetRight?: string; /** * Specify the z-index of the notification queue. * By default, this matches the z-index of modals. * @default 9000 */ zIndex?: number; /** * Specify the maximum number of notifications to display. * When this limit is exceeded, the oldest notification is automatically removed. * Notifications without an `action` or `actionable` go first. * @default 3 */ maxNotifications?: number; /** * Specify the accessible name of the notifications landmark * @default "Notifications" */ labelText?: string; }; export default class NotificationQueue extends SvelteComponentTyped< NotificationQueueProps, Record, Record > { /** * Add a notification to the queue. * If a notification with the same id already exists, the call is ignored. * To change an existing notification in place, use `update`. * Returns the notification id (either the provided id or a generated one). */ add: (notification: NotificationData) => string; /** * Update an existing notification by id, merging `patch` into it. * The id of the notification cannot be changed. * Returns true if the notification was found and updated, false otherwise. */ update: (id: string, patch: Partial) => boolean; /** * Remove a notification by id. * Returns true if the notification was found and removed, false otherwise. */ remove: (id: string) => boolean; /** * Clear all notifications. */ clear: () => void; }