@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,341 +1,414 @@
1
- import { Component, h, State, Prop, Watch, Event, Element, Listen } from '@stencil/core';
2
- import { translate } from '../../utils/locale.utils';
3
- import '@vaadin/date-picker';
4
- import tooltipIcon from '../../utils/tooltipIcon.svg';
1
+ import { h } from "@stencil/core";
2
+ import { translate } from "../../utils/locale.utils";
3
+ import "@vaadin/date-picker";
4
+ import tooltipIcon from "../../utils/tooltipIcon.svg";
5
+ import dateFnsFormat from "date-fns/format";
6
+ import dateFnsParse from "date-fns/parse";
7
+ import { isBefore, isAfter } from "date-fns";
5
8
  export class DateInput {
6
- constructor() {
7
- /**
8
- * Client custom styling via inline style
9
- */
10
- this.clientStyling = '';
11
- this.limitStylingAppends = false;
12
- this.showTooltip = false;
13
- this.setClientStyling = () => {
14
- let sheet = document.createElement('style');
15
- sheet.innerHTML = this.clientStyling;
16
- this.stylingContainer.prepend(sheet);
17
- };
18
- }
19
- validityChanged() {
20
- this.validityStateHandler({ valid: this.isValid, name: this.name });
21
- if (this.emitValue == true) {
22
- this.valueHandler({ name: this.name, value: this.value });
9
+ constructor() {
10
+ this.touched = false;
11
+ this.formatDate = (dateParts) => {
12
+ const { year, month, day } = dateParts;
13
+ const date = new Date(year, month, day);
14
+ return dateFnsFormat(date, this.dateFormat || 'yyyy-MM-dd');
15
+ };
16
+ this.parseDate = (inputValue) => {
17
+ const date = dateFnsParse(inputValue, this.dateFormat || 'yyyy-MM-dd', new Date());
18
+ return { year: date.getFullYear(), month: date.getMonth(), day: date.getDate() };
19
+ };
20
+ this.handleBlur = () => {
21
+ this.isValid = this.setValidity();
22
+ this.errorMessage = this.setErrorMessage();
23
+ this.touched = true;
24
+ };
25
+ this.setClientStyling = () => {
26
+ let sheet = document.createElement('style');
27
+ sheet.innerHTML = this.clientStyling;
28
+ this.stylingContainer.prepend(sheet);
29
+ };
30
+ this.name = undefined;
31
+ this.displayName = undefined;
32
+ this.placeholder = undefined;
33
+ this.validation = undefined;
34
+ this.defaultValue = undefined;
35
+ this.autofilled = undefined;
36
+ this.tooltip = undefined;
37
+ this.language = undefined;
38
+ this.emitValue = undefined;
39
+ this.clientStyling = '';
40
+ this.dateFormat = undefined;
41
+ this.errorMessage = undefined;
42
+ this.isValid = undefined;
43
+ this.limitStylingAppends = false;
44
+ this.showTooltip = false;
23
45
  }
24
- }
25
- validityStateHandler(inputStateEvent) {
26
- this.sendValidityState.emit(inputStateEvent);
27
- }
28
- emitValueHandler(newValue) {
29
- if (newValue == true && this.isValid) {
30
- this.valueHandler({ name: this.name, value: this.value });
46
+ validityChanged() {
47
+ this.validityStateHandler({ valid: this.isValid, name: this.name });
48
+ if (this.emitValue == true) {
49
+ this.valueHandler({ name: this.name, value: this.value });
50
+ }
51
+ }
52
+ validityStateHandler(inputStateEvent) {
53
+ this.sendValidityState.emit(inputStateEvent);
31
54
  }
32
- }
33
- valueHandler(inputValueEvent) {
34
- this.sendInputValue.emit(inputValueEvent);
35
- }
36
- handleClickOutside(event) {
37
- if (event.composedPath()[0] === this.tooltipIconReference)
38
- return;
39
- if (event.composedPath()[0] !== this.tooltipReference)
40
- this.showTooltip = false;
41
- }
42
- componentDidRender() {
43
- // start custom styling area
44
- if (!this.limitStylingAppends && this.stylingContainer) {
45
- if (this.clientStyling)
46
- this.setClientStyling();
47
- this.limitStylingAppends = true;
55
+ emitValueHandler(newValue) {
56
+ if (newValue == true && this.isValid) {
57
+ this.valueHandler({ name: this.name, value: this.value });
58
+ }
48
59
  }
49
- // end custom styling area
50
- if (this.defaultValue) {
51
- this.value = this.defaultValue;
52
- this.valueHandler({ name: this.name, value: this.value });
60
+ valueHandler(inputValueEvent) {
61
+ this.sendInputValue.emit(inputValueEvent);
53
62
  }
54
- }
55
- componentDidLoad() {
56
- this.inputReference = this.element.shadowRoot.querySelector('input');
57
- }
58
- handleInput(event) {
59
- this.value = event.target.value;
60
- this.errorMessage = this.setErrorMessage();
61
- this.isValid = this.setValidity();
62
- this.validityStateHandler({ valid: this.isValid, name: this.name });
63
- this.emitValueHandler(true);
64
- }
65
- setValidity() {
66
- return this.inputReference.validity.valid;
67
- }
68
- setErrorMessage() {
69
- if (this.inputReference.validity.rangeUnderflow || this.inputReference.validity.rangeOverflow) {
70
- return translate('dateError', this.language, { values: { min: this.validation.min, max: this.validation.max } });
63
+ handleClickOutside(event) {
64
+ if (event.composedPath()[0] === this.tooltipIconReference)
65
+ return;
66
+ if (event.composedPath()[0] !== this.tooltipReference)
67
+ this.showTooltip = false;
71
68
  }
72
- if (this.inputReference.validity.valueMissing) {
73
- return translate('requiredError', this.language);
69
+ connectedCallback() {
70
+ var _a, _b;
71
+ this.minDate = dateFnsParse(((_a = this.validation.min) === null || _a === void 0 ? void 0 : _a.toString()) || '', 'yyyy-MM-dd', new Date());
72
+ this.maxDate = dateFnsParse(((_b = this.validation.max) === null || _b === void 0 ? void 0 : _b.toString()) || '', 'yyyy-MM-dd', new Date());
74
73
  }
75
- }
76
- renderTooltip() {
77
- if (this.showTooltip) {
78
- return (h("div", { class: `date__tooltip ${this.showTooltip ? 'visible' : ''}`, ref: (el) => this.tooltipReference = el, innerHTML: this.tooltip }));
74
+ componentDidRender() {
75
+ // start custom styling area
76
+ if (!this.limitStylingAppends && this.stylingContainer) {
77
+ if (this.clientStyling)
78
+ this.setClientStyling();
79
+ this.limitStylingAppends = true;
80
+ }
81
+ // end custom styling area
79
82
  }
80
- return null;
81
- }
82
- render() {
83
- const invalidClass = this.isValid == true || this.isValid == undefined ? '' : 'date__input--invalid';
84
- return h("div", { class: 'date__wrapper', ref: el => this.stylingContainer = el },
85
- h("label", { class: `date__label ${this.validation.mandatory ? 'date__label--required' : ''}}`, htmlFor: `${this.name}__input` },
86
- this.displayName,
87
- " ",
88
- this.validation.mandatory ? '*' : ''),
89
- h("vaadin-date-picker", { id: `${this.name}__input`, type: 'date', class: `date__input ${invalidClass}`, value: this.defaultValue, readOnly: this.autofilled, placeholder: `${this.placeholder} ${this.placeholder && this.validation.mandatory ? '*' : ''}`, required: this.validation.mandatory, max: this.validation.max, min: this.validation.min, onBlur: (e) => this.handleInput(e) }),
90
- h("small", { class: 'date__error-message' }, this.errorMessage),
91
- this.tooltip &&
92
- h("img", { class: 'date__tooltip-icon', src: tooltipIcon, alt: "", ref: (el) => this.tooltipIconReference = el, onClick: () => this.showTooltip = !this.showTooltip }),
93
- this.renderTooltip());
94
- }
95
- static get is() { return "date-input"; }
96
- static get encapsulation() { return "shadow"; }
97
- static get originalStyleUrls() { return {
98
- "$": ["date-input.scss"]
99
- }; }
100
- static get styleUrls() { return {
101
- "$": ["date-input.css"]
102
- }; }
103
- static get properties() { return {
104
- "name": {
105
- "type": "string",
106
- "mutable": false,
107
- "complexType": {
108
- "original": "string",
109
- "resolved": "string",
110
- "references": {}
111
- },
112
- "required": false,
113
- "optional": false,
114
- "docs": {
115
- "tags": [],
116
- "text": "Name of the input."
117
- },
118
- "attribute": "name",
119
- "reflect": true
120
- },
121
- "displayName": {
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 input to be shown to the user."
134
- },
135
- "attribute": "display-name",
136
- "reflect": true
137
- },
138
- "placeholder": {
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": "Placeholder text to be shown."
151
- },
152
- "attribute": "placeholder",
153
- "reflect": true
154
- },
155
- "validation": {
156
- "type": "unknown",
157
- "mutable": false,
158
- "complexType": {
159
- "original": "ValidationSchema",
160
- "resolved": "ValidationSchema",
161
- "references": {
162
- "ValidationSchema": {
163
- "location": "import",
164
- "path": "../../utils/types"
165
- }
83
+ componentDidLoad() {
84
+ this.datePicker = this.element.shadowRoot.querySelector('vaadin-date-picker');
85
+ this.inputReference = this.element.shadowRoot.querySelector('input');
86
+ this.datePicker.i18n = Object.assign(Object.assign({}, this.datePicker.i18n), { formatDate: this.formatDate, parseDate: this.parseDate });
87
+ this.isValid = this.setValidity();
88
+ if (this.defaultValue) {
89
+ this.value = this.defaultValue;
90
+ this.valueHandler({ name: this.name, value: this.value });
166
91
  }
167
- },
168
- "required": false,
169
- "optional": false,
170
- "docs": {
171
- "tags": [],
172
- "text": "Object of validation rules for the input."
173
- }
174
- },
175
- "defaultValue": {
176
- "type": "string",
177
- "mutable": false,
178
- "complexType": {
179
- "original": "string",
180
- "resolved": "string",
181
- "references": {}
182
- },
183
- "required": false,
184
- "optional": false,
185
- "docs": {
186
- "tags": [],
187
- "text": "Default value for the input."
188
- },
189
- "attribute": "default-value",
190
- "reflect": true
191
- },
192
- "autofilled": {
193
- "type": "boolean",
194
- "mutable": false,
195
- "complexType": {
196
- "original": "boolean",
197
- "resolved": "boolean",
198
- "references": {}
199
- },
200
- "required": false,
201
- "optional": false,
202
- "docs": {
203
- "tags": [],
204
- "text": "Boolean. Determines if input should be readonly."
205
- },
206
- "attribute": "autofilled",
207
- "reflect": true
208
- },
209
- "tooltip": {
210
- "type": "string",
211
- "mutable": false,
212
- "complexType": {
213
- "original": "string",
214
- "resolved": "string",
215
- "references": {}
216
- },
217
- "required": false,
218
- "optional": false,
219
- "docs": {
220
- "tags": [],
221
- "text": "Tooltip text."
222
- },
223
- "attribute": "tooltip",
224
- "reflect": true
225
- },
226
- "language": {
227
- "type": "string",
228
- "mutable": false,
229
- "complexType": {
230
- "original": "string",
231
- "resolved": "string",
232
- "references": {}
233
- },
234
- "required": false,
235
- "optional": false,
236
- "docs": {
237
- "tags": [],
238
- "text": "Currently selected language."
239
- },
240
- "attribute": "language",
241
- "reflect": true
242
- },
243
- "emitValue": {
244
- "type": "boolean",
245
- "mutable": false,
246
- "complexType": {
247
- "original": "boolean",
248
- "resolved": "boolean",
249
- "references": {}
250
- },
251
- "required": false,
252
- "optional": false,
253
- "docs": {
254
- "tags": [],
255
- "text": "State passed down from the parent element. Will trigger the input to send it's value through an event."
256
- },
257
- "attribute": "emit-value",
258
- "reflect": true
259
- },
260
- "clientStyling": {
261
- "type": "string",
262
- "mutable": false,
263
- "complexType": {
264
- "original": "string",
265
- "resolved": "string",
266
- "references": {}
267
- },
268
- "required": false,
269
- "optional": false,
270
- "docs": {
271
- "tags": [],
272
- "text": "Client custom styling via inline style"
273
- },
274
- "attribute": "client-styling",
275
- "reflect": true,
276
- "defaultValue": "''"
277
92
  }
278
- }; }
279
- static get states() { return {
280
- "errorMessage": {},
281
- "isValid": {},
282
- "limitStylingAppends": {},
283
- "showTooltip": {}
284
- }; }
285
- static get events() { return [{
286
- "method": "sendValidityState",
287
- "name": "sendValidityState",
288
- "bubbles": true,
289
- "cancelable": true,
290
- "composed": true,
291
- "docs": {
292
- "tags": [],
293
- "text": ""
294
- },
295
- "complexType": {
296
- "original": "InputStateEvent",
297
- "resolved": "InputStateEvent",
298
- "references": {
299
- "InputStateEvent": {
300
- "location": "import",
301
- "path": "../../utils/types"
302
- }
93
+ handleInput(event) {
94
+ this.value = event.target.value;
95
+ this.touched = true;
96
+ this.valueAsDate = dateFnsParse(this.value || '', 'yyyy-MM-dd', new Date());
97
+ this.isValid = this.setValidity();
98
+ this.errorMessage = this.setErrorMessage();
99
+ this.emitValueHandler(true);
100
+ }
101
+ setValidity() {
102
+ if (isBefore(this.valueAsDate, this.minDate) || isAfter(this.valueAsDate, this.maxDate)) {
103
+ return false;
104
+ }
105
+ else {
106
+ return this.inputReference.validity.valid;
303
107
  }
304
- }
305
- }, {
306
- "method": "sendInputValue",
307
- "name": "sendInputValue",
308
- "bubbles": true,
309
- "cancelable": true,
310
- "composed": true,
311
- "docs": {
312
- "tags": [],
313
- "text": ""
314
- },
315
- "complexType": {
316
- "original": "InputValueEvent",
317
- "resolved": "InputValueEvent",
318
- "references": {
319
- "InputValueEvent": {
320
- "location": "import",
321
- "path": "../../utils/types"
322
- }
108
+ }
109
+ setErrorMessage() {
110
+ if (isBefore(this.valueAsDate, this.minDate) || isAfter(this.valueAsDate, this.maxDate)) {
111
+ return translate('dateError2', this.language);
112
+ }
113
+ if (this.inputReference.validity.rangeUnderflow || this.inputReference.validity.rangeOverflow) {
114
+ return translate('dateError', this.language, { values: { min: this.validation.min, max: this.validation.max } });
115
+ }
116
+ if (this.inputReference.validity.valueMissing) {
117
+ return translate('requiredError', this.language);
118
+ }
119
+ }
120
+ renderTooltip() {
121
+ if (this.showTooltip) {
122
+ return (h("div", { class: `date__tooltip ${this.showTooltip ? 'visible' : ''}`, ref: (el) => this.tooltipReference = el, innerHTML: this.tooltip }));
323
123
  }
324
- }
325
- }]; }
326
- static get elementRef() { return "element"; }
327
- static get watchers() { return [{
328
- "propName": "isValid",
329
- "methodName": "validityChanged"
330
- }, {
331
- "propName": "emitValue",
332
- "methodName": "emitValueHandler"
333
- }]; }
334
- static get listeners() { return [{
335
- "name": "click",
336
- "method": "handleClickOutside",
337
- "target": "document",
338
- "capture": false,
339
- "passive": false
340
- }]; }
124
+ return null;
125
+ }
126
+ render() {
127
+ let invalidClass = '';
128
+ if (this.touched) {
129
+ invalidClass = this.isValid == true || this.isValid == undefined ? '' : 'text__input--invalid';
130
+ }
131
+ return h("div", { key: '7fd02e4a0be8222ba408a59b5a32384a7ae979ae', class: `date__wrapper ${this.autofilled ? 'date__wrapper--autofilled' : ''} ${this.name}__input`, ref: el => this.stylingContainer = el }, h("label", { key: '8a9d7390bcee99105d65d406d86d6be997a333ad', class: `date__label ${this.validation.mandatory ? 'date__label--required' : ''}}`, htmlFor: `${this.name}__input` }, this.displayName, " ", this.validation.mandatory ? '*' : ''), h("vaadin-date-picker", { key: 'b8640a92030fde948dae7a4698d0937e701b720c', id: `${this.name}__input`, type: 'date', class: `date__input ${invalidClass}`, value: this.defaultValue, readOnly: this.autofilled, placeholder: `${this.placeholder}`, required: this.validation.mandatory, max: this.validation.max, min: this.validation.min, onChange: (e) => this.handleInput(e), onBlur: this.handleBlur }), h("small", { key: '45585438da48ddaf16c7301059d1e50b63e56a95', class: 'date__error-message' }, this.errorMessage), this.tooltip &&
132
+ h("img", { key: '4195a881e57441fd9faee6411760715e1cac12f5', class: 'date__tooltip-icon', src: tooltipIcon, alt: "", ref: (el) => this.tooltipIconReference = el, onClick: () => this.showTooltip = !this.showTooltip }), this.renderTooltip());
133
+ }
134
+ static get is() { return "date-input"; }
135
+ static get encapsulation() { return "shadow"; }
136
+ static get originalStyleUrls() {
137
+ return {
138
+ "$": ["date-input.scss"]
139
+ };
140
+ }
141
+ static get styleUrls() {
142
+ return {
143
+ "$": ["date-input.css"]
144
+ };
145
+ }
146
+ static get properties() {
147
+ return {
148
+ "name": {
149
+ "type": "string",
150
+ "mutable": false,
151
+ "complexType": {
152
+ "original": "string",
153
+ "resolved": "string",
154
+ "references": {}
155
+ },
156
+ "required": false,
157
+ "optional": false,
158
+ "docs": {
159
+ "tags": [],
160
+ "text": "Name of the input."
161
+ },
162
+ "attribute": "name",
163
+ "reflect": true
164
+ },
165
+ "displayName": {
166
+ "type": "string",
167
+ "mutable": false,
168
+ "complexType": {
169
+ "original": "string",
170
+ "resolved": "string",
171
+ "references": {}
172
+ },
173
+ "required": false,
174
+ "optional": false,
175
+ "docs": {
176
+ "tags": [],
177
+ "text": "Name of input to be shown to the user."
178
+ },
179
+ "attribute": "display-name",
180
+ "reflect": true
181
+ },
182
+ "placeholder": {
183
+ "type": "string",
184
+ "mutable": false,
185
+ "complexType": {
186
+ "original": "string",
187
+ "resolved": "string",
188
+ "references": {}
189
+ },
190
+ "required": false,
191
+ "optional": false,
192
+ "docs": {
193
+ "tags": [],
194
+ "text": "Placeholder text to be shown."
195
+ },
196
+ "attribute": "placeholder",
197
+ "reflect": true
198
+ },
199
+ "validation": {
200
+ "type": "unknown",
201
+ "mutable": false,
202
+ "complexType": {
203
+ "original": "ValidationSchema",
204
+ "resolved": "ValidationSchema",
205
+ "references": {
206
+ "ValidationSchema": {
207
+ "location": "import",
208
+ "path": "../../utils/types",
209
+ "id": "../../../../packages/stencil/general-input/src/utils/types.ts::ValidationSchema"
210
+ }
211
+ }
212
+ },
213
+ "required": false,
214
+ "optional": false,
215
+ "docs": {
216
+ "tags": [],
217
+ "text": "Object of validation rules for the input."
218
+ }
219
+ },
220
+ "defaultValue": {
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": "Default value for the input."
233
+ },
234
+ "attribute": "default-value",
235
+ "reflect": true
236
+ },
237
+ "autofilled": {
238
+ "type": "boolean",
239
+ "mutable": false,
240
+ "complexType": {
241
+ "original": "boolean",
242
+ "resolved": "boolean",
243
+ "references": {}
244
+ },
245
+ "required": false,
246
+ "optional": false,
247
+ "docs": {
248
+ "tags": [],
249
+ "text": "Boolean. Determines if input should be readonly."
250
+ },
251
+ "attribute": "autofilled",
252
+ "reflect": true
253
+ },
254
+ "tooltip": {
255
+ "type": "string",
256
+ "mutable": false,
257
+ "complexType": {
258
+ "original": "string",
259
+ "resolved": "string",
260
+ "references": {}
261
+ },
262
+ "required": false,
263
+ "optional": false,
264
+ "docs": {
265
+ "tags": [],
266
+ "text": "Tooltip text."
267
+ },
268
+ "attribute": "tooltip",
269
+ "reflect": true
270
+ },
271
+ "language": {
272
+ "type": "string",
273
+ "mutable": false,
274
+ "complexType": {
275
+ "original": "string",
276
+ "resolved": "string",
277
+ "references": {}
278
+ },
279
+ "required": false,
280
+ "optional": false,
281
+ "docs": {
282
+ "tags": [],
283
+ "text": "Currently selected language."
284
+ },
285
+ "attribute": "language",
286
+ "reflect": true
287
+ },
288
+ "emitValue": {
289
+ "type": "boolean",
290
+ "mutable": false,
291
+ "complexType": {
292
+ "original": "boolean",
293
+ "resolved": "boolean",
294
+ "references": {}
295
+ },
296
+ "required": false,
297
+ "optional": false,
298
+ "docs": {
299
+ "tags": [],
300
+ "text": "State passed down from the parent element. Will trigger the input to send it's value through an event."
301
+ },
302
+ "attribute": "emit-value",
303
+ "reflect": true
304
+ },
305
+ "clientStyling": {
306
+ "type": "string",
307
+ "mutable": false,
308
+ "complexType": {
309
+ "original": "string",
310
+ "resolved": "string",
311
+ "references": {}
312
+ },
313
+ "required": false,
314
+ "optional": false,
315
+ "docs": {
316
+ "tags": [],
317
+ "text": "Client custom styling via inline style"
318
+ },
319
+ "attribute": "client-styling",
320
+ "reflect": true,
321
+ "defaultValue": "''"
322
+ },
323
+ "dateFormat": {
324
+ "type": "string",
325
+ "mutable": false,
326
+ "complexType": {
327
+ "original": "string",
328
+ "resolved": "string",
329
+ "references": {}
330
+ },
331
+ "required": false,
332
+ "optional": false,
333
+ "docs": {
334
+ "tags": [],
335
+ "text": "Date format for date picker."
336
+ },
337
+ "attribute": "date-format",
338
+ "reflect": true
339
+ }
340
+ };
341
+ }
342
+ static get states() {
343
+ return {
344
+ "errorMessage": {},
345
+ "isValid": {},
346
+ "limitStylingAppends": {},
347
+ "showTooltip": {}
348
+ };
349
+ }
350
+ static get events() {
351
+ return [{
352
+ "method": "sendValidityState",
353
+ "name": "sendValidityState",
354
+ "bubbles": true,
355
+ "cancelable": true,
356
+ "composed": true,
357
+ "docs": {
358
+ "tags": [],
359
+ "text": ""
360
+ },
361
+ "complexType": {
362
+ "original": "InputStateEvent",
363
+ "resolved": "InputStateEvent",
364
+ "references": {
365
+ "InputStateEvent": {
366
+ "location": "import",
367
+ "path": "../../utils/types",
368
+ "id": "../../../../packages/stencil/general-input/src/utils/types.ts::InputStateEvent"
369
+ }
370
+ }
371
+ }
372
+ }, {
373
+ "method": "sendInputValue",
374
+ "name": "sendInputValue",
375
+ "bubbles": true,
376
+ "cancelable": true,
377
+ "composed": true,
378
+ "docs": {
379
+ "tags": [],
380
+ "text": ""
381
+ },
382
+ "complexType": {
383
+ "original": "InputValueEvent",
384
+ "resolved": "InputValueEvent",
385
+ "references": {
386
+ "InputValueEvent": {
387
+ "location": "import",
388
+ "path": "../../utils/types",
389
+ "id": "../../../../packages/stencil/general-input/src/utils/types.ts::InputValueEvent"
390
+ }
391
+ }
392
+ }
393
+ }];
394
+ }
395
+ static get elementRef() { return "element"; }
396
+ static get watchers() {
397
+ return [{
398
+ "propName": "isValid",
399
+ "methodName": "validityChanged"
400
+ }, {
401
+ "propName": "emitValue",
402
+ "methodName": "emitValueHandler"
403
+ }];
404
+ }
405
+ static get listeners() {
406
+ return [{
407
+ "name": "click",
408
+ "method": "handleClickOutside",
409
+ "target": "document",
410
+ "capture": false,
411
+ "passive": false
412
+ }];
413
+ }
341
414
  }