@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,429 +1,442 @@
1
- import { Component, h, Prop, State, Watch, Event, Element, Listen } from '@stencil/core';
2
- import { translate } from '../../utils/locale.utils';
3
- import '@vaadin/combo-box';
4
- import tooltipIcon from '../../utils/tooltipIcon.svg';
1
+ import { h } from "@stencil/core";
2
+ import { translate } from "../../utils/locale.utils";
3
+ import "@vaadin/combo-box";
4
+ import tooltipIcon from "../../utils/tooltipIcon.svg";
5
5
  export class SelectInput {
6
- constructor() {
7
- /**
8
- * Default value for the input.
9
- */
10
- this.defaultValue = '';
11
- /**
12
- * Options of the input.
13
- */
14
- this.options = [];
15
- /**
16
- * Client custom styling via inline style
17
- */
18
- this.clientStyling = '';
19
- this.limitStylingAppends = false;
20
- this.showTooltip = false;
21
- this.touched = false;
22
- this.handleChange = (event) => {
23
- this.touched = true;
24
- const selectedValue = event.target.value;
25
- // Find the original option based on case-insensitive comparison
26
- const originalOption = this.options.find(option => option.value.toLowerCase() === selectedValue.toLowerCase());
27
- if (originalOption) {
28
- this.value = originalOption.value;
29
- }
30
- else {
31
- this.value = selectedValue;
32
- }
33
- this.isValid = this.setValidity();
34
- this.errorMessage = this.setErrorMessage();
35
- this.emitValueHandler(true);
36
- };
37
- this.setClientStyling = () => {
38
- let sheet = document.createElement('style');
39
- sheet.innerHTML = this.clientStyling;
40
- this.stylingContainer.prepend(sheet);
41
- };
42
- }
43
- validityChanged() {
44
- this.validityStateHandler({ valid: this.isValid, name: this.name });
45
- if (this.emitValue == true) {
46
- this.valueHandler({ name: this.name, value: this.value });
6
+ constructor() {
7
+ this.touched = false;
8
+ this.handleChange = (event) => {
9
+ this.touched = true;
10
+ const selectedValue = event.target.value;
11
+ // Find the original option based on case-insensitive comparison
12
+ const originalOption = this.options.find(option => option.value.toLowerCase() === selectedValue.toLowerCase());
13
+ if (originalOption) {
14
+ this.value = originalOption.value;
15
+ }
16
+ else {
17
+ this.value = selectedValue;
18
+ }
19
+ this.isValid = this.setValidity();
20
+ this.errorMessage = this.setErrorMessage();
21
+ this.emitValueHandler(true);
22
+ };
23
+ this.setClientStyling = () => {
24
+ let sheet = document.createElement('style');
25
+ sheet.innerHTML = this.clientStyling;
26
+ this.stylingContainer.prepend(sheet);
27
+ };
28
+ this.name = undefined;
29
+ this.displayName = undefined;
30
+ this.placeholder = undefined;
31
+ this.action = undefined;
32
+ this.defaultValue = '';
33
+ this.autofilled = undefined;
34
+ this.tooltip = undefined;
35
+ this.options = [];
36
+ this.validation = 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;
47
44
  }
48
- }
49
- validityStateHandler(inputStateEvent) {
50
- this.sendValidityState.emit(inputStateEvent);
51
- }
52
- emitValueHandler(newValue) {
53
- if (newValue == true && this.isValid) {
54
- 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
+ }
55
50
  }
56
- }
57
- valueHandler(inputValueEvent) {
58
- this.sendInputValue.emit(inputValueEvent);
59
- }
60
- handleClickOutside(event) {
61
- if (event.composedPath()[0] === this.tooltipIconReference)
62
- return;
63
- if (event.composedPath()[0] !== this.tooltipReference)
64
- this.showTooltip = false;
65
- }
66
- connectedCallback() {
67
- this.displayedOptions = this.options.map(option => ({
68
- label: option.label,
69
- value: option.value.toUpperCase()
70
- }));
71
- }
72
- componentWillLoad() {
73
- if (this.action && !this.options.length) {
74
- if (this.action.split(" ")[0] == 'GET') {
75
- const endpoint = this.action.split(" ")[1];
76
- return this.getOptions(endpoint).then((options) => {
77
- const firstKey = Object.keys(options)[0];
78
- this.displayedOptions = options[firstKey].map(option => {
79
- return { label: option.Name, value: option.Alpha2Code };
80
- });
81
- });
82
- }
51
+ validityStateHandler(inputStateEvent) {
52
+ this.sendValidityState.emit(inputStateEvent);
83
53
  }
84
- }
85
- componentDidRender() {
86
- // start custom styling area
87
- if (!this.limitStylingAppends && this.stylingContainer) {
88
- if (this.clientStyling)
89
- this.setClientStyling();
90
- this.limitStylingAppends = true;
54
+ emitValueHandler(newValue) {
55
+ if (newValue == true && this.isValid) {
56
+ this.valueHandler({ name: this.name, value: this.value });
57
+ }
91
58
  }
92
- // end custom styling area
93
- }
94
- componentDidLoad() {
95
- this.inputReference = this.element.shadowRoot.querySelector('input');
96
- this.isValid = this.setValidity();
97
- if (this.defaultValue) {
98
- this.value = this.defaultValue.toUpperCase();
99
- this.valueHandler({ name: this.name, value: this.value });
59
+ valueHandler(inputValueEvent) {
60
+ this.sendInputValue.emit(inputValueEvent);
100
61
  }
101
- }
102
- getOptions(endpoint) {
103
- const url = new URL(endpoint);
104
- return new Promise((resolve, reject) => {
105
- fetch(url.href)
106
- .then((res) => res.json())
107
- .then((options) => {
108
- resolve(options);
109
- }).catch((err) => {
110
- console.error(err);
111
- reject(err);
112
- });
113
- });
114
- }
115
- setValidity() {
116
- return this.inputReference.validity.valid;
117
- }
118
- setErrorMessage() {
119
- if (this.inputReference.validity.valueMissing) {
120
- return translate('requiredError', this.language);
62
+ handleClickOutside(event) {
63
+ if (event.composedPath()[0] === this.tooltipIconReference)
64
+ return;
65
+ if (event.composedPath()[0] !== this.tooltipReference)
66
+ this.showTooltip = false;
121
67
  }
122
- }
123
- renderTooltip() {
124
- if (this.showTooltip) {
125
- return (h("div", { class: `select__tooltip ${this.showTooltip ? 'visible' : ''}`, ref: (el) => this.tooltipReference = el, innerHTML: this.tooltip }));
68
+ connectedCallback() {
69
+ this.displayedOptions = this.options.map(option => ({
70
+ label: option.label,
71
+ value: option.value.toUpperCase()
72
+ }));
126
73
  }
127
- return null;
128
- }
129
- render() {
130
- let invalidClass = '';
131
- if (this.touched) {
132
- invalidClass = this.isValid == true || this.isValid == undefined ? '' : 'select__input--invalid';
74
+ componentWillLoad() {
75
+ if (this.action && !this.options.length) {
76
+ if (this.action.split(" ")[0] == 'GET') {
77
+ const endpoint = this.action.split(" ")[1];
78
+ return this.getOptions(endpoint).then((options) => {
79
+ const firstKey = Object.keys(options)[0];
80
+ this.displayedOptions = options[firstKey].map(option => {
81
+ return { label: option.Name, value: option.Alpha2Code };
82
+ });
83
+ });
84
+ }
85
+ }
133
86
  }
134
- return h("div", { class: `select__wrapper ${this.autofilled ? 'select__wrapper--autofilled' : ''} ${this.name}__input`, ref: el => this.stylingContainer = el },
135
- h("div", { class: 'select__wrapper--flex' },
136
- h("label", { class: `select__label ${this.validation.mandatory ? 'select__label--required' : ''}`, htmlFor: `${this.name}__input` }, this.displayName),
137
- h("div", { class: 'select__wrapper--relative' },
138
- this.tooltip &&
139
- h("img", { class: 'select__tooltip-icon', src: tooltipIcon, alt: "", ref: (el) => this.tooltipIconReference = el, onClick: () => this.showTooltip = !this.showTooltip }),
140
- this.renderTooltip())),
141
- h("vaadin-combo-box", { name: this.name, id: `${this.name}__input`, class: `select__input ${invalidClass} ${this.autofilled ? 'select__input--autofilled' : ''}`, "item-label-path": "label", "item-value-path": "value", readOnly: this.autofilled, required: this.validation.mandatory, value: this.defaultValue, placeholder: `${this.placeholder}`, items: this.displayedOptions, onChange: this.handleChange }),
142
- h("small", { class: 'select__error-message' }, this.errorMessage));
143
- }
144
- static get is() { return "select-input"; }
145
- static get encapsulation() { return "shadow"; }
146
- static get originalStyleUrls() { return {
147
- "$": ["select-input.scss"]
148
- }; }
149
- static get styleUrls() { return {
150
- "$": ["select-input.css"]
151
- }; }
152
- static get properties() { return {
153
- "name": {
154
- "type": "string",
155
- "mutable": false,
156
- "complexType": {
157
- "original": "string",
158
- "resolved": "string",
159
- "references": {}
160
- },
161
- "required": false,
162
- "optional": false,
163
- "docs": {
164
- "tags": [],
165
- "text": "Name of the input."
166
- },
167
- "attribute": "name",
168
- "reflect": true
169
- },
170
- "displayName": {
171
- "type": "string",
172
- "mutable": false,
173
- "complexType": {
174
- "original": "string",
175
- "resolved": "string",
176
- "references": {}
177
- },
178
- "required": false,
179
- "optional": false,
180
- "docs": {
181
- "tags": [],
182
- "text": "Name of input to be shown to the user."
183
- },
184
- "attribute": "display-name",
185
- "reflect": true
186
- },
187
- "placeholder": {
188
- "type": "string",
189
- "mutable": false,
190
- "complexType": {
191
- "original": "string",
192
- "resolved": "string",
193
- "references": {}
194
- },
195
- "required": false,
196
- "optional": false,
197
- "docs": {
198
- "tags": [],
199
- "text": "Placeholder text to be shown."
200
- },
201
- "attribute": "placeholder",
202
- "reflect": true
203
- },
204
- "action": {
205
- "type": "string",
206
- "mutable": false,
207
- "complexType": {
208
- "original": "string",
209
- "resolved": "string",
210
- "references": {}
211
- },
212
- "required": false,
213
- "optional": false,
214
- "docs": {
215
- "tags": [],
216
- "text": "Special behaviour an input should have. Can be fetching for data."
217
- },
218
- "attribute": "action",
219
- "reflect": true
220
- },
221
- "defaultValue": {
222
- "type": "string",
223
- "mutable": false,
224
- "complexType": {
225
- "original": "string",
226
- "resolved": "string",
227
- "references": {}
228
- },
229
- "required": false,
230
- "optional": false,
231
- "docs": {
232
- "tags": [],
233
- "text": "Default value for the input."
234
- },
235
- "attribute": "default-value",
236
- "reflect": true,
237
- "defaultValue": "''"
238
- },
239
- "autofilled": {
240
- "type": "boolean",
241
- "mutable": false,
242
- "complexType": {
243
- "original": "boolean",
244
- "resolved": "boolean",
245
- "references": {}
246
- },
247
- "required": false,
248
- "optional": false,
249
- "docs": {
250
- "tags": [],
251
- "text": "Boolean. Determines if input should be readonly."
252
- },
253
- "attribute": "autofilled",
254
- "reflect": true
255
- },
256
- "tooltip": {
257
- "type": "string",
258
- "mutable": false,
259
- "complexType": {
260
- "original": "string",
261
- "resolved": "string",
262
- "references": {}
263
- },
264
- "required": false,
265
- "optional": false,
266
- "docs": {
267
- "tags": [],
268
- "text": "Tooltip text."
269
- },
270
- "attribute": "tooltip",
271
- "reflect": true
272
- },
273
- "options": {
274
- "type": "unknown",
275
- "mutable": false,
276
- "complexType": {
277
- "original": "Option[]",
278
- "resolved": "Option[]",
279
- "references": {
280
- "Option": {
281
- "location": "import",
282
- "path": "../../utils/types"
283
- }
87
+ componentDidRender() {
88
+ // start custom styling area
89
+ if (!this.limitStylingAppends && this.stylingContainer) {
90
+ if (this.clientStyling)
91
+ this.setClientStyling();
92
+ this.limitStylingAppends = true;
284
93
  }
285
- },
286
- "required": false,
287
- "optional": false,
288
- "docs": {
289
- "tags": [],
290
- "text": "Options of the input."
291
- },
292
- "defaultValue": "[]"
293
- },
294
- "validation": {
295
- "type": "unknown",
296
- "mutable": false,
297
- "complexType": {
298
- "original": "ValidationSchema",
299
- "resolved": "ValidationSchema",
300
- "references": {
301
- "ValidationSchema": {
302
- "location": "import",
303
- "path": "../../utils/types"
304
- }
94
+ // end custom styling area
95
+ }
96
+ componentDidLoad() {
97
+ this.inputReference = this.element.shadowRoot.querySelector('input');
98
+ this.isValid = this.setValidity();
99
+ if (this.defaultValue) {
100
+ this.value = this.defaultValue.toUpperCase();
101
+ this.valueHandler({ name: this.name, value: this.value });
305
102
  }
306
- },
307
- "required": false,
308
- "optional": false,
309
- "docs": {
310
- "tags": [],
311
- "text": "Object of validation rules for the input."
312
- }
313
- },
314
- "language": {
315
- "type": "string",
316
- "mutable": false,
317
- "complexType": {
318
- "original": "string",
319
- "resolved": "string",
320
- "references": {}
321
- },
322
- "required": false,
323
- "optional": false,
324
- "docs": {
325
- "tags": [],
326
- "text": "Currently selected language."
327
- },
328
- "attribute": "language",
329
- "reflect": true
330
- },
331
- "emitValue": {
332
- "type": "boolean",
333
- "mutable": false,
334
- "complexType": {
335
- "original": "boolean",
336
- "resolved": "boolean",
337
- "references": {}
338
- },
339
- "required": false,
340
- "optional": false,
341
- "docs": {
342
- "tags": [],
343
- "text": "State passed down from the parent element. Will trigger the input to send it's value through an event."
344
- },
345
- "attribute": "emit-value",
346
- "reflect": true
347
- },
348
- "clientStyling": {
349
- "type": "string",
350
- "mutable": false,
351
- "complexType": {
352
- "original": "string",
353
- "resolved": "string",
354
- "references": {}
355
- },
356
- "required": false,
357
- "optional": false,
358
- "docs": {
359
- "tags": [],
360
- "text": "Client custom styling via inline style"
361
- },
362
- "attribute": "client-styling",
363
- "reflect": true,
364
- "defaultValue": "''"
365
103
  }
366
- }; }
367
- static get states() { return {
368
- "errorMessage": {},
369
- "isValid": {},
370
- "limitStylingAppends": {},
371
- "showTooltip": {}
372
- }; }
373
- static get events() { return [{
374
- "method": "sendValidityState",
375
- "name": "sendValidityState",
376
- "bubbles": true,
377
- "cancelable": true,
378
- "composed": true,
379
- "docs": {
380
- "tags": [],
381
- "text": ""
382
- },
383
- "complexType": {
384
- "original": "InputStateEvent",
385
- "resolved": "InputStateEvent",
386
- "references": {
387
- "InputStateEvent": {
388
- "location": "import",
389
- "path": "../../utils/types"
390
- }
104
+ getOptions(endpoint) {
105
+ const url = new URL(endpoint);
106
+ return new Promise((resolve, reject) => {
107
+ fetch(url.href)
108
+ .then((res) => res.json())
109
+ .then((options) => {
110
+ resolve(options);
111
+ }).catch((err) => {
112
+ console.error(err);
113
+ reject(err);
114
+ });
115
+ });
116
+ }
117
+ setValidity() {
118
+ return this.inputReference.validity.valid;
119
+ }
120
+ setErrorMessage() {
121
+ if (this.inputReference.validity.valueMissing) {
122
+ return translate('requiredError', this.language);
391
123
  }
392
- }
393
- }, {
394
- "method": "sendInputValue",
395
- "name": "sendInputValue",
396
- "bubbles": true,
397
- "cancelable": true,
398
- "composed": true,
399
- "docs": {
400
- "tags": [],
401
- "text": ""
402
- },
403
- "complexType": {
404
- "original": "InputValueEvent",
405
- "resolved": "InputValueEvent",
406
- "references": {
407
- "InputValueEvent": {
408
- "location": "import",
409
- "path": "../../utils/types"
410
- }
124
+ }
125
+ renderTooltip() {
126
+ if (this.showTooltip) {
127
+ return (h("div", { class: `select__tooltip ${this.showTooltip ? 'visible' : ''}`, ref: (el) => this.tooltipReference = el, innerHTML: this.tooltip }));
411
128
  }
412
- }
413
- }]; }
414
- static get elementRef() { return "element"; }
415
- static get watchers() { return [{
416
- "propName": "isValid",
417
- "methodName": "validityChanged"
418
- }, {
419
- "propName": "emitValue",
420
- "methodName": "emitValueHandler"
421
- }]; }
422
- static get listeners() { return [{
423
- "name": "click",
424
- "method": "handleClickOutside",
425
- "target": "document",
426
- "capture": false,
427
- "passive": false
428
- }]; }
129
+ return null;
130
+ }
131
+ render() {
132
+ let invalidClass = '';
133
+ if (this.touched) {
134
+ invalidClass = this.isValid == true || this.isValid == undefined ? '' : 'text__input--invalid';
135
+ }
136
+ return h("div", { key: 'c235991f572ea3f8659f66d660fd1fb41b0094ad', class: `select__wrapper ${this.autofilled ? 'select__wrapper--autofilled' : ''} ${this.name}__input`, ref: el => this.stylingContainer = el }, h("div", { key: '50931d2e1345bb8337820409a6aff2eee4d33cd5', class: 'select__wrapper--flex' }, h("label", { key: '28a05e2a88132fb8ad279ec0fbc0d49253d3ffbc', class: 'select__label', htmlFor: `${this.name}__input` }, `${this.displayName} ${this.validation.mandatory ? '*' : ''}`), h("div", { key: '1d53254871214080c3f1d25c73380a9b9df19aab', class: 'select__wrapper--relative' }, this.tooltip &&
137
+ h("img", { key: '020465f83dd9a03a37b223521bfce37a66df818d', class: 'select__tooltip-icon', src: tooltipIcon, alt: "", ref: (el) => this.tooltipIconReference = el, onClick: () => this.showTooltip = !this.showTooltip }), this.renderTooltip())), h("vaadin-combo-box", { key: 'bbf7aff9102f6c849c84ff7cb390ed57e5b992b2', name: this.name, id: `${this.name}__input`, class: `select__input ${invalidClass} ${this.autofilled ? 'select__input--autofilled' : ''}`, "item-label-path": "label", "item-value-path": "value", readOnly: this.autofilled, required: this.validation.mandatory, value: this.defaultValue, placeholder: `${this.placeholder}`, items: this.displayedOptions, onChange: this.handleChange }), h("small", { key: '4cda22e9fdccb3960107a661fa24649946d6bb14', class: 'select__error-message' }, this.errorMessage));
138
+ }
139
+ static get is() { return "select-input"; }
140
+ static get encapsulation() { return "shadow"; }
141
+ static get originalStyleUrls() {
142
+ return {
143
+ "$": ["select-input.scss"]
144
+ };
145
+ }
146
+ static get styleUrls() {
147
+ return {
148
+ "$": ["select-input.css"]
149
+ };
150
+ }
151
+ static get properties() {
152
+ return {
153
+ "name": {
154
+ "type": "string",
155
+ "mutable": false,
156
+ "complexType": {
157
+ "original": "string",
158
+ "resolved": "string",
159
+ "references": {}
160
+ },
161
+ "required": false,
162
+ "optional": false,
163
+ "docs": {
164
+ "tags": [],
165
+ "text": "Name of the input."
166
+ },
167
+ "attribute": "name",
168
+ "reflect": true
169
+ },
170
+ "displayName": {
171
+ "type": "string",
172
+ "mutable": false,
173
+ "complexType": {
174
+ "original": "string",
175
+ "resolved": "string",
176
+ "references": {}
177
+ },
178
+ "required": false,
179
+ "optional": false,
180
+ "docs": {
181
+ "tags": [],
182
+ "text": "Name of input to be shown to the user."
183
+ },
184
+ "attribute": "display-name",
185
+ "reflect": true
186
+ },
187
+ "placeholder": {
188
+ "type": "string",
189
+ "mutable": false,
190
+ "complexType": {
191
+ "original": "string",
192
+ "resolved": "string",
193
+ "references": {}
194
+ },
195
+ "required": false,
196
+ "optional": false,
197
+ "docs": {
198
+ "tags": [],
199
+ "text": "Placeholder text to be shown."
200
+ },
201
+ "attribute": "placeholder",
202
+ "reflect": true
203
+ },
204
+ "action": {
205
+ "type": "string",
206
+ "mutable": false,
207
+ "complexType": {
208
+ "original": "string",
209
+ "resolved": "string",
210
+ "references": {}
211
+ },
212
+ "required": false,
213
+ "optional": false,
214
+ "docs": {
215
+ "tags": [],
216
+ "text": "Special behaviour an input should have. Can be fetching for data."
217
+ },
218
+ "attribute": "action",
219
+ "reflect": true
220
+ },
221
+ "defaultValue": {
222
+ "type": "string",
223
+ "mutable": false,
224
+ "complexType": {
225
+ "original": "string",
226
+ "resolved": "string",
227
+ "references": {}
228
+ },
229
+ "required": false,
230
+ "optional": false,
231
+ "docs": {
232
+ "tags": [],
233
+ "text": "Default value for the input."
234
+ },
235
+ "attribute": "default-value",
236
+ "reflect": true,
237
+ "defaultValue": "''"
238
+ },
239
+ "autofilled": {
240
+ "type": "boolean",
241
+ "mutable": false,
242
+ "complexType": {
243
+ "original": "boolean",
244
+ "resolved": "boolean",
245
+ "references": {}
246
+ },
247
+ "required": false,
248
+ "optional": false,
249
+ "docs": {
250
+ "tags": [],
251
+ "text": "Boolean. Determines if input should be readonly."
252
+ },
253
+ "attribute": "autofilled",
254
+ "reflect": true
255
+ },
256
+ "tooltip": {
257
+ "type": "string",
258
+ "mutable": false,
259
+ "complexType": {
260
+ "original": "string",
261
+ "resolved": "string",
262
+ "references": {}
263
+ },
264
+ "required": false,
265
+ "optional": false,
266
+ "docs": {
267
+ "tags": [],
268
+ "text": "Tooltip text."
269
+ },
270
+ "attribute": "tooltip",
271
+ "reflect": true
272
+ },
273
+ "options": {
274
+ "type": "unknown",
275
+ "mutable": false,
276
+ "complexType": {
277
+ "original": "Option[]",
278
+ "resolved": "Option[]",
279
+ "references": {
280
+ "Option": {
281
+ "location": "import",
282
+ "path": "../../utils/types",
283
+ "id": "../../../../packages/stencil/general-input/src/utils/types.ts::Option"
284
+ }
285
+ }
286
+ },
287
+ "required": false,
288
+ "optional": false,
289
+ "docs": {
290
+ "tags": [],
291
+ "text": "Options of the input."
292
+ },
293
+ "defaultValue": "[]"
294
+ },
295
+ "validation": {
296
+ "type": "unknown",
297
+ "mutable": false,
298
+ "complexType": {
299
+ "original": "ValidationSchema",
300
+ "resolved": "ValidationSchema",
301
+ "references": {
302
+ "ValidationSchema": {
303
+ "location": "import",
304
+ "path": "../../utils/types",
305
+ "id": "../../../../packages/stencil/general-input/src/utils/types.ts::ValidationSchema"
306
+ }
307
+ }
308
+ },
309
+ "required": false,
310
+ "optional": false,
311
+ "docs": {
312
+ "tags": [],
313
+ "text": "Object of validation rules for the input."
314
+ }
315
+ },
316
+ "language": {
317
+ "type": "string",
318
+ "mutable": false,
319
+ "complexType": {
320
+ "original": "string",
321
+ "resolved": "string",
322
+ "references": {}
323
+ },
324
+ "required": false,
325
+ "optional": false,
326
+ "docs": {
327
+ "tags": [],
328
+ "text": "Currently selected language."
329
+ },
330
+ "attribute": "language",
331
+ "reflect": true
332
+ },
333
+ "emitValue": {
334
+ "type": "boolean",
335
+ "mutable": false,
336
+ "complexType": {
337
+ "original": "boolean",
338
+ "resolved": "boolean",
339
+ "references": {}
340
+ },
341
+ "required": false,
342
+ "optional": false,
343
+ "docs": {
344
+ "tags": [],
345
+ "text": "State passed down from the parent element. Will trigger the input to send it's value through an event."
346
+ },
347
+ "attribute": "emit-value",
348
+ "reflect": true
349
+ },
350
+ "clientStyling": {
351
+ "type": "string",
352
+ "mutable": false,
353
+ "complexType": {
354
+ "original": "string",
355
+ "resolved": "string",
356
+ "references": {}
357
+ },
358
+ "required": false,
359
+ "optional": false,
360
+ "docs": {
361
+ "tags": [],
362
+ "text": "Client custom styling via inline style"
363
+ },
364
+ "attribute": "client-styling",
365
+ "reflect": true,
366
+ "defaultValue": "''"
367
+ }
368
+ };
369
+ }
370
+ static get states() {
371
+ return {
372
+ "errorMessage": {},
373
+ "isValid": {},
374
+ "limitStylingAppends": {},
375
+ "showTooltip": {}
376
+ };
377
+ }
378
+ static get events() {
379
+ return [{
380
+ "method": "sendValidityState",
381
+ "name": "sendValidityState",
382
+ "bubbles": true,
383
+ "cancelable": true,
384
+ "composed": true,
385
+ "docs": {
386
+ "tags": [],
387
+ "text": ""
388
+ },
389
+ "complexType": {
390
+ "original": "InputStateEvent",
391
+ "resolved": "InputStateEvent",
392
+ "references": {
393
+ "InputStateEvent": {
394
+ "location": "import",
395
+ "path": "../../utils/types",
396
+ "id": "../../../../packages/stencil/general-input/src/utils/types.ts::InputStateEvent"
397
+ }
398
+ }
399
+ }
400
+ }, {
401
+ "method": "sendInputValue",
402
+ "name": "sendInputValue",
403
+ "bubbles": true,
404
+ "cancelable": true,
405
+ "composed": true,
406
+ "docs": {
407
+ "tags": [],
408
+ "text": ""
409
+ },
410
+ "complexType": {
411
+ "original": "InputValueEvent",
412
+ "resolved": "InputValueEvent",
413
+ "references": {
414
+ "InputValueEvent": {
415
+ "location": "import",
416
+ "path": "../../utils/types",
417
+ "id": "../../../../packages/stencil/general-input/src/utils/types.ts::InputValueEvent"
418
+ }
419
+ }
420
+ }
421
+ }];
422
+ }
423
+ static get elementRef() { return "element"; }
424
+ static get watchers() {
425
+ return [{
426
+ "propName": "isValid",
427
+ "methodName": "validityChanged"
428
+ }, {
429
+ "propName": "emitValue",
430
+ "methodName": "emitValueHandler"
431
+ }];
432
+ }
433
+ static get listeners() {
434
+ return [{
435
+ "name": "click",
436
+ "method": "handleClickOutside",
437
+ "target": "document",
438
+ "capture": false,
439
+ "passive": false
440
+ }];
441
+ }
429
442
  }