@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,21 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const index = require('./index-64a5cb7f.js');
|
|
6
|
+
|
|
7
|
+
/*
|
|
8
|
+
Stencil Client Patch Esm v2.15.2 | MIT Licensed | https://stenciljs.com
|
|
9
|
+
*/
|
|
10
|
+
const patchEsm = () => {
|
|
11
|
+
return index.promiseResolve();
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const defineCustomElements = (win, options) => {
|
|
15
|
+
if (typeof window === 'undefined') return Promise.resolve();
|
|
16
|
+
return patchEsm().then(() => {
|
|
17
|
+
return index.bootstrapLazy([["checkbox-input_9.cjs",[[1,"checkbox-input",{"name":[1],"displayName":[1,"display-name"],"validation":[16],"language":[1],"emitValue":[4,"emit-value"],"errorMessage":[32],"isValid":[32]}],[1,"date-input",{"name":[1],"displayName":[1,"display-name"],"validation":[16],"defaultValue":[1,"default-value"],"language":[1],"checkValidity":[4,"check-validity"],"emitValue":[4,"emit-value"],"errorMessage":[32],"isValid":[32]}],[1,"email-input",{"name":[1],"displayName":[1,"display-name"],"validation":[16],"defaultValue":[1,"default-value"],"language":[1],"emitValue":[4,"emit-value"],"checkValidity":[4,"check-validity"],"errorMessage":[32],"isValid":[32]}],[1,"number-input",{"name":[1],"displayName":[1,"display-name"],"validation":[16],"defaultValue":[2,"default-value"],"language":[1],"checkValidity":[4,"check-validity"],"emitValue":[4,"emit-value"],"errorMessage":[32],"isValid":[32]}],[1,"password-input",{"name":[1],"displayName":[1,"display-name"],"validation":[16],"language":[1],"emitValue":[4,"emit-value"],"isValid":[32],"errorMessage":[32]}],[1,"radio-input",{"name":[1],"displayName":[1,"display-name"],"optionsGroup":[16],"validation":[16],"language":[1],"checkValidity":[4,"check-validity"],"emitValue":[4,"emit-value"],"errorMessage":[32],"isValid":[32]}],[1,"select-input",{"name":[1],"displayName":[1,"display-name"],"action":[1],"options":[16],"validation":[16],"language":[1],"checkValidity":[4,"check-validity"],"emitValue":[4,"emit-value"],"errorMessage":[32],"isValid":[32]}],[1,"tel-input",{"name":[1],"displayName":[1,"display-name"],"showLabels":[4,"show-labels"],"action":[1],"validation":[16],"defaultValue":[8,"default-value"],"language":[1],"checkValidity":[4,"check-validity"],"emitValue":[4,"emit-value"],"isValid":[32],"errorMessage":[32]}],[1,"text-input",{"name":[1025],"displayName":[1,"display-name"],"validation":[16],"defaultValue":[1025,"default-value"],"rules":[1],"language":[1],"checkValidity":[4,"check-validity"],"emitValue":[4,"emit-value"],"isValid":[32],"errorMessage":[32]}]]],["general-input.cjs",[[1,"general-input",{"type":[1],"name":[1],"displayName":[1,"display-name"],"action":[1],"validation":[16],"options":[8],"language":[1],"defaultValue":[8,"default-value"],"emitValue":[4,"emit-value"]}]]]], options);
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
exports.defineCustomElements = defineCustomElements;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"entries": [
|
|
3
|
+
"./components/checkbox-input/checkbox-input.js",
|
|
4
|
+
"./components/date-input/date-input.js",
|
|
5
|
+
"./components/email-input/email-input.js",
|
|
6
|
+
"./components/general-input/general-input.js",
|
|
7
|
+
"./components/number-input/number-input.js",
|
|
8
|
+
"./components/password-input/password-input.js",
|
|
9
|
+
"./components/radio-input/radio-input.js",
|
|
10
|
+
"./components/select-input/select-input.js",
|
|
11
|
+
"./components/tel-input/tel-input.js",
|
|
12
|
+
"./components/text-input/text-input.js"
|
|
13
|
+
],
|
|
14
|
+
"compiler": {
|
|
15
|
+
"name": "@stencil/core",
|
|
16
|
+
"version": "2.15.2",
|
|
17
|
+
"typescriptVersion": "4.5.4"
|
|
18
|
+
},
|
|
19
|
+
"collections": [],
|
|
20
|
+
"bundles": []
|
|
21
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
*,
|
|
2
|
+
*::before,
|
|
3
|
+
*::after {
|
|
4
|
+
padding: 0;
|
|
5
|
+
margin: 0;
|
|
6
|
+
box-sizing: border-box;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.checkbox__wrapper {
|
|
10
|
+
display: flex;
|
|
11
|
+
gap: 10px;
|
|
12
|
+
position: relative;
|
|
13
|
+
align-items: baseline;
|
|
14
|
+
}
|
|
15
|
+
.checkbox__error-message {
|
|
16
|
+
position: absolute;
|
|
17
|
+
top: calc(100% + 5px);
|
|
18
|
+
left: 0;
|
|
19
|
+
color: red;
|
|
20
|
+
}
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
import { Component, h, Prop, State, Watch, Event } from '@stencil/core';
|
|
2
|
+
import { translate } from '../../utils/locale.utils';
|
|
3
|
+
export class CheckboxInput {
|
|
4
|
+
validityChanged() {
|
|
5
|
+
this.validityStateHandler({ valid: this.isValid, name: this.name });
|
|
6
|
+
if (this.emitValue == true) {
|
|
7
|
+
this.valueHandler({ name: this.name, value: this.value });
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
validityStateHandler(inputStateEvent) {
|
|
11
|
+
this.sendValidityState.emit(inputStateEvent);
|
|
12
|
+
}
|
|
13
|
+
emitValueHandler(newValue) {
|
|
14
|
+
if (newValue == true && this.isValid) {
|
|
15
|
+
this.valueHandler({ name: this.name, value: this.value });
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
valueHandler(inputValueEvent) {
|
|
19
|
+
this.sendInputValue.emit(inputValueEvent);
|
|
20
|
+
}
|
|
21
|
+
connectedCallback() {
|
|
22
|
+
}
|
|
23
|
+
handleClick() {
|
|
24
|
+
this.value = this.inputReference.checked;
|
|
25
|
+
this.errorMessage = this.setErrorMessage();
|
|
26
|
+
this.isValid = this.setValidity();
|
|
27
|
+
this.validityStateHandler({ valid: this.isValid, name: this.name });
|
|
28
|
+
}
|
|
29
|
+
setValidity() {
|
|
30
|
+
return this.inputReference.validity.valid;
|
|
31
|
+
}
|
|
32
|
+
setErrorMessage() {
|
|
33
|
+
if (this.inputReference.validity.valueMissing) {
|
|
34
|
+
return translate('requiredError', this.language);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
render() {
|
|
38
|
+
return h("div", { class: 'checkbox__wrapper' },
|
|
39
|
+
h("input", { type: "checkbox", id: `${this.name}__input`, ref: (el) => this.inputReference = el, name: this.name, required: this.validation.mandatory, value: 'jdjdj', onClick: () => this.handleClick() }),
|
|
40
|
+
h("label", { htmlFor: `${this.name}__input` },
|
|
41
|
+
this.displayName,
|
|
42
|
+
" ",
|
|
43
|
+
this.validation.mandatory ? '*' : ''),
|
|
44
|
+
h("small", { class: 'checkbox__error-message' }, this.errorMessage));
|
|
45
|
+
}
|
|
46
|
+
static get is() { return "checkbox-input"; }
|
|
47
|
+
static get encapsulation() { return "shadow"; }
|
|
48
|
+
static get originalStyleUrls() { return {
|
|
49
|
+
"$": ["checkbox-input.scss"]
|
|
50
|
+
}; }
|
|
51
|
+
static get styleUrls() { return {
|
|
52
|
+
"$": ["checkbox-input.css"]
|
|
53
|
+
}; }
|
|
54
|
+
static get properties() { return {
|
|
55
|
+
"name": {
|
|
56
|
+
"type": "string",
|
|
57
|
+
"mutable": false,
|
|
58
|
+
"complexType": {
|
|
59
|
+
"original": "string",
|
|
60
|
+
"resolved": "string",
|
|
61
|
+
"references": {}
|
|
62
|
+
},
|
|
63
|
+
"required": false,
|
|
64
|
+
"optional": false,
|
|
65
|
+
"docs": {
|
|
66
|
+
"tags": [],
|
|
67
|
+
"text": "Name of the input."
|
|
68
|
+
},
|
|
69
|
+
"attribute": "name",
|
|
70
|
+
"reflect": false
|
|
71
|
+
},
|
|
72
|
+
"displayName": {
|
|
73
|
+
"type": "string",
|
|
74
|
+
"mutable": false,
|
|
75
|
+
"complexType": {
|
|
76
|
+
"original": "string",
|
|
77
|
+
"resolved": "string",
|
|
78
|
+
"references": {}
|
|
79
|
+
},
|
|
80
|
+
"required": false,
|
|
81
|
+
"optional": false,
|
|
82
|
+
"docs": {
|
|
83
|
+
"tags": [],
|
|
84
|
+
"text": "Name of input to be shown to the user."
|
|
85
|
+
},
|
|
86
|
+
"attribute": "display-name",
|
|
87
|
+
"reflect": false
|
|
88
|
+
},
|
|
89
|
+
"validation": {
|
|
90
|
+
"type": "unknown",
|
|
91
|
+
"mutable": false,
|
|
92
|
+
"complexType": {
|
|
93
|
+
"original": "ValidationSchema",
|
|
94
|
+
"resolved": "ValidationSchema",
|
|
95
|
+
"references": {
|
|
96
|
+
"ValidationSchema": {
|
|
97
|
+
"location": "import",
|
|
98
|
+
"path": "../../utils/types"
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
"required": false,
|
|
103
|
+
"optional": false,
|
|
104
|
+
"docs": {
|
|
105
|
+
"tags": [],
|
|
106
|
+
"text": "Object of validation rules for the input."
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
"language": {
|
|
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": "Currently selected language."
|
|
122
|
+
},
|
|
123
|
+
"attribute": "language",
|
|
124
|
+
"reflect": false
|
|
125
|
+
},
|
|
126
|
+
"emitValue": {
|
|
127
|
+
"type": "boolean",
|
|
128
|
+
"mutable": false,
|
|
129
|
+
"complexType": {
|
|
130
|
+
"original": "boolean",
|
|
131
|
+
"resolved": "boolean",
|
|
132
|
+
"references": {}
|
|
133
|
+
},
|
|
134
|
+
"required": false,
|
|
135
|
+
"optional": false,
|
|
136
|
+
"docs": {
|
|
137
|
+
"tags": [],
|
|
138
|
+
"text": "State passed down from the parent element. Will trigger the input to send it's value through an event."
|
|
139
|
+
},
|
|
140
|
+
"attribute": "emit-value",
|
|
141
|
+
"reflect": false
|
|
142
|
+
}
|
|
143
|
+
}; }
|
|
144
|
+
static get states() { return {
|
|
145
|
+
"errorMessage": {},
|
|
146
|
+
"isValid": {}
|
|
147
|
+
}; }
|
|
148
|
+
static get events() { return [{
|
|
149
|
+
"method": "sendValidityState",
|
|
150
|
+
"name": "sendValidityState",
|
|
151
|
+
"bubbles": true,
|
|
152
|
+
"cancelable": true,
|
|
153
|
+
"composed": true,
|
|
154
|
+
"docs": {
|
|
155
|
+
"tags": [],
|
|
156
|
+
"text": ""
|
|
157
|
+
},
|
|
158
|
+
"complexType": {
|
|
159
|
+
"original": "InputStateEvent",
|
|
160
|
+
"resolved": "InputStateEvent",
|
|
161
|
+
"references": {
|
|
162
|
+
"InputStateEvent": {
|
|
163
|
+
"location": "import",
|
|
164
|
+
"path": "../../utils/types"
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}, {
|
|
169
|
+
"method": "sendInputValue",
|
|
170
|
+
"name": "sendInputValue",
|
|
171
|
+
"bubbles": true,
|
|
172
|
+
"cancelable": true,
|
|
173
|
+
"composed": true,
|
|
174
|
+
"docs": {
|
|
175
|
+
"tags": [],
|
|
176
|
+
"text": ""
|
|
177
|
+
},
|
|
178
|
+
"complexType": {
|
|
179
|
+
"original": "InputValueEvent",
|
|
180
|
+
"resolved": "InputValueEvent",
|
|
181
|
+
"references": {
|
|
182
|
+
"InputValueEvent": {
|
|
183
|
+
"location": "import",
|
|
184
|
+
"path": "../../utils/types"
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
}]; }
|
|
189
|
+
static get watchers() { return [{
|
|
190
|
+
"propName": "isValid",
|
|
191
|
+
"methodName": "validityChanged"
|
|
192
|
+
}, {
|
|
193
|
+
"propName": "emitValue",
|
|
194
|
+
"methodName": "emitValueHandler"
|
|
195
|
+
}]; }
|
|
196
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
*,
|
|
2
|
+
*::before,
|
|
3
|
+
*::after {
|
|
4
|
+
padding: 0;
|
|
5
|
+
margin: 0;
|
|
6
|
+
box-sizing: border-box;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.date__wrapper {
|
|
10
|
+
position: relative;
|
|
11
|
+
display: flex;
|
|
12
|
+
flex-direction: column-reverse;
|
|
13
|
+
padding-top: 10px;
|
|
14
|
+
}
|
|
15
|
+
.date__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
|
+
.date__label--required::after {
|
|
25
|
+
content: "*";
|
|
26
|
+
margin-left: 5px;
|
|
27
|
+
color: #666666;
|
|
28
|
+
}
|
|
29
|
+
.date__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
|
+
.date__input:focus {
|
|
41
|
+
outline: none;
|
|
42
|
+
box-shadow: 0 5px 5px rgba(16, 15, 15, 0.1);
|
|
43
|
+
}
|
|
44
|
+
.date__input::placeholder {
|
|
45
|
+
color: #666666;
|
|
46
|
+
}
|
|
47
|
+
.date__input--invalid {
|
|
48
|
+
border-bottom: 3px solid #cc0000;
|
|
49
|
+
}
|
|
50
|
+
.date__input:placeholder-shown + .date__label {
|
|
51
|
+
opacity: 0;
|
|
52
|
+
visibility: hidden;
|
|
53
|
+
transform: translateY(0);
|
|
54
|
+
}
|
|
55
|
+
.date__error-message {
|
|
56
|
+
position: absolute;
|
|
57
|
+
top: calc(100% + 5px);
|
|
58
|
+
left: 0;
|
|
59
|
+
color: #cc0000;
|
|
60
|
+
}
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
import { Component, h, State, Prop, Watch, Event } from '@stencil/core';
|
|
2
|
+
import { translate } from '../../utils/locale.utils';
|
|
3
|
+
export class DateInput {
|
|
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
|
+
validityStateHandler(inputStateEvent) {
|
|
20
|
+
this.sendValidityState.emit(inputStateEvent);
|
|
21
|
+
}
|
|
22
|
+
emitValueHandler(newValue) {
|
|
23
|
+
if (newValue == true && this.isValid) {
|
|
24
|
+
this.valueHandler({ name: this.name, value: this.value });
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
valueHandler(inputValueEvent) {
|
|
28
|
+
this.sendInputValue.emit(inputValueEvent);
|
|
29
|
+
}
|
|
30
|
+
handleInput(event) {
|
|
31
|
+
this.value = event.target.value;
|
|
32
|
+
this.errorMessage = this.setErrorMessage();
|
|
33
|
+
this.isValid = this.setValidity();
|
|
34
|
+
}
|
|
35
|
+
setValidity() {
|
|
36
|
+
return this.inputReference.validity.valid;
|
|
37
|
+
}
|
|
38
|
+
setErrorMessage() {
|
|
39
|
+
if (this.inputReference.validity.rangeUnderflow || this.inputReference.validity.rangeOverflow) {
|
|
40
|
+
return translate('dateError', this.language, { values: { min: this.validation.min, max: this.validation.max } });
|
|
41
|
+
}
|
|
42
|
+
if (this.inputReference.validity.valueMissing) {
|
|
43
|
+
return translate('requiredError', this.language);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
render() {
|
|
47
|
+
return h("div", { class: 'date__wrapper' },
|
|
48
|
+
h("input", { id: `${this.name}__input`, type: 'date', class: `date__input`, value: this.defaultValue, placeholder: `${this.displayName} ${this.validation.mandatory ? '*' : ''}`, ref: (el) => this.inputReference = el, required: this.validation.mandatory, max: this.validation.max, min: this.validation.min, onInput: (e) => this.handleInput(e) }),
|
|
49
|
+
h("label", { class: `date__label ${this.validation.mandatory ? 'date__label--required' : ''}}`, htmlFor: `${this.name}__input` },
|
|
50
|
+
this.displayName,
|
|
51
|
+
" ",
|
|
52
|
+
this.validation.mandatory ? '*' : ''),
|
|
53
|
+
h("small", { class: 'date__error-message' }, this.errorMessage));
|
|
54
|
+
}
|
|
55
|
+
static get is() { return "date-input"; }
|
|
56
|
+
static get encapsulation() { return "shadow"; }
|
|
57
|
+
static get originalStyleUrls() { return {
|
|
58
|
+
"$": ["date-input.scss"]
|
|
59
|
+
}; }
|
|
60
|
+
static get styleUrls() { return {
|
|
61
|
+
"$": ["date-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
|
+
"validation": {
|
|
99
|
+
"type": "unknown",
|
|
100
|
+
"mutable": false,
|
|
101
|
+
"complexType": {
|
|
102
|
+
"original": "ValidationSchema",
|
|
103
|
+
"resolved": "ValidationSchema",
|
|
104
|
+
"references": {
|
|
105
|
+
"ValidationSchema": {
|
|
106
|
+
"location": "import",
|
|
107
|
+
"path": "../../utils/types"
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
"required": false,
|
|
112
|
+
"optional": false,
|
|
113
|
+
"docs": {
|
|
114
|
+
"tags": [],
|
|
115
|
+
"text": "Object of validation rules for the input."
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
"defaultValue": {
|
|
119
|
+
"type": "string",
|
|
120
|
+
"mutable": false,
|
|
121
|
+
"complexType": {
|
|
122
|
+
"original": "string",
|
|
123
|
+
"resolved": "string",
|
|
124
|
+
"references": {}
|
|
125
|
+
},
|
|
126
|
+
"required": false,
|
|
127
|
+
"optional": false,
|
|
128
|
+
"docs": {
|
|
129
|
+
"tags": [],
|
|
130
|
+
"text": "Default value for the input."
|
|
131
|
+
},
|
|
132
|
+
"attribute": "default-value",
|
|
133
|
+
"reflect": false
|
|
134
|
+
},
|
|
135
|
+
"language": {
|
|
136
|
+
"type": "string",
|
|
137
|
+
"mutable": false,
|
|
138
|
+
"complexType": {
|
|
139
|
+
"original": "string",
|
|
140
|
+
"resolved": "string",
|
|
141
|
+
"references": {}
|
|
142
|
+
},
|
|
143
|
+
"required": false,
|
|
144
|
+
"optional": false,
|
|
145
|
+
"docs": {
|
|
146
|
+
"tags": [],
|
|
147
|
+
"text": "Currently selected language."
|
|
148
|
+
},
|
|
149
|
+
"attribute": "language",
|
|
150
|
+
"reflect": false
|
|
151
|
+
},
|
|
152
|
+
"checkValidity": {
|
|
153
|
+
"type": "boolean",
|
|
154
|
+
"mutable": false,
|
|
155
|
+
"complexType": {
|
|
156
|
+
"original": "boolean",
|
|
157
|
+
"resolved": "boolean",
|
|
158
|
+
"references": {}
|
|
159
|
+
},
|
|
160
|
+
"required": false,
|
|
161
|
+
"optional": false,
|
|
162
|
+
"docs": {
|
|
163
|
+
"tags": [],
|
|
164
|
+
"text": "State passed down from the parent element. Will trigger the input to check for validity."
|
|
165
|
+
},
|
|
166
|
+
"attribute": "check-validity",
|
|
167
|
+
"reflect": false
|
|
168
|
+
},
|
|
169
|
+
"emitValue": {
|
|
170
|
+
"type": "boolean",
|
|
171
|
+
"mutable": false,
|
|
172
|
+
"complexType": {
|
|
173
|
+
"original": "boolean",
|
|
174
|
+
"resolved": "boolean",
|
|
175
|
+
"references": {}
|
|
176
|
+
},
|
|
177
|
+
"required": false,
|
|
178
|
+
"optional": false,
|
|
179
|
+
"docs": {
|
|
180
|
+
"tags": [],
|
|
181
|
+
"text": "State passed down from the parent element. Will trigger the input to send it's value through an event."
|
|
182
|
+
},
|
|
183
|
+
"attribute": "emit-value",
|
|
184
|
+
"reflect": false
|
|
185
|
+
}
|
|
186
|
+
}; }
|
|
187
|
+
static get states() { return {
|
|
188
|
+
"errorMessage": {},
|
|
189
|
+
"isValid": {}
|
|
190
|
+
}; }
|
|
191
|
+
static get events() { return [{
|
|
192
|
+
"method": "sendValidityState",
|
|
193
|
+
"name": "sendValidityState",
|
|
194
|
+
"bubbles": true,
|
|
195
|
+
"cancelable": true,
|
|
196
|
+
"composed": true,
|
|
197
|
+
"docs": {
|
|
198
|
+
"tags": [],
|
|
199
|
+
"text": ""
|
|
200
|
+
},
|
|
201
|
+
"complexType": {
|
|
202
|
+
"original": "InputStateEvent",
|
|
203
|
+
"resolved": "InputStateEvent",
|
|
204
|
+
"references": {
|
|
205
|
+
"InputStateEvent": {
|
|
206
|
+
"location": "import",
|
|
207
|
+
"path": "../../utils/types"
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
}, {
|
|
212
|
+
"method": "sendInputValue",
|
|
213
|
+
"name": "sendInputValue",
|
|
214
|
+
"bubbles": true,
|
|
215
|
+
"cancelable": true,
|
|
216
|
+
"composed": true,
|
|
217
|
+
"docs": {
|
|
218
|
+
"tags": [],
|
|
219
|
+
"text": ""
|
|
220
|
+
},
|
|
221
|
+
"complexType": {
|
|
222
|
+
"original": "InputValueEvent",
|
|
223
|
+
"resolved": "InputValueEvent",
|
|
224
|
+
"references": {
|
|
225
|
+
"InputValueEvent": {
|
|
226
|
+
"location": "import",
|
|
227
|
+
"path": "../../utils/types"
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
}]; }
|
|
232
|
+
static get watchers() { return [{
|
|
233
|
+
"propName": "checkValidity",
|
|
234
|
+
"methodName": "checkValidityHandler"
|
|
235
|
+
}, {
|
|
236
|
+
"propName": "isValid",
|
|
237
|
+
"methodName": "validityChanged"
|
|
238
|
+
}, {
|
|
239
|
+
"propName": "emitValue",
|
|
240
|
+
"methodName": "emitValueHandler"
|
|
241
|
+
}]; }
|
|
242
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
*,
|
|
2
|
+
*::before,
|
|
3
|
+
*::after {
|
|
4
|
+
padding: 0;
|
|
5
|
+
margin: 0;
|
|
6
|
+
box-sizing: border-box;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.email__wrapper {
|
|
10
|
+
position: relative;
|
|
11
|
+
display: flex;
|
|
12
|
+
flex-direction: column-reverse;
|
|
13
|
+
padding-top: 10px;
|
|
14
|
+
}
|
|
15
|
+
.email__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
|
+
.email__label--required::after {
|
|
25
|
+
content: "*";
|
|
26
|
+
margin-left: 5px;
|
|
27
|
+
color: #666666;
|
|
28
|
+
}
|
|
29
|
+
.email__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
|
+
.email__input:focus {
|
|
41
|
+
outline: none;
|
|
42
|
+
box-shadow: 0 5px 5px rgba(16, 15, 15, 0.1);
|
|
43
|
+
}
|
|
44
|
+
.email__input::placeholder {
|
|
45
|
+
color: #666666;
|
|
46
|
+
}
|
|
47
|
+
.email__input--invalid {
|
|
48
|
+
border-bottom: 3px solid #cc0000;
|
|
49
|
+
}
|
|
50
|
+
.email__input:placeholder-shown + .email__label {
|
|
51
|
+
opacity: 0;
|
|
52
|
+
visibility: hidden;
|
|
53
|
+
transform: translateY(0);
|
|
54
|
+
}
|
|
55
|
+
.email__error-message {
|
|
56
|
+
position: absolute;
|
|
57
|
+
top: calc(100% + 5px);
|
|
58
|
+
left: 0;
|
|
59
|
+
color: #cc0000;
|
|
60
|
+
}
|