UNPKG

1.95 kBTypeScriptView Raw
1import React from 'react';
2import ModalManager from './ModalManager';
3import { DOMContainer } from './useWaitForDOMRef';
4import { TransitionCallbacks } from './types';
5export declare type ModalTransitionComponent = React.ComponentType<{
6 in: boolean;
7 appear?: boolean;
8 unmountOnExit?: boolean;
9} & TransitionCallbacks>;
10export interface RenderModalDialogProps {
11 style: React.CSSProperties | undefined;
12 className: string | undefined;
13 tabIndex: number;
14 role: string;
15 ref: React.RefCallback<Element>;
16 'aria-modal': boolean | undefined;
17}
18export interface RenderModalBackdropProps {
19 ref: React.RefCallback<Element>;
20 onClick: (event: React.SyntheticEvent) => void;
21}
22export interface BaseModalProps extends TransitionCallbacks {
23 children?: React.ReactElement;
24 role?: string;
25 style?: React.CSSProperties;
26 className?: string;
27 show?: boolean;
28 container?: DOMContainer;
29 onShow?: () => void;
30 onHide?: () => void;
31 manager?: ModalManager;
32 backdrop?: true | false | 'static';
33 renderDialog?: (props: RenderModalDialogProps) => React.ReactNode;
34 renderBackdrop?: (props: RenderModalBackdropProps) => React.ReactNode;
35 onEscapeKeyDown?: (e: KeyboardEvent) => void;
36 onBackdropClick?: (e: React.SyntheticEvent) => void;
37 containerClassName?: string;
38 keyboard?: boolean;
39 transition?: ModalTransitionComponent;
40 backdropTransition?: ModalTransitionComponent;
41 autoFocus?: boolean;
42 enforceFocus?: boolean;
43 restoreFocus?: boolean;
44 restoreFocusOptions?: {
45 preventScroll: boolean;
46 };
47}
48export interface ModalProps extends BaseModalProps {
49 [other: string]: any;
50}
51export interface ModalHandle {
52 dialog: HTMLElement | null;
53 backdrop: HTMLElement | null;
54}
55declare const _default: React.ForwardRefExoticComponent<ModalProps & React.RefAttributes<ModalHandle>> & {
56 Manager: typeof ModalManager;
57};
58export default _default;