1.2.5 • Published 6 months ago

@types/styled-react-modal v1.2.5

Weekly downloads
3,768
License
MIT
Repository
github
Last release
6 months ago

Installation

npm install --save @types/styled-react-modal

Summary

This package contains type definitions for styled-react-modal (https://github.com/AlexanderRichey/styled-react-modal).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/styled-react-modal.

index.d.ts

// Type definitions for styled-react-modal 1.2
// Project: https://github.com/AlexanderRichey/styled-react-modal
// Definitions by: Greg Perlman <https://github.com/gperl27>
// 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>;

export interface ModalProps {
  children?: React.ReactNode | undefined;
  isOpen: boolean;
  allowScroll?: boolean | undefined;
  backgroundProps?: object | undefined;
  afterOpen?: (() => void) | undefined;
  afterClose?: (() => void) | undefined;
  beforeOpen?: Promise<void> | (() => void) | undefined;
  beforeClose?: Promise<void> | (() => void) | undefined;
  onEscapeKeydown?: ((event: Event) => void) | undefined;
  onBackgroundClick?: ((event: React.MouseEvent<HTMLDivElement>) => void) | undefined;
}

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 | undefined;
  children: React.ReactNode;
}

declare class ModalProvider extends React.Component<ModalProviderProps> {}

export default Modal;
export { BaseModalBackground, ModalProvider };

Additional Details

Credits

These definitions were written by Greg Perlman.