@everymatrix/general-input 1.43.4 → 1.45.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.
Files changed (138) hide show
  1. package/dist/cjs/app-globals-3a1e7e63.js +5 -0
  2. package/dist/cjs/checkbox-group-input_10.cjs.entry.js +3873 -1756
  3. package/dist/cjs/general-input.cjs.entry.js +65 -62
  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 +13 -13
  7. package/dist/cjs/loader.cjs.js +7 -13
  8. package/dist/cjs/locale.utils-fdc29445.js +147 -0
  9. package/dist/cjs/toggle-checkbox-input.cjs.entry.js +77 -74
  10. package/dist/collection/collection-manifest.json +14 -14
  11. package/dist/collection/components/checkbox-group-input/checkbox-group-input.js +368 -353
  12. package/dist/collection/components/checkbox-input/checkbox-input.js +325 -315
  13. package/dist/collection/components/date-input/date-input.css +2 -2
  14. package/dist/collection/components/date-input/date-input.js +397 -376
  15. package/dist/collection/components/email-input/email-input.css +7 -11
  16. package/dist/collection/components/email-input/email-input.js +404 -385
  17. package/dist/collection/components/general-input/general-input.js +373 -367
  18. package/dist/collection/components/general-input/index.js +1 -0
  19. package/dist/collection/components/number-input/number-input.js +370 -352
  20. package/dist/collection/components/password-input/password-input.css +2 -4
  21. package/dist/collection/components/password-input/password-input.js +513 -540
  22. package/dist/collection/components/radio-input/radio-input.js +301 -286
  23. package/dist/collection/components/select-input/select-input.css +8 -9
  24. package/dist/collection/components/select-input/select-input.js +427 -414
  25. package/dist/collection/components/tel-input/tel-input.css +1 -1
  26. package/dist/collection/components/tel-input/tel-input.js +440 -422
  27. package/dist/collection/components/text-input/text-input.css +0 -1
  28. package/dist/collection/components/text-input/text-input.js +444 -429
  29. package/dist/collection/components/toggle-checkbox-input/toggle-checkbox-input.js +327 -318
  30. package/dist/collection/index.js +13 -13
  31. package/dist/collection/utils/locale.utils.js +133 -133
  32. package/dist/collection/utils/utils.js +3 -3
  33. package/dist/esm/app-globals-0f993ce5.js +3 -0
  34. package/dist/esm/checkbox-group-input_10.entry.js +3873 -1756
  35. package/dist/esm/general-input.entry.js +65 -62
  36. package/dist/esm/general-input.js +14 -11
  37. package/dist/esm/index-514fda47.js +1287 -0
  38. package/dist/esm/index.js +13 -13
  39. package/dist/esm/loader.js +7 -13
  40. package/dist/esm/locale.utils-75b7d185.js +144 -0
  41. package/dist/esm/toggle-checkbox-input.entry.js +77 -74
  42. package/dist/general-input/general-input.esm.js +1 -1
  43. package/dist/general-input/p-03e81c11.js +2 -0
  44. package/dist/general-input/p-122566dd.entry.js +5430 -0
  45. package/dist/general-input/p-1913dcb0.entry.js +1 -0
  46. package/dist/general-input/p-e1255160.js +1 -0
  47. package/dist/general-input/p-e7df9c4a.entry.js +1 -0
  48. package/dist/stencil.config.dev.js +17 -0
  49. package/dist/stencil.config.js +14 -19
  50. package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/general-input/.stencil/packages/stencil/general-input/stencil.config.d.ts +2 -0
  51. package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/general-input/.stencil/packages/stencil/general-input/stencil.config.dev.d.ts +2 -0
  52. package/dist/types/components/checkbox-group-input/checkbox-group-input.d.ts +68 -68
  53. package/dist/types/components/checkbox-input/checkbox-input.d.ts +61 -62
  54. package/dist/types/components/date-input/date-input.d.ts +78 -78
  55. package/dist/types/components/email-input/email-input.d.ts +77 -77
  56. package/dist/types/components/general-input/general-input.d.ts +72 -72
  57. package/dist/types/components/general-input/index.d.ts +1 -0
  58. package/dist/types/components/number-input/number-input.d.ts +71 -71
  59. package/dist/types/components/password-input/password-input.d.ts +87 -92
  60. package/dist/types/components/radio-input/radio-input.d.ts +55 -55
  61. package/dist/types/components/select-input/select-input.d.ts +79 -79
  62. package/dist/types/components/tel-input/tel-input.d.ts +85 -85
  63. package/dist/types/components/text-input/text-input.d.ts +81 -81
  64. package/dist/types/components/toggle-checkbox-input/toggle-checkbox-input.d.ts +63 -64
  65. package/dist/types/components.d.ts +201 -31
  66. package/dist/types/stencil-public-runtime.d.ts +142 -33
  67. package/dist/types/utils/locale.utils.d.ts +8 -8
  68. package/dist/types/utils/types.d.ts +54 -54
  69. package/loader/cdn.js +1 -3
  70. package/loader/index.cjs.js +1 -3
  71. package/loader/index.d.ts +13 -1
  72. package/loader/index.es2017.js +1 -3
  73. package/loader/index.js +1 -3
  74. package/loader/package.json +1 -0
  75. package/package.json +8 -1
  76. package/dist/cjs/index-132a0774.js +0 -1327
  77. package/dist/cjs/locale.utils-2fa6f747.js +0 -147
  78. package/dist/components/active-mixin.js +0 -975
  79. package/dist/components/checkbox-group-input.d.ts +0 -11
  80. package/dist/components/checkbox-group-input.js +0 -6
  81. package/dist/components/checkbox-group-input2.js +0 -1078
  82. package/dist/components/checkbox-input.d.ts +0 -11
  83. package/dist/components/checkbox-input.js +0 -6
  84. package/dist/components/checkbox-input2.js +0 -132
  85. package/dist/components/date-input.d.ts +0 -11
  86. package/dist/components/date-input.js +0 -6
  87. package/dist/components/date-input2.js +0 -11556
  88. package/dist/components/email-input.d.ts +0 -11
  89. package/dist/components/email-input.js +0 -6
  90. package/dist/components/email-input2.js +0 -171
  91. package/dist/components/field-mixin.js +0 -12426
  92. package/dist/components/general-input.d.ts +0 -11
  93. package/dist/components/general-input.js +0 -6
  94. package/dist/components/general-input2.js +0 -344
  95. package/dist/components/index.d.ts +0 -26
  96. package/dist/components/index.js +0 -18
  97. package/dist/components/input-field-shared-styles.js +0 -1211
  98. package/dist/components/number-input.d.ts +0 -11
  99. package/dist/components/number-input.js +0 -6
  100. package/dist/components/number-input2.js +0 -158
  101. package/dist/components/password-input.d.ts +0 -11
  102. package/dist/components/password-input.js +0 -6
  103. package/dist/components/password-input2.js +0 -1059
  104. package/dist/components/radio-input.d.ts +0 -11
  105. package/dist/components/radio-input.js +0 -6
  106. package/dist/components/radio-input2.js +0 -114
  107. package/dist/components/select-input.d.ts +0 -11
  108. package/dist/components/select-input.js +0 -6
  109. package/dist/components/select-input2.js +0 -183
  110. package/dist/components/tel-input.d.ts +0 -11
  111. package/dist/components/tel-input.js +0 -6
  112. package/dist/components/tel-input2.js +0 -197
  113. package/dist/components/text-input.d.ts +0 -11
  114. package/dist/components/text-input.js +0 -6
  115. package/dist/components/text-input2.js +0 -199
  116. package/dist/components/toggle-checkbox-input.d.ts +0 -11
  117. package/dist/components/toggle-checkbox-input.js +0 -6
  118. package/dist/components/tooltipIcon.js +0 -146
  119. package/dist/components/vaadin-button.js +0 -490
  120. package/dist/components/vaadin-combo-box.js +0 -4512
  121. package/dist/components/virtual-keyboard-controller.js +0 -2001
  122. package/dist/esm/index-db76d5b5.js +0 -1299
  123. package/dist/esm/locale.utils-30fb5289.js +0 -144
  124. package/dist/esm/polyfills/core-js.js +0 -11
  125. package/dist/esm/polyfills/css-shim.js +0 -1
  126. package/dist/esm/polyfills/dom.js +0 -79
  127. package/dist/esm/polyfills/es5-html-element.js +0 -1
  128. package/dist/esm/polyfills/index.js +0 -34
  129. package/dist/esm/polyfills/system.js +0 -6
  130. package/dist/general-input/p-6ae987d0.entry.js +0 -1
  131. package/dist/general-input/p-b408093e.js +0 -1
  132. package/dist/general-input/p-b64caafa.entry.js +0 -3646
  133. package/dist/general-input/p-f659e9ee.entry.js +0 -1
  134. package/dist/types/Users/adrian.pripon/Documents/Work/widgets-stencil/packages/general-input/.stencil/packages/general-input/stencil.config.d.ts +0 -2
  135. /package/dist/cjs/{tooltipIcon-092a795f.js → tooltipIcon-7e9ee226.js} +0 -0
  136. /package/dist/esm/{tooltipIcon-99c1c7b7.js → tooltipIcon-0a5a06a2.js} +0 -0
  137. /package/dist/general-input/{p-f4f4ccda.js → p-2dccd0bf.js} +0 -0
  138. /package/dist/general-input/{p-04d4b145.js → p-ba14eb83.js} +0 -0
@@ -1,368 +1,386 @@
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 NumberInput {
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.touched = false;
14
- this.handleInput = (event) => {
15
- this.value = event.target.value;
16
- this.touched = true;
17
- if (this.debounceTime) {
18
- clearTimeout(this.debounceTime);
19
- }
20
- this.debounceTime = setTimeout(() => {
21
- this.isValid = this.setValidity();
22
- this.errorMessage = this.setErrorMessage();
23
- this.emitValueHandler(true);
24
- }, 500);
25
- };
26
- this.handleBlur = () => {
27
- this.isValid = this.setValidity();
28
- this.errorMessage = this.setErrorMessage();
29
- this.touched = true;
30
- };
31
- this.setClientStyling = () => {
32
- let sheet = document.createElement('style');
33
- sheet.innerHTML = this.clientStyling;
34
- this.stylingContainer.prepend(sheet);
35
- };
36
- }
37
- validityChanged() {
38
- this.validityStateHandler({ valid: this.isValid, name: this.name });
39
- if (this.emitValue == true) {
40
- 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.clientStyling = '';
40
+ this.errorMessage = undefined;
41
+ this.isValid = undefined;
42
+ this.limitStylingAppends = false;
43
+ this.showTooltip = false;
41
44
  }
42
- }
43
- validityStateHandler(inputStateEvent) {
44
- this.sendValidityState.emit(inputStateEvent);
45
- }
46
- emitValueHandler(newValue) {
47
- if (newValue == true && this.isValid) {
48
- this.valueHandler({ name: this.name, value: this.value });
45
+ validityChanged() {
46
+ this.validityStateHandler({ valid: this.isValid, name: this.name });
47
+ if (this.emitValue == true) {
48
+ this.valueHandler({ name: this.name, value: this.value });
49
+ }
49
50
  }
50
- }
51
- valueHandler(inputValueEvent) {
52
- this.sendInputValue.emit(inputValueEvent);
53
- }
54
- handleClickOutside(event) {
55
- if (event.composedPath()[0] === this.tooltipIconReference)
56
- return;
57
- if (event.composedPath()[0] !== this.tooltipReference)
58
- this.showTooltip = false;
59
- }
60
- connectedCallback() {
61
- this.validationPattern = this.setPattern();
62
- }
63
- componentDidRender() {
64
- // start custom styling area
65
- if (!this.limitStylingAppends && this.stylingContainer) {
66
- if (this.clientStyling)
67
- this.setClientStyling();
68
- this.limitStylingAppends = true;
51
+ validityStateHandler(inputStateEvent) {
52
+ this.sendValidityState.emit(inputStateEvent);
69
53
  }
70
- // end custom styling area
71
- }
72
- componentDidLoad() {
73
- this.isValid = this.setValidity();
74
- if (this.defaultValue) {
75
- this.value = this.defaultValue;
76
- this.valueHandler({ name: this.name, value: this.value });
54
+ emitValueHandler(newValue) {
55
+ if (newValue == true && this.isValid) {
56
+ this.valueHandler({ name: this.name, value: this.value });
57
+ }
77
58
  }
78
- }
79
- setValidity() {
80
- return this.inputReference.validity.valid;
81
- }
82
- setPattern() {
83
- var _a, _b;
84
- if (((_a = this.validation.custom) === null || _a === void 0 ? void 0 : _a.length) > 0) {
85
- return (_b = this.validation.custom.find(customValidation => customValidation.rule === 'regex')) === null || _b === void 0 ? void 0 : _b.pattern;
59
+ valueHandler(inputValueEvent) {
60
+ this.sendInputValue.emit(inputValueEvent);
86
61
  }
87
- }
88
- setErrorMessage() {
89
- var _a, _b;
90
- if (this.inputReference.validity.patternMismatch) {
91
- const errorCode = (_a = this.validation.custom.find(customValidation => customValidation.rule === 'regex')) === null || _a === void 0 ? void 0 : _a.errorKey;
92
- const errorMessage = (_b = this.validation.custom.find(customValidation => customValidation.rule === 'regex')) === null || _b === void 0 ? void 0 : _b.errorMessage;
93
- return translate(`${errorCode}`, this.language) ? translate(`${errorCode}`, this.language) : errorMessage;
62
+ handleClickOutside(event) {
63
+ if (event.composedPath()[0] === this.tooltipIconReference)
64
+ return;
65
+ if (event.composedPath()[0] !== this.tooltipReference)
66
+ this.showTooltip = false;
94
67
  }
95
- if (this.inputReference.validity.rangeUnderflow || this.inputReference.validity.rangeOverflow) {
96
- return translate('numberLengthError', this.language, { values: { min: this.validation.min, max: this.validation.max } });
68
+ connectedCallback() {
69
+ this.validationPattern = this.setPattern();
97
70
  }
98
- if (this.inputReference.validity.valueMissing) {
99
- return translate('requiredError', this.language);
71
+ componentDidRender() {
72
+ // start custom styling area
73
+ if (!this.limitStylingAppends && this.stylingContainer) {
74
+ if (this.clientStyling)
75
+ this.setClientStyling();
76
+ this.limitStylingAppends = true;
77
+ }
78
+ // end custom styling area
100
79
  }
101
- }
102
- renderTooltip() {
103
- if (this.showTooltip) {
104
- return (h("div", { class: `number__tooltip ${this.showTooltip ? 'visible' : ''}`, ref: (el) => this.tooltipReference = el, innerHTML: this.tooltip }));
80
+ componentDidLoad() {
81
+ this.isValid = this.setValidity();
82
+ if (this.defaultValue) {
83
+ this.value = this.defaultValue;
84
+ this.valueHandler({ name: this.name, value: this.value });
85
+ }
105
86
  }
106
- return null;
107
- }
108
- render() {
109
- let invalidClass = '';
110
- if (this.touched) {
111
- invalidClass = this.isValid == true || this.isValid == undefined ? '' : 'text__input--invalid';
87
+ setValidity() {
88
+ return this.inputReference.validity.valid;
112
89
  }
113
- return h("div", { class: `number__wrapper ${this.autofilled ? 'number__wrapper--autofilled' : ''} ${this.name}__input`, ref: el => this.stylingContainer = el },
114
- h("div", { class: 'number__wrapper--flex' },
115
- h("label", { class: `number__label ${this.validation.mandatory ? 'number__label--required' : ''}`, htmlFor: `${this.name}__input` }, this.displayName),
116
- h("div", { class: 'number__wrapper--relative' },
117
- this.tooltip &&
118
- h("img", { class: 'number__tooltip-icon', src: tooltipIcon, alt: "", ref: (el) => this.tooltipIconReference = el, onClick: () => this.showTooltip = !this.showTooltip }),
119
- this.renderTooltip())),
120
- h("input", { ref: (el) => this.inputReference = el, type: "number", value: this.defaultValue, readOnly: this.autofilled, id: `${this.name}__input`, class: `number__input ${invalidClass}`, pattern: this.validationPattern, placeholder: `${this.placeholder}`, required: this.validation.mandatory, max: this.validation.max, min: this.validation.min, onInput: this.handleInput, onBlur: this.handleBlur }),
121
- h("small", { class: 'number__error-message' }, this.errorMessage));
122
- }
123
- static get is() { return "number-input"; }
124
- static get encapsulation() { return "shadow"; }
125
- static get originalStyleUrls() { return {
126
- "$": ["number-input.scss"]
127
- }; }
128
- static get styleUrls() { return {
129
- "$": ["number-input.css"]
130
- }; }
131
- static get properties() { return {
132
- "name": {
133
- "type": "string",
134
- "mutable": false,
135
- "complexType": {
136
- "original": "string",
137
- "resolved": "string",
138
- "references": {}
139
- },
140
- "required": false,
141
- "optional": false,
142
- "docs": {
143
- "tags": [],
144
- "text": "Name of the input."
145
- },
146
- "attribute": "name",
147
- "reflect": true
148
- },
149
- "displayName": {
150
- "type": "string",
151
- "mutable": false,
152
- "complexType": {
153
- "original": "string",
154
- "resolved": "string",
155
- "references": {}
156
- },
157
- "required": false,
158
- "optional": false,
159
- "docs": {
160
- "tags": [],
161
- "text": "Name of input to be shown to the user."
162
- },
163
- "attribute": "display-name",
164
- "reflect": true
165
- },
166
- "placeholder": {
167
- "type": "string",
168
- "mutable": false,
169
- "complexType": {
170
- "original": "string",
171
- "resolved": "string",
172
- "references": {}
173
- },
174
- "required": false,
175
- "optional": false,
176
- "docs": {
177
- "tags": [],
178
- "text": "Placeholder text to be shown."
179
- },
180
- "attribute": "placeholder",
181
- "reflect": true
182
- },
183
- "validation": {
184
- "type": "unknown",
185
- "mutable": false,
186
- "complexType": {
187
- "original": "ValidationSchema",
188
- "resolved": "ValidationSchema",
189
- "references": {
190
- "ValidationSchema": {
191
- "location": "import",
192
- "path": "../../utils/types"
193
- }
90
+ setPattern() {
91
+ var _a, _b;
92
+ if (((_a = this.validation.custom) === null || _a === void 0 ? void 0 : _a.length) > 0) {
93
+ return (_b = this.validation.custom.find(customValidation => customValidation.rule === 'regex')) === null || _b === void 0 ? void 0 : _b.pattern;
194
94
  }
195
- },
196
- "required": false,
197
- "optional": false,
198
- "docs": {
199
- "tags": [],
200
- "text": "Object of validation rules for the input."
201
- }
202
- },
203
- "defaultValue": {
204
- "type": "string",
205
- "mutable": false,
206
- "complexType": {
207
- "original": "string",
208
- "resolved": "string",
209
- "references": {}
210
- },
211
- "required": false,
212
- "optional": false,
213
- "docs": {
214
- "tags": [],
215
- "text": "Default value for the input."
216
- },
217
- "attribute": "default-value",
218
- "reflect": true
219
- },
220
- "autofilled": {
221
- "type": "boolean",
222
- "mutable": false,
223
- "complexType": {
224
- "original": "boolean",
225
- "resolved": "boolean",
226
- "references": {}
227
- },
228
- "required": false,
229
- "optional": false,
230
- "docs": {
231
- "tags": [],
232
- "text": "Boolean. Determines if input should be readonly."
233
- },
234
- "attribute": "autofilled",
235
- "reflect": true
236
- },
237
- "tooltip": {
238
- "type": "string",
239
- "mutable": false,
240
- "complexType": {
241
- "original": "string",
242
- "resolved": "string",
243
- "references": {}
244
- },
245
- "required": false,
246
- "optional": false,
247
- "docs": {
248
- "tags": [],
249
- "text": "Tooltip text."
250
- },
251
- "attribute": "tooltip",
252
- "reflect": true
253
- },
254
- "language": {
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": "Currently selected language."
267
- },
268
- "attribute": "language",
269
- "reflect": true
270
- },
271
- "emitValue": {
272
- "type": "boolean",
273
- "mutable": false,
274
- "complexType": {
275
- "original": "boolean",
276
- "resolved": "boolean",
277
- "references": {}
278
- },
279
- "required": false,
280
- "optional": false,
281
- "docs": {
282
- "tags": [],
283
- "text": "State passed down from the parent element. Will trigger the input to send it's value through an event."
284
- },
285
- "attribute": "emit-value",
286
- "reflect": true
287
- },
288
- "clientStyling": {
289
- "type": "string",
290
- "mutable": false,
291
- "complexType": {
292
- "original": "string",
293
- "resolved": "string",
294
- "references": {}
295
- },
296
- "required": false,
297
- "optional": false,
298
- "docs": {
299
- "tags": [],
300
- "text": "Client custom styling via inline style"
301
- },
302
- "attribute": "client-styling",
303
- "reflect": true,
304
- "defaultValue": "''"
305
95
  }
306
- }; }
307
- static get states() { return {
308
- "errorMessage": {},
309
- "isValid": {},
310
- "limitStylingAppends": {},
311
- "showTooltip": {}
312
- }; }
313
- static get events() { return [{
314
- "method": "sendValidityState",
315
- "name": "sendValidityState",
316
- "bubbles": true,
317
- "cancelable": true,
318
- "composed": true,
319
- "docs": {
320
- "tags": [],
321
- "text": ""
322
- },
323
- "complexType": {
324
- "original": "InputStateEvent",
325
- "resolved": "InputStateEvent",
326
- "references": {
327
- "InputStateEvent": {
328
- "location": "import",
329
- "path": "../../utils/types"
330
- }
96
+ setErrorMessage() {
97
+ var _a, _b;
98
+ if (this.inputReference.validity.patternMismatch) {
99
+ const errorCode = (_a = this.validation.custom.find(customValidation => customValidation.rule === 'regex')) === null || _a === void 0 ? void 0 : _a.errorKey;
100
+ const errorMessage = (_b = this.validation.custom.find(customValidation => customValidation.rule === 'regex')) === null || _b === void 0 ? void 0 : _b.errorMessage;
101
+ return translate(`${errorCode}`, this.language) ? translate(`${errorCode}`, this.language) : errorMessage;
102
+ }
103
+ if (this.inputReference.validity.rangeUnderflow || this.inputReference.validity.rangeOverflow) {
104
+ return translate('numberLengthError', this.language, { values: { min: this.validation.min, max: this.validation.max } });
331
105
  }
332
- }
333
- }, {
334
- "method": "sendInputValue",
335
- "name": "sendInputValue",
336
- "bubbles": true,
337
- "cancelable": true,
338
- "composed": true,
339
- "docs": {
340
- "tags": [],
341
- "text": ""
342
- },
343
- "complexType": {
344
- "original": "InputValueEvent",
345
- "resolved": "InputValueEvent",
346
- "references": {
347
- "InputValueEvent": {
348
- "location": "import",
349
- "path": "../../utils/types"
350
- }
106
+ if (this.inputReference.validity.valueMissing) {
107
+ return translate('requiredError', this.language);
351
108
  }
352
- }
353
- }]; }
354
- static get watchers() { return [{
355
- "propName": "isValid",
356
- "methodName": "validityChanged"
357
- }, {
358
- "propName": "emitValue",
359
- "methodName": "emitValueHandler"
360
- }]; }
361
- static get listeners() { return [{
362
- "name": "click",
363
- "method": "handleClickOutside",
364
- "target": "document",
365
- "capture": false,
366
- "passive": false
367
- }]; }
109
+ }
110
+ renderTooltip() {
111
+ if (this.showTooltip) {
112
+ return (h("div", { class: `number__tooltip ${this.showTooltip ? 'visible' : ''}`, ref: (el) => this.tooltipReference = el, innerHTML: this.tooltip }));
113
+ }
114
+ return null;
115
+ }
116
+ render() {
117
+ let invalidClass = '';
118
+ if (this.touched) {
119
+ invalidClass = this.isValid == true || this.isValid == undefined ? '' : 'text__input--invalid';
120
+ }
121
+ return h("div", { key: '2032f77ca52b330ae2e8f484d7a0aba60ee7b9d5', class: `number__wrapper ${this.autofilled ? 'number__wrapper--autofilled' : ''} ${this.name}__input`, ref: el => this.stylingContainer = el }, h("div", { key: '0786901cd928bba86597180f058bff43fba522b6', class: 'number__wrapper--flex' }, h("label", { key: 'ff7f39306cef7aeba3e0e4508df03c5a945e748b', class: `number__label ${this.validation.mandatory ? 'number__label--required' : ''}`, htmlFor: `${this.name}__input` }, this.displayName), h("div", { key: 'dced91223621551472fee374d56f1ad7476f4191', class: 'number__wrapper--relative' }, this.tooltip &&
122
+ h("img", { key: 'a804a983e342e4d117126720a32c4c34a2b267dc', class: 'number__tooltip-icon', src: tooltipIcon, alt: "", ref: (el) => this.tooltipIconReference = el, onClick: () => this.showTooltip = !this.showTooltip }), this.renderTooltip())), h("input", { key: 'fd59afaedf7d9f761684b057a1809474d735cc26', ref: (el) => this.inputReference = el, type: "number", value: this.defaultValue, readOnly: this.autofilled, id: `${this.name}__input`, class: `number__input ${invalidClass}`, pattern: this.validationPattern, placeholder: `${this.placeholder}`, required: this.validation.mandatory, max: this.validation.max, min: this.validation.min, onInput: this.handleInput, onBlur: this.handleBlur }), h("small", { key: 'ca11558b5704b69311626736ab84a298449b98d7', class: 'number__error-message' }, this.errorMessage));
123
+ }
124
+ static get is() { return "number-input"; }
125
+ static get encapsulation() { return "shadow"; }
126
+ static get originalStyleUrls() {
127
+ return {
128
+ "$": ["number-input.scss"]
129
+ };
130
+ }
131
+ static get styleUrls() {
132
+ return {
133
+ "$": ["number-input.css"]
134
+ };
135
+ }
136
+ static get properties() {
137
+ return {
138
+ "name": {
139
+ "type": "string",
140
+ "mutable": false,
141
+ "complexType": {
142
+ "original": "string",
143
+ "resolved": "string",
144
+ "references": {}
145
+ },
146
+ "required": false,
147
+ "optional": false,
148
+ "docs": {
149
+ "tags": [],
150
+ "text": "Name of the input."
151
+ },
152
+ "attribute": "name",
153
+ "reflect": true
154
+ },
155
+ "displayName": {
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 input to be shown to the user."
168
+ },
169
+ "attribute": "display-name",
170
+ "reflect": true
171
+ },
172
+ "placeholder": {
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": "Placeholder text to be shown."
185
+ },
186
+ "attribute": "placeholder",
187
+ "reflect": true
188
+ },
189
+ "validation": {
190
+ "type": "unknown",
191
+ "mutable": false,
192
+ "complexType": {
193
+ "original": "ValidationSchema",
194
+ "resolved": "ValidationSchema",
195
+ "references": {
196
+ "ValidationSchema": {
197
+ "location": "import",
198
+ "path": "../../utils/types",
199
+ "id": "../../../../packages/stencil/general-input/src/utils/types.ts::ValidationSchema"
200
+ }
201
+ }
202
+ },
203
+ "required": false,
204
+ "optional": false,
205
+ "docs": {
206
+ "tags": [],
207
+ "text": "Object of validation rules for the input."
208
+ }
209
+ },
210
+ "defaultValue": {
211
+ "type": "string",
212
+ "mutable": false,
213
+ "complexType": {
214
+ "original": "string",
215
+ "resolved": "string",
216
+ "references": {}
217
+ },
218
+ "required": false,
219
+ "optional": false,
220
+ "docs": {
221
+ "tags": [],
222
+ "text": "Default value for the input."
223
+ },
224
+ "attribute": "default-value",
225
+ "reflect": true
226
+ },
227
+ "autofilled": {
228
+ "type": "boolean",
229
+ "mutable": false,
230
+ "complexType": {
231
+ "original": "boolean",
232
+ "resolved": "boolean",
233
+ "references": {}
234
+ },
235
+ "required": false,
236
+ "optional": false,
237
+ "docs": {
238
+ "tags": [],
239
+ "text": "Boolean. Determines if input should be readonly."
240
+ },
241
+ "attribute": "autofilled",
242
+ "reflect": true
243
+ },
244
+ "tooltip": {
245
+ "type": "string",
246
+ "mutable": false,
247
+ "complexType": {
248
+ "original": "string",
249
+ "resolved": "string",
250
+ "references": {}
251
+ },
252
+ "required": false,
253
+ "optional": false,
254
+ "docs": {
255
+ "tags": [],
256
+ "text": "Tooltip text."
257
+ },
258
+ "attribute": "tooltip",
259
+ "reflect": true
260
+ },
261
+ "language": {
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": "Currently selected language."
274
+ },
275
+ "attribute": "language",
276
+ "reflect": true
277
+ },
278
+ "emitValue": {
279
+ "type": "boolean",
280
+ "mutable": false,
281
+ "complexType": {
282
+ "original": "boolean",
283
+ "resolved": "boolean",
284
+ "references": {}
285
+ },
286
+ "required": false,
287
+ "optional": false,
288
+ "docs": {
289
+ "tags": [],
290
+ "text": "State passed down from the parent element. Will trigger the input to send it's value through an event."
291
+ },
292
+ "attribute": "emit-value",
293
+ "reflect": true
294
+ },
295
+ "clientStyling": {
296
+ "type": "string",
297
+ "mutable": false,
298
+ "complexType": {
299
+ "original": "string",
300
+ "resolved": "string",
301
+ "references": {}
302
+ },
303
+ "required": false,
304
+ "optional": false,
305
+ "docs": {
306
+ "tags": [],
307
+ "text": "Client custom styling via inline style"
308
+ },
309
+ "attribute": "client-styling",
310
+ "reflect": true,
311
+ "defaultValue": "''"
312
+ }
313
+ };
314
+ }
315
+ static get states() {
316
+ return {
317
+ "errorMessage": {},
318
+ "isValid": {},
319
+ "limitStylingAppends": {},
320
+ "showTooltip": {}
321
+ };
322
+ }
323
+ static get events() {
324
+ return [{
325
+ "method": "sendValidityState",
326
+ "name": "sendValidityState",
327
+ "bubbles": true,
328
+ "cancelable": true,
329
+ "composed": true,
330
+ "docs": {
331
+ "tags": [],
332
+ "text": ""
333
+ },
334
+ "complexType": {
335
+ "original": "InputStateEvent",
336
+ "resolved": "InputStateEvent",
337
+ "references": {
338
+ "InputStateEvent": {
339
+ "location": "import",
340
+ "path": "../../utils/types",
341
+ "id": "../../../../packages/stencil/general-input/src/utils/types.ts::InputStateEvent"
342
+ }
343
+ }
344
+ }
345
+ }, {
346
+ "method": "sendInputValue",
347
+ "name": "sendInputValue",
348
+ "bubbles": true,
349
+ "cancelable": true,
350
+ "composed": true,
351
+ "docs": {
352
+ "tags": [],
353
+ "text": ""
354
+ },
355
+ "complexType": {
356
+ "original": "InputValueEvent",
357
+ "resolved": "InputValueEvent",
358
+ "references": {
359
+ "InputValueEvent": {
360
+ "location": "import",
361
+ "path": "../../utils/types",
362
+ "id": "../../../../packages/stencil/general-input/src/utils/types.ts::InputValueEvent"
363
+ }
364
+ }
365
+ }
366
+ }];
367
+ }
368
+ static get watchers() {
369
+ return [{
370
+ "propName": "isValid",
371
+ "methodName": "validityChanged"
372
+ }, {
373
+ "propName": "emitValue",
374
+ "methodName": "emitValueHandler"
375
+ }];
376
+ }
377
+ static get listeners() {
378
+ return [{
379
+ "name": "click",
380
+ "method": "handleClickOutside",
381
+ "target": "document",
382
+ "capture": false,
383
+ "passive": false
384
+ }];
385
+ }
368
386
  }