@combine-labs/combine-polaris
Version:
Combine Lab's product component library. Forked from Shopify's Polaris.
74 lines (73 loc) • 2.99 kB
TypeScript
import * as React from 'react';
import * as PropTypes from 'prop-types';
import { WithAppProviderProps } from '../AppProvider';
import { Dialog, FooterProps, Section } from './components';
export declare type Size = 'large' | 'medium' | 'small';
export declare type Width = 'large' | 'fullwidth';
export declare type Warn = 'easdk' | 'modal';
export interface Props extends FooterProps {
/** Whether the modal is open or not */
open: boolean;
/** The url that will be loaded as the content of the modal */
src?: string;
/** The name of the modal content iframe */
iFrameName?: string;
/** The content for the title of the modal (EASDK accepts string) */
title?: string | React.ReactNode;
/** The markup content for the header of the modal */
header?: React.ReactNode;
/** The content to display inside modal (Modal use only) */
children?: React.ReactNode;
/** Inner content of the footer (Modal use only) */
footer?: React.ReactNode;
/** Disable animations and open modal instantly (Modal use only) */
instant?: boolean;
/** Automatically adds sections to modal (Modal use only) */
sectioned?: boolean;
/** Increases the modal width (Modal use only) */
size?: Size;
/** Limits modal height on large sceens with scrolling (Modal use only) */
limitHeight?: boolean;
/** Replaces modal content with a spinner while a background action is being performed (Modal use only) */
loading?: boolean;
/** Controls the width of the modal (EASDK use only) */
width?: Width;
/** Controls the height of the modal (EASDK use only, in pixels) */
height?: number;
/** Allow clicking on the backdrop to close the modal on desktop */
allowBackdropCloseOnDesktop?: boolean;
/** Callback when the modal is closed */
onClose(): void;
/** Callback when iframe has loaded (Modal use only) */
onIFrameLoad?(evt: React.SyntheticEvent<HTMLIFrameElement>): void;
/** Callback when modal transition animation has ended (Modal use only) */
onTransitionEnd?(): void;
}
export declare type CombinedProps = Props & WithAppProviderProps;
export interface State {
iframeHeight: number;
}
export declare class Modal extends React.Component<CombinedProps, State> {
static contextTypes: {
easdk: PropTypes.Requireable<object>;
};
static childContextTypes: React.ValidationMap<any>;
static Dialog: typeof Dialog;
static Section: typeof Section;
focusReturnPointNode: HTMLElement;
state: State;
private headerId;
getChildContext(): {
withinContentContainer: boolean;
};
componentDidMount(): void;
componentDidUpdate({ open: wasOpen }: Props): void;
render(): JSX.Element | null;
private handleEntered;
private handleExited;
private handleIFrameLoad;
private handleEASDKMessaging;
private handleWarning;
}
declare const _default: React.ComponentClass<Props> & typeof Modal;
export default _default;