@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
@@ -6,55 +6,90 @@
6
6
  box-sizing: border-box;
7
7
  }
8
8
 
9
+ .email {
10
+ font-family: "Roboto";
11
+ font-style: normal;
12
+ }
9
13
  .email__wrapper {
10
14
  position: relative;
15
+ width: 100%;
16
+ }
17
+ .email__wrapper--autofilled {
18
+ pointer-events: none;
19
+ }
20
+ .email__wrapper--autofilled .email__label {
21
+ color: #979797;
22
+ }
23
+ .email__wrapper--autofilled .email__input {
24
+ color: #979797;
25
+ }
26
+ .email__wrapper--flex {
11
27
  display: flex;
12
- flex-direction: column-reverse;
13
- padding-top: 10px;
28
+ gap: 5px;
29
+ }
30
+ .email__wrapper--relative {
31
+ position: relative;
14
32
  }
15
33
  .email__label {
16
- color: #474747;
34
+ font-family: inherit;
35
+ font-style: normal;
36
+ font-weight: 500;
17
37
  font-size: 16px;
18
- position: absolute;
19
- bottom: 15px;
20
- left: 5px;
21
- transform: translateY(-25px);
22
- transition: all 0.3s cubic-bezier(0.5, 0, 0.5, 1);
38
+ line-height: 20px;
39
+ color: #2A3841;
23
40
  }
24
41
  .email__label--required::after {
25
42
  content: "*";
26
- margin-left: 5px;
27
- color: #666666;
43
+ font-family: inherit;
44
+ color: #2A3841;
45
+ margin-left: 2px;
28
46
  }
29
47
  .email__input {
30
- width: inherit;
31
- padding: 15px 6px;
32
- position: relative;
33
- border: none;
34
- border-bottom: 3px solid #666666;
48
+ border-radius: 4px;
35
49
  background-color: transparent;
36
- color: #666666;
37
- font-size: 16px;
38
50
  font-family: inherit;
51
+ font-style: normal;
52
+ font-weight: 300;
53
+ font-size: 16px;
54
+ line-height: 19px;
55
+ color: #2A2E3F;
56
+ padding: 10px 20px;
57
+ width: inherit;
58
+ position: relative;
59
+ border: 2px solid #DEE1EE;
39
60
  }
40
61
  .email__input:focus {
41
- outline: none;
42
- box-shadow: 0 5px 5px rgba(16, 15, 15, 0.1);
43
- }
44
- .email__input::placeholder {
45
- color: #666666;
62
+ outline-color: #3E3E3E;
46
63
  }
47
64
  .email__input--invalid {
48
- border-bottom: 3px solid #cc0000;
65
+ border: 2px solid #cc0000b3;
49
66
  }
50
- .email__input:placeholder-shown + .email__label {
51
- opacity: 0;
52
- visibility: hidden;
53
- transform: translateY(0);
67
+ .email__input::placeholder {
68
+ color: #979797;
54
69
  }
55
70
  .email__error-message {
56
71
  position: absolute;
57
72
  top: calc(100% + 5px);
58
73
  left: 0;
59
- color: #cc0000;
74
+ color: #cc0000b3;
75
+ }
76
+ .email__tooltip-icon {
77
+ width: 16px;
78
+ height: auto;
79
+ }
80
+ .email__tooltip {
81
+ position: absolute;
82
+ top: 0;
83
+ left: 20px;
84
+ background-color: #FFFFFF;
85
+ border: 1px solid #B0B0B0;
86
+ color: #2B2D3F;
87
+ padding: 10px;
88
+ border-radius: 5px;
89
+ opacity: 0;
90
+ transition: opacity 0.3s ease-in-out;
91
+ z-index: 10;
92
+ }
93
+ .email__tooltip.visible {
94
+ opacity: 1;
60
95
  }
@@ -1,8 +1,38 @@
1
- import { Component, h, Prop, State, Watch, Event } from '@stencil/core';
1
+ import { Component, h, Prop, State, Watch, Event, Listen } from '@stencil/core';
2
2
  import { translate } from '../../utils/locale.utils';
3
+ import tooltipIcon from '../../utils/tooltipIcon.svg';
3
4
  export class EmailInput {
4
5
  constructor() {
6
+ /**
7
+ * Client custom styling via inline style
8
+ */
9
+ this.clientStyling = '';
10
+ this.limitStylingAppends = false;
11
+ this.showTooltip = false;
5
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
+ };
6
36
  }
7
37
  validityChanged() {
8
38
  this.validityStateHandler({ valid: this.isValid, name: this.name });
@@ -10,39 +40,64 @@ export class EmailInput {
10
40
  this.valueHandler({ name: this.name, value: this.value });
11
41
  }
12
42
  }
13
- validityStateHandler(inputStateEvent) {
14
- this.sendValidityState.emit(inputStateEvent);
15
- }
16
43
  emitValueHandler(newValue) {
17
44
  if (newValue == true && this.isValid) {
18
45
  this.valueHandler({ name: this.name, value: this.value });
19
46
  }
20
47
  }
48
+ validityStateHandler(inputStateEvent) {
49
+ this.sendValidityState.emit(inputStateEvent);
50
+ }
21
51
  valueHandler(inputValueEvent) {
22
52
  this.sendInputValue.emit(inputValueEvent);
23
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
+ valueChangedHandler(event) {
61
+ if (this.isDuplicateInput) {
62
+ if (this.name === event.detail.name + 'Duplicate') {
63
+ this.duplicateInputValue = event.detail.value;
64
+ }
65
+ }
66
+ }
24
67
  connectedCallback() {
25
68
  this.validationPattern = this.setPattern();
26
69
  }
27
- handleInput(event) {
28
- this.value = event.target.value;
29
- this.errorMessage = this.setErrorMessage();
70
+ componentDidRender() {
71
+ // start custom styling area
72
+ if (!this.limitStylingAppends && this.stylingContainer) {
73
+ if (this.clientStyling)
74
+ this.setClientStyling();
75
+ this.limitStylingAppends = true;
76
+ }
77
+ // end custom styling area
78
+ }
79
+ componentDidLoad() {
30
80
  this.isValid = this.setValidity();
31
- this.validityStateHandler({ valid: this.isValid, name: this.name });
32
- this.emitValueHandler(true);
81
+ if (this.defaultValue) {
82
+ this.value = this.defaultValue;
83
+ this.valueHandler({ name: this.name, value: this.value });
84
+ }
33
85
  }
34
86
  setValidity() {
35
87
  return this.inputReference.validity.valid;
36
88
  }
37
89
  setPattern() {
38
- var _a;
90
+ var _a, _b;
39
91
  if (((_a = this.validation.custom) === null || _a === void 0 ? void 0 : _a.length) > 0) {
40
- return this.validation.custom.find(customValidation => customValidation.rule === 'regex').pattern;
92
+ return (_b = this.validation.custom.find(customValidation => customValidation.rule === 'regex')) === null || _b === void 0 ? void 0 : _b.pattern;
41
93
  }
42
94
  }
43
95
  setErrorMessage() {
96
+ var _a, _b, _c, _d;
44
97
  if (this.inputReference.validity.patternMismatch) {
45
- return this.validation.custom.find(customValidation => customValidation.rule === 'regex').errorMessage;
98
+ const errorCode = (_a = this.validation.custom.find(customValidation => customValidation.rule === 'regex')) === null || _a === void 0 ? void 0 : _a.errorKey;
99
+ const errorMessage = (_b = this.validation.custom.find(customValidation => customValidation.rule === 'regex')) === null || _b === void 0 ? void 0 : _b.errorMessage;
100
+ return translate(`${errorCode}`, this.language) ? translate(`${errorCode}`, this.language) : errorMessage;
46
101
  }
47
102
  if (this.inputReference.validity.tooShort || this.inputReference.validity.tooLong) {
48
103
  return translate('lengthError', this.language, { values: { minLength: this.validation.minLength, maxLength: this.validation.maxLength } });
@@ -50,11 +105,31 @@ export class EmailInput {
50
105
  if (this.inputReference.validity.valueMissing) {
51
106
  return translate('requiredError', this.language);
52
107
  }
108
+ if (this.isDuplicateInput && this.duplicateInputValue !== this.value) {
109
+ const errorCode = (_c = this.validation.custom.find(customRule => customRule.rule === 'duplicate-input')) === null || _c === void 0 ? void 0 : _c.errorKey;
110
+ const errorMessage = (_d = this.validation.custom.find(customRule => customRule.rule === 'duplicate-input')) === null || _d === void 0 ? void 0 : _d.errorMessage;
111
+ return translate(`${errorCode}`, this.language) ? translate(`${errorCode}`, this.language) : errorMessage;
112
+ }
113
+ }
114
+ renderTooltip() {
115
+ if (this.showTooltip) {
116
+ return (h("div", { class: `email__tooltip ${this.showTooltip ? 'visible' : ''}`, ref: (el) => this.tooltipReference = el, innerHTML: this.tooltip }));
117
+ }
118
+ return null;
53
119
  }
54
120
  render() {
55
- return h("div", { class: 'email__wrapper' },
56
- h("input", { id: `${this.name}__input`, type: 'email', class: `email__input`, value: this.defaultValue, placeholder: `${this.displayName} ${this.validation.mandatory ? '*' : ''}`, ref: (el) => this.inputReference = el, pattern: this.validationPattern, required: this.validation.mandatory, minlength: this.validation.minLength, maxlength: this.validation.maxLength, onInput: (e) => this.handleInput(e) }),
57
- h("label", { class: `email__label ${this.validation.mandatory ? 'email__label--required' : ''}`, htmlFor: `${this.name}__input` }, this.displayName),
121
+ let invalidClass = '';
122
+ if (this.touched) {
123
+ invalidClass = this.isValid == true || this.isValid == undefined ? '' : 'text__input--invalid';
124
+ }
125
+ return h("div", { class: `email__wrapper ${this.autofilled ? 'number__wrapper--autofilled' : ''} ${this.name}__input`, ref: el => this.stylingContainer = el },
126
+ h("div", { class: 'email__wrapper--flex' },
127
+ h("label", { class: `email__label ${this.validation.mandatory ? 'email__label--required' : ''}`, htmlFor: `${this.name}__input` }, this.displayName),
128
+ h("div", { class: 'email__wrapper--relative' },
129
+ this.tooltip &&
130
+ h("img", { class: 'email__tooltip-icon', src: tooltipIcon, alt: "", ref: (el) => this.tooltipIconReference = el, onClick: () => this.showTooltip = !this.showTooltip }),
131
+ this.renderTooltip())),
132
+ h("input", { id: `${this.name}__input`, type: 'email', class: `email__input ${invalidClass}`, value: this.defaultValue, readOnly: this.autofilled, placeholder: `${this.placeholder}`, ref: (el) => this.inputReference = el, pattern: this.validationPattern, required: this.validation.mandatory, minlength: this.validation.minLength, maxlength: this.validation.maxLength, onInput: this.handleInput, onBlur: this.handleBlur }),
58
133
  h("small", { class: 'email__error-message' }, this.errorMessage));
59
134
  }
60
135
  static get is() { return "email-input"; }
@@ -81,7 +156,7 @@ export class EmailInput {
81
156
  "text": "Name of the input."
82
157
  },
83
158
  "attribute": "name",
84
- "reflect": false
159
+ "reflect": true
85
160
  },
86
161
  "displayName": {
87
162
  "type": "string",
@@ -98,7 +173,24 @@ export class EmailInput {
98
173
  "text": "Name of input to be shown to the user."
99
174
  },
100
175
  "attribute": "display-name",
101
- "reflect": false
176
+ "reflect": true
177
+ },
178
+ "placeholder": {
179
+ "type": "string",
180
+ "mutable": false,
181
+ "complexType": {
182
+ "original": "string",
183
+ "resolved": "string",
184
+ "references": {}
185
+ },
186
+ "required": false,
187
+ "optional": false,
188
+ "docs": {
189
+ "tags": [],
190
+ "text": "Placeholder text to be shown."
191
+ },
192
+ "attribute": "placeholder",
193
+ "reflect": true
102
194
  },
103
195
  "validation": {
104
196
  "type": "unknown",
@@ -135,7 +227,41 @@ export class EmailInput {
135
227
  "text": "Default value for the input."
136
228
  },
137
229
  "attribute": "default-value",
138
- "reflect": false
230
+ "reflect": true
231
+ },
232
+ "autofilled": {
233
+ "type": "boolean",
234
+ "mutable": false,
235
+ "complexType": {
236
+ "original": "boolean",
237
+ "resolved": "boolean",
238
+ "references": {}
239
+ },
240
+ "required": false,
241
+ "optional": false,
242
+ "docs": {
243
+ "tags": [],
244
+ "text": "Boolean. Determines if input should be readonly."
245
+ },
246
+ "attribute": "autofilled",
247
+ "reflect": true
248
+ },
249
+ "tooltip": {
250
+ "type": "string",
251
+ "mutable": false,
252
+ "complexType": {
253
+ "original": "string",
254
+ "resolved": "string",
255
+ "references": {}
256
+ },
257
+ "required": false,
258
+ "optional": false,
259
+ "docs": {
260
+ "tags": [],
261
+ "text": "Tooltip text."
262
+ },
263
+ "attribute": "tooltip",
264
+ "reflect": true
139
265
  },
140
266
  "language": {
141
267
  "type": "string",
@@ -152,7 +278,7 @@ export class EmailInput {
152
278
  "text": "Currently selected language."
153
279
  },
154
280
  "attribute": "language",
155
- "reflect": false
281
+ "reflect": true
156
282
  },
157
283
  "emitValue": {
158
284
  "type": "boolean",
@@ -169,12 +295,49 @@ export class EmailInput {
169
295
  "text": "State passed down from the parent element. Will trigger the input to send it's value through an event."
170
296
  },
171
297
  "attribute": "emit-value",
172
- "reflect": false
298
+ "reflect": true
299
+ },
300
+ "isDuplicateInput": {
301
+ "type": "boolean",
302
+ "mutable": false,
303
+ "complexType": {
304
+ "original": "boolean",
305
+ "resolved": "boolean",
306
+ "references": {}
307
+ },
308
+ "required": false,
309
+ "optional": false,
310
+ "docs": {
311
+ "tags": [],
312
+ "text": "Flag for duplicate inputs, it sets up the input for certain validation rules."
313
+ },
314
+ "attribute": "is-duplicate-input",
315
+ "reflect": true
316
+ },
317
+ "clientStyling": {
318
+ "type": "string",
319
+ "mutable": false,
320
+ "complexType": {
321
+ "original": "string",
322
+ "resolved": "string",
323
+ "references": {}
324
+ },
325
+ "required": false,
326
+ "optional": false,
327
+ "docs": {
328
+ "tags": [],
329
+ "text": "Client custom styling via inline style"
330
+ },
331
+ "attribute": "client-styling",
332
+ "reflect": true,
333
+ "defaultValue": "''"
173
334
  }
174
335
  }; }
175
336
  static get states() { return {
176
337
  "errorMessage": {},
177
- "isValid": {}
338
+ "isValid": {},
339
+ "limitStylingAppends": {},
340
+ "showTooltip": {}
178
341
  }; }
179
342
  static get events() { return [{
180
343
  "method": "sendValidityState",
@@ -224,4 +387,17 @@ export class EmailInput {
224
387
  "propName": "emitValue",
225
388
  "methodName": "emitValueHandler"
226
389
  }]; }
390
+ static get listeners() { return [{
391
+ "name": "click",
392
+ "method": "handleClickOutside",
393
+ "target": "document",
394
+ "capture": false,
395
+ "passive": false
396
+ }, {
397
+ "name": "sendInputValue",
398
+ "method": "valueChangedHandler",
399
+ "target": "body",
400
+ "capture": false,
401
+ "passive": false
402
+ }]; }
227
403
  }