import * as i0 from '@angular/core';
import { EventEmitter, Component, Input, Output, NgModule } from '@angular/core';
import * as i1 from '@aztrix/components/overlay';
import * as i3 from 'ngx-color-picker';
import { ColorPickerService, ColorPickerModule } from 'ngx-color-picker';
import * as i2 from '@aztrix/components/button';
import { ButtonModule } from '@aztrix/components/button';
import * as i4 from '@aztrix/helpers';
import { HelperPipesModule } from '@aztrix/helpers';
import { CommonModule } from '@angular/common';

class ColorPickerModalComponent {
    constructor(_overlay) {
        this._overlay = _overlay;
        this.valueChange = new EventEmitter();
        this._initialValue = '';
    }
    ngOnChanges(changes) {
        if (changes.value) {
            this._initialValue = this.value;
        }
    }
    save() {
        this._overlay.closeModal();
    }
    cancel() {
        this.valueChange.next(this._initialValue);
        this._overlay.closeModal();
    }
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: ColorPickerModalComponent, deps: [{ token: i1.OverlayService }], target: i0.ɵɵFactoryTarget.Component }); }
    static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", type: ColorPickerModalComponent, selector: "ng-component", inputs: { value: "value" }, outputs: { valueChange: "valueChange" }, providers: [ColorPickerService], usesOnChanges: true, ngImport: i0, template: "<div>\n  <color-picker\n    [cpToggle]=\"true\"\n    cpDialogDisplay=\"inline\"\n    cpAlphaChannel=\"disabled\"\n    [colorPicker]=\"value\"\n    (colorPickerChange)=\"valueChange.next($event)\"\n  ></color-picker>\n</div>\n<div class=\"actions h-button-wrapper\">\n  <button axButton (click)=\"cancel()\">\n    {{ 'label.cancel' | translate }}\n  </button>\n  <button axButton color=\"primary\" filled (click)=\"save()\">\n    {{ 'label.ok' | translate }}\n  </button>\n</div>\n", styles: [":host{display:flex;flex-direction:column;align-items:center;margin:1rem}.actions{width:100%}:host ::ng-deep .color-picker{border:none}\n"], dependencies: [{ kind: "directive", type: i2.ButtonDirective, selector: "[axButton]", inputs: ["color", "labelHideMobile", "smallButton", "bigButton", "fullWidth", "filled", "outline", "icon-button", "hoverLabel", "hover", "lowercase", "disabled"] }, { kind: "directive", type: i3.ColorPickerDirective, selector: "[colorPicker]", inputs: ["colorPicker", "cpWidth", "cpHeight", "cpToggle", "cpDisabled", "cpIgnoredElements", "cpFallbackColor", "cpColorMode", "cpCmykEnabled", "cpOutputFormat", "cpAlphaChannel", "cpDisableInput", "cpDialogDisplay", "cpSaveClickOutside", "cpCloseClickOutside", "cpUseRootViewContainer", "cpPosition", "cpPositionOffset", "cpPositionRelativeToArrow", "cpOKButton", "cpOKButtonText", "cpOKButtonClass", "cpCancelButton", "cpCancelButtonText", "cpCancelButtonClass", "cpEyeDropper", "cpPresetLabel", "cpPresetColors", "cpPresetColorsClass", "cpMaxPresetColorsLength", "cpPresetEmptyMessage", "cpPresetEmptyMessageClass", "cpAddColorButton", "cpAddColorButtonText", "cpAddColorButtonClass", "cpRemoveColorButtonClass", "cpArrowPosition", "cpExtraTemplate"], outputs: ["cpInputChange", "cpToggleChange", "cpSliderChange", "cpSliderDragEnd", "cpSliderDragStart", "colorPickerOpen", "colorPickerClose", "colorPickerCancel", "colorPickerSelect", "colorPickerChange", "cpCmykColorChange", "cpPresetColorsChange"], exportAs: ["ngxColorPicker"] }, { kind: "pipe", type: i4.TranslatePipe, name: "translate" }] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: ColorPickerModalComponent, decorators: [{
            type: Component,
            args: [{ providers: [ColorPickerService], template: "<div>\n  <color-picker\n    [cpToggle]=\"true\"\n    cpDialogDisplay=\"inline\"\n    cpAlphaChannel=\"disabled\"\n    [colorPicker]=\"value\"\n    (colorPickerChange)=\"valueChange.next($event)\"\n  ></color-picker>\n</div>\n<div class=\"actions h-button-wrapper\">\n  <button axButton (click)=\"cancel()\">\n    {{ 'label.cancel' | translate }}\n  </button>\n  <button axButton color=\"primary\" filled (click)=\"save()\">\n    {{ 'label.ok' | translate }}\n  </button>\n</div>\n", styles: [":host{display:flex;flex-direction:column;align-items:center;margin:1rem}.actions{width:100%}:host ::ng-deep .color-picker{border:none}\n"] }]
        }], ctorParameters: () => [{ type: i1.OverlayService }], propDecorators: { value: [{
                type: Input
            }], valueChange: [{
                type: Output
            }] } });

class ColorPickerModalModule {
    static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: ColorPickerModalModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
    static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.3.12", ngImport: i0, type: ColorPickerModalModule, declarations: [ColorPickerModalComponent], imports: [CommonModule, HelperPipesModule, ButtonModule, ColorPickerModule], exports: [ColorPickerModalComponent] }); }
    static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: ColorPickerModalModule, imports: [CommonModule, HelperPipesModule, ButtonModule, ColorPickerModule] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: ColorPickerModalModule, decorators: [{
            type: NgModule,
            args: [{
                    declarations: [ColorPickerModalComponent],
                    imports: [CommonModule, HelperPipesModule, ButtonModule, ColorPickerModule],
                    exports: [ColorPickerModalComponent],
                }]
        }] });

/**
 * Generated bundle index. Do not edit.
 */

export { ColorPickerModalComponent, ColorPickerModalModule };
//# sourceMappingURL=aztrix-components-color-picker-modal.mjs.map
