@praxisui/dialog
Version:
Dialog helpers and components for Praxis UI with Angular Material integration.
1 lines • 74.6 kB
Source Map (JSON)
{"version":3,"file":"praxisui-dialog.mjs","sources":["../../../projects/praxis-dialog/src/lib/dialog/dialog.tokens.ts","../../../projects/praxis-dialog/src/lib/dialog/dialog.ref.ts","../../../projects/praxis-dialog/src/lib/dialog/title.directive.ts","../../../projects/praxis-dialog/src/lib/dialog/actions.directive.ts","../../../projects/praxis-dialog/src/lib/dialog/content.directive.ts","../../../projects/praxis-dialog/src/lib/dialog/dialog.component.ts","../../../projects/praxis-dialog/src/lib/dialog/dialog.component.html","../../../projects/praxis-dialog/src/lib/dialog/overlay/dialog-overlay.service.ts","../../../projects/praxis-dialog/src/lib/dialog/dialog.service.ts","../../../projects/praxis-dialog/src/lib/providers/dialog-global-presets.provider.ts","../../../projects/praxis-dialog/src/praxisui-dialog.ts"],"sourcesContent":["import { InjectionToken } from '@angular/core';\n\nexport const PRAXIS_DIALOG_DATA = new InjectionToken<unknown>('PRAXIS_DIALOG_DATA');\n\nexport const PRAXIS_DIALOG_I18N = new InjectionToken<\n Readonly<{\n ok: string;\n cancel: string;\n yes: string;\n no: string;\n }>\n>('PRAXIS_DIALOG_I18N', {\n providedIn: 'root',\n factory: () => ({ ok: 'OK', cancel: 'Cancelar', yes: 'Sim', no: 'Não' }),\n});\n\nexport const PRAXIS_DIALOG_DEFAULTS = new InjectionToken<\n Readonly<{\n maxWidth: string | number;\n maxHeight: string | number;\n }>\n>('PRAXIS_DIALOG_DEFAULTS', {\n providedIn: 'root',\n factory: () => ({ maxWidth: '90vw', maxHeight: '80vh' }),\n});\n\nexport type ComponentType<T> = new (...args: any[]) => T;\nexport const PRAXIS_DIALOG_CONTENT_REGISTRY = new InjectionToken<\n Record<string, ComponentType<any>>\n>('PRAXIS_DIALOG_CONTENT_REGISTRY', {\n providedIn: 'root',\n factory: () => ({}),\n});\n\n// Template registry: id -> TemplateRef\nimport { TemplateRef } from '@angular/core';\nexport const PRAXIS_DIALOG_TEMPLATE_REGISTRY = new InjectionToken<\n Record<string, TemplateRef<any>>\n>('PRAXIS_DIALOG_TEMPLATE_REGISTRY', {\n providedIn: 'root',\n factory: () => ({}),\n});\n\n// Global presets (by type and variants)\nimport { PraxisDialogConfig } from './dialog.types';\nexport interface PraxisDialogGlobalPresets {\n confirm?: PraxisDialogConfig;\n alert?: PraxisDialogConfig;\n prompt?: PraxisDialogConfig;\n variants?: Record<string, PraxisDialogConfig>; // e.g., delete, save, destructive\n}\n\nexport const PRAXIS_DIALOG_GLOBAL_PRESETS = new InjectionToken<PraxisDialogGlobalPresets>(\n 'PRAXIS_DIALOG_GLOBAL_PRESETS',\n {\n providedIn: 'root',\n factory: () => ({}),\n },\n);\n","import { OverlayRef } from '@angular/cdk/overlay';\nimport { Observable, Subject } from 'rxjs';\nimport { PraxisDialogPosition } from './dialog.types';\n\nexport class PraxisDialogRef<T = any, R = any> {\n id?: string;\n private readonly _afterOpened = new Subject<void>();\n private readonly _beforeClosed = new Subject<R | undefined>();\n private readonly _afterClosed = new Subject<R | undefined>();\n private readonly _backdropClick = new Subject<MouseEvent>();\n private readonly _keydownEvents = new Subject<KeyboardEvent>();\n\n componentInstance?: T;\n\n constructor(private overlayRef: OverlayRef) {}\n private beforeCloseHandler?: (result?: R) => Promise<void> | void;\n\n setBeforeClose(handler: (result?: R) => Promise<void> | void): void {\n this.beforeCloseHandler = handler;\n }\n\n emitOpened(): void {\n this._afterOpened.next();\n this._afterOpened.complete();\n }\n\n backdropClick(): Observable<MouseEvent> {\n return this._backdropClick.asObservable();\n }\n\n keydownEvents(): Observable<KeyboardEvent> {\n return this._keydownEvents.asObservable();\n }\n\n afterOpened(): Observable<void> {\n return this._afterOpened.asObservable();\n }\n\n beforeClosed(): Observable<R | undefined> {\n return this._beforeClosed.asObservable();\n }\n\n afterClosed(): Observable<R | undefined> {\n return this._afterClosed.asObservable();\n }\n\n notifyBackdropClick(ev: MouseEvent): void {\n this._backdropClick.next(ev);\n }\n\n notifyKeydown(ev: KeyboardEvent): void {\n this._keydownEvents.next(ev);\n }\n\n async close(result?: R): Promise<void> {\n this._beforeClosed.next(result);\n this._beforeClosed.complete();\n if (this.beforeCloseHandler) {\n try { await this.beforeCloseHandler(result); } catch {}\n }\n this.overlayRef.dispose();\n this._afterClosed.next(result);\n this._afterClosed.complete();\n this._backdropClick.complete();\n this._keydownEvents.complete();\n }\n\n updateSize(width?: string | number, height?: string | number): this {\n this.overlayRef.updateSize({\n width: coerceCssUnit(width),\n height: coerceCssUnit(height),\n });\n return this;\n }\n\n updatePosition(position?: PraxisDialogPosition): this {\n this.overlayRef.updatePositionStrategy(\n this.overlayRef.getConfig().positionStrategy!,\n );\n if (position) {\n const ps: any = this.overlayRef.getConfig().positionStrategy as any;\n if (ps?.top !== undefined && position.top != null) (ps as any).top(position.top);\n if (ps?.bottom !== undefined && position.bottom != null)\n (ps as any).bottom(position.bottom);\n if (ps?.left !== undefined && position.left != null)\n (ps as any).left(position.left);\n if (ps?.right !== undefined && position.right != null)\n (ps as any).right(position.right);\n this.overlayRef.updatePosition();\n }\n return this;\n }\n}\n\nfunction coerceCssUnit(v?: string | number): string | undefined {\n if (v == null) return undefined;\n return typeof v === 'number' ? `${v}px` : v;\n}\n","import { Directive, TemplateRef } from '@angular/core';\n\n@Directive({ selector: 'ng-template[praxisDialogTitle]', standalone: true })\nexport class PraxisDialogTitleDirective {\n constructor(public templateRef: TemplateRef<any>) {}\n}\n\n","import { Directive, TemplateRef } from '@angular/core';\n\n@Directive({ selector: 'ng-template[praxisDialogActions]', standalone: true })\nexport class PraxisDialogActionsDirective {\n constructor(public templateRef: TemplateRef<any>) {}\n}\n\n","import { Directive, TemplateRef } from '@angular/core';\n\n@Directive({ selector: 'ng-template[praxisDialogContent]', standalone: true })\nexport class PraxisDialogContentDirective {\n constructor(public templateRef: TemplateRef<any>) {}\n}\n\n","import {\n ChangeDetectionStrategy,\n Component,\n ContentChild,\n ElementRef,\n EventEmitter,\n HostBinding,\n Input,\n OnInit,\n OnDestroy,\n OnChanges,\n SimpleChanges,\n Output,\n ViewChild,\n ViewEncapsulation,\n inject,\n} from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { CdkPortalOutlet, PortalModule } from '@angular/cdk/portal';\nimport { A11yModule } from '@angular/cdk/a11y';\nimport { PRAXIS_DIALOG_DATA } from './dialog.tokens';\nimport { ActionsLayout, DialogAction, DialogThemeColor, DialogAnimation } from './dialog.types';\nimport { PraxisDialogTitleDirective } from './title.directive';\nimport { PraxisDialogActionsDirective } from './actions.directive';\nimport { PraxisDialogContentDirective } from './content.directive';\nimport { MatIconModule } from '@angular/material/icon';\nimport { PraxisIconDirective } from '@praxisui/core';\n\n@Component({\n selector: 'praxis-dialog',\n standalone: true,\n imports: [CommonModule, PortalModule, A11yModule, MatIconModule, PraxisIconDirective],\n templateUrl: './dialog.component.html',\n styleUrls: ['./dialog.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n})\nexport class PraxisDialogComponent implements OnInit, OnChanges, OnDestroy {\n @Input() title?: string;\n @Input() actions: DialogAction[] = [];\n @Input() actionsLayout: ActionsLayout = 'stretched';\n @Input() animation: boolean | DialogAnimation = true;\n @Input() open = true;\n @Input() width?: string | number;\n @Input() height?: string | number;\n @Input() minWidth?: string | number;\n @Input() maxWidth?: string | number;\n @Input() minHeight?: string | number;\n @Input() maxHeight?: string | number;\n @Input() themeColor: DialogThemeColor = 'light';\n @Input() disableClose = false;\n @Input() hasBackdrop = true;\n @Input() overlayMode = false; // true when opened via service/CDK overlay\n @Input() zIndex?: number;\n @Input() panelClass?: string | string[] | Record<string, boolean>;\n @Input() backdropClass?: string | string[] | Record<string, boolean>;\n @Input() position?: { top?: string; bottom?: string; left?: string; right?: string };\n @Input() autoFocusedElement?: string;\n @Input() autoFocus?: boolean;\n @Input() restoreFocus = true;\n @Input() id?: string;\n @Input() ariaRole: 'dialog' | 'alertdialog' = 'dialog';\n @Input() ariaLabel?: string;\n @Input() ariaLabelledBy?: string;\n @Input() ariaDescribedBy?: string;\n @Input() styles?: import('./dialog.types').PraxisDialogStyleConfig;\n @Input() titleIcon?: string;\n\n @Output() action = new EventEmitter<DialogAction>();\n @Output() close = new EventEmitter<any>();\n @Output() opened = new EventEmitter<void>();\n @Output() afterClosed = new EventEmitter<void>();\n\n @ViewChild(CdkPortalOutlet, { static: false }) contentHost!: CdkPortalOutlet;\n @ViewChild('panel', { static: true }) panelEl!: ElementRef<HTMLElement>;\n @ContentChild(PraxisDialogTitleDirective, { read: PraxisDialogTitleDirective }) titleTpl?: PraxisDialogTitleDirective;\n @ContentChild(PraxisDialogActionsDirective, { read: PraxisDialogActionsDirective }) actionsTpl?: PraxisDialogActionsDirective;\n @ContentChild(PraxisDialogContentDirective, { read: PraxisDialogContentDirective }) contentTpl?: PraxisDialogContentDirective;\n\n @HostBinding('class') hostClass = 'pdx-dialog-host';\n @HostBinding('attr.tabindex') tabindex = '-1';\n\n readonly data = inject(PRAXIS_DIALOG_DATA, { optional: true }) as unknown;\n get titleId(): string { return (this.id ?? 'praxis-dialog') + '-title'; }\n\n isDisplayed = false; // controls DOM visibility for animation in tag mode\n\n ngOnInit(): void {\n if (this.open) {\n this.isDisplayed = true;\n this.applyAnimationVars();\n this.applyStyleVars();\n this.beginOpenAnimation().then(() => {\n if (!this.overlayMode) this.opened.emit();\n });\n this.scheduleInitialFocus();\n }\n if (this.ariaRole === 'alertdialog') {\n const hasLabel = !!(this.title || this.ariaLabel || this.ariaLabelledBy);\n try {\n const isDev = typeof (globalThis as any).ngDevMode !== 'undefined' ? !!(globalThis as any).ngDevMode : true;\n if (isDev && !hasLabel) {\n console.warn('[PraxisDialog] alertdialog requires a title or aria label.');\n }\n } catch {}\n }\n }\n\n ngOnChanges(changes: SimpleChanges): void {\n if (changes['open'] && this.open) {\n this.isDisplayed = true;\n this.applyAnimationVars();\n this.applyStyleVars();\n this.beginOpenAnimation().then(() => {\n if (!this.overlayMode) this.opened.emit();\n });\n this.scheduleInitialFocus();\n }\n if (changes['open'] && !this.open && !this.overlayMode && this.isDisplayed) {\n // animate close then hide\n this.beginCloseAnimation().then(() => {\n this.isDisplayed = false;\n this.afterClosed.emit();\n if (this.restoreFocus && this._previouslyFocused && typeof this._previouslyFocused.focus === 'function') {\n try { this._previouslyFocused.focus(); } catch {}\n }\n });\n }\n if (changes['animation']) {\n this.applyAnimationVars();\n }\n if (changes['styles']) {\n this.applyStyleVars();\n }\n }\n\n onKeydown(ev: KeyboardEvent): void {\n if (ev.key === 'Escape' && !this.disableClose) {\n ev.stopPropagation();\n this.close.emit();\n }\n if ((ev.key === 'Enter' || ev.key === ' ') && !this.disableClose) {\n const target = ev.target as HTMLElement | null;\n const isInteractive = !!target && /^(BUTTON|A|INPUT|TEXTAREA|SELECT)$/.test(target.tagName);\n if (!isInteractive) {\n const primary = this.actions.find((a) => a.role === 'primary') || this.actions[0];\n if (primary) {\n ev.preventDefault();\n this.onActionClick(primary);\n }\n }\n }\n }\n\n onActionClick(a: DialogAction): void {\n this.action.emit(a);\n if (a.close) {\n this.close.emit(a.payload);\n }\n }\n\n onBackdrop(ev: MouseEvent): void {\n if (!this.hasBackdrop) return;\n if (this.disableClose) return;\n // Avoid closing when clicking inside the panel area\n this.close.emit();\n }\n\n focus(): void {\n try {\n this.panelEl?.nativeElement?.focus?.();\n } catch {}\n }\n\n private scheduleInitialFocus(): void {\n const panel = this.panelEl?.nativeElement;\n if (!panel) return;\n const prev = document.activeElement as HTMLElement | null;\n if (!this._previouslyFocused && this.restoreFocus) this._previouslyFocused = prev;\n queueMicrotask(() => {\n try {\n if (this.autoFocus && this.ariaRole === 'alertdialog') {\n // In alertdialog, focus the primary action if present\n const focused = this.focusPrimaryAction();\n if (focused) return;\n }\n if (this.autoFocusedElement) {\n const el = panel.querySelector(this.autoFocusedElement) as HTMLElement | null;\n el?.focus?.();\n return;\n }\n // focus first focusable\n const focusable = panel.querySelector(\n 'button, [href], input, select, textarea, [tabindex]:not([tabindex=\"-1\"])',\n ) as HTMLElement | null;\n (focusable || panel).focus?.();\n } catch {}\n });\n }\n\n private _previouslyFocused?: HTMLElement | null;\n ngOnDestroy(): void {\n if (this.restoreFocus && this._previouslyFocused && typeof this._previouslyFocused.focus === 'function') {\n try { this._previouslyFocused.focus(); } catch {}\n }\n }\n\n get animationClasses(): string[] {\n const anim = this.animation;\n if (!anim) return [];\n const conf: DialogAnimation = typeof anim === 'boolean' ? { type: 'translate', duration: 300 } : anim;\n const type = conf.type || 'translate';\n const dir = conf.direction || 'up';\n const map: Record<string, string> = {\n translate: `pdx-anim-translate-${dir}`,\n slide: `pdx-anim-translate-${dir}`,\n fade: 'pdx-anim-fade',\n expand: 'pdx-anim-zoom',\n zoom: 'pdx-anim-zoom',\n };\n return [map[type] || ''];\n }\n\n get panelNgClass(): Record<string, boolean> | string[] {\n const anim = this.animationClasses || [];\n const extra = this.panelClass as any;\n if (extra && typeof extra === 'object' && !Array.isArray(extra)) {\n const obj: any = { ...extra };\n for (const c of anim) obj[c] = true;\n return obj;\n }\n if (typeof extra === 'string') return [...anim, extra];\n if (Array.isArray(extra)) return [...anim, ...extra];\n return anim;\n }\n\n applyAnimationVars(): void {\n if (!this.panelEl) return;\n const anim = this.animation;\n const conf: DialogAnimation = anim === true || anim == null ? { type: 'translate', duration: 300 } : (anim as DialogAnimation);\n const dur = (conf.duration ?? 300) as number;\n try {\n this.panelEl.nativeElement.style.setProperty('--pdx-dialog-anim-duration', `${dur}ms`);\n this.panelEl.nativeElement.style.setProperty('--pdx-dialog-anim-ease', conf.easing || 'cubic-bezier(0.2, 0, 0, 1)');\n } catch {}\n }\n\n applyStyleVars(): void {\n if (!this.panelEl) return;\n const s = this.styles || {};\n const set = (name: string, value: any) => {\n if (value == null) return;\n try { this.panelEl.nativeElement.style.setProperty(name, String(value)); } catch {}\n };\n // Base\n set('--pdx-dialog-actions-padding', s.actionsPadding);\n set('--pdx-dialog-elevation-shadow', s.containerElevationShadow);\n set('--pdx-dialog-max-width', s.containerMaxWidth);\n set('--pdx-dialog-min-width', s.containerMinWidth);\n set('--pdx-dialog-shape', s.containerShape);\n set('--pdx-dialog-small-max-width', s.containerSmallMaxWidth);\n set('--pdx-dialog-content-padding', s.contentPadding);\n set('--pdx-dialog-headline-padding', s.headlinePadding);\n set('--pdx-dialog-with-actions-content-padding', s.withActionsContentPadding);\n // Color\n set('--pdx-dialog-container-color', s.containerColor);\n set('--pdx-dialog-subhead-color', s.subheadColor);\n set('--pdx-dialog-supporting-text-color', s.supportingTextColor);\n // Typography - title\n set('--pdx-dialog-subhead-font', s.subheadFont);\n set('--pdx-dialog-subhead-line-height', s.subheadLineHeight);\n set('--pdx-dialog-subhead-size', s.subheadSize);\n set('--pdx-dialog-subhead-tracking', s.subheadTracking);\n set('--pdx-dialog-subhead-weight', s.subheadWeight);\n // Typography - content\n set('--pdx-dialog-supporting-text-font', s.supportingTextFont);\n set('--pdx-dialog-supporting-text-line-height', s.supportingTextLineHeight);\n set('--pdx-dialog-supporting-text-size', s.supportingTextSize);\n set('--pdx-dialog-supporting-text-tracking', s.supportingTextTracking);\n set('--pdx-dialog-supporting-text-weight', s.supportingTextWeight);\n // Alignment alias\n if (s.actionsAlignment) this.actionsLayout = s.actionsAlignment as any;\n }\n\n beginOpenAnimation(): Promise<void> {\n if (!this.animation) return Promise.resolve();\n const panel = this.panelEl?.nativeElement;\n if (!panel) return Promise.resolve();\n panel.classList.add('pdx-state-opening');\n return new Promise((resolve) => {\n requestAnimationFrame(() => {\n panel.classList.remove('pdx-state-opening');\n panel.classList.add('pdx-state-open');\n // resolve after transition duration\n const dur = parseFloat(getComputedStyle(panel).getPropertyValue('--pdx-dialog-anim-duration')) || 300;\n setTimeout(() => resolve(), dur);\n });\n });\n }\n\n beginCloseAnimation(): Promise<void> {\n if (!this.animation) return Promise.resolve();\n const panel = this.panelEl?.nativeElement;\n if (!panel) return Promise.resolve();\n panel.classList.add('pdx-state-closing');\n return new Promise((resolve) => {\n let done = false;\n const finish = () => { if (done) return; done = true; panel.removeEventListener('transitionend', onEnd); resolve(); };\n const onEnd = (ev: Event) => {\n if ((ev as TransitionEvent).propertyName === 'opacity' || (ev as TransitionEvent).propertyName === 'transform') finish();\n };\n panel.addEventListener('transitionend', onEnd);\n const durVar = getComputedStyle(panel).getPropertyValue('--pdx-dialog-anim-duration');\n const durMs = parseFloat(durVar) || 300;\n setTimeout(finish, durMs + 20);\n });\n }\n\n private focusPrimaryAction(): boolean {\n try {\n const panel = this.panelEl?.nativeElement;\n if (!panel) return false;\n const buttons = Array.from(panel.querySelectorAll<HTMLButtonElement>('.pdx-dialog__actions .pdx-dialog__action-btn'));\n if (buttons.length === 0) return false;\n // Prefer the first button corresponding to a primary role\n const primaryIndex = this.actions.findIndex((a) => a?.role === 'primary');\n if (primaryIndex >= 0 && buttons[primaryIndex]) {\n buttons[primaryIndex].focus();\n return true;\n }\n // Fallback to last button\n buttons[buttons.length - 1].focus();\n return true;\n } catch {\n return false;\n }\n }\n}\n\nexport const PraxisDialogDirectives = [] as const;\n","@let _titleId = (id ?? 'praxis-dialog') + '-title';\n\n<ng-template #panelHeader>\n <div class=\"pdx-dialog__title\" @if (titleTpl?.templateRef || title || titleIcon)>\n @if (titleTpl?.templateRef) {\n <ng-container [ngTemplateOutlet]=\"titleTpl!.templateRef\"></ng-container>\n } @else {\n <div class=\"pdx-dialog__title-row\">\n <mat-icon *ngIf=\"titleIcon\" class=\"pdx-dialog__title-icon\" [praxisIcon]=\"titleIcon\" aria-hidden=\"true\"></mat-icon>\n <h2 class=\"pdx-dialog__title-text\" [attr.id]=\"_titleId\">{{ title }}</h2>\n </div>\n }\n </div>\n </ng-template>\n\n<ng-template #panelActions>\n <div class=\"pdx-dialog__actions\" [class.is-stretched]=\"actionsLayout==='stretched'\">\n @if (actionsTpl?.templateRef) {\n <ng-container [ngTemplateOutlet]=\"actionsTpl!.templateRef\"></ng-container>\n } @else {\n @for (a of actions; track a?.id ?? a) {\n <button\n type=\"button\"\n class=\"pdx-dialog__action-btn\"\n [attr.data-testid]=\"a.id || null\"\n [ngClass]=\"a.cssClass\"\n (click)=\"onActionClick(a)\"\n [attr.cdkFocusInitial]=\"a.role==='primary' && ariaRole==='alertdialog' ? '' : null\"\n >\n <mat-icon *ngIf=\"a.icon\" [praxisIcon]=\"a.icon\"></mat-icon>\n {{ a.text }}\n </button>\n }\n }\n </div>\n</ng-template>\n\n@if (overlayMode) {\n <div\n #panel\n class=\"pdx-dialog pdx-dialog--{{ themeColor }} pdx-dialog--layout-{{ actionsLayout }}\"\n [attr.role]=\"ariaRole\"\n [attr.id]=\"id || null\"\n [attr.aria-modal]=\"true\"\n [attr.aria-label]=\"ariaLabel || null\"\n [attr.aria-labelledby]=\"(ariaLabelledBy || (title ? _titleId : null))\"\n [attr.aria-describedby]=\"ariaDescribedBy || null\"\n (keydown)=\"onKeydown($event)\"\n cdkTrapFocus\n [ngClass]=\"panelNgClass\"\n [style.width]=\"width\"\n [style.height]=\"height\"\n [style.min-width]=\"minWidth\"\n [style.max-width]=\"maxWidth\"\n [style.min-height]=\"minHeight\"\n [style.max-height]=\"maxHeight\"\n [class.has-actions]=\"(actions.length||0)>0 || !!actionsTpl?.templateRef\"\n >\n <ng-container [ngTemplateOutlet]=\"panelHeader\"></ng-container>\n <div class=\"pdx-dialog__content\">\n @if (contentTpl?.templateRef) {\n <ng-container [ngTemplateOutlet]=\"contentTpl!.templateRef\"></ng-container>\n } @else {\n <ng-template cdkPortalOutlet></ng-template>\n }\n </div>\n <ng-container [ngTemplateOutlet]=\"panelActions\"></ng-container>\n </div>\n} @else {\n <div class=\"pdx-dialog-overlay\" [class.has-backdrop]=\"hasBackdrop\" [hidden]=\"!isDisplayed\" (click)=\"onBackdrop($event)\" [ngClass]=\"backdropClass\" [style.z-index]=\"zIndex\">\n <div class=\"pdx-dialog-shell\" (click)=\"$event.stopPropagation()\">\n <div\n #panel\n class=\"pdx-dialog pdx-dialog--{{ themeColor }} pdx-dialog--layout-{{ actionsLayout }}\"\n [attr.role]=\"ariaRole\"\n [attr.id]=\"id || null\"\n [attr.aria-modal]=\"true\"\n [attr.aria-label]=\"ariaLabel || null\"\n [attr.aria-labelledby]=\"(ariaLabelledBy || (title ? _titleId : null))\"\n [attr.aria-describedby]=\"ariaDescribedBy || null\"\n (keydown)=\"onKeydown($event)\"\n cdkTrapFocus\n [ngClass]=\"panelNgClass\"\n [style.width]=\"width\"\n [style.height]=\"height\"\n [style.min-width]=\"minWidth\"\n [style.max-width]=\"maxWidth\"\n [style.min-height]=\"minHeight\"\n [style.max-height]=\"maxHeight\"\n [style.top]=\"position?.top || null\"\n [style.bottom]=\"position?.bottom || null\"\n [style.left]=\"position?.left || null\"\n [style.right]=\"position?.right || null\"\n [class.pdx-has-position]=\"position\"\n [class.has-actions]=\"(actions.length||0)>0 || !!actionsTpl?.templateRef\"\n >\n <ng-container [ngTemplateOutlet]=\"panelHeader\"></ng-container>\n <div class=\"pdx-dialog__content\">\n @if (contentTpl?.templateRef) {\n <ng-container [ngTemplateOutlet]=\"contentTpl!.templateRef\"></ng-container>\n } @else {\n <ng-template cdkPortalOutlet></ng-template>\n }\n </div>\n <ng-container [ngTemplateOutlet]=\"panelActions\"></ng-container>\n </div>\n </div>\n </div>\n}\n","import { Injectable, Injector, inject, ComponentRef } from '@angular/core';\nimport { Overlay, OverlayConfig, OverlayModule, OverlayRef } from '@angular/cdk/overlay';\nimport { ComponentPortal, PortalModule } from '@angular/cdk/portal';\nimport { PraxisDialogConfig } from '../dialog.types';\nimport { PraxisDialogComponent } from '../dialog.component';\n\n@Injectable({ providedIn: 'root' })\nexport class DialogOverlayService {\n private readonly overlay = inject(Overlay);\n\n createOverlay(cfg: PraxisDialogConfig, injector: Injector): OverlayRef {\n const overlayConfig = this.buildOverlayConfig(cfg);\n return this.overlay.create(overlayConfig);\n }\n\n attachContainer(ref: OverlayRef, injector: Injector): ComponentRef<PraxisDialogComponent> {\n const portal = new ComponentPortal(PraxisDialogComponent, null, injector);\n const compRef = ref.attach(portal);\n return compRef;\n }\n\n private buildOverlayConfig(cfg: PraxisDialogConfig): OverlayConfig {\n const positionStrategy = this.overlay\n .position()\n .global()\n .centerHorizontally()\n .centerVertically();\n\n if (cfg?.position) {\n if (cfg.position.top != null) positionStrategy.top(String(cfg.position.top));\n if (cfg.position.bottom != null)\n positionStrategy.bottom(String(cfg.position.bottom));\n if (cfg.position.left != null) positionStrategy.left(String(cfg.position.left));\n if (cfg.position.right != null)\n positionStrategy.right(String(cfg.position.right));\n }\n\n const scrollStrategy = (() => {\n switch (cfg?.scrollStrategy) {\n case 'noop':\n return this.overlay.scrollStrategies.noop();\n case 'reposition':\n return this.overlay.scrollStrategies.reposition();\n case 'block':\n default:\n return this.overlay.scrollStrategies.block();\n }\n })();\n\n const hasBackdrop = cfg?.hasBackdrop ?? true;\n const overlayConfig = new OverlayConfig({\n hasBackdrop,\n disposeOnNavigation: cfg?.closeOnNavigation ?? true,\n panelClass: cfg?.panelClass as any,\n backdropClass: cfg?.backdropClass as any,\n positionStrategy,\n scrollStrategy,\n width: coerceCssUnit(cfg?.width),\n height: coerceCssUnit(cfg?.height),\n });\n\n if (cfg?.zIndex != null) {\n (overlayConfig as any).zIndex = cfg.zIndex;\n }\n\n return overlayConfig;\n }\n}\n\nfunction coerceCssUnit(v?: string | number): string | undefined {\n if (v == null) return undefined;\n return typeof v === 'number' ? `${v}px` : v;\n}\n\nexport const DialogOverlayImports = [OverlayModule, PortalModule] as const;\n","import {\n ApplicationRef,\n ComponentRef,\n Injectable,\n Injector,\n TemplateRef,\n Type,\n ViewContainerRef,\n inject,\n Component,\n} from '@angular/core';\nimport { OverlayRef } from '@angular/cdk/overlay';\nimport { ComponentPortal, TemplatePortal } from '@angular/cdk/portal';\nimport { DialogOverlayService } from './overlay/dialog-overlay.service';\nimport { PraxisDialogComponent } from './dialog.component';\nimport { PRAXIS_DIALOG_CONTENT_REGISTRY, PRAXIS_DIALOG_DATA, PRAXIS_DIALOG_I18N, PRAXIS_DIALOG_TEMPLATE_REGISTRY, PRAXIS_DIALOG_GLOBAL_PRESETS, PRAXIS_DIALOG_DEFAULTS } from './dialog.tokens';\nimport { PraxisDialogConfig, PraxisConfirmConfig, PraxisAlertConfig, PraxisPromptConfig } from './dialog.types';\nimport { PraxisDialogRef } from './dialog.ref';\nimport { FormsModule } from '@angular/forms';\nimport { DomSanitizer, SafeHtml } from '@angular/platform-browser';\nimport { CommonModule } from '@angular/common';\nimport { Subject } from 'rxjs';\n\n@Injectable({ providedIn: 'root' })\nexport class PraxisDialog {\n private readonly overlay = inject(DialogOverlayService);\n private readonly appRef = inject(ApplicationRef);\n private readonly registry = inject(PRAXIS_DIALOG_CONTENT_REGISTRY);\n private readonly i18n = inject(PRAXIS_DIALOG_I18N);\n private readonly templateRegistry = inject(PRAXIS_DIALOG_TEMPLATE_REGISTRY);\n private readonly sanitizer = inject(DomSanitizer);\n private readonly globalPresets = inject(PRAXIS_DIALOG_GLOBAL_PRESETS);\n private readonly defaults = inject(PRAXIS_DIALOG_DEFAULTS);\n readonly afterAllClosed = new Subject<void>();\n readonly afterOpened = new Subject<PraxisDialogRef<any>>();\n private _openDialogs: PraxisDialogRef<any>[] = [];\n get openDialogs(): PraxisDialogRef<any>[] { return this._openDialogs.slice(); }\n private _seq = 0;\n\n open<T, D = any, R = any>(\n content: Type<T> | TemplateRef<any>,\n config?: PraxisDialogConfig<D>,\n ): PraxisDialogRef<T, R> {\n const injector = Injector.create({\n providers: [{ provide: PRAXIS_DIALOG_DATA, useValue: config?.data }],\n });\n const overlayRef = this.overlay.createOverlay(config ?? {}, injector);\n const ref = new PraxisDialogRef<T, R>(overlayRef);\n // Auto-id fallback if not provided\n let assignedId = config?.id ?? `praxis-dialog-${++this._seq}`;\n while (this.getDialogById(assignedId)) {\n assignedId = `praxis-dialog-${++this._seq}`;\n }\n ref.id = assignedId;\n\n const compRef = this.overlay.attachContainer(overlayRef, injector);\n const container = compRef.instance;\n // Set inputs before detectChanges so the correct branch/materialization occurs\n container.overlayMode = true;\n container.title = config?.title;\n (container as any).titleIcon = (config as any)?.icon ?? (config as any)?.titleIcon;\n container.actions = config?.actions ?? [];\n container.actionsLayout = config?.actionsLayout ?? 'stretched';\n container.animation = config?.animation ?? { type: 'translate', duration: 300 };\n container.width = config?.width;\n container.height = config?.height;\n container.minWidth = config?.minWidth;\n container.maxWidth = config?.maxWidth ?? this.defaults.maxWidth;\n container.minHeight = config?.minHeight;\n container.maxHeight = config?.maxHeight ?? this.defaults.maxHeight;\n container.themeColor = config?.themeColor ?? 'light';\n container.styles = config?.styles;\n container.disableClose = !!config?.disableClose;\n container.hasBackdrop = config?.hasBackdrop ?? true;\n container.panelClass = config?.panelClass;\n container.backdropClass = config?.backdropClass;\n container.position = config?.position;\n container.autoFocusedElement = config?.autoFocusedElement;\n (container as any).autoFocus = (config as any)?.autoFocus ?? (container as any).autoFocus;\n container.restoreFocus = config?.restoreFocus ?? true;\n container.id = assignedId;\n container.ariaRole = config?.ariaRole ?? 'dialog';\n container.ariaLabel = config?.ariaLabel;\n container.ariaLabelledBy = config?.ariaLabelledBy;\n container.ariaDescribedBy = config?.ariaDescribedBy;\n try { compRef.changeDetectorRef.detectChanges(); } catch {}\n\n const subAction = container.action.subscribe((a) => {\n if (a.close && !config?.disableClose) {\n ref.close(a.payload);\n }\n });\n const subClose = container.close.subscribe((result) => {\n if (!config?.disableClose) {\n ref.close(result);\n }\n });\n\n const backdropSub = overlayRef.backdropClick().subscribe((ev) => {\n ref.notifyBackdropClick(ev as any);\n if (!config?.disableClose && (config?.closeOnBackdropClick ?? true)) {\n ref.close();\n }\n });\n const keydownSub = overlayRef.keydownEvents().subscribe((ev) => {\n ref.notifyKeydown(ev as any);\n });\n\n // Attach portal content now that the outlet exists\n const doAttach = () => {\n if (content instanceof TemplateRef) {\n const origin = (config?.viewContainerRef as ViewContainerRef) ?? (null as unknown as ViewContainerRef);\n const portal = new TemplatePortal(content, origin, { $implicit: config?.data });\n (container as any).contentHost.attachTemplatePortal(portal);\n } else {\n const portal = new ComponentPortal<T>(content);\n const innerRef = (container as any).contentHost.attachComponentPortal(portal);\n ref.componentInstance = innerRef.instance;\n }\n };\n if ((container as any).contentHost) {\n doAttach();\n } else {\n try { compRef.changeDetectorRef.detectChanges(); } catch {}\n queueMicrotask(() => {\n if ((container as any).contentHost) doAttach();\n });\n }\n\n // Animate open then emit afterOpened\n container.beginOpenAnimation().then(() => {\n ref.emitOpened();\n this.afterOpened.next(ref);\n });\n\n overlayRef.detachments().subscribe(() => {\n subAction.unsubscribe();\n subClose.unsubscribe();\n backdropSub.unsubscribe();\n keydownSub.unsubscribe();\n });\n\n // Close animation hook\n ref.setBeforeClose(async () => {\n await container.beginCloseAnimation();\n });\n\n // Track open dialogs and notify when all are closed\n this._openDialogs.push(ref);\n ref.afterClosed().subscribe(() => {\n this._openDialogs = this._openDialogs.filter((r) => r !== ref);\n if (this._openDialogs.length === 0) this.afterAllClosed.next();\n });\n\n return ref;\n }\n\n confirm(cfg: PraxisConfirmConfig, variant?: string) {\n const merged = this.mergePresets('confirm', variant, cfg);\n const actions = [\n { text: merged.cancelLabel ?? this.i18n.cancel, role: 'secondary', close: true, id: 'cancel', payload: false },\n { text: merged.confirmLabel ?? this.i18n.ok, role: 'primary', close: true, id: 'confirm', payload: true },\n ];\n const Comp = SimpleDialogContentComponent;\n return this.open(Comp, {\n ...merged,\n actions,\n data: { message: merged.message, mode: 'confirm' },\n ariaRole: merged.ariaRole ?? 'alertdialog',\n });\n }\n\n alert(cfg: PraxisAlertConfig) {\n const merged = this.mergePresets('alert', undefined, cfg);\n const actions = [\n { text: merged.okLabel ?? this.i18n.ok, role: 'primary', close: true, id: 'ok' },\n ];\n const Comp = SimpleDialogContentComponent;\n return this.open(Comp, { ...merged, actions, data: { message: merged.message, mode: 'alert' }, ariaRole: merged.ariaRole ?? 'alertdialog' });\n }\n\n prompt(cfg: PraxisPromptConfig) {\n const merged = this.mergePresets('prompt', undefined, cfg);\n const actions = [\n { text: merged.cancelLabel ?? this.i18n.cancel, role: 'secondary', close: true, id: 'cancel', payload: null },\n { text: merged.okLabel ?? this.i18n.ok, role: 'primary', close: false, id: 'ok' },\n ];\n const Comp = SimpleDialogContentComponent;\n const ref = this.open<any, any, string | null>(Comp, { ...merged, actions, data: { message: merged.message, mode: 'prompt', placeholder: merged.placeholder, defaultValue: merged.defaultValue }, ariaRole: merged.ariaRole ?? 'dialog' });\n ref.afterOpened().subscribe(() => {\n const inst: any = (ref as any).componentInstance as SimpleDialogContentComponent;\n inst.submit = () => ref.close(inst.value ?? '');\n });\n return ref;\n }\n\n openByRegistry(id: string, config?: PraxisDialogConfig): PraxisDialogRef<any, any> {\n const comp = this.registry[id];\n if (!comp) {\n throw new Error(`Dialog registry: component '${id}' not found`);\n }\n return this.open(comp as any, config);\n }\n\n openTemplateById(templateId: string, config?: PraxisDialogConfig): PraxisDialogRef<any, any> {\n const tpl = this.templateRegistry[templateId];\n if (!tpl) throw new Error(`Dialog template '${templateId}' not found`);\n return this.open(tpl, config);\n }\n\n openSafeHtml(html: string, config?: PraxisDialogConfig): PraxisDialogRef<any, any> {\n const safe: SafeHtml = this.sanitizer.bypassSecurityTrustHtml(html);\n const Comp = SimpleHtmlDialogContentComponent;\n return this.open(Comp, { ...config, data: { safeHtml: safe } });\n }\n\n private mergePresets(type: 'confirm' | 'alert' | 'prompt', variant: string | undefined, cfg: any): any {\n const base = this.globalPresets?.[type] ?? {};\n const variantCfg = variant ? (this.globalPresets?.variants?.[variant] ?? {}) : {};\n return mergeDialogConfig(mergeDialogConfig(base, variantCfg), cfg);\n }\n\n closeAll(): void {\n const list = this._openDialogs.slice();\n list.forEach((r) => r.close());\n }\n\n getDialogById(id: string): PraxisDialogRef<any> | undefined {\n return this._openDialogs.find((r) => r.id === id);\n }\n}\n\n\n@Component({\n selector: 'praxis-simple-dialog-content',\n standalone: true,\n imports: [CommonModule, FormsModule],\n template: `\n <div class=\"pdx-simple-dialog\">\n <p *ngIf=\"message\" class=\"pdx-simple-dialog__message\">{{ message }}</p>\n <input\n *ngIf=\"mode === 'prompt'\"\n class=\"pdx-simple-dialog__input\"\n [attr.placeholder]=\"placeholder || ''\"\n [(ngModel)]=\"value\"\n />\n </div>\n `,\n})\nclass SimpleDialogContentComponent {\n message?: string;\n mode: 'confirm' | 'alert' | 'prompt' = 'alert';\n placeholder?: string;\n value?: string | null;\n submit?: () => void;\n private readonly dialogData = inject(PRAXIS_DIALOG_DATA, { optional: true } as any);\n\n constructor() {\n const data: any = this.dialogData;\n try {\n this.message = data?.message;\n this.mode = (data?.mode as any) || 'alert';\n this.placeholder = data?.placeholder;\n this.value = data?.defaultValue ?? null;\n } catch {}\n }\n}\n\n@Component({\n selector: 'praxis-simple-html-dialog-content',\n standalone: true,\n imports: [],\n template: `<div class=\"pdx-simple-dialog\" [innerHTML]=\"safeHtml\"></div>`,\n})\nclass SimpleHtmlDialogContentComponent {\n safeHtml?: SafeHtml;\n}\n\nfunction mergeDialogConfig<A extends object, B extends object>(a: A, b: B): A & B {\n const out: any = { ...(a as any) };\n for (const [k, v] of Object.entries(b || {})) {\n if (v == null) continue;\n if (k === 'styles' && typeof v === 'object') {\n out.styles = { ...(out.styles || {}), ...(v as any) };\n } else if (k === 'actions' && Array.isArray(v)) {\n out.actions = v.slice();\n } else if (typeof v === 'object' && !Array.isArray(v)) {\n out[k] = { ...(out[k] || {}), ...(v as any) };\n } else {\n out[k] = v;\n }\n }\n return out as A & B;\n}\n","import { Provider } from '@angular/core';\nimport { GlobalConfigService } from '@praxisui/core';\nimport type { GlobalDialogConfig } from '@praxisui/core';\nimport { PRAXIS_DIALOG_GLOBAL_PRESETS, PraxisDialogGlobalPresets } from '../dialog/dialog.tokens';\n\n/**\n * Provides PRAXIS_DIALOG_GLOBAL_PRESETS by transforming GlobalConfig.dialog\n * into the structure expected by @praxisui/dialog.\n */\nexport function provideDialogGlobalPresetsFromGlobalConfig(): Provider {\n return {\n provide: PRAXIS_DIALOG_GLOBAL_PRESETS,\n deps: [GlobalConfigService],\n useFactory: (gc: GlobalConfigService): PraxisDialogGlobalPresets => {\n const d = (gc.get('dialog') as GlobalDialogConfig | undefined) || undefined;\n const coerce = (entry: any) => {\n if (!entry || typeof entry !== 'object') return entry;\n const out: any = { ...entry };\n // Best-effort JSON parse for text inputs saved via editor\n const parseIfString = (v: any) => {\n if (typeof v === 'string') {\n try { return JSON.parse(v); } catch { return v; }\n }\n return v;\n };\n if (typeof out.actions === 'string') out.actions = parseIfString(out.actions);\n if (typeof out.styles === 'string') out.styles = parseIfString(out.styles);\n if (typeof out.animation === 'string') out.animation = parseIfString(out.animation);\n return out;\n };\n const variants: Record<string, any> = {};\n for (const key of Object.keys(d?.variants || {})) {\n variants[key] = coerce((d as any).variants[key]);\n }\n return {\n confirm: coerce(d?.defaults?.confirm) as any,\n alert: coerce(d?.defaults?.alert) as any,\n prompt: coerce(d?.defaults?.prompt) as any,\n variants,\n };\n },\n };\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["coerceCssUnit","i2"],"mappings":";;;;;;;;;;;;;;;;;MAEa,kBAAkB,GAAG,IAAI,cAAc,CAAU,oBAAoB;MAErE,kBAAkB,GAAG,IAAI,cAAc,CAOlD,oBAAoB,EAAE;AACtB,IAAA,UAAU,EAAE,MAAM;IAClB,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC;AACzE,CAAA;MAEY,sBAAsB,GAAG,IAAI,cAAc,CAKtD,wBAAwB,EAAE;AAC1B,IAAA,UAAU,EAAE,MAAM;AAClB,IAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,CAAC;AACzD,CAAA;MAGY,8BAA8B,GAAG,IAAI,cAAc,CAE9D,gCAAgC,EAAE;AAClC,IAAA,UAAU,EAAE,MAAM;AAClB,IAAA,OAAO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