@vaadin/avatar 25.0.0-alpha1 → 25.0.0-alpha10

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/avatar",
3
- "version": "25.0.0-alpha1",
3
+ "version": "25.0.0-alpha10",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -21,6 +21,8 @@
21
21
  "type": "module",
22
22
  "files": [
23
23
  "src",
24
+ "!src/styles/*-base-styles.d.ts",
25
+ "!src/styles/*-base-styles.js",
24
26
  "theme",
25
27
  "vaadin-*.d.ts",
26
28
  "vaadin-*.js",
@@ -36,22 +38,22 @@
36
38
  ],
37
39
  "dependencies": {
38
40
  "@open-wc/dedupe-mixin": "^1.3.0",
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",
41
+ "@vaadin/a11y-base": "25.0.0-alpha10",
42
+ "@vaadin/component-base": "25.0.0-alpha10",
43
+ "@vaadin/tooltip": "25.0.0-alpha10",
44
+ "@vaadin/vaadin-lumo-styles": "25.0.0-alpha10",
45
+ "@vaadin/vaadin-themable-mixin": "25.0.0-alpha10",
44
46
  "lit": "^3.0.0"
45
47
  },
46
48
  "devDependencies": {
47
- "@vaadin/chai-plugins": "25.0.0-alpha1",
48
- "@vaadin/test-runner-commands": "25.0.0-alpha1",
49
- "@vaadin/testing-helpers": "^1.1.0",
49
+ "@vaadin/chai-plugins": "25.0.0-alpha10",
50
+ "@vaadin/test-runner-commands": "25.0.0-alpha10",
51
+ "@vaadin/testing-helpers": "^2.0.0",
50
52
  "sinon": "^18.0.0"
51
53
  },
52
54
  "web-types": [
53
55
  "web-types.json",
54
56
  "web-types.lit.json"
55
57
  ],
56
- "gitHead": "b8c22a4a0c64156210d0daac96b43ae4e5526d49"
58
+ "gitHead": "6cc6c94079e805fa5b2f0af4dbf3b2a7485e57d0"
57
59
  }
@@ -0,0 +1,8 @@
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 type { CSSResult } from 'lit';
7
+
8
+ export const avatarStyles: CSSResult;
@@ -0,0 +1,74 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) 2017 - 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/style-props.js';
7
+ import { css } from 'lit';
8
+
9
+ export const avatarStyles = css`
10
+ :host {
11
+ display: inline-block;
12
+ flex: none;
13
+ border-radius: 50%;
14
+ cursor: default;
15
+ color: var(--vaadin-avatar-color, var(--vaadin-color-subtle));
16
+ line-height: 0;
17
+ overflow: hidden;
18
+ height: var(--vaadin-avatar-size, 32px);
19
+ width: var(--vaadin-avatar-size, 32px);
20
+ border: var(--vaadin-focus-ring-width) solid transparent;
21
+ margin: calc(var(--vaadin-focus-ring-width) * -1);
22
+ background: var(--vaadin-avatar-background, var(--vaadin-background-container-strong));
23
+ background-clip: content-box;
24
+ vertical-align: middle;
25
+ -webkit-user-select: none;
26
+ user-select: none;
27
+ -webkit-tap-highlight-color: transparent;
28
+ position: relative;
29
+ }
30
+
31
+ :host([role='button']) {
32
+ cursor: var(--vaadin-clickable-cursor);
33
+ }
34
+
35
+ img {
36
+ height: 100%;
37
+ width: 100%;
38
+ object-fit: cover;
39
+ }
40
+
41
+ [part='icon'] {
42
+ height: 100%;
43
+ mask: var(--_vaadin-icon-user) no-repeat center / 74%;
44
+ background: currentColor;
45
+ }
46
+
47
+ [part='abbr'] {
48
+ font-size: 2.75em;
49
+ fill: currentColor;
50
+ }
51
+
52
+ :host([hidden]),
53
+ [hidden] {
54
+ display: none !important;
55
+ }
56
+
57
+ :host([has-color-index]) {
58
+ background-color: var(--vaadin-avatar-user-color);
59
+ color: oklch(from var(--vaadin-avatar-user-color) clamp(0, (0.62 - l) * 1000, 1) 0 0);
60
+ }
61
+
62
+ :host([has-color-index])::before {
63
+ position: absolute;
64
+ content: '';
65
+ inset: 0;
66
+ border-radius: inherit;
67
+ border: 2px solid var(--vaadin-avatar-user-color);
68
+ }
69
+
70
+ :host([focus-ring]) {
71
+ outline: var(--vaadin-focus-ring-width) solid var(--vaadin-focus-ring-color);
72
+ outline-offset: calc((var(--vaadin-focus-ring-width)) * -1);
73
+ }
74
+ `;
@@ -0,0 +1,8 @@
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 type { CSSResult } from 'lit';
7
+
8
+ export const avatarStyles: CSSResult;
@@ -1,12 +1,13 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2017 - 2025 Vaadin Ltd.
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 { css } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
6
+ import { css } from 'lit';
7
7
 
8
8
  export const avatarStyles = css`
9
9
  :host {
10
+ position: relative;
10
11
  display: inline-block;
11
12
  flex: none;
12
13
  border-radius: 50%;
@@ -26,27 +27,24 @@ export const avatarStyles = css`
26
27
  }
27
28
 
28
29
  [part='icon'] {
29
- font-size: 5.6em;
30
+ display: flex;
31
+ align-items: center;
32
+ justify-content: center;
33
+ height: 100%;
34
+ font-size: var(--vaadin-avatar-size, 64px);
35
+ line-height: 1;
30
36
  }
31
37
 
32
38
  [part='abbr'] {
33
39
  font-size: 2.2em;
34
40
  }
35
41
 
36
- [part='icon'] > text {
37
- font-family: 'vaadin-avatar-icons';
38
- }
39
-
40
- :host([hidden]) {
41
- display: none !important;
42
- }
43
-
44
- svg[hidden] {
42
+ :host([hidden]),
43
+ [hidden] {
45
44
  display: none !important;
46
45
  }
47
46
 
48
47
  :host([has-color-index]) {
49
- position: relative;
50
48
  background-color: var(--vaadin-avatar-user-color);
51
49
  }
52
50
 
@@ -4,16 +4,16 @@
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import '@vaadin/tooltip/src/vaadin-tooltip.js';
7
- import './vaadin-avatar-icons.js';
8
7
  import { html, LitElement } from 'lit';
9
8
  import { ifDefined } from 'lit/directives/if-defined.js';
10
9
  import { defineCustomElement } from '@vaadin/component-base/src/define.js';
11
10
  import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
12
11
  import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
13
12
  import { TooltipController } from '@vaadin/component-base/src/tooltip-controller.js';
13
+ import { LumoInjectionMixin } from '@vaadin/vaadin-themable-mixin/lumo-injection-mixin.js';
14
14
  import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
15
+ import { avatarStyles } from './styles/vaadin-avatar-core-styles.js';
15
16
  import { AvatarMixin } from './vaadin-avatar-mixin.js';
16
- import { avatarStyles } from './vaadin-avatar-styles.js';
17
17
 
18
18
  /**
19
19
  * `<vaadin-avatar>` is a Web Component providing avatar displaying functionality.
@@ -47,7 +47,7 @@ import { avatarStyles } from './vaadin-avatar-styles.js';
47
47
  * @mixes ElementMixin
48
48
  * @mixes ThemableMixin
49
49
  */
50
- class Avatar extends AvatarMixin(ElementMixin(ThemableMixin(PolylitMixin(LitElement)))) {
50
+ class Avatar extends AvatarMixin(ElementMixin(ThemableMixin(PolylitMixin(LumoInjectionMixin(LitElement))))) {
51
51
  static get is() {
52
52
  return 'vaadin-avatar';
53
53
  }
@@ -56,6 +56,12 @@ class Avatar extends AvatarMixin(ElementMixin(ThemableMixin(PolylitMixin(LitElem
56
56
  return avatarStyles;
57
57
  }
58
58
 
59
+ static get lumoInjector() {
60
+ return {
61
+ includeBaseStyles: true,
62
+ };
63
+ }
64
+
59
65
  /** @protected */
60
66
  render() {
61
67
  return html`
@@ -66,20 +72,10 @@ class Avatar extends AvatarMixin(ElementMixin(ThemableMixin(PolylitMixin(LitElem
66
72
  @error="${this.__onImageLoadError}"
67
73
  draggable="false"
68
74
  />
69
- <svg
70
- part="icon"
71
- ?hidden="${!this.__iconVisible}"
72
- id="avatar-icon"
73
- viewBox="-50 -50 100 100"
74
- preserveAspectRatio="xMidYMid meet"
75
- aria-hidden="true"
76
- >
77
- <text dy=".35em" text-anchor="middle">&#xea01;</text>
78
- </svg>
75
+ <div part="icon" ?hidden="${!this.__iconVisible}" aria-hidden="true"></div>
79
76
  <svg
80
77
  part="abbr"
81
78
  ?hidden="${!this.__abbrVisible}"
82
- id="avatar-abbr"
83
79
  viewBox="-50 -50 100 100"
84
80
  preserveAspectRatio="xMidYMid meet"
85
81
  aria-hidden="true"
@@ -2,5 +2,6 @@ import '@vaadin/vaadin-lumo-styles/color.js';
2
2
  import '@vaadin/vaadin-lumo-styles/sizing.js';
3
3
  import '@vaadin/vaadin-lumo-styles/spacing.js';
4
4
  import '@vaadin/vaadin-lumo-styles/style.js';
5
+ import '@vaadin/vaadin-lumo-styles/font-icons.js';
5
6
  import '@vaadin/vaadin-lumo-styles/typography.js';
6
7
  import '@vaadin/vaadin-lumo-styles/user-colors.js';
@@ -2,6 +2,7 @@ import '@vaadin/vaadin-lumo-styles/color.js';
2
2
  import '@vaadin/vaadin-lumo-styles/sizing.js';
3
3
  import '@vaadin/vaadin-lumo-styles/spacing.js';
4
4
  import '@vaadin/vaadin-lumo-styles/style.js';
5
+ import '@vaadin/vaadin-lumo-styles/font-icons.js';
5
6
  import '@vaadin/vaadin-lumo-styles/typography.js';
6
7
  import '@vaadin/vaadin-lumo-styles/user-colors.js';
7
8
  import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
@@ -33,15 +34,17 @@ registerStyles(
33
34
  border-color: var(--vaadin-focus-ring-color, var(--lumo-primary-color-50pct));
34
35
  }
35
36
 
36
- [part='icon'],
37
- [part='abbr'] {
38
- fill: currentColor;
37
+ [part='icon']::before {
38
+ content: var(--lumo-icons-user);
39
+ font-family: lumo-icons;
40
+ font-size: 0.9em;
39
41
  }
40
42
 
41
43
  [part='abbr'] {
42
44
  font-family: var(--lumo-font-family);
43
45
  font-size: 2.4375em;
44
46
  font-weight: 500;
47
+ fill: currentColor;
45
48
  }
46
49
 
47
50
  :host([theme~='xlarge']) [part='abbr'] {
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": "25.0.0-alpha1",
4
+ "version": "25.0.0-alpha10",
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": "25.0.0-alpha1",
4
+ "version": "25.0.0-alpha10",
5
5
  "description-markup": "markdown",
6
6
  "framework": "lit",
7
7
  "framework-config": {
@@ -1,19 +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
- const template = document.createElement('template');
7
-
8
- template.innerHTML = `
9
- <style>
10
- @font-face {
11
- font-family: 'vaadin-avatar-icons';
12
- src: url(data:application/font-woff;charset=utf-8;base64,d09GRgABAAAAAAQAAAsAAAAABnwAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABHU1VCAAABCAAAADsAAABUIIslek9TLzIAAAFEAAAAQwAAAFZAIUmEY21hcAAAAYgAAABLAAABcOspwa1nbHlmAAAB1AAAAEUAAABMYO4o1WhlYWQAAAIcAAAALgAAADYYaAmGaGhlYQAAAkwAAAAdAAAAJAZsA1VobXR4AAAC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k2VmGPMiP/1h+71/ATcWYAhAAB4nGNgYoAALgbsgImRiZGZgaW0OLWIgQEACl4B2QAAAA==) format('woff');
13
- font-weight: normal;
14
- font-style: normal;
15
- }
16
- </style>
17
- `;
18
-
19
- document.head.appendChild(template.content);