@vaadin/field-base 22.0.0-alpha5 → 22.0.0-alpha9

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 (77) hide show
  1. package/index.d.ts +7 -15
  2. package/index.js +7 -15
  3. package/package.json +24 -18
  4. package/src/aria-label-controller.d.ts +11 -0
  5. package/src/aria-label-controller.js +53 -0
  6. package/src/checked-mixin.d.ts +21 -0
  7. package/src/checked-mixin.js +54 -0
  8. package/src/delegate-focus-mixin.d.ts +2 -2
  9. package/src/delegate-focus-mixin.js +150 -133
  10. package/src/delegate-state-mixin.d.ts +1 -1
  11. package/src/delegate-state-mixin.js +100 -88
  12. package/src/field-mixin.d.ts +39 -0
  13. package/src/field-mixin.js +317 -0
  14. package/src/input-constraints-mixin.d.ts +4 -2
  15. package/src/input-constraints-mixin.js +107 -64
  16. package/src/input-control-mixin.d.ts +52 -0
  17. package/src/input-control-mixin.js +170 -0
  18. package/src/input-controller.d.ts +11 -0
  19. package/src/input-controller.js +35 -0
  20. package/src/input-field-mixin.d.ts +2 -16
  21. package/src/input-field-mixin.js +125 -80
  22. package/src/input-mixin.d.ts +1 -1
  23. package/src/input-mixin.js +156 -145
  24. package/src/label-mixin.d.ts +2 -2
  25. package/src/label-mixin.js +73 -60
  26. package/src/pattern-mixin.js +9 -9
  27. package/src/shadow-focus-mixin.d.ts +21 -0
  28. package/src/shadow-focus-mixin.js +87 -0
  29. package/src/slot-controller.d.ts +8 -0
  30. package/src/slot-controller.js +36 -0
  31. package/src/slot-label-mixin.d.ts +20 -0
  32. package/src/slot-label-mixin.js +38 -0
  33. package/src/slot-styles-mixin.js +38 -31
  34. package/src/slot-target-mixin.d.ts +32 -0
  35. package/src/slot-target-mixin.js +110 -0
  36. package/src/styles/clear-button-styles.d.ts +8 -0
  37. package/src/styles/clear-button-styles.js +21 -0
  38. package/src/styles/field-shared-styles.d.ts +8 -0
  39. package/src/styles/field-shared-styles.js +29 -0
  40. package/src/styles/input-field-container-styles.d.ts +8 -0
  41. package/src/styles/input-field-container-styles.js +16 -0
  42. package/src/styles/input-field-shared-styles.d.ts +8 -0
  43. package/src/styles/input-field-shared-styles.js +10 -0
  44. package/src/text-area-controller.d.ts +11 -0
  45. package/src/text-area-controller.js +38 -0
  46. package/src/validate-mixin.d.ts +1 -9
  47. package/src/validate-mixin.js +43 -118
  48. package/src/active-mixin.d.ts +0 -26
  49. package/src/active-mixin.js +0 -106
  50. package/src/aria-label-mixin.d.ts +0 -20
  51. package/src/aria-label-mixin.js +0 -71
  52. package/src/char-length-mixin.d.ts +0 -30
  53. package/src/char-length-mixin.js +0 -42
  54. package/src/clear-button-mixin.d.ts +0 -28
  55. package/src/clear-button-mixin.js +0 -82
  56. package/src/delegate-input-state-mixin.d.ts +0 -43
  57. package/src/delegate-input-state-mixin.js +0 -63
  58. package/src/disabled-mixin.d.ts +0 -23
  59. package/src/disabled-mixin.js +0 -60
  60. package/src/field-aria-mixin.d.ts +0 -24
  61. package/src/field-aria-mixin.js +0 -61
  62. package/src/focus-mixin.d.ts +0 -33
  63. package/src/focus-mixin.js +0 -104
  64. package/src/helper-text-mixin.d.ts +0 -24
  65. package/src/helper-text-mixin.js +0 -144
  66. package/src/input-slot-mixin.d.ts +0 -26
  67. package/src/input-slot-mixin.js +0 -71
  68. package/src/keyboard-mixin.d.ts +0 -32
  69. package/src/keyboard-mixin.js +0 -51
  70. package/src/slot-mixin.d.ts +0 -23
  71. package/src/slot-mixin.js +0 -49
  72. package/src/tabindex-mixin.d.ts +0 -29
  73. package/src/tabindex-mixin.js +0 -78
  74. package/src/text-area-slot-mixin.d.ts +0 -21
  75. package/src/text-area-slot-mixin.js +0 -56
  76. package/src/text-field-mixin.d.ts +0 -21
  77. package/src/text-field-mixin.js +0 -17
@@ -3,19 +3,16 @@
3
3
  * Copyright (c) 2021 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
- import { Debouncer } from '@polymer/polymer/lib/utils/debounce.js';
7
- import { animationFrame } from '@polymer/polymer/lib/utils/async.js';
8
- import { dedupingMixin } from '@polymer/polymer/lib/utils/mixin.js';
9
- import { AriaLabelMixin } from './aria-label-mixin.js';
10
- import { ClearButtonMixin } from './clear-button-mixin.js';
11
- import { DelegateFocusMixin } from './delegate-focus-mixin.js';
12
- import { FieldAriaMixin } from './field-aria-mixin.js';
13
- import { InputConstraintsMixin } from './input-constraints-mixin.js';
14
-
15
- const InputFieldMixinImplementation = (superclass) =>
16
- class InputFieldMixinClass extends ClearButtonMixin(
17
- FieldAriaMixin(InputConstraintsMixin(AriaLabelMixin(DelegateFocusMixin(superclass))))
18
- ) {
6
+ import { InputControlMixin } from './input-control-mixin.js';
7
+
8
+ /**
9
+ * A mixin to provide logic for vaadin-text-field and related components.
10
+ *
11
+ * @polymerMixin
12
+ * @mixes InputControlMixin
13
+ */
14
+ export const InputFieldMixin = (superclass) =>
15
+ class InputFieldMixinClass extends InputControlMixin(superclass) {
19
16
  static get properties() {
20
17
  return {
21
18
  /**
@@ -52,11 +49,19 @@ const InputFieldMixinImplementation = (superclass) =>
52
49
  },
53
50
 
54
51
  /**
55
- * Specify that the value should be automatically selected when the field gains focus.
52
+ * A pattern matched against individual characters the user inputs.
53
+ * When set, the field will prevent:
54
+ * - `keyDown` events if the entered key doesn't match `/^_enabledCharPattern$/`
55
+ * - `paste` events if the pasted text doesn't match `/^_enabledCharPattern*$/`
56
+ * - `drop` events if the dropped text doesn't match `/^_enabledCharPattern*$/`
57
+ *
58
+ * For example, to enable entering only numbers and minus signs,
59
+ * `_enabledCharPattern = "[\\d-]"`
60
+ * @protected
56
61
  */
57
- autoselect: {
58
- type: Boolean,
59
- value: false
62
+ _enabledCharPattern: {
63
+ type: String,
64
+ observer: '_enabledCharPatternChanged'
60
65
  }
61
66
  };
62
67
  }
@@ -65,40 +70,31 @@ const InputFieldMixinImplementation = (superclass) =>
65
70
  return [...super.delegateAttrs, 'autocapitalize', 'autocomplete', 'autocorrect'];
66
71
  }
67
72
 
68
- static get observers() {
69
- return ['__observeOffsetHeight(errorMessage, invalid, label, helperText)'];
73
+ constructor() {
74
+ super();
75
+
76
+ this._boundOnPaste = this._onPaste.bind(this);
77
+ this._boundOnDrop = this._onDrop.bind(this);
78
+ this._boundOnBeforeInput = this._onBeforeInput.bind(this);
70
79
  }
71
80
 
72
81
  /**
73
- * Element used by `FieldAriaMixin` to set ARIA attributes.
82
+ * @param {HTMLElement} input
74
83
  * @protected
84
+ * @override
75
85
  */
76
- get _ariaTarget() {
77
- return this.inputElement;
78
- }
79
-
80
- /** @protected */
81
- ready() {
82
- super.ready();
83
-
84
- // Lumo theme defines a max-height transition for the "error-message"
85
- // part on invalid state change.
86
- const errorPart = this.shadowRoot.querySelector('[part="error-message"]');
87
- if (errorPart) {
88
- errorPart.addEventListener('transitionend', () => {
89
- this.__observeOffsetHeight();
90
- });
91
- }
86
+ _inputElementChanged(input) {
87
+ super._inputElementChanged(input);
92
88
 
93
- if (this.inputElement) {
89
+ if (input) {
94
90
  // Discard value set on the custom slotted input.
95
- if (this.inputElement.value && this.inputElement.value !== this.value) {
91
+ if (input.value && input.value !== this.value) {
96
92
  console.warn(`Please define value on the <${this.localName}> component!`);
97
- this.inputElement.value = '';
93
+ input.value = '';
98
94
  }
99
95
 
100
96
  if (this.value) {
101
- this.inputElement.value = this.value;
97
+ input.value = this.value;
102
98
  }
103
99
  }
104
100
  }
@@ -113,73 +109,122 @@ const InputFieldMixinImplementation = (superclass) =>
113
109
  }
114
110
 
115
111
  /**
116
- * Override an event listener from `DelegatesFocusMixin`.
112
+ * Override an event listener from `DelegateFocusMixin`.
117
113
  * @param {FocusEvent} event
118
114
  * @protected
119
115
  * @override
120
116
  */
121
- _onFocus(event) {
122
- super._onFocus(event);
117
+ _onBlur(event) {
118
+ super._onBlur(event);
123
119
 
124
- if (this.autoselect && this.inputElement) {
125
- this.inputElement.select();
126
- }
120
+ this.validate();
127
121
  }
128
122
 
129
123
  /**
130
- * Override an event listener from `DelegatesFocusMixin`.
131
- * @param {FocusEvent} event
124
+ * Override a method from `InputMixin` to validate the field
125
+ * when a new value is set programmatically.
126
+ * @param {string} value
132
127
  * @protected
133
128
  * @override
134
129
  */
135
- _onBlur(event) {
136
- super._onBlur(event);
130
+ _forwardInputValue(value) {
131
+ super._forwardInputValue(value);
137
132
 
138
- this.validate();
133
+ if (this.invalid) {
134
+ this.validate();
135
+ }
139
136
  }
140
137
 
141
138
  /**
142
- * Dispatch an event if a specific size measurement property has changed.
143
- * Supporting multiple properties here is needed for `vaadin-text-area`.
139
+ * Override a method from `InputMixin`.
140
+ * @param {!HTMLElement} input
144
141
  * @protected
142
+ * @override
145
143
  */
146
- _dispatchIronResizeEventIfNeeded(prop, value) {
147
- const oldSize = '__old' + prop;
148
- if (this[oldSize] !== undefined && this[oldSize] !== value) {
149
- this.dispatchEvent(new CustomEvent('iron-resize', { bubbles: true, composed: true }));
150
- }
144
+ _addInputListeners(input) {
145
+ super._addInputListeners(input);
151
146
 
152
- this[oldSize] = value;
147
+ input.addEventListener('paste', this._boundOnPaste);
148
+ input.addEventListener('drop', this._boundOnDrop);
149
+ input.addEventListener('beforeinput', this._boundOnBeforeInput);
153
150
  }
154
151
 
155
- /** @private */
156
- __observeOffsetHeight() {
157
- this.__observeOffsetHeightDebouncer = Debouncer.debounce(
158
- this.__observeOffsetHeightDebouncer,
159
- animationFrame,
160
- () => {
161
- this._dispatchIronResizeEventIfNeeded('Height', this.offsetHeight);
162
- }
163
- );
152
+ /**
153
+ * Override a method from `InputMixin`.
154
+ * @param {!HTMLElement} input
155
+ * @protected
156
+ * @override
157
+ */
158
+ _removeInputListeners(input) {
159
+ super._removeInputListeners(input);
160
+
161
+ input.removeEventListener('paste', this._boundOnPaste);
162
+ input.removeEventListener('drop', this._boundOnDrop);
163
+ input.removeEventListener('beforeinput', this._boundOnBeforeInput);
164
164
  }
165
165
 
166
166
  /**
167
- * Override a method from `InputMixin` to validate the field
168
- * when a new value is set programmatically.
169
- * @param {string} value
167
+ * Override an event listener from `ClearButtonMixin`
168
+ * to avoid adding a separate listener.
169
+ * @param {!KeyboardEvent} event
170
170
  * @protected
171
171
  * @override
172
172
  */
173
- _forwardInputValue(value) {
174
- super._forwardInputValue(value);
173
+ _onKeyDown(event) {
174
+ if (this._enabledCharPattern && !this.__shouldAcceptKey(event)) {
175
+ event.preventDefault();
176
+ }
175
177
 
176
- if (this.invalid) {
177
- this.validate();
178
+ super._onKeyDown(event);
179
+ }
180
+
181
+ /** @private */
182
+ __shouldAcceptKey(event) {
183
+ return (
184
+ event.metaKey ||
185
+ event.ctrlKey ||
186
+ !event.key || // allow typing anything if event.key is not supported
187
+ event.key.length !== 1 || // allow "Backspace", "ArrowLeft" etc.
188
+ this.__enabledCharRegExp.test(event.key)
189
+ );
190
+ }
191
+
192
+ /** @private */
193
+ _onPaste(e) {
194
+ if (this._enabledCharPattern) {
195
+ const pastedText = (e.clipboardData || window.clipboardData).getData('text');
196
+ if (!this.__enabledTextRegExp.test(pastedText)) {
197
+ e.preventDefault();
198
+ }
178
199
  }
179
200
  }
180
- };
181
201
 
182
- /**
183
- * A mixin to provide logic for vaadin-text-field and related components.
184
- */
185
- export const InputFieldMixin = dedupingMixin(InputFieldMixinImplementation);
202
+ /** @private */
203
+ _onDrop(e) {
204
+ if (this._enabledCharPattern) {
205
+ const draggedText = e.dataTransfer.getData('text');
206
+ if (!this.__enabledTextRegExp.test(draggedText)) {
207
+ e.preventDefault();
208
+ }
209
+ }
210
+ }
211
+
212
+ /** @private */
213
+ _onBeforeInput(e) {
214
+ // The `beforeinput` event covers all the cases for `_enabledCharPattern`: keyboard, pasting and dropping,
215
+ // but it is still experimental technology so we can't rely on it. It's used here just as an additional check,
216
+ // because it seems to be the only way to detect and prevent specific keys on mobile devices.
217
+ // See https://github.com/vaadin/vaadin-text-field/issues/429
218
+ if (this._enabledCharPattern && e.data && !this.__enabledTextRegExp.test(e.data)) {
219
+ e.preventDefault();
220
+ }
221
+ }
222
+
223
+ /** @private */
224
+ _enabledCharPatternChanged(charPattern) {
225
+ if (charPattern) {
226
+ this.__enabledCharRegExp = new RegExp('^' + charPattern + '$');
227
+ this.__enabledTextRegExp = new RegExp('^' + charPattern + '*$');
228
+ }
229
+ }
230
+ };
@@ -20,7 +20,7 @@ interface InputMixin {
20
20
  * Any component implementing this mixin is expected to provide it
21
21
  * by using `this._setInputElement(input)` Polymer API.
22
22
  *
23
- * A typical case is using `InputSlotMixin` that does this automatically.
23
+ * A typical case is using `InputController` that does this automatically.
24
24
  * However, the input element does not have to always be native <input>:
25
25
  * as an example, <vaadin-combo-box-light> accepts other components.
26
26
  */
@@ -5,165 +5,176 @@
5
5
  */
6
6
  import { dedupingMixin } from '@polymer/polymer/lib/utils/mixin.js';
7
7
 
8
- const InputMixinImplementation = (superclass) =>
9
- class InputMixinClass extends superclass {
10
- static get properties() {
11
- return {
12
- /**
13
- * A reference to the input element controlled by the mixin.
14
- * Any component implementing this mixin is expected to provide it
15
- * by using `this._setInputElement(input)` Polymer API.
16
- *
17
- * A typical case is using `InputSlotMixin` that does this automatically.
18
- * However, the input element does not have to always be native <input>:
19
- * as an example, <vaadin-combo-box-light> accepts other components.
20
- *
21
- * @protected
22
- * @type {!HTMLElement}
23
- */
24
- inputElement: {
25
- type: Object,
26
- readOnly: true,
27
- observer: '_inputElementChanged'
28
- },
29
-
30
- /**
31
- * The value of the field.
32
- */
33
- value: {
34
- type: String,
35
- value: '',
36
- observer: '_valueChanged',
37
- notify: true
38
- }
39
- };
40
- }
8
+ /**
9
+ * A mixin to store the reference to an input element
10
+ * and add input and change event listeners to it.
11
+ *
12
+ * @polymerMixin
13
+ */
14
+ export const InputMixin = dedupingMixin(
15
+ (superclass) =>
16
+ class InputMixinClass extends superclass {
17
+ static get properties() {
18
+ return {
19
+ /**
20
+ * A reference to the input element controlled by the mixin.
21
+ * Any component implementing this mixin is expected to provide it
22
+ * by using `this._setInputElement(input)` Polymer API.
23
+ *
24
+ * A typical case is using `InputController` that does this automatically.
25
+ * However, the input element does not have to always be native <input>:
26
+ * as an example, <vaadin-combo-box-light> accepts other components.
27
+ *
28
+ * @protected
29
+ * @type {!HTMLElement}
30
+ */
31
+ inputElement: {
32
+ type: Object,
33
+ readOnly: true,
34
+ observer: '_inputElementChanged'
35
+ },
36
+
37
+ /**
38
+ * String used to define input type.
39
+ * @protected
40
+ */
41
+ type: {
42
+ type: String,
43
+ readOnly: true
44
+ },
45
+
46
+ /**
47
+ * The value of the field.
48
+ */
49
+ value: {
50
+ type: String,
51
+ value: '',
52
+ observer: '_valueChanged',
53
+ notify: true
54
+ }
55
+ };
56
+ }
41
57
 
42
- constructor() {
43
- super();
58
+ constructor() {
59
+ super();
44
60
 
45
- this._boundOnInput = this._onInput.bind(this);
46
- this._boundOnChange = this._onChange.bind(this);
47
- }
61
+ this._boundOnInput = this._onInput.bind(this);
62
+ this._boundOnChange = this._onChange.bind(this);
63
+ }
48
64
 
49
- /**
50
- * Clear the value of the field.
51
- */
52
- clear() {
53
- this.value = '';
54
- }
65
+ /**
66
+ * Clear the value of the field.
67
+ */
68
+ clear() {
69
+ this.value = '';
70
+ }
55
71
 
56
- /**
57
- * Add event listeners to the input element instance.
58
- * Override this method to add custom listeners.
59
- * @param {!HTMLElement} input
60
- */
61
- _addInputListeners(input) {
62
- input.addEventListener('input', this._boundOnInput);
63
- input.addEventListener('change', this._boundOnChange);
64
- }
72
+ /**
73
+ * Add event listeners to the input element instance.
74
+ * Override this method to add custom listeners.
75
+ * @param {!HTMLElement} input
76
+ */
77
+ _addInputListeners(input) {
78
+ input.addEventListener('input', this._boundOnInput);
79
+ input.addEventListener('change', this._boundOnChange);
80
+ }
65
81
 
66
- /**
67
- * Remove event listeners from the input element instance.
68
- * @param {!HTMLElement} input
69
- */
70
- _removeInputListeners(input) {
71
- input.removeEventListener('input', this._boundOnInput);
72
- input.removeEventListener('change', this._boundOnChange);
73
- }
82
+ /**
83
+ * Remove event listeners from the input element instance.
84
+ * @param {!HTMLElement} input
85
+ */
86
+ _removeInputListeners(input) {
87
+ input.removeEventListener('input', this._boundOnInput);
88
+ input.removeEventListener('change', this._boundOnChange);
89
+ }
90
+
91
+ /**
92
+ * A method to forward the value property set on the field
93
+ * programmatically back to the input element value.
94
+ * Override this method to perform additional checks,
95
+ * for example to skip this in certain conditions.
96
+ * @param {string} value
97
+ * @protected
98
+ * @override
99
+ */
100
+ _forwardInputValue(value) {
101
+ // Value might be set before an input element is initialized.
102
+ // This case should be handled separately by a component that
103
+ // implements this mixin, for example in `connectedCallback`.
104
+ if (!this.inputElement) {
105
+ return;
106
+ }
74
107
 
75
- /**
76
- * A method to forward the value property set on the field
77
- * programmatically back to the input element value.
78
- * Override this method to perform additional checks,
79
- * for example to skip this in certain conditions.
80
- * @param {string} value
81
- * @protected
82
- * @override
83
- */
84
- _forwardInputValue(value) {
85
- // Value might be set before an input element is initialized.
86
- // This case should be handled separately by a component that
87
- // implements this mixin, for example in `connectedCallback`.
88
- if (!this.inputElement) {
89
- return;
108
+ if (value != undefined) {
109
+ this.inputElement.value = value;
110
+ } else {
111
+ this.inputElement.value = '';
112
+ }
90
113
  }
91
114
 
92
- if (value != undefined) {
93
- this.inputElement.value = value;
94
- } else {
95
- this.inputElement.value = '';
115
+ /** @protected */
116
+ _inputElementChanged(input, oldInput) {
117
+ if (input) {
118
+ this._addInputListeners(input);
119
+ } else if (oldInput) {
120
+ this._removeInputListeners(oldInput);
121
+ }
96
122
  }
97
- }
98
123
 
99
- /** @protected */
100
- _inputElementChanged(input, oldInput) {
101
- if (input) {
102
- this._addInputListeners(input);
103
- } else if (oldInput) {
104
- this._removeInputListeners(oldInput);
124
+ /**
125
+ * An input event listener used to update the field value.
126
+ * Override this method with an actual implementation.
127
+ * @param {Event} _event
128
+ * @protected
129
+ * @override
130
+ */
131
+ _onInput(event) {
132
+ // Ignore fake input events e.g. used by clear button.
133
+ this.__userInput = event.isTrusted;
134
+ this.value = event.target.value;
135
+ this.__userInput = false;
105
136
  }
106
- }
107
137
 
108
- /**
109
- * An input event listener used to update the field value.
110
- * Override this method with an actual implementation.
111
- * @param {Event} _event
112
- * @protected
113
- * @override
114
- */
115
- _onInput(event) {
116
- // Ignore fake input events e.g. used by clear button.
117
- this.__userInput = event.isTrusted;
118
- this.value = event.target.value;
119
- this.__userInput = false;
120
- }
138
+ /**
139
+ * A change event listener.
140
+ * Override this method with an actual implementation.
141
+ * @param {Event} _event
142
+ * @protected
143
+ * @override
144
+ */
145
+ _onChange(_event) {}
146
+
147
+ /**
148
+ * Toggle the has-value attribute based on the value property.
149
+ * @param {boolean} hasValue
150
+ * @protected
151
+ */
152
+ _toggleHasValue(hasValue) {
153
+ this.toggleAttribute('has-value', hasValue);
154
+ }
121
155
 
122
- /**
123
- * A change event listener.
124
- * Override this method with an actual implementation.
125
- * @param {Event} _event
126
- * @protected
127
- * @override
128
- */
129
- _onChange(_event) {}
130
-
131
- /**
132
- * Toggle the has-value attribute based on the value property.
133
- * @param {boolean} hasValue
134
- * @protected
135
- */
136
- _toggleHasValue(hasValue) {
137
- this.toggleAttribute('has-value', hasValue);
138
- }
156
+ /**
157
+ * Observer called when a value property changes.
158
+ * @param {string | undefined} newVal
159
+ * @param {string | undefined} oldVal
160
+ * @protected
161
+ * @override
162
+ */
163
+ _valueChanged(newVal, oldVal) {
164
+ this._toggleHasValue(newVal !== '' && newVal != null);
165
+
166
+ // Setting initial value to empty string, do nothing.
167
+ if (newVal === '' && oldVal === undefined) {
168
+ return;
169
+ }
139
170
 
140
- /**
141
- * Observer called when a value property changes.
142
- * @param {string | undefined} newVal
143
- * @param {string | undefined} oldVal
144
- * @protected
145
- * @override
146
- */
147
- _valueChanged(newVal, oldVal) {
148
- this._toggleHasValue(newVal !== '' && newVal != null);
149
-
150
- // Setting initial value to empty string, do nothing.
151
- if (newVal === '' && oldVal === undefined) {
152
- return;
153
- }
171
+ // Value is set by the user, no need to sync it back to input.
172
+ if (this.__userInput) {
173
+ return;
174
+ }
154
175
 
155
- // Value is set by the user, no need to sync it back to input.
156
- if (this.__userInput) {
157
- return;
176
+ // Setting a value programmatically, sync it to input element.
177
+ this._forwardInputValue(newVal);
158
178
  }
159
-
160
- // Setting a value programmatically, sync it to input element.
161
- this._forwardInputValue(newVal);
162
179
  }
163
- };
164
-
165
- /**
166
- * A mixin to store the reference to an input element
167
- * and add input and change event listeners to it.
168
- */
169
- export const InputMixin = dedupingMixin(InputMixinImplementation);
180
+ );
@@ -3,7 +3,7 @@
3
3
  * Copyright (c) 2021 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
- import { SlotMixin } from './slot-mixin.js';
6
+ import { SlotMixin } from '@vaadin/component-base/src/slot-mixin.js';
7
7
 
8
8
  /**
9
9
  * A mixin to provide label via corresponding property or named slot.
@@ -18,7 +18,7 @@ interface LabelMixin extends SlotMixin {
18
18
  /**
19
19
  * String used for a label element.
20
20
  */
21
- label: string;
21
+ label: string | null | undefined;
22
22
  }
23
23
 
24
24
  export { LabelMixinConstructor, LabelMixin };