@douyinfe/semi-ui
Version:
A modern, comprehensive, flexible design system and UI library. Connect DesignOps & DevOps. Quickly build beautiful React apps. Maintained by Douyin-fe team.
103 lines (102 loc) • 4.41 kB
TypeScript
import React from 'react';
import PropTypes from 'prop-types';
import { ContextValue } from '../configProvider/context';
import Tooltip, { ArrowBounding, Position, TooltipProps, Trigger, RenderContentProps } from '../tooltip/index';
import '@douyinfe/semi-foundation/lib/cjs/popover/popover.css';
import { BaseProps } from '../_base/baseComponent';
import type { ArrowProps } from './Arrow';
export type { ArrowProps };
declare interface ArrowStyle {
borderColor?: string;
backgroundColor?: string;
borderOpacity?: string | number;
}
export interface PopoverProps extends BaseProps {
autoAdjustOverflow?: boolean;
children?: React.ReactNode;
content?: TooltipProps['content'];
visible?: boolean;
position?: Position;
motion?: boolean;
margin?: TooltipProps['margin'];
mouseEnterDelay?: number;
mouseLeaveDelay?: number;
trigger?: Trigger;
contentClassName?: string | any[];
onVisibleChange?: (visible: boolean) => void;
onClickOutSide?: (e: React.MouseEvent) => void;
showArrow?: boolean;
spacing?: number | {
x: number;
y: number;
};
stopPropagation?: boolean | string;
arrowStyle?: ArrowStyle;
arrowBounding?: ArrowBounding;
arrowPointAtCenter?: boolean;
prefixCls?: string;
rePosKey?: string | number;
getPopupContainer?: () => HTMLElement;
zIndex?: number;
closeOnEsc?: TooltipProps['closeOnEsc'];
guardFocus?: TooltipProps['guardFocus'];
returnFocusOnClose?: TooltipProps['returnFocusOnClose'];
onEscKeyDown?: TooltipProps['onEscKeyDown'];
clickToHide?: TooltipProps['clickToHide'];
disableFocusListener?: boolean;
afterClose?: () => void;
keepDOM?: boolean;
}
export interface PopoverState {
popConfirmVisible: boolean;
}
declare class Popover extends React.PureComponent<PopoverProps, PopoverState> {
static contextType: React.Context<ContextValue>;
static propTypes: {
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
content: PropTypes.Requireable<NonNullable<PropTypes.ReactNodeLike | ((...args: any[]) => any)>>;
visible: PropTypes.Requireable<boolean>;
autoAdjustOverflow: PropTypes.Requireable<boolean>;
motion: PropTypes.Requireable<boolean>;
position: PropTypes.Requireable<"left" | "top" | "right" | "bottom" | "topLeft" | "topRight" | "leftTop" | "leftBottom" | "rightTop" | "rightBottom" | "bottomLeft" | "bottomRight" | "leftTopOver" | "rightTopOver">;
margin: PropTypes.Requireable<NonNullable<number | object>>;
mouseEnterDelay: PropTypes.Requireable<number>;
mouseLeaveDelay: PropTypes.Requireable<number>;
trigger: PropTypes.Validator<NonNullable<"hover" | "focus" | "click" | "custom" | "contextMenu">>;
contentClassName: PropTypes.Requireable<NonNullable<string | any[]>>;
onVisibleChange: PropTypes.Requireable<(...args: any[]) => any>;
onClickOutSide: PropTypes.Requireable<(...args: any[]) => any>;
style: PropTypes.Requireable<object>;
spacing: PropTypes.Requireable<NonNullable<number | object>>;
zIndex: PropTypes.Requireable<number>;
showArrow: PropTypes.Requireable<boolean>;
arrowStyle: PropTypes.Requireable<PropTypes.InferProps<{
borderColor: PropTypes.Requireable<string>;
backgroundColor: PropTypes.Requireable<string>;
borderOpacity: PropTypes.Requireable<NonNullable<string | number>>;
}>>;
arrowPointAtCenter: PropTypes.Requireable<boolean>;
arrowBounding: PropTypes.Requireable<object>;
prefixCls: PropTypes.Requireable<string>;
guardFocus: PropTypes.Requireable<boolean>;
disableArrowKeyDown: PropTypes.Requireable<boolean>;
};
static __SemiComponentName__: string;
static defaultProps: any;
context: ContextValue;
tooltipRef: React.RefObject<Tooltip | null>;
constructor(props: PopoverProps);
/**
* focus on tooltip trigger
*/
focusTrigger: () => void;
renderPopCard: ({ initialFocusRef }: {
initialFocusRef: RenderContentProps['initialFocusRef'];
}) => React.JSX.Element;
renderContentNode: (props: {
content: TooltipProps['content'];
initialFocusRef: RenderContentProps['initialFocusRef'];
}) => React.ReactNode;
render(): React.JSX.Element;
}
export default Popover;