import type { Key, MouseEvent, ReactElement } from 'react'; import { AlertBannerSeverity } from '@mezzanine-ui/core/alert-banner'; import { IconDefinition } from '@mezzanine-ui/icons'; import { ButtonPropsBase } from '../Button'; import { Notifier, NotifierConfig, NotifierData } from '../Notifier'; import { NativeElementPropsWithoutKeyAndRef } from '../utils/jsx-types'; export interface AlertBannerAction extends Omit { /** * The text content of the button. */ content?: string; /** * Callback when the button is clicked. */ onClick: (event: MouseEvent) => void; } export type AlertBannerConfigProps = NotifierConfig; export interface AlertBannerData extends Omit, AlertBannerConfigProps { /** * The action buttons to be rendered on the right side of the banner. * Maximum 2 actions, minimum 0 (will not display if empty). */ actions?: AlertBannerAction[]; /** * Whether to show the close button. */ closable?: boolean; /** * @internal */ createdAt?: number; /** * Custom icon. Defaults to severity icon when omitted. */ icon?: IconDefinition; /** * Main message displayed in the banner. */ message: string; /** * Callback when the banner is closed. */ onClose?: () => void; /** * The key of alert banner. */ reference?: Key; /** * The severity of the banner. */ severity: AlertBannerSeverity; } export interface AlertBannerProps extends Omit, 'children' | 'title'> { /** * The action buttons to be rendered on the right side of the banner. * Maximum 2 actions, minimum 0 (will not display if empty). */ actions?: AlertBannerAction[]; /** * Whether to show the close button. */ closable?: boolean; /** * Disable portal rendering. Only used internally by grouped rendering. * @internal */ disablePortal?: boolean; /** * Custom icon. Defaults to severity icon when omitted. */ icon?: IconDefinition; /** * Main message displayed in the banner. */ message: string; /** * Callback when the banner is closed. */ onClose?: () => void; /** * The severity of the banner. */ severity: AlertBannerSeverity; } export type AlertBannerType = ((props: AlertBannerData) => ReactElement | null) & Notifier & Record & { key?: Key; }) => Key>; /** * 頁面層級的橫幅式警示訊息元件。 * * 預設透過 `Portal` 渲染至 `alert` layer,支援 `info`、`warning`、`error` 三種嚴重程度。 * 提供最多 2 個操作按鈕與關閉按鈕,並在顯示及關閉時套用進入/離開動畫。 * 也可透過靜態方法 `AlertBanner.info()`、`AlertBanner.warning()`、`AlertBanner.error()` 以命令式方式觸發。 * * @example * ```tsx * import AlertBanner from '@mezzanine-ui/react/AlertBanner'; * * // 基本用法(JSX) * * * // 帶有操作按鈕 * * * // 命令式呼叫 * AlertBanner.error('操作失敗,請稍後再試'); * AlertBanner.info('資料已更新', { closable: true }); * ``` * * @see {@link InlineMessage} 行內訊息元件 * @see {@link Message} 全域提示訊息元件 */ export declare const AlertBannerComponent: import("react").ForwardRefExoticComponent>; declare const AlertBanner: AlertBannerType; export default AlertBanner;