import { BasePlugin } from '../base'; import { type NotificationPosition, type NotificationVariant } from './constants'; export type { NotificationPosition, NotificationVariant } from './constants'; export interface NotificationAction { label: string; type?: 'primary' | 'secondary'; callback: () => void; } export interface NotificationMessageOptions { variant?: NotificationVariant; title?: string; message: string | HTMLElement; duration?: number; position?: NotificationPosition; closable?: boolean; actions?: NotificationAction[]; } export interface NotificationNormalizedOptions { id: string; variant: NotificationVariant; title?: string; message: string | HTMLElement; duration: number; position: NotificationPosition; closable: boolean; actions: NotificationAction[]; } export interface NotificationConfig { stackLimit?: number; animation?: boolean; } export declare const PLUGIN_KEY = "notification"; export declare const PLUGIN_PRIORITY = 375; /** * @typedef {object} NotificationActionSpec * @property {string} label Text shown on the button. * @property {'primary'|'secondary'} [type] Visual style. Omit for secondary. * @property {function(): void} callback Invoked when the button is activated. */ /** * @plugin Notification * @class Notification * * @description * The Notification plugin shows non-blocking toast messages anchored to the Handsontable root. * Enable it with the {@link Options#notification} option. Toasts are exposed to assistive technologies with * `aria-live` and do not take keyboard focus when they appear; use **F6** to move focus into the notification region * for the grid that currently contains keyboard focus (with several instances on one page, each grid only handles **F6** * for its own focus scope, except when a single grid is on the page and focus is outside every grid). * **Tab** / **Shift+Tab** between controls, **Escape** to leave, and programmatic `hide` restores focus like **Escape** * when the last toast closes while focus is in the region. * * @example * ```js * const hot = new Handsontable(container, { * data: data, * notification: true, * licenseKey: 'non-commercial-and-evaluation', * }); * const notification = hot.getPlugin('notification'); * notification.showMessage({ message: 'Saved.' }); * ``` */ export declare class Notification extends BasePlugin { #private; /** * Returns the plugin key used to identify this plugin in Handsontable settings. */ static get PLUGIN_KEY(): string; /** * Returns the priority order used to determine the order in which plugins are initialized. */ static get PLUGIN_PRIORITY(): number; /** * Returns the default settings applied when the plugin is enabled without explicit configuration. */ static get DEFAULT_SETTINGS(): { stackLimit: number; animation: boolean; }; /** * Returns an object of validator functions used to type-check each settings property at runtime. */ static get SETTINGS_VALIDATORS(): { stackLimit: (value: unknown) => boolean; animation: (value: unknown) => value is boolean; }; /** * Returns whether the `notification` setting is enabled for this instance. * * @returns {boolean} */ isEnabled(): boolean; /** * Installs the notification host, document `focusin` listener (tab order + prior-focus for click paths), shortcuts * (**F6** via grid + global shortcut contexts, Escape, Tab, Shift+Tab), and the focus scope. */ enablePlugin(): void; /** * Rebuilds the plugin after settings change when notification options actually change. * * @param {object} [newSettings] Settings object passed to `updateSettings` (partial). */ updatePlugin(newSettings?: object): void; /** * Hides all toasts, removes shortcuts and listeners, and destroys the UI host. * * `hideAll()` must run before `super.disablePlugin()` because `BasePlugin.disablePlugin()` clears * `this.enabled` first, and `hideAll()` relies on the plugin still being enabled. The superclass * call then removes hooks and clears the shared `EventManager`. */ disablePlugin(): void; /** * Displays a toast. Returns the toast id, or an empty string when the toast is not shown. * * @param {object} options Toast options. * @param {'info' | 'success' | 'warning' | 'error'} [options.variant] Visual variant. * @param {string} [options.title] Optional title. * @param {string | HTMLElement} options.message Main message body. * @param {number} [options.duration] Auto-dismiss delay in ms. `0` keeps the toast until dismissed manually. * @param {'top-start' | 'top-end' | 'bottom-start' | 'bottom-end'} [options.position] Corner stack. * @param {boolean} [options.closable] Whether the close control is shown. * @param {NotificationActionSpec[]} [options.actions] Action buttons. * @returns {string} * @throws {Error} When `options` is invalid or actions are malformed. */ showMessage(options: NotificationMessageOptions): string; /** * Hides a toast by id. * * @param {string} id Toast id returned from {@link Notification#showMessage}. */ hide(id: string): void; /** * Hides every visible toast and clears all per-position queues. */ hideAll(): void; /** * Returns whether a toast is visible, or whether any toast is visible when `id` is omitted. * * @param {string} [id] Toast id. * @returns {boolean} */ isVisible(id?: string): boolean; /** * Returns how many toasts are waiting in per-position queues. * * @returns {number} */ getQueueSize(): number; /** * Clears queues and toast state, unregisters shortcuts and focus scope, and removes the host from the DOM. */ destroy(): void; }