@everymatrix/general-input 1.32.4 → 1.33.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (136) hide show
  1. package/dist/cjs/checkbox-group-input_10.cjs.entry.js +36077 -0
  2. package/dist/cjs/general-input.cjs.entry.js +75 -0
  3. package/dist/cjs/general-input.cjs.js +19 -0
  4. package/dist/cjs/index-132a0774.js +1327 -0
  5. package/dist/cjs/index.cjs.js +18 -0
  6. package/dist/cjs/loader.cjs.js +21 -0
  7. package/dist/cjs/locale.utils-cef1d3b6.js +128 -0
  8. package/dist/cjs/toggle-checkbox-input.cjs.entry.js +85 -0
  9. package/dist/cjs/tooltipIcon-092a795f.js +5 -0
  10. package/dist/collection/collection-manifest.json +23 -0
  11. package/dist/collection/components/checkbox-group-input/checkbox-group-input.css +82 -0
  12. package/dist/collection/components/checkbox-group-input/checkbox-group-input.js +366 -0
  13. package/dist/collection/components/checkbox-input/checkbox-input.css +68 -0
  14. package/dist/collection/components/checkbox-input/checkbox-input.js +324 -0
  15. package/dist/collection/components/date-input/date-input.css +101 -0
  16. package/dist/collection/components/date-input/date-input.js +396 -0
  17. package/dist/collection/components/email-input/email-input.css +95 -0
  18. package/dist/collection/components/email-input/email-input.js +403 -0
  19. package/dist/collection/components/general-input/general-input.css +4 -0
  20. package/dist/collection/components/general-input/general-input.js +373 -0
  21. package/dist/collection/components/number-input/number-input.css +102 -0
  22. package/dist/collection/components/number-input/number-input.js +368 -0
  23. package/dist/collection/components/password-input/password-input.css +182 -0
  24. package/dist/collection/components/password-input/password-input.js +527 -0
  25. package/dist/collection/components/radio-input/radio-input.css +43 -0
  26. package/dist/collection/components/radio-input/radio-input.js +297 -0
  27. package/dist/collection/components/select-input/select-input.css +122 -0
  28. package/dist/collection/components/select-input/select-input.js +429 -0
  29. package/dist/collection/components/tel-input/tel-input.css +145 -0
  30. package/dist/collection/components/tel-input/tel-input.js +440 -0
  31. package/dist/collection/components/text-input/text-input.css +98 -0
  32. package/dist/collection/components/text-input/text-input.js +448 -0
  33. package/dist/collection/components/toggle-checkbox-input/toggle-checkbox-input.css +82 -0
  34. package/dist/collection/components/toggle-checkbox-input/toggle-checkbox-input.js +324 -0
  35. package/dist/collection/index.js +17 -0
  36. package/dist/collection/utils/locale.utils.js +123 -0
  37. package/dist/collection/utils/tooltipIcon.svg +5 -0
  38. package/dist/collection/utils/types.js +1 -0
  39. package/dist/collection/utils/utils.js +5 -0
  40. package/dist/components/active-mixin.js +975 -0
  41. package/dist/components/checkbox-group-input.d.ts +11 -0
  42. package/dist/components/checkbox-group-input.js +6 -0
  43. package/dist/components/checkbox-group-input2.js +1078 -0
  44. package/dist/components/checkbox-input.d.ts +11 -0
  45. package/dist/components/checkbox-input.js +6 -0
  46. package/dist/components/checkbox-input2.js +129 -0
  47. package/dist/components/date-input.d.ts +11 -0
  48. package/dist/components/date-input.js +6 -0
  49. package/dist/components/date-input2.js +11556 -0
  50. package/dist/components/email-input.d.ts +11 -0
  51. package/dist/components/email-input.js +6 -0
  52. package/dist/components/email-input2.js +171 -0
  53. package/dist/components/field-mixin.js +12426 -0
  54. package/dist/components/general-input.d.ts +11 -0
  55. package/dist/components/general-input.js +6 -0
  56. package/dist/components/general-input2.js +341 -0
  57. package/dist/components/index.d.ts +26 -0
  58. package/dist/components/index.js +18 -0
  59. package/dist/components/input-field-shared-styles.js +1211 -0
  60. package/dist/components/number-input.d.ts +11 -0
  61. package/dist/components/number-input.js +6 -0
  62. package/dist/components/number-input2.js +158 -0
  63. package/dist/components/password-input.d.ts +11 -0
  64. package/dist/components/password-input.js +6 -0
  65. package/dist/components/password-input2.js +1041 -0
  66. package/dist/components/radio-input.d.ts +11 -0
  67. package/dist/components/radio-input.js +6 -0
  68. package/dist/components/radio-input2.js +114 -0
  69. package/dist/components/select-input.d.ts +11 -0
  70. package/dist/components/select-input.js +6 -0
  71. package/dist/components/select-input2.js +183 -0
  72. package/dist/components/tel-input.d.ts +11 -0
  73. package/dist/components/tel-input.js +6 -0
  74. package/dist/components/tel-input2.js +197 -0
  75. package/dist/components/text-input.d.ts +11 -0
  76. package/dist/components/text-input.js +6 -0
  77. package/dist/components/text-input2.js +199 -0
  78. package/dist/components/toggle-checkbox-input.d.ts +11 -0
  79. package/dist/components/toggle-checkbox-input.js +6 -0
  80. package/dist/components/tooltipIcon.js +127 -0
  81. package/dist/components/vaadin-button.js +490 -0
  82. package/dist/components/vaadin-combo-box.js +4512 -0
  83. package/dist/components/virtual-keyboard-controller.js +2001 -0
  84. package/dist/esm/checkbox-group-input_10.entry.js +36064 -0
  85. package/dist/esm/general-input.entry.js +71 -0
  86. package/dist/esm/general-input.js +17 -0
  87. package/dist/esm/index-db76d5b5.js +1299 -0
  88. package/dist/esm/index.js +16 -0
  89. package/dist/esm/loader.js +17 -0
  90. package/dist/esm/locale.utils-de759721.js +125 -0
  91. package/dist/esm/polyfills/core-js.js +11 -0
  92. package/dist/esm/polyfills/css-shim.js +1 -0
  93. package/dist/esm/polyfills/dom.js +79 -0
  94. package/dist/esm/polyfills/es5-html-element.js +1 -0
  95. package/dist/esm/polyfills/index.js +34 -0
  96. package/dist/esm/polyfills/system.js +6 -0
  97. package/dist/esm/toggle-checkbox-input.entry.js +81 -0
  98. package/dist/esm/tooltipIcon-99c1c7b7.js +3 -0
  99. package/dist/general-input/general-input.esm.js +1 -0
  100. package/dist/general-input/index.esm.js +1 -0
  101. package/dist/general-input/p-10efdf3f.js +1 -0
  102. package/dist/general-input/p-613c3e00.entry.js +1 -0
  103. package/dist/general-input/p-660bcdd1.entry.js +1 -0
  104. package/dist/general-input/p-9b6b0396.entry.js +3646 -0
  105. package/dist/general-input/p-b408093e.js +1 -0
  106. package/dist/general-input/p-f4f4ccda.js +1 -0
  107. package/dist/index.cjs.js +1 -0
  108. package/dist/index.js +1 -0
  109. package/dist/stencil.config.js +22 -0
  110. package/dist/types/Users/adrian.pripon/Documents/Work/widgets-stencil/packages/general-input/.stencil/packages/general-input/stencil.config.d.ts +2 -0
  111. package/dist/types/components/checkbox-group-input/checkbox-group-input.d.ts +74 -0
  112. package/dist/types/components/checkbox-input/checkbox-input.d.ts +65 -0
  113. package/dist/types/components/date-input/date-input.d.ts +84 -0
  114. package/dist/types/components/email-input/email-input.d.ts +80 -0
  115. package/dist/types/components/general-input/general-input.d.ts +75 -0
  116. package/dist/types/components/number-input/number-input.d.ts +74 -0
  117. package/dist/types/components/password-input/password-input.d.ts +91 -0
  118. package/dist/types/components/radio-input/radio-input.d.ts +59 -0
  119. package/dist/types/components/select-input/select-input.d.ts +83 -0
  120. package/dist/types/components/tel-input/tel-input.d.ts +89 -0
  121. package/dist/types/components/text-input/text-input.d.ts +84 -0
  122. package/dist/types/components/toggle-checkbox-input/toggle-checkbox-input.d.ts +67 -0
  123. package/dist/types/components.d.ts +1268 -0
  124. package/dist/types/index.d.ts +1 -0
  125. package/dist/types/stencil-public-runtime.d.ts +1565 -0
  126. package/dist/types/utils/locale.utils.d.ts +17 -0
  127. package/dist/types/utils/types.d.ts +87 -0
  128. package/dist/types/utils/utils.d.ts +1 -0
  129. package/loader/cdn.js +3 -0
  130. package/loader/index.cjs.js +3 -0
  131. package/loader/index.d.ts +12 -0
  132. package/loader/index.es2017.js +3 -0
  133. package/loader/index.js +4 -0
  134. package/loader/package.json +10 -0
  135. package/package.json +2 -3
  136. package/LICENSE +0 -21
@@ -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
+ }
@@ -0,0 +1,68 @@
1
+ *,
2
+ *::before,
3
+ *::after {
4
+ padding: 0;
5
+ margin: 0;
6
+ box-sizing: border-box;
7
+ }
8
+
9
+ .checkbox {
10
+ font-family: "Roboto";
11
+ font-style: normal;
12
+ }
13
+ .checkbox__wrapper {
14
+ display: flex;
15
+ gap: 10px;
16
+ position: relative;
17
+ align-items: baseline;
18
+ }
19
+ .checkbox__wrapper--relative {
20
+ position: relative;
21
+ }
22
+ .checkbox__input {
23
+ transform: scale(1.307, 1.307);
24
+ margin-left: 2px;
25
+ accent-color: var(--emfe-w-login-color-primary, var(--emfe-w-color-primary, #D0046C));
26
+ }
27
+ .checkbox__label {
28
+ font-style: inherit;
29
+ font-family: inherit;
30
+ font-weight: 400;
31
+ font-size: 16px;
32
+ color: var(--emfe-w-registration-typography, var(--emfe-w-color-black, #000000));
33
+ line-height: 1.5;
34
+ cursor: pointer;
35
+ padding: 0;
36
+ }
37
+ .checkbox__label-text {
38
+ font-size: 16px;
39
+ }
40
+ .checkbox__label a {
41
+ color: var(--emfe-w-login-color-primary, var(--emfe-w-color-primary, #D0046C));
42
+ }
43
+ .checkbox__error-message {
44
+ position: absolute;
45
+ top: calc(100% + 5px);
46
+ left: 0;
47
+ color: var(--emfe-w-color-error, var(--emfe-w-color-red, #ed0909));
48
+ }
49
+ .checkbox__tooltip-icon {
50
+ width: 16px;
51
+ height: auto;
52
+ }
53
+ .checkbox__tooltip {
54
+ position: absolute;
55
+ top: 0;
56
+ right: 20px;
57
+ background-color: var(--emfe-w-color-white, #FFFFFF);
58
+ border: 1px solid var(--emfe-w-color-gray-100, #E6E6E6);
59
+ color: var(--emfe-w-registration-typography, var(--emfe-w-color-black, #000000));
60
+ padding: 10px;
61
+ border-radius: 5px;
62
+ opacity: 0;
63
+ transition: opacity 0.3s ease-in-out;
64
+ z-index: 10;
65
+ }
66
+ .checkbox__tooltip.visible {
67
+ opacity: 1;
68
+ }