import type { ReactElement, HTMLAttributes, Ref } from "react";
import type SlDialogElement from "@shoelace-style/shoelace/dist/components/dialog/dialog.js";
import {
SlShowEvent,
SlAfterShowEvent,
SlHideEvent,
SlAfterHideEvent,
SlInitialFocusEvent,
SlRequestCloseEvent,
} from "../events";
export type { SlDialogElement };
export type SlDialogShowEvent = SlShowEvent;
export type SlDialogAfterShowEvent = SlAfterShowEvent;
export type SlDialogHideEvent = SlHideEvent;
export type SlDialogAfterHideEvent = SlAfterHideEvent;
export type SlDialogInitialFocusEvent = SlInitialFocusEvent;
export type SlDialogRequestCloseEventDetail = {
source: "close-button" | "keyboard" | "overlay";
};
export type SlDialogRequestCloseEvent = SlRequestCloseEvent<
SlDialogElement,
SlRequestCloseEventDetail
>;
export interface SlDialogProps extends HTMLAttributes {
ref?: Ref;
/**
* Indicates whether or not the dialog is open. You can toggle this attribute to show and hide the dialog, or you can
* use the `show()` and `hide()` methods and this attribute will reflect the dialog's open state.
*/
open?: boolean;
/**
* The dialog's label as displayed in the header. You should always include a relevant label even when using
* `no-header`, as it is required for proper accessibility. If you need to display HTML, use the `label` slot instead.
*/
label?: string;
/**
* Disables the header. This will also remove the default close button, so please ensure you provide an easy,
* accessible way for users to dismiss the dialog.
*/
noHeader?: boolean;
/**
* Emitted when the dialog opens.
*/
onSlShow?: (event: SlDialogShowEvent) => void;
/**
* Emitted when the dialog opens.
*/
onSlShowCapture?: (event: SlDialogShowEvent) => void;
/**
* Emitted after the dialog opens and all animations are complete.
*/
onSlAfterShow?: (event: SlDialogAfterShowEvent) => void;
/**
* Emitted after the dialog opens and all animations are complete.
*/
onSlAfterShowCapture?: (event: SlDialogAfterShowEvent) => void;
/**
* Emitted when the dialog closes.
*/
onSlHide?: (event: SlDialogHideEvent) => void;
/**
* Emitted when the dialog closes.
*/
onSlHideCapture?: (event: SlDialogHideEvent) => void;
/**
* Emitted after the dialog closes and all animations are complete.
*/
onSlAfterHide?: (event: SlDialogAfterHideEvent) => void;
/**
* Emitted after the dialog closes and all animations are complete.
*/
onSlAfterHideCapture?: (event: SlDialogAfterHideEvent) => void;
/**
* Emitted when the dialog opens and is ready to receive focus. Calling `event.preventDefault()` will prevent focusing and allow you to set it on a different element, such as an input.
*/
onSlInitialFocus?: (event: SlDialogInitialFocusEvent) => void;
/**
* Emitted when the dialog opens and is ready to receive focus. Calling `event.preventDefault()` will prevent focusing and allow you to set it on a different element, such as an input.
*/
onSlInitialFocusCapture?: (event: SlDialogInitialFocusEvent) => void;
/**
* Emitted when the user attempts to close the dialog by clicking the close button, clicking the overlay, or pressing escape. Calling `event.preventDefault()` will keep the dialog open. Avoid using this unless closing the dialog will result in destructive behavior such as data loss.
*/
onSlRequestClose?: (event: SlDialogRequestCloseEvent) => void;
/**
* Emitted when the user attempts to close the dialog by clicking the close button, clicking the overlay, or pressing escape. Calling `event.preventDefault()` will keep the dialog open. Avoid using this unless closing the dialog will result in destructive behavior such as data loss.
*/
onSlRequestCloseCapture?: (event: SlDialogRequestCloseEvent) => void;
}
/**
* Dialogs, sometimes called "modals", appear above the page and require the user's immediate attention.
*/
export default function SlDialog(
props: SlDialogProps,
): ReactElement;