/*
 * Copyright 2015-2024 Ritense BV, the Netherlands.
 *
 * Licensed under EUPL, Version 1.2 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" basis,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
import { Component, EventEmitter, Input, Output } from '@angular/core';
import { delay } from 'rxjs/operators';
import * as i0 from "@angular/core";
import * as i1 from "../../services/prompt.service";
import * as i2 from "@angular/common";
import * as i3 from "../button/button.component";
import * as i4 from "../title/title.component";
import * as i5 from "../paragraph/paragraph.component";
/**
 * @deprecated Migrate old design to Carbon
 */
export class PromptComponent {
    constructor(promptService) {
        this.promptService = promptService;
        this.appearingDelayMs = 140;
        this.closeEvent = new EventEmitter();
        this.visible$ = this.promptService.promptVisible$;
        this.showBackdrop$ = this.visible$.pipe(delay(0));
        this.appearing$ = this.promptService.appearing$;
        this.disappearing$ = this.promptService.disappearing$;
        this.headerText$ = this.promptService.headerText$;
        this.bodyText$ = this.promptService.bodyText$;
        this.cancelText$ = this.promptService.cancelText$;
        this.confirmText$ = this.promptService.confirmText$;
        this.cancelMdiIcon$ = this.promptService.cancelMdiIcon$;
        this.confirmMdiIcon$ = this.promptService.confirmMdiIcon$;
        this.cancelButtonType$ = this.promptService.cancelButtonType$;
        this.confirmButtonType$ = this.promptService.confirmButtonType$;
        this.closeButtonVisible$ = this.promptService.closeButtonVisible$;
    }
    ngOnInit() {
        this.setAppearingDelayInService();
    }
    cancel() {
        this.promptService.cancel();
    }
    confirm() {
        this.promptService.confirm();
    }
    close() {
        this.promptService.close();
    }
    setAppearingDelayInService() {
        this.promptService.setAppearingDelay(this.appearingDelayMs);
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: PromptComponent, deps: [{ token: i1.PromptService }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", type: PromptComponent, selector: "v-prompt", inputs: { appearingDelayMs: "appearingDelayMs", maxWidthPx: "maxWidthPx" }, outputs: { closeEvent: "closeEvent" }, ngImport: i0, template: "<!--\n  ~ Copyright 2015-2024 Ritense BV, the Netherlands.\n  ~\n  ~ Licensed under EUPL, Version 1.2 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" basis,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<ng-container\n  *ngIf=\"{\n    visible: visible$ | async,\n    appearing: appearing$ | async,\n    disappearing: disappearing$ | async,\n    showBackdrop: showBackdrop$ | async,\n  } as obs\"\n>\n  <div\n    class=\"v-prompt-backdrop\"\n    [ngClass]=\"{\n      'v-prompt-backdrop--visible': obs.visible || obs.disappearing,\n      'v-prompt-backdrop--backdrop': obs.showBackdrop,\n      'v-prompt-backdrop--hidden': !obs.visible,\n      'v-prompt-backdrop--appearing': obs.appearing,\n      'v-prompt-backdrop--disappearing': obs.disappearing,\n    }\"\n  >\n    <ng-container\n      *ngTemplateOutlet=\"modal; context: {appearing: obs.appearing, disappearing: obs.disappearing}\"\n    ></ng-container>\n  </div>\n</ng-container>\n\n<ng-template #modal let-appearing=\"appearing\" let-disappearing=\"disappearing\">\n  <div class=\"v-prompt\" [style.max-width.px]=\"maxWidthPx\">\n    <ng-container\n      *ngTemplateOutlet=\"modalHeader; context: {appearing: appearing, disappearing: disappearing}\"\n    ></ng-container>\n    <ng-container *ngTemplateOutlet=\"modalContent\"></ng-container>\n    <ng-container\n      *ngTemplateOutlet=\"modalFooter; context: {appearing: appearing, disappearing: disappearing}\"\n    ></ng-container>\n  </div>\n</ng-template>\n\n<ng-template #modalHeader let-appearing=\"appearing\" let-disappearing=\"disappearing\">\n  <div class=\"v-prompt__header\">\n    <v-title [margin]=\"false\" type=\"h2\">{{ headerText$ | async }}</v-title>\n  </div>\n  <div class=\"v-prompt__close\" *ngIf=\"closeButtonVisible$ | async\">\n    <button type=\"button\" class=\"close\" aria-label=\"Close\" (click)=\"close()\">\n      <span aria-hidden=\"true\">&times;</span>\n    </button>\n  </div>\n</ng-template>\n\n<ng-template #modalContent>\n  <div class=\"v-prompt__content\">\n    <v-paragraph>{{ bodyText$ | async }}</v-paragraph>\n  </div>\n</ng-template>\n\n<ng-template #modalFooter let-appearing=\"appearing\" let-disappearing=\"disappearing\">\n  <div class=\"v-prompt__footer\">\n    <div class=\"v-prompt__buttons\">\n      <v-button\n        [disabled]=\"appearing || disappearing\"\n        (clickEvent)=\"cancel()\"\n        [mdiIcon]=\"(cancelMdiIcon$ | async) || 'cancel'\"\n        [type]=\"(cancelButtonType$ | async) || 'primary'\"\n        >{{ cancelText$ | async }}\n      </v-button>\n      <v-button\n        [disabled]=\"appearing || disappearing\"\n        (clickEvent)=\"confirm()\"\n        [mdiIcon]=\"(confirmMdiIcon$ | async) || 'check'\"\n        [type]=\"(confirmButtonType$ | async) || 'primary'\"\n        >{{ confirmText$ | async }}\n      </v-button>\n    </div>\n  </div>\n</ng-template>\n", styles: [".v-prompt-backdrop{position:fixed;top:0;left:0;width:100%;height:100%;z-index:var(--v-prompt-z-index);background-color:var(--v-color-backdrop-transparant);-webkit-backdrop-filter:blur(0);backdrop-filter:blur(0);transition:var(--v-prompt-backdrop-transition);display:none;cursor:var(--v-prompt-backdrop-cursor);padding-inline-start:var(--v-prompt-backdrop-padding-inline);padding-inline-end:var(--v-prompt-backdrop-padding-inline);padding-block-start:var(--v-prompt-backdrop-padding-block);padding-block-end:var(--v-prompt-backdrop-padding-block)}.v-prompt-backdrop--visible,.v-prompt-backdrop--disappearing{display:flex;align-items:center;justify-content:center}.v-prompt{background-color:var(--v-prompt-background-color);min-height:var(--v-prompt-min-height);max-height:100%;width:100%;max-width:var(--v-prompt-max-width);transform:translateY(-100%);opacity:0;transition:var(--v-prompt-transition);cursor:var(--v-prompt-cursor);border-radius:var(--v-prompt-border-radius);overflow:hidden;display:flex;flex-direction:column;justify-content:space-between;box-shadow:var(--v-prompt-box-shadow)}.v-prompt-backdrop--backdrop{background-color:var(--v-prompt-backdrop-color);-webkit-backdrop-filter:var(--v-prompt-backdrop-filter);backdrop-filter:var(--v-prompt-backdrop-filter)}.v-prompt-backdrop--backdrop .v-prompt{transform:translateY(0);opacity:1}.v-prompt-backdrop--backdrop.v-prompt-backdrop--mouse-on-backdrop:not(.v-prompt-backdrop--disappearing),.v-prompt-backdrop--backdrop.v-prompt-backdrop--mouse-on-backdrop:not(.v-prompt-backdrop--appearing),.v-prompt-backdrop--backdrop.v-prompt-backdrop--mouse-on-backdrop:hover{background-color:var(--v-prompt-backdrop-color-hover);-webkit-backdrop-filter:var(--v-prompt-backdrop-filter-hover);backdrop-filter:var(--v-prompt-backdrop-filter-hover)}.v-prompt-backdrop--hidden,.v-prompt-backdrop--appearing{cursor:var(--v-prompt-backdrop-cursor-disappearing)}.v-prompt__header{position:relative;display:flex;flex-direction:row;justify-content:center;align-items:center;flex-shrink:0;background-color:var(--v-prompt-header-bg-color);padding-block-start:var(--v-prompt-header-padding-block);padding-block-end:var(--v-prompt-header-padding-block);padding-inline-start:var(--v-prompt-padding-inline);padding-inline-end:var(--v-prompt-padding-inline);border-bottom:var(--v-prompt-header-border);min-height:var(--v-prompt-header-min-height);box-sizing:content-box}.v-prompt__close{position:absolute;top:0;right:0;padding-block-start:var(--v-prompt-border-radius);padding-block-end:var(--v-prompt-border-radius);padding-inline-start:var(--v-prompt-padding-inline);padding-inline-end:var(--v-prompt-padding-inline)}.v-prompt__footer{display:flex;flex-shrink:0;background-color:var(--v-prompt-footer-bg-color);padding-block-start:var(--v-prompt-footer-padding-block);padding-block-end:var(--v-prompt-footer-padding-block);padding-inline-start:var(--v-prompt-padding-inline);padding-inline-end:var(--v-prompt-padding-inline);border-top:var(--v-prompt-footer-border)}.v-prompt__content{height:100%;padding-block-start:var(--v-prompt-content-padding-block-start);padding-block-end:var(--v-prompt-content-padding-block-end);padding-inline-start:var(--v-prompt-padding-inline);padding-inline-end:var(--v-prompt-padding-inline);overflow:auto}.v-prompt__buttons{display:flex;flex-direction:row;width:100%;justify-content:space-between}\n/*!\n * Copyright 2015-2024 Ritense BV, the Netherlands.\n *\n * Licensed under EUPL, Version 1.2 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" basis,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n"], dependencies: [{ kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: i3.ButtonComponent, selector: "v-button", inputs: ["type", "mdiIcon", "disabled", "title", "titleTranslationKey"], outputs: ["clickEvent"] }, { kind: "component", type: i4.TitleComponent, selector: "v-title", inputs: ["type", "margin", "fullWidth", "center"] }, { kind: "component", type: i5.ParagraphComponent, selector: "v-paragraph", inputs: ["center", "fullWidth", "margin", "italic", "loading", "dataTestId"] }, { kind: "pipe", type: i2.AsyncPipe, name: "async" }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: PromptComponent, decorators: [{
            type: Component,
            args: [{ selector: 'v-prompt', template: "<!--\n  ~ Copyright 2015-2024 Ritense BV, the Netherlands.\n  ~\n  ~ Licensed under EUPL, Version 1.2 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~ https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" basis,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<ng-container\n  *ngIf=\"{\n    visible: visible$ | async,\n    appearing: appearing$ | async,\n    disappearing: disappearing$ | async,\n    showBackdrop: showBackdrop$ | async,\n  } as obs\"\n>\n  <div\n    class=\"v-prompt-backdrop\"\n    [ngClass]=\"{\n      'v-prompt-backdrop--visible': obs.visible || obs.disappearing,\n      'v-prompt-backdrop--backdrop': obs.showBackdrop,\n      'v-prompt-backdrop--hidden': !obs.visible,\n      'v-prompt-backdrop--appearing': obs.appearing,\n      'v-prompt-backdrop--disappearing': obs.disappearing,\n    }\"\n  >\n    <ng-container\n      *ngTemplateOutlet=\"modal; context: {appearing: obs.appearing, disappearing: obs.disappearing}\"\n    ></ng-container>\n  </div>\n</ng-container>\n\n<ng-template #modal let-appearing=\"appearing\" let-disappearing=\"disappearing\">\n  <div class=\"v-prompt\" [style.max-width.px]=\"maxWidthPx\">\n    <ng-container\n      *ngTemplateOutlet=\"modalHeader; context: {appearing: appearing, disappearing: disappearing}\"\n    ></ng-container>\n    <ng-container *ngTemplateOutlet=\"modalContent\"></ng-container>\n    <ng-container\n      *ngTemplateOutlet=\"modalFooter; context: {appearing: appearing, disappearing: disappearing}\"\n    ></ng-container>\n  </div>\n</ng-template>\n\n<ng-template #modalHeader let-appearing=\"appearing\" let-disappearing=\"disappearing\">\n  <div class=\"v-prompt__header\">\n    <v-title [margin]=\"false\" type=\"h2\">{{ headerText$ | async }}</v-title>\n  </div>\n  <div class=\"v-prompt__close\" *ngIf=\"closeButtonVisible$ | async\">\n    <button type=\"button\" class=\"close\" aria-label=\"Close\" (click)=\"close()\">\n      <span aria-hidden=\"true\">&times;</span>\n    </button>\n  </div>\n</ng-template>\n\n<ng-template #modalContent>\n  <div class=\"v-prompt__content\">\n    <v-paragraph>{{ bodyText$ | async }}</v-paragraph>\n  </div>\n</ng-template>\n\n<ng-template #modalFooter let-appearing=\"appearing\" let-disappearing=\"disappearing\">\n  <div class=\"v-prompt__footer\">\n    <div class=\"v-prompt__buttons\">\n      <v-button\n        [disabled]=\"appearing || disappearing\"\n        (clickEvent)=\"cancel()\"\n        [mdiIcon]=\"(cancelMdiIcon$ | async) || 'cancel'\"\n        [type]=\"(cancelButtonType$ | async) || 'primary'\"\n        >{{ cancelText$ | async }}\n      </v-button>\n      <v-button\n        [disabled]=\"appearing || disappearing\"\n        (clickEvent)=\"confirm()\"\n        [mdiIcon]=\"(confirmMdiIcon$ | async) || 'check'\"\n        [type]=\"(confirmButtonType$ | async) || 'primary'\"\n        >{{ confirmText$ | async }}\n      </v-button>\n    </div>\n  </div>\n</ng-template>\n", styles: [".v-prompt-backdrop{position:fixed;top:0;left:0;width:100%;height:100%;z-index:var(--v-prompt-z-index);background-color:var(--v-color-backdrop-transparant);-webkit-backdrop-filter:blur(0);backdrop-filter:blur(0);transition:var(--v-prompt-backdrop-transition);display:none;cursor:var(--v-prompt-backdrop-cursor);padding-inline-start:var(--v-prompt-backdrop-padding-inline);padding-inline-end:var(--v-prompt-backdrop-padding-inline);padding-block-start:var(--v-prompt-backdrop-padding-block);padding-block-end:var(--v-prompt-backdrop-padding-block)}.v-prompt-backdrop--visible,.v-prompt-backdrop--disappearing{display:flex;align-items:center;justify-content:center}.v-prompt{background-color:var(--v-prompt-background-color);min-height:var(--v-prompt-min-height);max-height:100%;width:100%;max-width:var(--v-prompt-max-width);transform:translateY(-100%);opacity:0;transition:var(--v-prompt-transition);cursor:var(--v-prompt-cursor);border-radius:var(--v-prompt-border-radius);overflow:hidden;display:flex;flex-direction:column;justify-content:space-between;box-shadow:var(--v-prompt-box-shadow)}.v-prompt-backdrop--backdrop{background-color:var(--v-prompt-backdrop-color);-webkit-backdrop-filter:var(--v-prompt-backdrop-filter);backdrop-filter:var(--v-prompt-backdrop-filter)}.v-prompt-backdrop--backdrop .v-prompt{transform:translateY(0);opacity:1}.v-prompt-backdrop--backdrop.v-prompt-backdrop--mouse-on-backdrop:not(.v-prompt-backdrop--disappearing),.v-prompt-backdrop--backdrop.v-prompt-backdrop--mouse-on-backdrop:not(.v-prompt-backdrop--appearing),.v-prompt-backdrop--backdrop.v-prompt-backdrop--mouse-on-backdrop:hover{background-color:var(--v-prompt-backdrop-color-hover);-webkit-backdrop-filter:var(--v-prompt-backdrop-filter-hover);backdrop-filter:var(--v-prompt-backdrop-filter-hover)}.v-prompt-backdrop--hidden,.v-prompt-backdrop--appearing{cursor:var(--v-prompt-backdrop-cursor-disappearing)}.v-prompt__header{position:relative;display:flex;flex-direction:row;justify-content:center;align-items:center;flex-shrink:0;background-color:var(--v-prompt-header-bg-color);padding-block-start:var(--v-prompt-header-padding-block);padding-block-end:var(--v-prompt-header-padding-block);padding-inline-start:var(--v-prompt-padding-inline);padding-inline-end:var(--v-prompt-padding-inline);border-bottom:var(--v-prompt-header-border);min-height:var(--v-prompt-header-min-height);box-sizing:content-box}.v-prompt__close{position:absolute;top:0;right:0;padding-block-start:var(--v-prompt-border-radius);padding-block-end:var(--v-prompt-border-radius);padding-inline-start:var(--v-prompt-padding-inline);padding-inline-end:var(--v-prompt-padding-inline)}.v-prompt__footer{display:flex;flex-shrink:0;background-color:var(--v-prompt-footer-bg-color);padding-block-start:var(--v-prompt-footer-padding-block);padding-block-end:var(--v-prompt-footer-padding-block);padding-inline-start:var(--v-prompt-padding-inline);padding-inline-end:var(--v-prompt-padding-inline);border-top:var(--v-prompt-footer-border)}.v-prompt__content{height:100%;padding-block-start:var(--v-prompt-content-padding-block-start);padding-block-end:var(--v-prompt-content-padding-block-end);padding-inline-start:var(--v-prompt-padding-inline);padding-inline-end:var(--v-prompt-padding-inline);overflow:auto}.v-prompt__buttons{display:flex;flex-direction:row;width:100%;justify-content:space-between}\n/*!\n * Copyright 2015-2024 Ritense BV, the Netherlands.\n *\n * Licensed under EUPL, Version 1.2 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" basis,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n"] }]
        }], ctorParameters: () => [{ type: i1.PromptService }], propDecorators: { appearingDelayMs: [{
                type: Input
            }], maxWidthPx: [{
                type: Input
            }], closeEvent: [{
                type: Output
            }] } });
//# sourceMappingURL=data:application/json;base64, 