@vaadin/avatar 24.8.0-alpha8 → 25.0.0-alpha1

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
@@ -28,29 +28,6 @@ Once installed, import the component in your application:
28
28
  import '@vaadin/avatar';
29
29
  ```
30
30
 
31
- ## Themes
32
-
33
- Vaadin components come with two built-in [themes](https://vaadin.com/docs/latest/styling), Lumo and Material.
34
- The [main entrypoint](https://github.com/vaadin/web-components/blob/main/packages/avatar/vaadin-avatar.js) of the package uses the Lumo theme.
35
-
36
- To use the Material theme, import the component from the `theme/material` folder:
37
-
38
- ```js
39
- import '@vaadin/avatar/theme/material/vaadin-avatar.js';
40
- ```
41
-
42
- You can also import the Lumo version of the component explicitly:
43
-
44
- ```js
45
- import '@vaadin/avatar/theme/lumo/vaadin-avatar.js';
46
- ```
47
-
48
- Finally, you can import the un-themed component from the `src` folder to get a minimal starting point:
49
-
50
- ```js
51
- import '@vaadin/avatar/src/vaadin-avatar.js';
52
- ```
53
-
54
31
  ## Contributing
55
32
 
56
33
  Read the [contributing guide](https://vaadin.com/docs/latest/contributing) to learn about our development process, how to propose bugfixes and improvements, and how to test your changes to Vaadin components.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vaadin/avatar",
3
- "version": "24.8.0-alpha8",
3
+ "version": "25.0.0-alpha1",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -32,23 +32,20 @@
32
32
  "Avatar",
33
33
  "vaadin-avatar",
34
34
  "web-components",
35
- "web-component",
36
- "polymer"
35
+ "web-component"
37
36
  ],
38
37
  "dependencies": {
39
38
  "@open-wc/dedupe-mixin": "^1.3.0",
40
- "@polymer/polymer": "^3.0.0",
41
- "@vaadin/a11y-base": "24.8.0-alpha8",
42
- "@vaadin/component-base": "24.8.0-alpha8",
43
- "@vaadin/tooltip": "24.8.0-alpha8",
44
- "@vaadin/vaadin-lumo-styles": "24.8.0-alpha8",
45
- "@vaadin/vaadin-material-styles": "24.8.0-alpha8",
46
- "@vaadin/vaadin-themable-mixin": "24.8.0-alpha8",
39
+ "@vaadin/a11y-base": "25.0.0-alpha1",
40
+ "@vaadin/component-base": "25.0.0-alpha1",
41
+ "@vaadin/tooltip": "25.0.0-alpha1",
42
+ "@vaadin/vaadin-lumo-styles": "25.0.0-alpha1",
43
+ "@vaadin/vaadin-themable-mixin": "25.0.0-alpha1",
47
44
  "lit": "^3.0.0"
48
45
  },
49
46
  "devDependencies": {
50
- "@vaadin/chai-plugins": "24.8.0-alpha8",
51
- "@vaadin/test-runner-commands": "24.8.0-alpha8",
47
+ "@vaadin/chai-plugins": "25.0.0-alpha1",
48
+ "@vaadin/test-runner-commands": "25.0.0-alpha1",
52
49
  "@vaadin/testing-helpers": "^1.1.0",
53
50
  "sinon": "^18.0.0"
54
51
  },
@@ -56,5 +53,5 @@
56
53
  "web-types.json",
57
54
  "web-types.lit.json"
58
55
  ],
59
- "gitHead": "d914bb8f669d7e3d1981feb8eac05688ab9870b4"
56
+ "gitHead": "b8c22a4a0c64156210d0daac96b43ae4e5526d49"
60
57
  }
@@ -3,7 +3,6 @@
3
3
  * Copyright (c) 2020 - 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 { ControllerMixin } from '@vaadin/component-base/src/controller-mixin.js';
7
6
  import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
8
7
  import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
9
8
  import { AvatarMixin } from './vaadin-avatar-mixin.js';
@@ -36,7 +35,7 @@ export { AvatarI18n } from './vaadin-avatar-mixin.js';
36
35
  *
37
36
  * See [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.
38
37
  */
39
- declare class Avatar extends AvatarMixin(ElementMixin(ThemableMixin(ControllerMixin(HTMLElement)))) {}
38
+ declare class Avatar extends AvatarMixin(ElementMixin(ThemableMixin(HTMLElement))) {}
40
39
 
41
40
  declare global {
42
41
  interface HTMLElementTagNameMap {
@@ -3,18 +3,18 @@
3
3
  * Copyright (c) 2020 - 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/tooltip/src/vaadin-tooltip.js';
6
7
  import './vaadin-avatar-icons.js';
7
- import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
8
- import { ControllerMixin } from '@vaadin/component-base/src/controller-mixin.js';
8
+ import { html, LitElement } from 'lit';
9
+ import { ifDefined } from 'lit/directives/if-defined.js';
9
10
  import { defineCustomElement } from '@vaadin/component-base/src/define.js';
10
11
  import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
12
+ import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
11
13
  import { TooltipController } from '@vaadin/component-base/src/tooltip-controller.js';
12
- import { registerStyles, ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
14
+ import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
13
15
  import { AvatarMixin } from './vaadin-avatar-mixin.js';
14
16
  import { avatarStyles } from './vaadin-avatar-styles.js';
15
17
 
16
- registerStyles('vaadin-avatar', avatarStyles, { moduleId: 'vaadin-avatar-styles' });
17
-
18
18
  /**
19
19
  * `<vaadin-avatar>` is a Web Component providing avatar displaying functionality.
20
20
  *
@@ -44,23 +44,31 @@ registerStyles('vaadin-avatar', avatarStyles, { moduleId: 'vaadin-avatar-styles'
44
44
  * @customElement
45
45
  * @extends HTMLElement
46
46
  * @mixes AvatarMixin
47
- * @mixes ControllerMixin
48
47
  * @mixes ElementMixin
49
48
  * @mixes ThemableMixin
50
49
  */
51
- class Avatar extends AvatarMixin(ElementMixin(ThemableMixin(ControllerMixin(PolymerElement)))) {
52
- static get template() {
50
+ class Avatar extends AvatarMixin(ElementMixin(ThemableMixin(PolylitMixin(LitElement)))) {
51
+ static get is() {
52
+ return 'vaadin-avatar';
53
+ }
54
+
55
+ static get styles() {
56
+ return avatarStyles;
57
+ }
58
+
59
+ /** @protected */
60
+ render() {
53
61
  return html`
54
62
  <img
55
- hidden$="[[!__imgVisible]]"
56
- src$="[[img]]"
63
+ ?hidden="${!this.__imgVisible}"
64
+ src="${ifDefined(this.img)}"
57
65
  aria-hidden="true"
58
- on-error="__onImageLoadError"
66
+ @error="${this.__onImageLoadError}"
59
67
  draggable="false"
60
68
  />
61
69
  <svg
62
70
  part="icon"
63
- hidden$="[[!__iconVisible]]"
71
+ ?hidden="${!this.__iconVisible}"
64
72
  id="avatar-icon"
65
73
  viewBox="-50 -50 100 100"
66
74
  preserveAspectRatio="xMidYMid meet"
@@ -70,23 +78,19 @@ class Avatar extends AvatarMixin(ElementMixin(ThemableMixin(ControllerMixin(Poly
70
78
  </svg>
71
79
  <svg
72
80
  part="abbr"
73
- hidden$="[[!__abbrVisible]]"
81
+ ?hidden="${!this.__abbrVisible}"
74
82
  id="avatar-abbr"
75
83
  viewBox="-50 -50 100 100"
76
84
  preserveAspectRatio="xMidYMid meet"
77
85
  aria-hidden="true"
78
86
  >
79
- <text dy=".35em" text-anchor="middle">[[abbr]]</text>
87
+ <text dy=".35em" text-anchor="middle">${this.abbr}</text>
80
88
  </svg>
81
89
 
82
90
  <slot name="tooltip"></slot>
83
91
  `;
84
92
  }
85
93
 
86
- static get is() {
87
- return 'vaadin-avatar';
88
- }
89
-
90
94
  /** @protected */
91
95
  ready() {
92
96
  super.ready();
package/web-types.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "@vaadin/avatar",
4
- "version": "24.8.0-alpha8",
4
+ "version": "25.0.0-alpha1",
5
5
  "description-markup": "markdown",
6
6
  "contributions": {
7
7
  "html": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "@vaadin/avatar",
4
- "version": "24.8.0-alpha8",
4
+ "version": "25.0.0-alpha1",
5
5
  "description-markup": "markdown",
6
6
  "framework": "lit",
7
7
  "framework-config": {
@@ -1,6 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright (c) 2020 - 2025 Vaadin Ltd.
4
- * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
- */
6
- export * from './vaadin-avatar.js';
@@ -1,81 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright (c) 2020 - 2025 Vaadin Ltd.
4
- * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
- */
6
- import './vaadin-avatar-icons.js';
7
- import { html, LitElement } from 'lit';
8
- import { ifDefined } from 'lit/directives/if-defined.js';
9
- import { defineCustomElement } from '@vaadin/component-base/src/define.js';
10
- import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
11
- import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
12
- import { TooltipController } from '@vaadin/component-base/src/tooltip-controller.js';
13
- import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
14
- import { AvatarMixin } from './vaadin-avatar-mixin.js';
15
- import { avatarStyles } from './vaadin-avatar-styles.js';
16
-
17
- /**
18
- * LitElement based version of `<vaadin-avatar>` web component.
19
- *
20
- * ## Disclaimer
21
- *
22
- * This component is an experiment and not yet a part of Vaadin platform.
23
- * There is no ETA regarding specific Vaadin version where it'll land.
24
- * Feel free to try this code in your apps as per Apache 2.0 license.
25
- */
26
- class Avatar extends AvatarMixin(ElementMixin(ThemableMixin(PolylitMixin(LitElement)))) {
27
- static get is() {
28
- return 'vaadin-avatar';
29
- }
30
-
31
- static get styles() {
32
- return avatarStyles;
33
- }
34
-
35
- /** @protected */
36
- ready() {
37
- super.ready();
38
-
39
- this._tooltipController = new TooltipController(this);
40
- this.addController(this._tooltipController);
41
- }
42
-
43
- /** @protected */
44
- render() {
45
- return html`
46
- <img
47
- ?hidden="${!this.__imgVisible}"
48
- src="${ifDefined(this.img)}"
49
- aria-hidden="true"
50
- @error="${this.__onImageLoadError}"
51
- draggable="false"
52
- />
53
- <svg
54
- part="icon"
55
- ?hidden="${!this.__iconVisible}"
56
- id="avatar-icon"
57
- viewBox="-50 -50 100 100"
58
- preserveAspectRatio="xMidYMid meet"
59
- aria-hidden="true"
60
- >
61
- <text dy=".35em" text-anchor="middle">&#xea01;</text>
62
- </svg>
63
- <svg
64
- part="abbr"
65
- ?hidden="${!this.__abbrVisible}"
66
- id="avatar-abbr"
67
- viewBox="-50 -50 100 100"
68
- preserveAspectRatio="xMidYMid meet"
69
- aria-hidden="true"
70
- >
71
- <text dy=".35em" text-anchor="middle">${this.abbr}</text>
72
- </svg>
73
-
74
- <slot name="tooltip"></slot>
75
- `;
76
- }
77
- }
78
-
79
- defineCustomElement(Avatar);
80
-
81
- export { Avatar };
@@ -1,3 +0,0 @@
1
- import '@vaadin/tooltip/theme/lumo/vaadin-lit-tooltip.js';
2
- import './vaadin-avatar-styles.js';
3
- import '../../src/vaadin-lit-avatar.js';
@@ -1,3 +0,0 @@
1
- import '@vaadin/tooltip/theme/lumo/vaadin-lit-tooltip.js';
2
- import './vaadin-avatar-styles.js';
3
- import '../../src/vaadin-lit-avatar.js';
@@ -1,3 +0,0 @@
1
- import '@vaadin/vaadin-material-styles/color.js';
2
- import '@vaadin/vaadin-material-styles/typography.js';
3
- import '@vaadin/vaadin-material-styles/user-colors.js';
@@ -1,61 +0,0 @@
1
- import '@vaadin/vaadin-material-styles/color.js';
2
- import '@vaadin/vaadin-material-styles/typography.js';
3
- import '@vaadin/vaadin-material-styles/user-colors.js';
4
- import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
5
-
6
- const globalStyle = document.createElement('style');
7
- globalStyle.textContent = 'html { --vaadin-avatar-size: 2.25rem; }';
8
- document.head.appendChild(globalStyle);
9
-
10
- registerStyles(
11
- 'vaadin-avatar',
12
- css`
13
- :host {
14
- color: var(--material-secondary-text-color);
15
- background-color: var(--material-secondary-background-color);
16
- border-radius: 50%;
17
- cursor: default;
18
- outline: none;
19
- user-select: none;
20
- -webkit-tap-highlight-color: transparent;
21
- -webkit-font-smoothing: antialiased;
22
- -moz-osx-font-smoothing: grayscale;
23
- }
24
-
25
- :host([has-color-index]) {
26
- color: var(--material-primary-contrast-color);
27
- }
28
-
29
- :host([focus-ring]) {
30
- border-color: var(--material-primary-color);
31
- }
32
-
33
- [part='icon'],
34
- [part='abbr'] {
35
- fill: currentColor;
36
- }
37
-
38
- [part='abbr'] {
39
- font-family: var(--material-font-family);
40
- font-size: 3em;
41
- font-weight: 500;
42
- }
43
-
44
- :host([theme~='xlarge']) {
45
- --vaadin-avatar-size: 3.5rem;
46
- }
47
-
48
- :host([theme~='large']) {
49
- --vaadin-avatar-size: 2.75rem;
50
- }
51
-
52
- :host([theme~='small']) {
53
- --vaadin-avatar-size: 1.875rem;
54
- }
55
-
56
- :host([theme~='xsmall']) {
57
- --vaadin-avatar-size: 1.625rem;
58
- }
59
- `,
60
- { moduleId: 'material-avatar' },
61
- );
@@ -1,3 +0,0 @@
1
- import '@vaadin/tooltip/theme/material/vaadin-tooltip.js';
2
- import './vaadin-avatar-styles.js';
3
- import '../../src/vaadin-avatar.js';
@@ -1,3 +0,0 @@
1
- import '@vaadin/tooltip/theme/material/vaadin-tooltip.js';
2
- import './vaadin-avatar-styles.js';
3
- import '../../src/vaadin-avatar.js';
@@ -1,3 +0,0 @@
1
- import '@vaadin/tooltip/theme/material/vaadin-lit-tooltip.js';
2
- import './vaadin-avatar-styles.js';
3
- import '../../src/vaadin-lit-avatar.js';
@@ -1,3 +0,0 @@
1
- import '@vaadin/tooltip/theme/material/vaadin-lit-tooltip.js';
2
- import './vaadin-avatar-styles.js';
3
- import '../../src/vaadin-lit-avatar.js';
@@ -1 +0,0 @@
1
- export * from './src/vaadin-avatar.js';
@@ -1,2 +0,0 @@
1
- import './theme/lumo/vaadin-lit-avatar.js';
2
- export * from './src/vaadin-lit-avatar.js';