UNPKG

4.86 kBTypeScriptView Raw
1import * as React from "react";
2import { AbstractPureComponent2 } from "../../common";
3import { IPopoverSharedProps } from "./popoverSharedProps";
4export declare const PopoverInteractionKind: {
5 CLICK: "click";
6 CLICK_TARGET_ONLY: "click-target";
7 HOVER: "hover";
8 HOVER_TARGET_ONLY: "hover-target";
9};
10export declare type PopoverInteractionKind = (typeof PopoverInteractionKind)[keyof typeof PopoverInteractionKind];
11/** @deprecated migrate to Popover2, use Popover2Props */
12export interface IPopoverProps extends IPopoverSharedProps {
13 /** HTML props for the backdrop element. Can be combined with `backdropClassName`. */
14 backdropProps?: React.HTMLProps<HTMLDivElement>;
15 /**
16 * The content displayed inside the popover. This can instead be provided as
17 * the _second_ element in `children` (first is `target`).
18 */
19 content?: string | JSX.Element;
20 /**
21 * Whether the wrapper and target should take up the full width of their container.
22 * Note that supplying `true` for this prop will force `targetTagName="div"` and
23 * `wrapperTagName="div"`.
24 */
25 fill?: boolean;
26 /**
27 * The kind of interaction that triggers the display of the popover.
28 *
29 * @default PopoverInteractionKind.CLICK
30 */
31 interactionKind?: PopoverInteractionKind;
32 /**
33 * Enables an invisible overlay beneath the popover that captures clicks and
34 * prevents interaction with the rest of the document until the popover is
35 * closed. This prop is only available when `interactionKind` is
36 * `PopoverInteractionKind.CLICK`. When popovers with backdrop are opened,
37 * they become focused.
38 *
39 * @default false
40 */
41 hasBackdrop?: boolean;
42 /**
43 * Whether the application should return focus to the last active element in the
44 * document after this popover closes.
45 *
46 * This is automatically set to `false` if this is a hover interaction popover.
47 *
48 * If you are attaching a popover _and_ a tooltip to the same target, you must take
49 * care to either disable this prop for the popover _or_ disable the tooltip's
50 * `openOnTargetFocus` prop.
51 *
52 * @default false
53 */
54 shouldReturnFocusOnClose?: boolean;
55 /**
56 * Ref supplied to the `Classes.POPOVER` element.
57 */
58 popoverRef?: React.Ref<HTMLElement>;
59 /**
60 * The target to which the popover content is attached. This can instead be
61 * provided as the _first_ element in `children`.
62 */
63 target?: string | JSX.Element;
64}
65export interface IPopoverState {
66 transformOrigin: string;
67 isOpen: boolean;
68 hasDarkParent: boolean;
69}
70/**
71 * Popover component.
72 *
73 * @see https://blueprintjs.com/docs/#core/components/popover
74 * @deprecated use { Popover2 } from "@blueprintjs/popover2"
75 */
76export declare class Popover extends AbstractPureComponent2<IPopoverProps, IPopoverState> {
77 static displayName: string;
78 private popoverRef;
79 static defaultProps: IPopoverProps;
80 /**
81 * DOM element that contains the popover.
82 * When `usePortal={true}`, this element will be portaled outside the usual DOM flow,
83 * so this reference can be very useful for testing.
84 */
85 popoverElement: HTMLElement | null;
86 /** DOM element that contains the target. */
87 targetElement: HTMLElement | null;
88 state: IPopoverState;
89 private cancelOpenTimeout?;
90 private isMouseInTargetOrPopover;
91 private lostFocusOnSamePage;
92 private popperScheduleUpdate?;
93 private handlePopoverRef;
94 private handleTargetRef;
95 render(): JSX.Element;
96 componentDidMount(): void;
97 componentDidUpdate(prevProps: IPopoverProps, prevState: IPopoverState): void;
98 /**
99 * Instance method to instruct the `Popover` to recompute its position.
100 *
101 * This method should only be used if you are updating the target in a way
102 * that does not cause it to re-render, such as changing its _position_
103 * without changing its _size_ (since `Popover` already repositions when it
104 * detects a resize).
105 */
106 reposition: () => void | undefined;
107 protected validateProps(props: IPopoverProps & {
108 children?: React.ReactNode;
109 }): void;
110 private updateDarkParent;
111 private renderPopover;
112 private renderTarget;
113 private understandChildren;
114 private isControlled;
115 private getIsOpen;
116 private getPopperModifiers;
117 private handleTargetFocus;
118 private handleTargetBlur;
119 private handleMouseEnter;
120 private handleMouseLeave;
121 private handlePopoverClick;
122 private handleOverlayClose;
123 private handleTargetClick;
124 private setOpenState;
125 private isArrowEnabled;
126 private isElementInPopover;
127 private isHoverInteractionKind;
128 /** Popper modifier that updates React state (for style properties) based on latest data. */
129 private updatePopoverState;
130}