@everymatrix/general-input 1.10.0 → 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 +144 -16
  14. package/dist/collection/components/date-input/date-input.css +64 -30
  15. package/dist/collection/components/date-input/date-input.js +186 -32
  16. package/dist/collection/components/email-input/email-input.css +63 -28
  17. package/dist/collection/components/email-input/email-input.js +183 -39
  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 +165 -42
  21. package/dist/collection/components/password-input/password-input.css +120 -29
  22. package/dist/collection/components/password-input/password-input.js +341 -24
  23. package/dist/collection/components/radio-input/radio-input.css +22 -1
  24. package/dist/collection/components/radio-input/radio-input.js +83 -31
  25. package/dist/collection/components/select-input/select-input.css +75 -22
  26. package/dist/collection/components/select-input/select-input.js +172 -59
  27. package/dist/collection/components/tel-input/tel-input.css +91 -33
  28. package/dist/collection/components/tel-input/tel-input.js +195 -49
  29. package/dist/collection/components/text-input/text-input.css +63 -28
  30. package/dist/collection/components/text-input/text-input.js +208 -38
  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 +63 -12
  40. package/dist/components/date-input2.js +10247 -24
  41. package/dist/components/email-input2.js +97 -34
  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 +91 -29
  47. package/dist/components/password-input2.js +924 -23
  48. package/dist/components/pattern-mixin.js +85 -0
  49. package/dist/components/radio-input2.js +47 -22
  50. package/dist/components/select-input2.js +86 -38
  51. package/dist/components/tel-input2.js +122 -36
  52. package/dist/components/text-input2.js +120 -33
  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 -6
  77. package/dist/types/components/email-input/email-input.d.ts +35 -6
  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 -8
  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 -6
  82. package/dist/types/components/select-input/select-input.d.ts +36 -8
  83. package/dist/types/components/tel-input/tel-input.d.ts +40 -10
  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 +544 -33
  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 +9 -2
  90. package/dist/cjs/checkbox-input_9.cjs.entry.js +0 -686
  91. package/dist/components/locale.utils.js +0 -29
  92. package/dist/esm/checkbox-input_9.entry.js +0 -674
  93. package/dist/general-input/p-c9e79656.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
@@ -1,6 +1,25 @@
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 CheckboxInput {
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.limitStylingAppends = false;
15
+ this.showTooltip = false;
16
+ this.value = '';
17
+ this.setClientStyling = () => {
18
+ let sheet = document.createElement('style');
19
+ sheet.innerHTML = this.clientStyling;
20
+ this.stylingContainer.prepend(sheet);
21
+ };
22
+ }
4
23
  validityChanged() {
5
24
  this.validityStateHandler({ valid: this.isValid, name: this.name });
6
25
  if (this.emitValue == true) {
@@ -18,13 +37,32 @@ export class CheckboxInput {
18
37
  valueHandler(inputValueEvent) {
19
38
  this.sendInputValue.emit(inputValueEvent);
20
39
  }
21
- connectedCallback() {
40
+ handleClickOutside(event) {
41
+ if (event.composedPath()[0] === this.tooltipIconReference)
42
+ return;
43
+ if (event.composedPath()[0] !== this.tooltipReference)
44
+ this.showTooltip = false;
45
+ }
46
+ componentDidRender() {
47
+ // start custom styling area
48
+ if (!this.limitStylingAppends && this.stylingContainer) {
49
+ if (this.clientStyling)
50
+ this.setClientStyling();
51
+ this.limitStylingAppends = true;
52
+ }
53
+ // end custom styling area
54
+ }
55
+ componentDidLoad() {
56
+ if (this.defaultValue) {
57
+ this.value = this.defaultValue;
58
+ this.valueHandler({ name: this.name, value: this.value });
59
+ }
22
60
  }
23
61
  handleClick() {
24
- this.value = this.inputReference.checked;
62
+ this.value = this.inputReference.checked.toString();
25
63
  this.errorMessage = this.setErrorMessage();
26
64
  this.isValid = this.setValidity();
27
- this.validityStateHandler({ valid: this.isValid, name: this.name });
65
+ this.emitValueHandler(true);
28
66
  }
29
67
  setValidity() {
30
68
  return this.inputReference.validity.valid;
@@ -34,14 +72,25 @@ export class CheckboxInput {
34
72
  return translate('requiredError', this.language);
35
73
  }
36
74
  }
75
+ renderLabel() {
76
+ return (h("label", { class: 'checkbox__label', htmlFor: `${this.name}__input` },
77
+ h("div", { class: 'checkbox__label-text', innerHTML: `${this.displayName} ${this.validation.mandatory ? '*' : ''}` })));
78
+ }
79
+ renderTooltip() {
80
+ if (this.showTooltip) {
81
+ return (h("div", { class: `checkbox__tooltip ${this.showTooltip ? 'visible' : ''}`, ref: (el) => this.tooltipReference = el, innerHTML: this.tooltip }));
82
+ }
83
+ return null;
84
+ }
37
85
  render() {
38
- return h("div", { class: 'checkbox__wrapper' },
39
- h("input", { type: "checkbox", id: `${this.name}__input`, ref: (el) => this.inputReference = el, name: this.name, required: this.validation.mandatory, value: 'jdjdj', onClick: () => this.handleClick() }),
40
- h("label", { htmlFor: `${this.name}__input` },
41
- this.displayName,
42
- " ",
43
- this.validation.mandatory ? '*' : ''),
44
- h("small", { class: 'checkbox__error-message' }, this.errorMessage));
86
+ return h("div", { class: `checkbox__wrapper ${this.name}__input`, ref: el => this.stylingContainer = el },
87
+ h("input", { class: 'checkbox__input', type: "checkbox", id: `${this.name}__input`, ref: (el) => this.inputReference = el, name: this.name, checked: this.defaultValue === "true", readOnly: this.autofilled, required: this.validation.mandatory, value: this.value, onClick: () => this.handleClick() }),
88
+ this.renderLabel(),
89
+ h("small", { class: 'checkbox__error-message' }, this.errorMessage),
90
+ h("div", { class: 'checkbox__wrapper--relative' },
91
+ this.tooltip &&
92
+ h("img", { class: 'checkbox__tooltip-icon', src: tooltipIcon, alt: "", ref: (el) => this.tooltipIconReference = el, onClick: () => this.showTooltip = !this.showTooltip }),
93
+ this.renderTooltip()));
45
94
  }
46
95
  static get is() { return "checkbox-input"; }
47
96
  static get encapsulation() { return "shadow"; }
@@ -67,7 +116,7 @@ export class CheckboxInput {
67
116
  "text": "Name of the input."
68
117
  },
69
118
  "attribute": "name",
70
- "reflect": false
119
+ "reflect": true
71
120
  },
72
121
  "displayName": {
73
122
  "type": "string",
@@ -84,7 +133,59 @@ export class CheckboxInput {
84
133
  "text": "Name of input to be shown to the user."
85
134
  },
86
135
  "attribute": "display-name",
87
- "reflect": false
136
+ "reflect": true
137
+ },
138
+ "defaultValue": {
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": "Default value for the input."
151
+ },
152
+ "attribute": "default-value",
153
+ "reflect": true,
154
+ "defaultValue": "''"
155
+ },
156
+ "autofilled": {
157
+ "type": "boolean",
158
+ "mutable": false,
159
+ "complexType": {
160
+ "original": "boolean",
161
+ "resolved": "boolean",
162
+ "references": {}
163
+ },
164
+ "required": false,
165
+ "optional": false,
166
+ "docs": {
167
+ "tags": [],
168
+ "text": "Boolean. Determines if input should be readonly."
169
+ },
170
+ "attribute": "autofilled",
171
+ "reflect": true
172
+ },
173
+ "tooltip": {
174
+ "type": "string",
175
+ "mutable": false,
176
+ "complexType": {
177
+ "original": "string",
178
+ "resolved": "string",
179
+ "references": {}
180
+ },
181
+ "required": false,
182
+ "optional": false,
183
+ "docs": {
184
+ "tags": [],
185
+ "text": "Tooltip text."
186
+ },
187
+ "attribute": "tooltip",
188
+ "reflect": true
88
189
  },
89
190
  "validation": {
90
191
  "type": "unknown",
@@ -121,7 +222,7 @@ export class CheckboxInput {
121
222
  "text": "Currently selected language."
122
223
  },
123
224
  "attribute": "language",
124
- "reflect": false
225
+ "reflect": true
125
226
  },
126
227
  "emitValue": {
127
228
  "type": "boolean",
@@ -138,12 +239,32 @@ export class CheckboxInput {
138
239
  "text": "State passed down from the parent element. Will trigger the input to send it's value through an event."
139
240
  },
140
241
  "attribute": "emit-value",
141
- "reflect": false
242
+ "reflect": true
243
+ },
244
+ "clientStyling": {
245
+ "type": "string",
246
+ "mutable": false,
247
+ "complexType": {
248
+ "original": "string",
249
+ "resolved": "string",
250
+ "references": {}
251
+ },
252
+ "required": false,
253
+ "optional": false,
254
+ "docs": {
255
+ "tags": [],
256
+ "text": "Client custom styling via inline style"
257
+ },
258
+ "attribute": "client-styling",
259
+ "reflect": true,
260
+ "defaultValue": "''"
142
261
  }
143
262
  }; }
144
263
  static get states() { return {
145
264
  "errorMessage": {},
146
- "isValid": {}
265
+ "isValid": {},
266
+ "limitStylingAppends": {},
267
+ "showTooltip": {}
147
268
  }; }
148
269
  static get events() { return [{
149
270
  "method": "sendValidityState",
@@ -193,4 +314,11 @@ export class CheckboxInput {
193
314
  "propName": "emitValue",
194
315
  "methodName": "emitValueHandler"
195
316
  }]; }
317
+ static get listeners() { return [{
318
+ "name": "click",
319
+ "method": "handleClickOutside",
320
+ "target": "document",
321
+ "capture": false,
322
+ "passive": false
323
+ }]; }
196
324
  }
@@ -6,55 +6,89 @@
6
6
  box-sizing: border-box;
7
7
  }
8
8
 
9
+ .date {
10
+ font-family: "Roboto";
11
+ font-style: normal;
12
+ }
9
13
  .date__wrapper {
10
14
  position: relative;
11
- display: flex;
12
- flex-direction: column-reverse;
13
- padding-top: 10px;
15
+ width: 100%;
16
+ padding-top: 26px;
17
+ }
18
+ .date__wrapper--autofilled {
19
+ pointer-events: none;
20
+ }
21
+ .date__wrapper--autofilled .date__label {
22
+ color: #979797;
23
+ }
24
+ .date__wrapper--autofilled .date__input::part(input-field) {
25
+ color: #979797;
14
26
  }
15
27
  .date__label {
16
- color: #474747;
28
+ font-family: inherit;
29
+ font-style: normal;
30
+ font-weight: 500;
17
31
  font-size: 16px;
32
+ line-height: 20px;
33
+ color: #2A3841;
18
34
  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);
35
+ top: 0;
36
+ left: 0;
23
37
  }
24
38
  .date__label--required::after {
25
39
  content: "*";
26
- margin-left: 5px;
27
- color: #666666;
40
+ font-family: inherit;
41
+ color: #2A3841;
42
+ margin-left: 2px;
28
43
  }
29
44
  .date__input {
45
+ border: none;
30
46
  width: inherit;
31
- padding: 15px 6px;
32
47
  position: relative;
33
- border: none;
34
- border-bottom: 3px solid #666666;
35
- background-color: transparent;
36
- color: #666666;
37
- font-size: 16px;
38
- font-family: inherit;
39
48
  }
40
- .date__input:focus {
41
- outline: none;
42
- box-shadow: 0 5px 5px rgba(16, 15, 15, 0.1);
49
+ .date__input[focused]::part(input-field) {
50
+ border-color: #3E3E3E;
43
51
  }
44
- .date__input::placeholder {
45
- color: #666666;
52
+ .date__input[invalid]::part(input-field) {
53
+ border-color: #cc0000b3;
46
54
  }
47
- .date__input--invalid {
48
- border-bottom: 3px solid #cc0000;
49
- }
50
- .date__input:placeholder-shown + .date__label {
51
- opacity: 0;
52
- visibility: hidden;
53
- transform: translateY(0);
55
+ .date__input::part(input-field) {
56
+ border-radius: 4px;
57
+ background-color: #FFFFFF;
58
+ border: 2px solid #DEE1EE;
59
+ color: #2A2E3F;
60
+ border-radius: 4px;
61
+ background-color: transparent;
62
+ font-family: inherit;
63
+ font-style: normal;
64
+ font-weight: 300;
65
+ font-size: 16px;
66
+ line-height: 19px;
54
67
  }
55
68
  .date__error-message {
56
69
  position: absolute;
57
70
  top: calc(100% + 5px);
58
71
  left: 0;
59
- color: #cc0000;
72
+ color: #cc0000b3;
73
+ }
74
+ .date__tooltip-icon {
75
+ position: absolute;
76
+ right: 0;
77
+ bottom: 10px;
78
+ }
79
+ .date__tooltip {
80
+ position: absolute;
81
+ bottom: 35px;
82
+ right: 10px;
83
+ background-color: #FFFFFF;
84
+ border: 1px solid #B0B0B0;
85
+ color: #2B2D3F;
86
+ padding: 10px;
87
+ border-radius: 5px;
88
+ opacity: 0;
89
+ transition: opacity 0.3s ease-in-out;
90
+ z-index: 10;
91
+ }
92
+ .date__tooltip.visible {
93
+ opacity: 1;
60
94
  }
@@ -1,17 +1,41 @@
1
- import { Component, h, State, Prop, Watch, Event } from '@stencil/core';
1
+ import { Component, h, State, Prop, Watch, Event, Element, Listen } from '@stencil/core';
2
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';
3
8
  export class DateInput {
4
- checkValidityHandler(newValue) {
5
- if (newValue == true) {
9
+ constructor() {
10
+ /**
11
+ * Client custom styling via inline style
12
+ */
13
+ this.clientStyling = '';
14
+ this.limitStylingAppends = false;
15
+ this.showTooltip = false;
16
+ this.touched = false;
17
+ this.formatDate = (dateParts) => {
18
+ const { year, month, day } = dateParts;
19
+ const date = new Date(year, month, day);
20
+ return dateFnsFormat(date, this.dateFormat || 'yyyy-MM-dd');
21
+ };
22
+ this.parseDate = (inputValue) => {
23
+ const date = dateFnsParse(inputValue, this.dateFormat || 'yyyy-MM-dd', new Date());
24
+ return { year: date.getFullYear(), month: date.getMonth(), day: date.getDate() };
25
+ };
26
+ this.handleBlur = () => {
6
27
  this.isValid = this.setValidity();
7
28
  this.errorMessage = this.setErrorMessage();
8
- this.validityStateHandler({ valid: this.isValid, name: this.name });
9
- }
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
+ };
10
36
  }
11
37
  validityChanged() {
12
- if (this.checkValidity == true) {
13
- this.validityStateHandler({ valid: this.isValid, name: this.name });
14
- }
38
+ this.validityStateHandler({ valid: this.isValid, name: this.name });
15
39
  if (this.emitValue == true) {
16
40
  this.valueHandler({ name: this.name, value: this.value });
17
41
  }
@@ -27,15 +51,56 @@ export class DateInput {
27
51
  valueHandler(inputValueEvent) {
28
52
  this.sendInputValue.emit(inputValueEvent);
29
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
+ connectedCallback() {
61
+ var _a, _b;
62
+ this.minDate = dateFnsParse(((_a = this.validation.min) === null || _a === void 0 ? void 0 : _a.toString()) || '', 'yyyy-MM-dd', new Date());
63
+ this.maxDate = dateFnsParse(((_b = this.validation.max) === null || _b === void 0 ? void 0 : _b.toString()) || '', 'yyyy-MM-dd', new Date());
64
+ }
65
+ componentDidRender() {
66
+ // start custom styling area
67
+ if (!this.limitStylingAppends && this.stylingContainer) {
68
+ if (this.clientStyling)
69
+ this.setClientStyling();
70
+ this.limitStylingAppends = true;
71
+ }
72
+ // end custom styling area
73
+ }
74
+ componentDidLoad() {
75
+ this.datePicker = this.element.shadowRoot.querySelector('vaadin-date-picker');
76
+ this.inputReference = this.element.shadowRoot.querySelector('input');
77
+ this.datePicker.i18n = Object.assign(Object.assign({}, this.datePicker.i18n), { formatDate: this.formatDate, parseDate: this.parseDate });
78
+ this.isValid = this.setValidity();
79
+ if (this.defaultValue) {
80
+ this.value = this.defaultValue;
81
+ this.valueHandler({ name: this.name, value: this.value });
82
+ }
83
+ }
30
84
  handleInput(event) {
31
85
  this.value = event.target.value;
32
- this.errorMessage = this.setErrorMessage();
86
+ this.touched = true;
87
+ this.valueAsDate = dateFnsParse(this.value || '', 'yyyy-MM-dd', new Date());
33
88
  this.isValid = this.setValidity();
89
+ this.errorMessage = this.setErrorMessage();
90
+ this.emitValueHandler(true);
34
91
  }
35
92
  setValidity() {
36
- return this.inputReference.validity.valid;
93
+ if (isBefore(this.valueAsDate, this.minDate) || isAfter(this.valueAsDate, this.maxDate)) {
94
+ return false;
95
+ }
96
+ else {
97
+ return this.inputReference.validity.valid;
98
+ }
37
99
  }
38
100
  setErrorMessage() {
101
+ if (isBefore(this.valueAsDate, this.minDate) || isAfter(this.valueAsDate, this.maxDate)) {
102
+ return translate('dateError2', this.language);
103
+ }
39
104
  if (this.inputReference.validity.rangeUnderflow || this.inputReference.validity.rangeOverflow) {
40
105
  return translate('dateError', this.language, { values: { min: this.validation.min, max: this.validation.max } });
41
106
  }
@@ -43,14 +108,27 @@ export class DateInput {
43
108
  return translate('requiredError', this.language);
44
109
  }
45
110
  }
111
+ renderTooltip() {
112
+ if (this.showTooltip) {
113
+ return (h("div", { class: `date__tooltip ${this.showTooltip ? 'visible' : ''}`, ref: (el) => this.tooltipReference = el, innerHTML: this.tooltip }));
114
+ }
115
+ return null;
116
+ }
46
117
  render() {
47
- return h("div", { class: 'date__wrapper' },
48
- h("input", { id: `${this.name}__input`, type: 'date', class: `date__input`, value: this.defaultValue, placeholder: `${this.displayName} ${this.validation.mandatory ? '*' : ''}`, ref: (el) => this.inputReference = el, required: this.validation.mandatory, max: this.validation.max, min: this.validation.min, onInput: (e) => this.handleInput(e) }),
118
+ let invalidClass = '';
119
+ if (this.touched) {
120
+ invalidClass = this.isValid == true || this.isValid == undefined ? '' : 'text__input--invalid';
121
+ }
122
+ return h("div", { class: `date__wrapper ${this.autofilled ? 'date__wrapper--autofilled' : ''} ${this.name}__input`, ref: el => this.stylingContainer = el },
49
123
  h("label", { class: `date__label ${this.validation.mandatory ? 'date__label--required' : ''}}`, htmlFor: `${this.name}__input` },
50
124
  this.displayName,
51
125
  " ",
52
126
  this.validation.mandatory ? '*' : ''),
53
- h("small", { class: 'date__error-message' }, this.errorMessage));
127
+ h("vaadin-date-picker", { 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 }),
128
+ h("small", { class: 'date__error-message' }, this.errorMessage),
129
+ this.tooltip &&
130
+ h("img", { class: 'date__tooltip-icon', src: tooltipIcon, alt: "", ref: (el) => this.tooltipIconReference = el, onClick: () => this.showTooltip = !this.showTooltip }),
131
+ this.renderTooltip());
54
132
  }
55
133
  static get is() { return "date-input"; }
56
134
  static get encapsulation() { return "shadow"; }
@@ -76,7 +154,7 @@ export class DateInput {
76
154
  "text": "Name of the input."
77
155
  },
78
156
  "attribute": "name",
79
- "reflect": false
157
+ "reflect": true
80
158
  },
81
159
  "displayName": {
82
160
  "type": "string",
@@ -93,7 +171,24 @@ export class DateInput {
93
171
  "text": "Name of input to be shown to the user."
94
172
  },
95
173
  "attribute": "display-name",
96
- "reflect": false
174
+ "reflect": true
175
+ },
176
+ "placeholder": {
177
+ "type": "string",
178
+ "mutable": false,
179
+ "complexType": {
180
+ "original": "string",
181
+ "resolved": "string",
182
+ "references": {}
183
+ },
184
+ "required": false,
185
+ "optional": false,
186
+ "docs": {
187
+ "tags": [],
188
+ "text": "Placeholder text to be shown."
189
+ },
190
+ "attribute": "placeholder",
191
+ "reflect": true
97
192
  },
98
193
  "validation": {
99
194
  "type": "unknown",
@@ -130,9 +225,26 @@ export class DateInput {
130
225
  "text": "Default value for the input."
131
226
  },
132
227
  "attribute": "default-value",
133
- "reflect": false
228
+ "reflect": true
134
229
  },
135
- "language": {
230
+ "autofilled": {
231
+ "type": "boolean",
232
+ "mutable": false,
233
+ "complexType": {
234
+ "original": "boolean",
235
+ "resolved": "boolean",
236
+ "references": {}
237
+ },
238
+ "required": false,
239
+ "optional": false,
240
+ "docs": {
241
+ "tags": [],
242
+ "text": "Boolean. Determines if input should be readonly."
243
+ },
244
+ "attribute": "autofilled",
245
+ "reflect": true
246
+ },
247
+ "tooltip": {
136
248
  "type": "string",
137
249
  "mutable": false,
138
250
  "complexType": {
@@ -144,27 +256,27 @@ export class DateInput {
144
256
  "optional": false,
145
257
  "docs": {
146
258
  "tags": [],
147
- "text": "Currently selected language."
259
+ "text": "Tooltip text."
148
260
  },
149
- "attribute": "language",
150
- "reflect": false
261
+ "attribute": "tooltip",
262
+ "reflect": true
151
263
  },
152
- "checkValidity": {
153
- "type": "boolean",
264
+ "language": {
265
+ "type": "string",
154
266
  "mutable": false,
155
267
  "complexType": {
156
- "original": "boolean",
157
- "resolved": "boolean",
268
+ "original": "string",
269
+ "resolved": "string",
158
270
  "references": {}
159
271
  },
160
272
  "required": false,
161
273
  "optional": false,
162
274
  "docs": {
163
275
  "tags": [],
164
- "text": "State passed down from the parent element. Will trigger the input to check for validity."
276
+ "text": "Currently selected language."
165
277
  },
166
- "attribute": "check-validity",
167
- "reflect": false
278
+ "attribute": "language",
279
+ "reflect": true
168
280
  },
169
281
  "emitValue": {
170
282
  "type": "boolean",
@@ -181,12 +293,49 @@ export class DateInput {
181
293
  "text": "State passed down from the parent element. Will trigger the input to send it's value through an event."
182
294
  },
183
295
  "attribute": "emit-value",
184
- "reflect": false
296
+ "reflect": true
297
+ },
298
+ "clientStyling": {
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": "Client custom styling via inline style"
311
+ },
312
+ "attribute": "client-styling",
313
+ "reflect": true,
314
+ "defaultValue": "''"
315
+ },
316
+ "dateFormat": {
317
+ "type": "string",
318
+ "mutable": false,
319
+ "complexType": {
320
+ "original": "string",
321
+ "resolved": "string",
322
+ "references": {}
323
+ },
324
+ "required": false,
325
+ "optional": false,
326
+ "docs": {
327
+ "tags": [],
328
+ "text": "Date format for date picker."
329
+ },
330
+ "attribute": "date-format",
331
+ "reflect": true
185
332
  }
186
333
  }; }
187
334
  static get states() { return {
188
335
  "errorMessage": {},
189
- "isValid": {}
336
+ "isValid": {},
337
+ "limitStylingAppends": {},
338
+ "showTooltip": {}
190
339
  }; }
191
340
  static get events() { return [{
192
341
  "method": "sendValidityState",
@@ -229,14 +378,19 @@ export class DateInput {
229
378
  }
230
379
  }
231
380
  }]; }
381
+ static get elementRef() { return "element"; }
232
382
  static get watchers() { return [{
233
- "propName": "checkValidity",
234
- "methodName": "checkValidityHandler"
235
- }, {
236
383
  "propName": "isValid",
237
384
  "methodName": "validityChanged"
238
385
  }, {
239
386
  "propName": "emitValue",
240
387
  "methodName": "emitValueHandler"
241
388
  }]; }
389
+ static get listeners() { return [{
390
+ "name": "click",
391
+ "method": "handleClickOutside",
392
+ "target": "document",
393
+ "capture": false,
394
+ "passive": false
395
+ }]; }
242
396
  }