UNPKG

@spark-web/alert

Version:

--- title: Alert storybookPath: feedback-overlays-alert--info isExperimentalPackage: true ---

41 lines (40 loc) 2.12 kB
import type { IconProps } from '@spark-web/icon'; import type { DataAttributeMap } from '@spark-web/utils/internal'; import type { AriaRole, ReactElement, ReactNode } from 'react'; declare const toneToIcon: { caution: import("react").ForwardRefExoticComponent<IconProps & import("react").RefAttributes<SVGSVGElement>>; critical: import("react").ForwardRefExoticComponent<IconProps & import("react").RefAttributes<SVGSVGElement>>; info: import("react").ForwardRefExoticComponent<IconProps & import("react").RefAttributes<SVGSVGElement>>; positive: import("react").ForwardRefExoticComponent<IconProps & import("react").RefAttributes<SVGSVGElement>>; }; type AlertTones = keyof typeof toneToIcon; type IconWithRef = (typeof toneToIcon)[AlertTones]; type IconWithWithoutRef = (props: IconProps) => ReactElement; export type AlertProps = { /** The body content of the alert. */ children: ReactNode; /** Sets data attributes on the component. */ data?: DataAttributeMap; /** Sets a heading for the alert. */ heading?: string; /** Optionally provide a custom icon to be used instead of the default icon. */ icon?: IconWithRef | IconWithWithoutRef; /** Optionally provide custom content to render instead of an icon (e.g., Lottie animation). Takes precedence over the icon prop. */ customIcon?: ReactNode; /** Sets a unique indentifier on the component. */ id?: string; /** Sets the tone of the alert. */ tone: AlertTones; /** Sets the tone of the alert. */ role?: AriaRole | 'none'; } & ({ /** Sets a label for the close button if the close icon button is present. */ closeLabel: string; /** Sets a callback function when the alert close icon button is pressed. If the onClose function is not defined, the close icon button will not be rendered on the alert component. */ onClose: () => void; } | { closeLabel?: never; onClose?: never; }); export declare function Alert({ children, closeLabel, data, heading, icon, customIcon, onClose, tone, role, }: AlertProps): import("@emotion/react/jsx-runtime").JSX.Element; export {};