@vaadin/message-input 25.0.0-alpha2 → 25.0.0-alpha21

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/message-input",
3
- "version": "25.0.0-alpha2",
3
+ "version": "25.0.0-alpha21",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -21,7 +21,6 @@
21
21
  "type": "module",
22
22
  "files": [
23
23
  "src",
24
- "theme",
25
24
  "vaadin-*.d.ts",
26
25
  "vaadin-*.js",
27
26
  "web-types.json",
@@ -35,22 +34,22 @@
35
34
  ],
36
35
  "dependencies": {
37
36
  "@open-wc/dedupe-mixin": "^1.3.0",
38
- "@vaadin/button": "25.0.0-alpha2",
39
- "@vaadin/component-base": "25.0.0-alpha2",
40
- "@vaadin/text-area": "25.0.0-alpha2",
41
- "@vaadin/vaadin-lumo-styles": "25.0.0-alpha2",
42
- "@vaadin/vaadin-themable-mixin": "25.0.0-alpha2",
37
+ "@vaadin/button": "25.0.0-alpha21",
38
+ "@vaadin/component-base": "25.0.0-alpha21",
39
+ "@vaadin/text-area": "25.0.0-alpha21",
40
+ "@vaadin/vaadin-themable-mixin": "25.0.0-alpha21",
43
41
  "lit": "^3.0.0"
44
42
  },
45
43
  "devDependencies": {
46
- "@vaadin/chai-plugins": "25.0.0-alpha2",
47
- "@vaadin/test-runner-commands": "25.0.0-alpha2",
44
+ "@vaadin/chai-plugins": "25.0.0-alpha21",
45
+ "@vaadin/test-runner-commands": "25.0.0-alpha21",
48
46
  "@vaadin/testing-helpers": "^2.0.0",
49
- "sinon": "^18.0.0"
47
+ "@vaadin/vaadin-lumo-styles": "25.0.0-alpha21",
48
+ "sinon": "^21.0.0"
50
49
  },
51
50
  "web-types": [
52
51
  "web-types.json",
53
52
  "web-types.lit.json"
54
53
  ],
55
- "gitHead": "67ffcd5355cf21ce1b5039c598525109fc4c164b"
54
+ "gitHead": "8fb9e9710c01449edf623a1aaac4655cdc11a933"
56
55
  }
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) 2021 - 2025 Vaadin Ltd.
4
+ * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
+ */
6
+ import type { CSSResult } from 'lit';
7
+
8
+ export const messageInputStyles: CSSResult;
@@ -0,0 +1,45 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) 2021 - 2025 Vaadin Ltd.
4
+ * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
+ */
6
+ import '@vaadin/component-base/src/styles/style-props.js';
7
+ import { css } from 'lit';
8
+
9
+ export const messageInputStyles = css`
10
+ :host {
11
+ box-sizing: border-box;
12
+ display: flex;
13
+ max-height: 50vh;
14
+ flex-shrink: 0;
15
+ border: var(--vaadin-input-field-border-width, 1px) solid
16
+ var(--vaadin-input-field-border-color, var(--vaadin-border-color));
17
+ border-radius: var(--vaadin-input-field-border-radius, var(--vaadin-radius-m));
18
+ background: var(--vaadin-input-field-background, var(--vaadin-background-color));
19
+ }
20
+
21
+ :host([hidden]) {
22
+ display: none !important;
23
+ }
24
+
25
+ :host(:focus-within) {
26
+ outline: var(--vaadin-focus-ring-width) solid var(--vaadin-focus-ring-color);
27
+ outline-offset: calc(var(--vaadin-input-field-border-width, 1px) * -1);
28
+ }
29
+
30
+ :host([disabled]) {
31
+ --vaadin-input-field-value-color: var(--vaadin-input-field-disabled-text-color, var(--vaadin-text-color-disabled));
32
+ --vaadin-input-field-background: var(
33
+ --vaadin-input-field-disabled-background,
34
+ var(--vaadin-background-container-strong)
35
+ );
36
+ --vaadin-input-field-border-color: transparent;
37
+ }
38
+
39
+ ::slotted([slot='textarea']) {
40
+ flex: 1;
41
+ --vaadin-input-field-border-width: 0 !important;
42
+ --vaadin-focus-ring-width: 0;
43
+ --vaadin-input-field-background: transparent !important;
44
+ }
45
+ `;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) 2021 - 2025 Vaadin Ltd.
4
+ * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
+ */
6
+ import type { CSSResult } from 'lit';
7
+
8
+ export const messageInputButtonStyles: CSSResult;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) 2021 - 2025 Vaadin Ltd.
4
+ * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
+ */
6
+ import '@vaadin/component-base/src/styles/style-props.js';
7
+ import { css } from 'lit';
8
+
9
+ export const messageInputButtonStyles = css`
10
+ :host {
11
+ flex: none;
12
+ align-self: end;
13
+ margin: var(--vaadin-input-field-padding, var(--vaadin-padding-container));
14
+ --vaadin-button-border-width: 0;
15
+ --vaadin-button-background: transparent;
16
+ --vaadin-button-text-color: var(--vaadin-text-color);
17
+ --vaadin-button-padding: 0;
18
+ }
19
+ `;
@@ -0,0 +1,21 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) 2021 - 2025 Vaadin Ltd.
4
+ * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
+ */
6
+ import { ButtonMixin } from '@vaadin/button/src/vaadin-button-mixin.js';
7
+ import { DirMixin } from '@vaadin/component-base/src/dir-mixin.js';
8
+ import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
9
+
10
+ /**
11
+ * An element used internally by `<vaadin-message-input>`. Not intended to be used separately.
12
+ */
13
+ declare class MessageInputButton extends ButtonMixin(DirMixin(ThemableMixin(HTMLElement))) {}
14
+
15
+ declare global {
16
+ interface HTMLElementTagNameMap {
17
+ 'vaadin-message-input-button': MessageInputButton;
18
+ }
19
+ }
20
+
21
+ export { MessageInputButton };
@@ -0,0 +1,49 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) 2021 - 2025 Vaadin Ltd.
4
+ * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
+ */
6
+ import { html, LitElement } from 'lit';
7
+ import { buttonStyles } from '@vaadin/button/src/styles/vaadin-button-base-styles.js';
8
+ import { ButtonMixin } from '@vaadin/button/src/vaadin-button-mixin.js';
9
+ import { defineCustomElement } from '@vaadin/component-base/src/define.js';
10
+ import { DirMixin } from '@vaadin/component-base/src/dir-mixin.js';
11
+ import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
12
+ import { LumoInjectionMixin } from '@vaadin/vaadin-themable-mixin/lumo-injection-mixin.js';
13
+ import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
14
+ import { messageInputButtonStyles } from './styles/vaadin-message-input-button-styles.js';
15
+
16
+ /**
17
+ * An element used internally by `<vaadin-message-input>`. Not intended to be used separately.
18
+ *
19
+ * @customElement
20
+ * @extends HTMLElement
21
+ * @mixes ButtonMixin
22
+ * @mixes DirMixin
23
+ * @mixes ThemableMixin
24
+ * @private
25
+ */
26
+ class MessageInputButton extends ButtonMixin(DirMixin(ThemableMixin(PolylitMixin(LumoInjectionMixin(LitElement))))) {
27
+ static get is() {
28
+ return 'vaadin-message-input-button';
29
+ }
30
+
31
+ static get styles() {
32
+ return [buttonStyles, messageInputButtonStyles];
33
+ }
34
+
35
+ /** @protected */
36
+ render() {
37
+ return html`
38
+ <div class="vaadin-button-container">
39
+ <span part="label">
40
+ <slot></slot>
41
+ </span>
42
+ </div>
43
+ `;
44
+ }
45
+ }
46
+
47
+ defineCustomElement(MessageInputButton);
48
+
49
+ export { MessageInputButton };
@@ -27,7 +27,7 @@ export declare class MessageInputMixinClass {
27
27
  * just the individual properties you want to change.
28
28
  *
29
29
  * The object has the following JSON structure and default values:
30
- * ```
30
+ * ```js
31
31
  * {
32
32
  * // Used as the button label
33
33
  * send: 'Send',
@@ -67,7 +67,7 @@ export const MessageInputMixin = (superClass) =>
67
67
  * just the individual properties you want to change.
68
68
  *
69
69
  * The object has the following JSON structure and default values:
70
- * ```
70
+ * ```js
71
71
  * {
72
72
  * // Used as the button label
73
73
  * send: 'Send',
@@ -90,10 +90,8 @@ export const MessageInputMixin = (superClass) =>
90
90
  ready() {
91
91
  super.ready();
92
92
 
93
- this._buttonController = new SlotController(this, 'button', 'vaadin-button', {
93
+ this._buttonController = new SlotController(this, 'button', 'vaadin-message-input-button', {
94
94
  initializer: (btn) => {
95
- btn.setAttribute('theme', 'primary');
96
-
97
95
  btn.addEventListener('click', () => {
98
96
  this.__submit();
99
97
  });
@@ -118,6 +116,7 @@ export const MessageInputMixin = (superClass) =>
118
116
  });
119
117
 
120
118
  textarea.minRows = 1;
119
+ (textarea.inputElement || textarea).setAttribute('enterkeyhint', 'send');
121
120
 
122
121
  this._textArea = textarea;
123
122
  },
@@ -128,9 +127,9 @@ export const MessageInputMixin = (superClass) =>
128
127
  this.addController(this._tooltipController);
129
128
  }
130
129
 
131
- focus() {
130
+ focus(options) {
132
131
  if (this._textArea) {
133
- this._textArea.focus();
132
+ this._textArea.focus(options);
134
133
  }
135
134
  }
136
135
 
@@ -32,6 +32,25 @@ export type MessageInputEventMap = HTMLElementEventMap & MessageInputCustomEvent
32
32
  * ```html
33
33
  * <vaadin-message-input></vaadin-message-input>
34
34
  * ```
35
+ *
36
+ * ### Styling
37
+ *
38
+ * The following state attributes are available for styling:
39
+ *
40
+ * Attribute | Description
41
+ * ---------------|---------------------------------
42
+ * `disabled` | Set when the element is disabled
43
+ * `has-tooltip` | Set when the element has a slotted tooltip
44
+ *
45
+ * ### Internal components
46
+ *
47
+ * In addition to `<vaadin-message-input>` itself, the following internal
48
+ * components are themable:
49
+ *
50
+ * - `<vaadin-message-input-button>` - has the same API as `<vaadin-button>`
51
+ * - `<vaadin-text-area>`
52
+ *
53
+ * See [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.
35
54
  */
36
55
  declare class MessageInput extends MessageInputMixin(ThemableMixin(ElementMixin(HTMLElement))) {
37
56
  addEventListener<K extends keyof MessageInputEventMap>(
@@ -3,13 +3,15 @@
3
3
  * Copyright (c) 2021 - 2025 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
- import '@vaadin/button/src/vaadin-button.js';
7
6
  import '@vaadin/text-area/src/vaadin-text-area.js';
8
- import { css, html, LitElement } from 'lit';
7
+ import './vaadin-message-input-button.js';
8
+ import { html, LitElement } from 'lit';
9
9
  import { defineCustomElement } from '@vaadin/component-base/src/define.js';
10
10
  import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
11
11
  import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
12
+ import { LumoInjectionMixin } from '@vaadin/vaadin-themable-mixin/lumo-injection-mixin.js';
12
13
  import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
14
+ import { messageInputStyles } from './styles/vaadin-message-input-base-styles.js';
13
15
  import { MessageInputMixin } from './vaadin-message-input-mixin.js';
14
16
 
15
17
  /**
@@ -24,41 +26,40 @@ import { MessageInputMixin } from './vaadin-message-input-mixin.js';
24
26
  * <vaadin-message-input></vaadin-message-input>
25
27
  * ```
26
28
  *
29
+ * ### Styling
30
+ *
31
+ * The following state attributes are available for styling:
32
+ *
33
+ * Attribute | Description
34
+ * ---------------|---------------------------------
35
+ * `disabled` | Set when the element is disabled
36
+ * `has-tooltip` | Set when the element has a slotted tooltip
37
+ *
38
+ * ### Internal components
39
+ *
40
+ * In addition to `<vaadin-message-input>` itself, the following internal
41
+ * components are themable:
42
+ *
43
+ * - `<vaadin-message-input-button>` - has the same API as `<vaadin-button>`
44
+ * - `<vaadin-text-area>`
45
+ *
46
+ * See [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.
47
+ *
27
48
  * @customElement
28
49
  * @extends HTMLElement
29
50
  * @mixes MessageInputMixin
30
51
  * @mixes ThemableMixin
31
52
  * @mixes ElementMixin
32
53
  */
33
- class MessageInput extends MessageInputMixin(ElementMixin(ThemableMixin(PolylitMixin(LitElement)))) {
54
+ class MessageInput extends MessageInputMixin(
55
+ ElementMixin(ThemableMixin(PolylitMixin(LumoInjectionMixin(LitElement)))),
56
+ ) {
34
57
  static get is() {
35
58
  return 'vaadin-message-input';
36
59
  }
37
60
 
38
61
  static get styles() {
39
- return css`
40
- :host {
41
- align-items: flex-start;
42
- box-sizing: border-box;
43
- display: flex;
44
- max-height: 50vh;
45
- overflow: hidden;
46
- flex-shrink: 0;
47
- }
48
-
49
- :host([hidden]) {
50
- display: none !important;
51
- }
52
-
53
- ::slotted([slot='button']) {
54
- flex-shrink: 0;
55
- }
56
-
57
- ::slotted([slot='textarea']) {
58
- align-self: stretch;
59
- flex-grow: 1;
60
- }
61
- `;
62
+ return messageInputStyles;
62
63
  }
63
64
 
64
65
  /** @protected */
@@ -1,2 +1,2 @@
1
- import './theme/lumo/vaadin-message-input.js';
1
+ import './src/vaadin-message-input.js';
2
2
  export * from './src/vaadin-message-input.js';
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.0.0-alpha2",
4
+ "version": "25.0.0-alpha21",
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```",
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### Styling\n\nThe following state attributes are available for styling:\n\nAttribute | Description\n---------------|---------------------------------\n`disabled` | Set when the element is disabled\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": "i18n",
@@ -55,7 +55,7 @@
55
55
  "properties": [
56
56
  {
57
57
  "name": "i18n",
58
- "description": "The object used to localize this component. To change the default\nlocalization, replace this with an object that provides all properties, or\njust the individual properties you want to change.\n\nThe object has the following JSON structure and default values:\n```\n{\n // Used as the button label\n send: 'Send',\n\n // Used as the input field's placeholder and aria-label\n message: 'Message'\n}\n```",
58
+ "description": "The object used to localize this component. To change the default\nlocalization, replace this with an object that provides all properties, or\njust the individual properties you want to change.\n\nThe object has the following JSON structure and default values:\n```js\n{\n // Used as the button label\n send: 'Send',\n\n // Used as the input field's placeholder and aria-label\n message: 'Message'\n}\n```",
59
59
  "value": {
60
60
  "type": [
61
61
  "MessageInputI18n"
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "@vaadin/message-input",
4
- "version": "25.0.0-alpha2",
4
+ "version": "25.0.0-alpha21",
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```",
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### Styling\n\nThe following state attributes are available for styling:\n\nAttribute | Description\n---------------|---------------------------------\n`disabled` | Set when the element is disabled\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
  {
@@ -28,7 +28,7 @@
28
28
  },
29
29
  {
30
30
  "name": ".i18n",
31
- "description": "The object used to localize this component. To change the default\nlocalization, replace this with an object that provides all properties, or\njust the individual properties you want to change.\n\nThe object has the following JSON structure and default values:\n```\n{\n // Used as the button label\n send: 'Send',\n\n // Used as the input field's placeholder and aria-label\n message: 'Message'\n}\n```",
31
+ "description": "The object used to localize this component. To change the default\nlocalization, replace this with an object that provides all properties, or\njust the individual properties you want to change.\n\nThe object has the following JSON structure and default values:\n```js\n{\n // Used as the button label\n send: 'Send',\n\n // Used as the input field's placeholder and aria-label\n message: 'Message'\n}\n```",
32
32
  "value": {
33
33
  "kind": "expression"
34
34
  }
@@ -1,4 +0,0 @@
1
- import '@vaadin/vaadin-lumo-styles/color.js';
2
- import '@vaadin/vaadin-lumo-styles/sizing.js';
3
- import '@vaadin/vaadin-lumo-styles/spacing.js';
4
- import '@vaadin/vaadin-lumo-styles/style.js';
@@ -1,19 +0,0 @@
1
- import '@vaadin/vaadin-lumo-styles/color.js';
2
- import '@vaadin/vaadin-lumo-styles/sizing.js';
3
- import '@vaadin/vaadin-lumo-styles/spacing.js';
4
- import '@vaadin/vaadin-lumo-styles/style.js';
5
- import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
6
-
7
- registerStyles(
8
- 'vaadin-message-input',
9
- css`
10
- :host {
11
- padding: var(--lumo-space-s) var(--lumo-space-m);
12
- }
13
-
14
- ::slotted([slot='textarea']) {
15
- margin-inline-end: var(--lumo-space-s);
16
- }
17
- `,
18
- { moduleId: 'lumo-message-input' },
19
- );
@@ -1,4 +0,0 @@
1
- import '@vaadin/button/theme/lumo/vaadin-button.js';
2
- import '@vaadin/text-area/theme/lumo/vaadin-text-area.js';
3
- import './vaadin-message-input-styles.js';
4
- import '../../src/vaadin-message-input.js';
@@ -1,4 +0,0 @@
1
- import '@vaadin/button/theme/lumo/vaadin-button.js';
2
- import '@vaadin/text-area/theme/lumo/vaadin-text-area.js';
3
- import './vaadin-message-input-styles.js';
4
- import '../../src/vaadin-message-input.js';