@everymatrix/general-input 0.0.1 → 1.0.69

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