import { ComputedRef, InjectionKey } from 'vue'; import { OnyxButtonProps } from '../OnyxButton/types.js'; import { OnyxNotificationMessageProps } from '../OnyxNotificationMessage/types.js'; export type NotificationsProvider = { /** * Readonly list of currently active notifications. */ notifications: ComputedRef; /** * Shows a single notification. * @returns the id of the newly created notification. */ show: (notification: ShowNotificationOptions) => number; /** * Removes the notification with the given `id`. */ remove: (id: ProvidedNotification["id"]) => void; }; export type ProvidedNotification = ShowNotificationOptions & { /** * Unique notification id used to identify the notification. */ id: number; /** * Handler that should remove the notification. Will be called when the notification closes. * Is only used for internal onyx usage. */ onClose: () => void; }; export type ShowNotificationOptions = OnyxNotificationMessageProps & { /** * Description/preview of the notification content. */ description: string; /** * Slot to provide optional buttons/actions. */ buttons?: (OnyxButtonProps & { /** * Callback that is called when the button is clicked. */ onClick?: () => void; })[]; }; export declare const NOTIFICATIONS_PROVIDER_INJECTION_KEY: InjectionKey; /** * Creates a new notifications provider that can be used with `useNotification()`. * Should be provided once on global app level with: * * @example * ```ts * import { createNotificationsProvider, NOTIFICATIONS_PROVIDER_INJECTION_KEY } from "sit-onyx"; * * app.provide(NOTIFICATIONS_PROVIDER_INJECTION_KEY, createNotificationsProvider()); * ``` */ export declare const createNotificationsProvider: () => NotificationsProvider; /** * Composable for showing notifications. */ export declare const useNotification: () => NotificationsProvider;