react-elegant-ui
Version:
Elegant UI components, made by BEM best practices for react
65 lines (64 loc) • 1.96 kB
TypeScript
import { RefObject, ReactNode, FC, CSSProperties, ReactElement, Ref, MouseEventHandler } from 'react';
import { IComponentHTMLElement } from '../../types/IComponent';
import { OnClose } from '../LayerManager/LayerManager';
import './Popup.css';
export interface IPopupProps extends IComponentHTMLElement<HTMLDivElement> {
visible?: boolean;
/**
* Ref on DOM element to render popup there
*
* This element should have `position: relative`
*
* If your block have `overflow hidden`, use external container to render popup to prevent clipping
*/
scope?: RefObject<HTMLElement>;
/**
* Don't unmount non-visible component
*/
keepMounted?: boolean;
/**
* Option that determines whether to render the tail or not
*/
hasTail?: boolean;
tailRef?: Ref<HTMLDivElement>;
style?: CSSProperties;
zIndex?: number;
/**
* Popup content
*
* You can give a special function who take `tailRef`
*/
children?: ReactNode | ((props: {
tailRef?: Ref<HTMLDivElement>;
}) => ReactNode);
addonBefore?: ReactNode;
addonAfter?: ReactNode;
onClick?: MouseEventHandler<HTMLDivElement>;
/**
* Handler of close by esc key or click outside of popup
*/
onClose?: OnClose;
/**
* Function that call while render tail
* Call independent of `hasTail`
*/
UNSTABLE_onRenderTail?: (tail: ReactElement) => ReactElement;
/**
* Array of Refs to DOM nodes who should not handle interactions to close
*
* @internal
*/
essentialRefs?: RefObject<HTMLElement>[];
/**
* DOM node that should not handle interactions to close
*
* @internal
*/
hostRef?: RefObject<HTMLElement>;
}
export declare const cnPopup: import("@bem-react/classname").ClassNameFormatter;
/**
* Component to make pop-up windows
* @param {IPopupProps} props
*/
export declare const Popup: FC<IPopupProps>;