@vaadin/avatar 23.2.0-alpha1 → 23.2.0-alpha4
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": "23.2.0-
|
|
3
|
+
"version": "23.2.0-alpha4",
|
|
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",
|
|
@@ -35,18 +37,22 @@
|
|
|
35
37
|
],
|
|
36
38
|
"dependencies": {
|
|
37
39
|
"@polymer/polymer": "^3.0.0",
|
|
38
|
-
"@vaadin/component-base": "23.2.0-
|
|
39
|
-
"@vaadin/item": "23.2.0-
|
|
40
|
-
"@vaadin/list-box": "23.2.0-
|
|
41
|
-
"@vaadin/vaadin-lumo-styles": "23.2.0-
|
|
42
|
-
"@vaadin/vaadin-material-styles": "23.2.0-
|
|
43
|
-
"@vaadin/vaadin-overlay": "23.2.0-
|
|
44
|
-
"@vaadin/vaadin-themable-mixin": "23.2.0-
|
|
40
|
+
"@vaadin/component-base": "23.2.0-alpha4",
|
|
41
|
+
"@vaadin/item": "23.2.0-alpha4",
|
|
42
|
+
"@vaadin/list-box": "23.2.0-alpha4",
|
|
43
|
+
"@vaadin/vaadin-lumo-styles": "23.2.0-alpha4",
|
|
44
|
+
"@vaadin/vaadin-material-styles": "23.2.0-alpha4",
|
|
45
|
+
"@vaadin/vaadin-overlay": "23.2.0-alpha4",
|
|
46
|
+
"@vaadin/vaadin-themable-mixin": "23.2.0-alpha4"
|
|
45
47
|
},
|
|
46
48
|
"devDependencies": {
|
|
47
49
|
"@esm-bundle/chai": "^4.3.4",
|
|
48
50
|
"@vaadin/testing-helpers": "^0.3.2",
|
|
49
51
|
"sinon": "^13.0.2"
|
|
50
52
|
},
|
|
51
|
-
"
|
|
53
|
+
"web-types": [
|
|
54
|
+
"web-types.json",
|
|
55
|
+
"web-types.lit.json"
|
|
56
|
+
],
|
|
57
|
+
"gitHead": "cbf5f1d0f38ac9b81c65cf9ef5660182e176e598"
|
|
52
58
|
}
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
* Copyright (c) 2020 - 2022 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
|
-
const
|
|
6
|
+
const template = document.createElement('template');
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
template.innerHTML = `
|
|
9
9
|
<style>
|
|
10
10
|
@font-face {
|
|
11
11
|
font-family: 'vaadin-avatar-icons';
|
|
@@ -16,4 +16,4 @@ $_documentContainer.innerHTML = `
|
|
|
16
16
|
</style>
|
|
17
17
|
`;
|
|
18
18
|
|
|
19
|
-
document.head.appendChild(
|
|
19
|
+
document.head.appendChild(template.content);
|
package/src/vaadin-avatar.js
CHANGED
|
@@ -49,13 +49,12 @@ class Avatar extends FocusMixin(ElementMixin(ThemableMixin(PolymerElement))) {
|
|
|
49
49
|
flex: none;
|
|
50
50
|
border-radius: 50%;
|
|
51
51
|
overflow: hidden;
|
|
52
|
-
height: var(--vaadin-avatar-size);
|
|
53
|
-
width: var(--vaadin-avatar-size);
|
|
52
|
+
height: var(--vaadin-avatar-size, 64px);
|
|
53
|
+
width: var(--vaadin-avatar-size, 64px);
|
|
54
54
|
border: var(--vaadin-avatar-outline-width) solid transparent;
|
|
55
55
|
margin: calc(var(--vaadin-avatar-outline-width) * -1);
|
|
56
56
|
background-clip: content-box;
|
|
57
57
|
--vaadin-avatar-outline-width: 2px;
|
|
58
|
-
--vaadin-avatar-size: 64px;
|
|
59
58
|
}
|
|
60
59
|
|
|
61
60
|
img {
|
|
@@ -6,11 +6,14 @@ import '@vaadin/vaadin-lumo-styles/typography.js';
|
|
|
6
6
|
import '@vaadin/vaadin-lumo-styles/user-colors.js';
|
|
7
7
|
import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
8
8
|
|
|
9
|
+
const globalStyle = document.createElement('style');
|
|
10
|
+
globalStyle.textContent = 'html { --vaadin-avatar-size: var(--lumo-size-m); }';
|
|
11
|
+
document.head.appendChild(globalStyle);
|
|
12
|
+
|
|
9
13
|
registerStyles(
|
|
10
14
|
'vaadin-avatar',
|
|
11
15
|
css`
|
|
12
16
|
:host {
|
|
13
|
-
--vaadin-avatar-size: var(--lumo-size-m);
|
|
14
17
|
color: var(--lumo-secondary-text-color);
|
|
15
18
|
background-color: var(--lumo-contrast-10pct);
|
|
16
19
|
border-radius: 50%;
|
|
@@ -3,11 +3,14 @@ import '@vaadin/vaadin-material-styles/typography.js';
|
|
|
3
3
|
import '@vaadin/vaadin-material-styles/user-colors.js';
|
|
4
4
|
import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
5
5
|
|
|
6
|
+
const globalStyle = document.createElement('style');
|
|
7
|
+
globalStyle.textContent = 'html { --vaadin-avatar-size: 2.25rem; }';
|
|
8
|
+
document.head.appendChild(globalStyle);
|
|
9
|
+
|
|
6
10
|
registerStyles(
|
|
7
11
|
'vaadin-avatar',
|
|
8
12
|
css`
|
|
9
13
|
:host {
|
|
10
|
-
--vaadin-avatar-size: 2.25rem;
|
|
11
14
|
color: var(--material-secondary-text-color);
|
|
12
15
|
background-color: var(--material-secondary-background-color);
|
|
13
16
|
border-radius: 50%;
|
|
@@ -37,6 +40,22 @@ registerStyles(
|
|
|
37
40
|
font-size: 3em;
|
|
38
41
|
font-weight: 500;
|
|
39
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
|
+
}
|
|
40
59
|
`,
|
|
41
60
|
{ moduleId: 'material-avatar' },
|
|
42
61
|
);
|
package/web-types.json
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json.schemastore.org/web-types",
|
|
3
|
+
"name": "@vaadin/avatar",
|
|
4
|
+
"version": "23.2.0-alpha4",
|
|
5
|
+
"description-markup": "markdown",
|
|
6
|
+
"contributions": {
|
|
7
|
+
"html": {
|
|
8
|
+
"elements": [
|
|
9
|
+
{
|
|
10
|
+
"name": "vaadin-avatar",
|
|
11
|
+
"description": "`<vaadin-avatar>` is a Web Component providing avatar displaying functionality.\n\n```html\n<vaadin-avatar img=\"avatars/avatar-1.jpg\"></vaadin-avatar>\n```\n\n### Styling\n\nThe following shadow DOM parts are exposed for styling:\n\nPart name | Description\n--------- | ---------------\n`abbr` | The abbreviation element\n`icon` | The icon element\n\nThe following state attributes are available for styling:\n\nAttribute | Description\n------------------|-------------\n`focus-ring` | Set when the avatar is focused using the keyboard.\n`focused` | Set when the avatar is focused.\n`has-color-index` | Set when the avatar has `colorIndex` and the corresponding custom CSS property exists.\n\nSee [Styling Components](https://vaadin.com/docs/latest/ds/customization/styling-components) documentation.",
|
|
12
|
+
"attributes": [
|
|
13
|
+
{
|
|
14
|
+
"name": "img",
|
|
15
|
+
"description": "The path to the image",
|
|
16
|
+
"value": {
|
|
17
|
+
"type": [
|
|
18
|
+
"string",
|
|
19
|
+
"null",
|
|
20
|
+
"undefined"
|
|
21
|
+
]
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"name": "abbr",
|
|
26
|
+
"description": "A shortened form of name that is displayed\nin the avatar when `img` is not provided.",
|
|
27
|
+
"value": {
|
|
28
|
+
"type": [
|
|
29
|
+
"string",
|
|
30
|
+
"null",
|
|
31
|
+
"undefined"
|
|
32
|
+
]
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"name": "name",
|
|
37
|
+
"description": "Full name of the user\nused for the title of the avatar.",
|
|
38
|
+
"value": {
|
|
39
|
+
"type": [
|
|
40
|
+
"string",
|
|
41
|
+
"null",
|
|
42
|
+
"undefined"
|
|
43
|
+
]
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"name": "color-index",
|
|
48
|
+
"description": "Color index used for avatar background.",
|
|
49
|
+
"value": {
|
|
50
|
+
"type": [
|
|
51
|
+
"number",
|
|
52
|
+
"null",
|
|
53
|
+
"undefined"
|
|
54
|
+
]
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"name": "theme",
|
|
59
|
+
"description": "The theme variants to apply to the component.",
|
|
60
|
+
"value": {
|
|
61
|
+
"type": [
|
|
62
|
+
"string",
|
|
63
|
+
"null",
|
|
64
|
+
"undefined"
|
|
65
|
+
]
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
],
|
|
69
|
+
"js": {
|
|
70
|
+
"properties": [
|
|
71
|
+
{
|
|
72
|
+
"name": "img",
|
|
73
|
+
"description": "The path to the image",
|
|
74
|
+
"value": {
|
|
75
|
+
"type": [
|
|
76
|
+
"string",
|
|
77
|
+
"null",
|
|
78
|
+
"undefined"
|
|
79
|
+
]
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
"name": "abbr",
|
|
84
|
+
"description": "A shortened form of name that is displayed\nin the avatar when `img` is not provided.",
|
|
85
|
+
"value": {
|
|
86
|
+
"type": [
|
|
87
|
+
"string",
|
|
88
|
+
"null",
|
|
89
|
+
"undefined"
|
|
90
|
+
]
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
"name": "name",
|
|
95
|
+
"description": "Full name of the user\nused for the title of the avatar.",
|
|
96
|
+
"value": {
|
|
97
|
+
"type": [
|
|
98
|
+
"string",
|
|
99
|
+
"null",
|
|
100
|
+
"undefined"
|
|
101
|
+
]
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
"name": "colorIndex",
|
|
106
|
+
"description": "Color index used for avatar background.",
|
|
107
|
+
"value": {
|
|
108
|
+
"type": [
|
|
109
|
+
"number",
|
|
110
|
+
"null",
|
|
111
|
+
"undefined"
|
|
112
|
+
]
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
"name": "i18n",
|
|
117
|
+
"description": "The object used to localize this component.\nTo change the default localization, replace the entire\n_i18n_ object or just the property you want to modify.\n\nThe object has the following JSON structure and default values:\n {\n // Translation of the anonymous user avatar title.\n anonymous: 'anonymous'\n }",
|
|
118
|
+
"value": {
|
|
119
|
+
"type": [
|
|
120
|
+
"AvatarI18n"
|
|
121
|
+
]
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
],
|
|
125
|
+
"events": []
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
]
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json.schemastore.org/web-types",
|
|
3
|
+
"name": "@vaadin/avatar",
|
|
4
|
+
"version": "23.2.0-alpha4",
|
|
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-avatar",
|
|
19
|
+
"description": "`<vaadin-avatar>` is a Web Component providing avatar displaying functionality.\n\n```html\n<vaadin-avatar img=\"avatars/avatar-1.jpg\"></vaadin-avatar>\n```\n\n### Styling\n\nThe following shadow DOM parts are exposed for styling:\n\nPart name | Description\n--------- | ---------------\n`abbr` | The abbreviation element\n`icon` | The icon element\n\nThe following state attributes are available for styling:\n\nAttribute | Description\n------------------|-------------\n`focus-ring` | Set when the avatar is focused using the keyboard.\n`focused` | Set when the avatar is focused.\n`has-color-index` | Set when the avatar has `colorIndex` and the corresponding custom CSS property exists.\n\nSee [Styling Components](https://vaadin.com/docs/latest/ds/customization/styling-components) documentation.",
|
|
20
|
+
"extension": true,
|
|
21
|
+
"attributes": [
|
|
22
|
+
{
|
|
23
|
+
"name": ".img",
|
|
24
|
+
"description": "The path to the image",
|
|
25
|
+
"value": {
|
|
26
|
+
"kind": "expression"
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"name": ".abbr",
|
|
31
|
+
"description": "A shortened form of name that is displayed\nin the avatar when `img` is not provided.",
|
|
32
|
+
"value": {
|
|
33
|
+
"kind": "expression"
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"name": ".name",
|
|
38
|
+
"description": "Full name of the user\nused for the title of the avatar.",
|
|
39
|
+
"value": {
|
|
40
|
+
"kind": "expression"
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"name": ".colorIndex",
|
|
45
|
+
"description": "Color index used for avatar background.",
|
|
46
|
+
"value": {
|
|
47
|
+
"kind": "expression"
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"name": ".i18n",
|
|
52
|
+
"description": "The object used to localize this component.\nTo change the default localization, replace the entire\n_i18n_ object or just the property you want to modify.\n\nThe object has the following JSON structure and default values:\n {\n // Translation of the anonymous user avatar title.\n anonymous: 'anonymous'\n }",
|
|
53
|
+
"value": {
|
|
54
|
+
"kind": "expression"
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
]
|
|
58
|
+
}
|
|
59
|
+
]
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|