@everymatrix/general-input 1.80.9 → 1.80.11
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.
- package/dist/cjs/{checkbox-group-input_13.cjs.entry.js → checkbox-group-input_14.cjs.entry.js} +422 -19
- package/dist/cjs/general-input.cjs.js +1 -1
- package/dist/cjs/index-3b546c2c.js +2 -2
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/general-input/general-input.js +64 -4
- package/dist/collection/components/postalcode-input/postalcode-input.css +221 -0
- package/dist/collection/components/postalcode-input/postalcode-input.js +673 -0
- package/dist/collection/components/radio-input/radio-input.js +2 -2
- package/dist/collection/components/select-input/select-input.js +3 -3
- package/dist/collection/components/tel-input/tel-input.js +2 -2
- package/dist/collection/components/text-input/text-input.css +17 -0
- package/dist/collection/components/text-input/text-input.js +79 -6
- package/dist/collection/components/toggle-checkbox-input/toggle-checkbox-input.js +2 -2
- package/dist/collection/components/twofa-input/twofa-input.js +2 -2
- package/dist/collection/utils/locale.utils.js +3 -0
- package/dist/esm/{checkbox-group-input_13.entry.js → checkbox-group-input_14.entry.js} +422 -20
- package/dist/esm/general-input.js +1 -1
- package/dist/esm/index-ca174b7a.js +2 -2
- package/dist/esm/loader.js +1 -1
- package/dist/general-input/{checkbox-group-input_13.entry.js → checkbox-group-input_14.entry.js} +165 -165
- package/dist/general-input/general-input.esm.js +1 -1
- package/dist/types/components/general-input/general-input.d.ts +18 -2
- package/dist/types/components/postalcode-input/postalcode-input.d.ts +111 -0
- package/dist/types/components/text-input/text-input.d.ts +12 -0
- package/dist/types/components.d.ts +165 -4
- package/package.json +1 -1
|
@@ -0,0 +1,673 @@
|
|
|
1
|
+
import { h } from "@stencil/core";
|
|
2
|
+
import { translate } from "../../utils/locale.utils";
|
|
3
|
+
import tooltipIcon from "../../utils/tooltipIcon.svg";
|
|
4
|
+
export class PostalCodeInput {
|
|
5
|
+
constructor() {
|
|
6
|
+
this.value = '';
|
|
7
|
+
this.validationPattern = '';
|
|
8
|
+
this.hasManualAddressBeenTriggered = false;
|
|
9
|
+
this.touched = false;
|
|
10
|
+
this.maxPostalCodeLength = '10';
|
|
11
|
+
this.handleInput = (event) => {
|
|
12
|
+
const inputValue = event.target.value;
|
|
13
|
+
const upperCaseValue = inputValue.toUpperCase();
|
|
14
|
+
this.value = upperCaseValue;
|
|
15
|
+
this.touched = true;
|
|
16
|
+
this.currentPostalCode = upperCaseValue;
|
|
17
|
+
this.showNoResultsMessage = false;
|
|
18
|
+
if (this.inputReference) {
|
|
19
|
+
this.inputReference.value = upperCaseValue;
|
|
20
|
+
}
|
|
21
|
+
if (this.value.length < this.postalcodelength) {
|
|
22
|
+
this.openAddressDropdown = false;
|
|
23
|
+
this.isFetchingAddresses = false;
|
|
24
|
+
}
|
|
25
|
+
if (this.value === '' || this.value.length < 1) {
|
|
26
|
+
this.openAddressDropdown = false;
|
|
27
|
+
this.isFetchingAddresses = false;
|
|
28
|
+
}
|
|
29
|
+
if (this.debounceTime) {
|
|
30
|
+
clearTimeout(this.debounceTime);
|
|
31
|
+
}
|
|
32
|
+
this.debounceTime = setTimeout(() => {
|
|
33
|
+
// Trigger address lookup when postal code reaches minimum length
|
|
34
|
+
if (this.value.length >= this.postalcodelength) {
|
|
35
|
+
sessionStorage.setItem('currentPostalCode', this.value);
|
|
36
|
+
this.showNoResultsMessage = false;
|
|
37
|
+
if (this.addresses && this.addresses.length > 0) {
|
|
38
|
+
this.openAddressDropdown = true;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
// Validate input and update error state
|
|
42
|
+
const wasValid = this.isValid;
|
|
43
|
+
this.isValid = this.setValidity();
|
|
44
|
+
this.errorMessage = this.setErrorMessage();
|
|
45
|
+
// Emit validity state if changed
|
|
46
|
+
if (wasValid !== this.isValid) {
|
|
47
|
+
this.validityStateHandler({ valid: this.isValid, name: this.name });
|
|
48
|
+
}
|
|
49
|
+
this.emitValueHandler(true);
|
|
50
|
+
}, 300);
|
|
51
|
+
};
|
|
52
|
+
this.handleBlur = (event) => {
|
|
53
|
+
this.value = event.target.value;
|
|
54
|
+
this.touched = true;
|
|
55
|
+
this.isValid = this.setValidity();
|
|
56
|
+
this.errorMessage = this.setErrorMessage();
|
|
57
|
+
this.validityStateHandler({ valid: this.isValid, name: this.name });
|
|
58
|
+
this.showNoResultsMessage = false;
|
|
59
|
+
// hide 'no addresses found' msg
|
|
60
|
+
if (!this.openAddressDropdown) {
|
|
61
|
+
this.showNoResultsMessage = false;
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
this.handleFocus = () => {
|
|
65
|
+
const hasSearchTerm = this.currentPostalCode && this.currentPostalCode.length >= this.postalcodelength;
|
|
66
|
+
if (hasSearchTerm) {
|
|
67
|
+
this.openAddressDropdown = true;
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
this.handlePostalCode = (e, data) => {
|
|
71
|
+
e.stopPropagation();
|
|
72
|
+
const address1 = `${data.street}`.trim();
|
|
73
|
+
const address2 = `${data.number}`.trim();
|
|
74
|
+
const city = `${data.city}`.trim();
|
|
75
|
+
this.sendAddressValue.emit({ city, address1, address2 });
|
|
76
|
+
this.value = this.currentPostalCode.toLocaleUpperCase();
|
|
77
|
+
this.touched = true;
|
|
78
|
+
this.isValid = true;
|
|
79
|
+
this.openAddressDropdown = false;
|
|
80
|
+
this.showNoResultsMessage = false;
|
|
81
|
+
this.isFetchingAddresses = false;
|
|
82
|
+
this.valueHandler({ name: this.name, value: this.value });
|
|
83
|
+
this.validityStateHandler({ valid: true, name: this.name });
|
|
84
|
+
this.valueHandler({ name: 'address1', value: address1 });
|
|
85
|
+
this.valueHandler({ name: 'City', value: city });
|
|
86
|
+
if (address2) {
|
|
87
|
+
this.valueHandler({ name: 'address2', value: address2 });
|
|
88
|
+
}
|
|
89
|
+
this.refreshTrigger++;
|
|
90
|
+
};
|
|
91
|
+
this.enterAddressManually = () => {
|
|
92
|
+
const refs = window.targetInputRefs;
|
|
93
|
+
if (!refs)
|
|
94
|
+
return;
|
|
95
|
+
// Define all address fields that need to be filled manually
|
|
96
|
+
const allFields = [
|
|
97
|
+
{ name: 'PostalCode', ref: refs['PostalCode'], minLength: this.postalcodelength },
|
|
98
|
+
{ name: 'address1', ref: refs['address1'] },
|
|
99
|
+
{ name: 'address2', ref: refs['address2'] },
|
|
100
|
+
{ name: 'City', ref: refs['City'] }
|
|
101
|
+
];
|
|
102
|
+
// Required fields for address validation
|
|
103
|
+
const requiredFields = [
|
|
104
|
+
{ name: 'PostalCode', ref: refs['PostalCode'], minLength: this.postalcodelength },
|
|
105
|
+
{ name: 'address1', ref: refs['address1'] },
|
|
106
|
+
{ name: 'City', ref: refs['City'] }
|
|
107
|
+
];
|
|
108
|
+
// find the first required field that is empty or incomplete
|
|
109
|
+
const targetField = requiredFields.find(field => {
|
|
110
|
+
var _a;
|
|
111
|
+
const value = ((_a = field.ref) === null || _a === void 0 ? void 0 : _a.value) || '';
|
|
112
|
+
return field.minLength ? (value.length === 0 || value.length < field.minLength) : value.length === 0;
|
|
113
|
+
});
|
|
114
|
+
const targetInput = (targetField === null || targetField === void 0 ? void 0 : targetField.ref) || refs['address1'] || refs['PostalCode'];
|
|
115
|
+
targetInput.scrollIntoView({ behavior: 'smooth', block: 'center' });
|
|
116
|
+
if (!this.hasManualAddressBeenTriggered) {
|
|
117
|
+
this.hasManualAddressBeenTriggered = true;
|
|
118
|
+
allFields.forEach(field => {
|
|
119
|
+
var _a;
|
|
120
|
+
if (field.ref) {
|
|
121
|
+
const inputElement = ((_a = field.ref.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('input')) || field.ref;
|
|
122
|
+
if (inputElement) {
|
|
123
|
+
inputElement.classList.add('pulse-border');
|
|
124
|
+
// remove animation when it ends
|
|
125
|
+
const handleAnimationEnd = () => {
|
|
126
|
+
inputElement.classList.remove('pulse-border');
|
|
127
|
+
inputElement.removeEventListener('animationend', handleAnimationEnd);
|
|
128
|
+
};
|
|
129
|
+
inputElement.addEventListener('animationend', handleAnimationEnd);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
targetInput.focus();
|
|
134
|
+
}
|
|
135
|
+
else {
|
|
136
|
+
targetInput.focus();
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
this.setClientStyling = () => {
|
|
140
|
+
let sheet = document.createElement('style');
|
|
141
|
+
sheet.innerHTML = this.clientStyling;
|
|
142
|
+
this.stylingContainer.prepend(sheet);
|
|
143
|
+
};
|
|
144
|
+
this.handleOutsideClick = (event) => {
|
|
145
|
+
if (!this.openAddressDropdown)
|
|
146
|
+
return;
|
|
147
|
+
const path = event.composedPath ? event.composedPath() : [];
|
|
148
|
+
const isInputClick = path.includes(this.inputReference);
|
|
149
|
+
const isDropdownClick = path.includes(this.addressesDropdownRef);
|
|
150
|
+
const isOptionClick = path.some(el => { var _a; return el instanceof Element && ((_a = el.classList) === null || _a === void 0 ? void 0 : _a.contains('option')); });
|
|
151
|
+
if (!isInputClick && !isDropdownClick && !isOptionClick) {
|
|
152
|
+
this.openAddressDropdown = false;
|
|
153
|
+
this.showNoResultsMessage = false;
|
|
154
|
+
}
|
|
155
|
+
};
|
|
156
|
+
this.name = 'PostalCode';
|
|
157
|
+
this.displayName = undefined;
|
|
158
|
+
this.placeholder = undefined;
|
|
159
|
+
this.validation = undefined;
|
|
160
|
+
this.defaultValue = '';
|
|
161
|
+
this.autofilled = undefined;
|
|
162
|
+
this.tooltip = undefined;
|
|
163
|
+
this.language = undefined;
|
|
164
|
+
this.emitValue = undefined;
|
|
165
|
+
this.clientStyling = '';
|
|
166
|
+
this.postalcodelength = undefined;
|
|
167
|
+
this.addresses = undefined;
|
|
168
|
+
this.isValid = undefined;
|
|
169
|
+
this.errorMessage = '';
|
|
170
|
+
this.limitStylingAppends = false;
|
|
171
|
+
this.showTooltip = false;
|
|
172
|
+
this.selectedCountryCode = '';
|
|
173
|
+
this.currentPostalCode = '';
|
|
174
|
+
this.openAddressDropdown = false;
|
|
175
|
+
this.showNoResultsMessage = false;
|
|
176
|
+
this.refreshTrigger = 0;
|
|
177
|
+
this.isFetchingAddresses = false;
|
|
178
|
+
}
|
|
179
|
+
handleStylingChange(newValue, oldValue) {
|
|
180
|
+
if (newValue !== oldValue)
|
|
181
|
+
this.setClientStyling();
|
|
182
|
+
}
|
|
183
|
+
validityChanged() {
|
|
184
|
+
this.validityStateHandler({ valid: this.isValid, name: this.name });
|
|
185
|
+
if (this.emitValue == true) {
|
|
186
|
+
this.valueHandler({ name: this.name, value: this.value });
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
emitValueHandler(newValue) {
|
|
190
|
+
if (newValue == true && this.isValid) {
|
|
191
|
+
this.valueHandler({ name: this.name, value: this.value });
|
|
192
|
+
}
|
|
193
|
+
if (newValue === true && !this.value.length) {
|
|
194
|
+
this.valueHandler({ name: this.name, value: this.value });
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
handleAddresses(newValue) {
|
|
198
|
+
if (newValue && newValue.length > 0) {
|
|
199
|
+
this.openAddressDropdown = true;
|
|
200
|
+
this.showNoResultsMessage = false;
|
|
201
|
+
}
|
|
202
|
+
else {
|
|
203
|
+
this.openAddressDropdown = false;
|
|
204
|
+
if (this.isFetchingAddresses && this.currentPostalCode.length >= this.postalcodelength) {
|
|
205
|
+
setTimeout(() => {
|
|
206
|
+
if (this.currentPostalCode.length >= this.postalcodelength && !this.isFetchingAddresses) {
|
|
207
|
+
this.showNoResultsMessage = true;
|
|
208
|
+
}
|
|
209
|
+
}, 200);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
this.isFetchingAddresses = false;
|
|
213
|
+
}
|
|
214
|
+
validityStateHandler(inputStateEvent) {
|
|
215
|
+
this.sendValidityState.emit(inputStateEvent);
|
|
216
|
+
}
|
|
217
|
+
valueHandler(inputValueEvent) {
|
|
218
|
+
this.sendInputValue.emit(inputValueEvent);
|
|
219
|
+
}
|
|
220
|
+
handleClickOutside(event) {
|
|
221
|
+
const path = event.composedPath();
|
|
222
|
+
if (!path.includes(this.tooltipIconReference) && !path.includes(this.tooltipReference)) {
|
|
223
|
+
this.showTooltip = false;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
handleCountryCodeUpdate(event) {
|
|
227
|
+
const { name, value } = event.detail;
|
|
228
|
+
this.selectedCountryCode = value;
|
|
229
|
+
if (name === 'CountryCode') {
|
|
230
|
+
this.resetPostalCodeField();
|
|
231
|
+
this.refreshTrigger++;
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
handleFetchStarted() {
|
|
235
|
+
this.showNoResultsMessage = false;
|
|
236
|
+
this.isFetchingAddresses = true;
|
|
237
|
+
this.openAddressDropdown = false;
|
|
238
|
+
}
|
|
239
|
+
connectedCallback() {
|
|
240
|
+
this.validationPattern = this.setPattern();
|
|
241
|
+
}
|
|
242
|
+
componentDidRender() {
|
|
243
|
+
if (!this.limitStylingAppends && this.stylingContainer) {
|
|
244
|
+
if (this.clientStyling)
|
|
245
|
+
this.setClientStyling();
|
|
246
|
+
this.limitStylingAppends = true;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
componentDidLoad() {
|
|
250
|
+
if (this.defaultValue) {
|
|
251
|
+
this.value = this.defaultValue;
|
|
252
|
+
this.valueHandler({ name: this.name, value: this.value });
|
|
253
|
+
}
|
|
254
|
+
if (this.inputReference) {
|
|
255
|
+
window.targetInputRefs = window.targetInputRefs || {};
|
|
256
|
+
window.targetInputRefs[this.name] = this.inputReference;
|
|
257
|
+
}
|
|
258
|
+
this.isValid = this.setValidity();
|
|
259
|
+
document.addEventListener('click', this.handleOutsideClick);
|
|
260
|
+
}
|
|
261
|
+
disconnectedCallback() {
|
|
262
|
+
document.removeEventListener('click', this.handleOutsideClick);
|
|
263
|
+
}
|
|
264
|
+
setValidity() {
|
|
265
|
+
if (!this.inputReference) {
|
|
266
|
+
return false;
|
|
267
|
+
}
|
|
268
|
+
const inputIsValid = this.inputReference.validity.valid;
|
|
269
|
+
const inputMatchValidation = !this.inputReference.value || this.inputReference.value.match(this.validationPattern) !== null;
|
|
270
|
+
return inputIsValid && inputMatchValidation;
|
|
271
|
+
}
|
|
272
|
+
setPattern() {
|
|
273
|
+
var _a, _b;
|
|
274
|
+
if (((_a = this.validation.custom) === null || _a === void 0 ? void 0 : _a.length) > 0) {
|
|
275
|
+
return (_b = this.validation.custom.find(customValidation => customValidation.rule === 'regex')) === null || _b === void 0 ? void 0 : _b.pattern;
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
setErrorMessage() {
|
|
279
|
+
var _a, _b;
|
|
280
|
+
if (!this.touched) {
|
|
281
|
+
return '';
|
|
282
|
+
}
|
|
283
|
+
if (this.inputReference.validity.valueMissing) {
|
|
284
|
+
return translate('requiredError', this.language);
|
|
285
|
+
}
|
|
286
|
+
if (this.inputReference.validity.tooShort || this.inputReference.validity.tooLong) {
|
|
287
|
+
return translate('lengthError', this.language, { values: { minLength: this.validation.minLength, maxLength: this.validation.maxLength } });
|
|
288
|
+
}
|
|
289
|
+
if (this.inputReference.value.match(this.validationPattern) == null) {
|
|
290
|
+
const errorCode = (_a = this.validation.custom.find(customValidation => customValidation.rule === 'regex')) === null || _a === void 0 ? void 0 : _a.errorKey;
|
|
291
|
+
const errorMessage = (_b = this.validation.custom.find(customValidation => customValidation.rule === 'regex')) === null || _b === void 0 ? void 0 : _b.errorMessage;
|
|
292
|
+
return translate(`${errorCode}`, this.language) || errorMessage;
|
|
293
|
+
}
|
|
294
|
+
return '';
|
|
295
|
+
}
|
|
296
|
+
resetPostalCodeField() {
|
|
297
|
+
this.value = '';
|
|
298
|
+
this.currentPostalCode = '';
|
|
299
|
+
this.showNoResultsMessage = false;
|
|
300
|
+
this.openAddressDropdown = false;
|
|
301
|
+
this.isFetchingAddresses = false;
|
|
302
|
+
sessionStorage.removeItem('currentPostalCode');
|
|
303
|
+
if (this.inputReference) {
|
|
304
|
+
this.inputReference.value = '';
|
|
305
|
+
}
|
|
306
|
+
this.valueHandler({ name: this.name, value: '' });
|
|
307
|
+
this.validityStateHandler({ valid: false, name: this.name });
|
|
308
|
+
}
|
|
309
|
+
renderTooltip() {
|
|
310
|
+
if (this.showTooltip) {
|
|
311
|
+
return (h("div", { class: `text__tooltip ${this.showTooltip ? 'visible' : ''}`, ref: (el) => this.tooltipReference = el, innerHTML: this.tooltip }));
|
|
312
|
+
}
|
|
313
|
+
return null;
|
|
314
|
+
}
|
|
315
|
+
determineInputValue() {
|
|
316
|
+
// Store address input refs for manual entry function
|
|
317
|
+
if (this.inputReference && this.name) {
|
|
318
|
+
window.targetInputRefs = window.targetInputRefs || {};
|
|
319
|
+
window.targetInputRefs[this.name] = this.inputReference;
|
|
320
|
+
}
|
|
321
|
+
return this.value || this.currentPostalCode || sessionStorage.getItem('currentPostalCode') || this.defaultValue;
|
|
322
|
+
}
|
|
323
|
+
render() {
|
|
324
|
+
var _a, _b;
|
|
325
|
+
let invalidClass = '';
|
|
326
|
+
if (this.touched) {
|
|
327
|
+
invalidClass = this.isValid == true || this.isValid == undefined ? '' : 'text__input--invalid';
|
|
328
|
+
}
|
|
329
|
+
let isUKCountry = this.selectedCountryCode === 'UK' || this.selectedCountryCode === 'GB';
|
|
330
|
+
let showAddressesDropdown = ((_a = this.addresses) === null || _a === void 0 ? void 0 : _a.length) > 0 && this.openAddressDropdown && isUKCountry;
|
|
331
|
+
let shouldShowNoResults = this.showNoResultsMessage && this.currentPostalCode &&
|
|
332
|
+
this.currentPostalCode.length >= this.postalcodelength && (((_b = this.addresses) === null || _b === void 0 ? void 0 : _b.length) === 0) && isUKCountry;
|
|
333
|
+
let showLoadingMessage = this.isFetchingAddresses && this.currentPostalCode.length >= this.postalcodelength;
|
|
334
|
+
return (h("div", { key: '9618edb268c4c1cffa450bb3dbd778ab5197e6f3', class: `text__wrapper ${this.name}__input ${this.autofilled ? 'text__wrapper--autofilled' : ''}`, ref: el => this.stylingContainer = el }, h("div", { key: '932d83f8895024ba1d7490e01505b651625def00', class: 'text__wrapper--flex' }, h("label", { key: '0c2281a6670fda698469815be19d0e99b18dbe65', class: `text__label ${this.validation.mandatory ? 'text__label--required' : ''}`, htmlFor: `${this.name}__input` }, this.displayName), h("div", { key: '70eacd1179b9b9dc0def1cd18fab22bd090999b0', class: 'text__wrapper--relative' }, this.tooltip && (h("img", { key: '1237da82659dc9558020b0675a1a645c500f77de', class: 'text__tooltip-icon', src: tooltipIcon, alt: "", ref: (el) => this.tooltipIconReference = el, onClick: () => this.showTooltip = !this.showTooltip })), this.renderTooltip())), h("div", { key: '65db0837d507b90217802e6f6d08800ae91404c6', class: 'input__text-wrapper' }, h("input", { key: '4c05c552d1d1dfe70fb872d44c0f2bc3f4c62c31', name: this.name, id: `${this.name}__input`, value: this.determineInputValue(), type: 'text', class: `text__input ${invalidClass}`, placeholder: `${this.placeholder}`, ref: (el) => this.inputReference = el, readOnly: this.autofilled, required: this.validation.mandatory, minlength: this.validation.minLength, maxlength: this.maxPostalCodeLength, onInput: this.handleInput, onBlur: this.handleBlur, onFocus: this.handleFocus }), !isUKCountry && (h("p", { key: 'c0f93584fa3f970a27793178517807968a03d252', class: "address__manual-input-msg", onClick: () => this.enterAddressManually() }, translate('enterIEAddressManually', this.language))), showAddressesDropdown && (h("div", { key: '2f24716dbc7b5ed8f70f0f61a787c97fa75d3fba', class: "input__addresses-container", ref: (el) => (this.addressesDropdownRef = el) }, h("div", { key: '63b89521d94589aeb082f2ee98f31c0508c3b070', class: "options" }, this.addresses.map((addr, index) => (h("div", { key: index, class: "option", onClick: (e) => this.handlePostalCode(e, addr) }, addr.street, " ", addr.number, " ", addr.city)))))), showLoadingMessage && (h("div", { key: 'd1f3deaf9936e00ff05ac37d635a3dadb11a0db8', class: "postalcode__loading-spinner" }, h("div", { key: 'ee7c1a5275b8e5824a9e3ffbd39d1476ced9d0a1', class: "loading-spinner" }), h("span", { key: '198c01371a98fa07d35ff64fad5714176ffdcb0d' }, translate('searchingForAddresses', this.language)))), shouldShowNoResults && (h("div", { key: 'e4f098805673d2708bb3fe2ff6dccc61308fc27a', class: "postalcode__no-results-message" }, translate('postalLookUpNoAddressFound', this.language)))), h("small", { key: 'e84296325688a134e49f521ecfa1ff44ed13fcc9', class: 'text__error-message' }, this.errorMessage)));
|
|
335
|
+
}
|
|
336
|
+
static get is() { return "postalcode-input"; }
|
|
337
|
+
static get encapsulation() { return "shadow"; }
|
|
338
|
+
static get originalStyleUrls() {
|
|
339
|
+
return {
|
|
340
|
+
"$": ["postalcode-input.scss"]
|
|
341
|
+
};
|
|
342
|
+
}
|
|
343
|
+
static get styleUrls() {
|
|
344
|
+
return {
|
|
345
|
+
"$": ["postalcode-input.css"]
|
|
346
|
+
};
|
|
347
|
+
}
|
|
348
|
+
static get properties() {
|
|
349
|
+
return {
|
|
350
|
+
"name": {
|
|
351
|
+
"type": "string",
|
|
352
|
+
"mutable": false,
|
|
353
|
+
"complexType": {
|
|
354
|
+
"original": "string",
|
|
355
|
+
"resolved": "string",
|
|
356
|
+
"references": {}
|
|
357
|
+
},
|
|
358
|
+
"required": false,
|
|
359
|
+
"optional": false,
|
|
360
|
+
"docs": {
|
|
361
|
+
"tags": [],
|
|
362
|
+
"text": "Name of the input."
|
|
363
|
+
},
|
|
364
|
+
"attribute": "name",
|
|
365
|
+
"reflect": true,
|
|
366
|
+
"defaultValue": "'PostalCode'"
|
|
367
|
+
},
|
|
368
|
+
"displayName": {
|
|
369
|
+
"type": "string",
|
|
370
|
+
"mutable": false,
|
|
371
|
+
"complexType": {
|
|
372
|
+
"original": "string",
|
|
373
|
+
"resolved": "string",
|
|
374
|
+
"references": {}
|
|
375
|
+
},
|
|
376
|
+
"required": false,
|
|
377
|
+
"optional": false,
|
|
378
|
+
"docs": {
|
|
379
|
+
"tags": [],
|
|
380
|
+
"text": "Name of input to be shown to the user."
|
|
381
|
+
},
|
|
382
|
+
"attribute": "display-name",
|
|
383
|
+
"reflect": true
|
|
384
|
+
},
|
|
385
|
+
"placeholder": {
|
|
386
|
+
"type": "string",
|
|
387
|
+
"mutable": false,
|
|
388
|
+
"complexType": {
|
|
389
|
+
"original": "string",
|
|
390
|
+
"resolved": "string",
|
|
391
|
+
"references": {}
|
|
392
|
+
},
|
|
393
|
+
"required": false,
|
|
394
|
+
"optional": false,
|
|
395
|
+
"docs": {
|
|
396
|
+
"tags": [],
|
|
397
|
+
"text": "Placeholder text to be shown."
|
|
398
|
+
},
|
|
399
|
+
"attribute": "placeholder",
|
|
400
|
+
"reflect": true
|
|
401
|
+
},
|
|
402
|
+
"validation": {
|
|
403
|
+
"type": "unknown",
|
|
404
|
+
"mutable": false,
|
|
405
|
+
"complexType": {
|
|
406
|
+
"original": "ValidationSchema",
|
|
407
|
+
"resolved": "ValidationSchema",
|
|
408
|
+
"references": {
|
|
409
|
+
"ValidationSchema": {
|
|
410
|
+
"location": "import",
|
|
411
|
+
"path": "../../utils/types",
|
|
412
|
+
"id": "../../../../packages/stencil/general-input/src/utils/types.ts::ValidationSchema"
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
},
|
|
416
|
+
"required": false,
|
|
417
|
+
"optional": false,
|
|
418
|
+
"docs": {
|
|
419
|
+
"tags": [],
|
|
420
|
+
"text": "Object of validation rules for the input."
|
|
421
|
+
}
|
|
422
|
+
},
|
|
423
|
+
"defaultValue": {
|
|
424
|
+
"type": "string",
|
|
425
|
+
"mutable": false,
|
|
426
|
+
"complexType": {
|
|
427
|
+
"original": "string",
|
|
428
|
+
"resolved": "string",
|
|
429
|
+
"references": {}
|
|
430
|
+
},
|
|
431
|
+
"required": false,
|
|
432
|
+
"optional": false,
|
|
433
|
+
"docs": {
|
|
434
|
+
"tags": [],
|
|
435
|
+
"text": "Default value for the input."
|
|
436
|
+
},
|
|
437
|
+
"attribute": "default-value",
|
|
438
|
+
"reflect": true,
|
|
439
|
+
"defaultValue": "''"
|
|
440
|
+
},
|
|
441
|
+
"autofilled": {
|
|
442
|
+
"type": "boolean",
|
|
443
|
+
"mutable": false,
|
|
444
|
+
"complexType": {
|
|
445
|
+
"original": "boolean",
|
|
446
|
+
"resolved": "boolean",
|
|
447
|
+
"references": {}
|
|
448
|
+
},
|
|
449
|
+
"required": false,
|
|
450
|
+
"optional": false,
|
|
451
|
+
"docs": {
|
|
452
|
+
"tags": [],
|
|
453
|
+
"text": "Boolean. Determines if input should be readonly."
|
|
454
|
+
},
|
|
455
|
+
"attribute": "autofilled",
|
|
456
|
+
"reflect": true
|
|
457
|
+
},
|
|
458
|
+
"tooltip": {
|
|
459
|
+
"type": "string",
|
|
460
|
+
"mutable": false,
|
|
461
|
+
"complexType": {
|
|
462
|
+
"original": "string",
|
|
463
|
+
"resolved": "string",
|
|
464
|
+
"references": {}
|
|
465
|
+
},
|
|
466
|
+
"required": false,
|
|
467
|
+
"optional": false,
|
|
468
|
+
"docs": {
|
|
469
|
+
"tags": [],
|
|
470
|
+
"text": "Tooltip text."
|
|
471
|
+
},
|
|
472
|
+
"attribute": "tooltip",
|
|
473
|
+
"reflect": true
|
|
474
|
+
},
|
|
475
|
+
"language": {
|
|
476
|
+
"type": "string",
|
|
477
|
+
"mutable": false,
|
|
478
|
+
"complexType": {
|
|
479
|
+
"original": "string",
|
|
480
|
+
"resolved": "string",
|
|
481
|
+
"references": {}
|
|
482
|
+
},
|
|
483
|
+
"required": false,
|
|
484
|
+
"optional": false,
|
|
485
|
+
"docs": {
|
|
486
|
+
"tags": [],
|
|
487
|
+
"text": "Currently selected language."
|
|
488
|
+
},
|
|
489
|
+
"attribute": "language",
|
|
490
|
+
"reflect": true
|
|
491
|
+
},
|
|
492
|
+
"emitValue": {
|
|
493
|
+
"type": "boolean",
|
|
494
|
+
"mutable": false,
|
|
495
|
+
"complexType": {
|
|
496
|
+
"original": "boolean",
|
|
497
|
+
"resolved": "boolean",
|
|
498
|
+
"references": {}
|
|
499
|
+
},
|
|
500
|
+
"required": false,
|
|
501
|
+
"optional": false,
|
|
502
|
+
"docs": {
|
|
503
|
+
"tags": [],
|
|
504
|
+
"text": "State passed down from the parent element. Will trigger the input to send it's value through an event."
|
|
505
|
+
},
|
|
506
|
+
"attribute": "emit-value",
|
|
507
|
+
"reflect": true
|
|
508
|
+
},
|
|
509
|
+
"clientStyling": {
|
|
510
|
+
"type": "string",
|
|
511
|
+
"mutable": false,
|
|
512
|
+
"complexType": {
|
|
513
|
+
"original": "string",
|
|
514
|
+
"resolved": "string",
|
|
515
|
+
"references": {}
|
|
516
|
+
},
|
|
517
|
+
"required": false,
|
|
518
|
+
"optional": false,
|
|
519
|
+
"docs": {
|
|
520
|
+
"tags": [],
|
|
521
|
+
"text": "Client custom styling via inline style"
|
|
522
|
+
},
|
|
523
|
+
"attribute": "client-styling",
|
|
524
|
+
"reflect": true,
|
|
525
|
+
"defaultValue": "''"
|
|
526
|
+
},
|
|
527
|
+
"postalcodelength": {
|
|
528
|
+
"type": "any",
|
|
529
|
+
"mutable": false,
|
|
530
|
+
"complexType": {
|
|
531
|
+
"original": "any",
|
|
532
|
+
"resolved": "any",
|
|
533
|
+
"references": {}
|
|
534
|
+
},
|
|
535
|
+
"required": false,
|
|
536
|
+
"optional": false,
|
|
537
|
+
"docs": {
|
|
538
|
+
"tags": [],
|
|
539
|
+
"text": "The minimum length for postal code to trigger the postal lookup"
|
|
540
|
+
},
|
|
541
|
+
"attribute": "postalcodelength",
|
|
542
|
+
"reflect": true
|
|
543
|
+
},
|
|
544
|
+
"addresses": {
|
|
545
|
+
"type": "any",
|
|
546
|
+
"mutable": false,
|
|
547
|
+
"complexType": {
|
|
548
|
+
"original": "any",
|
|
549
|
+
"resolved": "any",
|
|
550
|
+
"references": {}
|
|
551
|
+
},
|
|
552
|
+
"required": false,
|
|
553
|
+
"optional": false,
|
|
554
|
+
"docs": {
|
|
555
|
+
"tags": [],
|
|
556
|
+
"text": "Addresses fetched based on the postal code"
|
|
557
|
+
},
|
|
558
|
+
"attribute": "addresses",
|
|
559
|
+
"reflect": true
|
|
560
|
+
}
|
|
561
|
+
};
|
|
562
|
+
}
|
|
563
|
+
static get states() {
|
|
564
|
+
return {
|
|
565
|
+
"isValid": {},
|
|
566
|
+
"errorMessage": {},
|
|
567
|
+
"limitStylingAppends": {},
|
|
568
|
+
"showTooltip": {},
|
|
569
|
+
"selectedCountryCode": {},
|
|
570
|
+
"currentPostalCode": {},
|
|
571
|
+
"openAddressDropdown": {},
|
|
572
|
+
"showNoResultsMessage": {},
|
|
573
|
+
"refreshTrigger": {},
|
|
574
|
+
"isFetchingAddresses": {}
|
|
575
|
+
};
|
|
576
|
+
}
|
|
577
|
+
static get events() {
|
|
578
|
+
return [{
|
|
579
|
+
"method": "sendAddressValue",
|
|
580
|
+
"name": "sendAddressValue",
|
|
581
|
+
"bubbles": true,
|
|
582
|
+
"cancelable": true,
|
|
583
|
+
"composed": true,
|
|
584
|
+
"docs": {
|
|
585
|
+
"tags": [],
|
|
586
|
+
"text": ""
|
|
587
|
+
},
|
|
588
|
+
"complexType": {
|
|
589
|
+
"original": "{ city: string; address1: string; address2: string }",
|
|
590
|
+
"resolved": "{ city: string; address1: string; address2: string; }",
|
|
591
|
+
"references": {}
|
|
592
|
+
}
|
|
593
|
+
}, {
|
|
594
|
+
"method": "sendValidityState",
|
|
595
|
+
"name": "sendValidityState",
|
|
596
|
+
"bubbles": true,
|
|
597
|
+
"cancelable": true,
|
|
598
|
+
"composed": true,
|
|
599
|
+
"docs": {
|
|
600
|
+
"tags": [],
|
|
601
|
+
"text": ""
|
|
602
|
+
},
|
|
603
|
+
"complexType": {
|
|
604
|
+
"original": "InputStateEvent",
|
|
605
|
+
"resolved": "InputStateEvent",
|
|
606
|
+
"references": {
|
|
607
|
+
"InputStateEvent": {
|
|
608
|
+
"location": "import",
|
|
609
|
+
"path": "../../utils/types",
|
|
610
|
+
"id": "../../../../packages/stencil/general-input/src/utils/types.ts::InputStateEvent"
|
|
611
|
+
}
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
}, {
|
|
615
|
+
"method": "sendInputValue",
|
|
616
|
+
"name": "sendInputValue",
|
|
617
|
+
"bubbles": true,
|
|
618
|
+
"cancelable": true,
|
|
619
|
+
"composed": true,
|
|
620
|
+
"docs": {
|
|
621
|
+
"tags": [],
|
|
622
|
+
"text": ""
|
|
623
|
+
},
|
|
624
|
+
"complexType": {
|
|
625
|
+
"original": "InputValueEvent",
|
|
626
|
+
"resolved": "InputValueEvent",
|
|
627
|
+
"references": {
|
|
628
|
+
"InputValueEvent": {
|
|
629
|
+
"location": "import",
|
|
630
|
+
"path": "../../utils/types",
|
|
631
|
+
"id": "../../../../packages/stencil/general-input/src/utils/types.ts::InputValueEvent"
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
}];
|
|
636
|
+
}
|
|
637
|
+
static get watchers() {
|
|
638
|
+
return [{
|
|
639
|
+
"propName": "clientStyling",
|
|
640
|
+
"methodName": "handleStylingChange"
|
|
641
|
+
}, {
|
|
642
|
+
"propName": "isValid",
|
|
643
|
+
"methodName": "validityChanged"
|
|
644
|
+
}, {
|
|
645
|
+
"propName": "emitValue",
|
|
646
|
+
"methodName": "emitValueHandler"
|
|
647
|
+
}, {
|
|
648
|
+
"propName": "addresses",
|
|
649
|
+
"methodName": "handleAddresses"
|
|
650
|
+
}];
|
|
651
|
+
}
|
|
652
|
+
static get listeners() {
|
|
653
|
+
return [{
|
|
654
|
+
"name": "click",
|
|
655
|
+
"method": "handleClickOutside",
|
|
656
|
+
"target": "window",
|
|
657
|
+
"capture": true,
|
|
658
|
+
"passive": false
|
|
659
|
+
}, {
|
|
660
|
+
"name": "countryCodeUpdated",
|
|
661
|
+
"method": "handleCountryCodeUpdate",
|
|
662
|
+
"target": "window",
|
|
663
|
+
"capture": false,
|
|
664
|
+
"passive": false
|
|
665
|
+
}, {
|
|
666
|
+
"name": "addressFetchStarted",
|
|
667
|
+
"method": "handleFetchStarted",
|
|
668
|
+
"target": "window",
|
|
669
|
+
"capture": false,
|
|
670
|
+
"passive": false
|
|
671
|
+
}];
|
|
672
|
+
}
|
|
673
|
+
}
|