@spark-web/alert
Version:
--- title: Alert storybookPath: feedback-overlays-alert--info isExperimentalPackage: true ---
37 lines (36 loc) • 1.84 kB
TypeScript
import type { IconProps } from '@spark-web/icon';
import type { DataAttributeMap } from '@spark-web/utils/internal';
import type { 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>>;
};
declare type AlertTones = keyof typeof toneToIcon;
declare type IconWithRef = typeof toneToIcon[AlertTones];
declare type IconWithWithoutRef = (props: IconProps) => JSX.Element;
export declare 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;
/** Sets a unique indentifier on the component. */
id?: string;
/** Sets the tone of the alert. */
tone: AlertTones;
} & ({
/** 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, onClose, tone, }: AlertProps): JSX.Element;
export {};