lucid-ui
Version:
A UI component library from AppNexus.
72 lines (71 loc) • 2.43 kB
TypeScript
import React from 'react';
import { StandardProps } from '../../util/component-types';
export interface IOverlayProps extends StandardProps, React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement> {
/** Controls visibility. */
isShown: boolean;
/** Enables animated transitions during expansion and collapse. */
isAnimated: boolean;
/** Determines if it shows with a gray background. If `false`, the
background will be rendered but will be invisible, except for the
contents, and it won't capture any of the user click events. */
isModal: boolean;
/** Set your own id for the \`Portal\` is that is opened up to contain the
contents. In practice you should never need to set this manually. */
portalId?: string;
/** Fired when the user hits escape. */
onEscape: ({ event, props, }: {
event: KeyboardEvent;
props: IOverlayProps;
}) => void;
/** Fired when the user clicks on the background, this may or may not be
visible depending on \`isModal\`. */
onBackgroundClick: ({ event, props, }: {
event: React.MouseEvent;
props: IOverlayProps;
}) => void;
}
interface IOverlayState {
portalId: string;
}
export declare const defaultProps: {
isShown: boolean;
isModal: boolean;
onEscape: (...args: any[]) => void;
onBackgroundClick: (...args: any[]) => void;
isAnimated: boolean;
};
declare class Overlay extends React.Component<IOverlayProps, IOverlayState, {}> {
static displayName: string;
static peek: {
description: string;
categories: string[];
madeFrom: string[];
};
static propTypes: {
className: any;
children: any;
isShown: any;
isAnimated: any;
isModal: any;
portalId: any;
onEscape: any;
onBackgroundClick: any;
};
private rootHTMLDivElement;
static defaultProps: {
isShown: boolean;
isModal: boolean;
onEscape: (...args: any[]) => void;
onBackgroundClick: (...args: any[]) => void;
isAnimated: boolean;
};
state: {
portalId: string;
};
componentDidMount(): void;
componentWillUnmount(): void;
handleDocumentKeyDown: (event: KeyboardEvent) => void;
handleBackgroundClick: (event: React.MouseEvent) => void;
render(): React.ReactNode;
}
export default Overlay;