1 | import * as React from "react";
|
2 | import { AbstractPureComponent2 } from "../../common";
|
3 | import { ActionProps, IntentProps, LinkProps, Props, MaybeElement } from "../../common/props";
|
4 | import { IconName } from "../icon/icon";
|
5 | export declare type ToastProps = IToastProps;
|
6 | export interface IToastProps extends Props, IntentProps {
|
7 | /**
|
8 | * Action rendered as a minimal `AnchorButton`. The toast is dismissed automatically when the
|
9 | * user clicks the action button. Note that the `intent` prop is ignored (the action button
|
10 | * cannot have its own intent color that might conflict with the toast's intent). Omit this
|
11 | * prop to omit the action button.
|
12 | */
|
13 | action?: ActionProps & LinkProps;
|
14 | /** Name of a Blueprint UI icon (or an icon element) to render before the message. */
|
15 | icon?: IconName | MaybeElement;
|
16 | /** Message to display in the body of the toast. */
|
17 | message: React.ReactNode;
|
18 | /**
|
19 | * Callback invoked when the toast is dismissed, either by the user or by the timeout.
|
20 | * The value of the argument indicates whether the toast was closed because the timeout expired.
|
21 | */
|
22 | onDismiss?: (didTimeoutExpire: boolean) => void;
|
23 | /**
|
24 | * Milliseconds to wait before automatically dismissing toast.
|
25 | * Providing a value less than or equal to 0 will disable the timeout (this is discouraged).
|
26 | *
|
27 | * @default 5000
|
28 | */
|
29 | timeout?: number;
|
30 | }
|
31 | export declare class Toast extends AbstractPureComponent2<IToastProps> {
|
32 | static defaultProps: IToastProps;
|
33 | static displayName: string;
|
34 | render(): JSX.Element;
|
35 | componentDidMount(): void;
|
36 | componentDidUpdate(prevProps: IToastProps): void;
|
37 | componentWillUnmount(): void;
|
38 | private maybeRenderActionButton;
|
39 | private handleActionClick;
|
40 | private handleCloseClick;
|
41 | private triggerDismiss;
|
42 | private startTimeout;
|
43 | }
|