@vaadin/text-area 24.0.0-beta1 → 24.0.0-beta3
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 +12 -8
- package/src/vaadin-text-area-mixin.d.ts +62 -0
- package/src/vaadin-text-area-mixin.js +207 -0
- package/src/vaadin-text-area-styles.d.ts +8 -0
- package/src/vaadin-text-area-styles.js +73 -0
- package/src/vaadin-text-area.d.ts +2 -14
- package/src/vaadin-text-area.js +6 -247
- package/web-types.json +34 -34
- package/web-types.lit.json +12 -12
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/text-area",
|
|
3
|
-
"version": "24.0.0-
|
|
3
|
+
"version": "24.0.0-beta3",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -21,6 +21,8 @@
|
|
|
21
21
|
"type": "module",
|
|
22
22
|
"files": [
|
|
23
23
|
"src",
|
|
24
|
+
"!src/vaadin-lit-text-area.d.ts",
|
|
25
|
+
"!src/vaadin-lit-text-area.js",
|
|
24
26
|
"theme",
|
|
25
27
|
"vaadin-*.d.ts",
|
|
26
28
|
"vaadin-*.js",
|
|
@@ -34,13 +36,15 @@
|
|
|
34
36
|
"web-component"
|
|
35
37
|
],
|
|
36
38
|
"dependencies": {
|
|
39
|
+
"@open-wc/dedupe-mixin": "^1.3.0",
|
|
37
40
|
"@polymer/polymer": "^3.0.0",
|
|
38
|
-
"@vaadin/component-base": "24.0.0-
|
|
39
|
-
"@vaadin/field-base": "24.0.0-
|
|
40
|
-
"@vaadin/input-container": "24.0.0-
|
|
41
|
-
"@vaadin/vaadin-lumo-styles": "24.0.0-
|
|
42
|
-
"@vaadin/vaadin-material-styles": "24.0.0-
|
|
43
|
-
"@vaadin/vaadin-themable-mixin": "24.0.0-
|
|
41
|
+
"@vaadin/component-base": "24.0.0-beta3",
|
|
42
|
+
"@vaadin/field-base": "24.0.0-beta3",
|
|
43
|
+
"@vaadin/input-container": "24.0.0-beta3",
|
|
44
|
+
"@vaadin/vaadin-lumo-styles": "24.0.0-beta3",
|
|
45
|
+
"@vaadin/vaadin-material-styles": "24.0.0-beta3",
|
|
46
|
+
"@vaadin/vaadin-themable-mixin": "24.0.0-beta3",
|
|
47
|
+
"lit": "^2.0.0"
|
|
44
48
|
},
|
|
45
49
|
"devDependencies": {
|
|
46
50
|
"@esm-bundle/chai": "^4.3.4",
|
|
@@ -51,5 +55,5 @@
|
|
|
51
55
|
"web-types.json",
|
|
52
56
|
"web-types.lit.json"
|
|
53
57
|
],
|
|
54
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "4daeac63327393aacd9cfaa5abeb031ea86b14a5"
|
|
55
59
|
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) 2021 - 2023 Vaadin Ltd.
|
|
4
|
+
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
|
+
*/
|
|
6
|
+
import type { Constructor } from '@open-wc/dedupe-mixin';
|
|
7
|
+
import type { ControllerMixinClass } from '@vaadin/component-base/src/controller-mixin.js';
|
|
8
|
+
import type { DelegateFocusMixinClass } from '@vaadin/component-base/src/delegate-focus-mixin.js';
|
|
9
|
+
import type { DelegateStateMixinClass } from '@vaadin/component-base/src/delegate-state-mixin.js';
|
|
10
|
+
import type { DisabledMixinClass } from '@vaadin/component-base/src/disabled-mixin.js';
|
|
11
|
+
import type { FocusMixinClass } from '@vaadin/component-base/src/focus-mixin.js';
|
|
12
|
+
import type { KeyboardMixinClass } from '@vaadin/component-base/src/keyboard-mixin.js';
|
|
13
|
+
import type { ResizeMixinClass } from '@vaadin/component-base/src/resize-mixin.js';
|
|
14
|
+
import type { FieldMixinClass } from '@vaadin/field-base/src/field-mixin.js';
|
|
15
|
+
import type { InputConstraintsMixinClass } from '@vaadin/field-base/src/input-constraints-mixin.js';
|
|
16
|
+
import type { InputControlMixinClass } from '@vaadin/field-base/src/input-control-mixin.js';
|
|
17
|
+
import type { InputFieldMixinClass } from '@vaadin/field-base/src/input-field-mixin.js';
|
|
18
|
+
import type { InputMixinClass } from '@vaadin/field-base/src/input-mixin.js';
|
|
19
|
+
import type { LabelMixinClass } from '@vaadin/field-base/src/label-mixin.js';
|
|
20
|
+
import type { SlotStylesMixinClass } from '@vaadin/field-base/src/slot-styles-mixin.js';
|
|
21
|
+
import type { ValidateMixinClass } from '@vaadin/field-base/src/validate-mixin.js';
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* A mixin providing common text area functionality.
|
|
25
|
+
*/
|
|
26
|
+
export declare function TextAreaMixin<T extends Constructor<HTMLElement>>(
|
|
27
|
+
base: T,
|
|
28
|
+
): Constructor<ControllerMixinClass> &
|
|
29
|
+
Constructor<DelegateFocusMixinClass> &
|
|
30
|
+
Constructor<DelegateStateMixinClass> &
|
|
31
|
+
Constructor<DisabledMixinClass> &
|
|
32
|
+
Constructor<FieldMixinClass> &
|
|
33
|
+
Constructor<FocusMixinClass> &
|
|
34
|
+
Constructor<InputConstraintsMixinClass> &
|
|
35
|
+
Constructor<InputControlMixinClass> &
|
|
36
|
+
Constructor<InputFieldMixinClass> &
|
|
37
|
+
Constructor<InputMixinClass> &
|
|
38
|
+
Constructor<KeyboardMixinClass> &
|
|
39
|
+
Constructor<LabelMixinClass> &
|
|
40
|
+
Constructor<ResizeMixinClass> &
|
|
41
|
+
Constructor<SlotStylesMixinClass> &
|
|
42
|
+
Constructor<TextAreaMixinClass> &
|
|
43
|
+
Constructor<ValidateMixinClass> &
|
|
44
|
+
T;
|
|
45
|
+
|
|
46
|
+
export declare class TextAreaMixinClass {
|
|
47
|
+
/**
|
|
48
|
+
* Maximum number of characters (in Unicode code points) that the user can enter.
|
|
49
|
+
*/
|
|
50
|
+
maxlength: number | null | undefined;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Minimum number of characters (in Unicode code points) that the user can enter.
|
|
54
|
+
*/
|
|
55
|
+
minlength: number | null | undefined;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* A regular expression that the value is checked against.
|
|
59
|
+
* The pattern must match the entire value, not just some subset.
|
|
60
|
+
*/
|
|
61
|
+
pattern: string;
|
|
62
|
+
}
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) 2021 - 2023 Vaadin Ltd.
|
|
4
|
+
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
|
+
*/
|
|
6
|
+
import { ResizeMixin } from '@vaadin/component-base/src/resize-mixin.js';
|
|
7
|
+
import { InputFieldMixin } from '@vaadin/field-base/src/input-field-mixin.js';
|
|
8
|
+
import { LabelledInputController } from '@vaadin/field-base/src/labelled-input-controller.js';
|
|
9
|
+
import { TextAreaController } from '@vaadin/field-base/src/text-area-controller.js';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* A mixin providing common text area functionality.
|
|
13
|
+
*
|
|
14
|
+
* @polymerMixin
|
|
15
|
+
* @mixes InputFieldMixin
|
|
16
|
+
* @mixes ResizeMixin
|
|
17
|
+
*/
|
|
18
|
+
export const TextAreaMixin = (superClass) =>
|
|
19
|
+
class TextAreaMixinClass extends ResizeMixin(InputFieldMixin(superClass)) {
|
|
20
|
+
static get properties() {
|
|
21
|
+
return {
|
|
22
|
+
/**
|
|
23
|
+
* Maximum number of characters (in Unicode code points) that the user can enter.
|
|
24
|
+
*/
|
|
25
|
+
maxlength: {
|
|
26
|
+
type: Number,
|
|
27
|
+
},
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Minimum number of characters (in Unicode code points) that the user can enter.
|
|
31
|
+
*/
|
|
32
|
+
minlength: {
|
|
33
|
+
type: Number,
|
|
34
|
+
},
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* A regular expression that the value is checked against.
|
|
38
|
+
* The pattern must match the entire value, not just some subset.
|
|
39
|
+
*/
|
|
40
|
+
pattern: {
|
|
41
|
+
type: String,
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
static get delegateAttrs() {
|
|
47
|
+
return [...super.delegateAttrs, 'maxlength', 'minlength', 'pattern'];
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
static get constraints() {
|
|
51
|
+
return [...super.constraints, 'maxlength', 'minlength', 'pattern'];
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Used by `InputControlMixin` as a reference to the clear button element.
|
|
56
|
+
* @protected
|
|
57
|
+
*/
|
|
58
|
+
get clearElement() {
|
|
59
|
+
return this.$.clearButton;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* @protected
|
|
64
|
+
* @override
|
|
65
|
+
*/
|
|
66
|
+
_onResize() {
|
|
67
|
+
this.__scrollPositionUpdated();
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/** @protected */
|
|
71
|
+
_onScroll() {
|
|
72
|
+
this.__scrollPositionUpdated();
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/** @protected */
|
|
76
|
+
ready() {
|
|
77
|
+
super.ready();
|
|
78
|
+
|
|
79
|
+
this.addController(
|
|
80
|
+
new TextAreaController(this, (input) => {
|
|
81
|
+
this._setInputElement(input);
|
|
82
|
+
this._setFocusElement(input);
|
|
83
|
+
this.stateTarget = input;
|
|
84
|
+
this.ariaTarget = input;
|
|
85
|
+
}),
|
|
86
|
+
);
|
|
87
|
+
this.addController(new LabelledInputController(this.inputElement, this._labelController));
|
|
88
|
+
|
|
89
|
+
this.addEventListener('animationend', this._onAnimationEnd);
|
|
90
|
+
|
|
91
|
+
this._inputField = this.shadowRoot.querySelector('[part=input-field]');
|
|
92
|
+
|
|
93
|
+
// Wheel scrolling results in async scroll events. Preventing the wheel
|
|
94
|
+
// event, scrolling manually and then synchronously updating the scroll position CSS variable
|
|
95
|
+
// allows us to avoid some jumpy behavior that would occur on wheel otherwise.
|
|
96
|
+
this._inputField.addEventListener('wheel', (e) => {
|
|
97
|
+
const scrollTopBefore = this._inputField.scrollTop;
|
|
98
|
+
this._inputField.scrollTop += e.deltaY;
|
|
99
|
+
|
|
100
|
+
if (scrollTopBefore !== this._inputField.scrollTop) {
|
|
101
|
+
e.preventDefault();
|
|
102
|
+
this.__scrollPositionUpdated();
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
this._updateHeight();
|
|
107
|
+
this.__scrollPositionUpdated();
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/** @private */
|
|
111
|
+
__scrollPositionUpdated() {
|
|
112
|
+
this._inputField.style.setProperty('--_text-area-vertical-scroll-position', '0px');
|
|
113
|
+
this._inputField.style.setProperty('--_text-area-vertical-scroll-position', `${this._inputField.scrollTop}px`);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/** @private */
|
|
117
|
+
_onAnimationEnd(e) {
|
|
118
|
+
if (e.animationName.indexOf('vaadin-text-area-appear') === 0) {
|
|
119
|
+
this._updateHeight();
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* @param {unknown} newVal
|
|
125
|
+
* @param {unknown} oldVal
|
|
126
|
+
* @protected
|
|
127
|
+
* @override
|
|
128
|
+
*/
|
|
129
|
+
_valueChanged(newVal, oldVal) {
|
|
130
|
+
super._valueChanged(newVal, oldVal);
|
|
131
|
+
|
|
132
|
+
this._updateHeight();
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/** @private */
|
|
136
|
+
_updateHeight() {
|
|
137
|
+
const input = this.inputElement;
|
|
138
|
+
const inputField = this._inputField;
|
|
139
|
+
|
|
140
|
+
if (!input || !inputField) {
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
const scrollTop = inputField.scrollTop;
|
|
145
|
+
|
|
146
|
+
// Only clear the height when the content shortens to minimize scrollbar flickering.
|
|
147
|
+
const valueLength = this.value ? this.value.length : 0;
|
|
148
|
+
|
|
149
|
+
if (this._oldValueLength >= valueLength) {
|
|
150
|
+
const inputFieldHeight = getComputedStyle(inputField).height;
|
|
151
|
+
const inputWidth = getComputedStyle(input).width;
|
|
152
|
+
|
|
153
|
+
// Temporarily fix the height of the wrapping input field container to prevent changing the browsers scroll
|
|
154
|
+
// position while resetting the textareas height. If the textarea had a large height, then removing its height
|
|
155
|
+
// will reset its height to the default of two rows. That might reduce the height of the page, and the
|
|
156
|
+
// browser might adjust the scroll position before we can restore the measured height of the textarea.
|
|
157
|
+
inputField.style.display = 'block';
|
|
158
|
+
inputField.style.height = inputFieldHeight;
|
|
159
|
+
|
|
160
|
+
// Fix the input element width so its scroll height isn't affected by host's disappearing scrollbars
|
|
161
|
+
input.style.maxWidth = inputWidth;
|
|
162
|
+
|
|
163
|
+
// Clear the height of the textarea to allow measuring a reduced scroll height
|
|
164
|
+
input.style.height = 'auto';
|
|
165
|
+
}
|
|
166
|
+
this._oldValueLength = valueLength;
|
|
167
|
+
|
|
168
|
+
const inputHeight = input.scrollHeight;
|
|
169
|
+
if (inputHeight > input.clientHeight) {
|
|
170
|
+
input.style.height = `${inputHeight}px`;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
// Restore
|
|
174
|
+
input.style.removeProperty('max-width');
|
|
175
|
+
inputField.style.removeProperty('display');
|
|
176
|
+
inputField.style.removeProperty('height');
|
|
177
|
+
inputField.scrollTop = scrollTop;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* Returns true if the current textarea value satisfies all constraints (if any).
|
|
182
|
+
* @return {boolean}
|
|
183
|
+
* @override
|
|
184
|
+
*/
|
|
185
|
+
checkValidity() {
|
|
186
|
+
if (!super.checkValidity()) {
|
|
187
|
+
return false;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
// Native <textarea> does not support pattern attribute, so we have a custom logic
|
|
191
|
+
// according to WHATWG spec for <input>, with tests inspired by web-platform-tests
|
|
192
|
+
// https://html.spec.whatwg.org/multipage/input.html#the-pattern-attribute
|
|
193
|
+
|
|
194
|
+
if (!this.pattern || !this.inputElement.value) {
|
|
195
|
+
// Mark as valid if there is no pattern, or the value is empty
|
|
196
|
+
return true;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
try {
|
|
200
|
+
const match = this.inputElement.value.match(this.pattern);
|
|
201
|
+
return match ? match[0] === match.input : false;
|
|
202
|
+
} catch (_) {
|
|
203
|
+
// If the pattern can not be compiled, then report as valid
|
|
204
|
+
return true;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright (c) 2021 - 2023 Vaadin Ltd.
|
|
4
|
+
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
|
+
*/
|
|
6
|
+
import { css } from 'lit';
|
|
7
|
+
|
|
8
|
+
export const textAreaStyles = css`
|
|
9
|
+
:host {
|
|
10
|
+
animation: 1ms vaadin-text-area-appear;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.vaadin-text-area-container {
|
|
14
|
+
flex: auto;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/* The label, helper text and the error message should neither grow nor shrink. */
|
|
18
|
+
[part='label'],
|
|
19
|
+
[part='helper-text'],
|
|
20
|
+
[part='error-message'] {
|
|
21
|
+
flex: none;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
[part='input-field'] {
|
|
25
|
+
flex: auto;
|
|
26
|
+
overflow: auto;
|
|
27
|
+
-webkit-overflow-scrolling: touch;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
::slotted(textarea) {
|
|
31
|
+
-webkit-appearance: none;
|
|
32
|
+
-moz-appearance: none;
|
|
33
|
+
flex: auto;
|
|
34
|
+
overflow: hidden;
|
|
35
|
+
width: 100%;
|
|
36
|
+
height: 100%;
|
|
37
|
+
outline: none;
|
|
38
|
+
resize: none;
|
|
39
|
+
margin: 0;
|
|
40
|
+
padding: 0 0.25em;
|
|
41
|
+
border: 0;
|
|
42
|
+
border-radius: 0;
|
|
43
|
+
min-width: 0;
|
|
44
|
+
font: inherit;
|
|
45
|
+
font-size: 1em;
|
|
46
|
+
line-height: normal;
|
|
47
|
+
color: inherit;
|
|
48
|
+
background-color: transparent;
|
|
49
|
+
/* Disable default invalid style in Firefox */
|
|
50
|
+
box-shadow: none;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/* Override styles from <vaadin-input-container> */
|
|
54
|
+
[part='input-field'] ::slotted(textarea) {
|
|
55
|
+
align-self: stretch;
|
|
56
|
+
white-space: pre-wrap;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
[part='input-field'] ::slotted(:not(textarea)) {
|
|
60
|
+
align-self: flex-start;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/* Workaround https://bugzilla.mozilla.org/show_bug.cgi?id=1739079 */
|
|
64
|
+
:host([disabled]) ::slotted(textarea) {
|
|
65
|
+
user-select: none;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
@keyframes vaadin-text-area-appear {
|
|
69
|
+
to {
|
|
70
|
+
opacity: 1;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
`;
|
|
@@ -4,10 +4,8 @@
|
|
|
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';
|
|
7
|
-
import { ResizeMixin } from '@vaadin/component-base/src/resize-mixin.js';
|
|
8
|
-
import { InputFieldMixin } from '@vaadin/field-base/src/input-field-mixin.js';
|
|
9
|
-
import { PatternMixin } from '@vaadin/field-base/src/pattern-mixin.js';
|
|
10
7
|
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
8
|
+
import { TextAreaMixin } from './vaadin-text-area-mixin.js';
|
|
11
9
|
|
|
12
10
|
/**
|
|
13
11
|
* Fired when the user commits a value change.
|
|
@@ -85,17 +83,7 @@ export interface TextAreaEventMap extends HTMLElementEventMap, TextAreaCustomEve
|
|
|
85
83
|
* @fires {CustomEvent} value-changed - Fired when the `value` property changes.
|
|
86
84
|
* @fires {CustomEvent} validated - Fired whenever the field is validated.
|
|
87
85
|
*/
|
|
88
|
-
declare class TextArea extends
|
|
89
|
-
/**
|
|
90
|
-
* Maximum number of characters (in Unicode code points) that the user can enter.
|
|
91
|
-
*/
|
|
92
|
-
maxlength: number | null | undefined;
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* Minimum number of characters (in Unicode code points) that the user can enter.
|
|
96
|
-
*/
|
|
97
|
-
minlength: number | null | undefined;
|
|
98
|
-
|
|
86
|
+
declare class TextArea extends TextAreaMixin(ThemableMixin(ElementMixin(HTMLElement))) {
|
|
99
87
|
addEventListener<K extends keyof TextAreaEventMap>(
|
|
100
88
|
type: K,
|
|
101
89
|
listener: (this: TextArea, ev: TextAreaEventMap[K]) => void,
|
package/src/vaadin-text-area.js
CHANGED
|
@@ -6,16 +6,13 @@
|
|
|
6
6
|
import '@vaadin/input-container/src/vaadin-input-container.js';
|
|
7
7
|
import { html, PolymerElement } from '@polymer/polymer';
|
|
8
8
|
import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
|
|
9
|
-
import { ResizeMixin } from '@vaadin/component-base/src/resize-mixin.js';
|
|
10
9
|
import { TooltipController } from '@vaadin/component-base/src/tooltip-controller.js';
|
|
11
|
-
import { InputFieldMixin } from '@vaadin/field-base/src/input-field-mixin.js';
|
|
12
|
-
import { LabelledInputController } from '@vaadin/field-base/src/labelled-input-controller.js';
|
|
13
|
-
import { PatternMixin } from '@vaadin/field-base/src/pattern-mixin.js';
|
|
14
10
|
import { inputFieldShared } from '@vaadin/field-base/src/styles/input-field-shared-styles.js';
|
|
15
|
-
import { TextAreaController } from '@vaadin/field-base/src/text-area-controller.js';
|
|
16
11
|
import { registerStyles, ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
12
|
+
import { TextAreaMixin } from './vaadin-text-area-mixin.js';
|
|
13
|
+
import { textAreaStyles } from './vaadin-text-area-styles.js';
|
|
17
14
|
|
|
18
|
-
registerStyles('vaadin-text-area', inputFieldShared, { moduleId: 'vaadin-text-area-styles' });
|
|
15
|
+
registerStyles('vaadin-text-area', [inputFieldShared, textAreaStyles], { moduleId: 'vaadin-text-area-styles' });
|
|
19
16
|
|
|
20
17
|
/**
|
|
21
18
|
* `<vaadin-text-area>` is a web component for multi-line text input.
|
|
@@ -58,86 +55,17 @@ registerStyles('vaadin-text-area', inputFieldShared, { moduleId: 'vaadin-text-ar
|
|
|
58
55
|
* @fires {CustomEvent} validated - Fired whenever the field is validated.
|
|
59
56
|
*
|
|
60
57
|
* @extends HTMLElement
|
|
61
|
-
* @mixes InputFieldMixin
|
|
62
58
|
* @mixes ElementMixin
|
|
63
|
-
* @mixes
|
|
59
|
+
* @mixes TextAreaMixin
|
|
64
60
|
* @mixes ThemableMixin
|
|
65
|
-
* @mixes ResizeMixin
|
|
66
61
|
*/
|
|
67
|
-
export class TextArea extends
|
|
62
|
+
export class TextArea extends TextAreaMixin(ThemableMixin(ElementMixin(PolymerElement))) {
|
|
68
63
|
static get is() {
|
|
69
64
|
return 'vaadin-text-area';
|
|
70
65
|
}
|
|
71
66
|
|
|
72
67
|
static get template() {
|
|
73
68
|
return html`
|
|
74
|
-
<style>
|
|
75
|
-
:host {
|
|
76
|
-
animation: 1ms vaadin-text-area-appear;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
.vaadin-text-area-container {
|
|
80
|
-
flex: auto;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
/* The label, helper text and the error message should neither grow nor shrink. */
|
|
84
|
-
[part='label'],
|
|
85
|
-
[part='helper-text'],
|
|
86
|
-
[part='error-message'] {
|
|
87
|
-
flex: none;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
[part='input-field'] {
|
|
91
|
-
flex: auto;
|
|
92
|
-
overflow: auto;
|
|
93
|
-
-webkit-overflow-scrolling: touch;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
::slotted(textarea) {
|
|
97
|
-
-webkit-appearance: none;
|
|
98
|
-
-moz-appearance: none;
|
|
99
|
-
flex: auto;
|
|
100
|
-
overflow: hidden;
|
|
101
|
-
width: 100%;
|
|
102
|
-
height: 100%;
|
|
103
|
-
outline: none;
|
|
104
|
-
resize: none;
|
|
105
|
-
margin: 0;
|
|
106
|
-
padding: 0 0.25em;
|
|
107
|
-
border: 0;
|
|
108
|
-
border-radius: 0;
|
|
109
|
-
min-width: 0;
|
|
110
|
-
font: inherit;
|
|
111
|
-
font-size: 1em;
|
|
112
|
-
line-height: normal;
|
|
113
|
-
color: inherit;
|
|
114
|
-
background-color: transparent;
|
|
115
|
-
/* Disable default invalid style in Firefox */
|
|
116
|
-
box-shadow: none;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
/* Override styles from <vaadin-input-container> */
|
|
120
|
-
[part='input-field'] ::slotted(textarea) {
|
|
121
|
-
align-self: stretch;
|
|
122
|
-
white-space: pre-wrap;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
[part='input-field'] ::slotted(:not(textarea)) {
|
|
126
|
-
align-self: flex-start;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
/* Workaround https://bugzilla.mozilla.org/show_bug.cgi?id=1739079 */
|
|
130
|
-
:host([disabled]) ::slotted(textarea) {
|
|
131
|
-
user-select: none;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
@keyframes vaadin-text-area-appear {
|
|
135
|
-
to {
|
|
136
|
-
opacity: 1;
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
</style>
|
|
140
|
-
|
|
141
69
|
<div class="vaadin-text-area-container">
|
|
142
70
|
<div part="label">
|
|
143
71
|
<slot name="label"></slot>
|
|
@@ -150,7 +78,7 @@ export class TextArea extends ResizeMixin(PatternMixin(InputFieldMixin(ThemableM
|
|
|
150
78
|
disabled="[[disabled]]"
|
|
151
79
|
invalid="[[invalid]]"
|
|
152
80
|
theme$="[[_theme]]"
|
|
153
|
-
on-scroll="
|
|
81
|
+
on-scroll="_onScroll"
|
|
154
82
|
>
|
|
155
83
|
<slot name="prefix" slot="prefix"></slot>
|
|
156
84
|
<slot name="textarea"></slot>
|
|
@@ -171,182 +99,13 @@ export class TextArea extends ResizeMixin(PatternMixin(InputFieldMixin(ThemableM
|
|
|
171
99
|
`;
|
|
172
100
|
}
|
|
173
101
|
|
|
174
|
-
static get properties() {
|
|
175
|
-
return {
|
|
176
|
-
/**
|
|
177
|
-
* Maximum number of characters (in Unicode code points) that the user can enter.
|
|
178
|
-
*/
|
|
179
|
-
maxlength: {
|
|
180
|
-
type: Number,
|
|
181
|
-
},
|
|
182
|
-
|
|
183
|
-
/**
|
|
184
|
-
* Minimum number of characters (in Unicode code points) that the user can enter.
|
|
185
|
-
*/
|
|
186
|
-
minlength: {
|
|
187
|
-
type: Number,
|
|
188
|
-
},
|
|
189
|
-
};
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
static get delegateAttrs() {
|
|
193
|
-
return [...super.delegateAttrs, 'maxlength', 'minlength'];
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
static get constraints() {
|
|
197
|
-
return [...super.constraints, 'maxlength', 'minlength'];
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
/**
|
|
201
|
-
* Used by `InputControlMixin` as a reference to the clear button element.
|
|
202
|
-
* @protected
|
|
203
|
-
*/
|
|
204
|
-
get clearElement() {
|
|
205
|
-
return this.$.clearButton;
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
/**
|
|
209
|
-
* @protected
|
|
210
|
-
* @override
|
|
211
|
-
*/
|
|
212
|
-
_onResize() {
|
|
213
|
-
this.__scrollPositionUpdated();
|
|
214
|
-
}
|
|
215
|
-
|
|
216
102
|
/** @protected */
|
|
217
103
|
ready() {
|
|
218
104
|
super.ready();
|
|
219
105
|
|
|
220
|
-
this.addController(
|
|
221
|
-
new TextAreaController(this, (input) => {
|
|
222
|
-
this._setInputElement(input);
|
|
223
|
-
this._setFocusElement(input);
|
|
224
|
-
this.stateTarget = input;
|
|
225
|
-
this.ariaTarget = input;
|
|
226
|
-
}),
|
|
227
|
-
);
|
|
228
|
-
this.addController(new LabelledInputController(this.inputElement, this._labelController));
|
|
229
|
-
|
|
230
106
|
this._tooltipController = new TooltipController(this);
|
|
231
107
|
this._tooltipController.setPosition('top');
|
|
232
108
|
this.addController(this._tooltipController);
|
|
233
|
-
|
|
234
|
-
this.addEventListener('animationend', this._onAnimationEnd);
|
|
235
|
-
|
|
236
|
-
this._inputField = this.shadowRoot.querySelector('[part=input-field]');
|
|
237
|
-
|
|
238
|
-
// Wheel scrolling results in async scroll events. Preventing the wheel
|
|
239
|
-
// event, scrolling manually and then synchronously updating the scroll position CSS variable
|
|
240
|
-
// allows us to avoid some jumpy behavior that would occur on wheel otherwise.
|
|
241
|
-
this._inputField.addEventListener('wheel', (e) => {
|
|
242
|
-
const scrollTopBefore = this._inputField.scrollTop;
|
|
243
|
-
this._inputField.scrollTop += e.deltaY;
|
|
244
|
-
|
|
245
|
-
if (scrollTopBefore !== this._inputField.scrollTop) {
|
|
246
|
-
e.preventDefault();
|
|
247
|
-
this.__scrollPositionUpdated();
|
|
248
|
-
}
|
|
249
|
-
});
|
|
250
|
-
|
|
251
|
-
this._updateHeight();
|
|
252
|
-
this.__scrollPositionUpdated();
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
/** @private */
|
|
256
|
-
__scrollPositionUpdated() {
|
|
257
|
-
this._inputField.style.setProperty('--_text-area-vertical-scroll-position', '0px');
|
|
258
|
-
this._inputField.style.setProperty('--_text-area-vertical-scroll-position', `${this._inputField.scrollTop}px`);
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
/** @private */
|
|
262
|
-
_onAnimationEnd(e) {
|
|
263
|
-
if (e.animationName.indexOf('vaadin-text-area-appear') === 0) {
|
|
264
|
-
this._updateHeight();
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
/**
|
|
269
|
-
* @param {unknown} newVal
|
|
270
|
-
* @param {unknown} oldVal
|
|
271
|
-
* @protected
|
|
272
|
-
* @override
|
|
273
|
-
*/
|
|
274
|
-
_valueChanged(newVal, oldVal) {
|
|
275
|
-
super._valueChanged(newVal, oldVal);
|
|
276
|
-
|
|
277
|
-
this._updateHeight();
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
/** @private */
|
|
281
|
-
_updateHeight() {
|
|
282
|
-
const input = this.inputElement;
|
|
283
|
-
const inputField = this._inputField;
|
|
284
|
-
|
|
285
|
-
if (!input || !inputField) {
|
|
286
|
-
return;
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
const scrollTop = inputField.scrollTop;
|
|
290
|
-
|
|
291
|
-
// Only clear the height when the content shortens to minimize scrollbar flickering.
|
|
292
|
-
const valueLength = this.value ? this.value.length : 0;
|
|
293
|
-
|
|
294
|
-
if (this._oldValueLength >= valueLength) {
|
|
295
|
-
const inputFieldHeight = getComputedStyle(inputField).height;
|
|
296
|
-
const inputWidth = getComputedStyle(input).width;
|
|
297
|
-
|
|
298
|
-
// Temporarily fix the height of the wrapping input field container to prevent changing the browsers scroll
|
|
299
|
-
// position while resetting the textareas height. If the textarea had a large height, then removing its height
|
|
300
|
-
// will reset its height to the default of two rows. That might reduce the height of the page, and the
|
|
301
|
-
// browser might adjust the scroll position before we can restore the measured height of the textarea.
|
|
302
|
-
inputField.style.display = 'block';
|
|
303
|
-
inputField.style.height = inputFieldHeight;
|
|
304
|
-
|
|
305
|
-
// Fix the input element width so its scroll height isn't affected by host's disappearing scrollbars
|
|
306
|
-
input.style.maxWidth = inputWidth;
|
|
307
|
-
|
|
308
|
-
// Clear the height of the textarea to allow measuring a reduced scroll height
|
|
309
|
-
input.style.height = 'auto';
|
|
310
|
-
}
|
|
311
|
-
this._oldValueLength = valueLength;
|
|
312
|
-
|
|
313
|
-
const inputHeight = input.scrollHeight;
|
|
314
|
-
if (inputHeight > input.clientHeight) {
|
|
315
|
-
input.style.height = `${inputHeight}px`;
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
// Restore
|
|
319
|
-
input.style.removeProperty('max-width');
|
|
320
|
-
inputField.style.removeProperty('display');
|
|
321
|
-
inputField.style.removeProperty('height');
|
|
322
|
-
inputField.scrollTop = scrollTop;
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
/**
|
|
326
|
-
* Returns true if the current textarea value satisfies all constraints (if any).
|
|
327
|
-
* @return {boolean}
|
|
328
|
-
*/
|
|
329
|
-
checkValidity() {
|
|
330
|
-
if (!super.checkValidity()) {
|
|
331
|
-
return false;
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
// Native <textarea> does not support pattern attribute, so we have a custom logic
|
|
335
|
-
// according to WHATWG spec for <input>, with tests inspired by web-platform-tests
|
|
336
|
-
// https://html.spec.whatwg.org/multipage/input.html#the-pattern-attribute
|
|
337
|
-
|
|
338
|
-
if (!this.pattern || !this.inputElement.value) {
|
|
339
|
-
// Mark as valid if there is no pattern, or the value is empty
|
|
340
|
-
return true;
|
|
341
|
-
}
|
|
342
|
-
|
|
343
|
-
try {
|
|
344
|
-
const match = this.inputElement.value.match(this.pattern);
|
|
345
|
-
return match ? match[0] === match.input : false;
|
|
346
|
-
} catch (_) {
|
|
347
|
-
// If the pattern can not be compiled, then report as valid
|
|
348
|
-
return true;
|
|
349
|
-
}
|
|
350
109
|
}
|
|
351
110
|
}
|
|
352
111
|
|
package/web-types.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/web-types",
|
|
3
3
|
"name": "@vaadin/text-area",
|
|
4
|
-
"version": "24.0.0-
|
|
4
|
+
"version": "24.0.0-beta3",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"contributions": {
|
|
7
7
|
"html": {
|
|
8
8
|
"elements": [
|
|
9
9
|
{
|
|
10
10
|
"name": "vaadin-text-area",
|
|
11
|
-
"description": "`<vaadin-text-area>` is a web component for multi-line text input.\n\n```html\n<vaadin-text-area label=\"Comment\"></vaadin-text-area>\n```\n\n### Prefixes and suffixes\n\nThese are child elements of a `<vaadin-text-area>` that are displayed\ninline with the input, before or after.\nIn order for an element to be considered as a prefix, it must have the slot\nattribute set to `prefix` (and similarly for `suffix`).\n\n```html\n<vaadin-text-area label=\"Description\">\n <div slot=\"prefix\">Details:</div>\n <div slot=\"suffix\">The end!</div>\n</vaadin-text-area>\n```\n\n### Styling\n\nThe following custom properties are available for styling:\n\nCustom property | Description | Default\n-------------------------------|----------------------------|---------\n`--vaadin-field-default-width` | Default width of the field | `12em`\n\n`<vaadin-text-area>` provides the same set of shadow DOM parts and state attributes as `<vaadin-text-field>`.\nSee [`<vaadin-text-field>`](https://cdn.vaadin.com/vaadin-web-components/24.0.0-
|
|
11
|
+
"description": "`<vaadin-text-area>` is a web component for multi-line text input.\n\n```html\n<vaadin-text-area label=\"Comment\"></vaadin-text-area>\n```\n\n### Prefixes and suffixes\n\nThese are child elements of a `<vaadin-text-area>` that are displayed\ninline with the input, before or after.\nIn order for an element to be considered as a prefix, it must have the slot\nattribute set to `prefix` (and similarly for `suffix`).\n\n```html\n<vaadin-text-area label=\"Description\">\n <div slot=\"prefix\">Details:</div>\n <div slot=\"suffix\">The end!</div>\n</vaadin-text-area>\n```\n\n### Styling\n\nThe following custom properties are available for styling:\n\nCustom property | Description | Default\n-------------------------------|----------------------------|---------\n`--vaadin-field-default-width` | Default width of the field | `12em`\n\n`<vaadin-text-area>` provides the same set of shadow DOM parts and state attributes as `<vaadin-text-field>`.\nSee [`<vaadin-text-field>`](https://cdn.vaadin.com/vaadin-web-components/24.0.0-beta3/#/elements/vaadin-text-field) for the styling documentation.\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/custom-theme/styling-components) documentation.",
|
|
12
12
|
"attributes": [
|
|
13
13
|
{
|
|
14
14
|
"name": "disabled",
|
|
@@ -99,30 +99,30 @@
|
|
|
99
99
|
}
|
|
100
100
|
},
|
|
101
101
|
{
|
|
102
|
-
"name": "
|
|
103
|
-
"description": "
|
|
102
|
+
"name": "clear-button-visible",
|
|
103
|
+
"description": "Set to true to display the clear icon which clears the input.\n\nIt is up to the component to choose where to place the clear icon:\nin the Shadow DOM or in the light DOM. In any way, a reference to\nthe clear icon element should be provided via the `clearElement` getter.",
|
|
104
104
|
"value": {
|
|
105
105
|
"type": [
|
|
106
|
-
"
|
|
106
|
+
"boolean",
|
|
107
107
|
"null",
|
|
108
108
|
"undefined"
|
|
109
109
|
]
|
|
110
110
|
}
|
|
111
111
|
},
|
|
112
112
|
{
|
|
113
|
-
"name": "
|
|
114
|
-
"description": "
|
|
113
|
+
"name": "allowed-char-pattern",
|
|
114
|
+
"description": "A pattern matched against individual characters the user inputs.\n\nWhen set, the field will prevent:\n- `keydown` events if the entered key doesn't match `/^allowedCharPattern$/`\n- `paste` events if the pasted text doesn't match `/^allowedCharPattern*$/`\n- `drop` events if the dropped text doesn't match `/^allowedCharPattern*$/`\n\nFor example, to allow entering only numbers and minus signs, use:\n`allowedCharPattern = \"[\\\\d-]\"`",
|
|
115
115
|
"value": {
|
|
116
116
|
"type": [
|
|
117
|
-
"
|
|
117
|
+
"string",
|
|
118
118
|
"null",
|
|
119
119
|
"undefined"
|
|
120
120
|
]
|
|
121
121
|
}
|
|
122
122
|
},
|
|
123
123
|
{
|
|
124
|
-
"name": "
|
|
125
|
-
"description": "
|
|
124
|
+
"name": "autoselect",
|
|
125
|
+
"description": "If true, the input text gets fully selected when the field is focused using click or touch / tap.",
|
|
126
126
|
"value": {
|
|
127
127
|
"type": [
|
|
128
128
|
"boolean",
|
|
@@ -209,19 +209,19 @@
|
|
|
209
209
|
}
|
|
210
210
|
},
|
|
211
211
|
{
|
|
212
|
-
"name": "
|
|
213
|
-
"description": "
|
|
212
|
+
"name": "maxlength",
|
|
213
|
+
"description": "Maximum number of characters (in Unicode code points) that the user can enter.",
|
|
214
214
|
"value": {
|
|
215
215
|
"type": [
|
|
216
|
-
"
|
|
216
|
+
"number",
|
|
217
217
|
"null",
|
|
218
218
|
"undefined"
|
|
219
219
|
]
|
|
220
220
|
}
|
|
221
221
|
},
|
|
222
222
|
{
|
|
223
|
-
"name": "
|
|
224
|
-
"description": "
|
|
223
|
+
"name": "minlength",
|
|
224
|
+
"description": "Minimum number of characters (in Unicode code points) that the user can enter.",
|
|
225
225
|
"value": {
|
|
226
226
|
"type": [
|
|
227
227
|
"number",
|
|
@@ -231,11 +231,11 @@
|
|
|
231
231
|
}
|
|
232
232
|
},
|
|
233
233
|
{
|
|
234
|
-
"name": "
|
|
235
|
-
"description": "
|
|
234
|
+
"name": "pattern",
|
|
235
|
+
"description": "A regular expression that the value is checked against.\nThe pattern must match the entire value, not just some subset.",
|
|
236
236
|
"value": {
|
|
237
237
|
"type": [
|
|
238
|
-
"
|
|
238
|
+
"string",
|
|
239
239
|
"null",
|
|
240
240
|
"undefined"
|
|
241
241
|
]
|
|
@@ -344,30 +344,30 @@
|
|
|
344
344
|
}
|
|
345
345
|
},
|
|
346
346
|
{
|
|
347
|
-
"name": "
|
|
348
|
-
"description": "
|
|
347
|
+
"name": "clearButtonVisible",
|
|
348
|
+
"description": "Set to true to display the clear icon which clears the input.\n\nIt is up to the component to choose where to place the clear icon:\nin the Shadow DOM or in the light DOM. In any way, a reference to\nthe clear icon element should be provided via the `clearElement` getter.",
|
|
349
349
|
"value": {
|
|
350
350
|
"type": [
|
|
351
|
-
"
|
|
351
|
+
"boolean",
|
|
352
352
|
"null",
|
|
353
353
|
"undefined"
|
|
354
354
|
]
|
|
355
355
|
}
|
|
356
356
|
},
|
|
357
357
|
{
|
|
358
|
-
"name": "
|
|
359
|
-
"description": "
|
|
358
|
+
"name": "allowedCharPattern",
|
|
359
|
+
"description": "A pattern matched against individual characters the user inputs.\n\nWhen set, the field will prevent:\n- `keydown` events if the entered key doesn't match `/^allowedCharPattern$/`\n- `paste` events if the pasted text doesn't match `/^allowedCharPattern*$/`\n- `drop` events if the dropped text doesn't match `/^allowedCharPattern*$/`\n\nFor example, to allow entering only numbers and minus signs, use:\n`allowedCharPattern = \"[\\\\d-]\"`",
|
|
360
360
|
"value": {
|
|
361
361
|
"type": [
|
|
362
|
-
"
|
|
362
|
+
"string",
|
|
363
363
|
"null",
|
|
364
364
|
"undefined"
|
|
365
365
|
]
|
|
366
366
|
}
|
|
367
367
|
},
|
|
368
368
|
{
|
|
369
|
-
"name": "
|
|
370
|
-
"description": "
|
|
369
|
+
"name": "autoselect",
|
|
370
|
+
"description": "If true, the input text gets fully selected when the field is focused using click or touch / tap.",
|
|
371
371
|
"value": {
|
|
372
372
|
"type": [
|
|
373
373
|
"boolean",
|
|
@@ -454,19 +454,19 @@
|
|
|
454
454
|
}
|
|
455
455
|
},
|
|
456
456
|
{
|
|
457
|
-
"name": "
|
|
458
|
-
"description": "
|
|
457
|
+
"name": "maxlength",
|
|
458
|
+
"description": "Maximum number of characters (in Unicode code points) that the user can enter.",
|
|
459
459
|
"value": {
|
|
460
460
|
"type": [
|
|
461
|
-
"
|
|
461
|
+
"number",
|
|
462
462
|
"null",
|
|
463
463
|
"undefined"
|
|
464
464
|
]
|
|
465
465
|
}
|
|
466
466
|
},
|
|
467
467
|
{
|
|
468
|
-
"name": "
|
|
469
|
-
"description": "
|
|
468
|
+
"name": "minlength",
|
|
469
|
+
"description": "Minimum number of characters (in Unicode code points) that the user can enter.",
|
|
470
470
|
"value": {
|
|
471
471
|
"type": [
|
|
472
472
|
"number",
|
|
@@ -476,11 +476,11 @@
|
|
|
476
476
|
}
|
|
477
477
|
},
|
|
478
478
|
{
|
|
479
|
-
"name": "
|
|
480
|
-
"description": "
|
|
479
|
+
"name": "pattern",
|
|
480
|
+
"description": "A regular expression that the value is checked against.\nThe pattern must match the entire value, not just some subset.",
|
|
481
481
|
"value": {
|
|
482
482
|
"type": [
|
|
483
|
-
"
|
|
483
|
+
"string",
|
|
484
484
|
"null",
|
|
485
485
|
"undefined"
|
|
486
486
|
]
|
package/web-types.lit.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/web-types",
|
|
3
3
|
"name": "@vaadin/text-area",
|
|
4
|
-
"version": "24.0.0-
|
|
4
|
+
"version": "24.0.0-beta3",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"framework": "lit",
|
|
7
7
|
"framework-config": {
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"elements": [
|
|
17
17
|
{
|
|
18
18
|
"name": "vaadin-text-area",
|
|
19
|
-
"description": "`<vaadin-text-area>` is a web component for multi-line text input.\n\n```html\n<vaadin-text-area label=\"Comment\"></vaadin-text-area>\n```\n\n### Prefixes and suffixes\n\nThese are child elements of a `<vaadin-text-area>` that are displayed\ninline with the input, before or after.\nIn order for an element to be considered as a prefix, it must have the slot\nattribute set to `prefix` (and similarly for `suffix`).\n\n```html\n<vaadin-text-area label=\"Description\">\n <div slot=\"prefix\">Details:</div>\n <div slot=\"suffix\">The end!</div>\n</vaadin-text-area>\n```\n\n### Styling\n\nThe following custom properties are available for styling:\n\nCustom property | Description | Default\n-------------------------------|----------------------------|---------\n`--vaadin-field-default-width` | Default width of the field | `12em`\n\n`<vaadin-text-area>` provides the same set of shadow DOM parts and state attributes as `<vaadin-text-field>`.\nSee [`<vaadin-text-field>`](https://cdn.vaadin.com/vaadin-web-components/24.0.0-
|
|
19
|
+
"description": "`<vaadin-text-area>` is a web component for multi-line text input.\n\n```html\n<vaadin-text-area label=\"Comment\"></vaadin-text-area>\n```\n\n### Prefixes and suffixes\n\nThese are child elements of a `<vaadin-text-area>` that are displayed\ninline with the input, before or after.\nIn order for an element to be considered as a prefix, it must have the slot\nattribute set to `prefix` (and similarly for `suffix`).\n\n```html\n<vaadin-text-area label=\"Description\">\n <div slot=\"prefix\">Details:</div>\n <div slot=\"suffix\">The end!</div>\n</vaadin-text-area>\n```\n\n### Styling\n\nThe following custom properties are available for styling:\n\nCustom property | Description | Default\n-------------------------------|----------------------------|---------\n`--vaadin-field-default-width` | Default width of the field | `12em`\n\n`<vaadin-text-area>` provides the same set of shadow DOM parts and state attributes as `<vaadin-text-field>`.\nSee [`<vaadin-text-field>`](https://cdn.vaadin.com/vaadin-web-components/24.0.0-beta3/#/elements/vaadin-text-field) for the styling documentation.\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/custom-theme/styling-components) documentation.",
|
|
20
20
|
"extension": true,
|
|
21
21
|
"attributes": [
|
|
22
22
|
{
|
|
@@ -48,15 +48,15 @@
|
|
|
48
48
|
}
|
|
49
49
|
},
|
|
50
50
|
{
|
|
51
|
-
"name": "?
|
|
52
|
-
"description": "
|
|
51
|
+
"name": "?clearButtonVisible",
|
|
52
|
+
"description": "Set to true to display the clear icon which clears the input.\n\nIt is up to the component to choose where to place the clear icon:\nin the Shadow DOM or in the light DOM. In any way, a reference to\nthe clear icon element should be provided via the `clearElement` getter.",
|
|
53
53
|
"value": {
|
|
54
54
|
"kind": "expression"
|
|
55
55
|
}
|
|
56
56
|
},
|
|
57
57
|
{
|
|
58
|
-
"name": "?
|
|
59
|
-
"description": "
|
|
58
|
+
"name": "?autoselect",
|
|
59
|
+
"description": "If true, the input text gets fully selected when the field is focused using click or touch / tap.",
|
|
60
60
|
"value": {
|
|
61
61
|
"kind": "expression"
|
|
62
62
|
}
|
|
@@ -146,22 +146,22 @@
|
|
|
146
146
|
}
|
|
147
147
|
},
|
|
148
148
|
{
|
|
149
|
-
"name": ".
|
|
150
|
-
"description": "
|
|
149
|
+
"name": ".maxlength",
|
|
150
|
+
"description": "Maximum number of characters (in Unicode code points) that the user can enter.",
|
|
151
151
|
"value": {
|
|
152
152
|
"kind": "expression"
|
|
153
153
|
}
|
|
154
154
|
},
|
|
155
155
|
{
|
|
156
|
-
"name": ".
|
|
157
|
-
"description": "
|
|
156
|
+
"name": ".minlength",
|
|
157
|
+
"description": "Minimum number of characters (in Unicode code points) that the user can enter.",
|
|
158
158
|
"value": {
|
|
159
159
|
"kind": "expression"
|
|
160
160
|
}
|
|
161
161
|
},
|
|
162
162
|
{
|
|
163
|
-
"name": ".
|
|
164
|
-
"description": "
|
|
163
|
+
"name": ".pattern",
|
|
164
|
+
"description": "A regular expression that the value is checked against.\nThe pattern must match the entire value, not just some subset.",
|
|
165
165
|
"value": {
|
|
166
166
|
"kind": "expression"
|
|
167
167
|
}
|