import * as React from 'react'; import React__default from 'react'; import ReactModal from 'react-modal'; import { PropsWithHTMLElement, CommonProps, ExpandProps } from '@contentful/f36-core'; interface ModalHeaderInternalProps extends CommonProps { title: string; subtitle?: string; onClose?: ReactModal.Props['onRequestClose']; children?: React__default.ReactNode; aria?: { closeIconLabel?: string; }; } type ModalHeaderProps = PropsWithHTMLElement; declare const ModalHeader: { ({ onClose, title, subtitle, testId, className, children, aria, ...otherProps }: ModalHeaderProps): React__default.ReactElement; displayName: string; }; interface ModalContentInternalProps extends CommonProps { children: React__default.ReactNode; } type ModalContentProps = PropsWithHTMLElement; declare const ModalContent: { ({ testId, className, children, ...otherProps }: ModalContentProps): React__default.JSX.Element; displayName: string; }; type ModalSizeType = 'small' | 'medium' | 'large' | 'fullWidth' | 'zen' | 'fullscreen'; type ModalPositionType = 'center' | 'top'; interface ModalProps extends CommonProps { /** * When true, the dialog is shown. */ isShown: boolean; /** * Function that will be run when the modal is requested to be closed, prior to actually closing. */ onClose: ReactModal.Props['onRequestClose']; /** * Function that will be run after the modal has opened. */ onAfterOpen?: ReactModal.Props['onAfterOpen']; /** * Additional aria attributes */ aria?: ReactModal.Props['aria']; /** * Boolean indicating if clicking the overlay should close the overlay. * @default true */ shouldCloseOnOverlayClick?: boolean; /** * Boolean indicating if pressing the esc key should close the overlay. * @default true */ shouldCloseOnEscapePress?: boolean; /** * Indicating if modal is centered or linked to the top * @default center */ position?: ModalPositionType; /** * Top offset if position is 'top' * @default 50px */ topOffset?: number | string; /** * Modal title that is used in header */ title?: string; /** * Modal subtitle that is used in header */ subtitle?: string; /** * Size of the modal window * @default medium */ size?: ModalSizeType | string | number; /** * Are modals higher than viewport allowed * @default false */ allowHeightOverflow?: boolean; /** * Optional props to override overlay behaviour */ overlayProps?: Pick; /** * Optional props to override ModalHeader behaviour */ modalHeaderProps?: Partial; /** * Optional props to override ModalContent behaviour */ modalContentProps?: Partial; /** * Optional property to set initial focus */ initialFocusRef?: React.RefObject; children: React.ReactNode | RenderModal; } type RenderModal = (modalProps: ModalProps) => React.ReactNode; declare const Modal$1: { ({ allowHeightOverflow, position, shouldCloseOnEscapePress, shouldCloseOnOverlayClick, size, testId, topOffset, aria, ...otherProps }: ExpandProps): React.JSX.Element; displayName: string; }; interface ModalControlsInternalProps extends CommonProps { children: React__default.ReactElement[] | React__default.ReactElement; } type ModalControlsProps = PropsWithHTMLElement; declare const ModalControls: { ({ testId, className, children, ...otherProps }: ModalControlsProps): React__default.ReactElement; displayName: string; }; type CompoundModal = typeof Modal$1 & { Content: typeof ModalContent; Header: typeof ModalHeader; Controls: typeof ModalControls; }; declare const Modal: CompoundModal; interface ModalConfirmProps { /** * When true, the dialog is shown. */ isShown: boolean; /** * Function that will be called when the confirm button is clicked. This does not close the ModalConfirm. */ onConfirm(): void; /** * Function that will be called when the cancel button is clicked. This does not close the ModalConfirm. */ onCancel: ModalProps['onClose']; /** Modal title that is used in header */ title?: string; /** * Label of the confirm button */ confirmLabel?: string | false; /** * Label of the cancel button */ cancelLabel?: string | false; /** * The intent of the ModalConfirm. Used for the Button. */ intent?: 'primary' | 'positive' | 'negative'; /** * Size of the modal window */ size?: ModalProps['size']; /** * Boolean indicating if clicking the overlay should close the overlay. */ shouldCloseOnOverlayClick?: boolean; /** * Boolean indicating if pressing the esc key should close the overlay. */ shouldCloseOnEscapePress?: boolean; /** * When true, the confirm button is set to disabled. */ isConfirmDisabled?: boolean; /** * When true, the confirm button is set to loading. */ isConfirmLoading?: boolean; /** * Are modals higher than viewport allowed */ allowHeightOverflow?: boolean; /** * Optional props to override ModalHeader behaviour */ modalHeaderProps?: Partial; /** * Optional props to override ModalContent behaviour */ modalContentProps?: Partial; /** * Optional props to override ModalControl behaviour */ modalControlsProps?: Partial; /** * Optional property to set initial focus */ initialFocusRef?: React__default.RefObject; testId?: string; confirmTestId?: string; cancelTestId?: string; children: React__default.ReactNode; } declare const ModalConfirm: { ({ allowHeightOverflow, cancelLabel, cancelTestId, children, confirmLabel, confirmTestId, intent, isConfirmDisabled, isConfirmLoading, isShown, modalContentProps, modalControlsProps, modalHeaderProps, onCancel, onConfirm, shouldCloseOnEscapePress, shouldCloseOnOverlayClick, size, testId, title, initialFocusRef, }: ModalConfirmProps): React__default.JSX.Element; displayName: string; }; interface ModalLauncherComponentRendererProps { isShown: boolean; onClose: (result?: T) => void; } interface ModalLauncherOpenOptions { /** * Unique id to be used as identifier for the modal contianer */ modalId?: string; /** * ms before removing the component from the tree * @default 300 */ delay?: number; } declare function closeAll(): Promise; declare function open(componentRenderer: (props: ModalLauncherComponentRendererProps) => React__default.ReactElement, options?: ModalLauncherOpenOptions): Promise; declare const ModalLauncher: { open: typeof open; closeAll: typeof closeAll; }; export { Modal, ModalConfirm, type ModalConfirmProps, ModalContent, type ModalContentProps, ModalControls, type ModalControlsProps, ModalHeader, type ModalHeaderProps, ModalLauncher, type ModalLauncherComponentRendererProps, type ModalLauncherOpenOptions, type ModalProps };