@everymatrix/general-input 1.10.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.
- package/dist/cjs/checkbox-input_9.cjs.entry.js +686 -0
- package/dist/cjs/general-input.cjs.entry.js +45 -0
- package/dist/cjs/general-input.cjs.js +19 -0
- package/dist/cjs/index-64a5cb7f.js +1214 -0
- package/dist/cjs/index.cjs.js +2 -0
- package/dist/cjs/loader.cjs.js +21 -0
- package/dist/collection/collection-manifest.json +21 -0
- package/dist/collection/components/checkbox-input/checkbox-input.css +20 -0
- package/dist/collection/components/checkbox-input/checkbox-input.js +196 -0
- package/dist/collection/components/date-input/date-input.css +60 -0
- package/dist/collection/components/date-input/date-input.js +242 -0
- package/dist/collection/components/email-input/email-input.css +60 -0
- package/dist/collection/components/email-input/email-input.js +259 -0
- package/dist/collection/components/general-input/general-input.css +3 -0
- package/dist/collection/components/general-input/general-input.js +204 -0
- package/dist/collection/components/number-input/number-input.css +67 -0
- package/dist/collection/components/number-input/number-input.js +245 -0
- package/dist/collection/components/password-input/password-input.css +60 -0
- package/dist/collection/components/password-input/password-input.js +210 -0
- package/dist/collection/components/radio-input/radio-input.css +22 -0
- package/dist/collection/components/radio-input/radio-input.js +245 -0
- package/dist/collection/components/select-input/select-input.css +49 -0
- package/dist/collection/components/select-input/select-input.js +308 -0
- package/dist/collection/components/tel-input/tel-input.css +67 -0
- package/dist/collection/components/tel-input/tel-input.js +294 -0
- package/dist/collection/components/text-input/text-input.css +60 -0
- package/dist/collection/components/text-input/text-input.js +278 -0
- package/dist/collection/index.js +1 -0
- package/dist/collection/utils/locale.utils.js +27 -0
- package/dist/collection/utils/types.js +1 -0
- package/dist/collection/utils/utils.js +5 -0
- package/dist/components/checkbox-input.d.ts +11 -0
- package/dist/components/checkbox-input.js +6 -0
- package/dist/components/checkbox-input2.js +78 -0
- package/dist/components/date-input.d.ts +11 -0
- package/dist/components/date-input.js +6 -0
- package/dist/components/date-input2.js +90 -0
- package/dist/components/email-input.d.ts +11 -0
- package/dist/components/email-input.js +6 -0
- package/dist/components/email-input2.js +108 -0
- package/dist/components/general-input.d.ts +11 -0
- package/dist/components/general-input.js +123 -0
- package/dist/components/index.d.ts +26 -0
- package/dist/components/index.js +1 -0
- package/dist/components/locale.utils.js +29 -0
- package/dist/components/number-input.d.ts +11 -0
- package/dist/components/number-input.js +6 -0
- package/dist/components/number-input2.js +96 -0
- package/dist/components/password-input.d.ts +11 -0
- package/dist/components/password-input.js +6 -0
- package/dist/components/password-input2.js +93 -0
- package/dist/components/radio-input.d.ts +11 -0
- package/dist/components/radio-input.js +6 -0
- package/dist/components/radio-input2.js +89 -0
- package/dist/components/select-input.d.ts +11 -0
- package/dist/components/select-input.js +6 -0
- package/dist/components/select-input2.js +127 -0
- package/dist/components/tel-input.d.ts +11 -0
- package/dist/components/tel-input.js +6 -0
- package/dist/components/tel-input2.js +111 -0
- package/dist/components/text-input.d.ts +11 -0
- package/dist/components/text-input.js +6 -0
- package/dist/components/text-input2.js +112 -0
- package/dist/esm/checkbox-input_9.entry.js +674 -0
- package/dist/esm/general-input.entry.js +41 -0
- package/dist/esm/general-input.js +17 -0
- package/dist/esm/index-df80f936.js +1188 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/loader.js +17 -0
- package/dist/esm/polyfills/core-js.js +11 -0
- package/dist/esm/polyfills/css-shim.js +1 -0
- package/dist/esm/polyfills/dom.js +79 -0
- package/dist/esm/polyfills/es5-html-element.js +1 -0
- package/dist/esm/polyfills/index.js +34 -0
- package/dist/esm/polyfills/system.js +6 -0
- package/dist/general-input/general-input.esm.js +1 -0
- package/dist/general-input/index.esm.js +0 -0
- package/dist/general-input/p-c9e79656.entry.js +1 -0
- package/dist/general-input/p-d9f7fa2e.js +1 -0
- package/dist/general-input/p-dea0a4ac.entry.js +1 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/stencil.config.js +22 -0
- package/dist/types/Users/user/workspace/everymatrix/widgets-stencil/packages/general-input/.stencil/packages/general-input/stencil.config.d.ts +2 -0
- package/dist/types/components/checkbox-input/checkbox-input.d.ts +39 -0
- package/dist/types/components/date-input/date-input.d.ts +47 -0
- package/dist/types/components/email-input/email-input.d.ts +51 -0
- package/dist/types/components/general-input/general-input.d.ts +40 -0
- package/dist/types/components/number-input/number-input.d.ts +48 -0
- package/dist/types/components/password-input/password-input.d.ts +42 -0
- package/dist/types/components/radio-input/radio-input.d.ts +48 -0
- package/dist/types/components/select-input/select-input.d.ts +55 -0
- package/dist/types/components/tel-input/tel-input.d.ts +59 -0
- package/dist/types/components.d.ts +749 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/stencil-public-runtime.d.ts +1565 -0
- package/dist/types/utils/locale.utils.d.ts +5 -0
- package/dist/types/utils/types.d.ts +55 -0
- package/dist/types/utils/utils.d.ts +1 -0
- package/loader/cdn.js +3 -0
- package/loader/index.cjs.js +3 -0
- package/loader/index.d.ts +12 -0
- package/loader/index.es2017.js +3 -0
- package/loader/index.js +4 -0
- package/loader/package.json +10 -0
- package/package.json +19 -0
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
import { Component, h, Prop, State, Watch, Event } from '@stencil/core';
|
|
2
|
+
import { translate } from '../../utils/locale.utils';
|
|
3
|
+
export class RadioInput {
|
|
4
|
+
checkValidityHandler(newValue) {
|
|
5
|
+
if (newValue == true) {
|
|
6
|
+
this.isValid = this.setValidity();
|
|
7
|
+
this.errorMessage = this.setErrorMessage();
|
|
8
|
+
this.validityStateHandler({ valid: this.isValid, name: this.name });
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
validityChanged() {
|
|
12
|
+
if (this.checkValidity == true) {
|
|
13
|
+
this.validityStateHandler({ valid: this.isValid, name: this.name });
|
|
14
|
+
}
|
|
15
|
+
if (this.emitValue == true) {
|
|
16
|
+
this.valueHandler({ name: this.name, value: this.value });
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
emitValueHandler(newValue) {
|
|
20
|
+
if (newValue == true && this.isValid) {
|
|
21
|
+
this.valueHandler({ name: this.name, value: this.value });
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
valueHandler(inputValueEvent) {
|
|
25
|
+
this.sendInputValue.emit(inputValueEvent);
|
|
26
|
+
}
|
|
27
|
+
validityStateHandler(inputStateEvent) {
|
|
28
|
+
this.sendValidityState.emit(inputStateEvent);
|
|
29
|
+
}
|
|
30
|
+
connectedCallback() {
|
|
31
|
+
}
|
|
32
|
+
handleClick(event) {
|
|
33
|
+
this.value = event.target.value;
|
|
34
|
+
this.isValid = this.setValidity();
|
|
35
|
+
this.errorMessage = this.setErrorMessage();
|
|
36
|
+
}
|
|
37
|
+
setValidity() {
|
|
38
|
+
return this.inputReference.validity.valid;
|
|
39
|
+
}
|
|
40
|
+
setErrorMessage() {
|
|
41
|
+
if (this.inputReference.validity.valueMissing) {
|
|
42
|
+
return translate('requiredError', this.language);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
render() {
|
|
46
|
+
return h("fieldset", { class: 'radio__fieldset' },
|
|
47
|
+
h("legend", { class: 'radio__legend' },
|
|
48
|
+
this.displayName,
|
|
49
|
+
":"),
|
|
50
|
+
this.optionsGroup.map(option => h("div", { class: 'radio__wrapper' },
|
|
51
|
+
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) }),
|
|
52
|
+
h("label", { htmlFor: `${option.label}__input` }, option.label))),
|
|
53
|
+
h("small", { class: 'radio__error-message' }, this.errorMessage));
|
|
54
|
+
}
|
|
55
|
+
static get is() { return "radio-input"; }
|
|
56
|
+
static get encapsulation() { return "shadow"; }
|
|
57
|
+
static get originalStyleUrls() { return {
|
|
58
|
+
"$": ["radio-input.scss"]
|
|
59
|
+
}; }
|
|
60
|
+
static get styleUrls() { return {
|
|
61
|
+
"$": ["radio-input.css"]
|
|
62
|
+
}; }
|
|
63
|
+
static get properties() { return {
|
|
64
|
+
"name": {
|
|
65
|
+
"type": "string",
|
|
66
|
+
"mutable": false,
|
|
67
|
+
"complexType": {
|
|
68
|
+
"original": "string",
|
|
69
|
+
"resolved": "string",
|
|
70
|
+
"references": {}
|
|
71
|
+
},
|
|
72
|
+
"required": false,
|
|
73
|
+
"optional": false,
|
|
74
|
+
"docs": {
|
|
75
|
+
"tags": [],
|
|
76
|
+
"text": "Name of the input."
|
|
77
|
+
},
|
|
78
|
+
"attribute": "name",
|
|
79
|
+
"reflect": false
|
|
80
|
+
},
|
|
81
|
+
"displayName": {
|
|
82
|
+
"type": "string",
|
|
83
|
+
"mutable": false,
|
|
84
|
+
"complexType": {
|
|
85
|
+
"original": "string",
|
|
86
|
+
"resolved": "string",
|
|
87
|
+
"references": {}
|
|
88
|
+
},
|
|
89
|
+
"required": false,
|
|
90
|
+
"optional": false,
|
|
91
|
+
"docs": {
|
|
92
|
+
"tags": [],
|
|
93
|
+
"text": "Name of input to be shown to the user."
|
|
94
|
+
},
|
|
95
|
+
"attribute": "display-name",
|
|
96
|
+
"reflect": false
|
|
97
|
+
},
|
|
98
|
+
"optionsGroup": {
|
|
99
|
+
"type": "unknown",
|
|
100
|
+
"mutable": false,
|
|
101
|
+
"complexType": {
|
|
102
|
+
"original": "Option[]",
|
|
103
|
+
"resolved": "Option[]",
|
|
104
|
+
"references": {
|
|
105
|
+
"Option": {
|
|
106
|
+
"location": "import",
|
|
107
|
+
"path": "../../utils/types"
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
"required": false,
|
|
112
|
+
"optional": false,
|
|
113
|
+
"docs": {
|
|
114
|
+
"tags": [],
|
|
115
|
+
"text": "Options of the input."
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
"validation": {
|
|
119
|
+
"type": "unknown",
|
|
120
|
+
"mutable": false,
|
|
121
|
+
"complexType": {
|
|
122
|
+
"original": "ValidationSchema",
|
|
123
|
+
"resolved": "ValidationSchema",
|
|
124
|
+
"references": {
|
|
125
|
+
"ValidationSchema": {
|
|
126
|
+
"location": "import",
|
|
127
|
+
"path": "../../utils/types"
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
"required": false,
|
|
132
|
+
"optional": false,
|
|
133
|
+
"docs": {
|
|
134
|
+
"tags": [],
|
|
135
|
+
"text": "Object of validation rules for the input."
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
"language": {
|
|
139
|
+
"type": "string",
|
|
140
|
+
"mutable": false,
|
|
141
|
+
"complexType": {
|
|
142
|
+
"original": "string",
|
|
143
|
+
"resolved": "string",
|
|
144
|
+
"references": {}
|
|
145
|
+
},
|
|
146
|
+
"required": false,
|
|
147
|
+
"optional": false,
|
|
148
|
+
"docs": {
|
|
149
|
+
"tags": [],
|
|
150
|
+
"text": "Currently selected language."
|
|
151
|
+
},
|
|
152
|
+
"attribute": "language",
|
|
153
|
+
"reflect": false
|
|
154
|
+
},
|
|
155
|
+
"checkValidity": {
|
|
156
|
+
"type": "boolean",
|
|
157
|
+
"mutable": false,
|
|
158
|
+
"complexType": {
|
|
159
|
+
"original": "boolean",
|
|
160
|
+
"resolved": "boolean",
|
|
161
|
+
"references": {}
|
|
162
|
+
},
|
|
163
|
+
"required": false,
|
|
164
|
+
"optional": false,
|
|
165
|
+
"docs": {
|
|
166
|
+
"tags": [],
|
|
167
|
+
"text": "State passed down from the parent element. Will trigger the input to check for validity."
|
|
168
|
+
},
|
|
169
|
+
"attribute": "check-validity",
|
|
170
|
+
"reflect": false
|
|
171
|
+
},
|
|
172
|
+
"emitValue": {
|
|
173
|
+
"type": "boolean",
|
|
174
|
+
"mutable": false,
|
|
175
|
+
"complexType": {
|
|
176
|
+
"original": "boolean",
|
|
177
|
+
"resolved": "boolean",
|
|
178
|
+
"references": {}
|
|
179
|
+
},
|
|
180
|
+
"required": false,
|
|
181
|
+
"optional": false,
|
|
182
|
+
"docs": {
|
|
183
|
+
"tags": [],
|
|
184
|
+
"text": "State passed down from the parent element. Will trigger the input to send it's value through an event."
|
|
185
|
+
},
|
|
186
|
+
"attribute": "emit-value",
|
|
187
|
+
"reflect": false
|
|
188
|
+
}
|
|
189
|
+
}; }
|
|
190
|
+
static get states() { return {
|
|
191
|
+
"errorMessage": {},
|
|
192
|
+
"isValid": {}
|
|
193
|
+
}; }
|
|
194
|
+
static get events() { return [{
|
|
195
|
+
"method": "sendInputValue",
|
|
196
|
+
"name": "sendInputValue",
|
|
197
|
+
"bubbles": true,
|
|
198
|
+
"cancelable": true,
|
|
199
|
+
"composed": true,
|
|
200
|
+
"docs": {
|
|
201
|
+
"tags": [],
|
|
202
|
+
"text": ""
|
|
203
|
+
},
|
|
204
|
+
"complexType": {
|
|
205
|
+
"original": "InputValueEvent",
|
|
206
|
+
"resolved": "InputValueEvent",
|
|
207
|
+
"references": {
|
|
208
|
+
"InputValueEvent": {
|
|
209
|
+
"location": "import",
|
|
210
|
+
"path": "../../utils/types"
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
}, {
|
|
215
|
+
"method": "sendValidityState",
|
|
216
|
+
"name": "sendValidityState",
|
|
217
|
+
"bubbles": true,
|
|
218
|
+
"cancelable": true,
|
|
219
|
+
"composed": true,
|
|
220
|
+
"docs": {
|
|
221
|
+
"tags": [],
|
|
222
|
+
"text": ""
|
|
223
|
+
},
|
|
224
|
+
"complexType": {
|
|
225
|
+
"original": "InputStateEvent",
|
|
226
|
+
"resolved": "InputStateEvent",
|
|
227
|
+
"references": {
|
|
228
|
+
"InputStateEvent": {
|
|
229
|
+
"location": "import",
|
|
230
|
+
"path": "../../utils/types"
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
}]; }
|
|
235
|
+
static get watchers() { return [{
|
|
236
|
+
"propName": "checkValidity",
|
|
237
|
+
"methodName": "checkValidityHandler"
|
|
238
|
+
}, {
|
|
239
|
+
"propName": "isValid",
|
|
240
|
+
"methodName": "validityChanged"
|
|
241
|
+
}, {
|
|
242
|
+
"propName": "emitValue",
|
|
243
|
+
"methodName": "emitValueHandler"
|
|
244
|
+
}]; }
|
|
245
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
*,
|
|
2
|
+
*::before,
|
|
3
|
+
*::after {
|
|
4
|
+
padding: 0;
|
|
5
|
+
margin: 0;
|
|
6
|
+
box-sizing: border-box;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.select__wrapper {
|
|
10
|
+
position: relative;
|
|
11
|
+
display: flex;
|
|
12
|
+
padding-top: 10px;
|
|
13
|
+
width: 100%;
|
|
14
|
+
}
|
|
15
|
+
.select__label {
|
|
16
|
+
color: #474747;
|
|
17
|
+
font-size: 16px;
|
|
18
|
+
position: absolute;
|
|
19
|
+
bottom: 15px;
|
|
20
|
+
left: 5px;
|
|
21
|
+
transform: translateY(-25px);
|
|
22
|
+
transition: all 0.3s cubic-bezier(0.5, 0, 0.5, 1);
|
|
23
|
+
}
|
|
24
|
+
.select__label--hidden {
|
|
25
|
+
opacity: 0;
|
|
26
|
+
visibility: hidden;
|
|
27
|
+
transform: translateY(0);
|
|
28
|
+
}
|
|
29
|
+
.select__input {
|
|
30
|
+
width: inherit;
|
|
31
|
+
padding: 15px 6px;
|
|
32
|
+
position: relative;
|
|
33
|
+
border: none;
|
|
34
|
+
border-bottom: 3px solid #666666;
|
|
35
|
+
background-color: transparent;
|
|
36
|
+
color: #666666;
|
|
37
|
+
font-size: 16px;
|
|
38
|
+
font-family: inherit;
|
|
39
|
+
}
|
|
40
|
+
.select__input:focus {
|
|
41
|
+
outline: none;
|
|
42
|
+
box-shadow: 0 5px 5px rgba(16, 15, 15, 0.1);
|
|
43
|
+
}
|
|
44
|
+
.select__error-message {
|
|
45
|
+
position: absolute;
|
|
46
|
+
top: calc(100% + 5px);
|
|
47
|
+
left: 0;
|
|
48
|
+
color: #cc0000;
|
|
49
|
+
}
|
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
import { Component, h, Prop, State, Watch, Event } from '@stencil/core';
|
|
2
|
+
import { translate } from '../../utils/locale.utils';
|
|
3
|
+
export class SelectInput {
|
|
4
|
+
constructor() {
|
|
5
|
+
/**
|
|
6
|
+
* Options of the input.
|
|
7
|
+
*/
|
|
8
|
+
this.options = [];
|
|
9
|
+
}
|
|
10
|
+
checkValidityHandler(newValue) {
|
|
11
|
+
if (newValue == true) {
|
|
12
|
+
this.isValid = this.setValidity();
|
|
13
|
+
this.errorMessage = this.setErrorMessage();
|
|
14
|
+
this.validityStateHandler({ valid: this.isValid, name: this.name });
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
validityChanged() {
|
|
18
|
+
if (this.checkValidity == true) {
|
|
19
|
+
this.validityStateHandler({ valid: this.isValid, name: this.name });
|
|
20
|
+
}
|
|
21
|
+
if (this.emitValue == true) {
|
|
22
|
+
this.valueHandler({ name: this.name, value: this.value });
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
validityStateHandler(inputStateEvent) {
|
|
26
|
+
this.sendValidityState.emit(inputStateEvent);
|
|
27
|
+
}
|
|
28
|
+
emitValueHandler(newValue) {
|
|
29
|
+
if (newValue == true && this.isValid) {
|
|
30
|
+
this.valueHandler({ name: this.name, value: this.value });
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
valueHandler(inputValueEvent) {
|
|
34
|
+
this.sendInputValue.emit(inputValueEvent);
|
|
35
|
+
}
|
|
36
|
+
connectedCallback() {
|
|
37
|
+
this.displayedOptions = this.options;
|
|
38
|
+
console.log(this.displayedOptions);
|
|
39
|
+
}
|
|
40
|
+
componentWillLoad() {
|
|
41
|
+
console.log(this.action, this.options);
|
|
42
|
+
if (this.action && !this.options.length) {
|
|
43
|
+
if (this.action.split(" ")[0] == 'GET') {
|
|
44
|
+
return this.getOptions().then((options) => {
|
|
45
|
+
this.displayedOptions = options.countries.map(option => {
|
|
46
|
+
return { label: option.Name, value: option.Alpha2Code };
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
getOptions() {
|
|
53
|
+
// TEMPORARY FOR DEMO PURPOSES UNTIL NORWAY CONFIGURES AN ACTUAL ENDPOINT...
|
|
54
|
+
const url = new URL("https://demo-api.stage.norway.everymatrix.com/v1/player/countries");
|
|
55
|
+
return new Promise((resolve, reject) => {
|
|
56
|
+
fetch(url.href)
|
|
57
|
+
.then((res) => res.json())
|
|
58
|
+
.then((options) => {
|
|
59
|
+
resolve(options);
|
|
60
|
+
}).catch((err) => {
|
|
61
|
+
console.error(err);
|
|
62
|
+
reject(err);
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
handleChange(event) {
|
|
67
|
+
this.value = event.target.value;
|
|
68
|
+
this.errorMessage = this.setErrorMessage();
|
|
69
|
+
this.isValid = this.setValidity();
|
|
70
|
+
this.inputReference.previousElementSibling.classList.remove('select__label--hidden');
|
|
71
|
+
console.log(this.action, this.options);
|
|
72
|
+
}
|
|
73
|
+
setValidity() {
|
|
74
|
+
return this.inputReference.validity.valid;
|
|
75
|
+
}
|
|
76
|
+
setErrorMessage() {
|
|
77
|
+
if (this.inputReference.validity.valueMissing) {
|
|
78
|
+
return translate('requiredError', this.language);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
render() {
|
|
82
|
+
console.log('RENDER');
|
|
83
|
+
return h("div", { class: 'select__wrapper' },
|
|
84
|
+
h("label", { class: 'select__label select__label--hidden', htmlFor: `${this.name}__input` },
|
|
85
|
+
this.displayName,
|
|
86
|
+
":"),
|
|
87
|
+
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) },
|
|
88
|
+
h("option", { value: "", selected: true, disabled: true },
|
|
89
|
+
" ",
|
|
90
|
+
this.displayName,
|
|
91
|
+
" "),
|
|
92
|
+
this.displayedOptions.map(option => {
|
|
93
|
+
return h("option", { value: option.value },
|
|
94
|
+
" ",
|
|
95
|
+
option.label,
|
|
96
|
+
" ");
|
|
97
|
+
})),
|
|
98
|
+
h("small", { class: 'select__error-message' }, this.errorMessage));
|
|
99
|
+
}
|
|
100
|
+
static get is() { return "select-input"; }
|
|
101
|
+
static get encapsulation() { return "shadow"; }
|
|
102
|
+
static get originalStyleUrls() { return {
|
|
103
|
+
"$": ["select-input.scss"]
|
|
104
|
+
}; }
|
|
105
|
+
static get styleUrls() { return {
|
|
106
|
+
"$": ["select-input.css"]
|
|
107
|
+
}; }
|
|
108
|
+
static get properties() { return {
|
|
109
|
+
"name": {
|
|
110
|
+
"type": "string",
|
|
111
|
+
"mutable": false,
|
|
112
|
+
"complexType": {
|
|
113
|
+
"original": "string",
|
|
114
|
+
"resolved": "string",
|
|
115
|
+
"references": {}
|
|
116
|
+
},
|
|
117
|
+
"required": false,
|
|
118
|
+
"optional": false,
|
|
119
|
+
"docs": {
|
|
120
|
+
"tags": [],
|
|
121
|
+
"text": "Name of the input."
|
|
122
|
+
},
|
|
123
|
+
"attribute": "name",
|
|
124
|
+
"reflect": false
|
|
125
|
+
},
|
|
126
|
+
"displayName": {
|
|
127
|
+
"type": "string",
|
|
128
|
+
"mutable": false,
|
|
129
|
+
"complexType": {
|
|
130
|
+
"original": "string",
|
|
131
|
+
"resolved": "string",
|
|
132
|
+
"references": {}
|
|
133
|
+
},
|
|
134
|
+
"required": false,
|
|
135
|
+
"optional": false,
|
|
136
|
+
"docs": {
|
|
137
|
+
"tags": [],
|
|
138
|
+
"text": "Name of input to be shown to the user."
|
|
139
|
+
},
|
|
140
|
+
"attribute": "display-name",
|
|
141
|
+
"reflect": false
|
|
142
|
+
},
|
|
143
|
+
"action": {
|
|
144
|
+
"type": "string",
|
|
145
|
+
"mutable": false,
|
|
146
|
+
"complexType": {
|
|
147
|
+
"original": "string",
|
|
148
|
+
"resolved": "string",
|
|
149
|
+
"references": {}
|
|
150
|
+
},
|
|
151
|
+
"required": false,
|
|
152
|
+
"optional": false,
|
|
153
|
+
"docs": {
|
|
154
|
+
"tags": [],
|
|
155
|
+
"text": "Special behaviour an input should have. Can be fetching for data."
|
|
156
|
+
},
|
|
157
|
+
"attribute": "action",
|
|
158
|
+
"reflect": false
|
|
159
|
+
},
|
|
160
|
+
"options": {
|
|
161
|
+
"type": "unknown",
|
|
162
|
+
"mutable": false,
|
|
163
|
+
"complexType": {
|
|
164
|
+
"original": "Option[]",
|
|
165
|
+
"resolved": "Option[]",
|
|
166
|
+
"references": {
|
|
167
|
+
"Option": {
|
|
168
|
+
"location": "import",
|
|
169
|
+
"path": "../../utils/types"
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
},
|
|
173
|
+
"required": false,
|
|
174
|
+
"optional": false,
|
|
175
|
+
"docs": {
|
|
176
|
+
"tags": [],
|
|
177
|
+
"text": "Options of the input."
|
|
178
|
+
},
|
|
179
|
+
"defaultValue": "[]"
|
|
180
|
+
},
|
|
181
|
+
"validation": {
|
|
182
|
+
"type": "unknown",
|
|
183
|
+
"mutable": false,
|
|
184
|
+
"complexType": {
|
|
185
|
+
"original": "ValidationSchema",
|
|
186
|
+
"resolved": "ValidationSchema",
|
|
187
|
+
"references": {
|
|
188
|
+
"ValidationSchema": {
|
|
189
|
+
"location": "import",
|
|
190
|
+
"path": "../../utils/types"
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
},
|
|
194
|
+
"required": false,
|
|
195
|
+
"optional": false,
|
|
196
|
+
"docs": {
|
|
197
|
+
"tags": [],
|
|
198
|
+
"text": "Object of validation rules for the input."
|
|
199
|
+
}
|
|
200
|
+
},
|
|
201
|
+
"language": {
|
|
202
|
+
"type": "string",
|
|
203
|
+
"mutable": false,
|
|
204
|
+
"complexType": {
|
|
205
|
+
"original": "string",
|
|
206
|
+
"resolved": "string",
|
|
207
|
+
"references": {}
|
|
208
|
+
},
|
|
209
|
+
"required": false,
|
|
210
|
+
"optional": false,
|
|
211
|
+
"docs": {
|
|
212
|
+
"tags": [],
|
|
213
|
+
"text": "Currently selected language."
|
|
214
|
+
},
|
|
215
|
+
"attribute": "language",
|
|
216
|
+
"reflect": false
|
|
217
|
+
},
|
|
218
|
+
"checkValidity": {
|
|
219
|
+
"type": "boolean",
|
|
220
|
+
"mutable": false,
|
|
221
|
+
"complexType": {
|
|
222
|
+
"original": "boolean",
|
|
223
|
+
"resolved": "boolean",
|
|
224
|
+
"references": {}
|
|
225
|
+
},
|
|
226
|
+
"required": false,
|
|
227
|
+
"optional": false,
|
|
228
|
+
"docs": {
|
|
229
|
+
"tags": [],
|
|
230
|
+
"text": "State passed down from the parent element. Will trigger the input to check for validity."
|
|
231
|
+
},
|
|
232
|
+
"attribute": "check-validity",
|
|
233
|
+
"reflect": false
|
|
234
|
+
},
|
|
235
|
+
"emitValue": {
|
|
236
|
+
"type": "boolean",
|
|
237
|
+
"mutable": false,
|
|
238
|
+
"complexType": {
|
|
239
|
+
"original": "boolean",
|
|
240
|
+
"resolved": "boolean",
|
|
241
|
+
"references": {}
|
|
242
|
+
},
|
|
243
|
+
"required": false,
|
|
244
|
+
"optional": false,
|
|
245
|
+
"docs": {
|
|
246
|
+
"tags": [],
|
|
247
|
+
"text": "State passed down from the parent element. Will trigger the input to send it's value through an event."
|
|
248
|
+
},
|
|
249
|
+
"attribute": "emit-value",
|
|
250
|
+
"reflect": false
|
|
251
|
+
}
|
|
252
|
+
}; }
|
|
253
|
+
static get states() { return {
|
|
254
|
+
"errorMessage": {},
|
|
255
|
+
"isValid": {}
|
|
256
|
+
}; }
|
|
257
|
+
static get events() { return [{
|
|
258
|
+
"method": "sendValidityState",
|
|
259
|
+
"name": "sendValidityState",
|
|
260
|
+
"bubbles": true,
|
|
261
|
+
"cancelable": true,
|
|
262
|
+
"composed": true,
|
|
263
|
+
"docs": {
|
|
264
|
+
"tags": [],
|
|
265
|
+
"text": ""
|
|
266
|
+
},
|
|
267
|
+
"complexType": {
|
|
268
|
+
"original": "InputStateEvent",
|
|
269
|
+
"resolved": "InputStateEvent",
|
|
270
|
+
"references": {
|
|
271
|
+
"InputStateEvent": {
|
|
272
|
+
"location": "import",
|
|
273
|
+
"path": "../../utils/types"
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
}, {
|
|
278
|
+
"method": "sendInputValue",
|
|
279
|
+
"name": "sendInputValue",
|
|
280
|
+
"bubbles": true,
|
|
281
|
+
"cancelable": true,
|
|
282
|
+
"composed": true,
|
|
283
|
+
"docs": {
|
|
284
|
+
"tags": [],
|
|
285
|
+
"text": ""
|
|
286
|
+
},
|
|
287
|
+
"complexType": {
|
|
288
|
+
"original": "InputValueEvent",
|
|
289
|
+
"resolved": "InputValueEvent",
|
|
290
|
+
"references": {
|
|
291
|
+
"InputValueEvent": {
|
|
292
|
+
"location": "import",
|
|
293
|
+
"path": "../../utils/types"
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
}]; }
|
|
298
|
+
static get watchers() { return [{
|
|
299
|
+
"propName": "checkValidity",
|
|
300
|
+
"methodName": "checkValidityHandler"
|
|
301
|
+
}, {
|
|
302
|
+
"propName": "isValid",
|
|
303
|
+
"methodName": "validityChanged"
|
|
304
|
+
}, {
|
|
305
|
+
"propName": "emitValue",
|
|
306
|
+
"methodName": "emitValueHandler"
|
|
307
|
+
}]; }
|
|
308
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
*,
|
|
2
|
+
*::before,
|
|
3
|
+
*::after {
|
|
4
|
+
padding: 0;
|
|
5
|
+
margin: 0;
|
|
6
|
+
box-sizing: border-box;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.tel__wrapper {
|
|
10
|
+
position: relative;
|
|
11
|
+
display: flex;
|
|
12
|
+
flex-direction: column-reverse;
|
|
13
|
+
padding-top: 10px;
|
|
14
|
+
}
|
|
15
|
+
.tel__label {
|
|
16
|
+
color: #474747;
|
|
17
|
+
font-size: 16px;
|
|
18
|
+
position: absolute;
|
|
19
|
+
bottom: 15px;
|
|
20
|
+
left: 5px;
|
|
21
|
+
transform: translateY(-25px);
|
|
22
|
+
transition: all 0.3s cubic-bezier(0.5, 0, 0.5, 1);
|
|
23
|
+
}
|
|
24
|
+
.tel__label--required::after {
|
|
25
|
+
content: "*";
|
|
26
|
+
margin-left: 5px;
|
|
27
|
+
color: #666666;
|
|
28
|
+
}
|
|
29
|
+
.tel__input {
|
|
30
|
+
width: inherit;
|
|
31
|
+
padding: 15px 6px;
|
|
32
|
+
position: relative;
|
|
33
|
+
border: none;
|
|
34
|
+
border-bottom: 3px solid #666666;
|
|
35
|
+
background-color: transparent;
|
|
36
|
+
color: #666666;
|
|
37
|
+
font-size: 16px;
|
|
38
|
+
font-family: inherit;
|
|
39
|
+
/* Firefox */
|
|
40
|
+
-moz-appearance: textfield;
|
|
41
|
+
/* Chrome, Safari, Edge, Opera */
|
|
42
|
+
}
|
|
43
|
+
.tel__input::-webkit-outer-spin-button, .tel__input::-webkit-inner-spin-button {
|
|
44
|
+
-webkit-appearance: none;
|
|
45
|
+
margin: 0;
|
|
46
|
+
}
|
|
47
|
+
.tel__input:focus {
|
|
48
|
+
outline: none;
|
|
49
|
+
box-shadow: 0 5px 5px rgba(16, 15, 15, 0.1);
|
|
50
|
+
}
|
|
51
|
+
.tel__input::placeholder {
|
|
52
|
+
color: #666666;
|
|
53
|
+
}
|
|
54
|
+
.tel__input--invalid {
|
|
55
|
+
border-bottom: 3px solid #cc0000;
|
|
56
|
+
}
|
|
57
|
+
.tel__input:placeholder-shown + .tel__label {
|
|
58
|
+
opacity: 0;
|
|
59
|
+
visibility: hidden;
|
|
60
|
+
transform: translateY(0);
|
|
61
|
+
}
|
|
62
|
+
.tel__error-message {
|
|
63
|
+
position: absolute;
|
|
64
|
+
top: calc(100% + 5px);
|
|
65
|
+
left: 0;
|
|
66
|
+
color: #cc0000;
|
|
67
|
+
}
|