UNPKG

@hypothesis/frontend-shared

Version:

Shared components, styles and utilities for Hypothesis projects

31 lines (30 loc) 1.26 kB
import type { CustomDialogProps, PanelDialogProps } from './Dialog'; type ModalSize = 'sm' | 'md' | 'lg' | 'custom'; type ComponentProps = { /** * Do not close the modal when the Escape key is pressed */ disableCloseOnEscape?: boolean; /** * Disable WAI-ARIA-specific modal-dialog focus trap and tab/shift-tab * keyboard navigation */ disableFocusTrap?: boolean; /** * Disable the restoration of focus to the previously-focused element when * the dialog is closed. */ disableRestoreFocus?: boolean; /** * Relative size (width) of modal dialog */ size?: ModalSize; }; export type PanelModalDialogProps = Omit<PanelDialogProps, 'restoreFocus' | 'closeOnEscape'> & ComponentProps; export type CustomModalDialogProps = Omit<CustomDialogProps, 'restoreFocus' | 'closeOnEscape'> & ComponentProps; export type ModalDialogProps = PanelModalDialogProps | CustomModalDialogProps; /** * Show a modal dialog */ export default function ModalDialog({ children, disableCloseOnEscape, disableFocusTrap, disableRestoreFocus, size, classes, elementRef, closeOnClickAway, closeOnFocusAway, initialFocus, ...htmlAndPanelAttributes }: ModalDialogProps): import("preact").JSX.Element; export {};