@vaadin/message-list 22.0.0-beta1 → 22.0.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 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
- [Live Demo ↗](https://vaadin.com/docs/latest/ds/components/message-list)
5
+ [Documentation + Live Demo ↗](https://vaadin.com/docs/latest/ds/components/message-list)
6
6
 
7
7
  ```html
8
8
  <vaadin-message-list></vaadin-message-list>
@@ -23,7 +23,7 @@ A web component that allows you to show a list of messages, for example, a chat
23
23
  Install the component:
24
24
 
25
25
  ```sh
26
- npm i @vaadin/message-list --save
26
+ npm i @vaadin/message-list
27
27
  ```
28
28
 
29
29
  Once installed, import the component in your application:
@@ -34,9 +34,8 @@ 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/ds/customization/using-themes),
38
- Lumo and Material. The [main entrypoint](https://github.com/vaadin/web-components/blob/master/packages/message-list/vaadin-message-list.js)
39
- of the package uses the Lumo theme.
37
+ Vaadin components come with two built-in [themes](https://vaadin.com/docs/latest/ds/customization/using-themes), Lumo and Material.
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.
40
39
 
41
40
  To use the Material theme, import the component from the `theme/material` folder:
42
41
 
@@ -56,9 +55,13 @@ Finally, you can import the un-themed component from the `src` folder to get a m
56
55
  import '@vaadin/message-list/src/vaadin-message-list.js';
57
56
  ```
58
57
 
58
+ ## Contributing
59
+
60
+ Read the [contributing guide](https://vaadin.com/docs/latest/guide/contributing/overview) to learn about our development process, how to propose bugfixes and improvements, and how to test your changes to Vaadin components.
61
+
59
62
  ## License
60
63
 
61
64
  Apache License 2.0
62
65
 
63
- Vaadin collects development time usage statistics to improve this product.
66
+ Vaadin collects usage statistics at development time to improve this product.
64
67
  For details and to opt-out, see https://github.com/vaadin/vaadin-usage-statistics.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vaadin/message-list",
3
- "version": "22.0.0-beta1",
3
+ "version": "22.0.1",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -35,16 +35,16 @@
35
35
  ],
36
36
  "dependencies": {
37
37
  "@polymer/polymer": "^3.0.0",
38
- "@vaadin/avatar": "22.0.0-beta1",
39
- "@vaadin/component-base": "22.0.0-beta1",
40
- "@vaadin/vaadin-lumo-styles": "22.0.0-beta1",
41
- "@vaadin/vaadin-material-styles": "22.0.0-beta1",
42
- "@vaadin/vaadin-themable-mixin": "22.0.0-beta1"
38
+ "@vaadin/avatar": "^22.0.1",
39
+ "@vaadin/component-base": "^22.0.1",
40
+ "@vaadin/vaadin-lumo-styles": "^22.0.1",
41
+ "@vaadin/vaadin-material-styles": "^22.0.1",
42
+ "@vaadin/vaadin-themable-mixin": "^22.0.1"
43
43
  },
44
44
  "devDependencies": {
45
45
  "@esm-bundle/chai": "^4.3.4",
46
- "@vaadin/testing-helpers": "^0.3.0",
46
+ "@vaadin/testing-helpers": "^0.3.2",
47
47
  "sinon": "^9.2.4"
48
48
  },
49
- "gitHead": "4cf8a9d0504994200c610e44b3676114fef49c1e"
49
+ "gitHead": "2b0a2bff0369d6020f7cc33ad35506aa2d1f6f68"
50
50
  }
@@ -4,7 +4,7 @@
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import { Avatar } from '@vaadin/avatar/src/vaadin-avatar.js';
7
- import { registerStyles, css } from '@vaadin/vaadin-themable-mixin/register-styles.js';
7
+ import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
8
8
 
9
9
  registerStyles(
10
10
  'vaadin-message-avatar',
@@ -3,12 +3,12 @@
3
3
  * Copyright (c) 2021 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
- import { PolymerElement, html } from '@polymer/polymer/polymer-element.js';
7
6
  import '@polymer/polymer/lib/elements/dom-repeat.js';
7
+ import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
8
8
  import { microTask } from '@vaadin/component-base/src/async.js';
9
9
  import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
10
10
  import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
11
- import './vaadin-message.js';
11
+ import { Message } from './vaadin-message.js';
12
12
 
13
13
  /**
14
14
  * `<vaadin-message-list>` is a Web Component for showing an ordered list of messages. The messages are rendered as <vaadin-message>
@@ -95,7 +95,7 @@ class MessageList extends ElementMixin(ThemableMixin(PolymerElement)) {
95
95
  user-color-index="[[item.userColorIndex]]"
96
96
  theme$="[[item.theme]]"
97
97
  role="listitem"
98
- on-focus="_handleFocusEvent"
98
+ on-focusin="_handleFocusEvent"
99
99
  >[[item.text]]</vaadin-message
100
100
  >
101
101
  </template>
@@ -188,11 +188,10 @@ class MessageList extends ElementMixin(ThemableMixin(PolymerElement)) {
188
188
  }
189
189
 
190
190
  _handleFocusEvent(e) {
191
- const target = e
192
- .composedPath()
193
- .filter((elem) => elem.nodeType === Node.ELEMENT_NODE && elem.tagName.toLowerCase() === 'vaadin-message')[0];
191
+ const target = e.composedPath().find((node) => node instanceof Message);
194
192
  this._setTabIndexesByMessage(target);
195
193
  }
194
+
196
195
  /**
197
196
  * @param {number} idx
198
197
  * @protected
@@ -4,6 +4,7 @@
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 { FocusMixin } from '@vaadin/component-base/src/focus-mixin.js';
7
8
  import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
8
9
 
9
10
  /**
@@ -27,6 +28,13 @@ import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mix
27
28
  * `time` | When the message was posted
28
29
  * `content` | The message itself as a slotted content
29
30
  *
31
+ * The following state attributes are available for styling:
32
+ *
33
+ * Attribute | Description
34
+ * -------------|-------------
35
+ * `focus-ring` | Set when the message is focused using the keyboard.
36
+ * `focused` | Set when the message is focused.
37
+ *
30
38
  * See [Styling Components](https://vaadin.com/docs/latest/ds/customization/styling-components) documentation.
31
39
  *
32
40
  * ### Internal components
@@ -36,7 +44,7 @@ import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mix
36
44
  *
37
45
  * - `<vaadin-message-avatar>` - has the same API as [`<vaadin-avatar>`](#/elements/vaadin-avatar).
38
46
  */
39
- declare class Message extends ThemableMixin(ElementMixin(HTMLElement)) {
47
+ declare class Message extends FocusMixin(ThemableMixin(ElementMixin(HTMLElement))) {
40
48
  /**
41
49
  * Time of sending the message. It is rendered as-is to the part='time' slot,
42
50
  * so the formatting is up to you.
@@ -3,10 +3,11 @@
3
3
  * Copyright (c) 2021 Vaadin Ltd.
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
- import { PolymerElement, html } from '@polymer/polymer/polymer-element.js';
6
+ import './vaadin-message-avatar.js';
7
+ import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
7
8
  import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
9
+ import { FocusMixin } from '@vaadin/component-base/src/focus-mixin.js';
8
10
  import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
9
- import './vaadin-message-avatar.js';
10
11
 
11
12
  /**
12
13
  * `<vaadin-message>` is a Web Component for showing a single message with an author, message and time.
@@ -29,6 +30,13 @@ import './vaadin-message-avatar.js';
29
30
  * `time` | When the message was posted
30
31
  * `content` | The message itself as a slotted content
31
32
  *
33
+ * The following state attributes are available for styling:
34
+ *
35
+ * Attribute | Description
36
+ * -------------|-------------
37
+ * `focus-ring` | Set when the message is focused using the keyboard.
38
+ * `focused` | Set when the message is focused.
39
+ *
32
40
  * See [Styling Components](https://vaadin.com/docs/latest/ds/customization/styling-components) documentation.
33
41
  *
34
42
  * ### Internal components
@@ -39,10 +47,11 @@ import './vaadin-message-avatar.js';
39
47
  * - `<vaadin-message-avatar>` - has the same API as [`<vaadin-avatar>`](#/elements/vaadin-avatar).
40
48
  *
41
49
  * @extends HTMLElement
50
+ * @mixes FocusMixin
42
51
  * @mixes ThemableMixin
43
52
  * @mixes ElementMixin
44
53
  */
45
- class Message extends ElementMixin(ThemableMixin(PolymerElement)) {
54
+ class Message extends FocusMixin(ElementMixin(ThemableMixin(PolymerElement))) {
46
55
  static get properties() {
47
56
  return {
48
57
  /**
@@ -163,39 +172,6 @@ class Message extends ElementMixin(ThemableMixin(PolymerElement)) {
163
172
  static get is() {
164
173
  return 'vaadin-message';
165
174
  }
166
-
167
- /** @protected */
168
- ready() {
169
- super.ready();
170
-
171
- // Handle focus
172
- this.addEventListener('focus', () => this._setFocused(true), true);
173
- this.addEventListener('blur', () => this._setFocused(false), true);
174
- this.addEventListener('mousedown', () => {
175
- this._mousedown = true;
176
- const mouseUpListener = () => {
177
- this._mousedown = false;
178
- document.removeEventListener('mouseup', mouseUpListener);
179
- };
180
- document.addEventListener('mouseup', mouseUpListener);
181
- });
182
- }
183
-
184
- /**
185
- * @param {boolean} focused
186
- * @protected
187
- */
188
- _setFocused(focused) {
189
- if (focused) {
190
- this.setAttribute('focused', '');
191
- if (!this._mousedown) {
192
- this.setAttribute('focus-ring', '');
193
- }
194
- } else {
195
- this.removeAttribute('focused');
196
- this.removeAttribute('focus-ring');
197
- }
198
- }
199
175
  }
200
176
 
201
177
  customElements.define(Message.is, Message);
@@ -1,5 +1,5 @@
1
- import { registerStyles, css } from '@vaadin/vaadin-themable-mixin/register-styles.js';
2
1
  import '@vaadin/avatar/theme/lumo/vaadin-avatar-styles.js';
2
+ import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
3
3
 
4
4
  registerStyles(
5
5
  'vaadin-message-avatar',
@@ -1,8 +1,8 @@
1
- import { registerStyles, css } from '@vaadin/vaadin-themable-mixin/register-styles.js';
2
1
  import '@vaadin/vaadin-lumo-styles/color.js';
3
2
  import '@vaadin/vaadin-lumo-styles/sizing.js';
4
3
  import '@vaadin/vaadin-lumo-styles/spacing.js';
5
4
  import '@vaadin/vaadin-lumo-styles/style.js';
6
5
  import './vaadin-message-styles.js';
6
+ import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
7
7
 
8
8
  registerStyles('vaadin-message-list', css``, { moduleId: 'lumo-message-list' });
@@ -1,10 +1,10 @@
1
- import { registerStyles, css } from '@vaadin/vaadin-themable-mixin/register-styles.js';
2
1
  import '@vaadin/vaadin-lumo-styles/color.js';
3
2
  import '@vaadin/vaadin-lumo-styles/sizing.js';
4
3
  import '@vaadin/vaadin-lumo-styles/spacing.js';
5
4
  import '@vaadin/vaadin-lumo-styles/style.js';
6
5
  import '@vaadin/vaadin-lumo-styles/typography.js';
7
6
  import './vaadin-message-avatar-styles.js';
7
+ import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
8
8
 
9
9
  registerStyles(
10
10
  'vaadin-message',
@@ -1,5 +1,5 @@
1
- import { registerStyles, css } from '@vaadin/vaadin-themable-mixin/register-styles.js';
2
1
  import '@vaadin/avatar/theme/material/vaadin-avatar-styles.js';
2
+ import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
3
3
 
4
4
  registerStyles(
5
5
  'vaadin-message-avatar',
@@ -1,7 +1,7 @@
1
- import { registerStyles, css } from '@vaadin/vaadin-themable-mixin/register-styles.js';
2
1
  import '@vaadin/vaadin-material-styles/color.js';
3
2
  import '@vaadin/vaadin-material-styles/typography.js';
4
3
  import './vaadin-message-styles.js';
4
+ import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
5
5
 
6
6
  registerStyles(
7
7
  'vaadin-message-list',
@@ -1,7 +1,7 @@
1
- import { registerStyles, css } from '@vaadin/vaadin-themable-mixin/register-styles.js';
2
1
  import '@vaadin/vaadin-material-styles/color.js';
3
2
  import '@vaadin/vaadin-material-styles/typography.js';
4
3
  import './vaadin-message-avatar-styles.js';
4
+ import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
5
5
 
6
6
  registerStyles(
7
7
  'vaadin-message',