@vaadin/text-area 25.2.0-alpha9 → 25.2.0-beta2
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/custom-elements.json +393 -5
- package/package.json +12 -12
- package/src/vaadin-text-area-mixin.js +9 -5
- package/src/vaadin-text-area.d.ts +39 -6
- package/src/vaadin-text-area.js +39 -9
- package/web-types.json +55 -159
- package/web-types.lit.json +47 -47
|
@@ -10,10 +10,6 @@ import { TextAreaController } from '@vaadin/field-base/src/text-area-controller.
|
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* A mixin providing common text area functionality.
|
|
13
|
-
*
|
|
14
|
-
* @polymerMixin
|
|
15
|
-
* @mixes InputFieldMixin
|
|
16
|
-
* @mixes ResizeMixin
|
|
17
13
|
*/
|
|
18
14
|
export const TextAreaMixin = (superClass) =>
|
|
19
15
|
class TextAreaMixinClass extends ResizeMixin(InputFieldMixin(superClass)) {
|
|
@@ -160,6 +156,7 @@ export const TextAreaMixin = (superClass) =>
|
|
|
160
156
|
}
|
|
161
157
|
|
|
162
158
|
const scrollTop = inputField.scrollTop;
|
|
159
|
+
const previousExplicitHeight = parseFloat(input.style.height);
|
|
163
160
|
|
|
164
161
|
// Only clear the height when the content shortens to minimize scrollbar flickering.
|
|
165
162
|
const valueLength = this.value ? this.value.length : 0;
|
|
@@ -184,7 +181,14 @@ export const TextAreaMixin = (superClass) =>
|
|
|
184
181
|
this._oldValueLength = valueLength;
|
|
185
182
|
|
|
186
183
|
const inputHeight = input.scrollHeight;
|
|
187
|
-
|
|
184
|
+
// Snap to the previous explicit height when the new measurement is
|
|
185
|
+
// within 1 CSS pixel of it. The pin/unpin cycle produces a 1 px
|
|
186
|
+
// asymmetry on low-DPR displays that would otherwise oscillate
|
|
187
|
+
// visibly on every keystroke; real content changes always move
|
|
188
|
+
// scrollHeight by at least one line.
|
|
189
|
+
if (Math.abs(inputHeight - previousExplicitHeight) <= 1) {
|
|
190
|
+
input.style.height = `${previousExplicitHeight}px`;
|
|
191
|
+
} else if (inputHeight > input.clientHeight) {
|
|
188
192
|
input.style.height = `${inputHeight}px`;
|
|
189
193
|
}
|
|
190
194
|
|
|
@@ -64,12 +64,6 @@ export interface TextAreaEventMap extends HTMLElementEventMap, TextAreaCustomEve
|
|
|
64
64
|
*
|
|
65
65
|
* ### Styling
|
|
66
66
|
*
|
|
67
|
-
* The following custom properties are available for styling:
|
|
68
|
-
*
|
|
69
|
-
* Custom property | Description | Default
|
|
70
|
-
* -------------------------------|----------------------------|---------
|
|
71
|
-
* `--vaadin-field-default-width` | Default width of the field | `12em`
|
|
72
|
-
*
|
|
73
67
|
* The following shadow DOM parts are available for styling:
|
|
74
68
|
*
|
|
75
69
|
* Part name | Description
|
|
@@ -100,6 +94,45 @@ export interface TextAreaEventMap extends HTMLElementEventMap, TextAreaCustomEve
|
|
|
100
94
|
*
|
|
101
95
|
* Note, the `input-prevented` state attribute is only supported when `allowedCharPattern` is set.
|
|
102
96
|
*
|
|
97
|
+
* The following custom CSS properties are available for styling:
|
|
98
|
+
*
|
|
99
|
+
* Custom CSS property |
|
|
100
|
+
* :--------------------------------------------------|
|
|
101
|
+
* | `--vaadin-field-default-width` |
|
|
102
|
+
* | `--vaadin-input-field-background` |
|
|
103
|
+
* | `--vaadin-input-field-border-color` |
|
|
104
|
+
* | `--vaadin-input-field-border-radius` |
|
|
105
|
+
* | `--vaadin-input-field-border-width` |
|
|
106
|
+
* | `--vaadin-input-field-bottom-end-radius` |
|
|
107
|
+
* | `--vaadin-input-field-bottom-start-radius` |
|
|
108
|
+
* | `--vaadin-input-field-button-text-color` |
|
|
109
|
+
* | `--vaadin-input-field-container-gap` |
|
|
110
|
+
* | `--vaadin-input-field-disabled-background` |
|
|
111
|
+
* | `--vaadin-input-field-disabled-text-color` |
|
|
112
|
+
* | `--vaadin-input-field-error-color` |
|
|
113
|
+
* | `--vaadin-input-field-error-font-size` |
|
|
114
|
+
* | `--vaadin-input-field-error-font-weight` |
|
|
115
|
+
* | `--vaadin-input-field-error-line-height` |
|
|
116
|
+
* | `--vaadin-input-field-gap` |
|
|
117
|
+
* | `--vaadin-input-field-helper-color` |
|
|
118
|
+
* | `--vaadin-input-field-helper-font-size` |
|
|
119
|
+
* | `--vaadin-input-field-helper-font-weight` |
|
|
120
|
+
* | `--vaadin-input-field-helper-line-height` |
|
|
121
|
+
* | `--vaadin-input-field-label-color` |
|
|
122
|
+
* | `--vaadin-input-field-label-font-size` |
|
|
123
|
+
* | `--vaadin-input-field-label-font-weight` |
|
|
124
|
+
* | `--vaadin-input-field-label-line-height` |
|
|
125
|
+
* | `--vaadin-input-field-padding` |
|
|
126
|
+
* | `--vaadin-input-field-placeholder-color` |
|
|
127
|
+
* | `--vaadin-input-field-required-indicator` |
|
|
128
|
+
* | `--vaadin-input-field-required-indicator-color` |
|
|
129
|
+
* | `--vaadin-input-field-top-end-radius` |
|
|
130
|
+
* | `--vaadin-input-field-top-start-radius` |
|
|
131
|
+
* | `--vaadin-input-field-value-color` |
|
|
132
|
+
* | `--vaadin-input-field-value-font-size` |
|
|
133
|
+
* | `--vaadin-input-field-value-font-weight` |
|
|
134
|
+
* | `--vaadin-input-field-value-line-height` |
|
|
135
|
+
*
|
|
103
136
|
* See [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.
|
|
104
137
|
*
|
|
105
138
|
* @fires {Event} input - Fired when the value is changed by the user: on every typing keystroke, and the value is cleared using the clear button.
|
package/src/vaadin-text-area.js
CHANGED
|
@@ -39,12 +39,6 @@ import { TextAreaMixin } from './vaadin-text-area-mixin.js';
|
|
|
39
39
|
*
|
|
40
40
|
* ### Styling
|
|
41
41
|
*
|
|
42
|
-
* The following custom properties are available for styling:
|
|
43
|
-
*
|
|
44
|
-
* Custom property | Description | Default
|
|
45
|
-
* -------------------------------|----------------------------|---------
|
|
46
|
-
* `--vaadin-field-default-width` | Default width of the field | `12em`
|
|
47
|
-
*
|
|
48
42
|
* The following shadow DOM parts are available for styling:
|
|
49
43
|
*
|
|
50
44
|
* Part name | Description
|
|
@@ -75,6 +69,45 @@ import { TextAreaMixin } from './vaadin-text-area-mixin.js';
|
|
|
75
69
|
*
|
|
76
70
|
* Note, the `input-prevented` state attribute is only supported when `allowedCharPattern` is set.
|
|
77
71
|
*
|
|
72
|
+
* The following custom CSS properties are available for styling:
|
|
73
|
+
*
|
|
74
|
+
* Custom CSS property |
|
|
75
|
+
* :--------------------------------------------------|
|
|
76
|
+
* | `--vaadin-field-default-width` |
|
|
77
|
+
* | `--vaadin-input-field-background` |
|
|
78
|
+
* | `--vaadin-input-field-border-color` |
|
|
79
|
+
* | `--vaadin-input-field-border-radius` |
|
|
80
|
+
* | `--vaadin-input-field-border-width` |
|
|
81
|
+
* | `--vaadin-input-field-bottom-end-radius` |
|
|
82
|
+
* | `--vaadin-input-field-bottom-start-radius` |
|
|
83
|
+
* | `--vaadin-input-field-button-text-color` |
|
|
84
|
+
* | `--vaadin-input-field-container-gap` |
|
|
85
|
+
* | `--vaadin-input-field-disabled-background` |
|
|
86
|
+
* | `--vaadin-input-field-disabled-text-color` |
|
|
87
|
+
* | `--vaadin-input-field-error-color` |
|
|
88
|
+
* | `--vaadin-input-field-error-font-size` |
|
|
89
|
+
* | `--vaadin-input-field-error-font-weight` |
|
|
90
|
+
* | `--vaadin-input-field-error-line-height` |
|
|
91
|
+
* | `--vaadin-input-field-gap` |
|
|
92
|
+
* | `--vaadin-input-field-helper-color` |
|
|
93
|
+
* | `--vaadin-input-field-helper-font-size` |
|
|
94
|
+
* | `--vaadin-input-field-helper-font-weight` |
|
|
95
|
+
* | `--vaadin-input-field-helper-line-height` |
|
|
96
|
+
* | `--vaadin-input-field-label-color` |
|
|
97
|
+
* | `--vaadin-input-field-label-font-size` |
|
|
98
|
+
* | `--vaadin-input-field-label-font-weight` |
|
|
99
|
+
* | `--vaadin-input-field-label-line-height` |
|
|
100
|
+
* | `--vaadin-input-field-padding` |
|
|
101
|
+
* | `--vaadin-input-field-placeholder-color` |
|
|
102
|
+
* | `--vaadin-input-field-required-indicator` |
|
|
103
|
+
* | `--vaadin-input-field-required-indicator-color` |
|
|
104
|
+
* | `--vaadin-input-field-top-end-radius` |
|
|
105
|
+
* | `--vaadin-input-field-top-start-radius` |
|
|
106
|
+
* | `--vaadin-input-field-value-color` |
|
|
107
|
+
* | `--vaadin-input-field-value-font-size` |
|
|
108
|
+
* | `--vaadin-input-field-value-font-weight` |
|
|
109
|
+
* | `--vaadin-input-field-value-line-height` |
|
|
110
|
+
*
|
|
78
111
|
* See [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.
|
|
79
112
|
*
|
|
80
113
|
* @fires {Event} input - Fired when the value is changed by the user: on every typing keystroke, and the value is cleared using the clear button.
|
|
@@ -85,9 +118,6 @@ import { TextAreaMixin } from './vaadin-text-area-mixin.js';
|
|
|
85
118
|
*
|
|
86
119
|
* @customElement vaadin-text-area
|
|
87
120
|
* @extends HTMLElement
|
|
88
|
-
* @mixes ElementMixin
|
|
89
|
-
* @mixes TextAreaMixin
|
|
90
|
-
* @mixes ThemableMixin
|
|
91
121
|
*/
|
|
92
122
|
export class TextArea extends TextAreaMixin(ThemableMixin(ElementMixin(PolylitMixin(LumoInjectionMixin(LitElement))))) {
|
|
93
123
|
static get is() {
|