import { h } from "@stencil/core";
import { randomIdGenerator } from "../../../global/utils/randomIdGenerator";
import { FormInputButtonVariation } from "./form-input-button-variation.enum";
import { FormInputType } from "./form-input-type.enum";
import { FormInputMode } from "./form-input-mode.enum";
import { FormInputValidation } from "./form-input-validation.enum";
import { FormInputVariation } from "./form-input-variation.enum";
/**
 * @enums FormInputType - form-input-type.enum.ts
 * @enums FormInputMode - form-input-mode.enum.ts
 * @enums FormInputValidation - form-input-validation.enum.ts
 * @enums FormInputVariation - form-input-variation.enum.ts
 * @swedishName Inmatningsfält
 */
export class FormInput {
    constructor() {
        this.hasActiveValidationMessage = false;
        this.hasButton = undefined;
        this.dirty = false;
        this.touched = false;
        this.afLabel = undefined;
        this.afLabelDescription = undefined;
        this.afType = FormInputType.TEXT;
        this.afInputmode = FormInputMode.DEFAULT;
        this.afButtonVariation = FormInputButtonVariation.PRIMARY;
        this.afAutofocus = undefined;
        this.afVariation = FormInputVariation.MEDIUM;
        this.afName = undefined;
        this.afId = randomIdGenerator('digi-form-input');
        this.afMaxlength = undefined;
        this.afMinlength = undefined;
        this.afRequired = undefined;
        this.afRequiredText = undefined;
        this.afAnnounceIfOptional = false;
        this.afAnnounceIfOptionalText = undefined;
        this.value = undefined;
        this.afValue = undefined;
        this.afValidation = FormInputValidation.NEUTRAL;
        this.afValidationText = undefined;
        this.afRole = undefined;
        this.afAutocomplete = undefined;
        this.afMin = undefined;
        this.afMax = undefined;
        this.afList = undefined;
        this.afStep = undefined;
        this.afDirname = undefined;
        this.afAriaAutocomplete = undefined;
        this.afAriaActivedescendant = undefined;
        this.afAriaLabelledby = undefined;
        this.afAriaDescribedby = undefined;
        this.afAriaControls = undefined;
        this.afTrimValue = undefined;
    }
    onValueChanged(value) {
        this.afValue = value;
    }
    onAfValueChanged(value) {
        this.value = value;
    }
    afValidationTextWatch() {
        this.setActiveValidationMessage();
    }
    /**
     * Hämtar en referens till inputelementet. Bra för att t.ex. sätta fokus programmatiskt.
     * @en Returns a reference to the input element. Handy for setting focus programmatically.
     */
    async afMGetFormControlElement() {
        return this._input;
    }
    componentWillLoad() {
        this.afValue ? (this.value = this.afValue) : (this.afValue = this.value);
        this.setActiveValidationMessage();
        this.setHasButton();
    }
    componentWillUpdate() {
        this.setHasButton();
    }
    componentDidLoad() {
        this.afOnReady.emit();
    }
    setActiveValidationMessage() {
        this.hasActiveValidationMessage = !!this.afValidationText;
    }
    get cssModifiers() {
        return {
            'digi-form-input--small': this.afVariation === FormInputVariation.SMALL,
            'digi-form-input--medium': this.afVariation === FormInputVariation.MEDIUM,
            'digi-form-input--large': this.afVariation === FormInputVariation.LARGE,
            'digi-form-input--neutral': this.afValidation === FormInputValidation.NEUTRAL,
            'digi-form-input--success': this.afValidation === FormInputValidation.SUCCESS,
            'digi-form-input--error': this.afValidation === FormInputValidation.ERROR,
            'digi-form-input--warning': this.afValidation === FormInputValidation.WARNING,
            [`digi-form-input--button-variation-${this.afButtonVariation}`]: !!this.afButtonVariation,
            [`digi-form-input--has-button-${this.hasButton}`]: true,
            'digi-form-input--empty': !this.afValue &&
                (!this.afValidation ||
                    this.afValidation === FormInputValidation.NEUTRAL)
        };
    }
    blurHandler(e) {
        const trimableTypes = [
            FormInputType.TEXT,
            FormInputType.EMAIL,
            FormInputType.SEARCH,
            FormInputType.TEL,
            FormInputType.URL
        ];
        const shouldTrim = this.afTrimValue && trimableTypes.includes(this.afType);
        if (shouldTrim && typeof e.target.value === 'string') {
            const trimmedValue = e.target.value.trim();
            if (trimmedValue !== e.target.value) {
                this.afValue = this.value = trimmedValue;
                if (this._input) {
                    this._input.value = trimmedValue;
                }
                // Emittar afOnInput så Angulars value accessor får det trimmade värdet
                this.afOnInput.emit(e);
            }
        }
        if (!this.touched) {
            this.afOnTouched.emit(e);
            this.touched = true;
        }
        this.afOnBlur.emit(e);
    }
    changeHandler(e) {
        this.setActiveValidationMessage();
        this.afOnChange.emit(e);
    }
    focusHandler(e) {
        this.afOnFocus.emit(e);
    }
    focusoutHandler(e) {
        this.afOnFocusout.emit(e);
    }
    keyupHandler(e) {
        this.afOnKeyup.emit(e);
    }
    inputHandler(e) {
        this.afValue = this.value =
            this.afType === FormInputType.NUMBER
                ? parseFloat(e.target.value)
                : e.target.value;
        if (!this.dirty) {
            this.afOnDirty.emit(e);
            this.dirty = true;
        }
        this.setActiveValidationMessage();
        this.afOnInput.emit(e);
    }
    setHasButton() {
        this.hasButton = !!this.hostElement.querySelector('[slot="button"]');
    }
    render() {
        return (h("div", { key: '76e580b94dd90b3d68427845fd8b67bb9c241a92', class: Object.assign({ 'digi-form-input': true }, this.cssModifiers) }, h("digi-form-label", { key: '153bdcc184b2199cc98919aaed49907c5a0230b6', class: "digi-form-input__label", afFor: this.afId, afLabel: this.afLabel, afDescription: this.afLabelDescription, afRequired: this.afRequired, afAnnounceIfOptional: this.afAnnounceIfOptional, afRequiredText: this.afRequiredText, afAnnounceIfOptionalText: this.afAnnounceIfOptionalText }), h("div", { key: '5a0459aaeb1116259f22cfa969c3026db4e3b6b9', class: "digi-form-input__input-wrapper" }, h("input", Object.assign({ key: '9c6bdb4d73cf4843240f0902d2a516dc877ad9cd', class: "digi-form-input__input", ref: (el) => (this._input = el), onBlur: (e) => this.blurHandler(e), onChange: (e) => this.changeHandler(e), onFocus: (e) => this.focusHandler(e), onFocusout: (e) => this.focusoutHandler(e), onKeyUp: (e) => this.keyupHandler(e), onInput: (e) => this.inputHandler(e), "aria-activedescendant": this.afAriaActivedescendant, "aria-describedby": this.afAriaDescribedby, "aria-labelledby": this.afAriaLabelledby, "aria-autocomplete": this.afAriaAutocomplete, "aria-invalid": this.afValidation === FormInputValidation.ERROR ? 'true' : 'false', "aria-controls": this.afAriaControls, autocomplete: this.afAutocomplete, autofocus: this.afAutofocus ? this.afAutofocus : null, maxLength: this.afMaxlength, minLength: this.afMinlength, max: this.afMax, min: this.afMin, step: this.afStep, list: this.afList, role: this.afRole, dirName: this.afDirname, required: this.afRequired, id: this.afId, name: this.afName, type: this.afType, value: this.afValue }, (this.afInputmode == FormInputMode.DEFAULT
            ? {}
            : { inputmode: this.afInputmode }))), h("slot", { key: '645bcd1d92b3984c984d9c8ea23c6c547c44f62b', name: "button" })), h("div", { key: '3b39eec1b0e9216dc0fe34067f90de3a50b49664', class: "digi-form-input__footer" }, h("div", { key: '6ff1c7cf6c84bfe2673890cabfda3fc5a0b0f138', class: "digi-form-input__validation", "aria-atomic": "true", role: "alert", id: `${this.afId}--validation-message` }, this.hasActiveValidationMessage &&
            this.afValidation != FormInputValidation.NEUTRAL && (h("digi-form-validation-message", { key: '25362c686f7124c53d16300b02e4c408aac5525e', class: "digi-form-input__validation-message", "af-variation": this.afValidation }, this.afValidationText))))));
    }
    static get is() { return "digi-form-input"; }
    static get encapsulation() { return "scoped"; }
    static get originalStyleUrls() {
        return {
            "$": ["form-input.scss"]
        };
    }
    static get styleUrls() {
        return {
            "$": ["form-input.css"]
        };
    }
    static get properties() {
        return {
            "afLabel": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": true,
                "optional": false,
                "docs": {
                    "tags": [{
                            "name": "en",
                            "text": "The label text"
                        }],
                    "text": "Texten till labelelementet"
                },
                "getter": false,
                "setter": false,
                "attribute": "af-label",
                "reflect": false
            },
            "afLabelDescription": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [{
                            "name": "en",
                            "text": "A description text"
                        }],
                    "text": "Valfri beskrivande text"
                },
                "getter": false,
                "setter": false,
                "attribute": "af-label-description",
                "reflect": false
            },
            "afType": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "FormInputType",
                    "resolved": "FormInputType.COLOR | FormInputType.DATE | FormInputType.DATETIME_LOCAL | FormInputType.EMAIL | FormInputType.HIDDEN | FormInputType.MONTH | FormInputType.NUMBER | FormInputType.PASSWORD | FormInputType.SEARCH | FormInputType.TEL | FormInputType.TEXT | FormInputType.TIME | FormInputType.URL | FormInputType.WEEK",
                    "references": {
                        "FormInputType": {
                            "location": "import",
                            "path": "./form-input-type.enum",
                            "id": "src/components/_form/form-input/form-input-type.enum.ts::FormInputType"
                        }
                    }
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [{
                            "name": "en",
                            "text": "Input type attribute"
                        }],
                    "text": "S\u00E4tter attributet 'type'."
                },
                "getter": false,
                "setter": false,
                "attribute": "af-type",
                "reflect": false,
                "defaultValue": "FormInputType.TEXT"
            },
            "afInputmode": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "FormInputMode",
                    "resolved": "FormInputMode.DECIMAL | FormInputMode.DEFAULT | FormInputMode.EMAIL | FormInputMode.NONE | FormInputMode.NUMERIC | FormInputMode.SEARCH | FormInputMode.TEL | FormInputMode.TEXT | FormInputMode.URL",
                    "references": {
                        "FormInputMode": {
                            "location": "import",
                            "path": "./form-input-mode.enum",
                            "id": "src/components/_form/form-input/form-input-mode.enum.ts::FormInputMode"
                        }
                    }
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [{
                            "name": "en",
                            "text": "Inputmode  type attribute"
                        }],
                    "text": "S\u00E4tter attributet 'inputmode'."
                },
                "getter": false,
                "setter": false,
                "attribute": "af-inputmode",
                "reflect": false,
                "defaultValue": "FormInputMode.DEFAULT"
            },
            "afButtonVariation": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "FormInputButtonVariation",
                    "resolved": "FormInputButtonVariation.PRIMARY | FormInputButtonVariation.SECONDARY",
                    "references": {
                        "FormInputButtonVariation": {
                            "location": "import",
                            "path": "./form-input-button-variation.enum",
                            "id": "src/components/_form/form-input/form-input-button-variation.enum.ts::FormInputButtonVariation"
                        }
                    }
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [{
                            "name": "en",
                            "text": "Input layout when there is a button"
                        }],
                    "text": "Layout f\u00F6r hur inmatningsf\u00E4ltet ska visas d\u00E5 det finns en knapp"
                },
                "getter": false,
                "setter": false,
                "attribute": "af-button-variation",
                "reflect": false,
                "defaultValue": "FormInputButtonVariation.PRIMARY"
            },
            "afAutofocus": {
                "type": "boolean",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [{
                            "name": "en",
                            "text": "Input autofocus attribute"
                        }],
                    "text": "S\u00E4tter attributet 'autofocus'."
                },
                "getter": false,
                "setter": false,
                "attribute": "af-autofocus",
                "reflect": false
            },
            "afVariation": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "FormInputVariation",
                    "resolved": "FormInputVariation.LARGE | FormInputVariation.MEDIUM | FormInputVariation.SMALL",
                    "references": {
                        "FormInputVariation": {
                            "location": "import",
                            "path": "./form-input-variation.enum",
                            "id": "src/components/_form/form-input/form-input-variation.enum.ts::FormInputVariation"
                        }
                    }
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [{
                            "name": "en",
                            "text": "Set input variation."
                        }],
                    "text": "S\u00E4tter variant. Kan vara 'small', 'medium' eller 'large'"
                },
                "getter": false,
                "setter": false,
                "attribute": "af-variation",
                "reflect": false,
                "defaultValue": "FormInputVariation.MEDIUM"
            },
            "afName": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [{
                            "name": "en",
                            "text": "Input name attribute"
                        }],
                    "text": "S\u00E4tter attributet 'name'."
                },
                "getter": false,
                "setter": false,
                "attribute": "af-name",
                "reflect": false
            },
            "afId": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [{
                            "name": "en",
                            "text": "Input id attribute. Defaults to random string."
                        }],
                    "text": "S\u00E4tter attributet 'id'. Om inget v\u00E4ljs s\u00E5 skapas ett slumpm\u00E4ssigt id."
                },
                "getter": false,
                "setter": false,
                "attribute": "af-id",
                "reflect": false,
                "defaultValue": "randomIdGenerator('digi-form-input')"
            },
            "afMaxlength": {
                "type": "number",
                "mutable": false,
                "complexType": {
                    "original": "number",
                    "resolved": "number",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [{
                            "name": "en",
                            "text": "Input maxlength attribute"
                        }],
                    "text": "S\u00E4tter attributet 'maxlength'."
                },
                "getter": false,
                "setter": false,
                "attribute": "af-maxlength",
                "reflect": false
            },
            "afMinlength": {
                "type": "number",
                "mutable": false,
                "complexType": {
                    "original": "number",
                    "resolved": "number",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [{
                            "name": "en",
                            "text": "Input minlength attribute"
                        }],
                    "text": "S\u00E4tter attributet 'minlength'."
                },
                "getter": false,
                "setter": false,
                "attribute": "af-minlength",
                "reflect": false
            },
            "afRequired": {
                "type": "boolean",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [{
                            "name": "en",
                            "text": "Input required attribute"
                        }],
                    "text": "S\u00E4tter attributet 'required'."
                },
                "getter": false,
                "setter": false,
                "attribute": "af-required",
                "reflect": false
            },
            "afRequiredText": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [{
                            "name": "en",
                            "text": "Set text for afRequired."
                        }],
                    "text": "S\u00E4tter text f\u00F6r afRequired."
                },
                "getter": false,
                "setter": false,
                "attribute": "af-required-text",
                "reflect": false
            },
            "afAnnounceIfOptional": {
                "type": "boolean",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [{
                            "name": "en",
                            "text": "Set this to true if the form contains more required fields than optional fields."
                        }],
                    "text": "S\u00E4tt denna till true om formul\u00E4ret inneh\u00E5ller fler obligatoriska f\u00E4lt \u00E4n valfria."
                },
                "getter": false,
                "setter": false,
                "attribute": "af-announce-if-optional",
                "reflect": false,
                "defaultValue": "false"
            },
            "afAnnounceIfOptionalText": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [{
                            "name": "en",
                            "text": "Set text for afAnnounceIfOptional."
                        }],
                    "text": "S\u00E4tter text f\u00F6r afAnnounceIfOptional."
                },
                "getter": false,
                "setter": false,
                "attribute": "af-announce-if-optional-text",
                "reflect": false
            },
            "value": {
                "type": "any",
                "mutable": false,
                "complexType": {
                    "original": "string | number",
                    "resolved": "number | string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [{
                            "name": "en",
                            "text": "Input value attribute"
                        }, {
                            "name": "ignore",
                            "text": undefined
                        }],
                    "text": "S\u00E4tter attributet 'value'."
                },
                "getter": false,
                "setter": false,
                "attribute": "value",
                "reflect": false
            },
            "afValue": {
                "type": "any",
                "mutable": false,
                "complexType": {
                    "original": "string | number",
                    "resolved": "number | string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [{
                            "name": "en",
                            "text": "Input value attribute"
                        }],
                    "text": "S\u00E4tter attributet 'value'."
                },
                "getter": false,
                "setter": false,
                "attribute": "af-value",
                "reflect": false
            },
            "afValidation": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "FormInputValidation",
                    "resolved": "FormInputValidation.ERROR | FormInputValidation.NEUTRAL | FormInputValidation.SUCCESS | FormInputValidation.WARNING",
                    "references": {
                        "FormInputValidation": {
                            "location": "import",
                            "path": "./form-input-validation.enum",
                            "id": "src/components/_form/form-input/form-input-validation.enum.ts::FormInputValidation"
                        }
                    }
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [{
                            "name": "en",
                            "text": "Set input validation status"
                        }],
                    "text": "S\u00E4tter valideringsstatus. Kan vara 'success', 'error', 'warning', 'neutral' eller ingenting."
                },
                "getter": false,
                "setter": false,
                "attribute": "af-validation",
                "reflect": false,
                "defaultValue": "FormInputValidation.NEUTRAL"
            },
            "afValidationText": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [{
                            "name": "en",
                            "text": "Set input validation message"
                        }],
                    "text": "S\u00E4tter valideringsmeddelandet"
                },
                "getter": false,
                "setter": false,
                "attribute": "af-validation-text",
                "reflect": false
            },
            "afRole": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [{
                            "name": "en",
                            "text": "Input role attribute"
                        }],
                    "text": "S\u00E4tter attributet 'role'."
                },
                "getter": false,
                "setter": false,
                "attribute": "af-role",
                "reflect": false
            },
            "afAutocomplete": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [{
                            "name": "en",
                            "text": "Input autocomplete attribute"
                        }],
                    "text": "S\u00E4tter attributet 'autocomplete'."
                },
                "getter": false,
                "setter": false,
                "attribute": "af-autocomplete",
                "reflect": false
            },
            "afMin": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [{
                            "name": "en",
                            "text": "Input min attribute"
                        }],
                    "text": "S\u00E4tter attributet 'min'."
                },
                "getter": false,
                "setter": false,
                "attribute": "af-min",
                "reflect": false
            },
            "afMax": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [{
                            "name": "en",
                            "text": "Input max attribute"
                        }],
                    "text": "S\u00E4tter attributet 'max'."
                },
                "getter": false,
                "setter": false,
                "attribute": "af-max",
                "reflect": false
            },
            "afList": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [{
                            "name": "en",
                            "text": "Input list attribute"
                        }],
                    "text": "S\u00E4tter attributet 'list'."
                },
                "getter": false,
                "setter": false,
                "attribute": "af-list",
                "reflect": false
            },
            "afStep": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [{
                            "name": "en",
                            "text": "Input step attribute"
                        }],
                    "text": "S\u00E4tter attributet 'step'."
                },
                "getter": false,
                "setter": false,
                "attribute": "af-step",
                "reflect": false
            },
            "afDirname": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [{
                            "name": "en",
                            "text": "Input dirname attribute"
                        }],
                    "text": "S\u00E4tter attributet 'dirname'."
                },
                "getter": false,
                "setter": false,
                "attribute": "af-dirname",
                "reflect": false
            },
            "afAriaAutocomplete": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [{
                            "name": "en",
                            "text": "Input aria-autocomplete attribute"
                        }],
                    "text": "S\u00E4tter attributet 'aria-autocomplete'."
                },
                "getter": false,
                "setter": false,
                "attribute": "af-aria-autocomplete",
                "reflect": false
            },
            "afAriaActivedescendant": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [{
                            "name": "en",
                            "text": "Input aria-activedescendant attribute"
                        }],
                    "text": "S\u00E4tter attributet 'aria-activedescendant'."
                },
                "getter": false,
                "setter": false,
                "attribute": "af-aria-activedescendant",
                "reflect": false
            },
            "afAriaLabelledby": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [{
                            "name": "en",
                            "text": "Input aria-labelledby attribute"
                        }],
                    "text": "S\u00E4tter attributet 'aria-labelledby'."
                },
                "getter": false,
                "setter": false,
                "attribute": "af-aria-labelledby",
                "reflect": false
            },
            "afAriaDescribedby": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [{
                            "name": "en",
                            "text": "Input aria-describedby attribute"
                        }],
                    "text": "S\u00E4tter attributet 'aria-describedby'."
                },
                "getter": false,
                "setter": false,
                "attribute": "af-aria-describedby",
                "reflect": false
            },
            "afAriaControls": {
                "type": "string",
                "mutable": false,
                "complexType": {
                    "original": "string",
                    "resolved": "string",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [{
                            "name": "en",
                            "text": "Input aria-controls attribute"
                        }],
                    "text": "S\u00E4tter attributet 'aria-controls'."
                },
                "getter": false,
                "setter": false,
                "attribute": "af-aria-controls",
                "reflect": false
            },
            "afTrimValue": {
                "type": "boolean",
                "mutable": false,
                "complexType": {
                    "original": "boolean",
                    "resolved": "boolean",
                    "references": {}
                },
                "required": false,
                "optional": false,
                "docs": {
                    "tags": [{
                            "name": "en",
                            "text": "If true, the value of the input field is trimmed on blur for following\nFormInputType: TEXT, EMAIL, SEARCH, TEL and URL."
                        }],
                    "text": "S\u00E4tts till true f\u00F6r att trimma v\u00E4rdet i inmatningsf\u00E4ltet vid onblur.\nSt\u00F6djer inmatningsf\u00E4lt av typerna FormInputType: TEXT, EMAIL, SEARCH, TEL och URL."
                },
                "getter": false,
                "setter": false,
                "attribute": "af-trim-value",
                "reflect": false
            }
        };
    }
    static get states() {
        return {
            "hasActiveValidationMessage": {},
            "hasButton": {},
            "dirty": {},
            "touched": {}
        };
    }
    static get events() {
        return [{
                "method": "afOnChange",
                "name": "afOnChange",
                "bubbles": true,
                "cancelable": true,
                "composed": true,
                "docs": {
                    "tags": [{
                            "name": "en",
                            "text": "The input element's 'onchange' event."
                        }],
                    "text": "Inputelementets 'onchange'-event."
                },
                "complexType": {
                    "original": "any",
                    "resolved": "any",
                    "references": {}
                }
            }, {
                "method": "afOnBlur",
                "name": "afOnBlur",
                "bubbles": true,
                "cancelable": true,
                "composed": true,
                "docs": {
                    "tags": [{
                            "name": "en",
                            "text": "The input element's 'onblur' event."
                        }],
                    "text": "Inputelementets 'onblur'-event."
                },
                "complexType": {
                    "original": "any",
                    "resolved": "any",
                    "references": {}
                }
            }, {
                "method": "afOnKeyup",
                "name": "afOnKeyup",
                "bubbles": true,
                "cancelable": true,
                "composed": true,
                "docs": {
                    "tags": [{
                            "name": "en",
                            "text": "The input element's 'onkeyup' event."
                        }],
                    "text": "Inputelementets 'onkeyup'-event."
                },
                "complexType": {
                    "original": "any",
                    "resolved": "any",
                    "references": {}
                }
            }, {
                "method": "afOnFocus",
                "name": "afOnFocus",
                "bubbles": true,
                "cancelable": true,
                "composed": true,
                "docs": {
                    "tags": [{
                            "name": "en",
                            "text": "The input element's 'onfocus' event."
                        }],
                    "text": "Inputelementets 'onfocus'-event."
                },
                "complexType": {
                    "original": "any",
                    "resolved": "any",
                    "references": {}
                }
            }, {
                "method": "afOnFocusout",
                "name": "afOnFocusout",
                "bubbles": true,
                "cancelable": true,
                "composed": true,
                "docs": {
                    "tags": [{
                            "name": "en",
                            "text": "The input element's 'onfocusout' event."
                        }],
                    "text": "Inputelementets 'onfocusout'-event."
                },
                "complexType": {
                    "original": "any",
                    "resolved": "any",
                    "references": {}
                }
            }, {
                "method": "afOnInput",
                "name": "afOnInput",
                "bubbles": true,
                "cancelable": true,
                "composed": true,
                "docs": {
                    "tags": [{
                            "name": "en",
                            "text": "The input element's 'oninput' event."
                        }],
                    "text": "Inputelementets 'oninput'-event."
                },
                "complexType": {
                    "original": "any",
                    "resolved": "any",
                    "references": {}
                }
            }, {
                "method": "afOnDirty",
                "name": "afOnDirty",
                "bubbles": true,
                "cancelable": true,
                "composed": true,
                "docs": {
                    "tags": [{
                            "name": "en",
                            "text": "First time the input element receives an input"
                        }],
                    "text": "Sker vid inputf\u00E4ltets f\u00F6rsta 'oninput'"
                },
                "complexType": {
                    "original": "any",
                    "resolved": "any",
                    "references": {}
                }
            }, {
                "method": "afOnTouched",
                "name": "afOnTouched",
                "bubbles": true,
                "cancelable": true,
                "composed": true,
                "docs": {
                    "tags": [{
                            "name": "en",
                            "text": "First time the input element is blurred"
                        }],
                    "text": "Sker vid inputf\u00E4ltets f\u00F6rsta 'onblur'"
                },
                "complexType": {
                    "original": "any",
                    "resolved": "any",
                    "references": {}
                }
            }, {
                "method": "afOnReady",
                "name": "afOnReady",
                "bubbles": false,
                "cancelable": true,
                "composed": true,
                "docs": {
                    "tags": [{
                            "name": "en",
                            "text": "When the component and slots are loaded and initialized this event will trigger."
                        }],
                    "text": "N\u00E4r komponenten och slotsen \u00E4r laddade och initierade s\u00E5 skickas detta eventet."
                },
                "complexType": {
                    "original": "any",
                    "resolved": "any",
                    "references": {}
                }
            }];
    }
    static get methods() {
        return {
            "afMGetFormControlElement": {
                "complexType": {
                    "signature": "() => Promise<HTMLInputElement>",
                    "parameters": [],
                    "references": {
                        "Promise": {
                            "location": "global",
                            "id": "global::Promise"
                        },
                        "HTMLInputElement": {
                            "location": "global",
                            "id": "global::HTMLInputElement"
                        }
                    },
                    "return": "Promise<HTMLInputElement>"
                },
                "docs": {
                    "text": "H\u00E4mtar en referens till inputelementet. Bra f\u00F6r att t.ex. s\u00E4tta fokus programmatiskt.",
                    "tags": [{
                            "name": "en",
                            "text": "Returns a reference to the input element. Handy for setting focus programmatically."
                        }]
                }
            }
        };
    }
    static get elementRef() { return "hostElement"; }
    static get watchers() {
        return [{
                "propName": "value",
                "methodName": "onValueChanged"
            }, {
                "propName": "afValue",
                "methodName": "onAfValueChanged"
            }, {
                "propName": "afValidationText",
                "methodName": "afValidationTextWatch"
            }];
    }
}
