@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.
Files changed (95) hide show
  1. package/dist/cjs/app-globals-3a1e7e63.js +5 -0
  2. package/dist/cjs/checkbox-group-input_13.cjs.entry.js +7303 -0
  3. package/dist/cjs/general-input-hsl-2832e412.js +5800 -0
  4. package/dist/cjs/general-input-hsl.cjs.js +25 -0
  5. package/dist/cjs/index-6f821b8d.js +1299 -0
  6. package/dist/cjs/index.cjs.js +10 -0
  7. package/dist/cjs/loader.cjs.js +15 -0
  8. package/dist/collection/collection-manifest.json +24 -0
  9. package/dist/collection/components/checkbox-group-input/checkbox-group-input.css +89 -0
  10. package/dist/collection/components/checkbox-group-input/checkbox-group-input.js +390 -0
  11. package/dist/collection/components/checkbox-input/checkbox-input.css +78 -0
  12. package/dist/collection/components/checkbox-input/checkbox-input.js +344 -0
  13. package/dist/collection/components/date-input/date-input.css +101 -0
  14. package/dist/collection/components/date-input/date-input.js +466 -0
  15. package/dist/collection/components/email-input/email-input.css +95 -0
  16. package/dist/collection/components/email-input/email-input.js +429 -0
  17. package/dist/collection/components/general-input-hsl/general-input-hsl.css +4 -0
  18. package/dist/collection/components/general-input-hsl/general-input-hsl.js +438 -0
  19. package/dist/collection/components/general-input-hsl/index.js +1 -0
  20. package/dist/collection/components/number-input/number-input.css +102 -0
  21. package/dist/collection/components/number-input/number-input.js +393 -0
  22. package/dist/collection/components/password-input/password-input.css +193 -0
  23. package/dist/collection/components/password-input/password-input.js +573 -0
  24. package/dist/collection/components/radio-input/radio-input.css +43 -0
  25. package/dist/collection/components/radio-input/radio-input.js +319 -0
  26. package/dist/collection/components/select-input/select-input.css +121 -0
  27. package/dist/collection/components/select-input/select-input.js +488 -0
  28. package/dist/collection/components/tel-input/tel-input.css +145 -0
  29. package/dist/collection/components/tel-input/tel-input.js +468 -0
  30. package/dist/collection/components/text-input/text-input.css +97 -0
  31. package/dist/collection/components/text-input/text-input.js +489 -0
  32. package/dist/collection/components/toggle-checkbox-input/toggle-checkbox-input.css +82 -0
  33. package/dist/collection/components/toggle-checkbox-input/toggle-checkbox-input.js +366 -0
  34. package/dist/collection/components/twofa-input/twofa-input.css +56 -0
  35. package/dist/collection/components/twofa-input/twofa-input.js +495 -0
  36. package/dist/collection/index.js +1 -0
  37. package/dist/collection/utils/locale.utils.js +81 -0
  38. package/dist/collection/utils/tooltipIcon.svg +5 -0
  39. package/dist/collection/utils/types.js +1 -0
  40. package/dist/collection/utils/utils.js +3 -0
  41. package/dist/esm/app-globals-0f993ce5.js +3 -0
  42. package/dist/esm/checkbox-group-input_13.entry.js +7288 -0
  43. package/dist/esm/general-input-hsl-31f19ad0.js +5797 -0
  44. package/dist/esm/general-input-hsl.js +20 -0
  45. package/dist/esm/index-8598bfb7.js +1270 -0
  46. package/dist/esm/index.js +2 -0
  47. package/dist/esm/loader.js +11 -0
  48. package/dist/general-input-hsl/app-globals-0f993ce5.js +1 -0
  49. package/dist/general-input-hsl/checkbox-group-input_13.entry.js +1 -0
  50. package/dist/general-input-hsl/general-input-hsl-31f19ad0.js +5614 -0
  51. package/dist/general-input-hsl/general-input-hsl.esm.js +1 -0
  52. package/dist/general-input-hsl/index-8598bfb7.js +2 -0
  53. package/dist/general-input-hsl/index.esm.js +1 -0
  54. package/dist/index.cjs.js +1 -0
  55. package/dist/index.js +1 -0
  56. package/dist/stencil.config.dev.js +19 -0
  57. package/dist/stencil.config.js +19 -0
  58. package/dist/storybook/main.js +43 -0
  59. package/dist/storybook/preview.js +9 -0
  60. 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
  61. 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
  62. 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
  63. 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
  64. 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
  65. package/dist/types/Users/maria.bumbar/Desktop/Widgets & Template/widgets-monorepo/packages/stencil/general-input-hsl/.stencil/tools/plugins/index.d.ts +3 -0
  66. 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
  67. 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
  68. 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
  69. package/dist/types/components/checkbox-group-input/checkbox-group-input.d.ts +74 -0
  70. package/dist/types/components/checkbox-input/checkbox-input.d.ts +67 -0
  71. package/dist/types/components/date-input/date-input.d.ts +89 -0
  72. package/dist/types/components/email-input/email-input.d.ts +81 -0
  73. package/dist/types/components/general-input-hsl/general-input-hsl.d.ts +84 -0
  74. package/dist/types/components/general-input-hsl/index.d.ts +1 -0
  75. package/dist/types/components/number-input/number-input.d.ts +75 -0
  76. package/dist/types/components/password-input/password-input.d.ts +97 -0
  77. package/dist/types/components/radio-input/radio-input.d.ts +60 -0
  78. package/dist/types/components/select-input/select-input.d.ts +85 -0
  79. package/dist/types/components/tel-input/tel-input.d.ts +89 -0
  80. package/dist/types/components/text-input/text-input.d.ts +86 -0
  81. package/dist/types/components/toggle-checkbox-input/toggle-checkbox-input.d.ts +73 -0
  82. package/dist/types/components/twofa-input/twofa-input.d.ts +84 -0
  83. package/dist/types/components.d.ts +1599 -0
  84. package/dist/types/index.d.ts +1 -0
  85. package/dist/types/stencil-public-runtime.d.ts +1674 -0
  86. package/dist/types/utils/locale.utils.d.ts +13 -0
  87. package/dist/types/utils/types.d.ts +111 -0
  88. package/dist/types/utils/utils.d.ts +1 -0
  89. package/loader/cdn.js +1 -0
  90. package/loader/index.cjs.js +1 -0
  91. package/loader/index.d.ts +24 -0
  92. package/loader/index.es2017.js +1 -0
  93. package/loader/index.js +2 -0
  94. package/loader/package.json +11 -0
  95. package/package.json +27 -0
@@ -0,0 +1,429 @@
1
+ import { h } from "@stencil/core";
2
+ import { translate } from "../../utils/locale.utils";
3
+ import tooltipIcon from "../../utils/tooltipIcon.svg";
4
+ export class EmailInput {
5
+ constructor() {
6
+ this.validationPattern = '';
7
+ this.touched = false;
8
+ this.handleInput = (event) => {
9
+ this.value = event.target.value;
10
+ this.touched = true;
11
+ if (this.debounceTime) {
12
+ clearTimeout(this.debounceTime);
13
+ }
14
+ this.debounceTime = setTimeout(() => {
15
+ this.isValid = this.setValidity();
16
+ this.errorMessage = this.setErrorMessage();
17
+ this.emitValueHandler(true);
18
+ }, 500);
19
+ };
20
+ this.handleBlur = () => {
21
+ this.isValid = this.setValidity();
22
+ this.errorMessage = this.setErrorMessage();
23
+ this.touched = true;
24
+ };
25
+ this.setClientStyling = () => {
26
+ let sheet = document.createElement('style');
27
+ sheet.innerHTML = this.clientStyling;
28
+ this.stylingContainer.prepend(sheet);
29
+ };
30
+ this.name = undefined;
31
+ this.displayName = undefined;
32
+ this.placeholder = undefined;
33
+ this.validation = undefined;
34
+ this.defaultValue = undefined;
35
+ this.autofilled = undefined;
36
+ this.tooltip = undefined;
37
+ this.language = undefined;
38
+ this.emitValue = undefined;
39
+ this.isDuplicateInput = undefined;
40
+ this.clientStyling = '';
41
+ this.errorMessage = undefined;
42
+ this.isValid = undefined;
43
+ this.limitStylingAppends = false;
44
+ this.showTooltip = false;
45
+ }
46
+ handleStylingChange(newValue, oldValue) {
47
+ if (newValue !== oldValue)
48
+ this.setClientStyling();
49
+ }
50
+ validityChanged() {
51
+ this.validityStateHandler({ valid: this.isValid, name: this.name });
52
+ if (this.emitValue == true) {
53
+ this.valueHandler({ name: this.name, value: this.value });
54
+ }
55
+ }
56
+ emitValueHandler(newValue) {
57
+ if (newValue == true && this.isValid) {
58
+ this.valueHandler({ name: this.name, value: this.value });
59
+ }
60
+ }
61
+ validityStateHandler(inputStateEvent) {
62
+ this.sendValidityState.emit(inputStateEvent);
63
+ }
64
+ valueHandler(inputValueEvent) {
65
+ this.sendInputValue.emit(inputValueEvent);
66
+ }
67
+ handleClickOutside(event) {
68
+ if (event.composedPath()[0] === this.tooltipIconReference)
69
+ return;
70
+ if (event.composedPath()[0] !== this.tooltipReference)
71
+ this.showTooltip = false;
72
+ }
73
+ valueChangedHandler(event) {
74
+ if (this.isDuplicateInput) {
75
+ if (this.name === event.detail.name + 'Duplicate') {
76
+ this.duplicateInputValue = event.detail.value;
77
+ }
78
+ }
79
+ }
80
+ connectedCallback() {
81
+ this.validationPattern = this.setPattern();
82
+ }
83
+ componentDidRender() {
84
+ // start custom styling area
85
+ if (!this.limitStylingAppends && this.stylingContainer) {
86
+ if (this.clientStyling)
87
+ this.setClientStyling();
88
+ this.limitStylingAppends = true;
89
+ }
90
+ // end custom styling area
91
+ }
92
+ componentDidLoad() {
93
+ this.isValid = this.setValidity();
94
+ if (this.defaultValue) {
95
+ this.value = this.defaultValue;
96
+ this.valueHandler({ name: this.name, value: this.value });
97
+ }
98
+ }
99
+ setValidity() {
100
+ return this.inputReference.validity.valid;
101
+ }
102
+ setPattern() {
103
+ var _a, _b;
104
+ if (((_a = this.validation.custom) === null || _a === void 0 ? void 0 : _a.length) > 0) {
105
+ return (_b = this.validation.custom.find(customValidation => customValidation.rule === 'regex')) === null || _b === void 0 ? void 0 : _b.pattern;
106
+ }
107
+ }
108
+ setErrorMessage() {
109
+ var _a, _b, _c, _d;
110
+ if (this.inputReference.validity.valueMissing) {
111
+ return translate('requiredError', this.language);
112
+ }
113
+ if (this.inputReference.validity.tooShort || this.inputReference.validity.tooLong) {
114
+ return translate('lengthError', this.language, { values: { minLength: this.validation.minLength, maxLength: this.validation.maxLength } });
115
+ }
116
+ if (this.inputReference.validity.patternMismatch) {
117
+ const errorCode = (_a = this.validation.custom.find(customValidation => customValidation.rule === 'regex')) === null || _a === void 0 ? void 0 : _a.errorKey;
118
+ const errorMessage = (_b = this.validation.custom.find(customValidation => customValidation.rule === 'regex')) === null || _b === void 0 ? void 0 : _b.errorMessage;
119
+ return translate(`${errorCode}`, this.language) ? translate(`${errorCode}`, this.language) : errorMessage;
120
+ }
121
+ if (this.isDuplicateInput && this.duplicateInputValue !== this.value) {
122
+ const errorCode = (_c = this.validation.custom.find(customRule => customRule.rule === 'duplicate-input')) === null || _c === void 0 ? void 0 : _c.errorKey;
123
+ const errorMessage = (_d = this.validation.custom.find(customRule => customRule.rule === 'duplicate-input')) === null || _d === void 0 ? void 0 : _d.errorMessage;
124
+ return translate(`${errorCode}`, this.language) ? translate(`${errorCode}`, this.language) : errorMessage;
125
+ }
126
+ }
127
+ renderTooltip() {
128
+ if (this.showTooltip) {
129
+ return (h("div", { class: `email__tooltip ${this.showTooltip ? 'visible' : ''}`, ref: (el) => this.tooltipReference = el, innerHTML: this.tooltip }));
130
+ }
131
+ return null;
132
+ }
133
+ render() {
134
+ let invalidClass = '';
135
+ if (this.touched) {
136
+ invalidClass = this.isValid == true || this.isValid == undefined ? '' : 'text__input--invalid';
137
+ }
138
+ return h("div", { key: '532d12855e6014b6c5a81cd11f4c7d83596361c3', class: `email__wrapper ${this.autofilled ? 'number__wrapper--autofilled' : ''} ${this.name}__input`, ref: el => this.stylingContainer = el }, h("div", { key: '80f2e930c6360e1e4e27f29b1de3d3c49a3bb47f', class: 'email__wrapper--flex' }, h("label", { key: '68189c133403e6dada30c376bd84b60b35ca56e4', class: `email__label ${this.validation.mandatory ? 'email__label--required' : ''}`, htmlFor: `${this.name}__input` }, this.displayName), h("div", { key: 'b62dd9a877825d51f6735e9b3ca6b3bb3fc21c28', class: 'email__wrapper--relative' }, this.tooltip &&
139
+ h("img", { key: 'ff76c31db244e06af60db2855b907c90ecde2fe2', class: 'email__tooltip-icon', src: tooltipIcon, alt: "", ref: (el) => this.tooltipIconReference = el, onClick: () => this.showTooltip = !this.showTooltip }), this.renderTooltip())), h("input", { key: '137af683d11c63b2bd881fa3110dd1522ead8774', id: `${this.name}__input`, type: 'email', class: `email__input ${invalidClass}`, value: this.defaultValue, readOnly: this.autofilled, placeholder: `${this.placeholder}`, ref: (el) => this.inputReference = el, pattern: this.validationPattern, required: this.validation.mandatory, minlength: this.validation.minLength, maxlength: this.validation.maxLength, onInput: this.handleInput, onBlur: this.handleBlur }), h("small", { key: '573a357c4e8464f20d9e60a5fd3a2d0c4ae69e3c', class: 'email__error-message' }, this.errorMessage));
140
+ }
141
+ static get is() { return "email-input"; }
142
+ static get encapsulation() { return "shadow"; }
143
+ static get originalStyleUrls() {
144
+ return {
145
+ "$": ["email-input.scss"]
146
+ };
147
+ }
148
+ static get styleUrls() {
149
+ return {
150
+ "$": ["email-input.css"]
151
+ };
152
+ }
153
+ static get properties() {
154
+ return {
155
+ "name": {
156
+ "type": "string",
157
+ "mutable": false,
158
+ "complexType": {
159
+ "original": "string",
160
+ "resolved": "string",
161
+ "references": {}
162
+ },
163
+ "required": false,
164
+ "optional": false,
165
+ "docs": {
166
+ "tags": [],
167
+ "text": "Name of the input."
168
+ },
169
+ "attribute": "name",
170
+ "reflect": true
171
+ },
172
+ "displayName": {
173
+ "type": "string",
174
+ "mutable": false,
175
+ "complexType": {
176
+ "original": "string",
177
+ "resolved": "string",
178
+ "references": {}
179
+ },
180
+ "required": false,
181
+ "optional": false,
182
+ "docs": {
183
+ "tags": [],
184
+ "text": "Name of input to be shown to the user."
185
+ },
186
+ "attribute": "display-name",
187
+ "reflect": true
188
+ },
189
+ "placeholder": {
190
+ "type": "string",
191
+ "mutable": false,
192
+ "complexType": {
193
+ "original": "string",
194
+ "resolved": "string",
195
+ "references": {}
196
+ },
197
+ "required": false,
198
+ "optional": false,
199
+ "docs": {
200
+ "tags": [],
201
+ "text": "Placeholder text to be shown."
202
+ },
203
+ "attribute": "placeholder",
204
+ "reflect": true
205
+ },
206
+ "validation": {
207
+ "type": "unknown",
208
+ "mutable": false,
209
+ "complexType": {
210
+ "original": "ValidationSchema",
211
+ "resolved": "ValidationSchema",
212
+ "references": {
213
+ "ValidationSchema": {
214
+ "location": "import",
215
+ "path": "../../utils/types",
216
+ "id": "../../../../packages/stencil/general-input-hsl/src/utils/types.ts::ValidationSchema"
217
+ }
218
+ }
219
+ },
220
+ "required": false,
221
+ "optional": false,
222
+ "docs": {
223
+ "tags": [],
224
+ "text": "Object of validation rules for the input."
225
+ }
226
+ },
227
+ "defaultValue": {
228
+ "type": "string",
229
+ "mutable": false,
230
+ "complexType": {
231
+ "original": "string",
232
+ "resolved": "string",
233
+ "references": {}
234
+ },
235
+ "required": false,
236
+ "optional": false,
237
+ "docs": {
238
+ "tags": [],
239
+ "text": "Default value for the input."
240
+ },
241
+ "attribute": "default-value",
242
+ "reflect": true
243
+ },
244
+ "autofilled": {
245
+ "type": "boolean",
246
+ "mutable": false,
247
+ "complexType": {
248
+ "original": "boolean",
249
+ "resolved": "boolean",
250
+ "references": {}
251
+ },
252
+ "required": false,
253
+ "optional": false,
254
+ "docs": {
255
+ "tags": [],
256
+ "text": "Boolean. Determines if input should be readonly."
257
+ },
258
+ "attribute": "autofilled",
259
+ "reflect": true
260
+ },
261
+ "tooltip": {
262
+ "type": "string",
263
+ "mutable": false,
264
+ "complexType": {
265
+ "original": "string",
266
+ "resolved": "string",
267
+ "references": {}
268
+ },
269
+ "required": false,
270
+ "optional": false,
271
+ "docs": {
272
+ "tags": [],
273
+ "text": "Tooltip text."
274
+ },
275
+ "attribute": "tooltip",
276
+ "reflect": true
277
+ },
278
+ "language": {
279
+ "type": "string",
280
+ "mutable": false,
281
+ "complexType": {
282
+ "original": "string",
283
+ "resolved": "string",
284
+ "references": {}
285
+ },
286
+ "required": false,
287
+ "optional": false,
288
+ "docs": {
289
+ "tags": [],
290
+ "text": "Currently selected language."
291
+ },
292
+ "attribute": "language",
293
+ "reflect": true
294
+ },
295
+ "emitValue": {
296
+ "type": "boolean",
297
+ "mutable": false,
298
+ "complexType": {
299
+ "original": "boolean",
300
+ "resolved": "boolean",
301
+ "references": {}
302
+ },
303
+ "required": false,
304
+ "optional": false,
305
+ "docs": {
306
+ "tags": [],
307
+ "text": "State passed down from the parent element. Will trigger the input to send it's value through an event."
308
+ },
309
+ "attribute": "emit-value",
310
+ "reflect": true
311
+ },
312
+ "isDuplicateInput": {
313
+ "type": "boolean",
314
+ "mutable": false,
315
+ "complexType": {
316
+ "original": "boolean",
317
+ "resolved": "boolean",
318
+ "references": {}
319
+ },
320
+ "required": false,
321
+ "optional": false,
322
+ "docs": {
323
+ "tags": [],
324
+ "text": "Flag for duplicate inputs, it sets up the input for certain validation rules."
325
+ },
326
+ "attribute": "is-duplicate-input",
327
+ "reflect": true
328
+ },
329
+ "clientStyling": {
330
+ "type": "string",
331
+ "mutable": false,
332
+ "complexType": {
333
+ "original": "string",
334
+ "resolved": "string",
335
+ "references": {}
336
+ },
337
+ "required": false,
338
+ "optional": false,
339
+ "docs": {
340
+ "tags": [],
341
+ "text": "Client custom styling via inline style"
342
+ },
343
+ "attribute": "client-styling",
344
+ "reflect": true,
345
+ "defaultValue": "''"
346
+ }
347
+ };
348
+ }
349
+ static get states() {
350
+ return {
351
+ "errorMessage": {},
352
+ "isValid": {},
353
+ "limitStylingAppends": {},
354
+ "showTooltip": {}
355
+ };
356
+ }
357
+ static get events() {
358
+ return [{
359
+ "method": "sendValidityState",
360
+ "name": "sendValidityState",
361
+ "bubbles": true,
362
+ "cancelable": true,
363
+ "composed": true,
364
+ "docs": {
365
+ "tags": [],
366
+ "text": ""
367
+ },
368
+ "complexType": {
369
+ "original": "InputStateEvent",
370
+ "resolved": "InputStateEvent",
371
+ "references": {
372
+ "InputStateEvent": {
373
+ "location": "import",
374
+ "path": "../../utils/types",
375
+ "id": "../../../../packages/stencil/general-input-hsl/src/utils/types.ts::InputStateEvent"
376
+ }
377
+ }
378
+ }
379
+ }, {
380
+ "method": "sendInputValue",
381
+ "name": "sendInputValue",
382
+ "bubbles": true,
383
+ "cancelable": true,
384
+ "composed": true,
385
+ "docs": {
386
+ "tags": [],
387
+ "text": ""
388
+ },
389
+ "complexType": {
390
+ "original": "InputValueEvent",
391
+ "resolved": "InputValueEvent",
392
+ "references": {
393
+ "InputValueEvent": {
394
+ "location": "import",
395
+ "path": "../../utils/types",
396
+ "id": "../../../../packages/stencil/general-input-hsl/src/utils/types.ts::InputValueEvent"
397
+ }
398
+ }
399
+ }
400
+ }];
401
+ }
402
+ static get watchers() {
403
+ return [{
404
+ "propName": "clientStyling",
405
+ "methodName": "handleStylingChange"
406
+ }, {
407
+ "propName": "isValid",
408
+ "methodName": "validityChanged"
409
+ }, {
410
+ "propName": "emitValue",
411
+ "methodName": "emitValueHandler"
412
+ }];
413
+ }
414
+ static get listeners() {
415
+ return [{
416
+ "name": "click",
417
+ "method": "handleClickOutside",
418
+ "target": "document",
419
+ "capture": false,
420
+ "passive": false
421
+ }, {
422
+ "name": "sendInputValue",
423
+ "method": "valueChangedHandler",
424
+ "target": "body",
425
+ "capture": false,
426
+ "passive": false
427
+ }];
428
+ }
429
+ }
@@ -0,0 +1,4 @@
1
+ :host {
2
+ display: block;
3
+ height: 100%;
4
+ }