import { Component } from '@angular/core';
import { FormControl } from '@angular/forms';
import { AbstractFieldWriteComponent } from '../base-field/abstract-field-write.component';
import * as i0 from "@angular/core";
import * as i1 from "@angular/common";
import * as i2 from "@angular/forms";
import * as i3 from "../utils/field-label.pipe";
import * as i4 from "../utils/first-error.pipe";
import * as i5 from "rpx-xui-translation";
const _c0 = a0 => ({ "form-group-error": a0 });
const _c1 = a0 => ({ "govuk-input--error": a0 });
function WritePhoneUKFieldComponent_span_2_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "span", 6);
    i0.ɵɵtext(1);
    i0.ɵɵpipe(2, "ccdFieldLabel");
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const ctx_r0 = i0.ɵɵnextContext();
    i0.ɵɵadvance();
    i0.ɵɵtextInterpolate(i0.ɵɵpipeBind1(2, 1, ctx_r0.caseField));
} }
function WritePhoneUKFieldComponent_span_3_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "span", 7);
    i0.ɵɵtext(1);
    i0.ɵɵpipe(2, "rpxTranslate");
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const ctx_r0 = i0.ɵɵnextContext();
    i0.ɵɵadvance();
    i0.ɵɵtextInterpolate(i0.ɵɵpipeBind1(2, 1, ctx_r0.caseField.hint_text));
} }
function WritePhoneUKFieldComponent_span_4_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "span", 8);
    i0.ɵɵtext(1);
    i0.ɵɵpipe(2, "ccdFirstError");
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const ctx_r0 = i0.ɵɵnextContext();
    i0.ɵɵadvance();
    i0.ɵɵtextInterpolate1(" ", i0.ɵɵpipeBind2(2, 1, ctx_r0.phoneUkControl.errors, ctx_r0.caseField.label), " ");
} }
export class WritePhoneUKFieldComponent extends AbstractFieldWriteComponent {
    phoneUkControl;
    ngOnInit() {
        this.phoneUkControl = this.registerControl(new FormControl(this.caseField.value));
    }
    static ɵfac = /*@__PURE__*/ (() => { let ɵWritePhoneUKFieldComponent_BaseFactory; return function WritePhoneUKFieldComponent_Factory(__ngFactoryType__) { return (ɵWritePhoneUKFieldComponent_BaseFactory || (ɵWritePhoneUKFieldComponent_BaseFactory = i0.ɵɵgetInheritedFactory(WritePhoneUKFieldComponent)))(__ngFactoryType__ || WritePhoneUKFieldComponent); }; })();
    static ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: WritePhoneUKFieldComponent, selectors: [["ccd-write-phone-uk-field"]], features: [i0.ɵɵInheritDefinitionFeature], decls: 6, vars: 12, consts: [[1, "form-group", 3, "ngClass"], [3, "for"], ["class", "form-label", 4, "ngIf"], ["class", "form-hint", 4, "ngIf"], ["class", "error-message", 4, "ngIf"], ["type", "tel", 1, "form-control", "bottom-30", 3, "ngClass", "id", "formControl"], [1, "form-label"], [1, "form-hint"], [1, "error-message"]], template: function WritePhoneUKFieldComponent_Template(rf, ctx) { if (rf & 1) {
            i0.ɵɵelementStart(0, "div", 0)(1, "label", 1);
            i0.ɵɵtemplate(2, WritePhoneUKFieldComponent_span_2_Template, 3, 3, "span", 2);
            i0.ɵɵelementEnd();
            i0.ɵɵtemplate(3, WritePhoneUKFieldComponent_span_3_Template, 3, 3, "span", 3)(4, WritePhoneUKFieldComponent_span_4_Template, 3, 4, "span", 4);
            i0.ɵɵelement(5, "input", 5);
            i0.ɵɵelementEnd();
        } if (rf & 2) {
            i0.ɵɵproperty("ngClass", i0.ɵɵpureFunction1(8, _c0, !ctx.phoneUkControl.valid && (ctx.phoneUkControl.dirty || ctx.phoneUkControl.touched)));
            i0.ɵɵadvance();
            i0.ɵɵproperty("for", ctx.id());
            i0.ɵɵadvance();
            i0.ɵɵproperty("ngIf", ctx.caseField.label);
            i0.ɵɵadvance();
            i0.ɵɵproperty("ngIf", ctx.caseField.hint_text);
            i0.ɵɵadvance();
            i0.ɵɵproperty("ngIf", ctx.phoneUkControl.errors && (ctx.phoneUkControl.dirty || ctx.phoneUkControl.touched));
            i0.ɵɵadvance();
            i0.ɵɵproperty("ngClass", i0.ɵɵpureFunction1(10, _c1, ctx.phoneUkControl.errors && ctx.phoneUkControl.dirty))("id", ctx.id())("formControl", ctx.phoneUkControl);
        } }, dependencies: [i1.NgClass, i1.NgIf, i2.DefaultValueAccessor, i2.NgControlStatus, i2.FormControlDirective, i3.FieldLabelPipe, i4.FirstErrorPipe, i5.RpxTranslatePipe], encapsulation: 2 });
}
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(WritePhoneUKFieldComponent, [{
        type: Component,
        args: [{ selector: 'ccd-write-phone-uk-field', template: "<div class=\"form-group\" [ngClass]=\"{'form-group-error': !phoneUkControl.valid && (phoneUkControl.dirty || phoneUkControl.touched)}\">\n  <label [for]=\"id()\">\n    <span class=\"form-label\" *ngIf=\"caseField.label\">{{caseField | ccdFieldLabel}}</span>\n  </label>\n  <span class=\"form-hint\" *ngIf=\"caseField.hint_text\">{{caseField.hint_text | rpxTranslate}}</span>\n  <span class=\"error-message\" *ngIf=\"phoneUkControl.errors && (phoneUkControl.dirty || phoneUkControl.touched)\">\n    {{phoneUkControl.errors | ccdFirstError:caseField.label}}\n  </span>\n  <input class=\"form-control bottom-30\" [ngClass]=\"{'govuk-input--error': phoneUkControl.errors && phoneUkControl.dirty}\"\n   [id]=\"id()\" type=\"tel\" [formControl]=\"phoneUkControl\">\n</div>\n" }]
    }], null, null); })();
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(WritePhoneUKFieldComponent, { className: "WritePhoneUKFieldComponent", filePath: "lib/shared/components/palette/phone-uk/write-phone-uk-field.component.ts", lineNumber: 9 }); })();
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoid3JpdGUtcGhvbmUtdWstZmllbGQuY29tcG9uZW50LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vLi4vLi4vcHJvam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