UNPKG

1.82 kBTypeScriptView Raw
1import * as React from "react";
2import { ValidationMap } from "../../common/context";
3import { Props } from "../../common/props";
4export declare type PortalProps = IPortalProps;
5/** @deprecated use PortalProps */
6export interface IPortalProps extends Props {
7 /** Contents to send through the portal. */
8 children: React.ReactNode;
9 /**
10 * Callback invoked when the children of this `Portal` have been added to the DOM.
11 */
12 onChildrenMount?: () => void;
13 /**
14 * The HTML element that children will be mounted to.
15 *
16 * @default document.body
17 */
18 container?: HTMLElement;
19}
20export interface IPortalState {
21 hasMounted: boolean;
22}
23/** @deprecated use PortalLegacyContext */
24export declare type IPortalContext = PortalLegacyContext;
25export interface PortalLegacyContext {
26 /** Additional CSS classes to add to all `Portal` elements in this React context. */
27 blueprintPortalClassName?: string;
28}
29/**
30 * Portal component.
31 *
32 * This component detaches its contents and re-attaches them to document.body.
33 * Use it when you need to circumvent DOM z-stacking (for dialogs, popovers, etc.).
34 * Any class names passed to this element will be propagated to the new container element on document.body.
35 *
36 * @see https://blueprintjs.com/docs/#core/components/portal
37 */
38export declare class Portal extends React.Component<PortalProps, IPortalState> {
39 static displayName: string;
40 static contextTypes: ValidationMap<PortalLegacyContext>;
41 static defaultProps: Partial<PortalProps>;
42 context: PortalLegacyContext;
43 state: IPortalState;
44 private portalElement;
45 render(): React.ReactPortal | null;
46 componentDidMount(): void;
47 componentDidUpdate(prevProps: PortalProps): void;
48 componentWillUnmount(): void;
49 private createContainerElement;
50}