import { ReactElement, ReactNode } from 'react'; export interface ModalProps { children: ReactNode; accessibleTitle: string; accessibleDescription?: string; size?: 'small' | 'large' | 'auto'; padding?: 'large' | 'none'; margin?: 'large' | 'default'; zIndex?: number | string; themeOverlay?: string; themeContent?: string; onExit?: () => void; exitOnUnderlayClicked?: boolean; allowEventBubbling?: boolean; initialFocus?: string; primaryAction?: { text: string; callback: () => void; destructive?: boolean; disabled?: boolean; }; secondaryAction?: { text: string; callback: () => void; disabled?: boolean; }; tertiaryAction?: { text: string; callback: () => void; disabled?: boolean; }; } /** * An accessible modal dialog. * * To get a standard button arrangement at the bottom of the modal, use the * `primaryAction`, `secondaryAction`, and `tertiaryAction` props. * * This modal *traps focus within it*. You should be aware of that, because it * can sometimes introduce a hurdle when integrating the modal with other * things, especially third-party libraries. But it's an essential UX feature. */ declare function Modal({ children, accessibleTitle, accessibleDescription, size, padding, margin, zIndex, allowEventBubbling, exitOnUnderlayClicked, initialFocus, primaryAction, secondaryAction, tertiaryAction, themeOverlay, themeContent, onExit }: ModalProps): ReactElement; declare namespace Modal { var propTypes: { /** * A screen-reader-friendly modal title. Required for accessibility. * * This **will not be displayed.** It's only for screen readers. * You can visually display your own header text however you'd like. */ accessibleTitle: any; /** * A screen-reader-friendly modal description. * * This **will not be displayed.** It's only for screen readers. * Falls back to `accessibleTitle` if not provided. */ accessibleDescription: any; /** * Invoked when the modal should close. When this callback is provided, * a close button will be in the top right corner, and a click on the underlay * or the Escape key will close the modal. * * If this prop is not provided, the close button will not be present and * a click on the underlay or Escape will not close the modal. The reason * you might not provide this function is that you want to force the user * to do something, instead of allowing them to sneak out of the modal. */ onExit: any; /** * If `onExit` is provided but this prop is set as false, a click on the underlay will * not close the modal. The only way of closing the modal is clicking on the close button. */ exitOnUnderlayClicked: any; /** * Modal container size. Options are `small`, `large`, or `auto`. If `auto` * is provided, a width is not specified. */ size: any; /** * Selector for a specific element that should receive initial focus. The * value will be passed to `querySelector`. */ initialFocus: any; /** * The content of the modal. */ children: any; /** * `'large'` or `'none'`. */ padding: any; /** * `'large'` to compensate for a fixed top header or `'default'` to be closer to the top of the viewport. */ margin: any; /** * z-index of the modal */ zIndex: any; /** * Additional CSS classes to apply to the overlay, * along with existing classes * `fixed top bottom left right flex flex--center-main flex--start-cross overflow-auto bg-darken50` */ themeOverlay: any; /** * Additional CSS classes to apply to the content, * along with existing classes `relative bg-white round` */ themeContent: any; /** * The modal's primary action. If this is provided, an encouraging * button will be rendered at the bottom of the modal. * * Provide this and other action props if you want a standard button * arrangement at the bottom of the modal. If you need a more custom * arrangement, leave them out and insert your buttons into the content. * * The value is an object with the following properties: * - `text`: **(required)** The text of the button. * - `callback`: **(required)** Invoked when the button is clicked. * - `destructive`: If `true`, the [Button](#button) will be primed for * desctruction. */ primaryAction: any; /** * The modal's secondary action. If this is provided, a discouraging button * will be rendered at the bottom of the modal. See the description of * `primaryAction`. * * **Can only be used in combination with `primaryAction`.** * * The value is an object with the following properties: * - `text`: **(required)** The text of the button. * - `callback`: **(required)** Invoked when the button is clicked. */ secondaryAction: any; /** * The modal's tertiary action. **You should rarely if ever need this.** * If this is provided, a *very* discouraging button * will be rendered at the bottom of the modal. See the description of * `primaryAction`. * * **Can only be used in combination with `primaryAction` and * `secondaryAction`.** * * The value is an object with the following properties: * - `text`: **(required)** The text of the button. * - `callback`: **(required)** Invoked when the button is clicked. */ tertiaryAction: any; /** * We stop propagation on clicks by default to enable more intuitive * operation with React Portals. If you need click events to bubble up * to parent components, set this prop to true */ allowEventBubbling: any; }; } export default Modal;