import * as i0 from '@angular/core'; import { AfterViewInit, OnDestroy, ElementRef, InjectionToken, OnInit, TemplateRef, Injector, ChangeDetectorRef, Renderer2, NgZone, EnvironmentInjector, OnChanges, EventEmitter, SimpleChanges } from '@angular/core'; import { ActivatedRoute, Router, Routes, Params, Route, Data, CanDeactivateFn } from '@angular/router'; import { KirbyAnimation, ThemeColor, PlatformService } from '@kirbydesign/designsystem/helpers'; import { Observable } from 'rxjs'; import { ModalController as ModalController$1, AnimationBuilder, IonContent } from '@ionic/angular/standalone'; import { WindowRef } from '@kirbydesign/designsystem/types'; import { OverlayEventDetail as OverlayEventDetail$1 } from '@ionic/core/components'; import { TranslationService, ResizeObserverService } from '@kirbydesign/designsystem/shared'; interface OverlayEventDetail { data?: T; role?: string; } interface Overlay { dismiss: (data?: any) => Promise; onWillDismiss: Promise; onDidDismiss: Promise; isDismissing?: boolean; } interface ModalRouteActivation { route: ActivatedRoute; isNewModal: boolean; } declare abstract class Modal { didPresent: Promise; willClose: Promise; close: (data?: any) => Promise; scrollToTop: (scrollDuration?: KirbyAnimation.Duration) => void; scrollToBottom: (scrollDuration?: KirbyAnimation.Duration) => void; scrollDisabled: boolean; canDismiss: ShowAlertCallback; focusTitle?: () => void; } /** * WARNING: This is for internal use only and should not be used outside of Kirby. */ declare enum ModalElementType { PAGE_PROGRESS = 0, FOOTER = 1, TITLE = 2 } /** * WARNING: This is for internal use only and should not be used outside of Kirby. */ declare abstract class ModalElementsAdvertiser { addModalElement: (type: ModalElementType, elementRef: ElementRef) => void; removeModalElement: (type: ModalElementType, elementRef: ElementRef) => void; } /** * WARNING: This is for internal use only and should not be used outside of Kirby. */ declare abstract class ModalElementComponent implements AfterViewInit, OnDestroy { private modalElementType; private elementRef; private modalElementsAdvertiser; private get isContainedInModal(); constructor(modalElementType: ModalElementType, elementRef: ElementRef, modalElementsAdvertiser: ModalElementsAdvertiser); ngAfterViewInit(): void; ngOnDestroy(): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } interface ActionSheetItem { id: string; text: string; } interface ActionSheetConfig { header?: string; subheader?: string; items: Array; cancelButtonText?: string; } interface AlertConfig { title: string | Observable; message?: string | Observable; cancelBtn?: string | Observable; icon?: { name: string; themeColor?: string; }; okBtn?: string | Observable | { text: string | Observable; isDestructive: boolean; }; } declare class ModalNavigationService { private router; private route; constructor(router: Router, route: ActivatedRoute); isModalRoute(url: string): boolean; private getCurrentActivatedRoute; private getModalRoutes; private getModuleRootPath; private getCurrentRoutePaths; private getRoutePathsWithoutChildSegments; private findChildRouteForUrl; private pathContainsChildRouteWithUrlParams; private getRoutePaths; private getRoutePath; private getModalRoutePath; private getModalRoutePaths; private isNewModalWindow; private navigationEndListener$; private waitForCurrentThenGetNavigationEndStream; private modalRouteActivatedFor; private modalRouteDeactivatedFor; private modalRouteSetContainsPath; getModalNavigation(routeConfig: Routes[], moduleRootRoutePath?: string): Promise<{ activated$: Observable; deactivated$: Observable; }>; navigateToModal(path: string | string[], queryParams?: Params): Promise; navigateWithinModal(relativePath: string, queryParams?: Params): Promise; navigateOutOfModalOutlet(): Promise; private getBackdropRoute; handleBrowserBackButton(modal: HTMLIonModalElement): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } declare class DrawerSupplementaryAction { iconName: string; action: Function; } type ModalFlavor = 'modal' | 'drawer' | 'compact'; type ModalSize = 'small' | 'medium' | 'large' | 'full-height'; type ShowAlertCallback = () => boolean | AlertConfig | Promise; interface ModalConfig { collapseTitle?: boolean; component?: any; size?: ModalSize; customHeight?: string; modalRoute?: ActivatedRoute; siblingModalRouteActivated$?: Observable; flavor?: ModalFlavor; componentProps?: { [key: string]: any; }; canDismiss?: ShowAlertCallback; drawerSupplementaryAction?: DrawerSupplementaryAction; interactWithBackground?: boolean; cssClass?: string | string[]; htmlAttributes?: { [key: string]: any; }; } /** * Here we extend Data and Route from Angular to create a covariant type ModalEnabledRoutes. * This can be used in place of the Routes type when configuring route-based modals in the array * of routes passed to RouterModule in applications. */ type RoutedModalConfig = Omit; interface ModalConfigRouteData extends Data { modalConfig?: RoutedModalConfig; } interface ModalEnabledRoute extends Route { data?: ModalConfigRouteData; children?: ModalEnabledRoutes; } type ModalEnabledRoutes = ModalEnabledRoute[]; declare const COMPONENT_PROPS: InjectionToken; declare class AlertComponent implements AfterViewInit { private elementRef; private windowRef; readonly BLUR_WRAPPER_DELAY_IN_MS = 50; private alertWrapper; private scrollY; title$: Observable; set title(title: string | Observable); message$: Observable; set message(message: string | Observable); iconName: string; iconThemeColor: ThemeColor | `${ThemeColor}`; okBtn$: Observable; set okBtn(okBtn: string | Observable); okBtnIsDestructive: boolean; cancelBtn$: Observable; set cancelBtn(cancelBtn: string | Observable); constructor(elementRef: ElementRef, windowRef: WindowRef); ngAfterViewInit(): void; onFocusChange(): void; onCancel(): void; onOk(): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } declare class AlertHelper { private ionicModalController; constructor(ionicModalController: ModalController$1); showAlert(config: AlertConfig): Promise; private getComponentProps; private getOkBtn; getOkBtnIsDestructive(config: any): any; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } declare class CanDismissHelper { private alertHelper; constructor(alertHelper: AlertHelper); getCanDismissCallback(callback: ShowAlertCallback): () => Promise; showAlert(config: AlertConfig): Promise; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } declare class ModalWrapperComponent implements Modal, AfterViewInit, OnInit, OnDestroy, ModalElementsAdvertiser { private changeDetector; private injector; private elementRef; private renderer; private zone; private resizeObserverService; private windowRef; private platform; private canDismissHelper; private environmentInjector; translations: TranslationService; get _hasCollapsibleTitle(): boolean; static readonly KEYBOARD_HIDE_DELAY_IN_MS = 100; scrollY: number; private readonly VIEWPORT_RESIZE_DEBOUNCE_TIME; set scrollDisabled(disabled: boolean); set canDismiss(callback: ShowAlertCallback); config: ModalConfig; content: TemplateRef; componentPropsInjector: Injector; modalWrapperInjector: Injector; templateRef: TemplateRef; private toolbarButtonsQuery; private ionContent; private ionContentElement; private ionHeaderElement; private ionToolbarElement; private ionTitleElement; private routerOutlet; private _contentTitleElement; get contentTitleElement(): ElementRef; private keyboardVisible; private toolbarButtons; private delayedClose; private delayedCloseTimeoutId; private initialViewportHeight; private viewportResized; private ionModalElement?; private ionModalDialog?; private readonly ionModalDidPresent; readonly didPresent: Promise; private readonly ionModalWillDismiss; readonly willClose: Promise; private viewportResize; private viewportResize$; private mutationObserverUnobserveFn; private _intersectionObserver; private get intersectionObserver(); scrollEventsEnabled: boolean; isContentScrolled: boolean; private destroy$; get _isDrawer(): boolean; willClose$: Observable; private modalElementsMoverDelegate; constructor(changeDetector: ChangeDetectorRef, injector: Injector, elementRef: ElementRef, renderer: Renderer2, zone: NgZone, resizeObserverService: ResizeObserverService, windowRef: WindowRef, platform: PlatformService, canDismissHelper: CanDismissHelper, environmentInjector: EnvironmentInjector, translations: TranslationService); ngOnInit(): void; ngAfterViewInit(): void; private _currentFooter; private set currentFooter(value); private get currentFooter(); addModalElement(type: ModalElementType, modalElement: ElementRef): void; removeModalElement(type: ModalElementType, modalElement: ElementRef): void; private initializeResizeModalToModalWrapper; private initializeSizing; private initializeModalRoute; private onSiblingModalRouteActivated; private patchScrollElementSize; private observeModalFullHeight; private getIonModalWrapperElement; private observeHeaderResize; private listenForIonModalDidPresent; private listenForIonModalWillDismiss; private listenForScroll; private observeTitleContentChanges; private setAriaLabelFromTitleContent; private setAriaLabel; private focusTitleOnDidPresent; focusTitle(): void; scrollToTop(scrollDuration?: KirbyAnimation.Duration): void; scrollToBottom(scrollDuration?: KirbyAnimation.Duration): void; close(data?: any): Promise; onFocusChange(): void; _onKeyboardShow(keyboardHeight: number): void; _onKeyboardHide(): void; private toggleContentMaxHeight; private setKeyboardVisibility; private getKeyboardOverlap; private setCssVar; private toggleCssClass; private setKeyboardOverlap; onHeaderTouchStart(event: TouchEvent): void; _onWindowResize(): void; private setViewportHeight; private observeViewportResize; private onViewportResize; blurActiveElement(): void; private createModalWrapperIntersectionObserver; ngOnDestroy(): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } declare class ModalCompactWrapperComponent implements Modal, OnInit { private injector; private elementRef; private windowRef; private canDismissHelper; private renderer; config: ModalConfig; content: TemplateRef; scrollY: number; scrollDisabled: boolean; componentPropsInjector: Injector; private ionModalElement; private readonly ionModalDidPresent; private readonly ionModalWillDismiss; readonly didPresent: Promise; readonly willClose: Promise; constructor(injector: Injector, elementRef: ElementRef, windowRef: WindowRef, canDismissHelper: CanDismissHelper, renderer: Renderer2); ngOnInit(): void; private listenForIonModalDidPresent; private listenForIonModalWillDismiss; private setAriaLabel; close(data?: any): Promise; set canDismiss(callback: ShowAlertCallback); scrollToTop: (_?: any) => void; scrollToBottom: (_?: any) => void; onFocusChange(): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } declare class ActionSheetHelper { private ionicModalController; constructor(ionicModalController: ModalController$1); showActionSheet(config: ActionSheetConfig): Promise; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } declare class ModalAnimationBuilderService { private platform; constructor(platform: PlatformService); private readonly easingEnter; private readonly easingLeave; private readonly duration; private readonly SwipeToCloseDefaults; enterAnimation(currentBackdrop?: HTMLIonBackdropElement): AnimationBuilder; leaveAnimation(currentBackdrop?: HTMLIonBackdropElement): AnimationBuilder; private createEnterAnimation; private createLeaveAnimation; /** * Gets the root context of a shadow dom element * On newer browsers this will be the shadowRoot, * but for older browser this may just be the * element itself. * * Useful for whenever you need to explicitly * do "myElement.shadowRoot!.querySelector(...)". */ private getElementRoot; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } declare class ModalHelper { private ionicModalController; private modalAnimationBuilder; private modalNavigationService; private windowRef; private canDismissHelper; constructor(ionicModalController: ModalController$1, modalAnimationBuilder: ModalAnimationBuilderService, modalNavigationService: ModalNavigationService, windowRef: WindowRef, canDismissHelper: CanDismissHelper); private isModalOpening; showModalWindow(config: ModalConfig): Promise; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } declare class ModalController implements OnDestroy { private modalHelper; private actionSheetHelper; private alertHelper; private modalNavigationService; private routeConfig; private overlays; private readonly noOverlayRegisteredErrorMessage; private destroy$; constructor(modalHelper: ModalHelper, actionSheetHelper: ActionSheetHelper, alertHelper: AlertHelper, modalNavigationService: ModalNavigationService, routeConfig: Routes[]); initialize(moduleRootRoutePath?: string): Promise; private onModalRouteActivated; private onModalRouteDeactivated; showModal(config: ModalConfig, onClose?: (data?: any) => void): Promise; navigateToModal(path: string | string[], queryParams?: Params): Promise; navigateWithinModal(relativePath: string, queryParams?: Params): Promise; private showModalRoute; showActionSheet(config: ActionSheetConfig, onClose?: (data?: any) => void): Promise; showAlert(config: AlertConfig, onClose?: (result: boolean) => void): Promise; private showAndRegisterOverlay; hideTopmost(data?: any): Promise; hideAll(): Promise; getTopMost(): Overlay | null; ngOnDestroy(): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } declare const CanDismissModalGuard: CanDeactivateFn; declare class ModalComponent implements OnChanges, OnInit { private canDismissHelper; private modalNavigationService; private windowRef; private elementRef; modalElement: ElementRef; ionContent: IonContent; template: TemplateRef; isOpen: boolean; trigger: string; size: ModalSize; scrollDisabled: boolean; set canDismiss(canDismiss: ShowAlertCallback | boolean); collapseTitle: boolean; customHeight: string; flavor: ModalFlavor; drawerSupplementaryAction?: DrawerSupplementaryAction; interactWithBackground: boolean; willPresent: EventEmitter>>; didPresent: EventEmitter>>; didDismiss: EventEmitter>>; willDismiss: EventEmitter>>; /** * We populate the ModalConfig with defaults here. This ensures that we can * guard for `if (key in this._config)` and only update the config when any of these * inputs change. */ _config: ModalConfig; _canDismiss: ShowAlertCallback | boolean; constructor(canDismissHelper: CanDismissHelper, modalNavigationService: ModalNavigationService, windowRef: WindowRef, elementRef: ElementRef); ngOnInit(): void; ngOnChanges(changes: SimpleChanges): void; scrollToTop(scrollDuration?: KirbyAnimation.Duration): void; scrollToBottom(scrollDuration?: KirbyAnimation.Duration): void; _onWillPresent(event: CustomEvent): void; _onDidPresent(event: CustomEvent): void; _onWillDismiss(event: CustomEvent): void; _onDidDismiss(event: CustomEvent): void; private updateModalConfigOnChange; private forwardAriaLabel; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } declare class ModalFooterComponent extends ModalElementComponent { snapToKeyboard: boolean; type: 'inline' | 'fixed'; themeColor: 'white' | 'light'; get _cssClass(): ("inline" | "fixed" | "white" | "light")[]; constructor(elementRef: ElementRef, modalElementsAdvertiser: ModalElementsAdvertiser); static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } declare class ActionSheetComponent { cancelButtonText: string; hideCancel: boolean; disabled: boolean; header: string; subheader: string; items: Array; cancel: EventEmitter; itemSelect: EventEmitter; constructor(); onItemSelect(selection: ActionSheetItem): void; onCancel(): void; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } export { ActionSheetComponent, ActionSheetHelper, AlertComponent, AlertHelper, COMPONENT_PROPS, CanDismissHelper, CanDismissModalGuard, DrawerSupplementaryAction, Modal, ModalCompactWrapperComponent, ModalComponent, ModalController, ModalElementComponent, ModalElementType, ModalElementsAdvertiser, ModalFooterComponent, ModalHelper, ModalNavigationService, ModalWrapperComponent }; export type { ActionSheetConfig, ActionSheetItem, AlertConfig, ModalConfig, ModalEnabledRoutes, ModalFlavor, ModalRouteActivation, ModalSize, Overlay, OverlayEventDetail, RoutedModalConfig, ShowAlertCallback }; //# sourceMappingURL=kirbydesign-designsystem-modal.d.ts.map