/**
 * @fileoverview added by tsickle
 * Generated from: lib/dialog-confirm/dialog-confirm.component.ts
 * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
 */
import { ChangeDetectionStrategy, Component, ViewChild, ViewEncapsulation } from '@angular/core';
import { BbButton } from '@bravobit/bb-foundation/elements';
import { BbDialogConfig } from '../dialog.interfaces';
import { BbDialogRef } from '../dialog.ref';
/** @type {?} */
let nextUniqueId = 0;
export class BbDialogConfirm {
    /**
     * @param {?} config
     * @param {?} dialogRef
     */
    constructor(config, dialogRef) {
        this.config = config;
        this.dialogRef = dialogRef;
        // Id.
        this.dialogId = `bb-dialog-confirm-${nextUniqueId++}`;
    }
    /**
     * @return {?}
     */
    ngAfterViewInit() {
        // Initial focus the button.
        this.confirmButton.focus();
    }
    /**
     * @param {?} result
     * @return {?}
     */
    onClose(result) {
        this.dialogRef.close(result);
    }
}
BbDialogConfirm.decorators = [
    { type: Component, args: [{
                selector: 'bb-dialog-confirm',
                template: "<div [attr.aria-labelledby]=\"dialogId\"\r\n     bb-dialog-modal\r\n     bbFocusTrap>\r\n    <header bb-dialog-header>\r\n        <h1 *ngIf=\"config?.data?.title as title\"\r\n            [id]=\"dialogId\">\r\n            {{ title | bbLocalize:{optional: true} }}\r\n        </h1>\r\n    </header>\r\n\r\n    <p>\r\n        {{ config?.data?.description | bbLocalize:{optional: true} }}\r\n    </p>\r\n\r\n    <footer bb-dialog-actions>\r\n        <button *ngIf=\"config?.data?.cancelButtonText as cancelButtonText\"\r\n                (click)=\"onClose(false)\"\r\n                bb-button\r\n                type=\"button\">\r\n            {{ cancelButtonText | bbLocalize:{optional: true} }}\r\n        </button>\r\n        <button #confirm\r\n                *ngIf=\"config?.data?.confirmButtonText as confirmButtonText\"\r\n                (click)=\"onClose(true)\"\r\n                bb-button\r\n                type=\"button\"\r\n                class=\"destructive\">\r\n            {{ confirmButtonText | bbLocalize:{optional: true} }}\r\n        </button>\r\n    </footer>\r\n</div>\r\n",
                changeDetection: ChangeDetectionStrategy.OnPush,
                encapsulation: ViewEncapsulation.None,
                preserveWhitespaces: false,
                host: { 'class': 'bb-dialog-confirm' },
                styles: [".bb-dialog-confirm{display:block}"]
            }] }
];
/** @nocollapse */
BbDialogConfirm.ctorParameters = () => [
    { type: BbDialogConfig },
    { type: BbDialogRef }
];
BbDialogConfirm.propDecorators = {
    confirmButton: [{ type: ViewChild, args: ['confirm', { read: BbButton, static: false },] }]
};
if (false) {
    /** @type {?} */
    BbDialogConfirm.prototype.confirmButton;
    /** @type {?} */
    BbDialogConfirm.prototype.dialogId;
    /** @type {?} */
    BbDialogConfirm.prototype.config;
    /** @type {?} */
    BbDialogConfirm.prototype.dialogRef;
}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZGlhbG9nLWNvbmZpcm0uY29tcG9uZW50LmpzIiwic291cmNlUm9vdCI6Im5nOi8vQGJyYXZvYml0L2JiLWZvdW5kYXRpb24vZGlhbG9nLyIsInNvdXJjZXMiOlsibGliL2RpYWxvZy1jb25maXJtL2RpYWxvZy1jb25maXJtLmNvbXBvbmVudC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7OztBQUFBLE9BQU8sRUFBZ0IsdUJBQXVCLEVBQUUsU0FBUyxFQUFFLFNBQVMsRUFBRSxpQkFBaUIsRUFBQyxNQUFNLGVBQWUsQ0FBQztBQUM5RyxPQUFPLEVBQUMsUUFBUSxFQUFDLE1BQU0sa0NBQWtDLENBQUM7QUFDMUQsT0FBTyxFQUFDLGNBQWMsRUFBQyxNQUFNLHNCQUFzQixDQUFDO0FBQ3BELE9BQU8sRUFBQyxXQUFXLEVBQUMsTUFBTSxlQUFlLENBQUM7O0lBRXRDLFlBQVksR0FBRyxDQUFDO0FBV3BCLE1BQU0sT0FBTyxlQUFlOzs7OztJQVF4QixZQUFtQixNQUFzQixFQUN0QixTQUErQjtRQUQvQixXQUFNLEdBQU4sTUFBT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