UNPKG

2.31 kBTypeScriptView Raw
1import * as React from "react";
2import { AbstractPureComponent2 } from "../../common";
3import { ButtonProps } from "../button/buttons";
4import { DialogProps } from "./dialog";
5import { DialogStepId, DialogStepButtonProps } from "./dialogStep";
6export declare type MultistepDialogProps = IMultistepDialogProps;
7/** @deprecated use MultistepDialogProps */
8export interface IMultistepDialogProps extends DialogProps {
9 /**
10 * Props for the back button.
11 */
12 backButtonProps?: DialogStepButtonProps;
13 /**
14 * Props for the button to display on the final step.
15 */
16 finalButtonProps?: Partial<ButtonProps>;
17 /**
18 * Props for the next button.
19 */
20 nextButtonProps?: DialogStepButtonProps;
21 /**
22 * A callback that is invoked when the user selects a different step by clicking on back, next, or a step itself.
23 */
24 onChange?(newDialogStepId: DialogStepId, prevDialogStepId: DialogStepId | undefined, event: React.MouseEvent<HTMLElement>): void;
25 /**
26 * Whether to reset the dialog state to its initial state on close.
27 * By default, closing the dialog will reset its state.
28 *
29 * @default true
30 */
31 resetOnClose?: boolean;
32 /**
33 * A 0 indexed initial step to start off on, to start in the middle of the dialog, for example.
34 * If the provided index exceeds the number of steps, it defaults to the last step.
35 * If a negative index is provided, it defaults to the first step.
36 */
37 initialStepIndex?: number;
38}
39interface IMultistepDialogState {
40 lastViewedIndex: number;
41 selectedIndex: number;
42}
43export declare class MultistepDialog extends AbstractPureComponent2<MultistepDialogProps, IMultistepDialogState> {
44 static displayName: string;
45 static defaultProps: Partial<MultistepDialogProps>;
46 state: IMultistepDialogState;
47 render(): JSX.Element;
48 componentDidUpdate(prevProps: MultistepDialogProps): void;
49 private getDialogStyle;
50 private renderLeftPanel;
51 private renderDialogStep;
52 private handleClickDialogStep;
53 private maybeRenderRightPanel;
54 private renderFooter;
55 private renderButtons;
56 private getDialogStepChangeHandler;
57 /** Filters children to only `<DialogStep>`s */
58 private getDialogStepChildren;
59 private getInitialIndexFromProps;
60}
61export {};