@everymatrix/general-input 0.0.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 (121) hide show
  1. package/dist/cjs/checkbox-group-input_10.cjs.entry.js +34870 -0
  2. package/dist/cjs/general-input.cjs.entry.js +51 -0
  3. package/dist/cjs/general-input.cjs.js +19 -0
  4. package/dist/cjs/index-1768513d.js +1286 -0
  5. package/dist/cjs/index.cjs.js +2 -0
  6. package/dist/cjs/loader.cjs.js +21 -0
  7. package/dist/collection/collection-manifest.json +22 -0
  8. package/dist/collection/components/checkbox-group-input/checkbox-group-input.css +62 -0
  9. package/dist/collection/components/checkbox-group-input/checkbox-group-input.js +344 -0
  10. package/dist/collection/components/checkbox-input/checkbox-input.css +62 -0
  11. package/dist/collection/components/checkbox-input/checkbox-input.js +322 -0
  12. package/dist/collection/components/date-input/date-input.css +85 -0
  13. package/dist/collection/components/date-input/date-input.js +341 -0
  14. package/dist/collection/components/email-input/email-input.css +83 -0
  15. package/dist/collection/components/email-input/email-input.js +382 -0
  16. package/dist/collection/components/general-input/general-input.css +3 -0
  17. package/dist/collection/components/general-input/general-input.js +296 -0
  18. package/dist/collection/components/number-input/number-input.css +90 -0
  19. package/dist/collection/components/number-input/number-input.js +349 -0
  20. package/dist/collection/components/password-input/password-input.css +86 -0
  21. package/dist/collection/components/password-input/password-input.js +395 -0
  22. package/dist/collection/components/radio-input/radio-input.css +43 -0
  23. package/dist/collection/components/radio-input/radio-input.js +298 -0
  24. package/dist/collection/components/select-input/select-input.css +93 -0
  25. package/dist/collection/components/select-input/select-input.js +412 -0
  26. package/dist/collection/components/tel-input/tel-input.css +116 -0
  27. package/dist/collection/components/tel-input/tel-input.js +421 -0
  28. package/dist/collection/components/text-input/text-input.css +83 -0
  29. package/dist/collection/components/text-input/text-input.js +406 -0
  30. package/dist/collection/index.js +1 -0
  31. package/dist/collection/utils/locale.utils.js +26 -0
  32. package/dist/collection/utils/tooltipIcon.svg +5 -0
  33. package/dist/collection/utils/types.js +1 -0
  34. package/dist/collection/utils/utils.js +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 +5793 -0
  39. package/dist/components/checkbox-input.d.ts +11 -0
  40. package/dist/components/checkbox-input.js +6 -0
  41. package/dist/components/checkbox-input2.js +127 -0
  42. package/dist/components/date-input.d.ts +11 -0
  43. package/dist/components/date-input.js +6 -0
  44. package/dist/components/date-input2.js +5182 -0
  45. package/dist/components/email-input.d.ts +11 -0
  46. package/dist/components/email-input.js +6 -0
  47. package/dist/components/email-input2.js +150 -0
  48. package/dist/components/field-mixin.js +12712 -0
  49. package/dist/components/general-input.d.ts +11 -0
  50. package/dist/components/general-input.js +140 -0
  51. package/dist/components/index.d.ts +26 -0
  52. package/dist/components/index.js +1 -0
  53. package/dist/components/input-field-shared-styles.js +1067 -0
  54. package/dist/components/number-input.d.ts +11 -0
  55. package/dist/components/number-input.js +6 -0
  56. package/dist/components/number-input2.js +139 -0
  57. package/dist/components/password-input.d.ts +11 -0
  58. package/dist/components/password-input.js +6 -0
  59. package/dist/components/password-input2.js +879 -0
  60. package/dist/components/pattern-mixin.js +85 -0
  61. package/dist/components/radio-input.d.ts +11 -0
  62. package/dist/components/radio-input.js +6 -0
  63. package/dist/components/radio-input2.js +115 -0
  64. package/dist/components/select-input.d.ts +11 -0
  65. package/dist/components/select-input.js +6 -0
  66. package/dist/components/select-input2.js +166 -0
  67. package/dist/components/tel-input.d.ts +11 -0
  68. package/dist/components/tel-input.js +6 -0
  69. package/dist/components/tel-input2.js +178 -0
  70. package/dist/components/text-input.d.ts +11 -0
  71. package/dist/components/text-input.js +6 -0
  72. package/dist/components/text-input2.js +157 -0
  73. package/dist/components/tooltipIcon.js +30 -0
  74. package/dist/components/vaadin-button.js +461 -0
  75. package/dist/components/vaadin-combo-box.js +4329 -0
  76. package/dist/components/virtual-keyboard-controller.js +2693 -0
  77. package/dist/esm/checkbox-group-input_10.entry.js +34857 -0
  78. package/dist/esm/general-input.entry.js +47 -0
  79. package/dist/esm/general-input.js +17 -0
  80. package/dist/esm/index-7e24a6f1.js +1259 -0
  81. package/dist/esm/index.js +1 -0
  82. package/dist/esm/loader.js +17 -0
  83. package/dist/esm/polyfills/core-js.js +11 -0
  84. package/dist/esm/polyfills/css-shim.js +1 -0
  85. package/dist/esm/polyfills/dom.js +79 -0
  86. package/dist/esm/polyfills/es5-html-element.js +1 -0
  87. package/dist/esm/polyfills/index.js +34 -0
  88. package/dist/esm/polyfills/system.js +6 -0
  89. package/dist/general-input/general-input.esm.js +1 -0
  90. package/dist/general-input/index.esm.js +0 -0
  91. package/dist/general-input/p-61d76ec3.entry.js +1 -0
  92. package/dist/general-input/p-a79eb0a3.entry.js +4413 -0
  93. package/dist/general-input/p-fb647820.js +1 -0
  94. package/dist/index.cjs.js +1 -0
  95. package/dist/index.js +1 -0
  96. package/dist/stencil.config.js +22 -0
  97. package/dist/types/Users/adrian.pripon/Documents/Work/stencil/widgets-stencil/packages/general-input/.stencil/packages/general-input/stencil.config.d.ts +2 -0
  98. package/dist/types/components/checkbox-group-input/checkbox-group-input.d.ts +72 -0
  99. package/dist/types/components/checkbox-input/checkbox-input.d.ts +64 -0
  100. package/dist/types/components/date-input/date-input.d.ts +70 -0
  101. package/dist/types/components/email-input/email-input.d.ts +77 -0
  102. package/dist/types/components/general-input/general-input.d.ts +60 -0
  103. package/dist/types/components/number-input/number-input.d.ts +70 -0
  104. package/dist/types/components/password-input/password-input.d.ts +79 -0
  105. package/dist/types/components/radio-input/radio-input.d.ts +59 -0
  106. package/dist/types/components/select-input/select-input.d.ts +82 -0
  107. package/dist/types/components/tel-input/tel-input.d.ts +85 -0
  108. package/dist/types/components/text-input/text-input.d.ts +81 -0
  109. package/dist/types/components.d.ts +1140 -0
  110. package/dist/types/index.d.ts +1 -0
  111. package/dist/types/stencil-public-runtime.d.ts +1565 -0
  112. package/dist/types/utils/locale.utils.d.ts +5 -0
  113. package/dist/types/utils/types.d.ts +76 -0
  114. package/dist/types/utils/utils.d.ts +1 -0
  115. package/loader/cdn.js +3 -0
  116. package/loader/index.cjs.js +3 -0
  117. package/loader/index.d.ts +12 -0
  118. package/loader/index.es2017.js +3 -0
  119. package/loader/index.js +4 -0
  120. package/loader/package.json +10 -0
  121. package/package.json +26 -0
@@ -0,0 +1,395 @@
1
+ import { Component, h, Prop, State, Watch, Event, Listen, Element } from '@stencil/core';
2
+ import { translate } from '../../utils/locale.utils';
3
+ import '@vaadin/password-field';
4
+ import tooltipIcon from '../../utils/tooltipIcon.svg';
5
+ export class PasswordInput {
6
+ constructor() {
7
+ /**
8
+ * Default value for the input.
9
+ */
10
+ this.defaultValue = '';
11
+ /**
12
+ * Client custom styling via inline style
13
+ */
14
+ this.clientStyling = '';
15
+ this.limitStylingAppends = false;
16
+ this.showTooltip = false;
17
+ this.value = '';
18
+ this.validationPattern = '';
19
+ this.setClientStyling = () => {
20
+ let sheet = document.createElement('style');
21
+ sheet.innerHTML = this.clientStyling;
22
+ this.stylingContainer.prepend(sheet);
23
+ };
24
+ }
25
+ validityChanged() {
26
+ this.validityStateHandler({ valid: this.isValid, name: this.name });
27
+ if (this.emitValue == true) {
28
+ this.valueHandler({ name: this.name, value: this.value });
29
+ }
30
+ }
31
+ emitValueHandler(newValue) {
32
+ if (newValue == true && this.isValid) {
33
+ this.valueHandler({ name: this.name, value: this.value });
34
+ }
35
+ }
36
+ validityStateHandler(inputStateEvent) {
37
+ this.sendValidityState.emit(inputStateEvent);
38
+ }
39
+ valueHandler(inputValueEvent) {
40
+ this.sendInputValue.emit(inputValueEvent);
41
+ }
42
+ valueChangedHandler(event) {
43
+ if (this.isDuplicateInput) {
44
+ if (this.name === event.detail.name + 'Duplicate') {
45
+ this.duplicateInputValue = event.detail.value;
46
+ }
47
+ }
48
+ }
49
+ handleClickOutside(event) {
50
+ if (event.composedPath()[0] === this.tooltipIconReference)
51
+ return;
52
+ if (event.composedPath()[0] !== this.tooltipReference)
53
+ this.showTooltip = false;
54
+ }
55
+ connectedCallback() {
56
+ this.validationPattern = this.setPattern();
57
+ }
58
+ componentDidRender() {
59
+ // start custom styling area
60
+ if (!this.limitStylingAppends && this.stylingContainer) {
61
+ if (this.clientStyling)
62
+ this.setClientStyling();
63
+ this.limitStylingAppends = true;
64
+ }
65
+ // end custom styling area
66
+ if (this.defaultValue) {
67
+ this.value = this.defaultValue;
68
+ this.valueHandler({ name: this.name, value: this.value });
69
+ }
70
+ }
71
+ componentDidLoad() {
72
+ this.inputReference = this.element.shadowRoot.querySelector('input');
73
+ }
74
+ handleInput(event) {
75
+ this.value = event.target.value;
76
+ this.errorMessage = this.setErrorMessage();
77
+ this.isValid = this.setValidity();
78
+ this.validityStateHandler({ valid: this.isValid, name: this.name });
79
+ this.emitValueHandler(true);
80
+ }
81
+ setValidity() {
82
+ return this.inputReference.validity.valid;
83
+ }
84
+ setPattern() {
85
+ var _a, _b;
86
+ if (((_a = this.validation.custom) === null || _a === void 0 ? void 0 : _a.length) > 0) {
87
+ return (_b = this.validation.custom.find(customValidation => customValidation.rule === 'regex')) === null || _b === void 0 ? void 0 : _b.pattern;
88
+ }
89
+ }
90
+ setErrorMessage() {
91
+ var _a;
92
+ if (this.inputReference.validity.patternMismatch) {
93
+ return (_a = this.validation.custom.find(customValidation => customValidation.rule === 'regex')) === null || _a === void 0 ? void 0 : _a.errorMessage;
94
+ }
95
+ if (this.inputReference.validity.tooShort || this.inputReference.validity.tooLong) {
96
+ return translate('lengthError', this.language, { values: { minLength: this.validation.minLength, maxLength: this.validation.maxLength } });
97
+ }
98
+ if (this.inputReference.validity.valueMissing) {
99
+ return translate('requiredError', this.language);
100
+ }
101
+ if (this.isDuplicateInput && this.duplicateInputValue !== this.value) {
102
+ return this.validation.custom.find(customRule => customRule.rule === 'duplicate-input').errorMessage;
103
+ }
104
+ }
105
+ renderTooltip() {
106
+ if (this.showTooltip) {
107
+ return (h("div", { class: `password__tooltip ${this.showTooltip ? 'visible' : ''}`, ref: (el) => this.tooltipReference = el, innerHTML: this.tooltip }));
108
+ }
109
+ return null;
110
+ }
111
+ render() {
112
+ const invalidClass = this.isValid == true || this.isValid == undefined ? '' : 'password__input--invalid';
113
+ return h("div", { class: 'password__wrapper', ref: el => this.stylingContainer = el },
114
+ h("div", { class: 'password__wrapper--flex' },
115
+ h("label", { class: `password__label ${this.validation.mandatory ? 'password__label--required' : ''}`, htmlFor: `${this.name}__input` }, this.displayName),
116
+ h("div", { class: 'password__wrapper--relative' },
117
+ this.tooltip &&
118
+ h("img", { class: 'password__tooltip-icon', src: tooltipIcon, alt: "", ref: (el) => this.tooltipIconReference = el, onClick: () => this.showTooltip = !this.showTooltip }),
119
+ this.renderTooltip())),
120
+ h("vaadin-password-field", { type: "password", id: `${this.name}__input`, class: `password__input ${invalidClass}`, name: this.name, readOnly: this.autofilled, value: this.defaultValue,
121
+ // ref={(el) => this.inputReference = el as HTMLInputElement}
122
+ required: this.validation.mandatory, maxlength: this.validation.maxLength, minlength: this.validation.minLength, pattern: this.validationPattern, placeholder: `${this.placeholder} ${this.placeholder && this.validation.mandatory ? '*' : ''}`, onBlur: (e) => this.handleInput(e) }),
123
+ h("small", { class: 'password__error-message' }, this.errorMessage));
124
+ }
125
+ static get is() { return "password-input"; }
126
+ static get encapsulation() { return "shadow"; }
127
+ static get originalStyleUrls() { return {
128
+ "$": ["password-input.scss"]
129
+ }; }
130
+ static get styleUrls() { return {
131
+ "$": ["password-input.css"]
132
+ }; }
133
+ static get properties() { return {
134
+ "name": {
135
+ "type": "string",
136
+ "mutable": false,
137
+ "complexType": {
138
+ "original": "string",
139
+ "resolved": "string",
140
+ "references": {}
141
+ },
142
+ "required": false,
143
+ "optional": false,
144
+ "docs": {
145
+ "tags": [],
146
+ "text": "Name of the input."
147
+ },
148
+ "attribute": "name",
149
+ "reflect": true
150
+ },
151
+ "displayName": {
152
+ "type": "string",
153
+ "mutable": false,
154
+ "complexType": {
155
+ "original": "string",
156
+ "resolved": "string",
157
+ "references": {}
158
+ },
159
+ "required": false,
160
+ "optional": false,
161
+ "docs": {
162
+ "tags": [],
163
+ "text": "Name of input to be shown to the user."
164
+ },
165
+ "attribute": "display-name",
166
+ "reflect": true
167
+ },
168
+ "placeholder": {
169
+ "type": "string",
170
+ "mutable": false,
171
+ "complexType": {
172
+ "original": "string",
173
+ "resolved": "string",
174
+ "references": {}
175
+ },
176
+ "required": false,
177
+ "optional": false,
178
+ "docs": {
179
+ "tags": [],
180
+ "text": "Placeholder text to be shown."
181
+ },
182
+ "attribute": "placeholder",
183
+ "reflect": true
184
+ },
185
+ "defaultValue": {
186
+ "type": "string",
187
+ "mutable": false,
188
+ "complexType": {
189
+ "original": "string",
190
+ "resolved": "string",
191
+ "references": {}
192
+ },
193
+ "required": false,
194
+ "optional": false,
195
+ "docs": {
196
+ "tags": [],
197
+ "text": "Default value for the input."
198
+ },
199
+ "attribute": "default-value",
200
+ "reflect": true,
201
+ "defaultValue": "''"
202
+ },
203
+ "autofilled": {
204
+ "type": "boolean",
205
+ "mutable": false,
206
+ "complexType": {
207
+ "original": "boolean",
208
+ "resolved": "boolean",
209
+ "references": {}
210
+ },
211
+ "required": false,
212
+ "optional": false,
213
+ "docs": {
214
+ "tags": [],
215
+ "text": "Boolean. Determines if input should be readonly."
216
+ },
217
+ "attribute": "autofilled",
218
+ "reflect": true
219
+ },
220
+ "tooltip": {
221
+ "type": "string",
222
+ "mutable": false,
223
+ "complexType": {
224
+ "original": "string",
225
+ "resolved": "string",
226
+ "references": {}
227
+ },
228
+ "required": false,
229
+ "optional": false,
230
+ "docs": {
231
+ "tags": [],
232
+ "text": "Tooltip text."
233
+ },
234
+ "attribute": "tooltip",
235
+ "reflect": true
236
+ },
237
+ "validation": {
238
+ "type": "unknown",
239
+ "mutable": false,
240
+ "complexType": {
241
+ "original": "ValidationSchema",
242
+ "resolved": "ValidationSchema",
243
+ "references": {
244
+ "ValidationSchema": {
245
+ "location": "import",
246
+ "path": "../../utils/types"
247
+ }
248
+ }
249
+ },
250
+ "required": false,
251
+ "optional": false,
252
+ "docs": {
253
+ "tags": [],
254
+ "text": "Object of validation rules for the input."
255
+ }
256
+ },
257
+ "language": {
258
+ "type": "string",
259
+ "mutable": false,
260
+ "complexType": {
261
+ "original": "string",
262
+ "resolved": "string",
263
+ "references": {}
264
+ },
265
+ "required": false,
266
+ "optional": false,
267
+ "docs": {
268
+ "tags": [],
269
+ "text": "Currently selected language."
270
+ },
271
+ "attribute": "language",
272
+ "reflect": true
273
+ },
274
+ "emitValue": {
275
+ "type": "boolean",
276
+ "mutable": false,
277
+ "complexType": {
278
+ "original": "boolean",
279
+ "resolved": "boolean",
280
+ "references": {}
281
+ },
282
+ "required": false,
283
+ "optional": false,
284
+ "docs": {
285
+ "tags": [],
286
+ "text": "State passed down from the parent element. Will trigger the input to send it's value through an event."
287
+ },
288
+ "attribute": "emit-value",
289
+ "reflect": true
290
+ },
291
+ "isDuplicateInput": {
292
+ "type": "boolean",
293
+ "mutable": false,
294
+ "complexType": {
295
+ "original": "boolean",
296
+ "resolved": "boolean",
297
+ "references": {}
298
+ },
299
+ "required": false,
300
+ "optional": false,
301
+ "docs": {
302
+ "tags": [],
303
+ "text": "Flag for duplicate inputs, it sets up the input for certain validation rules."
304
+ },
305
+ "attribute": "is-duplicate-input",
306
+ "reflect": true
307
+ },
308
+ "clientStyling": {
309
+ "type": "string",
310
+ "mutable": false,
311
+ "complexType": {
312
+ "original": "string",
313
+ "resolved": "string",
314
+ "references": {}
315
+ },
316
+ "required": false,
317
+ "optional": false,
318
+ "docs": {
319
+ "tags": [],
320
+ "text": "Client custom styling via inline style"
321
+ },
322
+ "attribute": "client-styling",
323
+ "reflect": true,
324
+ "defaultValue": "''"
325
+ }
326
+ }; }
327
+ static get states() { return {
328
+ "isValid": {},
329
+ "errorMessage": {},
330
+ "limitStylingAppends": {},
331
+ "showTooltip": {}
332
+ }; }
333
+ static get events() { return [{
334
+ "method": "sendValidityState",
335
+ "name": "sendValidityState",
336
+ "bubbles": true,
337
+ "cancelable": true,
338
+ "composed": true,
339
+ "docs": {
340
+ "tags": [],
341
+ "text": ""
342
+ },
343
+ "complexType": {
344
+ "original": "InputStateEvent",
345
+ "resolved": "InputStateEvent",
346
+ "references": {
347
+ "InputStateEvent": {
348
+ "location": "import",
349
+ "path": "../../utils/types"
350
+ }
351
+ }
352
+ }
353
+ }, {
354
+ "method": "sendInputValue",
355
+ "name": "sendInputValue",
356
+ "bubbles": true,
357
+ "cancelable": true,
358
+ "composed": true,
359
+ "docs": {
360
+ "tags": [],
361
+ "text": ""
362
+ },
363
+ "complexType": {
364
+ "original": "InputValueEvent",
365
+ "resolved": "InputValueEvent",
366
+ "references": {
367
+ "InputValueEvent": {
368
+ "location": "import",
369
+ "path": "../../utils/types"
370
+ }
371
+ }
372
+ }
373
+ }]; }
374
+ static get elementRef() { return "element"; }
375
+ static get watchers() { return [{
376
+ "propName": "isValid",
377
+ "methodName": "validityChanged"
378
+ }, {
379
+ "propName": "emitValue",
380
+ "methodName": "emitValueHandler"
381
+ }]; }
382
+ static get listeners() { return [{
383
+ "name": "sendInputValue",
384
+ "method": "valueChangedHandler",
385
+ "target": "body",
386
+ "capture": false,
387
+ "passive": false
388
+ }, {
389
+ "name": "click",
390
+ "method": "handleClickOutside",
391
+ "target": "document",
392
+ "capture": false,
393
+ "passive": false
394
+ }]; }
395
+ }
@@ -0,0 +1,43 @@
1
+ *,
2
+ *::before,
3
+ *::after {
4
+ padding: 0;
5
+ margin: 0;
6
+ box-sizing: border-box;
7
+ }
8
+
9
+ .radio__fieldset {
10
+ border: none;
11
+ position: relative;
12
+ }
13
+ .radio__wrapper {
14
+ display: flex;
15
+ gap: 5px;
16
+ }
17
+ .radio__error-message {
18
+ position: absolute;
19
+ top: calc(100% + 5px);
20
+ left: 0;
21
+ color: #cc0000b3;
22
+ }
23
+ .radio__tooltip-icon {
24
+ position: absolute;
25
+ right: 0;
26
+ bottom: 10px;
27
+ }
28
+ .radio__tooltip {
29
+ position: absolute;
30
+ bottom: 35px;
31
+ right: 10px;
32
+ background-color: #FFFFFF;
33
+ border: 1px solid #B0B0B0;
34
+ color: #2B2D3F;
35
+ padding: 10px;
36
+ border-radius: 5px;
37
+ opacity: 0;
38
+ transition: opacity 0.3s ease-in-out;
39
+ z-index: 10;
40
+ }
41
+ .radio__tooltip.visible {
42
+ opacity: 1;
43
+ }