@vaadin/message-list 23.2.0-dev.8a7678b70 → 23.2.1
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/README.md +5 -5
- package/package.json +14 -8
- package/src/vaadin-message-list.d.ts +1 -1
- package/src/vaadin-message-list.js +9 -2
- package/src/vaadin-message.d.ts +5 -1
- package/src/vaadin-message.js +5 -1
- package/web-types.json +177 -0
- package/web-types.lit.json +76 -0
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
A web component that allows you to show a list of messages, for example, a chat log.
|
|
4
4
|
|
|
5
|
-
[Documentation + Live Demo ↗](https://vaadin.com/docs/latest/
|
|
5
|
+
[Documentation + Live Demo ↗](https://vaadin.com/docs/latest/components/message-list)
|
|
6
6
|
|
|
7
7
|
```html
|
|
8
8
|
<vaadin-message-list></vaadin-message-list>
|
|
@@ -11,12 +11,12 @@ A web component that allows you to show a list of messages, for example, a chat
|
|
|
11
11
|
{ userName: 'Alice', time: '8 Minutes ago', text: 'Lunch at the usual place?' },
|
|
12
12
|
{ userName: 'Bob', time: '6 Minutes ago', text: `Yeah, let's go together.` },
|
|
13
13
|
{ userName: 'Alice', time: '2 Minutes ago', text: 'Great! What about you, Charlie?' },
|
|
14
|
-
{ userName: 'Charlie', time: 'A few seconds ago', text: 'I will meet you there.' }
|
|
14
|
+
{ userName: 'Charlie', time: 'A few seconds ago', text: 'I will meet you there.' },
|
|
15
15
|
];
|
|
16
16
|
</script>
|
|
17
17
|
```
|
|
18
18
|
|
|
19
|
-
[<img src="https://raw.githubusercontent.com/vaadin/web-components/master/packages/message-list/screenshot.png" width="504" alt="Screenshot of vaadin-message-list">](https://vaadin.com/docs/latest/
|
|
19
|
+
[<img src="https://raw.githubusercontent.com/vaadin/web-components/master/packages/message-list/screenshot.png" width="504" alt="Screenshot of vaadin-message-list">](https://vaadin.com/docs/latest/components/message-list)
|
|
20
20
|
|
|
21
21
|
## Installation
|
|
22
22
|
|
|
@@ -34,7 +34,7 @@ import '@vaadin/message-list';
|
|
|
34
34
|
|
|
35
35
|
## Themes
|
|
36
36
|
|
|
37
|
-
Vaadin components come with two built-in [themes](https://vaadin.com/docs/latest/
|
|
37
|
+
Vaadin components come with two built-in [themes](https://vaadin.com/docs/latest/styling), Lumo and Material.
|
|
38
38
|
The [main entrypoint](https://github.com/vaadin/web-components/blob/master/packages/message-list/vaadin-message-list.js) of the package uses the Lumo theme.
|
|
39
39
|
|
|
40
40
|
To use the Material theme, import the component from the `theme/material` folder:
|
|
@@ -57,7 +57,7 @@ import '@vaadin/message-list/src/vaadin-message-list.js';
|
|
|
57
57
|
|
|
58
58
|
## Contributing
|
|
59
59
|
|
|
60
|
-
Read the [contributing guide](https://vaadin.com/docs/latest/
|
|
60
|
+
Read the [contributing guide](https://vaadin.com/docs/latest/contributing/overview) to learn about our development process, how to propose bugfixes and improvements, and how to test your changes to Vaadin components.
|
|
61
61
|
|
|
62
62
|
## License
|
|
63
63
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/message-list",
|
|
3
|
-
"version": "23.2.
|
|
3
|
+
"version": "23.2.1",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -23,7 +23,9 @@
|
|
|
23
23
|
"src",
|
|
24
24
|
"theme",
|
|
25
25
|
"vaadin-*.d.ts",
|
|
26
|
-
"vaadin-*.js"
|
|
26
|
+
"vaadin-*.js",
|
|
27
|
+
"web-types.json",
|
|
28
|
+
"web-types.lit.json"
|
|
27
29
|
],
|
|
28
30
|
"keywords": [
|
|
29
31
|
"Vaadin",
|
|
@@ -36,16 +38,20 @@
|
|
|
36
38
|
],
|
|
37
39
|
"dependencies": {
|
|
38
40
|
"@polymer/polymer": "^3.0.0",
|
|
39
|
-
"@vaadin/avatar": "23.2.
|
|
40
|
-
"@vaadin/component-base": "23.2.
|
|
41
|
-
"@vaadin/vaadin-lumo-styles": "23.2.
|
|
42
|
-
"@vaadin/vaadin-material-styles": "23.2.
|
|
43
|
-
"@vaadin/vaadin-themable-mixin": "23.2.
|
|
41
|
+
"@vaadin/avatar": "~23.2.1",
|
|
42
|
+
"@vaadin/component-base": "~23.2.1",
|
|
43
|
+
"@vaadin/vaadin-lumo-styles": "~23.2.1",
|
|
44
|
+
"@vaadin/vaadin-material-styles": "~23.2.1",
|
|
45
|
+
"@vaadin/vaadin-themable-mixin": "~23.2.1"
|
|
44
46
|
},
|
|
45
47
|
"devDependencies": {
|
|
46
48
|
"@esm-bundle/chai": "^4.3.4",
|
|
47
49
|
"@vaadin/testing-helpers": "^0.3.2",
|
|
48
50
|
"sinon": "^13.0.2"
|
|
49
51
|
},
|
|
50
|
-
"
|
|
52
|
+
"web-types": [
|
|
53
|
+
"web-types.json",
|
|
54
|
+
"web-types.lit.json"
|
|
55
|
+
],
|
|
56
|
+
"gitHead": "a6c314f6927bfd3309fc735eae6c6dc72ab8367a"
|
|
51
57
|
}
|
|
@@ -41,7 +41,7 @@ export interface MessageListItem {
|
|
|
41
41
|
* ----------|----------------
|
|
42
42
|
* `list` | The container wrapping messages.
|
|
43
43
|
*
|
|
44
|
-
* See [Styling Components](https://vaadin.com/docs/latest/
|
|
44
|
+
* See [Styling Components](https://vaadin.com/docs/latest/styling/custom-theme/styling-components) documentation.
|
|
45
45
|
*/
|
|
46
46
|
declare class MessageList extends ThemableMixin(ElementMixin(HTMLElement)) {
|
|
47
47
|
/**
|
|
@@ -35,7 +35,7 @@ import { Message } from './vaadin-message.js';
|
|
|
35
35
|
* ----------|----------------
|
|
36
36
|
* `list` | The container wrapping messages.
|
|
37
37
|
*
|
|
38
|
-
* See [Styling Components](https://vaadin.com/docs/latest/
|
|
38
|
+
* See [Styling Components](https://vaadin.com/docs/latest/styling/custom-theme/styling-components) documentation.
|
|
39
39
|
*
|
|
40
40
|
* @extends HTMLElement
|
|
41
41
|
* @mixes ThemableMixin
|
|
@@ -118,6 +118,7 @@ class MessageList extends ElementMixin(ThemableMixin(PolymerElement)) {
|
|
|
118
118
|
return Array.from(this.shadowRoot.querySelectorAll('vaadin-message'));
|
|
119
119
|
}
|
|
120
120
|
|
|
121
|
+
/** @private */
|
|
121
122
|
_itemsChanged(newVal, oldVal) {
|
|
122
123
|
const focusedIndex = this._getIndexOfFocusableElement();
|
|
123
124
|
if (newVal && newVal.length) {
|
|
@@ -132,6 +133,7 @@ class MessageList extends ElementMixin(ThemableMixin(PolymerElement)) {
|
|
|
132
133
|
}
|
|
133
134
|
}
|
|
134
135
|
|
|
136
|
+
/** @private */
|
|
135
137
|
_scrollToLastMessage() {
|
|
136
138
|
if (this.items.length > 0) {
|
|
137
139
|
this.scrollTop = this.scrollHeight - this.clientHeight;
|
|
@@ -186,6 +188,7 @@ class MessageList extends ElementMixin(ThemableMixin(PolymerElement)) {
|
|
|
186
188
|
target.focus();
|
|
187
189
|
}
|
|
188
190
|
|
|
191
|
+
/** @private */
|
|
189
192
|
_handleFocusEvent(e) {
|
|
190
193
|
const target = e.composedPath().find((node) => node instanceof Message);
|
|
191
194
|
this._setTabIndexesByMessage(target);
|
|
@@ -200,10 +203,14 @@ class MessageList extends ElementMixin(ThemableMixin(PolymerElement)) {
|
|
|
200
203
|
this._setTabIndexesByMessage(message);
|
|
201
204
|
}
|
|
202
205
|
|
|
206
|
+
/** @private */
|
|
203
207
|
_setTabIndexesByMessage(message) {
|
|
204
|
-
this._messages.forEach((e) =>
|
|
208
|
+
this._messages.forEach((e) => {
|
|
209
|
+
e.tabIndex = e === message ? 0 : -1;
|
|
210
|
+
});
|
|
205
211
|
}
|
|
206
212
|
|
|
213
|
+
/** @private */
|
|
207
214
|
_getIndexOfFocusableElement() {
|
|
208
215
|
const index = this._messages.findIndex((e) => e.tabIndex === 0);
|
|
209
216
|
return index !== -1 ? index : 0;
|
package/src/vaadin-message.d.ts
CHANGED
|
@@ -35,7 +35,7 @@ import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mix
|
|
|
35
35
|
* `focus-ring` | Set when the message is focused using the keyboard.
|
|
36
36
|
* `focused` | Set when the message is focused.
|
|
37
37
|
*
|
|
38
|
-
* See [Styling Components](https://vaadin.com/docs/latest/
|
|
38
|
+
* See [Styling Components](https://vaadin.com/docs/latest/styling/custom-theme/styling-components) documentation.
|
|
39
39
|
*
|
|
40
40
|
* ### Internal components
|
|
41
41
|
*
|
|
@@ -56,6 +56,7 @@ declare class Message extends FocusMixin(ThemableMixin(ElementMixin(HTMLElement)
|
|
|
56
56
|
* It will be placed in the name part to indicate who has sent the message.
|
|
57
57
|
* It is also used as a tooltip for the avatar.
|
|
58
58
|
* Example: `message.userName = "Jessica Jacobs";`
|
|
59
|
+
* @attr {string} user-name
|
|
59
60
|
*/
|
|
60
61
|
userName: string | null | undefined;
|
|
61
62
|
|
|
@@ -64,6 +65,7 @@ declare class Message extends FocusMixin(ThemableMixin(ElementMixin(HTMLElement)
|
|
|
64
65
|
* The abbreviation will be passed on to avatar of the message.
|
|
65
66
|
* If the user does not have an avatar picture set with `userImg`, `userAbbr` will be shown in the avatar.
|
|
66
67
|
* Example: `message.userAbbr = "JJ";`
|
|
68
|
+
* @attr {string} user-abbr
|
|
67
69
|
*/
|
|
68
70
|
userAbbr: string | null | undefined;
|
|
69
71
|
|
|
@@ -71,6 +73,7 @@ declare class Message extends FocusMixin(ThemableMixin(ElementMixin(HTMLElement)
|
|
|
71
73
|
* An URL for a user image.
|
|
72
74
|
* The image will be used in the avatar component to show who has sent the message.
|
|
73
75
|
* Example: `message.userImg = "/static/img/avatar.jpg";`
|
|
76
|
+
* @attr {string} user-img
|
|
74
77
|
*/
|
|
75
78
|
userImg: string | null | undefined;
|
|
76
79
|
|
|
@@ -92,6 +95,7 @@ declare class Message extends FocusMixin(ThemableMixin(ElementMixin(HTMLElement)
|
|
|
92
95
|
* ```js
|
|
93
96
|
* message.userColorIndex = 1;
|
|
94
97
|
* ```
|
|
98
|
+
* @attr {number} user-color-index
|
|
95
99
|
*/
|
|
96
100
|
userColorIndex: number | null | undefined;
|
|
97
101
|
}
|
package/src/vaadin-message.js
CHANGED
|
@@ -37,7 +37,7 @@ import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mix
|
|
|
37
37
|
* `focus-ring` | Set when the message is focused using the keyboard.
|
|
38
38
|
* `focused` | Set when the message is focused.
|
|
39
39
|
*
|
|
40
|
-
* See [Styling Components](https://vaadin.com/docs/latest/
|
|
40
|
+
* See [Styling Components](https://vaadin.com/docs/latest/styling/custom-theme/styling-components) documentation.
|
|
41
41
|
*
|
|
42
42
|
* ### Internal components
|
|
43
43
|
*
|
|
@@ -67,6 +67,7 @@ class Message extends FocusMixin(ElementMixin(ThemableMixin(PolymerElement))) {
|
|
|
67
67
|
* It will be placed in the name part to indicate who has sent the message.
|
|
68
68
|
* It is also used as a tooltip for the avatar.
|
|
69
69
|
* Example: `message.userName = "Jessica Jacobs";`
|
|
70
|
+
* @attr {string} user-name
|
|
70
71
|
*/
|
|
71
72
|
userName: {
|
|
72
73
|
type: String,
|
|
@@ -77,6 +78,7 @@ class Message extends FocusMixin(ElementMixin(ThemableMixin(PolymerElement))) {
|
|
|
77
78
|
* The abbreviation will be passed on to avatar of the message.
|
|
78
79
|
* If the user does not have an avatar picture set with `userImg`, `userAbbr` will be shown in the avatar.
|
|
79
80
|
* Example: `message.userAbbr = "JJ";`
|
|
81
|
+
* @attr {string} user-abbr
|
|
80
82
|
*/
|
|
81
83
|
userAbbr: {
|
|
82
84
|
type: String,
|
|
@@ -86,6 +88,7 @@ class Message extends FocusMixin(ElementMixin(ThemableMixin(PolymerElement))) {
|
|
|
86
88
|
* An URL for a user image.
|
|
87
89
|
* The image will be used in the avatar component to show who has sent the message.
|
|
88
90
|
* Example: `message.userImg = "/static/img/avatar.jpg";`
|
|
91
|
+
* @attr {string} user-img
|
|
89
92
|
*/
|
|
90
93
|
userImg: {
|
|
91
94
|
type: String,
|
|
@@ -109,6 +112,7 @@ class Message extends FocusMixin(ElementMixin(ThemableMixin(PolymerElement))) {
|
|
|
109
112
|
* ```js
|
|
110
113
|
* message.userColorIndex = 1;
|
|
111
114
|
* ```
|
|
115
|
+
* @attr {number} user-color-index
|
|
112
116
|
*/
|
|
113
117
|
userColorIndex: {
|
|
114
118
|
type: Number,
|
package/web-types.json
ADDED
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json.schemastore.org/web-types",
|
|
3
|
+
"name": "@vaadin/message-list",
|
|
4
|
+
"version": "23.2.1",
|
|
5
|
+
"description-markup": "markdown",
|
|
6
|
+
"contributions": {
|
|
7
|
+
"html": {
|
|
8
|
+
"elements": [
|
|
9
|
+
{
|
|
10
|
+
"name": "vaadin-message",
|
|
11
|
+
"description": "`<vaadin-message>` is a Web Component for showing a single message with an author, message and time.\n\n```html\n<vaadin-message time=\"2021-01-28 10:43\"\n user-name = \"Bob Ross\"\n user-abbr = \"BR\"\n user-img = \"/static/img/avatar.jpg\">There is no real ending. It's just the place where you stop the story.</vaadin-message>\n```\n\n### Styling\n\nThe following shadow DOM parts are available for styling:\n\nPart name | Description\n----------|----------------\n`avatar` | The author's avatar\n`name` | Author's name\n`time` | When the message was posted\n`content` | The message itself as a slotted content\n\nThe following state attributes are available for styling:\n\nAttribute | Description\n-------------|-------------\n`focus-ring` | Set when the message is focused using the keyboard.\n`focused` | Set when the message is focused.\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/custom-theme/styling-components) documentation.\n\n### Internal components\n\nIn addition to `<vaadin-message>` itself, the following internal\ncomponents are themable:\n\n- `<vaadin-message-avatar>` - has the same API as [`<vaadin-avatar>`](https://cdn.vaadin.com/vaadin-web-components/23.2.1/#/elements/vaadin-avatar).",
|
|
12
|
+
"attributes": [
|
|
13
|
+
{
|
|
14
|
+
"name": "time",
|
|
15
|
+
"description": "Time of sending the message. It is rendered as-is to the part='time' slot,\nso the formatting is up to you.",
|
|
16
|
+
"value": {
|
|
17
|
+
"type": [
|
|
18
|
+
"string",
|
|
19
|
+
"null",
|
|
20
|
+
"undefined"
|
|
21
|
+
]
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"name": "user-name",
|
|
26
|
+
"description": "The name of the user posting the message.\nIt will be placed in the name part to indicate who has sent the message.\nIt is also used as a tooltip for the avatar.\nExample: `message.userName = \"Jessica Jacobs\";`",
|
|
27
|
+
"value": {
|
|
28
|
+
"type": [
|
|
29
|
+
"string",
|
|
30
|
+
"null",
|
|
31
|
+
"undefined"
|
|
32
|
+
]
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"name": "user-abbr",
|
|
37
|
+
"description": "The abbreviation of the user.\nThe abbreviation will be passed on to avatar of the message.\nIf the user does not have an avatar picture set with `userImg`, `userAbbr` will be shown in the avatar.\nExample: `message.userAbbr = \"JJ\";`",
|
|
38
|
+
"value": {
|
|
39
|
+
"type": [
|
|
40
|
+
"string",
|
|
41
|
+
"null",
|
|
42
|
+
"undefined"
|
|
43
|
+
]
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"name": "user-img",
|
|
48
|
+
"description": "An URL for a user image.\nThe image will be used in the avatar component to show who has sent the message.\nExample: `message.userImg = \"/static/img/avatar.jpg\";`",
|
|
49
|
+
"value": {
|
|
50
|
+
"type": [
|
|
51
|
+
"string",
|
|
52
|
+
"null",
|
|
53
|
+
"undefined"
|
|
54
|
+
]
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"name": "user-color-index",
|
|
59
|
+
"description": "A color index to be used to render the color of the avatar.\nWith no `userColorIndex` set, the basic avatar color will be used.\nBy setting a userColorIndex, the component will check if there exists a CSS variable defining the color, and uses it if there is one.\nIf now CSS variable is found for the color index, the property for the color will not be set.\n\nExample:\nCSS:\n```css\nhtml {\n --vaadin-user-color-1: red;\n}\n```\n\nJavaScript:\n```js\nmessage.userColorIndex = 1;\n```",
|
|
60
|
+
"value": {
|
|
61
|
+
"type": [
|
|
62
|
+
"number",
|
|
63
|
+
"null",
|
|
64
|
+
"undefined"
|
|
65
|
+
]
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
"name": "theme",
|
|
70
|
+
"description": "The theme variants to apply to the component.",
|
|
71
|
+
"value": {
|
|
72
|
+
"type": [
|
|
73
|
+
"string",
|
|
74
|
+
"null",
|
|
75
|
+
"undefined"
|
|
76
|
+
]
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
],
|
|
80
|
+
"js": {
|
|
81
|
+
"properties": [
|
|
82
|
+
{
|
|
83
|
+
"name": "time",
|
|
84
|
+
"description": "Time of sending the message. It is rendered as-is to the part='time' slot,\nso the formatting is up to you.",
|
|
85
|
+
"value": {
|
|
86
|
+
"type": [
|
|
87
|
+
"string",
|
|
88
|
+
"null",
|
|
89
|
+
"undefined"
|
|
90
|
+
]
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
"name": "userName",
|
|
95
|
+
"description": "The name of the user posting the message.\nIt will be placed in the name part to indicate who has sent the message.\nIt is also used as a tooltip for the avatar.\nExample: `message.userName = \"Jessica Jacobs\";`",
|
|
96
|
+
"value": {
|
|
97
|
+
"type": [
|
|
98
|
+
"string",
|
|
99
|
+
"null",
|
|
100
|
+
"undefined"
|
|
101
|
+
]
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
"name": "userAbbr",
|
|
106
|
+
"description": "The abbreviation of the user.\nThe abbreviation will be passed on to avatar of the message.\nIf the user does not have an avatar picture set with `userImg`, `userAbbr` will be shown in the avatar.\nExample: `message.userAbbr = \"JJ\";`",
|
|
107
|
+
"value": {
|
|
108
|
+
"type": [
|
|
109
|
+
"string",
|
|
110
|
+
"null",
|
|
111
|
+
"undefined"
|
|
112
|
+
]
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
"name": "userImg",
|
|
117
|
+
"description": "An URL for a user image.\nThe image will be used in the avatar component to show who has sent the message.\nExample: `message.userImg = \"/static/img/avatar.jpg\";`",
|
|
118
|
+
"value": {
|
|
119
|
+
"type": [
|
|
120
|
+
"string",
|
|
121
|
+
"null",
|
|
122
|
+
"undefined"
|
|
123
|
+
]
|
|
124
|
+
}
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
"name": "userColorIndex",
|
|
128
|
+
"description": "A color index to be used to render the color of the avatar.\nWith no `userColorIndex` set, the basic avatar color will be used.\nBy setting a userColorIndex, the component will check if there exists a CSS variable defining the color, and uses it if there is one.\nIf now CSS variable is found for the color index, the property for the color will not be set.\n\nExample:\nCSS:\n```css\nhtml {\n --vaadin-user-color-1: red;\n}\n```\n\nJavaScript:\n```js\nmessage.userColorIndex = 1;\n```",
|
|
129
|
+
"value": {
|
|
130
|
+
"type": [
|
|
131
|
+
"number",
|
|
132
|
+
"null",
|
|
133
|
+
"undefined"
|
|
134
|
+
]
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
],
|
|
138
|
+
"events": []
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
"name": "vaadin-message-list",
|
|
143
|
+
"description": "`<vaadin-message-list>` is a Web Component for showing an ordered list of messages. The messages are rendered as <vaadin-message>\n\n### Example\nTo create a new message list, add the component to the page:\n```html\n<vaadin-message-list></vaadin-message-list>\n```\n\nProvide the messages to the message list with the `items` property.\n```js\ndocument.querySelector('vaadin-message-list').items = [\n { text: 'Hello list', time: 'yesterday', userName: 'Matt Mambo', userAbbr: 'MM', userColorIndex: 1 },\n { text: 'Another message', time: 'right now', userName: 'Linsey Listy', userAbbr: 'LL', userColorIndex: 2, userImg: '/static/img/avatar.jpg' }\n];\n```\n\n### Styling\n\nThe following shadow DOM parts are available for styling:\n\nPart name | Description\n----------|----------------\n`list` | The container wrapping messages.\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/custom-theme/styling-components) documentation.",
|
|
144
|
+
"attributes": [
|
|
145
|
+
{
|
|
146
|
+
"name": "theme",
|
|
147
|
+
"description": "The theme variants to apply to the component.",
|
|
148
|
+
"value": {
|
|
149
|
+
"type": [
|
|
150
|
+
"string",
|
|
151
|
+
"null",
|
|
152
|
+
"undefined"
|
|
153
|
+
]
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
],
|
|
157
|
+
"js": {
|
|
158
|
+
"properties": [
|
|
159
|
+
{
|
|
160
|
+
"name": "items",
|
|
161
|
+
"description": "An array of objects which will be rendered as messages.\nThe message objects can have the following properties:\n```js\nArray<{\n text: string,\n time: string,\n userName: string,\n userAbbr: string,\n userImg: string,\n userColorIndex: number,\n theme: string\n}>\n```",
|
|
162
|
+
"value": {
|
|
163
|
+
"type": [
|
|
164
|
+
"Array",
|
|
165
|
+
"null",
|
|
166
|
+
"undefined"
|
|
167
|
+
]
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
],
|
|
171
|
+
"events": []
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
]
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json.schemastore.org/web-types",
|
|
3
|
+
"name": "@vaadin/message-list",
|
|
4
|
+
"version": "23.2.1",
|
|
5
|
+
"description-markup": "markdown",
|
|
6
|
+
"framework": "lit",
|
|
7
|
+
"framework-config": {
|
|
8
|
+
"enable-when": {
|
|
9
|
+
"node-packages": [
|
|
10
|
+
"lit"
|
|
11
|
+
]
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"contributions": {
|
|
15
|
+
"html": {
|
|
16
|
+
"elements": [
|
|
17
|
+
{
|
|
18
|
+
"name": "vaadin-message",
|
|
19
|
+
"description": "`<vaadin-message>` is a Web Component for showing a single message with an author, message and time.\n\n```html\n<vaadin-message time=\"2021-01-28 10:43\"\n user-name = \"Bob Ross\"\n user-abbr = \"BR\"\n user-img = \"/static/img/avatar.jpg\">There is no real ending. It's just the place where you stop the story.</vaadin-message>\n```\n\n### Styling\n\nThe following shadow DOM parts are available for styling:\n\nPart name | Description\n----------|----------------\n`avatar` | The author's avatar\n`name` | Author's name\n`time` | When the message was posted\n`content` | The message itself as a slotted content\n\nThe following state attributes are available for styling:\n\nAttribute | Description\n-------------|-------------\n`focus-ring` | Set when the message is focused using the keyboard.\n`focused` | Set when the message is focused.\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/custom-theme/styling-components) documentation.\n\n### Internal components\n\nIn addition to `<vaadin-message>` itself, the following internal\ncomponents are themable:\n\n- `<vaadin-message-avatar>` - has the same API as [`<vaadin-avatar>`](https://cdn.vaadin.com/vaadin-web-components/23.2.1/#/elements/vaadin-avatar).",
|
|
20
|
+
"extension": true,
|
|
21
|
+
"attributes": [
|
|
22
|
+
{
|
|
23
|
+
"name": ".time",
|
|
24
|
+
"description": "Time of sending the message. It is rendered as-is to the part='time' slot,\nso the formatting is up to you.",
|
|
25
|
+
"value": {
|
|
26
|
+
"kind": "expression"
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"name": ".userName",
|
|
31
|
+
"description": "The name of the user posting the message.\nIt will be placed in the name part to indicate who has sent the message.\nIt is also used as a tooltip for the avatar.\nExample: `message.userName = \"Jessica Jacobs\";`",
|
|
32
|
+
"value": {
|
|
33
|
+
"kind": "expression"
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"name": ".userAbbr",
|
|
38
|
+
"description": "The abbreviation of the user.\nThe abbreviation will be passed on to avatar of the message.\nIf the user does not have an avatar picture set with `userImg`, `userAbbr` will be shown in the avatar.\nExample: `message.userAbbr = \"JJ\";`",
|
|
39
|
+
"value": {
|
|
40
|
+
"kind": "expression"
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"name": ".userImg",
|
|
45
|
+
"description": "An URL for a user image.\nThe image will be used in the avatar component to show who has sent the message.\nExample: `message.userImg = \"/static/img/avatar.jpg\";`",
|
|
46
|
+
"value": {
|
|
47
|
+
"kind": "expression"
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"name": ".userColorIndex",
|
|
52
|
+
"description": "A color index to be used to render the color of the avatar.\nWith no `userColorIndex` set, the basic avatar color will be used.\nBy setting a userColorIndex, the component will check if there exists a CSS variable defining the color, and uses it if there is one.\nIf now CSS variable is found for the color index, the property for the color will not be set.\n\nExample:\nCSS:\n```css\nhtml {\n --vaadin-user-color-1: red;\n}\n```\n\nJavaScript:\n```js\nmessage.userColorIndex = 1;\n```",
|
|
53
|
+
"value": {
|
|
54
|
+
"kind": "expression"
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
]
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"name": "vaadin-message-list",
|
|
61
|
+
"description": "`<vaadin-message-list>` is a Web Component for showing an ordered list of messages. The messages are rendered as <vaadin-message>\n\n### Example\nTo create a new message list, add the component to the page:\n```html\n<vaadin-message-list></vaadin-message-list>\n```\n\nProvide the messages to the message list with the `items` property.\n```js\ndocument.querySelector('vaadin-message-list').items = [\n { text: 'Hello list', time: 'yesterday', userName: 'Matt Mambo', userAbbr: 'MM', userColorIndex: 1 },\n { text: 'Another message', time: 'right now', userName: 'Linsey Listy', userAbbr: 'LL', userColorIndex: 2, userImg: '/static/img/avatar.jpg' }\n];\n```\n\n### Styling\n\nThe following shadow DOM parts are available for styling:\n\nPart name | Description\n----------|----------------\n`list` | The container wrapping messages.\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/custom-theme/styling-components) documentation.",
|
|
62
|
+
"extension": true,
|
|
63
|
+
"attributes": [
|
|
64
|
+
{
|
|
65
|
+
"name": ".items",
|
|
66
|
+
"description": "An array of objects which will be rendered as messages.\nThe message objects can have the following properties:\n```js\nArray<{\n text: string,\n time: string,\n userName: string,\n userAbbr: string,\n userImg: string,\n userColorIndex: number,\n theme: string\n}>\n```",
|
|
67
|
+
"value": {
|
|
68
|
+
"kind": "expression"
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
]
|
|
72
|
+
}
|
|
73
|
+
]
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|