| 1 |
import { Component } from 'react'; |
| 2 |
import { PickOptional } from '../../../helpers'; |
| 3 |
import { OUIAProps } from '../../../helpers'; |
| 4 |
export interface ModalProps extends Omit<React.HTMLProps<HTMLDivElement>, 'title'>, OUIAProps { |
| 5 |
/** Action buttons to add to the standard modal footer. Ignored if the footer property |
| 6 |
* is passed in. |
| 7 |
*/ |
| 8 |
actions?: any; |
| 9 |
/** The parent container to append the modal to. Defaults to "document.body". */ |
| 10 |
appendTo?: HTMLElement | (() => HTMLElement); |
| 11 |
/** Id to use for the modal box descriptor. */ |
| 12 |
'aria-describedby'?: string; |
| 13 |
/** Accessible descriptor of the modal. */ |
| 14 |
'aria-label'?: string; |
| 15 |
/** Id to use for the modal box label. */ |
| 16 |
'aria-labelledby'?: string; |
| 17 |
/** Accessible label applied to the modal box body. This should be used to communicate |
| 18 |
* important information about the modal box body div element if needed, such as that it |
| 19 |
* is scrollable. |
| 20 |
*/ |
| 21 |
bodyAriaLabel?: string; |
| 22 |
/** Accessible role applied to the modal box body. This will default to "region" if the |
| 23 |
* bodyAriaLabel property is passed in. Set to a more appropriate role as applicable |
| 24 |
* based on the modal content and context. |
| 25 |
*/ |
| 26 |
bodyAriaRole?: string; |
| 27 |
/** Content rendered inside the modal. */ |
| 28 |
children: React.ReactNode; |
| 29 |
/** Additional classes added to the modal. */ |
| 30 |
className?: string; |
| 31 |
/** Description of the modal. */ |
| 32 |
description?: React.ReactNode; |
| 33 |
/** Flag to disable focus trap. */ |
| 34 |
disableFocusTrap?: boolean; |
| 35 |
/** The element to focus when the modal opens. By default the first |
| 36 |
* focusable element will receive focus. |
| 37 |
*/ |
| 38 |
elementToFocus?: HTMLElement | SVGElement | string; |
| 39 |
/** Custom footer. */ |
| 40 |
footer?: React.ReactNode; |
| 41 |
/** Flag indicating if modal content should be placed in a modal box body wrapper. */ |
| 42 |
hasNoBodyWrapper?: boolean; |
| 43 |
/** Complex header (more than just text), supersedes the title property for header content. */ |
| 44 |
header?: React.ReactNode; |
| 45 |
/** Optional help section for the modal header. */ |
| 46 |
help?: React.ReactNode; |
| 47 |
/** An id to use for the modal box container. */ |
| 48 |
id?: string; |
| 49 |
/** Flag to show the modal. */ |
| 50 |
isOpen?: boolean; |
| 51 |
/** A callback for when the close button is clicked. */ |
| 52 |
onClose?: (event: KeyboardEvent | React.MouseEvent) => void; |
| 53 |
/** Modal handles pressing of the escape key and closes the modal. If you want to handle |
| 54 |
* this yourself you can use this callback function. */ |
| 55 |
onEscapePress?: (event: KeyboardEvent) => void; |
| 56 |
/** Position of the modal. By default a modal will be positioned vertically and horizontally centered. */ |
| 57 |
position?: 'default' | 'top'; |
| 58 |
/** Offset from alternate position. Can be any valid CSS length/percentage. */ |
| 59 |
positionOffset?: string; |
| 60 |
/** Flag to show the close button in the header area of the modal. */ |
| 61 |
showClose?: boolean; |
| 62 |
/** Text content of the modal header. */ |
| 63 |
title?: React.ReactNode; |
| 64 |
/** Optional alert icon (or other) to show before the title of the modal header. When the |
| 65 |
* predefined alert types are used the default styling will be automatically applied. |
| 66 |
*/ |
| 67 |
titleIconVariant?: 'success' | 'danger' | 'warning' | 'info' | 'custom' | React.ComponentType<any>; |
| 68 |
/** Optional title label text for screen readers. */ |
| 69 |
titleLabel?: string; |
| 70 |
/** Variant of the modal. */ |
| 71 |
variant?: 'small' | 'medium' | 'large' | 'default'; |
| 72 |
/** Default width of the modal. */ |
| 73 |
width?: number | string; |
| 74 |
/** Maximum width of the modal. */ |
| 75 |
maxWidth?: number | string; |
| 76 |
/** Value to overwrite the randomly generated data-ouia-component-id.*/ |
| 77 |
ouiaId?: number | string; |
| 78 |
/** Set the value of data-ouia-safe. Only set to true when the component is in a static state, i.e. no animations are occurring. At all other times, this value must be false. */ |
| 79 |
ouiaSafe?: boolean; |
| 80 |
} |
| 81 |
export declare enum ModalVariant { |
| 82 |
small = "small", |
| 83 |
medium = "medium", |
| 84 |
large = "large", |
| 85 |
default = "default" |
| 86 |
} |
| 87 |
interface ModalState { |
| 88 |
mounted: boolean; |
| 89 |
} |
| 90 |
declare class Modal extends Component<ModalProps, ModalState> { |
| 91 |
static displayName: string; |
| 92 |
static currentId: number; |
| 93 |
boxId: string; |
| 94 |
labelId: string; |
| 95 |
descriptorId: string; |
| 96 |
backdropId: string; |
| 97 |
static defaultProps: PickOptional<ModalProps>; |
| 98 |
constructor(props: ModalProps); |
| 99 |
handleEscKeyClick: (event: KeyboardEvent) => void; |
| 100 |
getElement: (appendTo: HTMLElement | (() => HTMLElement)) => HTMLElement; |
| 101 |
toggleSiblingsFromScreenReaders: (hide: boolean) => void; |
| 102 |
isEmpty: (value: string | null | undefined) => boolean; |
| 103 |
componentDidMount(): void; |
| 104 |
componentDidUpdate(prevProps: ModalProps): void; |
| 105 |
componentWillUnmount(): void; |
| 106 |
render(): import("react/jsx-runtime").JSX.Element; |
| 107 |
} |
| 108 |
export { Modal }; |
| 109 |
//# sourceMappingURL=Modal.d.ts.map |