UNPKG

2.46 kBPlain TextView Raw
1/*
2 * Copyright 2018 Palantir Technologies, Inc. All rights reserved.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17import * as React from "react";
18
19/* eslint-disable deprecation/deprecation */
20
21/**
22 * An object describing a panel in a `PanelStack`.
23 *
24 * @deprecated use `Panel<T>`
25 */
26// eslint-disable-next-line @typescript-eslint/ban-types
27export interface IPanel<P = {}> {
28 /**
29 * The component type to render for this panel. This must be a reference to
30 * the component class or SFC, _not_ a JSX element, so it can be re-created
31 * dynamically when needed.
32 */
33 component: React.ComponentType<P & IPanelProps>;
34
35 /**
36 * HTML title to be passed to the <Text> component
37 */
38 htmlTitle?: string;
39
40 /**
41 * The props passed to the component type when it is rendered. The methods
42 * in `IPanelProps` will be injected by `PanelStack`.
43 */
44 props?: P;
45
46 /**
47 * The title to be displayed above this panel. It is also used as the text
48 * of the back button for any panel opened by this panel.
49 */
50 title?: React.ReactNode;
51}
52
53/**
54 * Include this interface in your panel component's props type to access these
55 * two functions which are injected by `PanelStack`.
56 *
57 * ```tsx
58 * import { IPanelProps } from "@blueprintjs/core";
59 * export class SettingsPanel extends React.Component<IPanelProps & ISettingsPanelProps> {...}
60 * ```
61 *
62 * @deprecated use `PanelActions<T>`
63 */
64export interface IPanelProps {
65 /**
66 * Call this method to programatically close this panel. If this is the only
67 * panel on the stack then this method will do nothing.
68 *
69 * Remember that the panel header always contains a "back" button that
70 * closes this panel on click (unless there is only one panel on the stack).
71 */
72 closePanel(): void;
73
74 /**
75 * Call this method to open a new panel on the top of the stack.
76 */
77 openPanel<P>(panel: IPanel<P>): void;
78}