UNPKG

2.31 kBTypeScriptView Raw
1/// <reference types="react" />
2import { AbstractPureComponent2 } from "../../common";
3import { IProps } from "../../common/props";
4import { IPanel } from "./panelProps";
5export interface IPanelStackProps extends IProps {
6 /**
7 * The initial panel to show on mount. This panel cannot be removed from the
8 * stack and will appear when the stack is empty.
9 * This prop is only used in uncontrolled mode and is thus mutually
10 * exclusive with the `stack` prop.
11 */
12 initialPanel?: IPanel<any>;
13 /**
14 * Callback invoked when the user presses the back button or a panel invokes
15 * the `closePanel()` injected prop method.
16 */
17 onClose?: (removedPanel: IPanel) => void;
18 /**
19 * Callback invoked when a panel invokes the `openPanel(panel)` injected
20 * prop method.
21 */
22 onOpen?: (addedPanel: IPanel) => void;
23 /**
24 * If false, PanelStack will render all panels in the stack to the DOM, allowing their
25 * React component trees to maintain state as a user navigates through the stack.
26 * Panels other than the currently active one will be invisible.
27 *
28 * @default true
29 */
30 renderActivePanelOnly?: boolean;
31 /**
32 * Whether to show the header with the "back" button in each panel.
33 *
34 * @default true
35 */
36 showPanelHeader?: boolean;
37 /**
38 * The full stack of panels in controlled mode. The last panel in the stack
39 * will be displayed.
40 */
41 stack?: Array<IPanel<any>>;
42}
43export interface IPanelStackState {
44 /** Whether the stack is currently animating the push or pop of a panel. */
45 direction: "push" | "pop";
46 /** The current stack of panels. The first panel in the stack will be displayed. */
47 stack: IPanel[];
48}
49/**
50 * Panel stack component.
51 *
52 * @see https://blueprintjs.com/docs/#core/components/panel-stack
53 * @deprecated use `PanelStack2<T>`
54 */
55export declare class PanelStack extends AbstractPureComponent2<IPanelStackProps, IPanelStackState> {
56 state: IPanelStackState;
57 componentDidUpdate(prevProps: IPanelStackProps, prevState: IPanelStackState): void;
58 render(): JSX.Element;
59 protected validateProps(props: IPanelStackProps): void;
60 private renderPanels;
61 private renderPanel;
62 private handlePanelClose;
63 private handlePanelOpen;
64}