@everymatrix/general-input 0.0.1 → 1.0.69

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 (141) hide show
  1. package/dist/cjs/app-globals-3a1e7e63.js +5 -0
  2. package/dist/cjs/checkbox-group-input_10.cjs.entry.js +20007 -16663
  3. package/dist/cjs/general-input.cjs.entry.js +67 -40
  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 +16 -0
  7. package/dist/cjs/loader.cjs.js +7 -13
  8. package/dist/cjs/locale.utils-7a3dfe2f.js +128 -0
  9. package/dist/cjs/toggle-checkbox-input.cjs.entry.js +91 -0
  10. package/dist/cjs/tooltipIcon-7e9ee226.js +5 -0
  11. package/dist/collection/collection-manifest.json +14 -13
  12. package/dist/collection/components/checkbox-group-input/checkbox-group-input.css +26 -6
  13. package/dist/collection/components/checkbox-group-input/checkbox-group-input.js +372 -335
  14. package/dist/collection/components/checkbox-input/checkbox-input.css +16 -10
  15. package/dist/collection/components/checkbox-input/checkbox-input.js +325 -310
  16. package/dist/collection/components/date-input/date-input.css +35 -19
  17. package/dist/collection/components/date-input/date-input.js +401 -328
  18. package/dist/collection/components/email-input/email-input.css +30 -18
  19. package/dist/collection/components/email-input/email-input.js +405 -365
  20. package/dist/collection/components/general-input/general-input.css +1 -0
  21. package/dist/collection/components/general-input/general-input.js +374 -291
  22. package/dist/collection/components/general-input/index.js +1 -0
  23. package/dist/collection/components/number-input/number-input.css +28 -16
  24. package/dist/collection/components/number-input/number-input.js +371 -334
  25. package/dist/collection/components/password-input/password-input.css +105 -11
  26. package/dist/collection/components/password-input/password-input.js +518 -378
  27. package/dist/collection/components/radio-input/radio-input.css +4 -4
  28. package/dist/collection/components/radio-input/radio-input.js +301 -287
  29. package/dist/collection/components/select-input/select-input.css +47 -19
  30. package/dist/collection/components/select-input/select-input.js +428 -398
  31. package/dist/collection/components/tel-input/tel-input.css +52 -23
  32. package/dist/collection/components/tel-input/tel-input.js +441 -404
  33. package/dist/collection/components/text-input/text-input.css +33 -18
  34. package/dist/collection/components/text-input/text-input.js +446 -389
  35. package/dist/collection/components/toggle-checkbox-input/toggle-checkbox-input.css +82 -0
  36. package/dist/collection/components/toggle-checkbox-input/toggle-checkbox-input.js +336 -0
  37. package/dist/collection/index.js +16 -0
  38. package/dist/collection/utils/locale.utils.js +118 -21
  39. package/dist/collection/utils/tooltipIcon.svg +4 -4
  40. package/dist/collection/utils/utils.js +3 -3
  41. package/dist/esm/app-globals-0f993ce5.js +3 -0
  42. package/dist/esm/checkbox-group-input_10.entry.js +20007 -16663
  43. package/dist/esm/general-input.entry.js +67 -40
  44. package/dist/esm/general-input.js +14 -11
  45. package/dist/esm/index-514fda47.js +1287 -0
  46. package/dist/esm/index.js +16 -1
  47. package/dist/esm/loader.js +7 -13
  48. package/dist/esm/locale.utils-21605050.js +125 -0
  49. package/dist/esm/toggle-checkbox-input.entry.js +87 -0
  50. package/dist/esm/tooltipIcon-0a5a06a2.js +3 -0
  51. package/dist/general-input/general-input.esm.js +1 -1
  52. package/dist/general-input/index.esm.js +1 -0
  53. package/dist/general-input/p-03e81c11.js +2 -0
  54. package/dist/general-input/p-2dccd0bf.js +1 -0
  55. package/dist/general-input/p-34939f14.entry.js +1 -0
  56. package/dist/general-input/p-b32f19c2.entry.js +5430 -0
  57. package/dist/general-input/p-c43bb82e.entry.js +1 -0
  58. package/dist/general-input/p-cfe9eb31.js +1 -0
  59. package/dist/general-input/p-e1255160.js +1 -0
  60. package/dist/stencil.config.dev.js +17 -0
  61. package/dist/stencil.config.js +14 -19
  62. package/dist/types/Users/raul.vasile/workspace/everymatrix/widgets-monorepo/packages/stencil/general-input/.stencil/packages/stencil/general-input/stencil.config.d.ts +2 -0
  63. package/dist/types/Users/raul.vasile/workspace/everymatrix/widgets-monorepo/packages/stencil/general-input/.stencil/packages/stencil/general-input/stencil.config.dev.d.ts +2 -0
  64. package/dist/types/components/checkbox-group-input/checkbox-group-input.d.ts +69 -67
  65. package/dist/types/components/checkbox-input/checkbox-input.d.ts +61 -60
  66. package/dist/types/components/date-input/date-input.d.ts +79 -65
  67. package/dist/types/components/email-input/email-input.d.ts +76 -73
  68. package/dist/types/components/general-input/general-input.d.ts +72 -57
  69. package/dist/types/components/general-input/index.d.ts +1 -0
  70. package/dist/types/components/number-input/number-input.d.ts +70 -66
  71. package/dist/types/components/password-input/password-input.d.ts +87 -75
  72. package/dist/types/components/radio-input/radio-input.d.ts +55 -55
  73. package/dist/types/components/select-input/select-input.d.ts +78 -77
  74. package/dist/types/components/tel-input/tel-input.d.ts +84 -80
  75. package/dist/types/components/text-input/text-input.d.ts +81 -78
  76. package/dist/types/components/toggle-checkbox-input/toggle-checkbox-input.d.ts +67 -0
  77. package/dist/types/components.d.ts +331 -25
  78. package/dist/types/stencil-public-runtime.d.ts +142 -33
  79. package/dist/types/utils/locale.utils.d.ts +13 -1
  80. package/dist/types/utils/types.d.ts +58 -47
  81. package/loader/cdn.js +1 -3
  82. package/loader/index.cjs.js +1 -3
  83. package/loader/index.d.ts +13 -1
  84. package/loader/index.es2017.js +1 -3
  85. package/loader/index.js +1 -3
  86. package/loader/package.json +1 -0
  87. package/package.json +9 -9
  88. package/dist/cjs/index-1768513d.js +0 -1286
  89. package/dist/components/active-mixin.js +0 -975
  90. package/dist/components/checkbox-group-input.d.ts +0 -11
  91. package/dist/components/checkbox-group-input.js +0 -6
  92. package/dist/components/checkbox-group-input2.js +0 -5793
  93. package/dist/components/checkbox-input.d.ts +0 -11
  94. package/dist/components/checkbox-input.js +0 -6
  95. package/dist/components/checkbox-input2.js +0 -127
  96. package/dist/components/date-input.d.ts +0 -11
  97. package/dist/components/date-input.js +0 -6
  98. package/dist/components/date-input2.js +0 -5182
  99. package/dist/components/email-input.d.ts +0 -11
  100. package/dist/components/email-input.js +0 -6
  101. package/dist/components/email-input2.js +0 -150
  102. package/dist/components/field-mixin.js +0 -12712
  103. package/dist/components/general-input.d.ts +0 -11
  104. package/dist/components/general-input.js +0 -140
  105. package/dist/components/index.d.ts +0 -26
  106. package/dist/components/index.js +0 -1
  107. package/dist/components/input-field-shared-styles.js +0 -1067
  108. package/dist/components/number-input.d.ts +0 -11
  109. package/dist/components/number-input.js +0 -6
  110. package/dist/components/number-input2.js +0 -139
  111. package/dist/components/password-input.d.ts +0 -11
  112. package/dist/components/password-input.js +0 -6
  113. package/dist/components/password-input2.js +0 -879
  114. package/dist/components/pattern-mixin.js +0 -85
  115. package/dist/components/radio-input.d.ts +0 -11
  116. package/dist/components/radio-input.js +0 -6
  117. package/dist/components/radio-input2.js +0 -115
  118. package/dist/components/select-input.d.ts +0 -11
  119. package/dist/components/select-input.js +0 -6
  120. package/dist/components/select-input2.js +0 -166
  121. package/dist/components/tel-input.d.ts +0 -11
  122. package/dist/components/tel-input.js +0 -6
  123. package/dist/components/tel-input2.js +0 -178
  124. package/dist/components/text-input.d.ts +0 -11
  125. package/dist/components/text-input.js +0 -6
  126. package/dist/components/text-input2.js +0 -157
  127. package/dist/components/tooltipIcon.js +0 -30
  128. package/dist/components/vaadin-button.js +0 -461
  129. package/dist/components/vaadin-combo-box.js +0 -4329
  130. package/dist/components/virtual-keyboard-controller.js +0 -2693
  131. package/dist/esm/index-7e24a6f1.js +0 -1259
  132. package/dist/esm/polyfills/core-js.js +0 -11
  133. package/dist/esm/polyfills/css-shim.js +0 -1
  134. package/dist/esm/polyfills/dom.js +0 -79
  135. package/dist/esm/polyfills/es5-html-element.js +0 -1
  136. package/dist/esm/polyfills/index.js +0 -34
  137. package/dist/esm/polyfills/system.js +0 -6
  138. package/dist/general-input/p-61d76ec3.entry.js +0 -1
  139. package/dist/general-input/p-a79eb0a3.entry.js +0 -4413
  140. package/dist/general-input/p-fb647820.js +0 -1
  141. package/dist/types/Users/adrian.pripon/Documents/Work/stencil/widgets-stencil/packages/general-input/.stencil/packages/general-input/stencil.config.d.ts +0 -2
@@ -1,406 +1,463 @@
1
- import { Component, h, Prop, State, Watch, Event, Listen } from '@stencil/core';
2
- import { translate } from '../../utils/locale.utils';
3
- import tooltipIcon from '../../utils/tooltipIcon.svg';
1
+ import { h } from "@stencil/core";
2
+ import { translate } from "../../utils/locale.utils";
3
+ import tooltipIcon from "../../utils/tooltipIcon.svg";
4
4
  export class TextInput {
5
- constructor() {
6
- /**
7
- * Default value for the input.
8
- */
9
- this.defaultValue = '';
10
- /**
11
- * Client custom styling via inline style
12
- */
13
- this.clientStyling = '';
14
- this.errorMessage = '';
15
- this.limitStylingAppends = false;
16
- this.showTooltip = false;
17
- this.value = '';
18
- this.customRules = [];
19
- this.validationPattern = '';
20
- this.setClientStyling = () => {
21
- let sheet = document.createElement('style');
22
- sheet.innerHTML = this.clientStyling;
23
- this.stylingContainer.prepend(sheet);
24
- };
25
- }
26
- validityChanged() {
27
- if (this.emitValue == true) {
28
- this.valueHandler({ name: this.name, value: this.value });
5
+ constructor() {
6
+ this.value = '';
7
+ this.validationPattern = '';
8
+ this.duplicateInputValue = null;
9
+ this.touched = false;
10
+ this.handleInput = (event) => {
11
+ this.value = event.target.value;
12
+ this.touched = true;
13
+ if (this.debounceTime) {
14
+ clearTimeout(this.debounceTime);
15
+ }
16
+ this.debounceTime = setTimeout(() => {
17
+ this.isValid = this.setValidity();
18
+ this.errorMessage = this.setErrorMessage();
19
+ this.validityStateHandler({ valid: this.isValid, name: this.name });
20
+ this.emitValueHandler(true);
21
+ }, 500);
22
+ };
23
+ this.handleBlur = (event) => {
24
+ this.value = event.target.value;
25
+ this.touched = true;
26
+ this.isValid = this.setValidity();
27
+ this.errorMessage = this.setErrorMessage();
28
+ this.validityStateHandler({ valid: this.isValid, name: this.name });
29
+ };
30
+ this.setClientStyling = () => {
31
+ let sheet = document.createElement('style');
32
+ sheet.innerHTML = this.clientStyling;
33
+ this.stylingContainer.prepend(sheet);
34
+ };
35
+ this.name = undefined;
36
+ this.displayName = undefined;
37
+ this.placeholder = undefined;
38
+ this.validation = undefined;
39
+ this.defaultValue = '';
40
+ this.autofilled = undefined;
41
+ this.tooltip = undefined;
42
+ this.language = undefined;
43
+ this.checkValidity = undefined;
44
+ this.emitValue = undefined;
45
+ this.isDuplicateInput = undefined;
46
+ this.clientStyling = '';
47
+ this.isValid = undefined;
48
+ this.errorMessage = '';
49
+ this.limitStylingAppends = false;
50
+ this.showTooltip = false;
29
51
  }
30
- }
31
- emitValueHandler(newValue) {
32
- if (newValue == true && this.isValid) {
33
- this.valueHandler({ name: this.name, value: this.value });
52
+ validityChanged() {
53
+ this.validityStateHandler({ valid: this.isValid, name: this.name });
54
+ if (this.emitValue == true) {
55
+ this.valueHandler({ name: this.name, value: this.value });
56
+ }
34
57
  }
35
- }
36
- validityStateHandler(inputStateEvent) {
37
- this.sendValidityState.emit(inputStateEvent);
38
- }
39
- valueHandler(inputValueEvent) {
40
- this.sendInputValue.emit(inputValueEvent);
41
- }
42
- handleClickOutside(event) {
43
- if (event.composedPath()[0] === this.tooltipIconReference)
44
- return;
45
- if (event.composedPath()[0] !== this.tooltipReference)
46
- this.showTooltip = false;
47
- }
48
- valueChangedHandler(event) {
49
- if (this.isDuplicateInput) {
50
- if (this.name === event.detail.name + 'Duplicate') {
51
- this.duplicateInputValue = event.detail.value;
52
- }
58
+ emitValueHandler(newValue) {
59
+ if (newValue == true && this.isValid) {
60
+ this.valueHandler({ name: this.name, value: this.value });
61
+ }
53
62
  }
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;
63
+ validityStateHandler(inputStateEvent) {
64
+ this.sendValidityState.emit(inputStateEvent);
64
65
  }
65
- // end custom styling area
66
- if (this.defaultValue) {
67
- this.value = this.defaultValue;
68
- this.valueHandler({ name: this.name, value: this.value });
66
+ valueHandler(inputValueEvent) {
67
+ this.sendInputValue.emit(inputValueEvent);
69
68
  }
70
- }
71
- handleInput(event) {
72
- this.value = event.target.value;
73
- this.isValid = this.setValidity();
74
- this.errorMessage = this.setErrorMessage();
75
- this.validityStateHandler({ valid: this.isValid, name: this.name });
76
- this.emitValueHandler(true);
77
- }
78
- setValidity() {
79
- return this.inputReference.validity.valid;
80
- }
81
- setPattern() {
82
- var _a, _b;
83
- if (((_a = this.validation.custom) === null || _a === void 0 ? void 0 : _a.length) > 0) {
84
- return (_b = this.validation.custom.find(customValidation => customValidation.rule === 'regex')) === null || _b === void 0 ? void 0 : _b.pattern;
69
+ handleClickOutside(event) {
70
+ if (event.composedPath()[0] === this.tooltipIconReference)
71
+ return;
72
+ if (event.composedPath()[0] !== this.tooltipReference)
73
+ this.showTooltip = false;
85
74
  }
86
- }
87
- setErrorMessage() {
88
- var _a;
89
- if (this.inputReference.validity.patternMismatch) {
90
- return (_a = this.validation.custom.find(customValidation => customValidation.rule === 'regex')) === null || _a === void 0 ? void 0 : _a.errorMessage;
75
+ valueChangedHandler(event) {
76
+ if (this.isDuplicateInput && this.name === event.detail.name + 'Duplicate') {
77
+ this.duplicateInputValue = event.detail.value;
78
+ if (this.touched) {
79
+ this.isValid = this.setValidity();
80
+ this.errorMessage = this.setErrorMessage();
81
+ }
82
+ }
83
+ if (this.name === event.detail.name + 'Duplicate'
84
+ && this.name.replace('Duplicate', '') === event.detail.name
85
+ && this.touched === true) {
86
+ this.isValid = this.setValidity();
87
+ this.errorMessage = this.setErrorMessage();
88
+ }
91
89
  }
92
- if (this.inputReference.validity.tooShort || this.inputReference.validity.tooLong) {
93
- return translate('lengthError', this.language, { values: { minLength: this.validation.minLength, maxLength: this.validation.maxLength } });
90
+ connectedCallback() {
91
+ this.validationPattern = this.setPattern();
94
92
  }
95
- if (this.inputReference.validity.valueMissing) {
96
- return translate('requiredError', this.language);
93
+ componentDidRender() {
94
+ // start custom styling area
95
+ if (!this.limitStylingAppends && this.stylingContainer) {
96
+ if (this.clientStyling)
97
+ this.setClientStyling();
98
+ this.limitStylingAppends = true;
99
+ }
100
+ // end custom styling area
97
101
  }
98
- if (this.isDuplicateInput && this.duplicateInputValue !== this.value) {
99
- return this.validation.custom.find(customRule => customRule.rule === 'duplicate-input').errorMessage;
102
+ componentDidLoad() {
103
+ if (this.defaultValue) {
104
+ this.value = this.defaultValue;
105
+ this.valueHandler({ name: this.name, value: this.value });
106
+ if (this.isDuplicateInput) {
107
+ this.touched = true;
108
+ }
109
+ }
110
+ this.isValid = this.setValidity();
100
111
  }
101
- }
102
- renderTooltip() {
103
- if (this.showTooltip) {
104
- return (h("div", { class: `text__tooltip ${this.showTooltip ? 'visible' : ''}`, ref: (el) => this.tooltipReference = el, innerHTML: this.tooltip }));
112
+ setValidity() {
113
+ var _a;
114
+ if (this.isDuplicateInput && this.duplicateInputValue !== this.value) {
115
+ return false;
116
+ }
117
+ else {
118
+ return (_a = this.inputReference) === null || _a === void 0 ? void 0 : _a.validity.valid;
119
+ }
105
120
  }
106
- return null;
107
- }
108
- render() {
109
- const invalidClass = this.isValid == true || this.isValid == undefined ? '' : 'text__input--invalid';
110
- return h("div", { class: 'text__wrapper', ref: el => this.stylingContainer = el },
111
- h("div", { class: 'text__wrapper--flex' },
112
- h("label", { class: `text__label ${this.validation.mandatory ? 'text__label--required' : ''}`, htmlFor: `${this.name}__input` }, this.displayName),
113
- h("div", { class: 'text__wrapper--relative' },
114
- this.tooltip &&
115
- h("img", { class: 'text__tooltip-icon', src: tooltipIcon, alt: "", ref: (el) => this.tooltipIconReference = el, onClick: () => this.showTooltip = !this.showTooltip }),
116
- this.renderTooltip())),
117
- h("input", { name: this.name, id: `${this.name}__input`, value: this.defaultValue, type: 'text', class: `text__input ${invalidClass}`, placeholder: `${this.placeholder} ${this.placeholder && this.validation.mandatory ? '*' : ''}`, ref: (el) => this.inputReference = el, readOnly: this.autofilled, pattern: this.validationPattern, required: this.validation.mandatory, minlength: this.validation.minLength, maxlength: this.validation.maxLength, onBlur: (e) => { this.handleInput(e); } }),
118
- h("small", { class: 'text__error-message' }, this.errorMessage));
119
- }
120
- static get is() { return "text-input"; }
121
- static get encapsulation() { return "shadow"; }
122
- static get originalStyleUrls() { return {
123
- "$": ["text-input.scss"]
124
- }; }
125
- static get styleUrls() { return {
126
- "$": ["text-input.css"]
127
- }; }
128
- static get properties() { return {
129
- "name": {
130
- "type": "string",
131
- "mutable": false,
132
- "complexType": {
133
- "original": "string",
134
- "resolved": "string",
135
- "references": {}
136
- },
137
- "required": false,
138
- "optional": false,
139
- "docs": {
140
- "tags": [],
141
- "text": "Name of the input."
142
- },
143
- "attribute": "name",
144
- "reflect": true
145
- },
146
- "displayName": {
147
- "type": "string",
148
- "mutable": false,
149
- "complexType": {
150
- "original": "string",
151
- "resolved": "string",
152
- "references": {}
153
- },
154
- "required": false,
155
- "optional": false,
156
- "docs": {
157
- "tags": [],
158
- "text": "Name of input to be shown to the user."
159
- },
160
- "attribute": "display-name",
161
- "reflect": true
162
- },
163
- "placeholder": {
164
- "type": "string",
165
- "mutable": false,
166
- "complexType": {
167
- "original": "string",
168
- "resolved": "string",
169
- "references": {}
170
- },
171
- "required": false,
172
- "optional": false,
173
- "docs": {
174
- "tags": [],
175
- "text": "Placeholder text to be shown."
176
- },
177
- "attribute": "placeholder",
178
- "reflect": true
179
- },
180
- "validation": {
181
- "type": "unknown",
182
- "mutable": false,
183
- "complexType": {
184
- "original": "ValidationSchema",
185
- "resolved": "ValidationSchema",
186
- "references": {
187
- "ValidationSchema": {
188
- "location": "import",
189
- "path": "../../utils/types"
190
- }
121
+ setPattern() {
122
+ var _a, _b;
123
+ if (((_a = this.validation.custom) === null || _a === void 0 ? void 0 : _a.length) > 0) {
124
+ return (_b = this.validation.custom.find(customValidation => customValidation.rule === 'regex')) === null || _b === void 0 ? void 0 : _b.pattern;
125
+ }
126
+ }
127
+ setErrorMessage() {
128
+ var _a, _b, _c, _d;
129
+ if (this.inputReference.validity.patternMismatch) {
130
+ const errorCode = (_a = this.validation.custom.find(customValidation => customValidation.rule === 'regex')) === null || _a === void 0 ? void 0 : _a.errorKey;
131
+ const errorMessage = (_b = this.validation.custom.find(customValidation => customValidation.rule === 'regex')) === null || _b === void 0 ? void 0 : _b.errorMessage;
132
+ return translate(`${errorCode}`, this.language) ? translate(`${errorCode}`, this.language) : errorMessage;
133
+ }
134
+ if (this.inputReference.validity.tooShort || this.inputReference.validity.tooLong) {
135
+ return translate('lengthError', this.language, { values: { minLength: this.validation.minLength, maxLength: this.validation.maxLength } });
136
+ }
137
+ if (this.inputReference.validity.valueMissing) {
138
+ return translate('requiredError', this.language);
139
+ }
140
+ if (this.isDuplicateInput && this.duplicateInputValue !== this.value) {
141
+ const errorCode = (_c = this.validation.custom.find(customRule => customRule.rule === 'duplicate-input')) === null || _c === void 0 ? void 0 : _c.errorKey;
142
+ const errorMessage = (_d = this.validation.custom.find(customRule => customRule.rule === 'duplicate-input')) === null || _d === void 0 ? void 0 : _d.errorMessage;
143
+ return translate(`${errorCode}`, this.language) ? translate(`${errorCode}`, this.language) : errorMessage;
191
144
  }
192
- },
193
- "required": false,
194
- "optional": false,
195
- "docs": {
196
- "tags": [],
197
- "text": "Object of validation rules for the input."
198
- }
199
- },
200
- "defaultValue": {
201
- "type": "string",
202
- "mutable": false,
203
- "complexType": {
204
- "original": "string",
205
- "resolved": "string",
206
- "references": {}
207
- },
208
- "required": false,
209
- "optional": false,
210
- "docs": {
211
- "tags": [],
212
- "text": "Default value for the input."
213
- },
214
- "attribute": "default-value",
215
- "reflect": true,
216
- "defaultValue": "''"
217
- },
218
- "autofilled": {
219
- "type": "boolean",
220
- "mutable": false,
221
- "complexType": {
222
- "original": "boolean",
223
- "resolved": "boolean",
224
- "references": {}
225
- },
226
- "required": false,
227
- "optional": false,
228
- "docs": {
229
- "tags": [],
230
- "text": "Boolean. Determines if input should be readonly."
231
- },
232
- "attribute": "autofilled",
233
- "reflect": true
234
- },
235
- "tooltip": {
236
- "type": "string",
237
- "mutable": false,
238
- "complexType": {
239
- "original": "string",
240
- "resolved": "string",
241
- "references": {}
242
- },
243
- "required": false,
244
- "optional": false,
245
- "docs": {
246
- "tags": [],
247
- "text": "Tooltip text."
248
- },
249
- "attribute": "tooltip",
250
- "reflect": true
251
- },
252
- "language": {
253
- "type": "string",
254
- "mutable": false,
255
- "complexType": {
256
- "original": "string",
257
- "resolved": "string",
258
- "references": {}
259
- },
260
- "required": false,
261
- "optional": false,
262
- "docs": {
263
- "tags": [],
264
- "text": "Currently selected language."
265
- },
266
- "attribute": "language",
267
- "reflect": true
268
- },
269
- "checkValidity": {
270
- "type": "boolean",
271
- "mutable": false,
272
- "complexType": {
273
- "original": "boolean",
274
- "resolved": "boolean",
275
- "references": {}
276
- },
277
- "required": false,
278
- "optional": false,
279
- "docs": {
280
- "tags": [],
281
- "text": "State passed down from the parent element. Will trigger the input to check for validity."
282
- },
283
- "attribute": "check-validity",
284
- "reflect": true
285
- },
286
- "emitValue": {
287
- "type": "boolean",
288
- "mutable": false,
289
- "complexType": {
290
- "original": "boolean",
291
- "resolved": "boolean",
292
- "references": {}
293
- },
294
- "required": false,
295
- "optional": false,
296
- "docs": {
297
- "tags": [],
298
- "text": "State passed down from the parent element. Will trigger the input to send it's value through an event."
299
- },
300
- "attribute": "emit-value",
301
- "reflect": true
302
- },
303
- "isDuplicateInput": {
304
- "type": "boolean",
305
- "mutable": false,
306
- "complexType": {
307
- "original": "boolean",
308
- "resolved": "boolean",
309
- "references": {}
310
- },
311
- "required": false,
312
- "optional": false,
313
- "docs": {
314
- "tags": [],
315
- "text": "Boolean that triggers certain validation rules, for duplicated inputs."
316
- },
317
- "attribute": "is-duplicate-input",
318
- "reflect": true
319
- },
320
- "clientStyling": {
321
- "type": "string",
322
- "mutable": false,
323
- "complexType": {
324
- "original": "string",
325
- "resolved": "string",
326
- "references": {}
327
- },
328
- "required": false,
329
- "optional": false,
330
- "docs": {
331
- "tags": [],
332
- "text": "Client custom styling via inline style"
333
- },
334
- "attribute": "client-styling",
335
- "reflect": true,
336
- "defaultValue": "''"
337
145
  }
338
- }; }
339
- static get states() { return {
340
- "isValid": {},
341
- "errorMessage": {},
342
- "limitStylingAppends": {},
343
- "showTooltip": {}
344
- }; }
345
- static get events() { return [{
346
- "method": "sendValidityState",
347
- "name": "sendValidityState",
348
- "bubbles": true,
349
- "cancelable": true,
350
- "composed": true,
351
- "docs": {
352
- "tags": [],
353
- "text": ""
354
- },
355
- "complexType": {
356
- "original": "InputStateEvent",
357
- "resolved": "InputStateEvent",
358
- "references": {
359
- "InputStateEvent": {
360
- "location": "import",
361
- "path": "../../utils/types"
362
- }
146
+ renderTooltip() {
147
+ if (this.showTooltip) {
148
+ return (h("div", { class: `text__tooltip ${this.showTooltip ? 'visible' : ''}`, ref: (el) => this.tooltipReference = el, innerHTML: this.tooltip }));
363
149
  }
364
- }
365
- }, {
366
- "method": "sendInputValue",
367
- "name": "sendInputValue",
368
- "bubbles": true,
369
- "cancelable": true,
370
- "composed": true,
371
- "docs": {
372
- "tags": [],
373
- "text": ""
374
- },
375
- "complexType": {
376
- "original": "InputValueEvent",
377
- "resolved": "InputValueEvent",
378
- "references": {
379
- "InputValueEvent": {
380
- "location": "import",
381
- "path": "../../utils/types"
382
- }
150
+ return null;
151
+ }
152
+ render() {
153
+ let invalidClass = '';
154
+ if (this.touched) {
155
+ invalidClass = this.isValid == true || this.isValid == undefined ? '' : 'text__input--invalid';
383
156
  }
384
- }
385
- }]; }
386
- static get watchers() { return [{
387
- "propName": "isValid",
388
- "methodName": "validityChanged"
389
- }, {
390
- "propName": "emitValue",
391
- "methodName": "emitValueHandler"
392
- }]; }
393
- static get listeners() { return [{
394
- "name": "click",
395
- "method": "handleClickOutside",
396
- "target": "document",
397
- "capture": false,
398
- "passive": false
399
- }, {
400
- "name": "sendInputValue",
401
- "method": "valueChangedHandler",
402
- "target": "body",
403
- "capture": false,
404
- "passive": false
405
- }]; }
157
+ return h("div", { key: 'bfb803110a70b89dd484e993c204b572f0115a17', class: `text__wrapper ${this.name}__input ${this.autofilled ? 'text__wrapper--autofilled' : ''}`, ref: el => this.stylingContainer = el }, h("div", { key: '6e9f8f5aada98821d5dc78ccb8b1431ba23b81ab', class: 'text__wrapper--flex' }, h("label", { key: '05cf07855121a79641475a5b020774cf8120d1ed', class: `text__label ${this.validation.mandatory ? 'text__label--required' : ''}`, htmlFor: `${this.name}__input` }, this.displayName), h("div", { key: 'f8c48a999f6827a61ec392ce99858c19559c77d2', class: 'text__wrapper--relative' }, this.tooltip &&
158
+ h("img", { key: 'e866f1df104ce57c29164e73b4ad4d017c7201cd', class: 'text__tooltip-icon', src: tooltipIcon, alt: "", ref: (el) => this.tooltipIconReference = el, onClick: () => this.showTooltip = !this.showTooltip }), this.renderTooltip())), h("input", { key: 'd761c265b1487fe73af54568b6da7fed82656b8d', name: this.name, id: `${this.name}__input`, value: this.defaultValue, type: 'text', class: `text__input ${invalidClass}`, placeholder: `${this.placeholder}`, ref: (el) => this.inputReference = el, readOnly: this.autofilled, pattern: this.validationPattern, required: this.validation.mandatory, minlength: this.validation.minLength, maxlength: this.validation.maxLength, onInput: this.handleInput, onBlur: this.handleBlur }), h("small", { key: '5c8df34dd47959eb1668cdf389524d145c69fa84', class: 'text__error-message' }, this.errorMessage));
159
+ }
160
+ static get is() { return "text-input"; }
161
+ static get encapsulation() { return "shadow"; }
162
+ static get originalStyleUrls() {
163
+ return {
164
+ "$": ["text-input.scss"]
165
+ };
166
+ }
167
+ static get styleUrls() {
168
+ return {
169
+ "$": ["text-input.css"]
170
+ };
171
+ }
172
+ static get properties() {
173
+ return {
174
+ "name": {
175
+ "type": "string",
176
+ "mutable": false,
177
+ "complexType": {
178
+ "original": "string",
179
+ "resolved": "string",
180
+ "references": {}
181
+ },
182
+ "required": false,
183
+ "optional": false,
184
+ "docs": {
185
+ "tags": [],
186
+ "text": "Name of the input."
187
+ },
188
+ "attribute": "name",
189
+ "reflect": true
190
+ },
191
+ "displayName": {
192
+ "type": "string",
193
+ "mutable": false,
194
+ "complexType": {
195
+ "original": "string",
196
+ "resolved": "string",
197
+ "references": {}
198
+ },
199
+ "required": false,
200
+ "optional": false,
201
+ "docs": {
202
+ "tags": [],
203
+ "text": "Name of input to be shown to the user."
204
+ },
205
+ "attribute": "display-name",
206
+ "reflect": true
207
+ },
208
+ "placeholder": {
209
+ "type": "string",
210
+ "mutable": false,
211
+ "complexType": {
212
+ "original": "string",
213
+ "resolved": "string",
214
+ "references": {}
215
+ },
216
+ "required": false,
217
+ "optional": false,
218
+ "docs": {
219
+ "tags": [],
220
+ "text": "Placeholder text to be shown."
221
+ },
222
+ "attribute": "placeholder",
223
+ "reflect": true
224
+ },
225
+ "validation": {
226
+ "type": "unknown",
227
+ "mutable": false,
228
+ "complexType": {
229
+ "original": "ValidationSchema",
230
+ "resolved": "ValidationSchema",
231
+ "references": {
232
+ "ValidationSchema": {
233
+ "location": "import",
234
+ "path": "../../utils/types",
235
+ "id": "../../../../packages/stencil/general-input/src/utils/types.ts::ValidationSchema"
236
+ }
237
+ }
238
+ },
239
+ "required": false,
240
+ "optional": false,
241
+ "docs": {
242
+ "tags": [],
243
+ "text": "Object of validation rules for the input."
244
+ }
245
+ },
246
+ "defaultValue": {
247
+ "type": "string",
248
+ "mutable": false,
249
+ "complexType": {
250
+ "original": "string",
251
+ "resolved": "string",
252
+ "references": {}
253
+ },
254
+ "required": false,
255
+ "optional": false,
256
+ "docs": {
257
+ "tags": [],
258
+ "text": "Default value for the input."
259
+ },
260
+ "attribute": "default-value",
261
+ "reflect": true,
262
+ "defaultValue": "''"
263
+ },
264
+ "autofilled": {
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": "Boolean. Determines if input should be readonly."
277
+ },
278
+ "attribute": "autofilled",
279
+ "reflect": true
280
+ },
281
+ "tooltip": {
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": "Tooltip text."
294
+ },
295
+ "attribute": "tooltip",
296
+ "reflect": true
297
+ },
298
+ "language": {
299
+ "type": "string",
300
+ "mutable": false,
301
+ "complexType": {
302
+ "original": "string",
303
+ "resolved": "string",
304
+ "references": {}
305
+ },
306
+ "required": false,
307
+ "optional": false,
308
+ "docs": {
309
+ "tags": [],
310
+ "text": "Currently selected language."
311
+ },
312
+ "attribute": "language",
313
+ "reflect": true
314
+ },
315
+ "checkValidity": {
316
+ "type": "boolean",
317
+ "mutable": false,
318
+ "complexType": {
319
+ "original": "boolean",
320
+ "resolved": "boolean",
321
+ "references": {}
322
+ },
323
+ "required": false,
324
+ "optional": false,
325
+ "docs": {
326
+ "tags": [],
327
+ "text": "State passed down from the parent element. Will trigger the input to check for validity."
328
+ },
329
+ "attribute": "check-validity",
330
+ "reflect": true
331
+ },
332
+ "emitValue": {
333
+ "type": "boolean",
334
+ "mutable": false,
335
+ "complexType": {
336
+ "original": "boolean",
337
+ "resolved": "boolean",
338
+ "references": {}
339
+ },
340
+ "required": false,
341
+ "optional": false,
342
+ "docs": {
343
+ "tags": [],
344
+ "text": "State passed down from the parent element. Will trigger the input to send it's value through an event."
345
+ },
346
+ "attribute": "emit-value",
347
+ "reflect": true
348
+ },
349
+ "isDuplicateInput": {
350
+ "type": "boolean",
351
+ "mutable": false,
352
+ "complexType": {
353
+ "original": "boolean",
354
+ "resolved": "boolean",
355
+ "references": {}
356
+ },
357
+ "required": false,
358
+ "optional": false,
359
+ "docs": {
360
+ "tags": [],
361
+ "text": "Boolean that triggers certain validation rules, for duplicated inputs."
362
+ },
363
+ "attribute": "is-duplicate-input",
364
+ "reflect": true
365
+ },
366
+ "clientStyling": {
367
+ "type": "string",
368
+ "mutable": false,
369
+ "complexType": {
370
+ "original": "string",
371
+ "resolved": "string",
372
+ "references": {}
373
+ },
374
+ "required": false,
375
+ "optional": false,
376
+ "docs": {
377
+ "tags": [],
378
+ "text": "Client custom styling via inline style"
379
+ },
380
+ "attribute": "client-styling",
381
+ "reflect": true,
382
+ "defaultValue": "''"
383
+ }
384
+ };
385
+ }
386
+ static get states() {
387
+ return {
388
+ "isValid": {},
389
+ "errorMessage": {},
390
+ "limitStylingAppends": {},
391
+ "showTooltip": {}
392
+ };
393
+ }
394
+ static get events() {
395
+ return [{
396
+ "method": "sendValidityState",
397
+ "name": "sendValidityState",
398
+ "bubbles": true,
399
+ "cancelable": true,
400
+ "composed": true,
401
+ "docs": {
402
+ "tags": [],
403
+ "text": ""
404
+ },
405
+ "complexType": {
406
+ "original": "InputStateEvent",
407
+ "resolved": "InputStateEvent",
408
+ "references": {
409
+ "InputStateEvent": {
410
+ "location": "import",
411
+ "path": "../../utils/types",
412
+ "id": "../../../../packages/stencil/general-input/src/utils/types.ts::InputStateEvent"
413
+ }
414
+ }
415
+ }
416
+ }, {
417
+ "method": "sendInputValue",
418
+ "name": "sendInputValue",
419
+ "bubbles": true,
420
+ "cancelable": true,
421
+ "composed": true,
422
+ "docs": {
423
+ "tags": [],
424
+ "text": ""
425
+ },
426
+ "complexType": {
427
+ "original": "InputValueEvent",
428
+ "resolved": "InputValueEvent",
429
+ "references": {
430
+ "InputValueEvent": {
431
+ "location": "import",
432
+ "path": "../../utils/types",
433
+ "id": "../../../../packages/stencil/general-input/src/utils/types.ts::InputValueEvent"
434
+ }
435
+ }
436
+ }
437
+ }];
438
+ }
439
+ static get watchers() {
440
+ return [{
441
+ "propName": "isValid",
442
+ "methodName": "validityChanged"
443
+ }, {
444
+ "propName": "emitValue",
445
+ "methodName": "emitValueHandler"
446
+ }];
447
+ }
448
+ static get listeners() {
449
+ return [{
450
+ "name": "click",
451
+ "method": "handleClickOutside",
452
+ "target": "document",
453
+ "capture": false,
454
+ "passive": false
455
+ }, {
456
+ "name": "sendInputValue",
457
+ "method": "valueChangedHandler",
458
+ "target": "body",
459
+ "capture": false,
460
+ "passive": false
461
+ }];
462
+ }
406
463
  }