@base-ui/react
Version:
Base UI is a library of headless ('unstyled') React components and low-level hooks. You gain complete control over your app's CSS and accessibility features.
24 lines (23 loc) • 761 B
JavaScript
import { DialogHandle } from "../dialog/store/DialogHandle.js";
import { DialogStore } from "../dialog/store/DialogStore.js";
export const alertDialogState = {
modal: true,
disablePointerDismissal: true,
role: 'alertdialog'
};
/**
* A handle to control an Alert Dialog imperatively and to associate detached triggers with it.
*/
export class AlertDialogHandle extends DialogHandle {
constructor(store) {
const alertDialogStore = store ?? new DialogStore(alertDialogState);
super(alertDialogStore);
if (store) {
// Supplied stores may have been created as plain dialogs; enforce alert-dialog state.
this.store.update(alertDialogState);
}
}
}
export function createAlertDialogHandle() {
return new AlertDialogHandle();
}