@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.
40 lines (39 loc) • 1.53 kB
TypeScript
import React, { PureComponent } from 'react';
import PropTypes from 'prop-types';
import { ContextValue } from '../configProvider/context';
import '@douyinfe/semi-foundation/lib/cjs/_portal/portal.css';
export interface PortalProps {
children: React.ReactNode;
style?: React.CSSProperties;
prefixCls?: string;
className?: string;
getPopupContainer?: () => HTMLElement;
didUpdate?: (props: PortalProps) => void;
}
export interface PortalState {
container: undefined | HTMLElement;
}
declare class Portal extends PureComponent<PortalProps, PortalState> {
static contextType: React.Context<ContextValue>;
static defaultProps: {
prefixCls: string;
};
static propTypes: {
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
prefixCls: PropTypes.Requireable<string>;
getPopupContainer: PropTypes.Requireable<(...args: any[]) => any>;
className: PropTypes.Requireable<string>;
didUpdate: PropTypes.Requireable<(...args: any[]) => any>;
};
el: HTMLElement;
context: ContextValue;
constructor(props: PortalProps, context: ContextValue);
componentDidMount(): void;
initContainer: (context: ContextValue, catchError?: boolean) => HTMLElement;
componentDidUpdate(prevProps: PortalProps): void;
componentWillUnmount(): void;
addStyle: (style?: {}) => void;
addClass: (prefixCls: string, context?: ContextValue, ...classNames: string[]) => void;
render(): React.ReactPortal;
}
export default Portal;