import { ChangeDetectionStrategy, Component, EventEmitter, Input, Output, } from '@angular/core';
import { CustomValidators, PropertyFormControl } from '@aztrix/helpers';
import { PropertyType } from '@aztrix/models';
import * as i0 from "@angular/core";
import * as i1 from "@aztrix/components/property-edit";
import * as i2 from "@aztrix/components/button";
import * as i3 from "@aztrix/helpers";
export class SendToEmailComponent {
    constructor() {
        this.didClickSend = new EventEmitter();
        this.form = PropertyFormControl.createByType(PropertyType.EMAIL, CustomValidators.propertyValid);
    }
    sendEmail() {
        this.didClickSend.emit(this.form.value.value);
    }
    ngOnChanges(changes) {
        if (changes.email && this.email) {
            this.form.get('value').setValue(this.email);
            this.form.markAsDirty();
        }
    }
}
SendToEmailComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: SendToEmailComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
SendToEmailComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.5", type: SendToEmailComponent, selector: "ax-send-to-email", inputs: { hint: "hint", email: "email" }, outputs: { didClickSend: "didClickSend" }, usesOnChanges: true, ngImport: i0, template: "<ax-property-edit [form]=\"form\" [autofocus]=\"false\" [hint]=\"hint\"></ax-property-edit>\n<div class=\"h-button-wrapper\">\n  <button axButton filled color=\"primary\" [disabled]=\"!form?.valid\" (click)=\"sendEmail()\">\n    {{ 'label.send' | translate }}\n  </button>\n</div>\n", styles: [":host{display:block;background-color:#efefef;margin:1rem 0;padding:1rem;border-radius:1rem}@media only screen and (min-width: 600px){:host{display:flex;align-items:center}}:host ax-property-edit{flex:1 0 auto;margin-right:1rem}\n"], dependencies: [{ kind: "component", type: i1.PropertyEditComponent, selector: "ax-property-edit", inputs: ["isIndividual", "isProposalSubscribeForm"] }, { kind: "directive", type: i2.ButtonDirective, selector: "[axButton]", inputs: ["color", "labelHideMobile", "smallButton", "bigButton", "fullWidth", "filled", "outline", "icon-button", "hoverLabel", "hover", "lowercase", "disabled"] }, { kind: "pipe", type: i3.TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.5", ngImport: i0, type: SendToEmailComponent, decorators: [{
            type: Component,
            args: [{ selector: 'ax-send-to-email', changeDetection: ChangeDetectionStrategy.OnPush, template: "<ax-property-edit [form]=\"form\" [autofocus]=\"false\" [hint]=\"hint\"></ax-property-edit>\n<div class=\"h-button-wrapper\">\n  <button axButton filled color=\"primary\" [disabled]=\"!form?.valid\" (click)=\"sendEmail()\">\n    {{ 'label.send' | translate }}\n  </button>\n</div>\n", styles: [":host{display:block;background-color:#efefef;margin:1rem 0;padding:1rem;border-radius:1rem}@media only screen and (min-width: 600px){:host{display:flex;align-items:center}}:host ax-property-edit{flex:1 0 auto;margin-right:1rem}\n"] }]
        }], propDecorators: { hint: [{
                type: Input
            }], email: [{
                type: Input
            }], didClickSend: [{
                type: Output
            }] } });
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2VuZC10by1lbWFpbC5jb21wb25lbnQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi9saWJzL2NvbXBvbmVudHMvc2VuZC10by1lbWFpbC9zZW5kLXRvLWVtYWlsLmNvbXBvbmVudC50cyIsIi4uLy4uLy4uLy4uLy4uL2xpYnMvY29tcG9uZW50cy9zZW5kLXRvLWVtYWlsL3NlbmQtdG8tZW1haWwuY29tcG9uZW50Lmh0bWwiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUNMLHVCQUF1QixFQUN2QixTQUFTLEVBQ1QsWUFBWSxFQUNaLEtBQUssRUFFTCxNQUFNLEdBRVAsTUFBTSxlQUFlLENBQUM7QUFDdkIsT0FBTyxFQUFDLGdCQUFnQixFQUFFLG1CQUFtQixFQUFDLE1BQU0saUJBQWlCLENBQUM7QUFDdEUsT0FBTyx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