import { TemplateResult } from 'lit'; import { DialogPlacement } from '../components/dialog/UDialog.js'; import { ButtonColor, ButtonAppearance } from '../components/button/UButton.js'; /** 공통 Dialog 옵션 */ export interface DialogOptions { /** 다이얼로그를 표시할 대상 엘리먼트, 지정 시 contained 모드로 동작 */ target?: HTMLElement; /** 헤더 제목 */ title?: string; /** 배치 위치 */ placement?: DialogPlacement; /** 가장자리로부터의 간격 (px) */ offset?: number; /** 모달 모드 여부 (기본: true) */ modal?: boolean; /** 닫기 버튼 표시 여부 (기본: false) */ buttonClose?: boolean; /** ESC 키로 닫기 허용 (기본: true) */ escapeClose?: boolean; /** 백드롭 클릭으로 닫기 허용 (기본: true) */ backdropClose?: boolean; } /** Confirm Dialog 옵션 */ export interface AlertDialogOptions extends DialogOptions { /** 닫는 버튼의 글자 (기본값: 로케일의 «확인»/`OK`) */ confirmLabel?: string; } export interface ConfirmDialogOptions extends DialogOptions { /** 확인 버튼 텍스트 (기본: 현재 로케일의 `confirm` — 영어는 'Confirm') */ confirmLabel?: string; /** 취소 버튼 텍스트 (기본: 현재 로케일의 `cancel` — 영어는 'Cancel') */ cancelLabel?: string; /** * 확인 버튼의 색. 되돌릴 수 없는 동작(삭제·취소)을 확인할 때 `'danger'` — 그 확인 버튼이 화면에서 * 파괴적 동작이 solid 로 칠해지는 유일한 자리가 된다. 기본은 버튼의 기본색. */ confirmColor?: ButtonColor; } /** Prompt Dialog 옵션 */ export interface PromptDialogOptions extends ConfirmDialogOptions { /** 입력 필드 type */ type?: string; /** 입력 필드 기본값 */ defaultValue?: string; /** 입력 필드 placeholder */ placeholder?: string; } /** Custom Dialog 옵션 */ export interface CustomDialogOptions extends DialogOptions { /** 본문 콘텐츠 (HTML 문자열 또는 TemplateResult) */ content: string | TemplateResult; /** 액션 버튼 목록 */ actions?: DialogAction[]; } /** Custom Dialog 버튼 정의 */ export interface DialogAction { /** 버튼 텍스트 */ label: string; /** 반환될 값 */ value: string; /** 버튼 스타일 */ appearance?: ButtonAppearance; /** 버튼 색 (기본: 버튼의 기본색) */ color?: ButtonColor; } /** * Dialog 유틸리티 클래스입니다. * 프로그래밍 방식으로 alert, confirm, prompt 다이얼로그를 표시합니다. */ export declare class Dialog { /** 개별 인스턴스 생성을 방지합니다. */ private constructor(); /** * 알림 다이얼로그를 표시합니다. * @param message 본문 — **문자열은 글자로** 그린다(사용자 입력을 넣어도 마크업이 되지 않는다). 서식이 필요하면 * `TemplateResult`(`html\`…\``)를 넘긴다. HTML 문자열은 그것을 명시한 `show({ content })` 로만. */ static alert(message: string | TemplateResult, options?: AlertDialogOptions): Promise; /** * 확인 다이얼로그를 표시합니다. (확인/취소 버튼) * @param message 본문 — **문자열은 글자로** 그린다(`alert` 와 같다). 서식은 `TemplateResult` 로. * @returns 확인이면 true, 취소이면 false */ static confirm(message: string | TemplateResult, options?: ConfirmDialogOptions): Promise; /** * 입력 다이얼로그를 표시합니다. (텍스트 입력 + 확인/취소) * @returns 입력값 또는 취소 시 null */ static prompt(message: string, options?: PromptDialogOptions): Promise; /** * 커스텀 다이얼로그를 표시합니다. * @returns 클릭된 액션의 value 또는 닫힌 경우 null */ static show(options: CustomDialogOptions): Promise; /** `show` 의 본체 — `decorate` 는 `alert`·`confirm`·`prompt` 가 렌더 뒤 접근성 이름·설명을 잇는 자리다. */ private static present; /** 다이얼로그 엘리먼트를 생성하고 옵션을 적용합니다. */ private static createDialog; }