import React from 'react'; export interface TyModalEventDetail { reason?: 'programmatic' | 'native' | 'backdrop' | 'escape' | 'close-button'; returnValue?: string; } /** * Detail for the `beforeclose` event — fired *before* the modal closes, * cancellable. Call `event.preventDefault()` to abort the close and render * your own confirm UI; once the user consents, call `ref.current?.hide({ force: true })` * to actually close (or just toggle your controlled `open` state to `false`). */ export interface TyModalBeforeCloseDetail { reason: 'programmatic' | 'backdrop' | 'escape' | 'close-button' | 'native'; } export interface TyModalProps extends React.HTMLAttributes { /** Controls modal visibility */ open?: boolean; /** Show backdrop behind modal (default: true) */ backdrop?: boolean; /** * @deprecated Use `preventOutsideClick` — string-boolean attrs are being * phased out. Still works; prevent-* wins when both are set. */ closeOnOutsideClick?: boolean; /** * @deprecated Use `preventEscape` — string-boolean attrs are being phased * out. Still works; prevent-* wins when both are set. */ closeOnEscape?: boolean; /** Backdrop clicks no longer close the modal (also hides the built-in ✕) */ preventOutsideClick?: boolean; /** * ESC no longer closes the modal (keydown is consumed, so the browser's * double-ESC anti-trap never fires). A fully guarded modal must render its * own close control — WCAG 2.1.2. */ preventEscape?: boolean; /** * Accessible name — sets aria-label on the internal . The dialog * gets role="dialog" for free, but nothing names it unless you set this. */ label?: string; /** React event handlers */ onOpen?: (event: CustomEvent) => void; onClose?: (event: CustomEvent) => void; /** * Fires before the modal closes. Cancellable — call `event.preventDefault()` * to abort. Use this for "discard changes?" flows with custom UI. */ onBeforeClose?: (event: CustomEvent) => void; /** Modal content */ children?: React.ReactNode; } export interface TyModalRef { show: () => void; /** * Close the modal. Without `force`, fires `beforeclose` first (consumer can * cancel). With `force: true`, bypasses `beforeclose` — call this once your * custom confirm UI has captured user consent. */ hide: (opts?: { force?: boolean; }) => void; element: HTMLElement | null; } export declare const TyModal: React.ForwardRefExoticComponent>; //# sourceMappingURL=TyModal.d.ts.map