@furystack/shades-common-components
Version:
Common UI components for FuryStack Shades
57 lines • 1.82 kB
TypeScript
export type DialogProps = {
isVisible: boolean;
title?: string;
onClose?: () => void;
actions?: JSX.Element;
maxWidth?: string;
fullWidth?: boolean;
/**
* When true, traps spatial navigation within the dialog's bounds.
* Forwarded to the underlying Modal component.
*/
trapFocus?: boolean;
/**
* Section name for spatial navigation scoping.
* Forwarded to the underlying Modal component.
* @default 'modal'
*/
navSection?: string;
};
export declare const Dialog: (props: DialogProps & Omit<Partial<HTMLElement>, "style"> & {
style?: Partial<CSSStyleDeclaration>;
} & {
ref?: import("@furystack/shades").RefObject<Element>;
}, children?: import("@furystack/shades").ChildrenList) => JSX.Element;
/**
* Options for the confirm dialog helper
*/
export type ConfirmDialogOptions = {
title: string;
message: string | JSX.Element;
confirmText?: string;
cancelText?: string;
onConfirm: () => void;
onCancel?: () => void;
};
/**
* Renders a pre-built confirm dialog with confirm/cancel buttons.
* Returns a JSX element that should be placed in the component tree.
*
* @param isVisible - Boolean controlling the dialog visibility
* @param options - Configuration for the confirm dialog
* @returns A Dialog JSX element
*
* @example
* ```tsx
* const [isConfirmOpen, setConfirmOpen] = useState('confirmOpen', false)
* // ...
* {ConfirmDialog(isConfirmOpen, {
* title: 'Delete Item',
* message: 'Are you sure you want to delete this item?',
* onConfirm: () => { deleteItem(); setConfirmOpen(false) },
* onCancel: () => setConfirmOpen(false),
* })}
* ```
*/
export declare const ConfirmDialog: (isVisible: boolean, options: ConfirmDialogOptions) => JSX.Element;
//# sourceMappingURL=dialog.d.ts.map