@vaadin/avatar 25.0.0-alpha1 → 25.0.0-alpha11
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 +10 -11
- package/src/styles/vaadin-avatar-base-styles.d.ts +8 -0
- package/src/styles/vaadin-avatar-base-styles.js +75 -0
- package/src/vaadin-avatar.js +10 -14
- package/vaadin-avatar.js +1 -1
- package/web-types.json +1 -1
- package/web-types.lit.json +1 -1
- package/src/vaadin-avatar-icons.js +0 -19
- package/src/vaadin-avatar-styles.js +0 -60
- package/theme/lumo/vaadin-avatar-styles.d.ts +0 -6
- package/theme/lumo/vaadin-avatar-styles.js +0 -80
- package/theme/lumo/vaadin-avatar.d.ts +0 -3
- package/theme/lumo/vaadin-avatar.js +0 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/avatar",
|
|
3
|
-
"version": "25.0.0-
|
|
3
|
+
"version": "25.0.0-alpha11",
|
|
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",
|
|
@@ -36,22 +35,22 @@
|
|
|
36
35
|
],
|
|
37
36
|
"dependencies": {
|
|
38
37
|
"@open-wc/dedupe-mixin": "^1.3.0",
|
|
39
|
-
"@vaadin/a11y-base": "25.0.0-
|
|
40
|
-
"@vaadin/component-base": "25.0.0-
|
|
41
|
-
"@vaadin/tooltip": "25.0.0-
|
|
42
|
-
"@vaadin/vaadin-
|
|
43
|
-
"@vaadin/vaadin-themable-mixin": "25.0.0-alpha1",
|
|
38
|
+
"@vaadin/a11y-base": "25.0.0-alpha11",
|
|
39
|
+
"@vaadin/component-base": "25.0.0-alpha11",
|
|
40
|
+
"@vaadin/tooltip": "25.0.0-alpha11",
|
|
41
|
+
"@vaadin/vaadin-themable-mixin": "25.0.0-alpha11",
|
|
44
42
|
"lit": "^3.0.0"
|
|
45
43
|
},
|
|
46
44
|
"devDependencies": {
|
|
47
|
-
"@vaadin/chai-plugins": "25.0.0-
|
|
48
|
-
"@vaadin/test-runner-commands": "25.0.0-
|
|
49
|
-
"@vaadin/testing-helpers": "^
|
|
45
|
+
"@vaadin/chai-plugins": "25.0.0-alpha11",
|
|
46
|
+
"@vaadin/test-runner-commands": "25.0.0-alpha11",
|
|
47
|
+
"@vaadin/testing-helpers": "^2.0.0",
|
|
48
|
+
"@vaadin/vaadin-lumo-styles": "25.0.0-alpha11",
|
|
50
49
|
"sinon": "^18.0.0"
|
|
51
50
|
},
|
|
52
51
|
"web-types": [
|
|
53
52
|
"web-types.json",
|
|
54
53
|
"web-types.lit.json"
|
|
55
54
|
],
|
|
56
|
-
"gitHead": "
|
|
55
|
+
"gitHead": "abfd315ba5a7484a613e0768635a4e8fe945a44b"
|
|
57
56
|
}
|
|
@@ -0,0 +1,75 @@
|
|
|
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/styles/style-props.js';
|
|
7
|
+
import '@vaadin/component-base/src/styles/user-colors.js';
|
|
8
|
+
import { css } from 'lit';
|
|
9
|
+
|
|
10
|
+
export const avatarStyles = css`
|
|
11
|
+
:host {
|
|
12
|
+
display: inline-block;
|
|
13
|
+
flex: none;
|
|
14
|
+
border-radius: 50%;
|
|
15
|
+
cursor: default;
|
|
16
|
+
color: var(--vaadin-avatar-color, var(--vaadin-color-subtle));
|
|
17
|
+
line-height: 0;
|
|
18
|
+
overflow: hidden;
|
|
19
|
+
height: var(--vaadin-avatar-size, 32px);
|
|
20
|
+
width: var(--vaadin-avatar-size, 32px);
|
|
21
|
+
border: var(--vaadin-focus-ring-width) solid transparent;
|
|
22
|
+
margin: calc(var(--vaadin-focus-ring-width) * -1);
|
|
23
|
+
background: var(--vaadin-avatar-background, var(--vaadin-background-container-strong));
|
|
24
|
+
background-clip: content-box;
|
|
25
|
+
vertical-align: middle;
|
|
26
|
+
-webkit-user-select: none;
|
|
27
|
+
user-select: none;
|
|
28
|
+
-webkit-tap-highlight-color: transparent;
|
|
29
|
+
position: relative;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
:host([role='button']) {
|
|
33
|
+
cursor: var(--vaadin-clickable-cursor);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
img {
|
|
37
|
+
height: 100%;
|
|
38
|
+
width: 100%;
|
|
39
|
+
object-fit: cover;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
[part='icon'] {
|
|
43
|
+
height: 100%;
|
|
44
|
+
mask: var(--_vaadin-icon-user) no-repeat center / 74%;
|
|
45
|
+
background: currentColor;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
[part='abbr'] {
|
|
49
|
+
font-size: 2.75em;
|
|
50
|
+
fill: currentColor;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
:host([hidden]),
|
|
54
|
+
[hidden] {
|
|
55
|
+
display: none !important;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
:host([has-color-index]) {
|
|
59
|
+
background-color: var(--vaadin-avatar-user-color);
|
|
60
|
+
color: oklch(from var(--vaadin-avatar-user-color) clamp(0, (0.62 - l) * 1000, 1) 0 0);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
:host([has-color-index])::before {
|
|
64
|
+
position: absolute;
|
|
65
|
+
content: '';
|
|
66
|
+
inset: 0;
|
|
67
|
+
border-radius: inherit;
|
|
68
|
+
border: 2px solid var(--vaadin-avatar-user-color);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
:host([focus-ring]) {
|
|
72
|
+
outline: var(--vaadin-focus-ring-width) solid var(--vaadin-focus-ring-color);
|
|
73
|
+
outline-offset: calc((var(--vaadin-focus-ring-width)) * -1);
|
|
74
|
+
}
|
|
75
|
+
`;
|
package/src/vaadin-avatar.js
CHANGED
|
@@ -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-base-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
|
-
<
|
|
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"></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"
|
package/vaadin-avatar.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import './
|
|
1
|
+
import './src/vaadin-avatar.js';
|
|
2
2
|
export * from './src/vaadin-avatar.js';
|
package/web-types.json
CHANGED
package/web-types.lit.json
CHANGED
|
@@ -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,d09GRgABAAAAAAQAAAsAAAAABnwAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABHU1VCAAABCAAAADsAAABUIIslek9TLzIAAAFEAAAAQwAAAFZAIUmEY21hcAAAAYgAAABLAAABcOspwa1nbHlmAAAB1AAAAEUAAABMYO4o1WhlYWQAAAIcAAAALgAAADYYaAmGaGhlYQAAAkwAAAAdAAAAJAZsA1VobXR4AAACbAAAAAgAAAAIA+gAAGxvY2EAAAJ0AAAABgAAAAYAJgAAbWF4cAAAAnwAAAAeAAAAIAEOACFuYW1lAAACnAAAAUIAAAKavFDYrHBvc3QAAAPgAAAAHQAAAC52hGZ4eJxjYGRgYOBiMGCwY2BycfMJYeDLSSzJY5BiYGGAAJA8MpsxJzM9kYEDxgPKsYBpDiBmg4gCACY7BUgAeJxjYGT8wjiBgZWBgamKaQ8DA0MPhGZ8wGDIyAQUZWBlZsAKAtJcUxgcXjG+YmQO+p/FEMUcxDANKMwIkgMADiUMJQB4nGNgYGBlYGBgBmIdIGZhYGAMYWBkAAE/oCgjWJyZgQsszsKgBFbDAhJ/xfj/P4wE8lnAJAMjG8Mo4AGTMlAeOKwgmIERADU0CX0AeJxjYGIAAmYJpkgGHgYRBgZGJT1GEztGIzlGET5GKEuU8YuSpZKSpQuI+LfLv21emz9jHJQPJP7dsUywsEiwBACG8g9CAAAAeJxjYGRgYADicIOnh+P5bb4ycDO/AIow3JZ4rIJMM0swRQIpDgYmEA8AKwgJOwAAeJxjYGRgYA76nwUkXzAAAbMEAyMDKmACAE2GAskAAAAAAAAAA+gAAAAAAAAAJgAAeJxjYGRgYGBiEAViBjCLgYELCBkY/oP5DAAKuwEwAAB4nI2Qu07DMBSG//SGaCWEhMSAGDx1QU0vYyemdmDrUDEhuamTpkriyHEj9RF4B56Bh2Bg5mmY+8d4Qh3qo9jf+c45thQAt/hGgGYFuHN7s1q4YvbHbdKD5w555LmLAZ499+hfPPfxhDfPA/p33hB0rmmG+PDcwg2+PLfpfzx3yL+eu7gPHj33MAxmnvtYB6+eB/SftZTbtBjJWlppRmmki2qlkkMmzZnKGbVWpkp1Iabh5Ex1qQplpFVbsTmKqk5m1sYiNjoXC11YlWValEbvVWTDnbXlfDyOvQ8jnaOGZGyRouCfky63/AyzFBE0fYUVFBIckLnKZTOXda15s+GZulxgihCTC2eXnC3cfFNV7BfY4Mi9eT3BjNYiZh6zRyMnLdxs050xNE3panuaiD7Ezk2VmGPMiP/1h+71/ATcWYAhAAB4nGNgYoAALgbsgImRiZGZgaW0OLWIgQEACl4B2QAAAA==) format('woff');
|
|
13
|
-
font-weight: normal;
|
|
14
|
-
font-style: normal;
|
|
15
|
-
}
|
|
16
|
-
</style>
|
|
17
|
-
`;
|
|
18
|
-
|
|
19
|
-
document.head.appendChild(template.content);
|
|
@@ -1,60 +0,0 @@
|
|
|
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 { css } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
7
|
-
|
|
8
|
-
export const avatarStyles = css`
|
|
9
|
-
:host {
|
|
10
|
-
display: inline-block;
|
|
11
|
-
flex: none;
|
|
12
|
-
border-radius: 50%;
|
|
13
|
-
overflow: hidden;
|
|
14
|
-
height: var(--vaadin-avatar-size, 64px);
|
|
15
|
-
width: var(--vaadin-avatar-size, 64px);
|
|
16
|
-
border: var(--vaadin-avatar-outline-width) solid transparent;
|
|
17
|
-
margin: calc(var(--vaadin-avatar-outline-width) * -1);
|
|
18
|
-
background-clip: content-box;
|
|
19
|
-
--vaadin-avatar-outline-width: var(--vaadin-focus-ring-width, 2px);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
img {
|
|
23
|
-
height: 100%;
|
|
24
|
-
width: 100%;
|
|
25
|
-
object-fit: cover;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
[part='icon'] {
|
|
29
|
-
font-size: 5.6em;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
[part='abbr'] {
|
|
33
|
-
font-size: 2.2em;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
[part='icon'] > text {
|
|
37
|
-
font-family: 'vaadin-avatar-icons';
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
:host([hidden]) {
|
|
41
|
-
display: none !important;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
svg[hidden] {
|
|
45
|
-
display: none !important;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
:host([has-color-index]) {
|
|
49
|
-
position: relative;
|
|
50
|
-
background-color: var(--vaadin-avatar-user-color);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
:host([has-color-index])::before {
|
|
54
|
-
position: absolute;
|
|
55
|
-
content: '';
|
|
56
|
-
inset: 0;
|
|
57
|
-
border-radius: inherit;
|
|
58
|
-
box-shadow: inset 0 0 0 2px var(--vaadin-avatar-user-color);
|
|
59
|
-
}
|
|
60
|
-
`;
|
|
@@ -1,6 +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 '@vaadin/vaadin-lumo-styles/typography.js';
|
|
6
|
-
import '@vaadin/vaadin-lumo-styles/user-colors.js';
|
|
@@ -1,80 +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 '@vaadin/vaadin-lumo-styles/typography.js';
|
|
6
|
-
import '@vaadin/vaadin-lumo-styles/user-colors.js';
|
|
7
|
-
import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
8
|
-
|
|
9
|
-
const globalStyle = document.createElement('style');
|
|
10
|
-
globalStyle.textContent = 'html { --vaadin-avatar-size: var(--lumo-size-m); }';
|
|
11
|
-
document.head.appendChild(globalStyle);
|
|
12
|
-
|
|
13
|
-
registerStyles(
|
|
14
|
-
'vaadin-avatar',
|
|
15
|
-
css`
|
|
16
|
-
:host {
|
|
17
|
-
color: var(--lumo-secondary-text-color);
|
|
18
|
-
background-color: var(--lumo-contrast-10pct);
|
|
19
|
-
border-radius: 50%;
|
|
20
|
-
outline: none;
|
|
21
|
-
cursor: default;
|
|
22
|
-
user-select: none;
|
|
23
|
-
-webkit-tap-highlight-color: transparent;
|
|
24
|
-
-webkit-font-smoothing: antialiased;
|
|
25
|
-
-moz-osx-font-smoothing: grayscale;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
:host([has-color-index]) {
|
|
29
|
-
color: var(--lumo-base-color);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
:host([focus-ring]) {
|
|
33
|
-
border-color: var(--vaadin-focus-ring-color, var(--lumo-primary-color-50pct));
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
[part='icon'],
|
|
37
|
-
[part='abbr'] {
|
|
38
|
-
fill: currentColor;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
[part='abbr'] {
|
|
42
|
-
font-family: var(--lumo-font-family);
|
|
43
|
-
font-size: 2.4375em;
|
|
44
|
-
font-weight: 500;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
:host([theme~='xlarge']) [part='abbr'] {
|
|
48
|
-
font-size: 2.5em;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
:host([theme~='large']) [part='abbr'] {
|
|
52
|
-
font-size: 2.375em;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
:host([theme~='small']) [part='abbr'] {
|
|
56
|
-
font-size: 2.75em;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
:host([theme~='xsmall']) [part='abbr'] {
|
|
60
|
-
font-size: 3em;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
:host([theme~='xlarge']) {
|
|
64
|
-
--vaadin-avatar-size: var(--lumo-size-xl);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
:host([theme~='large']) {
|
|
68
|
-
--vaadin-avatar-size: var(--lumo-size-l);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
:host([theme~='small']) {
|
|
72
|
-
--vaadin-avatar-size: var(--lumo-size-s);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
:host([theme~='xsmall']) {
|
|
76
|
-
--vaadin-avatar-size: var(--lumo-size-xs);
|
|
77
|
-
}
|
|
78
|
-
`,
|
|
79
|
-
{ moduleId: 'lumo-avatar' },
|
|
80
|
-
);
|