| 1 |
import { Component } from 'react'; |
| 2 |
import { PickOptional } from '../../helpers'; |
| 3 |
import { OUIAProps } from '../../helpers'; |
| 4 |
export interface ModalProps extends React.HTMLProps<HTMLDivElement>, OUIAProps { |
| 5 |
/** The parent container to append the modal to. Defaults to "document.body". */ |
| 6 |
appendTo?: HTMLElement | (() => HTMLElement); |
| 7 |
/** Id to use for the modal box description. This should match the ModalHeader labelId or descriptorId. */ |
| 8 |
'aria-describedby'?: string; |
| 9 |
/** Adds an accessible name to the modal when there is no title in the ModalHeader. */ |
| 10 |
'aria-label'?: string; |
| 11 |
/** Id to use for the modal box label. This should include the ModalHeader labelId. */ |
| 12 |
'aria-labelledby'?: string; |
| 13 |
/** Content rendered inside the modal. */ |
| 14 |
children: React.ReactNode; |
| 15 |
/** Additional classes added to the modal. */ |
| 16 |
className?: string; |
| 17 |
/** Additional classes added to the modal backdrop. */ |
| 18 |
backdropClassName?: string; |
| 19 |
/** Flag to disable focus trap. */ |
| 20 |
disableFocusTrap?: boolean; |
| 21 |
/** The element to focus when the modal opens. By default the first |
| 22 |
* focusable element will receive focus. |
| 23 |
*/ |
| 24 |
elementToFocus?: HTMLElement | SVGElement | string; |
| 25 |
/** Id of the focus trap in the ModalContent component */ |
| 26 |
focusTrapId?: string; |
| 27 |
/** An id to use for the modal box container. */ |
| 28 |
id?: string; |
| 29 |
/** Flag to show the modal. */ |
| 30 |
isOpen?: boolean; |
| 31 |
/** Add callback for when the close button is clicked. This prop needs to be passed to render the close button */ |
| 32 |
onClose?: (event: KeyboardEvent | React.MouseEvent) => void; |
| 33 |
/** Modal handles pressing of the escape key and closes the modal. If you want to handle |
| 34 |
* this yourself you can use this callback function. */ |
| 35 |
onEscapePress?: (event: KeyboardEvent) => void; |
| 36 |
/** Position of the modal. By default a modal will be positioned vertically and horizontally centered. */ |
| 37 |
position?: 'default' | 'top'; |
| 38 |
/** Offset from alternate position. Can be any valid CSS length/percentage. */ |
| 39 |
positionOffset?: string; |
| 40 |
/** Variant of the modal. */ |
| 41 |
variant?: 'small' | 'medium' | 'large' | 'default'; |
| 42 |
/** Default width of the modal. */ |
| 43 |
width?: number | string; |
| 44 |
/** Maximum width of the modal. */ |
| 45 |
maxWidth?: number | string; |
| 46 |
/** Value to overwrite the randomly generated data-ouia-component-id.*/ |
| 47 |
ouiaId?: number | string; |
| 48 |
/** 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. */ |
| 49 |
ouiaSafe?: boolean; |
| 50 |
} |
| 51 |
export declare enum ModalVariant { |
| 52 |
small = "small", |
| 53 |
medium = "medium", |
| 54 |
large = "large", |
| 55 |
default = "default" |
| 56 |
} |
| 57 |
interface ModalState { |
| 58 |
mounted: boolean; |
| 59 |
} |
| 60 |
declare class Modal extends Component<ModalProps, ModalState> { |
| 61 |
static displayName: string; |
| 62 |
static currentId: number; |
| 63 |
boxId: string; |
| 64 |
backdropId: string; |
| 65 |
static defaultProps: PickOptional<ModalProps>; |
| 66 |
constructor(props: ModalProps); |
| 67 |
handleEscKeyClick: (event: KeyboardEvent) => void; |
| 68 |
getElement: (appendTo: HTMLElement | (() => HTMLElement)) => HTMLElement; |
| 69 |
toggleSiblingsFromScreenReaders: (hide: boolean) => void; |
| 70 |
isEmpty: (value: string | null | undefined) => boolean; |
| 71 |
componentDidMount(): void; |
| 72 |
componentDidUpdate(prevProps: ModalProps): void; |
| 73 |
componentWillUnmount(): void; |
| 74 |
render(): import("react/jsx-runtime").JSX.Element; |
| 75 |
} |
| 76 |
export { Modal }; |
| 77 |
//# sourceMappingURL=Modal.d.ts.map |