@vaadin/message-input 25.4.0-alpha5 → 25.4.0-alpha7
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 +44 -0
- package/package.json +11 -11
- package/src/vaadin-message-input-mixin.d.ts +8 -0
- package/src/vaadin-message-input-mixin.js +26 -4
- package/web-types.json +20 -2
- package/web-types.lit.json +9 -2
package/custom-elements.json
CHANGED
|
@@ -45,6 +45,16 @@
|
|
|
45
45
|
},
|
|
46
46
|
"privacy": "public"
|
|
47
47
|
},
|
|
48
|
+
{
|
|
49
|
+
"kind": "field",
|
|
50
|
+
"name": "submitDisabled",
|
|
51
|
+
"privacy": "public",
|
|
52
|
+
"type": {
|
|
53
|
+
"text": "boolean"
|
|
54
|
+
},
|
|
55
|
+
"description": "Set to true to prevent submitting the message. The send button is\ndisabled and pressing Enter does not submit. The user can still type\nin the text area and the current value is kept.",
|
|
56
|
+
"attribute": "submit-disabled"
|
|
57
|
+
},
|
|
48
58
|
{
|
|
49
59
|
"kind": "field",
|
|
50
60
|
"name": "value",
|
|
@@ -73,6 +83,14 @@
|
|
|
73
83
|
"description": "Set to true to disable this element.",
|
|
74
84
|
"fieldName": "disabled"
|
|
75
85
|
},
|
|
86
|
+
{
|
|
87
|
+
"name": "submit-disabled",
|
|
88
|
+
"type": {
|
|
89
|
+
"text": "boolean"
|
|
90
|
+
},
|
|
91
|
+
"description": "Set to true to prevent submitting the message. The send button is\ndisabled and pressing Enter does not submit. The user can still type\nin the text area and the current value is kept.",
|
|
92
|
+
"fieldName": "submitDisabled"
|
|
93
|
+
},
|
|
76
94
|
{
|
|
77
95
|
"name": "value",
|
|
78
96
|
"type": {
|
|
@@ -146,6 +164,20 @@
|
|
|
146
164
|
"module": "src/vaadin-message-input-mixin.js"
|
|
147
165
|
}
|
|
148
166
|
},
|
|
167
|
+
{
|
|
168
|
+
"kind": "field",
|
|
169
|
+
"name": "submitDisabled",
|
|
170
|
+
"privacy": "public",
|
|
171
|
+
"type": {
|
|
172
|
+
"text": "boolean"
|
|
173
|
+
},
|
|
174
|
+
"description": "Set to true to prevent submitting the message. The send button is\ndisabled and pressing Enter does not submit. The user can still type\nin the text area and the current value is kept.",
|
|
175
|
+
"attribute": "submit-disabled",
|
|
176
|
+
"inheritedFrom": {
|
|
177
|
+
"name": "MessageInputMixin",
|
|
178
|
+
"module": "src/vaadin-message-input-mixin.js"
|
|
179
|
+
}
|
|
180
|
+
},
|
|
149
181
|
{
|
|
150
182
|
"kind": "field",
|
|
151
183
|
"name": "value",
|
|
@@ -183,6 +215,18 @@
|
|
|
183
215
|
"module": "src/vaadin-message-input-mixin.js"
|
|
184
216
|
}
|
|
185
217
|
},
|
|
218
|
+
{
|
|
219
|
+
"name": "submit-disabled",
|
|
220
|
+
"type": {
|
|
221
|
+
"text": "boolean"
|
|
222
|
+
},
|
|
223
|
+
"description": "Set to true to prevent submitting the message. The send button is\ndisabled and pressing Enter does not submit. The user can still type\nin the text area and the current value is kept.",
|
|
224
|
+
"fieldName": "submitDisabled",
|
|
225
|
+
"inheritedFrom": {
|
|
226
|
+
"name": "MessageInputMixin",
|
|
227
|
+
"module": "src/vaadin-message-input-mixin.js"
|
|
228
|
+
}
|
|
229
|
+
},
|
|
186
230
|
{
|
|
187
231
|
"type": {
|
|
188
232
|
"text": "string"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/message-input",
|
|
3
|
-
"version": "25.4.0-
|
|
3
|
+
"version": "25.4.0-alpha7",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -35,19 +35,19 @@
|
|
|
35
35
|
],
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@open-wc/dedupe-mixin": "^1.3.0",
|
|
38
|
-
"@vaadin/a11y-base": "25.4.0-
|
|
39
|
-
"@vaadin/button": "25.4.0-
|
|
40
|
-
"@vaadin/component-base": "25.4.0-
|
|
41
|
-
"@vaadin/text-area": "25.4.0-
|
|
42
|
-
"@vaadin/vaadin-themable-mixin": "25.4.0-
|
|
38
|
+
"@vaadin/a11y-base": "25.4.0-alpha7",
|
|
39
|
+
"@vaadin/button": "25.4.0-alpha7",
|
|
40
|
+
"@vaadin/component-base": "25.4.0-alpha7",
|
|
41
|
+
"@vaadin/text-area": "25.4.0-alpha7",
|
|
42
|
+
"@vaadin/vaadin-themable-mixin": "25.4.0-alpha7",
|
|
43
43
|
"lit": "^3.0.0"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@vaadin/aura": "25.4.0-
|
|
47
|
-
"@vaadin/chai-plugins": "25.4.0-
|
|
48
|
-
"@vaadin/test-runner-commands": "25.4.0-
|
|
46
|
+
"@vaadin/aura": "25.4.0-alpha7",
|
|
47
|
+
"@vaadin/chai-plugins": "25.4.0-alpha7",
|
|
48
|
+
"@vaadin/test-runner-commands": "25.4.0-alpha7",
|
|
49
49
|
"@vaadin/testing-helpers": "^2.0.0",
|
|
50
|
-
"@vaadin/vaadin-lumo-styles": "25.4.0-
|
|
50
|
+
"@vaadin/vaadin-lumo-styles": "25.4.0-alpha7",
|
|
51
51
|
"sinon": "^22.0.0"
|
|
52
52
|
},
|
|
53
53
|
"customElements": "custom-elements.json",
|
|
@@ -55,5 +55,5 @@
|
|
|
55
55
|
"web-types.json",
|
|
56
56
|
"web-types.lit.json"
|
|
57
57
|
],
|
|
58
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "368fb0f0df09ec6f51766d9c44047c8d7620d6bd"
|
|
59
59
|
}
|
|
@@ -49,4 +49,12 @@ export declare class MessageInputMixinClass {
|
|
|
49
49
|
* Set to true to disable this element.
|
|
50
50
|
*/
|
|
51
51
|
disabled: boolean;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Set to true to prevent submitting the message. The send button is
|
|
55
|
+
* disabled and pressing Enter does not submit. The user can still type
|
|
56
|
+
* in the text area and the current value is kept.
|
|
57
|
+
* @attr {boolean} submit-disabled
|
|
58
|
+
*/
|
|
59
|
+
submitDisabled: boolean;
|
|
52
60
|
}
|
|
@@ -40,6 +40,18 @@ export const MessageInputMixin = (superClass) =>
|
|
|
40
40
|
sync: true,
|
|
41
41
|
},
|
|
42
42
|
|
|
43
|
+
/**
|
|
44
|
+
* Set to true to prevent submitting the message. The send button is
|
|
45
|
+
* disabled and pressing Enter does not submit. The user can still type
|
|
46
|
+
* in the text area and the current value is kept.
|
|
47
|
+
* @attr {boolean} submit-disabled
|
|
48
|
+
*/
|
|
49
|
+
submitDisabled: {
|
|
50
|
+
type: Boolean,
|
|
51
|
+
value: false,
|
|
52
|
+
sync: true,
|
|
53
|
+
},
|
|
54
|
+
|
|
43
55
|
/** @private */
|
|
44
56
|
_button: {
|
|
45
57
|
type: Object,
|
|
@@ -56,7 +68,7 @@ export const MessageInputMixin = (superClass) =>
|
|
|
56
68
|
|
|
57
69
|
static get observers() {
|
|
58
70
|
return [
|
|
59
|
-
'__buttonPropsChanged(_button, disabled, __effectiveI18n, value)',
|
|
71
|
+
'__buttonPropsChanged(_button, disabled, submitDisabled, __effectiveI18n, value)',
|
|
60
72
|
'__textAreaPropsChanged(_textArea, disabled, __effectiveI18n, value)',
|
|
61
73
|
];
|
|
62
74
|
}
|
|
@@ -112,6 +124,12 @@ export const MessageInputMixin = (superClass) =>
|
|
|
112
124
|
});
|
|
113
125
|
|
|
114
126
|
textarea.addEventListener('keydown', (event) => {
|
|
127
|
+
// Let the IME handle Enter that confirms a composition. Safari fires
|
|
128
|
+
// compositionend before keydown, so also check the IME key code.
|
|
129
|
+
if (event.isComposing || event.keyCode === 229) {
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
|
|
115
133
|
if (event.key === 'Enter' && !event.shiftKey) {
|
|
116
134
|
event.preventDefault();
|
|
117
135
|
event.stopImmediatePropagation();
|
|
@@ -179,9 +197,9 @@ export const MessageInputMixin = (superClass) =>
|
|
|
179
197
|
}
|
|
180
198
|
|
|
181
199
|
/** @private */
|
|
182
|
-
__buttonPropsChanged(button, disabled, effectiveI18n, value) {
|
|
200
|
+
__buttonPropsChanged(button, disabled, submitDisabled, effectiveI18n, value) {
|
|
183
201
|
if (button) {
|
|
184
|
-
button.disabled = disabled || !value;
|
|
202
|
+
button.disabled = disabled || submitDisabled || !value;
|
|
185
203
|
|
|
186
204
|
this._buttonController.setLabel(effectiveI18n.send);
|
|
187
205
|
}
|
|
@@ -203,9 +221,13 @@ export const MessageInputMixin = (superClass) =>
|
|
|
203
221
|
* Submits the current value as an custom event named 'submit'.
|
|
204
222
|
* It also clears the text input and refocuses it for sending another message.
|
|
205
223
|
* In UI, can be triggered by pressing the submit button or pressing enter key when field is focused.
|
|
206
|
-
* It does not submit anything if text is empty.
|
|
224
|
+
* It does not submit anything if text is empty or `submitDisabled` is true.
|
|
207
225
|
*/
|
|
208
226
|
__submit() {
|
|
227
|
+
if (this.submitDisabled) {
|
|
228
|
+
return;
|
|
229
|
+
}
|
|
230
|
+
|
|
209
231
|
if (this.value !== '') {
|
|
210
232
|
this.dispatchEvent(new CustomEvent('submit', { detail: { value: this.value } }));
|
|
211
233
|
this.value = '';
|
package/web-types.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/web-types",
|
|
3
3
|
"name": "@vaadin/message-input",
|
|
4
|
-
"version": "25.4.0-
|
|
4
|
+
"version": "25.4.0-alpha7",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"contributions": {
|
|
7
7
|
"html": {
|
|
8
8
|
"elements": [
|
|
9
9
|
{
|
|
10
10
|
"name": "vaadin-message-input",
|
|
11
|
-
"description": "`<vaadin-message-input>` is a Web Component for sending messages.\nIt consists of a text area that grows on along with the content, and a send button to send message.\n\nThe message can be sent by one of the following actions:\n- by pressing Enter (use Shift + Enter to add a new line)\n- by clicking `submit` button.\n\n```html\n<vaadin-message-input></vaadin-message-input>\n```\n\n### Slots\n\nThe following slots are available for adding content to the message input:\n\nName | Description\n-----------|-------------\n`header` | Content displayed above the text area and controls\n`prefix` | Content displayed before the text area\n`button` | Button that submits the message, replacing the default one\n`footer` | Content displayed below the text area and controls\n\nWhen a custom button has no text content or accessible label, `aria-label` attribute\nis set based on the [`i18n`](https://cdn.vaadin.com/vaadin-web-components/25.4.0-
|
|
11
|
+
"description": "`<vaadin-message-input>` is a Web Component for sending messages.\nIt consists of a text area that grows on along with the content, and a send button to send message.\n\nThe message can be sent by one of the following actions:\n- by pressing Enter (use Shift + Enter to add a new line)\n- by clicking `submit` button.\n\n```html\n<vaadin-message-input></vaadin-message-input>\n```\n\n### Slots\n\nThe following slots are available for adding content to the message input:\n\nName | Description\n-----------|-------------\n`header` | Content displayed above the text area and controls\n`prefix` | Content displayed before the text area\n`button` | Button that submits the message, replacing the default one\n`footer` | Content displayed below the text area and controls\n\nWhen a custom button has no text content or accessible label, `aria-label` attribute\nis set based on the [`i18n`](https://cdn.vaadin.com/vaadin-web-components/25.4.0-alpha7/#/elements/vaadin-message-input#property-i18n) property.\n\n### Styling\n\nThe following state attributes are available for styling:\n\nAttribute | Description\n---------------|---------------------------------\n`disabled` | Set when the element is disabled\n`focused` | Set when the text area is focused\n`focus-ring` | Set when the text area is focused using the keyboard\n`has-header` | Set when the element has content in the header slot\n`has-prefix` | Set when the element has content in the prefix slot\n`has-footer` | Set when the element has content in the footer slot\n`has-tooltip` | Set when the element has a slotted tooltip\n\n### Internal components\n\nIn addition to `<vaadin-message-input>` itself, the following internal\ncomponents are themable:\n\n- `<vaadin-message-input-button>` - has the same API as `<vaadin-button>`\n- `<vaadin-text-area>`\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
|
|
12
12
|
"attributes": [
|
|
13
13
|
{
|
|
14
14
|
"name": "disabled",
|
|
@@ -19,6 +19,15 @@
|
|
|
19
19
|
]
|
|
20
20
|
}
|
|
21
21
|
},
|
|
22
|
+
{
|
|
23
|
+
"name": "submit-disabled",
|
|
24
|
+
"description": "Set to true to prevent submitting the message. The send button is\ndisabled and pressing Enter does not submit. The user can still type\nin the text area and the current value is kept.",
|
|
25
|
+
"value": {
|
|
26
|
+
"type": [
|
|
27
|
+
"boolean"
|
|
28
|
+
]
|
|
29
|
+
}
|
|
30
|
+
},
|
|
22
31
|
{
|
|
23
32
|
"name": "theme",
|
|
24
33
|
"description": "The theme variants to apply to the component.",
|
|
@@ -59,6 +68,15 @@
|
|
|
59
68
|
]
|
|
60
69
|
}
|
|
61
70
|
},
|
|
71
|
+
{
|
|
72
|
+
"name": "submitDisabled",
|
|
73
|
+
"description": "Set to true to prevent submitting the message. The send button is\ndisabled and pressing Enter does not submit. The user can still type\nin the text area and the current value is kept.",
|
|
74
|
+
"value": {
|
|
75
|
+
"type": [
|
|
76
|
+
"boolean"
|
|
77
|
+
]
|
|
78
|
+
}
|
|
79
|
+
},
|
|
62
80
|
{
|
|
63
81
|
"name": "value",
|
|
64
82
|
"description": "Current content of the text input field",
|
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/message-input",
|
|
4
|
-
"version": "25.4.0-
|
|
4
|
+
"version": "25.4.0-alpha7",
|
|
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-message-input",
|
|
19
|
-
"description": "`<vaadin-message-input>` is a Web Component for sending messages.\nIt consists of a text area that grows on along with the content, and a send button to send message.\n\nThe message can be sent by one of the following actions:\n- by pressing Enter (use Shift + Enter to add a new line)\n- by clicking `submit` button.\n\n```html\n<vaadin-message-input></vaadin-message-input>\n```\n\n### Slots\n\nThe following slots are available for adding content to the message input:\n\nName | Description\n-----------|-------------\n`header` | Content displayed above the text area and controls\n`prefix` | Content displayed before the text area\n`button` | Button that submits the message, replacing the default one\n`footer` | Content displayed below the text area and controls\n\nWhen a custom button has no text content or accessible label, `aria-label` attribute\nis set based on the [`i18n`](https://cdn.vaadin.com/vaadin-web-components/25.4.0-
|
|
19
|
+
"description": "`<vaadin-message-input>` is a Web Component for sending messages.\nIt consists of a text area that grows on along with the content, and a send button to send message.\n\nThe message can be sent by one of the following actions:\n- by pressing Enter (use Shift + Enter to add a new line)\n- by clicking `submit` button.\n\n```html\n<vaadin-message-input></vaadin-message-input>\n```\n\n### Slots\n\nThe following slots are available for adding content to the message input:\n\nName | Description\n-----------|-------------\n`header` | Content displayed above the text area and controls\n`prefix` | Content displayed before the text area\n`button` | Button that submits the message, replacing the default one\n`footer` | Content displayed below the text area and controls\n\nWhen a custom button has no text content or accessible label, `aria-label` attribute\nis set based on the [`i18n`](https://cdn.vaadin.com/vaadin-web-components/25.4.0-alpha7/#/elements/vaadin-message-input#property-i18n) property.\n\n### Styling\n\nThe following state attributes are available for styling:\n\nAttribute | Description\n---------------|---------------------------------\n`disabled` | Set when the element is disabled\n`focused` | Set when the text area is focused\n`focus-ring` | Set when the text area is focused using the keyboard\n`has-header` | Set when the element has content in the header slot\n`has-prefix` | Set when the element has content in the prefix slot\n`has-footer` | Set when the element has content in the footer slot\n`has-tooltip` | Set when the element has a slotted tooltip\n\n### Internal components\n\nIn addition to `<vaadin-message-input>` itself, the following internal\ncomponents are themable:\n\n- `<vaadin-message-input-button>` - has the same API as `<vaadin-button>`\n- `<vaadin-text-area>`\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
|
|
20
20
|
"extension": true,
|
|
21
21
|
"attributes": [
|
|
22
22
|
{
|
|
@@ -33,6 +33,13 @@
|
|
|
33
33
|
"kind": "expression"
|
|
34
34
|
}
|
|
35
35
|
},
|
|
36
|
+
{
|
|
37
|
+
"name": "?submitDisabled",
|
|
38
|
+
"description": "Set to true to prevent submitting the message. The send button is\ndisabled and pressing Enter does not submit. The user can still type\nin the text area and the current value is kept.",
|
|
39
|
+
"value": {
|
|
40
|
+
"kind": "expression"
|
|
41
|
+
}
|
|
42
|
+
},
|
|
36
43
|
{
|
|
37
44
|
"name": ".value",
|
|
38
45
|
"description": "Current content of the text input field",
|