@telia-ace/alliance-ui 1.0.9-next.0 → 1.0.10-next.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,169 +1,14 @@
1
- import { p as c, H as d, c as m, h as i } from "../../chunks/index-eef143db.js";
2
- import { u as s } from "../../chunks/uniqueId-0daf01ec.js";
3
- import { s as p } from "../../chunks/stringCombiner-10b57054.js";
4
- import { d as h } from "../../chunks/telia-field-assistive-text2-173ba2fb.js";
5
- import { d as v } from "../../chunks/telia-field-error2-75dc8ceb.js";
6
- import { d as g } from "../../chunks/telia-field-valid2-0f6759ac.js";
7
- import { d as f } from "../../chunks/telia-icon2-d0e7c715.js";
8
- import { d as _ } from "../../chunks/telia-label2-f4c1eb47.js";
9
- import { d as b } from "../../chunks/telia-vst2-dfb33a56.js";
1
+ import "../../chunks/telia-text-input2-db9121d9.js";
2
+ import "../../chunks/index-eef143db.js";
3
+ import "../../chunks/uniqueId-0daf01ec.js";
4
+ import "../../chunks/stringCombiner-10b57054.js";
5
+ import "../../chunks/telia-field-assistive-text2-173ba2fb.js";
6
+ import "../../chunks/telia-vst2-dfb33a56.js";
7
+ import "../../chunks/telia-field-error2-75dc8ceb.js";
10
8
  import "../../chunks/error-filled-8de50bdd.js";
11
- import "../../chunks/check-circle-filled-42095247.js";
9
+ import "../../chunks/telia-icon2-d0e7c715.js";
12
10
  import "../../chunks/getSvgContent-f2389ce0.js";
13
- const x = {
14
- text: "text",
15
- number: "number",
16
- email: "email",
17
- tel: "tel",
18
- search: "search",
19
- password: "password"
20
- }, E = '.telia-text-input{display:flex;flex-direction:column}.telia-text-input__input{border:calc(0.1rem * var(--voca-rem-multiplier)) solid rgba(0, 0, 0, 0.3);border-radius:calc(0.2rem * var(--voca-rem-multiplier));background-color:#ffffff;font-family:"TeliaSans", Helvetica, Arial, "Lucida Grande", sans-serif;font-weight:normal;font-size:calc(1.6rem * var(--voca-rem-multiplier));line-height:1.5;-webkit-appearance:none;appearance:none;box-sizing:border-box;color:rgba(0, 0, 0, 0.85);display:block;margin:0;padding:calc(1rem * var(--voca-rem-multiplier)) calc(1.2rem * var(--voca-rem-multiplier));width:100%;height:calc(4.6rem * var(--voca-rem-multiplier));margin:calc(0.4rem * var(--voca-rem-multiplier)) 0 0;order:2}.telia-text-input__input:required{box-shadow:none}.telia-text-input__input[type=search]{-webkit-appearance:textfield;outline-offset:calc(-0.2rem * var(--voca-rem-multiplier))}.telia-text-input__input[type=search]::-webkit-search-decoration{-webkit-appearance:none}.telia-text-input__input[type=number]~.telia-text-input__valid-icon-container,.telia-text-input__input[type=search]~.telia-text-input__valid-icon-container{margin:calc(-1 * (4.6rem * var(--voca-rem-multiplier))) calc(1.2rem * var(--voca-rem-multiplier)) 0 calc(100% - (3.2rem * var(--voca-rem-multiplier)));width:0}.telia-text-input__input:hover{border:calc(0.2rem * var(--voca-rem-multiplier)) solid #29003e;padding:calc(calc(1rem * var(--voca-rem-multiplier)) - calc(0.1rem * var(--voca-rem-multiplier))) calc(calc(1.2rem * var(--voca-rem-multiplier)) - calc(0.1rem * var(--voca-rem-multiplier)))}.telia-text-input__input:hover:focus{border:calc(0.1rem * var(--voca-rem-multiplier)) solid rgba(0, 0, 0, 0.3)}.telia-text-input__input:focus{outline:solid calc(0.3rem * var(--voca-rem-multiplier)) #0099ff;outline-offset:calc(0.2rem * var(--voca-rem-multiplier));padding:calc(1rem * var(--voca-rem-multiplier)) calc(1.2rem * var(--voca-rem-multiplier))}.telia-text-input__input:focus:hover{border:calc(0.1rem * var(--voca-rem-multiplier)) solid rgba(0, 0, 0, 0.3)}.telia-text-input__input:read-only{border:calc(0.1rem * var(--voca-rem-multiplier)) solid #c8c8cd;background-color:rgba(0, 0, 0, 0.05)}.telia-text-input__input:read-only:hover{border:calc(0.1rem * var(--voca-rem-multiplier)) solid #c8c8cd;padding:calc(1rem * var(--voca-rem-multiplier)) calc(1.2rem * var(--voca-rem-multiplier))}.telia-text-input__input:disabled{border:calc(0.1rem * var(--voca-rem-multiplier)) solid rgba(0, 0, 0, 0.15);background-color:rgba(0, 0, 0, 0.1);color:rgba(0, 0, 0, 0.4);cursor:not-allowed;-webkit-text-fill-color:#606064}.telia-text-input__input:disabled:hover{padding:calc(1rem * var(--voca-rem-multiplier)) calc(1.2rem * var(--voca-rem-multiplier))}.telia-text-input__input:disabled~telia-label .telia-label{color:rgba(0, 0, 0, 0.4);cursor:not-allowed}.telia-text-input__input:disabled~.telia-text-input__additional{color:rgba(0, 0, 0, 0.4)}.telia-text-input__input:invalid{box-shadow:none}.telia-text-input__input--icon-shown{padding:calc(1rem * var(--voca-rem-multiplier)) calc(4.5rem * var(--voca-rem-multiplier)) calc(1rem * var(--voca-rem-multiplier)) calc(1.2rem * var(--voca-rem-multiplier))}.telia-text-input__input--touched:invalid{border:calc(0.1rem * var(--voca-rem-multiplier)) solid #e4175c}.telia-text-input__input--touched:invalid:focus{border:calc(0.1rem * var(--voca-rem-multiplier)) solid rgba(0, 0, 0, 0.3)}.telia-text-input__input--touched:invalid:hover:not(:focus){border:calc(0.2rem * var(--voca-rem-multiplier)) solid #e4175c;padding:calc(calc(1rem * var(--voca-rem-multiplier)) - calc(0.1rem * var(--voca-rem-multiplier))) calc(calc(1.2rem * var(--voca-rem-multiplier)) - calc(0.1rem * var(--voca-rem-multiplier)))}.telia-text-input__valid-icon-container{align-items:center;display:flex;flex-direction:row;height:calc(4.6rem * var(--voca-rem-multiplier));justify-content:flex-end;margin:calc(calc(4.6rem * var(--voca-rem-multiplier)) * -1) calc(1.2rem * var(--voca-rem-multiplier)) 0 calc(100% - calc(1.2rem * var(--voca-rem-multiplier)));order:3}.telia-text-input__additional{order:4}.telia-text-input__error{margin:calc(0.4rem * var(--voca-rem-multiplier)) 0 0;order:5}', V = /* @__PURE__ */ c(class extends d {
21
- constructor() {
22
- super(), this.__registerHost(), this.valueChange = m(this, "valueChange", 7), this.type = x.text, this.value = "", this.additionalId = s("additional"), this.inputId = s("input"), this.errorId = s("error"), this.disabled = !1, this.readonly = !1, this.required = !1, this.showValidIcon = !1, this.dataTrackingId = "telia-text-input", this.touched = !1, this.dirty = !1, this.inputValue = "", this.errorMessageState = "", this.updateInputValue = () => {
23
- this.inputValue = this.inputElement ? this.inputElement.value : this.value;
24
- }, this.isValuePatternValid = () => this.pattern ? new RegExp("^(?:" + this.pattern + ")$").test(this.inputValue) : !0, this.isValueLessThanMinlength = () => this.inputValue.length > 0 && this.inputValue.length < this.minlength, this.isValueTypeInvalid = () => {
25
- var t;
26
- return (t = this.inputElement) === null || t === void 0 ? void 0 : t.validity.typeMismatch;
27
- }, this.updateErrorMessage = (t) => {
28
- var e;
29
- (e = this.inputElement) === null || e === void 0 || e.setCustomValidity(t), this.errorMessageState = t;
30
- }, this.isValueMissing = () => this.inputValue.length === 0, this.updateErrorState = () => {
31
- var t, e;
32
- const a = !!(!((t = this.errorMessageState) === null || t === void 0) && t.length), l = this.required, r = !!this.pattern, n = this.minlength, u = !!(!((e = this.errorMessage) === null || e === void 0) && e.length), o = !!this.emailErrorMessage && this.type === "email";
33
- if (u) {
34
- this.updateErrorMessage(this.errorMessage), this.touched = !0;
35
- return;
36
- }
37
- if (r && !this.isValueMissing() && this.touched && this.patternErrorMessage && !this.isValuePatternValid() && this.updateErrorMessage(this.patternErrorMessage), n && this.touched && this.minlengthErrorMessage && this.isValueLessThanMinlength() && this.updateErrorMessage(this.minlengthErrorMessage), l && (o && this.isValueTypeInvalid() && this.touched && this.updateErrorMessage(this.emailErrorMessage), this.touched && this.requiredErrorMessage && this.isValueMissing() && this.updateErrorMessage(this.requiredErrorMessage)), a) {
38
- if (r && !this.isValuePatternValid() || n && this.isValueLessThanMinlength() || l && this.isValueMissing() || o && this.isValueTypeInvalid())
39
- return;
40
- this.updateErrorMessage("");
41
- }
42
- };
43
- }
44
- /**
45
- * Sets focus on input
46
- */
47
- async focusInput() {
48
- this.inputElement.focus();
49
- }
50
- componentWillLoad() {
51
- this.updateInputValue(), this.updateErrorState();
52
- }
53
- componentWillUpdate() {
54
- this.updateErrorState();
55
- }
56
- componentDidRender() {
57
- var t, e, a;
58
- this.inputElement && (!((t = this.inputElement) === null || t === void 0) && t.setCustomValidity) && ((e = this.inputElement) === null || e === void 0 || e.setCustomValidity(this.errorMessageState)), this.htmlForm && ((a = this.inputElement) === null || a === void 0 || a.setAttribute("form", this.htmlForm));
59
- }
60
- /**
61
- * Watch if value attributes changes after initial load.
62
- * Needed for prefilling functionality to work with input validations.
63
- * @param value value attribute
64
- */
65
- componentValueChanged(t) {
66
- this.inputValue = t, this.updateErrorState();
67
- }
68
- /**
69
- * This method is used to determine
70
- * if a 'valid icon' can be shown to the user.
71
- * Given the complexity of the validation logic
72
- * in this component, using this method
73
- * to determine 'validity' in a general sense
74
- * should be carefully considered and tested.
75
- */
76
- isValid() {
77
- return !this.errorMessage && !this.isValueMissing() && !this.isValueLessThanMinlength() && !this.isValueTypeInvalid() && this.isValuePatternValid();
78
- }
79
- render() {
80
- const t = this.touched && !!this.errorMessageState.length, e = !!this.additional, a = p({
81
- [this.additionalId]: e,
82
- [this.errorId]: this.errorMessageState.length
83
- }), l = this.showValidIcon && this.dirty && this.isValid();
84
- return i("div", { class: "telia-text-input" }, i("input", { class: {
85
- "telia-text-input__input": !0,
86
- "telia-text-input__input--touched": this.touched,
87
- "telia-text-input__input--icon-shown": l
88
- }, placeholder: this.placeholder, type: this.type, id: this.inputId, "aria-describedby": a, minlength: this.minlength, maxlength: this.maxlength, disabled: this.disabled, readonly: this.readonly, value: this.value, name: this.name, onChange: (r) => {
89
- this.valueChange.emit(r);
90
- }, onInput: () => {
91
- this.dirty = !0, this.updateInputValue(), this.updateErrorState();
92
- }, inputmode: this.inputmode, list: this.list, autocomplete: this.autocomplete, required: this.required, onBlur: () => {
93
- this.touched = !0, this.updateErrorState();
94
- }, ref: (r) => this.inputElement = r, pattern: this.pattern, onInvalid: (r) => {
95
- r.preventDefault(), this.touched = !0, this.updateErrorState();
96
- }, form: this.htmlForm }), l && i("div", { class: "telia-text-input__valid-icon-container" }, i("telia-field-valid", { class: "telia-text-input__valid-icon" })), i("telia-label", { class: "telia-text-input__label", htmlFor: this.inputId }, this.required && i("span", { "aria-hidden": "true" }, "* "), this.label), e && i("telia-field-assistive-text", { class: "telia-text-input__additional", id: this.additionalId }, this.additional), t && i("telia-field-error", { id: this.errorId, class: "telia-text-input__error" }, this.errorMessageState), i("telia-vst", { dataTrackingId: this.dataTrackingId }));
97
- }
98
- static get watchers() {
99
- return {
100
- value: ["componentValueChanged"]
101
- };
102
- }
103
- static get style() {
104
- return E;
105
- }
106
- }, [0, "telia-text-input", {
107
- dataTestid: [1, "data-testid"],
108
- htmlForm: [1, "html-form"],
109
- type: [1],
110
- label: [1],
111
- value: [1],
112
- placeholder: [1],
113
- name: [1],
114
- additional: [1],
115
- additionalId: [1, "additional-id"],
116
- inputId: [1, "input-id"],
117
- errorId: [1, "error-id"],
118
- disabled: [4],
119
- minlength: [2],
120
- maxlength: [2],
121
- readonly: [4],
122
- inputmode: [1],
123
- list: [1],
124
- autocomplete: [1],
125
- required: [4],
126
- requiredErrorMessage: [1, "required-error-message"],
127
- emailErrorMessage: [1, "email-error-message"],
128
- minlengthErrorMessage: [1, "minlength-error-message"],
129
- showValidIcon: [4, "show-valid-icon"],
130
- pattern: [1],
131
- patternErrorMessage: [1, "pattern-error-message"],
132
- errorMessage: [1, "error-message"],
133
- touched: [32],
134
- dirty: [32],
135
- inputValue: [32],
136
- errorMessageState: [32],
137
- focusInput: [64]
138
- }]);
139
- function M() {
140
- if (typeof customElements > "u")
141
- return;
142
- ["telia-text-input", "telia-field-assistive-text", "telia-field-error", "telia-field-valid", "telia-icon", "telia-label", "telia-vst"].forEach((e) => {
143
- switch (e) {
144
- case "telia-text-input":
145
- customElements.get(e) || customElements.define(e, V);
146
- break;
147
- case "telia-field-assistive-text":
148
- customElements.get(e) || h();
149
- break;
150
- case "telia-field-error":
151
- customElements.get(e) || v();
152
- break;
153
- case "telia-field-valid":
154
- customElements.get(e) || g();
155
- break;
156
- case "telia-icon":
157
- customElements.get(e) || f();
158
- break;
159
- case "telia-label":
160
- customElements.get(e) || _();
161
- break;
162
- case "telia-vst":
163
- customElements.get(e) || b();
164
- break;
165
- }
166
- });
167
- }
168
- M();
11
+ import "../../chunks/telia-field-valid2-0f6759ac.js";
12
+ import "../../chunks/check-circle-filled-42095247.js";
13
+ import "../../chunks/telia-label2-f4c1eb47.js";
169
14
  //# sourceMappingURL=telia-text-input.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"telia-text-input.js","sources":["../../../../node_modules/.pnpm/@teliads+components@21.3.1/node_modules/@teliads/components/dist/components/telia-text-input2.js"],"sourcesContent":["import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';\nimport { u as uniqueId } from './uniqueId.js';\nimport { s as stringCombiner } from './stringCombiner.js';\nimport { d as defineCustomElement$6 } from './telia-field-assistive-text2.js';\nimport { d as defineCustomElement$5 } from './telia-field-error2.js';\nimport { d as defineCustomElement$4 } from './telia-field-valid2.js';\nimport { d as defineCustomElement$3 } from './telia-icon2.js';\nimport { d as defineCustomElement$2 } from './telia-label2.js';\nimport { d as defineCustomElement$1 } from './telia-vst2.js';\n\n// Create a const where all members have a readonly value\n// and literal type by using const assertion.\nconst TextFieldTypes = {\n text: 'text',\n number: 'number',\n email: 'email',\n tel: 'tel',\n search: 'search',\n password: 'password',\n};\n\nconst teliaTextInputCss = \".telia-text-input{display:flex;flex-direction:column}.telia-text-input__input{border:calc(0.1rem * var(--voca-rem-multiplier)) solid rgba(0, 0, 0, 0.3);border-radius:calc(0.2rem * var(--voca-rem-multiplier));background-color:#ffffff;font-family:\\\"TeliaSans\\\", Helvetica, Arial, \\\"Lucida Grande\\\", sans-serif;font-weight:normal;font-size:calc(1.6rem * var(--voca-rem-multiplier));line-height:1.5;-webkit-appearance:none;appearance:none;box-sizing:border-box;color:rgba(0, 0, 0, 0.85);display:block;margin:0;padding:calc(1rem * var(--voca-rem-multiplier)) calc(1.2rem * var(--voca-rem-multiplier));width:100%;height:calc(4.6rem * var(--voca-rem-multiplier));margin:calc(0.4rem * var(--voca-rem-multiplier)) 0 0;order:2}.telia-text-input__input:required{box-shadow:none}.telia-text-input__input[type=search]{-webkit-appearance:textfield;outline-offset:calc(-0.2rem * var(--voca-rem-multiplier))}.telia-text-input__input[type=search]::-webkit-search-decoration{-webkit-appearance:none}.telia-text-input__input[type=number]~.telia-text-input__valid-icon-container,.telia-text-input__input[type=search]~.telia-text-input__valid-icon-container{margin:calc(-1 * (4.6rem * var(--voca-rem-multiplier))) calc(1.2rem * var(--voca-rem-multiplier)) 0 calc(100% - (3.2rem * var(--voca-rem-multiplier)));width:0}.telia-text-input__input:hover{border:calc(0.2rem * var(--voca-rem-multiplier)) solid #29003e;padding:calc(calc(1rem * var(--voca-rem-multiplier)) - calc(0.1rem * var(--voca-rem-multiplier))) calc(calc(1.2rem * var(--voca-rem-multiplier)) - calc(0.1rem * var(--voca-rem-multiplier)))}.telia-text-input__input:hover:focus{border:calc(0.1rem * var(--voca-rem-multiplier)) solid rgba(0, 0, 0, 0.3)}.telia-text-input__input:focus{outline:solid calc(0.3rem * var(--voca-rem-multiplier)) #0099ff;outline-offset:calc(0.2rem * var(--voca-rem-multiplier));padding:calc(1rem * var(--voca-rem-multiplier)) calc(1.2rem * var(--voca-rem-multiplier))}.telia-text-input__input:focus:hover{border:calc(0.1rem * var(--voca-rem-multiplier)) solid rgba(0, 0, 0, 0.3)}.telia-text-input__input:read-only{border:calc(0.1rem * var(--voca-rem-multiplier)) solid #c8c8cd;background-color:rgba(0, 0, 0, 0.05)}.telia-text-input__input:read-only:hover{border:calc(0.1rem * var(--voca-rem-multiplier)) solid #c8c8cd;padding:calc(1rem * var(--voca-rem-multiplier)) calc(1.2rem * var(--voca-rem-multiplier))}.telia-text-input__input:disabled{border:calc(0.1rem * var(--voca-rem-multiplier)) solid rgba(0, 0, 0, 0.15);background-color:rgba(0, 0, 0, 0.1);color:rgba(0, 0, 0, 0.4);cursor:not-allowed;-webkit-text-fill-color:#606064}.telia-text-input__input:disabled:hover{padding:calc(1rem * var(--voca-rem-multiplier)) calc(1.2rem * var(--voca-rem-multiplier))}.telia-text-input__input:disabled~telia-label .telia-label{color:rgba(0, 0, 0, 0.4);cursor:not-allowed}.telia-text-input__input:disabled~.telia-text-input__additional{color:rgba(0, 0, 0, 0.4)}.telia-text-input__input:invalid{box-shadow:none}.telia-text-input__input--icon-shown{padding:calc(1rem * var(--voca-rem-multiplier)) calc(4.5rem * var(--voca-rem-multiplier)) calc(1rem * var(--voca-rem-multiplier)) calc(1.2rem * var(--voca-rem-multiplier))}.telia-text-input__input--touched:invalid{border:calc(0.1rem * var(--voca-rem-multiplier)) solid #e4175c}.telia-text-input__input--touched:invalid:focus{border:calc(0.1rem * var(--voca-rem-multiplier)) solid rgba(0, 0, 0, 0.3)}.telia-text-input__input--touched:invalid:hover:not(:focus){border:calc(0.2rem * var(--voca-rem-multiplier)) solid #e4175c;padding:calc(calc(1rem * var(--voca-rem-multiplier)) - calc(0.1rem * var(--voca-rem-multiplier))) calc(calc(1.2rem * var(--voca-rem-multiplier)) - calc(0.1rem * var(--voca-rem-multiplier)))}.telia-text-input__valid-icon-container{align-items:center;display:flex;flex-direction:row;height:calc(4.6rem * var(--voca-rem-multiplier));justify-content:flex-end;margin:calc(calc(4.6rem * var(--voca-rem-multiplier)) * -1) calc(1.2rem * var(--voca-rem-multiplier)) 0 calc(100% - calc(1.2rem * var(--voca-rem-multiplier)));order:3}.telia-text-input__additional{order:4}.telia-text-input__error{margin:calc(0.4rem * var(--voca-rem-multiplier)) 0 0;order:5}\";\n\nconst TeliaTextInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {\n constructor() {\n super();\n this.__registerHost();\n this.valueChange = createEvent(this, \"valueChange\", 7);\n /** Type of input as a string */\n this.type = TextFieldTypes.text;\n /** Value of input */\n this.value = '';\n /** Additional description id */\n this.additionalId = uniqueId('additional');\n /** Input element id */\n this.inputId = uniqueId('input');\n /** Error description id */\n this.errorId = uniqueId('error');\n /** Disabled state */\n this.disabled = false;\n /** Readonly state */\n this.readonly = false;\n /** Field needs to be filled, so it can be submitted */\n this.required = false;\n /** Show valid icon when value passes all validations. Use sparingly. */\n this.showValidIcon = false;\n /** Tracking id is used to identify and count Component usage */\n this.dataTrackingId = 'telia-text-input';\n /**\n * Input has been blurred at least once.\n */\n this.touched = false;\n /**\n * Input has received data at least once.\n */\n this.dirty = false;\n /**\n * Real time value of input\n */\n this.inputValue = '';\n /**\n * Error message\n */\n this.errorMessageState = '';\n this.updateInputValue = () => {\n // eslint-disable-next-line @stencil/strict-boolean-conditions\n this.inputValue = this.inputElement ? this.inputElement.value : this.value;\n };\n /**\n * Check if input value state is valid with given pattern. This is\n * imitating native input validation.\n */\n this.isValuePatternValid = () => {\n if (this.pattern) {\n const regexp = new RegExp('^(?:' + this.pattern + ')$');\n return regexp.test(this.inputValue);\n }\n return true;\n };\n this.isValueLessThanMinlength = () => {\n return (this.inputValue.length > 0 && this.inputValue.length < this.minlength);\n };\n /**\n * Check if validation failed due to type mismatch.\n * Type mismatch is set to true when email, url, ... field type built-in validation triggers\n */\n this.isValueTypeInvalid = () => {\n var _a;\n return (_a = this.inputElement) === null || _a === void 0 ? void 0 : _a.validity.typeMismatch;\n };\n /**\n * Update error message and keep native input error message in sync.\n */\n this.updateErrorMessage = message => {\n var _a;\n (_a = this.inputElement) === null || _a === void 0 ? void 0 : _a.setCustomValidity(message);\n this.errorMessageState = message;\n };\n /**\n * Check if input value is empty, so required should be triggered.\n */\n this.isValueMissing = () => {\n return this.inputValue.length === 0;\n };\n this.updateErrorState = () => {\n var _a, _b;\n const errorMessageIsSet = !!((_a = this.errorMessageState) === null || _a === void 0 ? void 0 : _a.length);\n const requiredInUse = this.required;\n const patternInUse = !!this.pattern;\n const minlengthInUse = this.minlength;\n const generalErrorInUse = !!((_b = this.errorMessage) === null || _b === void 0 ? void 0 : _b.length);\n const emailErrorInUse = !!this.emailErrorMessage && this.type === 'email';\n if (generalErrorInUse) {\n this.updateErrorMessage(this.errorMessage);\n this.touched = true;\n // General error message overrides other errors, so exit here.\n return;\n }\n if (patternInUse && !this.isValueMissing()) {\n if (this.touched &&\n !!this.patternErrorMessage &&\n !this.isValuePatternValid()) {\n this.updateErrorMessage(this.patternErrorMessage);\n }\n }\n if (minlengthInUse) {\n if (this.touched &&\n !!this.minlengthErrorMessage &&\n this.isValueLessThanMinlength()) {\n this.updateErrorMessage(this.minlengthErrorMessage);\n }\n }\n if (requiredInUse) {\n /**\n * Follow HTML5 input ways of working,\n * email field is validated only if type is email and required is set to true\n */\n if (emailErrorInUse && this.isValueTypeInvalid() && this.touched) {\n this.updateErrorMessage(this.emailErrorMessage);\n }\n if (this.touched &&\n !!this.requiredErrorMessage &&\n this.isValueMissing()) {\n this.updateErrorMessage(this.requiredErrorMessage);\n }\n }\n // Clean error message if needed\n if (errorMessageIsSet) {\n if (patternInUse && !this.isValuePatternValid())\n return;\n if (minlengthInUse && this.isValueLessThanMinlength())\n return;\n if (requiredInUse && this.isValueMissing())\n return;\n if (emailErrorInUse && this.isValueTypeInvalid())\n return;\n this.updateErrorMessage('');\n }\n };\n }\n /**\n * Sets focus on input\n */\n async focusInput() {\n this.inputElement.focus();\n }\n componentWillLoad() {\n this.updateInputValue();\n this.updateErrorState();\n }\n componentWillUpdate() {\n this.updateErrorState();\n }\n componentDidRender() {\n // This check is for Stencil unit tests. Input element is mocked,\n // but setCustomValidity method is not. It is undefined.\n var _a, _b, _c;\n // eslint-disable-next-line @stencil/strict-boolean-conditions\n if (this.inputElement && ((_a = this.inputElement) === null || _a === void 0 ? void 0 : _a.setCustomValidity)) {\n (_b = this.inputElement) === null || _b === void 0 ? void 0 : _b.setCustomValidity(this.errorMessageState);\n }\n if (this.htmlForm) {\n (_c = this.inputElement) === null || _c === void 0 ? void 0 : _c.setAttribute('form', this.htmlForm);\n }\n }\n /**\n * Watch if value attributes changes after initial load.\n * Needed for prefilling functionality to work with input validations.\n * @param value value attribute\n */\n componentValueChanged(value) {\n this.inputValue = value;\n this.updateErrorState();\n }\n /**\n * This method is used to determine\n * if a 'valid icon' can be shown to the user.\n * Given the complexity of the validation logic\n * in this component, using this method\n * to determine 'validity' in a general sense\n * should be carefully considered and tested.\n */\n isValid() {\n return (!this.errorMessage &&\n !this.isValueMissing() &&\n !this.isValueLessThanMinlength() &&\n !this.isValueTypeInvalid() &&\n this.isValuePatternValid());\n }\n render() {\n const showError = this.touched && !!this.errorMessageState.length;\n const showAdditional = !!this.additional;\n const describedBy = stringCombiner({\n [this.additionalId]: showAdditional,\n [this.errorId]: this.errorMessageState.length,\n });\n const showValidIcon = this.showValidIcon && this.dirty && this.isValid();\n return (h(\"div\", { class: \"telia-text-input\" }, h(\"input\", { class: {\n 'telia-text-input__input': true,\n 'telia-text-input__input--touched': this.touched,\n 'telia-text-input__input--icon-shown': showValidIcon,\n }, placeholder: this.placeholder, type: this.type, id: this.inputId, \"aria-describedby\": describedBy, minlength: this.minlength, maxlength: this.maxlength, disabled: this.disabled, readonly: this.readonly, value: this.value, name: this.name, onChange: event => {\n /** valueChange is deprecated, will be removed in the future releases. */\n this.valueChange.emit(event);\n }, onInput: () => {\n this.dirty = true;\n this.updateInputValue();\n this.updateErrorState();\n }, inputmode: this.inputmode, list: this.list, autocomplete: this.autocomplete, required: this.required, onBlur: () => {\n this.touched = true;\n this.updateErrorState();\n }, ref: ref => (this.inputElement = ref), pattern: this.pattern, onInvalid: event => {\n event.preventDefault();\n this.touched = true;\n this.updateErrorState();\n }, form: this.htmlForm }), showValidIcon && (h(\"div\", { class: \"telia-text-input__valid-icon-container\" }, h(\"telia-field-valid\", { class: \"telia-text-input__valid-icon\" }))), h(\"telia-label\", { class: \"telia-text-input__label\", htmlFor: this.inputId }, this.required && h(\"span\", { \"aria-hidden\": \"true\" }, '* '), this.label), showAdditional && (h(\"telia-field-assistive-text\", { class: \"telia-text-input__additional\", id: this.additionalId }, this.additional)), showError && (h(\"telia-field-error\", { id: this.errorId, class: \"telia-text-input__error\" }, this.errorMessageState)), h(\"telia-vst\", { dataTrackingId: this.dataTrackingId })));\n }\n static get watchers() { return {\n \"value\": [\"componentValueChanged\"]\n }; }\n static get style() { return teliaTextInputCss; }\n}, [0, \"telia-text-input\", {\n \"dataTestid\": [1, \"data-testid\"],\n \"htmlForm\": [1, \"html-form\"],\n \"type\": [1],\n \"label\": [1],\n \"value\": [1],\n \"placeholder\": [1],\n \"name\": [1],\n \"additional\": [1],\n \"additionalId\": [1, \"additional-id\"],\n \"inputId\": [1, \"input-id\"],\n \"errorId\": [1, \"error-id\"],\n \"disabled\": [4],\n \"minlength\": [2],\n \"maxlength\": [2],\n \"readonly\": [4],\n \"inputmode\": [1],\n \"list\": [1],\n \"autocomplete\": [1],\n \"required\": [4],\n \"requiredErrorMessage\": [1, \"required-error-message\"],\n \"emailErrorMessage\": [1, \"email-error-message\"],\n \"minlengthErrorMessage\": [1, \"minlength-error-message\"],\n \"showValidIcon\": [4, \"show-valid-icon\"],\n \"pattern\": [1],\n \"patternErrorMessage\": [1, \"pattern-error-message\"],\n \"errorMessage\": [1, \"error-message\"],\n \"touched\": [32],\n \"dirty\": [32],\n \"inputValue\": [32],\n \"errorMessageState\": [32],\n \"focusInput\": [64]\n }]);\nfunction defineCustomElement() {\n if (typeof customElements === \"undefined\") {\n return;\n }\n const components = [\"telia-text-input\", \"telia-field-assistive-text\", \"telia-field-error\", \"telia-field-valid\", \"telia-icon\", \"telia-label\", \"telia-vst\"];\n components.forEach(tagName => { switch (tagName) {\n case \"telia-text-input\":\n if (!customElements.get(tagName)) {\n customElements.define(tagName, TeliaTextInput);\n }\n break;\n case \"telia-field-assistive-text\":\n if (!customElements.get(tagName)) {\n defineCustomElement$6();\n }\n break;\n case \"telia-field-error\":\n if (!customElements.get(tagName)) {\n defineCustomElement$5();\n }\n break;\n case \"telia-field-valid\":\n if (!customElements.get(tagName)) {\n defineCustomElement$4();\n }\n break;\n case \"telia-icon\":\n if (!customElements.get(tagName)) {\n defineCustomElement$3();\n }\n break;\n case \"telia-label\":\n if (!customElements.get(tagName)) {\n defineCustomElement$2();\n }\n break;\n case \"telia-vst\":\n if (!customElements.get(tagName)) {\n defineCustomElement$1();\n }\n break;\n } });\n}\ndefineCustomElement();\n\nexport { TeliaTextInput as T, defineCustomElement as d };\n"],"names":["TextFieldTypes","teliaTextInputCss","TeliaTextInput","proxyCustomElement","HTMLElement","createEvent","uniqueId","_a","message","_b","errorMessageIsSet","requiredInUse","patternInUse","minlengthInUse","generalErrorInUse","emailErrorInUse","_c","value","showError","showAdditional","describedBy","stringCombiner","showValidIcon","h","event","ref","defineCustomElement","tagName","defineCustomElement$6","defineCustomElement$5","defineCustomElement$4","defineCustomElement$3","defineCustomElement$2","defineCustomElement$1"],"mappings":";;;;;;;;;;;;AAYA,MAAMA,IAAiB;AAAA,EACrB,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,KAAK;AAAA,EACL,QAAQ;AAAA,EACR,UAAU;AACZ,GAEMC,IAAoB,0kIAEpBC,IAA+B,gBAAAC,EAAmB,cAAcC,EAAY;AAAA,EAChF,cAAc;AACZ,aACA,KAAK,eAAc,GACnB,KAAK,cAAcC,EAAY,MAAM,eAAe,CAAC,GAErD,KAAK,OAAOL,EAAe,MAE3B,KAAK,QAAQ,IAEb,KAAK,eAAeM,EAAS,YAAY,GAEzC,KAAK,UAAUA,EAAS,OAAO,GAE/B,KAAK,UAAUA,EAAS,OAAO,GAE/B,KAAK,WAAW,IAEhB,KAAK,WAAW,IAEhB,KAAK,WAAW,IAEhB,KAAK,gBAAgB,IAErB,KAAK,iBAAiB,oBAItB,KAAK,UAAU,IAIf,KAAK,QAAQ,IAIb,KAAK,aAAa,IAIlB,KAAK,oBAAoB,IACzB,KAAK,mBAAmB,MAAM;AAE5B,WAAK,aAAa,KAAK,eAAe,KAAK,aAAa,QAAQ,KAAK;AAAA,IAC3E,GAKI,KAAK,sBAAsB,MACrB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