UNPKG

3.38 kBTypeScriptView Raw
1import * as React from "react";
2import { AbstractPureComponent2 } from "../../common";
3import { Position } from "../../common/position";
4import { Props, MaybeElement } from "../../common/props";
5import { IconName } from "../icon/icon";
6import { IBackdropProps, OverlayableProps } from "../overlay/overlay";
7export declare enum DrawerSize {
8 SMALL = "360px",
9 STANDARD = "50%",
10 LARGE = "90%"
11}
12export declare type DrawerProps = IDrawerProps;
13/** @deprecated use DrawerProps */
14export interface IDrawerProps extends OverlayableProps, IBackdropProps, Props {
15 /**
16 * Name of a Blueprint UI icon (or an icon element) to render in the
17 * drawer's header. Note that the header will only be rendered if `title` is
18 * provided.
19 */
20 icon?: IconName | MaybeElement;
21 /**
22 * Whether to show the close button in the dialog's header.
23 * Note that the header will only be rendered if `title` is provided.
24 *
25 * @default true
26 */
27 isCloseButtonShown?: boolean;
28 /**
29 * Toggles the visibility of the overlay and its children.
30 * This prop is required because the component is controlled.
31 */
32 isOpen: boolean;
33 /**
34 * Position of a drawer. All angled positions will be casted into pure positions
35 * (TOP, BOTTOM, LEFT or RIGHT).
36 *
37 * @default Position.RIGHT
38 */
39 position?: Position;
40 /**
41 * Whether the application should return focus to the last active element in the
42 * document after this drawer closes.
43 *
44 * @default true
45 */
46 shouldReturnFocusOnClose?: boolean;
47 /**
48 * CSS size of the drawer. This sets `width` if `vertical={false}` (default)
49 * and `height` otherwise.
50 *
51 * Constants are available for common sizes:
52 * - `DrawerSize.SMALL = 360px`
53 * - `DrawerSize.STANDARD = 50%`
54 * - `DrawerSize.LARGE = 90%`
55 *
56 * @default DrawerSize.STANDARD = "50%"
57 */
58 size?: number | string;
59 /**
60 * CSS styles to apply to the dialog.
61 *
62 * @default {}
63 */
64 style?: React.CSSProperties;
65 /**
66 * Title of the dialog. If provided, an element with `Classes.DIALOG_HEADER`
67 * will be rendered inside the dialog before any children elements.
68 */
69 title?: React.ReactNode;
70 /**
71 * Name of the transition for internal `CSSTransition`. Providing your own
72 * name here will require defining new CSS transition properties.
73 */
74 transitionName?: string;
75 /**
76 * Whether the drawer should appear with vertical styling.
77 * It will be ignored if `position` prop is set
78 *
79 * @default false
80 * @deprecated use `position` instead
81 */
82 vertical?: boolean;
83}
84export declare class Drawer extends AbstractPureComponent2<DrawerProps> {
85 static displayName: string;
86 static defaultProps: DrawerProps;
87 /** @deprecated use DrawerSize.SMALL */
88 static readonly SIZE_SMALL = DrawerSize.SMALL;
89 /** @deprecated use DrawerSize.STANDARD */
90 static readonly SIZE_STANDARD = DrawerSize.STANDARD;
91 /** @deprecated use DrawerSize.LARGE */
92 static readonly SIZE_LARGE = DrawerSize.LARGE;
93 private lastActiveElementBeforeOpened;
94 render(): JSX.Element;
95 protected validateProps(props: DrawerProps): void;
96 private maybeRenderCloseButton;
97 private maybeRenderHeader;
98 private handleOpening;
99 private handleClosed;
100}