DefinitelyTyped/types/styled-react-modal/index.d.ts
Ferdy Budhidharma afdf66dc15 [react] better types for React.Children, second generic parameter for ReactElement (#32279)
* better types for react.children

* fix failing tests

* semicolons..
2019-01-26 14:36:57 +00:00

43 lines
1.4 KiB
TypeScript

// Type definitions for styled-react-modal 1.1
// Project: https://github.com/AlexanderRichey/styled-react-modal
// Definitions by: Adam Lavin <https://github.com/Lavoaster>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.9
import * as React from 'react';
import { StyledComponent, AnyStyledComponent, CSSObject, InterpolationFunction } from 'styled-components';
declare const BaseModalBackground: StyledComponent<'div', any>;
interface ModalProps {
children?: React.ReactNode;
isOpen: boolean;
allowScroll?: boolean;
afterOpen?: () => void;
afterClose?: () => void;
beforeOpen?: Promise<void> | (() => void);
beforeClose?: Promise<void> | (() => void);
onEscapeKeydown?: (event: Event) => void;
onBackgroundClick?: (event: React.MouseEvent<HTMLDivElement>) => void;
}
declare class Modal extends React.Component<ModalProps> {
static styled(
object: CSSObject | InterpolationFunction<any>
): StyledComponent<React.ComponentClass<ModalProps>, any>;
static styled(
strings: TemplateStringsArray,
...interpolations: any[]
): StyledComponent<React.ComponentClass<ModalProps>, any>;
}
interface ModalProviderProps {
backgroundComponent?: AnyStyledComponent;
children: React.ReactNode;
}
declare class ModalProvider extends React.Component<ModalProviderProps> {}
export default Modal;
export { BaseModalBackground, ModalProvider };