@vaadin/text-area 22.0.1 → 22.0.5

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vaadin/text-area",
3
- "version": "22.0.1",
3
+ "version": "22.0.5",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -32,17 +32,17 @@
32
32
  ],
33
33
  "dependencies": {
34
34
  "@polymer/polymer": "^3.0.0",
35
- "@vaadin/component-base": "^22.0.1",
36
- "@vaadin/field-base": "^22.0.1",
37
- "@vaadin/input-container": "^22.0.1",
38
- "@vaadin/vaadin-lumo-styles": "^22.0.1",
39
- "@vaadin/vaadin-material-styles": "^22.0.1",
40
- "@vaadin/vaadin-themable-mixin": "^22.0.1"
35
+ "@vaadin/component-base": "^22.0.5",
36
+ "@vaadin/field-base": "^22.0.5",
37
+ "@vaadin/input-container": "^22.0.5",
38
+ "@vaadin/vaadin-lumo-styles": "^22.0.5",
39
+ "@vaadin/vaadin-material-styles": "^22.0.5",
40
+ "@vaadin/vaadin-themable-mixin": "^22.0.5"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@esm-bundle/chai": "^4.3.4",
44
44
  "@vaadin/testing-helpers": "^0.3.2",
45
45
  "sinon": "^9.2.1"
46
46
  },
47
- "gitHead": "2b0a2bff0369d6020f7cc33ad35506aa2d1f6f68"
47
+ "gitHead": "3e1990867670f3de2dec6fa1200d945623b2710c"
48
48
  }
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 Vaadin Ltd.
3
+ * Copyright (c) 2021 - 2022 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 Vaadin Ltd.
3
+ * Copyright (c) 2021 - 2022 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import '@vaadin/input-container/src/vaadin-input-container.js';
@@ -138,11 +138,12 @@ export class TextArea extends InputFieldMixin(ThemableMixin(ElementMixin(Polymer
138
138
  disabled="[[disabled]]"
139
139
  invalid="[[invalid]]"
140
140
  theme$="[[theme]]"
141
+ on-scroll="__scrollPositionUpdated"
141
142
  >
142
143
  <slot name="prefix" slot="prefix"></slot>
143
144
  <slot name="textarea"></slot>
144
145
  <slot name="suffix" slot="suffix"></slot>
145
- <div id="clearButton" part="clear-button" slot="suffix"></div>
146
+ <div id="clearButton" part="clear-button" slot="suffix" aria-hidden="true"></div>
146
147
  </vaadin-input-container>
147
148
 
148
149
  <div part="helper-text">
@@ -195,7 +196,18 @@ export class TextArea extends InputFieldMixin(ThemableMixin(ElementMixin(Polymer
195
196
  super.connectedCallback();
196
197
 
197
198
  this._inputField = this.shadowRoot.querySelector('[part=input-field]');
199
+
200
+ // Wheel scrolling results in async scroll events. Preventing the wheel
201
+ // event, scrolling manually and then synchronously updating the scroll position CSS variable
202
+ // allows us to avoid some jumpy behavior that would occur on wheel otherwise.
203
+ this._inputField.addEventListener('wheel', (e) => {
204
+ e.preventDefault();
205
+ this._inputField.scrollTop += e.deltaY;
206
+ this.__scrollPositionUpdated();
207
+ });
208
+
198
209
  this._updateHeight();
210
+ this.__scrollPositionUpdated();
199
211
  }
200
212
 
201
213
  /** @protected */
@@ -210,10 +222,16 @@ export class TextArea extends InputFieldMixin(ThemableMixin(ElementMixin(Polymer
210
222
  this.ariaTarget = input;
211
223
  })
212
224
  );
213
- this.addController(new LabelledInputController(this.inputElement, this._labelNode));
225
+ this.addController(new LabelledInputController(this.inputElement, this._labelController));
214
226
  this.addEventListener('animationend', this._onAnimationEnd);
215
227
  }
216
228
 
229
+ /** @private */
230
+ __scrollPositionUpdated() {
231
+ this._inputField.style.setProperty('--_text-area-vertical-scroll-position', '0px');
232
+ this._inputField.style.setProperty('--_text-area-vertical-scroll-position', this._inputField.scrollTop + 'px');
233
+ }
234
+
217
235
  /** @private */
218
236
  _onAnimationEnd(e) {
219
237
  if (e.animationName.indexOf('vaadin-text-area-appear') === 0) {
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 Vaadin Ltd.
3
+ * Copyright (c) 2017 - 2022 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import '@vaadin/vaadin-lumo-styles/color.js';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 Vaadin Ltd.
3
+ * Copyright (c) 2017 - 2022 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import '@vaadin/input-container/theme/lumo/vaadin-input-container.js';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 Vaadin Ltd.
3
+ * Copyright (c) 2017 - 2022 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import { inputFieldShared } from '@vaadin/vaadin-material-styles/mixins/input-field-shared.js';
@@ -21,6 +21,11 @@ const textArea = css`
21
21
  white-space: pre-wrap; /* override "nowrap" from <vaadin-text-field> */
22
22
  align-self: stretch; /* override "baseline" from <vaadin-text-field> */
23
23
  }
24
+
25
+ [part='input-field']::before,
26
+ [part='input-field']::after {
27
+ bottom: calc(var(--_text-area-vertical-scroll-position) * -1);
28
+ }
24
29
  `;
25
30
 
26
31
  registerStyles('vaadin-text-area', [inputFieldShared, textArea], { moduleId: 'material-text-area' });
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 Vaadin Ltd.
3
+ * Copyright (c) 2017 - 2022 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import '@vaadin/input-container/theme/material/vaadin-input-container.js';