@everymatrix/general-input-hsl 0.0.1
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/app-globals-3a1e7e63.js +5 -0
- package/dist/cjs/checkbox-group-input_13.cjs.entry.js +7303 -0
- package/dist/cjs/general-input-hsl-2832e412.js +5800 -0
- package/dist/cjs/general-input-hsl.cjs.js +25 -0
- package/dist/cjs/index-6f821b8d.js +1299 -0
- package/dist/cjs/index.cjs.js +10 -0
- package/dist/cjs/loader.cjs.js +15 -0
- package/dist/collection/collection-manifest.json +24 -0
- package/dist/collection/components/checkbox-group-input/checkbox-group-input.css +89 -0
- package/dist/collection/components/checkbox-group-input/checkbox-group-input.js +390 -0
- package/dist/collection/components/checkbox-input/checkbox-input.css +78 -0
- package/dist/collection/components/checkbox-input/checkbox-input.js +344 -0
- package/dist/collection/components/date-input/date-input.css +101 -0
- package/dist/collection/components/date-input/date-input.js +466 -0
- package/dist/collection/components/email-input/email-input.css +95 -0
- package/dist/collection/components/email-input/email-input.js +429 -0
- package/dist/collection/components/general-input-hsl/general-input-hsl.css +4 -0
- package/dist/collection/components/general-input-hsl/general-input-hsl.js +438 -0
- package/dist/collection/components/general-input-hsl/index.js +1 -0
- package/dist/collection/components/number-input/number-input.css +102 -0
- package/dist/collection/components/number-input/number-input.js +393 -0
- package/dist/collection/components/password-input/password-input.css +193 -0
- package/dist/collection/components/password-input/password-input.js +573 -0
- package/dist/collection/components/radio-input/radio-input.css +43 -0
- package/dist/collection/components/radio-input/radio-input.js +319 -0
- package/dist/collection/components/select-input/select-input.css +121 -0
- package/dist/collection/components/select-input/select-input.js +488 -0
- package/dist/collection/components/tel-input/tel-input.css +145 -0
- package/dist/collection/components/tel-input/tel-input.js +468 -0
- package/dist/collection/components/text-input/text-input.css +97 -0
- package/dist/collection/components/text-input/text-input.js +489 -0
- package/dist/collection/components/toggle-checkbox-input/toggle-checkbox-input.css +82 -0
- package/dist/collection/components/toggle-checkbox-input/toggle-checkbox-input.js +366 -0
- package/dist/collection/components/twofa-input/twofa-input.css +56 -0
- package/dist/collection/components/twofa-input/twofa-input.js +495 -0
- package/dist/collection/index.js +1 -0
- package/dist/collection/utils/locale.utils.js +81 -0
- package/dist/collection/utils/tooltipIcon.svg +5 -0
- package/dist/collection/utils/types.js +1 -0
- package/dist/collection/utils/utils.js +3 -0
- package/dist/esm/app-globals-0f993ce5.js +3 -0
- package/dist/esm/checkbox-group-input_13.entry.js +7288 -0
- package/dist/esm/general-input-hsl-31f19ad0.js +5797 -0
- package/dist/esm/general-input-hsl.js +20 -0
- package/dist/esm/index-8598bfb7.js +1270 -0
- package/dist/esm/index.js +2 -0
- package/dist/esm/loader.js +11 -0
- package/dist/general-input-hsl/app-globals-0f993ce5.js +1 -0
- package/dist/general-input-hsl/checkbox-group-input_13.entry.js +1 -0
- package/dist/general-input-hsl/general-input-hsl-31f19ad0.js +5614 -0
- package/dist/general-input-hsl/general-input-hsl.esm.js +1 -0
- package/dist/general-input-hsl/index-8598bfb7.js +2 -0
- package/dist/general-input-hsl/index.esm.js +1 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/stencil.config.dev.js +19 -0
- package/dist/stencil.config.js +19 -0
- package/dist/storybook/main.js +43 -0
- package/dist/storybook/preview.js +9 -0
- package/dist/types/Users/maria.bumbar/Desktop/Widgets & Template/widgets-monorepo/packages/stencil/general-input-hsl/.stencil/libs/common/src/storybook/storybook-utils.d.ts +39 -0
- package/dist/types/Users/maria.bumbar/Desktop/Widgets & Template/widgets-monorepo/packages/stencil/general-input-hsl/.stencil/packages/stencil/general-input-hsl/stencil.config.d.ts +2 -0
- package/dist/types/Users/maria.bumbar/Desktop/Widgets & Template/widgets-monorepo/packages/stencil/general-input-hsl/.stencil/packages/stencil/general-input-hsl/stencil.config.dev.d.ts +2 -0
- package/dist/types/Users/maria.bumbar/Desktop/Widgets & Template/widgets-monorepo/packages/stencil/general-input-hsl/.stencil/packages/stencil/general-input-hsl/storybook/main.d.ts +3 -0
- package/dist/types/Users/maria.bumbar/Desktop/Widgets & Template/widgets-monorepo/packages/stencil/general-input-hsl/.stencil/packages/stencil/general-input-hsl/storybook/preview.d.ts +70 -0
- package/dist/types/Users/maria.bumbar/Desktop/Widgets & Template/widgets-monorepo/packages/stencil/general-input-hsl/.stencil/tools/plugins/index.d.ts +3 -0
- package/dist/types/Users/maria.bumbar/Desktop/Widgets & Template/widgets-monorepo/packages/stencil/general-input-hsl/.stencil/tools/plugins/stencil-clean-deps-plugin.d.ts +5 -0
- package/dist/types/Users/maria.bumbar/Desktop/Widgets & Template/widgets-monorepo/packages/stencil/general-input-hsl/.stencil/tools/plugins/vite-chunk-plugin.d.ts +6 -0
- package/dist/types/Users/maria.bumbar/Desktop/Widgets & Template/widgets-monorepo/packages/stencil/general-input-hsl/.stencil/tools/plugins/vite-clean-deps-plugin.d.ts +4 -0
- package/dist/types/components/checkbox-group-input/checkbox-group-input.d.ts +74 -0
- package/dist/types/components/checkbox-input/checkbox-input.d.ts +67 -0
- package/dist/types/components/date-input/date-input.d.ts +89 -0
- package/dist/types/components/email-input/email-input.d.ts +81 -0
- package/dist/types/components/general-input-hsl/general-input-hsl.d.ts +84 -0
- package/dist/types/components/general-input-hsl/index.d.ts +1 -0
- package/dist/types/components/number-input/number-input.d.ts +75 -0
- package/dist/types/components/password-input/password-input.d.ts +97 -0
- package/dist/types/components/radio-input/radio-input.d.ts +60 -0
- package/dist/types/components/select-input/select-input.d.ts +85 -0
- package/dist/types/components/tel-input/tel-input.d.ts +89 -0
- package/dist/types/components/text-input/text-input.d.ts +86 -0
- package/dist/types/components/toggle-checkbox-input/toggle-checkbox-input.d.ts +73 -0
- package/dist/types/components/twofa-input/twofa-input.d.ts +84 -0
- package/dist/types/components.d.ts +1599 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/stencil-public-runtime.d.ts +1674 -0
- package/dist/types/utils/locale.utils.d.ts +13 -0
- package/dist/types/utils/types.d.ts +111 -0
- package/dist/types/utils/utils.d.ts +1 -0
- package/loader/cdn.js +1 -0
- package/loader/index.cjs.js +1 -0
- package/loader/index.d.ts +24 -0
- package/loader/index.es2017.js +1 -0
- package/loader/index.js +2 -0
- package/loader/package.json +11 -0
- package/package.json +27 -0
|
@@ -0,0 +1,495 @@
|
|
|
1
|
+
import { h } from "@stencil/core";
|
|
2
|
+
import { translate } from "../../utils/locale.utils";
|
|
3
|
+
export class TwofaInput {
|
|
4
|
+
constructor() {
|
|
5
|
+
this.validationPattern = '';
|
|
6
|
+
this.stylingContainer = null;
|
|
7
|
+
this.tooltipReference = null;
|
|
8
|
+
this.tooltipIconReference = null;
|
|
9
|
+
this.inputRefs = [];
|
|
10
|
+
this.containerRef = null;
|
|
11
|
+
this.resendInterval = null;
|
|
12
|
+
this.resendCodeHandler = () => {
|
|
13
|
+
this.triggerResendInterval();
|
|
14
|
+
this.resendCode.emit();
|
|
15
|
+
};
|
|
16
|
+
this.setInputRef = (el, idx) => {
|
|
17
|
+
if (el) {
|
|
18
|
+
this.inputRefs[idx] = el;
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
this.setContainerRef = (el) => {
|
|
22
|
+
if (el) {
|
|
23
|
+
this.containerRef = el;
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
this.triggerResendInterval = () => {
|
|
27
|
+
this.isResendButtonAvailable = false;
|
|
28
|
+
if (this.resendInterval) {
|
|
29
|
+
clearInterval(this.resendInterval);
|
|
30
|
+
}
|
|
31
|
+
this.resendInterval = setInterval(() => {
|
|
32
|
+
if (--this.resendIntervalSecondsLeft <= 0) {
|
|
33
|
+
clearInterval(this.resendInterval);
|
|
34
|
+
this.resendIntervalSecondsLeft = this.resendIntervalSeconds;
|
|
35
|
+
this.isResendButtonAvailable = true;
|
|
36
|
+
}
|
|
37
|
+
}, 1000);
|
|
38
|
+
};
|
|
39
|
+
this.formatTime = () => {
|
|
40
|
+
const minutes = String(Math.floor(this.resendIntervalSecondsLeft / 60));
|
|
41
|
+
let seconds = String(this.resendIntervalSecondsLeft % 60);
|
|
42
|
+
if (seconds.length === 1) {
|
|
43
|
+
seconds = '0' + seconds;
|
|
44
|
+
}
|
|
45
|
+
return `${minutes}:${seconds}`;
|
|
46
|
+
};
|
|
47
|
+
this.handleInput = (e, idx) => {
|
|
48
|
+
const input = e.target;
|
|
49
|
+
const value = input.value;
|
|
50
|
+
if (value.length > 1) {
|
|
51
|
+
input.value = value.charAt(1);
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
input.value = value.charAt(0);
|
|
55
|
+
}
|
|
56
|
+
if (!value) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
this.code[idx] = input.value;
|
|
60
|
+
const nextInput = this.inputRefs[idx + 1];
|
|
61
|
+
if (nextInput) {
|
|
62
|
+
nextInput.focus();
|
|
63
|
+
}
|
|
64
|
+
this.setValidity();
|
|
65
|
+
this.setErrorMessage();
|
|
66
|
+
};
|
|
67
|
+
this.setClientStyling = () => {
|
|
68
|
+
let sheet = document.createElement('style');
|
|
69
|
+
sheet.innerHTML = this.clientStyling;
|
|
70
|
+
this.stylingContainer.prepend(sheet);
|
|
71
|
+
};
|
|
72
|
+
this.name = '';
|
|
73
|
+
this.displayName = '';
|
|
74
|
+
this.placeholder = '';
|
|
75
|
+
this.validation = undefined;
|
|
76
|
+
this.tooltip = '';
|
|
77
|
+
this.language = 'en';
|
|
78
|
+
this.emitValue = true;
|
|
79
|
+
this.destination = '';
|
|
80
|
+
this.resendIntervalSeconds = 60;
|
|
81
|
+
this.clientStyling = '';
|
|
82
|
+
this.limitStylingAppends = false;
|
|
83
|
+
this.isValid = false;
|
|
84
|
+
this.isResendButtonAvailable = true;
|
|
85
|
+
this.showTooltip = false;
|
|
86
|
+
this.errorMessage = '';
|
|
87
|
+
this.code = [];
|
|
88
|
+
this.resendIntervalSecondsLeft = this.resendIntervalSeconds;
|
|
89
|
+
}
|
|
90
|
+
handleStylingChange(newValue, oldValue) {
|
|
91
|
+
if (newValue !== oldValue)
|
|
92
|
+
this.setClientStyling();
|
|
93
|
+
}
|
|
94
|
+
validityChanged() {
|
|
95
|
+
this.validityStateHandler({ valid: this.isValid, name: this.name });
|
|
96
|
+
if (this.emitValue == true) {
|
|
97
|
+
this.valueHandler({ name: this.name, value: this.code.join('') });
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
emitValueHandler(newValue) {
|
|
101
|
+
if (newValue == true && this.isValid) {
|
|
102
|
+
this.valueHandler({ name: this.name, value: this.code.join('') });
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
validityStateHandler(inputStateEvent) {
|
|
106
|
+
this.sendValidityState.emit(inputStateEvent);
|
|
107
|
+
}
|
|
108
|
+
valueHandler(inputValueEvent) {
|
|
109
|
+
this.sendInputValue.emit(inputValueEvent);
|
|
110
|
+
}
|
|
111
|
+
handleClickOutside(event) {
|
|
112
|
+
if (event.composedPath()[0] === this.tooltipIconReference)
|
|
113
|
+
return;
|
|
114
|
+
if (event.composedPath()[0] !== this.tooltipReference)
|
|
115
|
+
this.showTooltip = false;
|
|
116
|
+
}
|
|
117
|
+
connectedCallback() {
|
|
118
|
+
this.validationPattern = this.setPattern();
|
|
119
|
+
this.code = new Array(this.validation.maxLength).fill('');
|
|
120
|
+
}
|
|
121
|
+
componentDidRender() {
|
|
122
|
+
if (!this.limitStylingAppends && this.stylingContainer) {
|
|
123
|
+
if (this.clientStyling) {
|
|
124
|
+
this.setClientStyling();
|
|
125
|
+
}
|
|
126
|
+
this.limitStylingAppends = true;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
componentDidLoad() {
|
|
130
|
+
this.setValidity();
|
|
131
|
+
}
|
|
132
|
+
handleKeyDown(e, idx) {
|
|
133
|
+
if (e.key === 'Backspace') {
|
|
134
|
+
this.code[idx] = '';
|
|
135
|
+
if (this.inputRefs[idx]) {
|
|
136
|
+
this.inputRefs[idx].value = '';
|
|
137
|
+
} // Clear input field
|
|
138
|
+
const prevInput = this.inputRefs[idx - 1];
|
|
139
|
+
if (prevInput) {
|
|
140
|
+
prevInput === null || prevInput === void 0 ? void 0 : prevInput.focus();
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
this.setValidity();
|
|
144
|
+
this.setErrorMessage();
|
|
145
|
+
}
|
|
146
|
+
handlePaste(e) {
|
|
147
|
+
var _a;
|
|
148
|
+
e.preventDefault();
|
|
149
|
+
const data = (_a = e.clipboardData) === null || _a === void 0 ? void 0 : _a.getData('text').trim();
|
|
150
|
+
if (!data) {
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
const value = data.slice(0, this.validation.maxLength).split(''); // Limit to OTP length
|
|
154
|
+
this.code = [...value, ...new Array(this.validation.maxLength - value.length).fill('')];
|
|
155
|
+
value.forEach((char, index) => {
|
|
156
|
+
this.inputRefs[index].value = char;
|
|
157
|
+
});
|
|
158
|
+
// Move focus to the last input or trigger submit
|
|
159
|
+
const lastInput = this.inputRefs[Math.min(value.length, this.inputRefs.length - 1)];
|
|
160
|
+
if (lastInput) {
|
|
161
|
+
lastInput.focus();
|
|
162
|
+
}
|
|
163
|
+
this.setValidity();
|
|
164
|
+
this.setErrorMessage();
|
|
165
|
+
}
|
|
166
|
+
setValidity() {
|
|
167
|
+
const code = this.code.join('');
|
|
168
|
+
const inputMatchLength = code.length === this.validation.maxLength;
|
|
169
|
+
const inputMatchValidation = code.match(this.validationPattern) !== null;
|
|
170
|
+
this.isValid = inputMatchLength && inputMatchValidation;
|
|
171
|
+
}
|
|
172
|
+
setPattern() {
|
|
173
|
+
var _a, _b;
|
|
174
|
+
if (((_a = this.validation.custom) === null || _a === void 0 ? void 0 : _a.length) > 0) {
|
|
175
|
+
return (_b = this.validation.custom.find(customValidation => customValidation.rule === 'regex')) === null || _b === void 0 ? void 0 : _b.pattern;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
setErrorMessage() {
|
|
179
|
+
var _a;
|
|
180
|
+
const inputMatchValidation = this.code.join('').match(this.validationPattern) !== null;
|
|
181
|
+
if (!inputMatchValidation) {
|
|
182
|
+
const errorKey = (_a = this.validation.custom.find(customValidation => customValidation.rule === 'regex')) === null || _a === void 0 ? void 0 : _a.errorKey;
|
|
183
|
+
if (errorKey) {
|
|
184
|
+
this.errorMessage = translate(errorKey, this.language);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
else {
|
|
188
|
+
this.errorMessage = '';
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
renderTooltip() {
|
|
192
|
+
if (this.showTooltip) {
|
|
193
|
+
return h("div", { class: `text__tooltip ${this.showTooltip ? 'visible' : ''}`, ref: (el) => this.tooltipReference = el, innerHTML: this.tooltip });
|
|
194
|
+
}
|
|
195
|
+
return null;
|
|
196
|
+
}
|
|
197
|
+
render() {
|
|
198
|
+
return (h("div", { key: '7ecca2099a381cc85094e079a2f43e975d736cef', class: "twofa" }, h("div", { key: '304e3aed1f98557d39614fb165d12f9a09b00e1f', class: 'twofa__error-message' }, h("p", { key: '7b05b7a203918df3abbecc500547b696e0b621a6' }, this.errorMessage)), h("div", { key: '2bb05986311a53c02a825da485ce66d23fbd38bb', class: "twofa__description", innerHTML: translate('twofaDescription', this.language, { values: { destination: this.destination } }) }), h("div", { key: 'c2761ea3d3528cb33a1aedc8321f425deafd5cfd', class: "twofa__input-wrapper", ref: this.setContainerRef }, this.code.map((char, idx) => {
|
|
199
|
+
return (h("input", { key: idx, ref: el => this.setInputRef(el, idx), id: `otp-input-${idx}`, type: "text", maxLength: 2, value: char, onInput: (event) => this.handleInput(event, idx), onKeyDown: (event) => this.handleKeyDown(event, idx), onPaste: (event) => this.handlePaste(event) }));
|
|
200
|
+
})), h("div", { key: '0478bfdee48cf1a066cf93ac791e82df43eb73f8', class: "twofa__button-wrapper" }, h("p", { key: '7e100b0c404b2b7e7327cf3a29da72d4d6accd7b', class: "twofa__resend-message" }, translate('twofaResendMessage', this.language)), h("button", { key: 'be335e68240059206a284b687c71b0fafd97b997', class: "twofa__resend-button", onClick: this.resendCodeHandler, disabled: !this.isResendButtonAvailable }, this.isResendButtonAvailable
|
|
201
|
+
? translate('twofaResendButton', this.language)
|
|
202
|
+
: this.formatTime()))));
|
|
203
|
+
}
|
|
204
|
+
static get is() { return "twofa-input"; }
|
|
205
|
+
static get encapsulation() { return "shadow"; }
|
|
206
|
+
static get originalStyleUrls() {
|
|
207
|
+
return {
|
|
208
|
+
"$": ["twofa-input.scss"]
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
static get styleUrls() {
|
|
212
|
+
return {
|
|
213
|
+
"$": ["twofa-input.css"]
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
static get properties() {
|
|
217
|
+
return {
|
|
218
|
+
"name": {
|
|
219
|
+
"type": "string",
|
|
220
|
+
"mutable": false,
|
|
221
|
+
"complexType": {
|
|
222
|
+
"original": "string",
|
|
223
|
+
"resolved": "string",
|
|
224
|
+
"references": {}
|
|
225
|
+
},
|
|
226
|
+
"required": false,
|
|
227
|
+
"optional": false,
|
|
228
|
+
"docs": {
|
|
229
|
+
"tags": [],
|
|
230
|
+
"text": "Name of the input."
|
|
231
|
+
},
|
|
232
|
+
"attribute": "name",
|
|
233
|
+
"reflect": true,
|
|
234
|
+
"defaultValue": "''"
|
|
235
|
+
},
|
|
236
|
+
"displayName": {
|
|
237
|
+
"type": "string",
|
|
238
|
+
"mutable": false,
|
|
239
|
+
"complexType": {
|
|
240
|
+
"original": "string",
|
|
241
|
+
"resolved": "string",
|
|
242
|
+
"references": {}
|
|
243
|
+
},
|
|
244
|
+
"required": false,
|
|
245
|
+
"optional": false,
|
|
246
|
+
"docs": {
|
|
247
|
+
"tags": [],
|
|
248
|
+
"text": "Name of input to be shown to the user."
|
|
249
|
+
},
|
|
250
|
+
"attribute": "display-name",
|
|
251
|
+
"reflect": true,
|
|
252
|
+
"defaultValue": "''"
|
|
253
|
+
},
|
|
254
|
+
"placeholder": {
|
|
255
|
+
"type": "string",
|
|
256
|
+
"mutable": false,
|
|
257
|
+
"complexType": {
|
|
258
|
+
"original": "string",
|
|
259
|
+
"resolved": "string",
|
|
260
|
+
"references": {}
|
|
261
|
+
},
|
|
262
|
+
"required": false,
|
|
263
|
+
"optional": false,
|
|
264
|
+
"docs": {
|
|
265
|
+
"tags": [],
|
|
266
|
+
"text": "Placeholder text to be shown."
|
|
267
|
+
},
|
|
268
|
+
"attribute": "placeholder",
|
|
269
|
+
"reflect": true,
|
|
270
|
+
"defaultValue": "''"
|
|
271
|
+
},
|
|
272
|
+
"validation": {
|
|
273
|
+
"type": "unknown",
|
|
274
|
+
"mutable": false,
|
|
275
|
+
"complexType": {
|
|
276
|
+
"original": "ValidationSchema",
|
|
277
|
+
"resolved": "ValidationSchema",
|
|
278
|
+
"references": {
|
|
279
|
+
"ValidationSchema": {
|
|
280
|
+
"location": "import",
|
|
281
|
+
"path": "../../utils/types",
|
|
282
|
+
"id": "../../../../packages/stencil/general-input-hsl/src/utils/types.ts::ValidationSchema"
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
},
|
|
286
|
+
"required": false,
|
|
287
|
+
"optional": false,
|
|
288
|
+
"docs": {
|
|
289
|
+
"tags": [],
|
|
290
|
+
"text": "Object of validation rules for the input."
|
|
291
|
+
}
|
|
292
|
+
},
|
|
293
|
+
"tooltip": {
|
|
294
|
+
"type": "string",
|
|
295
|
+
"mutable": false,
|
|
296
|
+
"complexType": {
|
|
297
|
+
"original": "string",
|
|
298
|
+
"resolved": "string",
|
|
299
|
+
"references": {}
|
|
300
|
+
},
|
|
301
|
+
"required": false,
|
|
302
|
+
"optional": false,
|
|
303
|
+
"docs": {
|
|
304
|
+
"tags": [],
|
|
305
|
+
"text": "Tooltip text."
|
|
306
|
+
},
|
|
307
|
+
"attribute": "tooltip",
|
|
308
|
+
"reflect": true,
|
|
309
|
+
"defaultValue": "''"
|
|
310
|
+
},
|
|
311
|
+
"language": {
|
|
312
|
+
"type": "string",
|
|
313
|
+
"mutable": false,
|
|
314
|
+
"complexType": {
|
|
315
|
+
"original": "string",
|
|
316
|
+
"resolved": "string",
|
|
317
|
+
"references": {}
|
|
318
|
+
},
|
|
319
|
+
"required": false,
|
|
320
|
+
"optional": false,
|
|
321
|
+
"docs": {
|
|
322
|
+
"tags": [],
|
|
323
|
+
"text": "Currently selected language."
|
|
324
|
+
},
|
|
325
|
+
"attribute": "language",
|
|
326
|
+
"reflect": true,
|
|
327
|
+
"defaultValue": "'en'"
|
|
328
|
+
},
|
|
329
|
+
"emitValue": {
|
|
330
|
+
"type": "boolean",
|
|
331
|
+
"mutable": false,
|
|
332
|
+
"complexType": {
|
|
333
|
+
"original": "boolean",
|
|
334
|
+
"resolved": "boolean",
|
|
335
|
+
"references": {}
|
|
336
|
+
},
|
|
337
|
+
"required": false,
|
|
338
|
+
"optional": false,
|
|
339
|
+
"docs": {
|
|
340
|
+
"tags": [],
|
|
341
|
+
"text": "State passed down from the parent element. Will trigger the input to send it's value through an event."
|
|
342
|
+
},
|
|
343
|
+
"attribute": "emit-value",
|
|
344
|
+
"reflect": true,
|
|
345
|
+
"defaultValue": "true"
|
|
346
|
+
},
|
|
347
|
+
"destination": {
|
|
348
|
+
"type": "string",
|
|
349
|
+
"mutable": false,
|
|
350
|
+
"complexType": {
|
|
351
|
+
"original": "string",
|
|
352
|
+
"resolved": "string",
|
|
353
|
+
"references": {}
|
|
354
|
+
},
|
|
355
|
+
"required": false,
|
|
356
|
+
"optional": false,
|
|
357
|
+
"docs": {
|
|
358
|
+
"tags": [],
|
|
359
|
+
"text": "destination where the code is sent, only for display purposes here"
|
|
360
|
+
},
|
|
361
|
+
"attribute": "destination",
|
|
362
|
+
"reflect": true,
|
|
363
|
+
"defaultValue": "''"
|
|
364
|
+
},
|
|
365
|
+
"resendIntervalSeconds": {
|
|
366
|
+
"type": "number",
|
|
367
|
+
"mutable": false,
|
|
368
|
+
"complexType": {
|
|
369
|
+
"original": "number",
|
|
370
|
+
"resolved": "number",
|
|
371
|
+
"references": {}
|
|
372
|
+
},
|
|
373
|
+
"required": false,
|
|
374
|
+
"optional": false,
|
|
375
|
+
"docs": {
|
|
376
|
+
"tags": [],
|
|
377
|
+
"text": "code resend interval in seconds"
|
|
378
|
+
},
|
|
379
|
+
"attribute": "resend-interval-seconds",
|
|
380
|
+
"reflect": true,
|
|
381
|
+
"defaultValue": "60"
|
|
382
|
+
},
|
|
383
|
+
"clientStyling": {
|
|
384
|
+
"type": "string",
|
|
385
|
+
"mutable": false,
|
|
386
|
+
"complexType": {
|
|
387
|
+
"original": "string",
|
|
388
|
+
"resolved": "string",
|
|
389
|
+
"references": {}
|
|
390
|
+
},
|
|
391
|
+
"required": false,
|
|
392
|
+
"optional": false,
|
|
393
|
+
"docs": {
|
|
394
|
+
"tags": [],
|
|
395
|
+
"text": "Client custom styling via inline style"
|
|
396
|
+
},
|
|
397
|
+
"attribute": "client-styling",
|
|
398
|
+
"reflect": true,
|
|
399
|
+
"defaultValue": "''"
|
|
400
|
+
}
|
|
401
|
+
};
|
|
402
|
+
}
|
|
403
|
+
static get states() {
|
|
404
|
+
return {
|
|
405
|
+
"limitStylingAppends": {},
|
|
406
|
+
"isValid": {},
|
|
407
|
+
"isResendButtonAvailable": {},
|
|
408
|
+
"showTooltip": {},
|
|
409
|
+
"errorMessage": {},
|
|
410
|
+
"code": {},
|
|
411
|
+
"resendIntervalSecondsLeft": {}
|
|
412
|
+
};
|
|
413
|
+
}
|
|
414
|
+
static get events() {
|
|
415
|
+
return [{
|
|
416
|
+
"method": "sendValidityState",
|
|
417
|
+
"name": "sendValidityState",
|
|
418
|
+
"bubbles": true,
|
|
419
|
+
"cancelable": true,
|
|
420
|
+
"composed": true,
|
|
421
|
+
"docs": {
|
|
422
|
+
"tags": [],
|
|
423
|
+
"text": ""
|
|
424
|
+
},
|
|
425
|
+
"complexType": {
|
|
426
|
+
"original": "InputStateEvent",
|
|
427
|
+
"resolved": "InputStateEvent",
|
|
428
|
+
"references": {
|
|
429
|
+
"InputStateEvent": {
|
|
430
|
+
"location": "import",
|
|
431
|
+
"path": "../../utils/types",
|
|
432
|
+
"id": "../../../../packages/stencil/general-input-hsl/src/utils/types.ts::InputStateEvent"
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
}, {
|
|
437
|
+
"method": "sendInputValue",
|
|
438
|
+
"name": "sendInputValue",
|
|
439
|
+
"bubbles": true,
|
|
440
|
+
"cancelable": true,
|
|
441
|
+
"composed": true,
|
|
442
|
+
"docs": {
|
|
443
|
+
"tags": [],
|
|
444
|
+
"text": ""
|
|
445
|
+
},
|
|
446
|
+
"complexType": {
|
|
447
|
+
"original": "InputValueEvent",
|
|
448
|
+
"resolved": "InputValueEvent",
|
|
449
|
+
"references": {
|
|
450
|
+
"InputValueEvent": {
|
|
451
|
+
"location": "import",
|
|
452
|
+
"path": "../../utils/types",
|
|
453
|
+
"id": "../../../../packages/stencil/general-input-hsl/src/utils/types.ts::InputValueEvent"
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
}, {
|
|
458
|
+
"method": "resendCode",
|
|
459
|
+
"name": "resendCode",
|
|
460
|
+
"bubbles": true,
|
|
461
|
+
"cancelable": true,
|
|
462
|
+
"composed": true,
|
|
463
|
+
"docs": {
|
|
464
|
+
"tags": [],
|
|
465
|
+
"text": ""
|
|
466
|
+
},
|
|
467
|
+
"complexType": {
|
|
468
|
+
"original": "void",
|
|
469
|
+
"resolved": "void",
|
|
470
|
+
"references": {}
|
|
471
|
+
}
|
|
472
|
+
}];
|
|
473
|
+
}
|
|
474
|
+
static get watchers() {
|
|
475
|
+
return [{
|
|
476
|
+
"propName": "clientStyling",
|
|
477
|
+
"methodName": "handleStylingChange"
|
|
478
|
+
}, {
|
|
479
|
+
"propName": "isValid",
|
|
480
|
+
"methodName": "validityChanged"
|
|
481
|
+
}, {
|
|
482
|
+
"propName": "emitValue",
|
|
483
|
+
"methodName": "emitValueHandler"
|
|
484
|
+
}];
|
|
485
|
+
}
|
|
486
|
+
static get listeners() {
|
|
487
|
+
return [{
|
|
488
|
+
"name": "click",
|
|
489
|
+
"method": "handleClickOutside",
|
|
490
|
+
"target": "document",
|
|
491
|
+
"capture": false,
|
|
492
|
+
"passive": false
|
|
493
|
+
}];
|
|
494
|
+
}
|
|
495
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './components/general-input-hsl';
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
const DEFAULT_LANGUAGE = 'en';
|
|
2
|
+
export const TRANSLATIONS = {
|
|
3
|
+
"en": {
|
|
4
|
+
"dateError": "The selected date should be between {min} and {max}",
|
|
5
|
+
"dateError2": "The selected date is not within the accepted range",
|
|
6
|
+
"dateFormatError": "The selected date has a different format then the one required.",
|
|
7
|
+
"numberLengthError": "The number should be between {min} and {max}",
|
|
8
|
+
"lengthError": "The length should be between {minLength} and {maxLength}",
|
|
9
|
+
"requiredError": "This input is required.",
|
|
10
|
+
"invalidOriginalPasswordError": "Initial password field does not validate all criteria.",
|
|
11
|
+
"invalidPassword": "Password does not meet all criteria",
|
|
12
|
+
"passwordStrength": "Password strength",
|
|
13
|
+
"passwordStrengthWeak": "is not adequate",
|
|
14
|
+
"passwordStrengthStrong": "is adequate",
|
|
15
|
+
"SpecialCharactersNotAllowed": "Should not contain special characters",
|
|
16
|
+
"InvalidEmailFormat": "Invalid email format.",
|
|
17
|
+
"EmailNotMatching": "Emails not matching!",
|
|
18
|
+
"PasswordNotMatching": "Passwords not matching",
|
|
19
|
+
"MustIncludeNumber": "Password must include a number",
|
|
20
|
+
"MustContainCapital": "Password must include a capital letter",
|
|
21
|
+
"MustIncludePunctation": "Password must include punctuation",
|
|
22
|
+
"OnlyNumbers": "The input should contain only digits.",
|
|
23
|
+
"InvalidFieldSize": "The length must be exactly 11 digits.",
|
|
24
|
+
"InvalidDocumentNumber": "Only numerical characters are allowed.",
|
|
25
|
+
"twofaDescription": "<p> We have sent the verification code to <p> {destination}. </p> </p> <p> Please insert the PIN below. </p>",
|
|
26
|
+
"twofaResendMessage": "Didn't receive the verification code?",
|
|
27
|
+
"twofaResendButton": "Resend",
|
|
28
|
+
},
|
|
29
|
+
"hu": {
|
|
30
|
+
"dateError": "A választott dátumnak {min} és {max} között kell lennie",
|
|
31
|
+
"dateError2": "A kiválasztott dátum nincs az elfogadott tartományon belül",
|
|
32
|
+
"dateFormatError": "A kiválasztott dátum formátuma eltér a szükségestől.",
|
|
33
|
+
"numberLengthError": "A számnak {min} és {max} között kell lennie",
|
|
34
|
+
"lengthError": "A hossznak {minLength} és {maxLength} között kell lennie",
|
|
35
|
+
"requiredError": "Ez a beviteli mező kötelező.",
|
|
36
|
+
"invalidOriginalPasswordError": "Initial password field does not validate all criteria.",
|
|
37
|
+
"invalidPassword": "A jelszó nem felel meg minden kritériumnak",
|
|
38
|
+
"passwordStrength": "Jelszó erőssége",
|
|
39
|
+
"passwordStrengthWeak": "nem megfelelő",
|
|
40
|
+
"passwordStrengthStrong": "megfelelő",
|
|
41
|
+
"SpecialCharactersNotAllowed": "Nem tartalmazhat speciális karaktereket",
|
|
42
|
+
"InvalidEmailFormat": "Érvénytelen e-mail formátum.",
|
|
43
|
+
"EmailNotMatching": "Az e-mailek nem egyeznek!",
|
|
44
|
+
"PasswordNotMatching": "A jelszavak nem egyeznek",
|
|
45
|
+
"MustIncludeNumber": "A jelszónak tartalmaznia kell egy számot",
|
|
46
|
+
"MustContainCapital": "A jelszónak tartalmaznia kell egy nagybetűt",
|
|
47
|
+
"MustIncludePunctation": "A jelszónak tartalmaznia kell írásjelet",
|
|
48
|
+
"OnlyNumbers": "Csak számjegyeket tartalmazhat.",
|
|
49
|
+
"InvalidFieldSize": "A hosszúságnak pontosan 11 számjegynek kell lennie.",
|
|
50
|
+
"InvalidDocumentNumber": "Csak számjegyek engedélyezettek.",
|
|
51
|
+
"twofaDescription": "<p> A megerősítő kódot elküldtük a következő címre: <p> {destination}. </p> </p> <p> Kérjük, írja be az alábbi PIN-kódot. </p>",
|
|
52
|
+
"twofaResendMessage": "Nem kapta meg a megerősítő kódot?",
|
|
53
|
+
"twofaResendButton": "Újraküldés"
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
export const translate = (key, customLang, values) => {
|
|
57
|
+
const lang = customLang;
|
|
58
|
+
let translation = TRANSLATIONS[lang !== undefined ? lang : DEFAULT_LANGUAGE][key];
|
|
59
|
+
if (values !== undefined) {
|
|
60
|
+
for (const [key, value] of Object.entries(values.values)) {
|
|
61
|
+
const regex = new RegExp(`{${key}}`, 'g');
|
|
62
|
+
translation = translation.replace(regex, value);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return translation;
|
|
66
|
+
};
|
|
67
|
+
export const getTranslations = (url) => {
|
|
68
|
+
// fetch url, get the data, replace the TRANSLATIONS content
|
|
69
|
+
return new Promise((resolve) => {
|
|
70
|
+
fetch(url)
|
|
71
|
+
.then((res) => res.json())
|
|
72
|
+
.then((data) => {
|
|
73
|
+
Object.keys(data).forEach((item) => {
|
|
74
|
+
for (let key in data[item]) {
|
|
75
|
+
TRANSLATIONS[item][key] = data[item][key];
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
resolve(true);
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|