@everymatrix/general-registration 1.10.1 → 1.10.3
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-input_11.cjs.entry.js +28186 -770
- package/dist/cjs/general-registration.cjs.js +2 -2
- package/dist/cjs/{index-c04f4a2a.js → index-9a07d1e9.js} +5 -0
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/collection/components/general-registration/general-registration.js +299 -224
- package/dist/components/checkbox-input2.js +10 -5
- package/dist/components/date-input2.js +6493 -19
- package/dist/components/email-input2.js +7 -20
- package/dist/components/general-input2.js +11 -9
- package/dist/components/general-registration.js +299 -223
- package/dist/components/locale.utils.js +2 -1
- package/dist/components/number-input2.js +7 -20
- package/dist/components/password-input2.js +9 -1
- package/dist/components/radio-input2.js +3 -12
- package/dist/components/select-input2.js +16 -19
- package/dist/components/tel-input2.js +35 -21
- package/dist/components/text-input2.js +5 -4
- package/dist/components/vaadin-combo-box.js +4423 -0
- package/dist/components/virtual-keyboard-controller.js +16466 -0
- package/dist/esm/checkbox-input_11.entry.js +28193 -777
- package/dist/esm/general-registration.js +2 -2
- package/dist/esm/{index-79f297c1.js → index-0505440f.js} +5 -1
- package/dist/esm/loader.js +2 -2
- package/dist/general-registration/general-registration.esm.js +1 -1
- package/dist/general-registration/p-1a88a312.js +1 -0
- package/dist/general-registration/p-7c69629f.entry.js +3164 -0
- package/dist/types/Users/{user/workspace/everymatrix → adrian.pripon/Documents/Work/stencil}/widgets-stencil/packages/general-registration/.stencil/packages/general-input/src/utils/types.d.ts +8 -0
- package/dist/types/Users/adrian.pripon/Documents/Work/stencil/widgets-stencil/packages/general-registration/.stencil/packages/general-registration/stencil.config.d.ts +2 -0
- package/dist/types/components/general-registration/general-registration.d.ts +267 -11
- package/package.json +6 -4
- package/dist/general-registration/p-0e7175cd.js +0 -1
- package/dist/general-registration/p-cadaffbe.entry.js +0 -1
- package/dist/types/Users/user/workspace/everymatrix/widgets-stencil/packages/general-registration/.stencil/packages/general-registration/stencil.config.d.ts +0 -2
- /package/dist/types/Users/{user/workspace/everymatrix → adrian.pripon/Documents/Work/stencil}/widgets-stencil/packages/general-registration/.stencil/packages/general-input/src/utils/locale.utils.d.ts +0 -0
|
@@ -7,7 +7,8 @@ const TRANSLATIONS = {
|
|
|
7
7
|
lengthError: `The length should be between {minLength} and {maxLength}`,
|
|
8
8
|
requiredError: 'This input is required.',
|
|
9
9
|
nextButton: 'Next',
|
|
10
|
-
backButton: 'Back'
|
|
10
|
+
backButton: 'Back',
|
|
11
|
+
doneButton: 'Done'
|
|
11
12
|
},
|
|
12
13
|
ro: {
|
|
13
14
|
lengthError: `Cuvântul introdus este prea scurt. {minLength} and {maxLength}`,
|
|
@@ -11,17 +11,8 @@ const NumberInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
11
11
|
this.sendValidityState = createEvent(this, "sendValidityState", 7);
|
|
12
12
|
this.sendInputValue = createEvent(this, "sendInputValue", 7);
|
|
13
13
|
}
|
|
14
|
-
checkValidityHandler(newValue) {
|
|
15
|
-
if (newValue == true) {
|
|
16
|
-
this.isValid = this.setValidity();
|
|
17
|
-
this.errorMessage = this.setErrorMessage();
|
|
18
|
-
this.validityStateHandler({ valid: this.isValid, name: this.name });
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
14
|
validityChanged() {
|
|
22
|
-
|
|
23
|
-
this.validityStateHandler({ valid: this.isValid, name: this.name });
|
|
24
|
-
}
|
|
15
|
+
this.validityStateHandler({ valid: this.isValid, name: this.name });
|
|
25
16
|
if (this.emitValue == true) {
|
|
26
17
|
this.valueHandler({ name: this.name, value: this.value });
|
|
27
18
|
}
|
|
@@ -39,13 +30,10 @@ const NumberInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
39
30
|
}
|
|
40
31
|
handleInput(event) {
|
|
41
32
|
this.value = event.target.value;
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}
|
|
45
|
-
this.
|
|
46
|
-
this.errorMessage = this.setErrorMessage();
|
|
47
|
-
this.isValid = this.setValidity();
|
|
48
|
-
}, 500);
|
|
33
|
+
this.errorMessage = this.setErrorMessage();
|
|
34
|
+
this.isValid = this.setValidity();
|
|
35
|
+
this.validityStateHandler({ valid: this.isValid, name: this.name });
|
|
36
|
+
this.emitValueHandler(true);
|
|
49
37
|
}
|
|
50
38
|
setValidity() {
|
|
51
39
|
return this.inputReference.validity.valid;
|
|
@@ -60,10 +48,9 @@ const NumberInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
60
48
|
}
|
|
61
49
|
render() {
|
|
62
50
|
const invalidClass = this.isValid == true || this.isValid == undefined ? '' : 'number__input--invalid';
|
|
63
|
-
return h("div", { class: 'number__wrapper' }, h("input", { ref: (el) => this.inputReference = el, type: "number", value: this.defaultValue, id: `${this.name}__input`, class: `number__input ${invalidClass}`, placeholder: `${this.displayName} ${this.validation.mandatory ? '*' : ''}`, required: this.validation.mandatory, max: this.validation.max, min: this.validation.min,
|
|
51
|
+
return h("div", { class: 'number__wrapper' }, h("input", { ref: (el) => this.inputReference = el, type: "number", value: this.defaultValue, readOnly: this.autofilled, id: `${this.name}__input`, class: `number__input ${invalidClass}`, placeholder: `${this.displayName} ${this.validation.mandatory ? '*' : ''}`, required: this.validation.mandatory, max: this.validation.max, min: this.validation.min, onBlur: (e) => this.handleInput(e) }), h("label", { class: `number__label ${this.validation.mandatory ? 'number__label--required' : ''}`, htmlFor: `${this.name}__input` }, this.displayName), h("small", { class: 'number__error-message' }, this.errorMessage));
|
|
64
52
|
}
|
|
65
53
|
static get watchers() { return {
|
|
66
|
-
"checkValidity": ["checkValidityHandler"],
|
|
67
54
|
"isValid": ["validityChanged"],
|
|
68
55
|
"emitValue": ["emitValueHandler"]
|
|
69
56
|
}; }
|
|
@@ -73,8 +60,8 @@ const NumberInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
73
60
|
"displayName": [1, "display-name"],
|
|
74
61
|
"validation": [16],
|
|
75
62
|
"defaultValue": [2, "default-value"],
|
|
63
|
+
"autofilled": [4],
|
|
76
64
|
"language": [1],
|
|
77
|
-
"checkValidity": [4, "check-validity"],
|
|
78
65
|
"emitValue": [4, "emit-value"],
|
|
79
66
|
"errorMessage": [32],
|
|
80
67
|
"isValid": [32]
|
|
@@ -10,6 +10,11 @@ const PasswordInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
10
10
|
this.__attachShadow();
|
|
11
11
|
this.sendValidityState = createEvent(this, "sendValidityState", 7);
|
|
12
12
|
this.sendInputValue = createEvent(this, "sendInputValue", 7);
|
|
13
|
+
/**
|
|
14
|
+
* Default value for the input.
|
|
15
|
+
*/
|
|
16
|
+
this.defaultValue = '';
|
|
17
|
+
this.value = '';
|
|
13
18
|
this.validationPattern = '';
|
|
14
19
|
}
|
|
15
20
|
validityChanged() {
|
|
@@ -37,6 +42,7 @@ const PasswordInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
37
42
|
this.errorMessage = this.setErrorMessage();
|
|
38
43
|
this.isValid = this.setValidity();
|
|
39
44
|
this.validityStateHandler({ valid: this.isValid, name: this.name });
|
|
45
|
+
this.emitValueHandler(true);
|
|
40
46
|
}
|
|
41
47
|
setValidity() {
|
|
42
48
|
return this.inputReference.validity.valid;
|
|
@@ -60,7 +66,7 @@ const PasswordInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
60
66
|
}
|
|
61
67
|
render() {
|
|
62
68
|
const invalidClass = this.isValid == true || this.isValid == undefined ? '' : 'password__input--invalid';
|
|
63
|
-
return h("div", { class: 'password__wrapper' }, h("input", { type: "password", id: `${this.name}__input`, class: `password__input ${invalidClass}`, name: this.name, ref: (el) => this.inputReference = el, required: this.validation.mandatory, maxlength: this.validation.maxLength, minlength: this.validation.minLength, pattern: this.validationPattern, placeholder: `${this.displayName} ${this.validation.mandatory ? '*' : ''}`, onBlur: (e) => this.handleInput(e) }), h("label", { class: `password__label ${this.validation.mandatory ? 'password__label--required' : ''}`, htmlFor: `${this.name}__input` }, this.displayName), h("small", { class: 'password__error-message' }, this.errorMessage));
|
|
69
|
+
return h("div", { class: 'password__wrapper' }, h("input", { type: "password", id: `${this.name}__input`, class: `password__input ${invalidClass}`, name: this.name, readOnly: this.autofilled, value: this.defaultValue, ref: (el) => this.inputReference = el, required: this.validation.mandatory, maxlength: this.validation.maxLength, minlength: this.validation.minLength, pattern: this.validationPattern, placeholder: `${this.displayName} ${this.validation.mandatory ? '*' : ''}`, onBlur: (e) => this.handleInput(e) }), h("label", { class: `password__label ${this.validation.mandatory ? 'password__label--required' : ''}`, htmlFor: `${this.name}__input` }, this.displayName), h("small", { class: 'password__error-message' }, this.errorMessage));
|
|
64
70
|
}
|
|
65
71
|
static get watchers() { return {
|
|
66
72
|
"isValid": ["validityChanged"],
|
|
@@ -70,6 +76,8 @@ const PasswordInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement
|
|
|
70
76
|
}, [1, "password-input", {
|
|
71
77
|
"name": [1],
|
|
72
78
|
"displayName": [1, "display-name"],
|
|
79
|
+
"defaultValue": [1, "default-value"],
|
|
80
|
+
"autofilled": [4],
|
|
73
81
|
"validation": [16],
|
|
74
82
|
"language": [1],
|
|
75
83
|
"emitValue": [4, "emit-value"],
|
|
@@ -11,17 +11,8 @@ const RadioInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
11
11
|
this.sendInputValue = createEvent(this, "sendInputValue", 7);
|
|
12
12
|
this.sendValidityState = createEvent(this, "sendValidityState", 7);
|
|
13
13
|
}
|
|
14
|
-
checkValidityHandler(newValue) {
|
|
15
|
-
if (newValue == true) {
|
|
16
|
-
this.isValid = this.setValidity();
|
|
17
|
-
this.errorMessage = this.setErrorMessage();
|
|
18
|
-
this.validityStateHandler({ valid: this.isValid, name: this.name });
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
14
|
validityChanged() {
|
|
22
|
-
|
|
23
|
-
this.validityStateHandler({ valid: this.isValid, name: this.name });
|
|
24
|
-
}
|
|
15
|
+
this.validityStateHandler({ valid: this.isValid, name: this.name });
|
|
25
16
|
if (this.emitValue == true) {
|
|
26
17
|
this.valueHandler({ name: this.name, value: this.value });
|
|
27
18
|
}
|
|
@@ -43,6 +34,8 @@ const RadioInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
43
34
|
this.value = event.target.value;
|
|
44
35
|
this.isValid = this.setValidity();
|
|
45
36
|
this.errorMessage = this.setErrorMessage();
|
|
37
|
+
this.validityStateHandler({ valid: this.isValid, name: this.name });
|
|
38
|
+
this.emitValueHandler(true);
|
|
46
39
|
}
|
|
47
40
|
setValidity() {
|
|
48
41
|
return this.inputReference.validity.valid;
|
|
@@ -56,7 +49,6 @@ const RadioInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
56
49
|
return h("fieldset", { class: 'radio__fieldset' }, h("legend", { class: 'radio__legend' }, this.displayName, ":"), this.optionsGroup.map(option => h("div", { class: 'radio__wrapper' }, h("input", { type: "radio", class: 'radio__input', id: `${option.label}__input`, ref: (el) => this.inputReference = el, value: option.value, name: this.name, required: this.validation.mandatory, onClick: (e) => this.handleClick(e) }), h("label", { htmlFor: `${option.label}__input` }, option.label))), h("small", { class: 'radio__error-message' }, this.errorMessage));
|
|
57
50
|
}
|
|
58
51
|
static get watchers() { return {
|
|
59
|
-
"checkValidity": ["checkValidityHandler"],
|
|
60
52
|
"isValid": ["validityChanged"],
|
|
61
53
|
"emitValue": ["emitValueHandler"]
|
|
62
54
|
}; }
|
|
@@ -67,7 +59,6 @@ const RadioInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
67
59
|
"optionsGroup": [16],
|
|
68
60
|
"validation": [16],
|
|
69
61
|
"language": [1],
|
|
70
|
-
"checkValidity": [4, "check-validity"],
|
|
71
62
|
"emitValue": [4, "emit-value"],
|
|
72
63
|
"errorMessage": [32],
|
|
73
64
|
"isValid": [32]
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
|
|
2
2
|
import { t as translate } from './locale.utils.js';
|
|
3
|
+
import './virtual-keyboard-controller.js';
|
|
4
|
+
import './vaadin-combo-box.js';
|
|
3
5
|
|
|
4
6
|
const selectInputCss = "*,*::before,*::after{padding:0;margin:0;box-sizing:border-box}.select__wrapper{position:relative;display:flex;padding-top:10px;width:100%}.select__label{color:#474747;font-size:16px;position:absolute;bottom:15px;left:5px;transform:translateY(-25px);transition:all 0.3s cubic-bezier(0.5, 0, 0.5, 1)}.select__label--hidden{opacity:0;visibility:hidden;transform:translateY(0)}.select__input{width:inherit;padding:15px 6px;position:relative;border:none;border-bottom:3px solid #666666;background-color:transparent;color:#666666;font-size:16px;font-family:inherit}.select__input:focus{outline:none;box-shadow:0 5px 5px rgba(16, 15, 15, 0.1)}.select__error-message{position:absolute;top:calc(100% + 5px);left:0;color:#cc0000}";
|
|
5
7
|
|
|
@@ -10,22 +12,17 @@ const SelectInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
10
12
|
this.__attachShadow();
|
|
11
13
|
this.sendValidityState = createEvent(this, "sendValidityState", 7);
|
|
12
14
|
this.sendInputValue = createEvent(this, "sendInputValue", 7);
|
|
15
|
+
/**
|
|
16
|
+
* Default value for the input.
|
|
17
|
+
*/
|
|
18
|
+
this.defaultValue = '';
|
|
13
19
|
/**
|
|
14
20
|
* Options of the input.
|
|
15
21
|
*/
|
|
16
22
|
this.options = [];
|
|
17
23
|
}
|
|
18
|
-
checkValidityHandler(newValue) {
|
|
19
|
-
if (newValue == true) {
|
|
20
|
-
this.isValid = this.setValidity();
|
|
21
|
-
this.errorMessage = this.setErrorMessage();
|
|
22
|
-
this.validityStateHandler({ valid: this.isValid, name: this.name });
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
24
|
validityChanged() {
|
|
26
|
-
|
|
27
|
-
this.validityStateHandler({ valid: this.isValid, name: this.name });
|
|
28
|
-
}
|
|
25
|
+
this.validityStateHandler({ valid: this.isValid, name: this.name });
|
|
29
26
|
if (this.emitValue == true) {
|
|
30
27
|
this.valueHandler({ name: this.name, value: this.value });
|
|
31
28
|
}
|
|
@@ -43,10 +40,8 @@ const SelectInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
43
40
|
}
|
|
44
41
|
connectedCallback() {
|
|
45
42
|
this.displayedOptions = this.options;
|
|
46
|
-
console.log(this.displayedOptions);
|
|
47
43
|
}
|
|
48
44
|
componentWillLoad() {
|
|
49
|
-
console.log(this.action, this.options);
|
|
50
45
|
if (this.action && !this.options.length) {
|
|
51
46
|
if (this.action.split(" ")[0] == 'GET') {
|
|
52
47
|
return this.getOptions().then((options) => {
|
|
@@ -57,6 +52,9 @@ const SelectInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
57
52
|
}
|
|
58
53
|
}
|
|
59
54
|
}
|
|
55
|
+
componentDidLoad() {
|
|
56
|
+
this.inputReference = this.element.shadowRoot.querySelector('input');
|
|
57
|
+
}
|
|
60
58
|
getOptions() {
|
|
61
59
|
// TEMPORARY FOR DEMO PURPOSES UNTIL NORWAY CONFIGURES AN ACTUAL ENDPOINT...
|
|
62
60
|
const url = new URL("https://demo-api.stage.norway.everymatrix.com/v1/player/countries");
|
|
@@ -75,8 +73,9 @@ const SelectInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
75
73
|
this.value = event.target.value;
|
|
76
74
|
this.errorMessage = this.setErrorMessage();
|
|
77
75
|
this.isValid = this.setValidity();
|
|
76
|
+
this.validityStateHandler({ valid: this.isValid, name: this.name });
|
|
77
|
+
this.emitValueHandler(true);
|
|
78
78
|
this.inputReference.previousElementSibling.classList.remove('select__label--hidden');
|
|
79
|
-
console.log(this.action, this.options);
|
|
80
79
|
}
|
|
81
80
|
setValidity() {
|
|
82
81
|
return this.inputReference.validity.valid;
|
|
@@ -87,13 +86,10 @@ const SelectInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
87
86
|
}
|
|
88
87
|
}
|
|
89
88
|
render() {
|
|
90
|
-
|
|
91
|
-
return h("div", { class: 'select__wrapper' }, h("label", { class: 'select__label select__label--hidden', htmlFor: `${this.name}__input` }, this.displayName, ":"), h("select", { ref: (el) => this.inputReference = el, name: this.name, id: `${this.name}__input`, required: this.validation.mandatory, class: 'select__input', onChange: (e) => this.handleChange(e) }, h("option", { value: "", selected: true, disabled: true }, " ", this.displayName, " "), this.displayedOptions.map(option => {
|
|
92
|
-
return h("option", { value: option.value }, " ", option.label, " ");
|
|
93
|
-
})), h("small", { class: 'select__error-message' }, this.errorMessage));
|
|
89
|
+
return h("div", { class: 'select__wrapper' }, h("label", { class: 'select__label select__label--hidden', htmlFor: `${this.name}__input` }, `${this.displayName} ${this.validation.mandatory ? '*' : ''}`), h("vaadin-combo-box", { name: this.name, id: `${this.name}__input`, class: 'select__input', "item-label-path": "label", "item-value-path": "value", readOnly: this.autofilled, required: this.validation.mandatory, value: this.defaultValue, placeholder: `${this.displayName} ${this.validation.mandatory ? '*' : ''}`, items: this.displayedOptions, onBlur: (e) => this.handleChange(e) }), h("small", { class: 'select__error-message' }, this.errorMessage));
|
|
94
90
|
}
|
|
91
|
+
get element() { return this; }
|
|
95
92
|
static get watchers() { return {
|
|
96
|
-
"checkValidity": ["checkValidityHandler"],
|
|
97
93
|
"isValid": ["validityChanged"],
|
|
98
94
|
"emitValue": ["emitValueHandler"]
|
|
99
95
|
}; }
|
|
@@ -102,10 +98,11 @@ const SelectInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
102
98
|
"name": [1],
|
|
103
99
|
"displayName": [1, "display-name"],
|
|
104
100
|
"action": [1],
|
|
101
|
+
"defaultValue": [1, "default-value"],
|
|
102
|
+
"autofilled": [4],
|
|
105
103
|
"options": [16],
|
|
106
104
|
"validation": [16],
|
|
107
105
|
"language": [1],
|
|
108
|
-
"checkValidity": [4, "check-validity"],
|
|
109
106
|
"emitValue": [4, "emit-value"],
|
|
110
107
|
"errorMessage": [32],
|
|
111
108
|
"isValid": [32]
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
|
|
2
2
|
import { t as translate } from './locale.utils.js';
|
|
3
|
+
import './virtual-keyboard-controller.js';
|
|
4
|
+
import './vaadin-combo-box.js';
|
|
3
5
|
|
|
4
|
-
const telInputCss = "*,*::before,*::after{padding:0;margin:0;box-sizing:border-box}.tel__wrapper{position:relative;display:flex;flex-direction:column-reverse;padding-top:10px}.tel__label{color:#474747;font-size:16px;position:absolute;bottom:15px;left:5px;transform:translateY(-25px);transition:all 0.3s cubic-bezier(0.5, 0, 0.5, 1)}.tel__label--required::after{content:\"*\";margin-left:5px;color:#666666}.tel__input{width:inherit;padding:15px 6px;position:relative;border:none;
|
|
6
|
+
const telInputCss = "*,*::before,*::after{padding:0;margin:0;box-sizing:border-box}.tel__wrapper{position:relative;display:flex;flex-direction:column-reverse;padding-top:10px;border-bottom:3px solid #666666}.tel__wrapper--flex{display:flex}.tel__label{color:#474747;font-size:16px;position:absolute;bottom:15px;left:5px;transform:translateY(-25px);transition:all 0.3s cubic-bezier(0.5, 0, 0.5, 1)}.tel__label--required::after{content:\"*\";margin-left:5px;color:#666666}.tel vaadin-combo-box{flex-grow:1}.tel__input{width:inherit;padding:15px 6px;position:relative;border:none;background-color:transparent;color:#666666;font-size:16px;font-family:inherit;flex-grow:3;-moz-appearance:textfield;}.tel__input::-webkit-outer-spin-button,.tel__input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}.tel__input:focus{outline:none;box-shadow:0 5px 5px rgba(16, 15, 15, 0.1)}.tel__input::placeholder{color:#666666}.tel__input--invalid .tel__wrapper{border-bottom:3px solid #cc0000}.tel__input:placeholder-shown+.tel__label{opacity:0;visibility:hidden;transform:translateY(0)}.tel__error-message{position:absolute;top:calc(100% + 5px);left:0;color:#cc0000}";
|
|
5
7
|
|
|
6
8
|
const TelInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
7
9
|
constructor() {
|
|
@@ -12,17 +14,8 @@ const TelInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
12
14
|
this.sendInputValue = createEvent(this, "sendInputValue", 7);
|
|
13
15
|
this.validationPattern = '';
|
|
14
16
|
}
|
|
15
|
-
checkValidityHandler(newValue) {
|
|
16
|
-
if (newValue == true) {
|
|
17
|
-
this.isValid = this.setValidity();
|
|
18
|
-
this.errorMessage = this.setErrorMessage();
|
|
19
|
-
this.validityStateHandler({ valid: this.isValid, name: this.name });
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
17
|
validityChanged() {
|
|
23
|
-
|
|
24
|
-
this.validityStateHandler({ valid: this.isValid, name: this.name });
|
|
25
|
-
}
|
|
18
|
+
this.validityStateHandler({ valid: this.isValid, name: this.name });
|
|
26
19
|
if (this.emitValue == true) {
|
|
27
20
|
this.valueHandler({ name: this.name, value: this.value });
|
|
28
21
|
}
|
|
@@ -41,15 +34,37 @@ const TelInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
41
34
|
connectedCallback() {
|
|
42
35
|
this.validationPattern = this.setPattern();
|
|
43
36
|
}
|
|
37
|
+
componentWillLoad() {
|
|
38
|
+
if (this.action) {
|
|
39
|
+
if (this.action.split(" ")[0] == 'GET') {
|
|
40
|
+
return this.getPhoneCodes().then((options) => {
|
|
41
|
+
this.phoneCodesOptions = options.phoneCodes.map(code => {
|
|
42
|
+
return { label: code.Prefix, value: code.CountryID };
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
getPhoneCodes() {
|
|
49
|
+
// TEMPORARY FOR DEMO PURPOSES UNTIL NORWAY CONFIGURES AN ACTUAL ENDPOINT...
|
|
50
|
+
const url = new URL("https://demo-api.stage.norway.everymatrix.com/v1/player/phonecodes");
|
|
51
|
+
return new Promise((resolve, reject) => {
|
|
52
|
+
fetch(url.href)
|
|
53
|
+
.then((res) => res.json())
|
|
54
|
+
.then((options) => {
|
|
55
|
+
resolve(options);
|
|
56
|
+
}).catch((err) => {
|
|
57
|
+
console.error(err);
|
|
58
|
+
reject(err);
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
}
|
|
44
62
|
handleInput(event) {
|
|
45
63
|
this.value = event.target.value;
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}
|
|
49
|
-
this.
|
|
50
|
-
this.errorMessage = this.setErrorMessage();
|
|
51
|
-
this.isValid = this.setValidity();
|
|
52
|
-
}, 500);
|
|
64
|
+
this.errorMessage = this.setErrorMessage();
|
|
65
|
+
this.isValid = this.setValidity();
|
|
66
|
+
this.validityStateHandler({ valid: this.isValid, name: this.name });
|
|
67
|
+
this.emitValueHandler(true);
|
|
53
68
|
}
|
|
54
69
|
setValidity() {
|
|
55
70
|
return this.inputReference.validity.valid;
|
|
@@ -73,10 +88,9 @@ const TelInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
73
88
|
}
|
|
74
89
|
render() {
|
|
75
90
|
const invalidClass = this.isValid == true || this.isValid == undefined ? '' : 'tel__input--invalid';
|
|
76
|
-
return h("div", { class: 'tel__wrapper' }, h("input", { type: "tel", ref: (el) => this.inputReference = el, id: `${this.name}__input`,
|
|
91
|
+
return h("div", { class: 'tel__wrapper' }, h("div", { class: 'tel__wrapper--flex' }, h("vaadin-combo-box", { items: this.phoneCodesOptions, value: this.defaultValue, readOnly: this.autofilled }), h("input", { type: "tel", ref: (el) => this.inputReference = el, id: `${this.name}__input`, readOnly: this.autofilled, class: `tel__input ${invalidClass}`, placeholder: `${this.displayName} ${this.validation.mandatory ? '*' : ''}`, required: this.validation.mandatory, minlength: this.validation.minLength, maxlength: this.validation.maxLength, pattern: this.validationPattern, onBlur: (e) => this.handleInput(e) })), h("label", { class: `tel__label ${this.validation.mandatory ? 'tel__label--required' : ''}`, htmlFor: `${this.name}__input` }, this.displayName), h("small", { class: 'tel__error-message' }, this.errorMessage));
|
|
77
92
|
}
|
|
78
93
|
static get watchers() { return {
|
|
79
|
-
"checkValidity": ["checkValidityHandler"],
|
|
80
94
|
"isValid": ["validityChanged"],
|
|
81
95
|
"emitValue": ["emitValueHandler"]
|
|
82
96
|
}; }
|
|
@@ -88,8 +102,8 @@ const TelInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
88
102
|
"action": [1],
|
|
89
103
|
"validation": [16],
|
|
90
104
|
"defaultValue": [8, "default-value"],
|
|
105
|
+
"autofilled": [4],
|
|
91
106
|
"language": [1],
|
|
92
|
-
"checkValidity": [4, "check-validity"],
|
|
93
107
|
"emitValue": [4, "emit-value"],
|
|
94
108
|
"isValid": [32],
|
|
95
109
|
"errorMessage": [32]
|
|
@@ -45,6 +45,7 @@ const TextInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
45
45
|
this.isValid = this.setValidity();
|
|
46
46
|
this.errorMessage = this.setErrorMessage();
|
|
47
47
|
this.validityStateHandler({ valid: this.isValid, name: this.name });
|
|
48
|
+
this.emitValueHandler(true);
|
|
48
49
|
}
|
|
49
50
|
setValidity() {
|
|
50
51
|
return this.inputReference.validity.valid;
|
|
@@ -75,8 +76,7 @@ const TextInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
75
76
|
}
|
|
76
77
|
render() {
|
|
77
78
|
const invalidClass = this.isValid == true || this.isValid == undefined ? '' : 'text__input--invalid';
|
|
78
|
-
|
|
79
|
-
return h("div", { class: 'text__wrapper' }, h("input", { id: `${this.name}__input`, value: this.defaultValue, type: 'text', class: `text__input ${invalidClass}`, placeholder: `${this.displayName} ${this.validation.mandatory ? '*' : ''}`, ref: (el) => this.inputReference = el, pattern: this.validationPattern, required: this.validation.mandatory, minlength: this.validation.minLength, maxlength: this.validation.maxLength, onBlur: (e) => { this.handleInput(e); } }), h("label", { class: `text__label ${this.validation.mandatory ? 'text__label--required' : ''}`, htmlFor: `${this.name}__input` }, this.displayName), h("small", { class: 'text__error-message' }, this.errorMessage));
|
|
79
|
+
return h("div", { class: 'text__wrapper' }, h("input", { id: `${this.name}__input`, value: this.defaultValue, type: 'text', class: `text__input ${invalidClass}`, placeholder: `${this.displayName} ${this.validation.mandatory ? '*' : ''}`, ref: (el) => this.inputReference = el, readOnly: this.autofilled, pattern: this.validationPattern, required: this.validation.mandatory, minlength: this.validation.minLength, maxlength: this.validation.maxLength, onBlur: (e) => { this.handleInput(e); } }), h("label", { class: `text__label ${this.validation.mandatory ? 'text__label--required' : ''}`, htmlFor: `${this.name}__input` }, this.displayName), h("small", { class: 'text__error-message' }, this.errorMessage));
|
|
80
80
|
}
|
|
81
81
|
static get watchers() { return {
|
|
82
82
|
"isValid": ["validityChanged"],
|
|
@@ -84,10 +84,11 @@ const TextInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
84
84
|
}; }
|
|
85
85
|
static get style() { return textInputCss; }
|
|
86
86
|
}, [1, "text-input", {
|
|
87
|
-
"name": [
|
|
87
|
+
"name": [1],
|
|
88
88
|
"displayName": [1, "display-name"],
|
|
89
89
|
"validation": [16],
|
|
90
|
-
"defaultValue": [
|
|
90
|
+
"defaultValue": [1, "default-value"],
|
|
91
|
+
"autofilled": [4],
|
|
91
92
|
"rules": [1],
|
|
92
93
|
"language": [1],
|
|
93
94
|
"checkValidity": [4, "check-validity"],
|