@everymatrix/general-input 1.10.2 → 1.15.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 (96) hide show
  1. package/dist/cjs/checkbox-group-input_10.cjs.entry.js +35539 -0
  2. package/dist/cjs/general-input.cjs.entry.js +34 -13
  3. package/dist/cjs/general-input.cjs.js +2 -2
  4. package/dist/cjs/{index-64a5cb7f.js → index-132a0774.js} +119 -6
  5. package/dist/cjs/loader.cjs.js +2 -2
  6. package/dist/cjs/locale.utils-7665b010.js +71 -0
  7. package/dist/cjs/toggle-checkbox-input.cjs.entry.js +85 -0
  8. package/dist/cjs/tooltipIcon-092a795f.js +5 -0
  9. package/dist/collection/collection-manifest.json +3 -1
  10. package/dist/collection/components/checkbox-group-input/checkbox-group-input.css +62 -0
  11. package/dist/collection/components/checkbox-group-input/checkbox-group-input.js +366 -0
  12. package/dist/collection/components/checkbox-input/checkbox-input.css +47 -1
  13. package/dist/collection/components/checkbox-input/checkbox-input.js +143 -16
  14. package/dist/collection/components/date-input/date-input.css +64 -30
  15. package/dist/collection/components/date-input/date-input.js +194 -13
  16. package/dist/collection/components/email-input/email-input.css +63 -28
  17. package/dist/collection/components/email-input/email-input.js +197 -21
  18. package/dist/collection/components/general-input/general-input.js +163 -21
  19. package/dist/collection/components/number-input/number-input.css +65 -30
  20. package/dist/collection/components/number-input/number-input.js +174 -19
  21. package/dist/collection/components/password-input/password-input.css +120 -29
  22. package/dist/collection/components/password-input/password-input.js +341 -25
  23. package/dist/collection/components/radio-input/radio-input.css +22 -1
  24. package/dist/collection/components/radio-input/radio-input.js +89 -10
  25. package/dist/collection/components/select-input/select-input.css +75 -22
  26. package/dist/collection/components/select-input/select-input.js +180 -37
  27. package/dist/collection/components/tel-input/tel-input.css +91 -33
  28. package/dist/collection/components/tel-input/tel-input.js +202 -24
  29. package/dist/collection/components/text-input/text-input.css +63 -28
  30. package/dist/collection/components/text-input/text-input.js +208 -39
  31. package/dist/collection/components/toggle-checkbox-input/toggle-checkbox-input.css +76 -0
  32. package/dist/collection/components/toggle-checkbox-input/toggle-checkbox-input.js +324 -0
  33. package/dist/collection/utils/locale.utils.js +52 -13
  34. package/dist/collection/utils/tooltipIcon.svg +5 -0
  35. package/dist/components/active-mixin.js +975 -0
  36. package/dist/components/checkbox-group-input.d.ts +11 -0
  37. package/dist/components/checkbox-group-input.js +6 -0
  38. package/dist/components/checkbox-group-input2.js +1125 -0
  39. package/dist/components/checkbox-input2.js +62 -12
  40. package/dist/components/date-input2.js +10247 -15
  41. package/dist/components/email-input2.js +98 -21
  42. package/dist/components/field-mixin.js +12712 -0
  43. package/dist/components/general-input.js +1 -118
  44. package/dist/components/general-input2.js +331 -0
  45. package/dist/components/input-field-shared-styles.js +1114 -0
  46. package/dist/components/number-input2.js +92 -16
  47. package/dist/components/password-input2.js +924 -24
  48. package/dist/components/pattern-mixin.js +85 -0
  49. package/dist/components/radio-input2.js +45 -11
  50. package/dist/components/select-input2.js +87 -27
  51. package/dist/components/tel-input2.js +122 -22
  52. package/dist/components/text-input2.js +120 -34
  53. package/dist/components/toggle-checkbox-input.d.ts +11 -0
  54. package/dist/components/toggle-checkbox-input.js +6 -0
  55. package/dist/components/tooltipIcon.js +70 -0
  56. package/dist/components/vaadin-button.js +461 -0
  57. package/dist/components/vaadin-combo-box.js +4329 -0
  58. package/dist/components/virtual-keyboard-controller.js +2658 -0
  59. package/dist/esm/checkbox-group-input_10.entry.js +35526 -0
  60. package/dist/esm/general-input.entry.js +34 -13
  61. package/dist/esm/general-input.js +2 -2
  62. package/dist/esm/{index-df80f936.js → index-db76d5b5.js} +118 -7
  63. package/dist/esm/loader.js +2 -2
  64. package/dist/esm/locale.utils-95ea2605.js +68 -0
  65. package/dist/esm/toggle-checkbox-input.entry.js +81 -0
  66. package/dist/esm/tooltipIcon-99c1c7b7.js +3 -0
  67. package/dist/general-input/general-input.esm.js +1 -1
  68. package/dist/general-input/p-0966f523.entry.js +3581 -0
  69. package/dist/general-input/p-916a1319.entry.js +1 -0
  70. package/dist/general-input/p-b408093e.js +1 -0
  71. package/dist/general-input/p-c2d4d6ac.entry.js +1 -0
  72. package/dist/general-input/p-f4f4ccda.js +1 -0
  73. package/dist/general-input/p-f6132f1d.js +1 -0
  74. package/dist/types/components/checkbox-group-input/checkbox-group-input.d.ts +74 -0
  75. package/dist/types/components/checkbox-input/checkbox-input.d.ts +28 -2
  76. package/dist/types/components/date-input/date-input.d.ts +43 -1
  77. package/dist/types/components/email-input/email-input.d.ts +37 -3
  78. package/dist/types/components/general-input/general-input.d.ts +30 -0
  79. package/dist/types/components/number-input/number-input.d.ts +34 -3
  80. package/dist/types/components/password-input/password-input.d.ts +56 -7
  81. package/dist/types/components/radio-input/radio-input.d.ts +17 -1
  82. package/dist/types/components/select-input/select-input.d.ts +36 -3
  83. package/dist/types/components/tel-input/tel-input.d.ts +40 -5
  84. package/dist/types/components/text-input/text-input.d.ts +84 -0
  85. package/dist/types/components/toggle-checkbox-input/toggle-checkbox-input.d.ts +67 -0
  86. package/dist/types/components.d.ts +568 -9
  87. package/dist/types/utils/locale.utils.d.ts +9 -0
  88. package/dist/types/utils/types.d.ts +41 -9
  89. package/package.json +8 -1
  90. package/dist/cjs/checkbox-input_9.cjs.entry.js +0 -623
  91. package/dist/components/locale.utils.js +0 -29
  92. package/dist/esm/checkbox-input_9.entry.js +0 -611
  93. package/dist/general-input/p-1703fce3.entry.js +0 -1
  94. package/dist/general-input/p-d9f7fa2e.js +0 -1
  95. package/dist/general-input/p-dea0a4ac.entry.js +0 -1
  96. /package/dist/types/Users/{user/workspace/everymatrix → adrian.pripon/Documents/Work}/widgets-stencil/packages/general-input/.stencil/packages/general-input/stencil.config.d.ts +0 -0
@@ -0,0 +1,62 @@
1
+ *,
2
+ *::before,
3
+ *::after {
4
+ padding: 0;
5
+ margin: 0;
6
+ box-sizing: border-box;
7
+ }
8
+
9
+ .checkboxgroup {
10
+ font-family: "Roboto";
11
+ font-style: normal;
12
+ font-size: 15px;
13
+ }
14
+ .checkboxgroup__wrapper {
15
+ position: relative;
16
+ }
17
+ .checkboxgroup__wrapper--flex {
18
+ display: flex;
19
+ gap: 5px;
20
+ align-content: flex-start;
21
+ }
22
+ .checkboxgroup__wrapper--relative {
23
+ position: relative;
24
+ display: inline;
25
+ }
26
+ .checkboxgroup__label {
27
+ font-style: inherit;
28
+ font-family: inherit;
29
+ font-weight: 400;
30
+ font-size: 16px;
31
+ color: #2B2D3F;
32
+ line-height: 14px;
33
+ }
34
+ .checkboxgroup__label-text {
35
+ font-size: 16px;
36
+ }
37
+ .checkboxgroup__error-message {
38
+ position: absolute;
39
+ top: calc(100% + 5px);
40
+ left: 0;
41
+ color: #cc0000b3;
42
+ }
43
+ .checkboxgroup__tooltip-icon {
44
+ width: 16px;
45
+ height: auto;
46
+ }
47
+ .checkboxgroup__tooltip {
48
+ position: absolute;
49
+ top: 0;
50
+ right: 0;
51
+ background-color: #FFFFFF;
52
+ border: 1px solid #B0B0B0;
53
+ color: #2B2D3F;
54
+ padding: 10px;
55
+ border-radius: 5px;
56
+ opacity: 0;
57
+ transition: opacity 0.3s ease-in-out;
58
+ z-index: 10;
59
+ }
60
+ .checkboxgroup__tooltip.visible {
61
+ opacity: 1;
62
+ }
@@ -0,0 +1,366 @@
1
+ import { Component, h, Prop, State, Event, Listen, Element, Watch } from '@stencil/core';
2
+ import { translate } from '../../utils/locale.utils';
3
+ import tooltipIcon from '../../utils/tooltipIcon.svg';
4
+ import '@vaadin/checkbox';
5
+ import '@vaadin/checkbox-group';
6
+ export class CheckboxGroupInput {
7
+ constructor() {
8
+ /**
9
+ * Default value for the input.
10
+ */
11
+ this.defaultValue = '';
12
+ /**
13
+ * Client custom styling via inline style
14
+ */
15
+ this.clientStyling = '';
16
+ this.limitStylingAppends = false;
17
+ this.showTooltip = false;
18
+ this.selectedValues = [];
19
+ this.value = null;
20
+ this.setClientStyling = () => {
21
+ let sheet = document.createElement('style');
22
+ sheet.innerHTML = this.clientStyling;
23
+ this.stylingContainer.prepend(sheet);
24
+ };
25
+ }
26
+ validityChanged() {
27
+ this.validityStateHandler({ valid: this.isValid, name: this.name });
28
+ if (this.emitValue == true) {
29
+ this.valueHandler({ name: this.name, value: this.value, type: 'checkboxgroup' });
30
+ }
31
+ }
32
+ setValue() {
33
+ this.value = this.options.reduce((acc, option) => {
34
+ acc[option.name] = this.selectedValues.includes(option.name);
35
+ return acc;
36
+ }, {});
37
+ this.emitValueHandler(true);
38
+ }
39
+ validityStateHandler(inputStateEvent) {
40
+ this.sendValidityState.emit(inputStateEvent);
41
+ }
42
+ emitValueHandler(newValue) {
43
+ if (newValue == true && this.isValid) {
44
+ this.valueHandler({ name: this.name, value: this.value, type: 'checkboxgroup' });
45
+ }
46
+ }
47
+ valueHandler(inputValueEvent) {
48
+ this.sendInputValue.emit(inputValueEvent);
49
+ }
50
+ handleClickOutside(event) {
51
+ if (event.composedPath()[0] === this.tooltipIconReference)
52
+ return;
53
+ if (event.composedPath()[0] !== this.tooltipReference)
54
+ this.showTooltip = false;
55
+ }
56
+ componentDidRender() {
57
+ // start custom styling area
58
+ if (!this.limitStylingAppends && this.stylingContainer) {
59
+ if (this.clientStyling)
60
+ this.setClientStyling();
61
+ this.limitStylingAppends = true;
62
+ }
63
+ // end custom styling area
64
+ }
65
+ componentDidLoad() {
66
+ this.inputReference = this.element.shadowRoot.querySelector('input');
67
+ // For now this input has no validation. Send isValid as true immediately.
68
+ //@TODO: add validation logic to it, if business reason arises.
69
+ this.isValid = this.setValidity();
70
+ if (this.defaultValue) {
71
+ this.selectedValues = this.options.map((checkbox) => checkbox.name);
72
+ this.value = this.defaultValue;
73
+ this.valueHandler({ name: this.name, value: this.value });
74
+ }
75
+ }
76
+ setValidity() {
77
+ return this.inputReference.validity.valid;
78
+ }
79
+ setErrorMessage() {
80
+ if (this.inputReference.validity.valueMissing) {
81
+ return translate('requiredError', this.language);
82
+ }
83
+ }
84
+ renderTooltip() {
85
+ if (this.showTooltip) {
86
+ return (h("div", { class: `checkboxgroup__tooltip ${this.showTooltip ? 'visible' : ''}`, ref: (el) => this.tooltipReference = el, innerHTML: this.tooltip }));
87
+ }
88
+ return null;
89
+ }
90
+ handleParentCheckbox(e) {
91
+ // Logic for toggling the children checkboxes.
92
+ this.selectedValues = e.target.checked
93
+ ? this.options.map((checkbox) => checkbox.name)
94
+ : [];
95
+ }
96
+ renderLabel() {
97
+ return (h("label", { class: 'checkbox__label', htmlFor: `${this.name}__input`, slot: 'label' },
98
+ h("div", { class: 'checkbox__label-text', innerHTML: `${this.displayName} ${this.validation.mandatory ? '*' : ''}` })));
99
+ }
100
+ render() {
101
+ return h("div", { class: `checkboxgroup__wrapper ${this.name}__input`, ref: el => this.stylingContainer = el },
102
+ h("div", { class: 'checkboxgroup__wrapper--flex' },
103
+ h("vaadin-checkbox", { class: 'checkbox__input', checked: this.selectedValues.length === this.options.length || this.defaultValue === 'true', indeterminate: this.selectedValues.length > 0 && this.selectedValues.length < this.options.length, onChange: (e) => this.handleParentCheckbox(e) }, this.renderLabel()),
104
+ this.tooltip &&
105
+ h("img", { class: 'checkboxgroup__tooltip-icon', src: tooltipIcon, alt: "", ref: (el) => this.tooltipIconReference = el, onClick: () => this.showTooltip = !this.showTooltip }),
106
+ this.renderTooltip()),
107
+ h("small", { class: 'checkboxgroup__error-message' }, this.errorMessage),
108
+ h("vaadin-checkbox-group", { theme: "vertical", value: this.selectedValues, "on-value-changed": (event) => {
109
+ this.selectedValues = event.detail.value;
110
+ } }, this.options.map((checkbox) => h("vaadin-checkbox", { class: 'checkbox__input', name: checkbox.name, value: checkbox.name, label: checkbox.displayName }))));
111
+ }
112
+ static get is() { return "checkbox-group-input"; }
113
+ static get encapsulation() { return "shadow"; }
114
+ static get originalStyleUrls() { return {
115
+ "$": ["checkbox-group-input.scss"]
116
+ }; }
117
+ static get styleUrls() { return {
118
+ "$": ["checkbox-group-input.css"]
119
+ }; }
120
+ static get properties() { return {
121
+ "name": {
122
+ "type": "string",
123
+ "mutable": false,
124
+ "complexType": {
125
+ "original": "string",
126
+ "resolved": "string",
127
+ "references": {}
128
+ },
129
+ "required": false,
130
+ "optional": false,
131
+ "docs": {
132
+ "tags": [],
133
+ "text": "Name of the input."
134
+ },
135
+ "attribute": "name",
136
+ "reflect": true
137
+ },
138
+ "displayName": {
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 input to be shown to the user."
151
+ },
152
+ "attribute": "display-name",
153
+ "reflect": true
154
+ },
155
+ "defaultValue": {
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": "Default value for the input."
168
+ },
169
+ "attribute": "default-value",
170
+ "reflect": true,
171
+ "defaultValue": "''"
172
+ },
173
+ "autofilled": {
174
+ "type": "boolean",
175
+ "mutable": false,
176
+ "complexType": {
177
+ "original": "boolean",
178
+ "resolved": "boolean",
179
+ "references": {}
180
+ },
181
+ "required": false,
182
+ "optional": false,
183
+ "docs": {
184
+ "tags": [],
185
+ "text": "Boolean. Determines if input should be readonly."
186
+ },
187
+ "attribute": "autofilled",
188
+ "reflect": true
189
+ },
190
+ "tooltip": {
191
+ "type": "string",
192
+ "mutable": false,
193
+ "complexType": {
194
+ "original": "string",
195
+ "resolved": "string",
196
+ "references": {}
197
+ },
198
+ "required": false,
199
+ "optional": false,
200
+ "docs": {
201
+ "tags": [],
202
+ "text": "Tooltip text."
203
+ },
204
+ "attribute": "tooltip",
205
+ "reflect": true
206
+ },
207
+ "options": {
208
+ "type": "unknown",
209
+ "mutable": false,
210
+ "complexType": {
211
+ "original": "RegCfgContentField[]",
212
+ "resolved": "RegCfgContentField[]",
213
+ "references": {
214
+ "RegCfgContentField": {
215
+ "location": "import",
216
+ "path": "../../utils/types"
217
+ }
218
+ }
219
+ },
220
+ "required": false,
221
+ "optional": false,
222
+ "docs": {
223
+ "tags": [],
224
+ "text": "Options of the input."
225
+ }
226
+ },
227
+ "validation": {
228
+ "type": "unknown",
229
+ "mutable": false,
230
+ "complexType": {
231
+ "original": "ValidationSchema",
232
+ "resolved": "ValidationSchema",
233
+ "references": {
234
+ "ValidationSchema": {
235
+ "location": "import",
236
+ "path": "../../utils/types"
237
+ }
238
+ }
239
+ },
240
+ "required": false,
241
+ "optional": false,
242
+ "docs": {
243
+ "tags": [],
244
+ "text": "Object of validation rules for the input."
245
+ }
246
+ },
247
+ "language": {
248
+ "type": "string",
249
+ "mutable": false,
250
+ "complexType": {
251
+ "original": "string",
252
+ "resolved": "string",
253
+ "references": {}
254
+ },
255
+ "required": false,
256
+ "optional": false,
257
+ "docs": {
258
+ "tags": [],
259
+ "text": "Currently selected language."
260
+ },
261
+ "attribute": "language",
262
+ "reflect": true
263
+ },
264
+ "emitValue": {
265
+ "type": "boolean",
266
+ "mutable": false,
267
+ "complexType": {
268
+ "original": "boolean",
269
+ "resolved": "boolean",
270
+ "references": {}
271
+ },
272
+ "required": false,
273
+ "optional": false,
274
+ "docs": {
275
+ "tags": [],
276
+ "text": "State passed down from the parent element. Will trigger the input to send it's value through an event."
277
+ },
278
+ "attribute": "emit-value",
279
+ "reflect": true
280
+ },
281
+ "clientStyling": {
282
+ "type": "string",
283
+ "mutable": false,
284
+ "complexType": {
285
+ "original": "string",
286
+ "resolved": "string",
287
+ "references": {}
288
+ },
289
+ "required": false,
290
+ "optional": false,
291
+ "docs": {
292
+ "tags": [],
293
+ "text": "Client custom styling via inline style"
294
+ },
295
+ "attribute": "client-styling",
296
+ "reflect": true,
297
+ "defaultValue": "''"
298
+ }
299
+ }; }
300
+ static get states() { return {
301
+ "errorMessage": {},
302
+ "isValid": {},
303
+ "limitStylingAppends": {},
304
+ "showTooltip": {},
305
+ "selectedValues": {}
306
+ }; }
307
+ static get events() { return [{
308
+ "method": "sendValidityState",
309
+ "name": "sendValidityState",
310
+ "bubbles": true,
311
+ "cancelable": true,
312
+ "composed": true,
313
+ "docs": {
314
+ "tags": [],
315
+ "text": ""
316
+ },
317
+ "complexType": {
318
+ "original": "InputStateEvent",
319
+ "resolved": "InputStateEvent",
320
+ "references": {
321
+ "InputStateEvent": {
322
+ "location": "import",
323
+ "path": "../../utils/types"
324
+ }
325
+ }
326
+ }
327
+ }, {
328
+ "method": "sendInputValue",
329
+ "name": "sendInputValue",
330
+ "bubbles": true,
331
+ "cancelable": true,
332
+ "composed": true,
333
+ "docs": {
334
+ "tags": [],
335
+ "text": ""
336
+ },
337
+ "complexType": {
338
+ "original": "InputValueEvent",
339
+ "resolved": "InputValueEvent",
340
+ "references": {
341
+ "InputValueEvent": {
342
+ "location": "import",
343
+ "path": "../../utils/types"
344
+ }
345
+ }
346
+ }
347
+ }]; }
348
+ static get elementRef() { return "element"; }
349
+ static get watchers() { return [{
350
+ "propName": "isValid",
351
+ "methodName": "validityChanged"
352
+ }, {
353
+ "propName": "selectedValues",
354
+ "methodName": "setValue"
355
+ }, {
356
+ "propName": "emitValue",
357
+ "methodName": "emitValueHandler"
358
+ }]; }
359
+ static get listeners() { return [{
360
+ "name": "click",
361
+ "method": "handleClickOutside",
362
+ "target": "document",
363
+ "capture": false,
364
+ "passive": false
365
+ }]; }
366
+ }
@@ -6,15 +6,61 @@
6
6
  box-sizing: border-box;
7
7
  }
8
8
 
9
+ .checkbox {
10
+ font-family: "Roboto";
11
+ font-style: normal;
12
+ }
9
13
  .checkbox__wrapper {
10
14
  display: flex;
11
15
  gap: 10px;
12
16
  position: relative;
13
17
  align-items: baseline;
14
18
  }
19
+ .checkbox__wrapper--flex {
20
+ display: flex;
21
+ gap: 5px;
22
+ }
23
+ .checkbox__wrapper--relative {
24
+ position: relative;
25
+ }
26
+ .checkbox__input {
27
+ transform: scale(1.307, 1.307);
28
+ margin-left: 2px;
29
+ }
30
+ .checkbox__label {
31
+ font-style: inherit;
32
+ font-family: inherit;
33
+ font-weight: 400;
34
+ font-size: 16px;
35
+ color: #2B2D3F;
36
+ line-height: 14px;
37
+ }
38
+ .checkbox__label-text {
39
+ font-size: 16px;
40
+ }
15
41
  .checkbox__error-message {
16
42
  position: absolute;
17
43
  top: calc(100% + 5px);
18
44
  left: 0;
19
- color: red;
45
+ color: #cc0000b3;
46
+ }
47
+ .checkbox__tooltip-icon {
48
+ width: 16px;
49
+ height: auto;
50
+ }
51
+ .checkbox__tooltip {
52
+ position: absolute;
53
+ top: 0;
54
+ right: 20px;
55
+ background-color: #FFFFFF;
56
+ border: 1px solid #B0B0B0;
57
+ color: #2B2D3F;
58
+ padding: 10px;
59
+ border-radius: 5px;
60
+ opacity: 0;
61
+ transition: opacity 0.3s ease-in-out;
62
+ z-index: 10;
63
+ }
64
+ .checkbox__tooltip.visible {
65
+ opacity: 1;
20
66
  }