UNPKG

@atlaskit/editor-core

Version:

A package contains Atlassian editor core functionality

46 lines (45 loc) 1.34 kB
/// <reference types="react" /> import { PureComponent } from 'react'; import { Position } from './utils'; export interface Props { alignX?: 'left' | 'right'; alignY?: 'top' | 'bottom'; target?: HTMLElement; fitHeight?: number; fitWidth?: number; boundariesElement?: HTMLElement; mountTo?: HTMLElement; offset?: number[]; onPositionCalculated?: (position: Position) => Position; onPlacementChanged?: (placement: [string, string]) => void; } export interface State { popup?: HTMLElement; position?: Position; overflowScrollParent: HTMLElement | false; } export default class Popup extends PureComponent<Props, State> { static defaultProps: { offset: number[]; boundariesElement: HTMLElement; }; state: State; private debounced; private placement; /** * Calculates new popup position */ private updatePosition(props, popup?); /** * Popup initialization. * Checks whether it's possible to position popup along given target, and if it's not throws an error. */ private initPopup(popup); private handleRef; private handleResize; componentWillReceiveProps(newProps: Props): void; componentDidMount(): void; componentWillUnmount(): void; private renderPopup(); render(): JSX.Element | null; }