@fluentui-react-native/experimental-avatar 0.14.27 → 0.14.30
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/CHANGELOG.json +112 -1
- package/CHANGELOG.md +37 -2
- package/SPEC.md +310 -0
- package/lib/JSAvatar.d.ts.map +1 -1
- package/lib/JSAvatar.js +3 -1
- package/lib/JSAvatar.js.map +1 -1
- package/lib/JSAvatar.styling.d.ts.map +1 -1
- package/lib/JSAvatar.styling.js +18 -8
- package/lib/JSAvatar.styling.js.map +1 -1
- package/lib/JSAvatar.types.d.ts +15 -3
- package/lib/JSAvatar.types.d.ts.map +1 -1
- package/lib/JSAvatarTokens.d.ts.map +1 -1
- package/lib/JSAvatarTokens.js +73 -153
- package/lib/JSAvatarTokens.js.map +1 -1
- package/lib/JSAvatarTokens.win32.d.ts +5 -0
- package/lib/JSAvatarTokens.win32.d.ts.map +1 -0
- package/lib/JSAvatarTokens.win32.js +210 -0
- package/lib/JSAvatarTokens.win32.js.map +1 -0
- package/lib-commonjs/JSAvatar.d.ts.map +1 -1
- package/lib-commonjs/JSAvatar.js +3 -1
- package/lib-commonjs/JSAvatar.js.map +1 -1
- package/lib-commonjs/JSAvatar.styling.d.ts.map +1 -1
- package/lib-commonjs/JSAvatar.styling.js +18 -8
- package/lib-commonjs/JSAvatar.styling.js.map +1 -1
- package/lib-commonjs/JSAvatar.types.d.ts +15 -3
- package/lib-commonjs/JSAvatar.types.d.ts.map +1 -1
- package/lib-commonjs/JSAvatarTokens.d.ts.map +1 -1
- package/lib-commonjs/JSAvatarTokens.js +73 -153
- package/lib-commonjs/JSAvatarTokens.js.map +1 -1
- package/lib-commonjs/JSAvatarTokens.win32.d.ts +5 -0
- package/lib-commonjs/JSAvatarTokens.win32.d.ts.map +1 -0
- package/lib-commonjs/JSAvatarTokens.win32.js +214 -0
- package/lib-commonjs/JSAvatarTokens.win32.js.map +1 -0
- package/package.json +9 -8
- package/src/JSAvatar.styling.ts +22 -6
- package/src/JSAvatar.tsx +12 -1
- package/src/JSAvatar.types.ts +17 -3
- package/src/JSAvatarTokens.ts +74 -153
- package/src/JSAvatarTokens.win32.ts +213 -0
- package/src/__tests__/__snapshots__/JSAvatar.test.jsx.snap +59 -1
package/CHANGELOG.json
CHANGED
|
@@ -2,7 +2,118 @@
|
|
|
2
2
|
"name": "@fluentui-react-native/experimental-avatar",
|
|
3
3
|
"entries": [
|
|
4
4
|
{
|
|
5
|
-
"date": "
|
|
5
|
+
"date": "Sat, 21 May 2022 16:16:50 GMT",
|
|
6
|
+
"tag": "@fluentui-react-native/experimental-avatar_v0.14.30",
|
|
7
|
+
"version": "0.14.30",
|
|
8
|
+
"comments": {
|
|
9
|
+
"patch": [
|
|
10
|
+
{
|
|
11
|
+
"author": "v.kozova13@gmail.com",
|
|
12
|
+
"package": "@fluentui-react-native/experimental-avatar",
|
|
13
|
+
"commit": "313cc45fbeb5bfaff0b266194cc48608bf6d2c35",
|
|
14
|
+
"comment": "Added documentation for the Avatar"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"author": "beachball",
|
|
18
|
+
"package": "@fluentui-react-native/experimental-avatar",
|
|
19
|
+
"comment": "Bump @fluentui-react-native/badge to v0.0.36",
|
|
20
|
+
"commit": "313cc45fbeb5bfaff0b266194cc48608bf6d2c35"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"author": "beachball",
|
|
24
|
+
"package": "@fluentui-react-native/experimental-avatar",
|
|
25
|
+
"comment": "Bump @fluentui-react-native/framework to v0.7.28",
|
|
26
|
+
"commit": "313cc45fbeb5bfaff0b266194cc48608bf6d2c35"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"author": "beachball",
|
|
30
|
+
"package": "@fluentui-react-native/experimental-avatar",
|
|
31
|
+
"comment": "Bump @fluentui-react-native/icon to v0.11.23",
|
|
32
|
+
"commit": "313cc45fbeb5bfaff0b266194cc48608bf6d2c35"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"author": "beachball",
|
|
36
|
+
"package": "@fluentui-react-native/experimental-avatar",
|
|
37
|
+
"comment": "Bump @fluentui-react-native/interactive-hooks to v0.15.8",
|
|
38
|
+
"commit": "313cc45fbeb5bfaff0b266194cc48608bf6d2c35"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"author": "beachball",
|
|
42
|
+
"package": "@fluentui-react-native/experimental-avatar",
|
|
43
|
+
"comment": "Bump @fluentui-react-native/tokens to v0.12.2",
|
|
44
|
+
"commit": "313cc45fbeb5bfaff0b266194cc48608bf6d2c35"
|
|
45
|
+
}
|
|
46
|
+
]
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"date": "Sat, 21 May 2022 01:47:58 GMT",
|
|
51
|
+
"tag": "@fluentui-react-native/experimental-avatar_v0.14.29",
|
|
52
|
+
"version": "0.14.29",
|
|
53
|
+
"comments": {
|
|
54
|
+
"patch": [
|
|
55
|
+
{
|
|
56
|
+
"author": "beachball",
|
|
57
|
+
"package": "@fluentui-react-native/experimental-avatar",
|
|
58
|
+
"comment": "Bump @fluentui-react-native/badge to v0.0.35",
|
|
59
|
+
"commit": "36ea0d81629f9326eb8c23912d9949381014dade"
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"author": "beachball",
|
|
63
|
+
"package": "@fluentui-react-native/experimental-avatar",
|
|
64
|
+
"comment": "Bump @fluentui-react-native/framework to v0.7.27",
|
|
65
|
+
"commit": "36ea0d81629f9326eb8c23912d9949381014dade"
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
"author": "beachball",
|
|
69
|
+
"package": "@fluentui-react-native/experimental-avatar",
|
|
70
|
+
"comment": "Bump @fluentui-react-native/icon to v0.11.22",
|
|
71
|
+
"commit": "36ea0d81629f9326eb8c23912d9949381014dade"
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
"author": "beachball",
|
|
75
|
+
"package": "@fluentui-react-native/experimental-avatar",
|
|
76
|
+
"comment": "Bump @fluentui-react-native/interactive-hooks to v0.15.7",
|
|
77
|
+
"commit": "36ea0d81629f9326eb8c23912d9949381014dade"
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
"author": "beachball",
|
|
81
|
+
"package": "@fluentui-react-native/experimental-avatar",
|
|
82
|
+
"comment": "Bump @fluentui-react-native/theme-tokens to v0.16.3",
|
|
83
|
+
"commit": "36ea0d81629f9326eb8c23912d9949381014dade"
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
"author": "beachball",
|
|
87
|
+
"package": "@fluentui-react-native/experimental-avatar",
|
|
88
|
+
"comment": "Bump @fluentui-react-native/tokens to v0.12.1",
|
|
89
|
+
"commit": "36ea0d81629f9326eb8c23912d9949381014dade"
|
|
90
|
+
}
|
|
91
|
+
]
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
"date": "Thu, 19 May 2022 20:09:25 GMT",
|
|
96
|
+
"tag": "@fluentui-react-native/experimental-avatar_v0.14.28",
|
|
97
|
+
"version": "0.14.28",
|
|
98
|
+
"comments": {
|
|
99
|
+
"patch": [
|
|
100
|
+
{
|
|
101
|
+
"author": "v.kozova13@gmail.com",
|
|
102
|
+
"package": "@fluentui-react-native/experimental-avatar",
|
|
103
|
+
"commit": "afc5faf340ee104daf976801ce76962637fe0a61",
|
|
104
|
+
"comment": "Added color generator depending on theme"
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
"author": "beachball",
|
|
108
|
+
"package": "@fluentui-react-native/experimental-avatar",
|
|
109
|
+
"comment": "Bump @fluentui-react-native/badge to v0.0.34",
|
|
110
|
+
"commit": "afc5faf340ee104daf976801ce76962637fe0a61"
|
|
111
|
+
}
|
|
112
|
+
]
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
"date": "Tue, 17 May 2022 16:41:49 GMT",
|
|
6
117
|
"tag": "@fluentui-react-native/experimental-avatar_v0.14.27",
|
|
7
118
|
"version": "0.14.27",
|
|
8
119
|
"comments": {
|
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,47 @@
|
|
|
1
1
|
# Change Log - @fluentui-react-native/experimental-avatar
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Sat, 21 May 2022 16:16:50 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## 0.14.30
|
|
8
|
+
|
|
9
|
+
Sat, 21 May 2022 16:16:50 GMT
|
|
10
|
+
|
|
11
|
+
### Patches
|
|
12
|
+
|
|
13
|
+
- Added documentation for the Avatar (v.kozova13@gmail.com)
|
|
14
|
+
- Bump @fluentui-react-native/badge to v0.0.36
|
|
15
|
+
- Bump @fluentui-react-native/framework to v0.7.28
|
|
16
|
+
- Bump @fluentui-react-native/icon to v0.11.23
|
|
17
|
+
- Bump @fluentui-react-native/interactive-hooks to v0.15.8
|
|
18
|
+
- Bump @fluentui-react-native/tokens to v0.12.2
|
|
19
|
+
|
|
20
|
+
## 0.14.29
|
|
21
|
+
|
|
22
|
+
Sat, 21 May 2022 01:47:58 GMT
|
|
23
|
+
|
|
24
|
+
### Patches
|
|
25
|
+
|
|
26
|
+
- Bump @fluentui-react-native/badge to v0.0.35
|
|
27
|
+
- Bump @fluentui-react-native/framework to v0.7.27
|
|
28
|
+
- Bump @fluentui-react-native/icon to v0.11.22
|
|
29
|
+
- Bump @fluentui-react-native/interactive-hooks to v0.15.7
|
|
30
|
+
- Bump @fluentui-react-native/theme-tokens to v0.16.3
|
|
31
|
+
- Bump @fluentui-react-native/tokens to v0.12.1
|
|
32
|
+
|
|
33
|
+
## 0.14.28
|
|
34
|
+
|
|
35
|
+
Thu, 19 May 2022 20:09:25 GMT
|
|
36
|
+
|
|
37
|
+
### Patches
|
|
38
|
+
|
|
39
|
+
- Added color generator depending on theme (v.kozova13@gmail.com)
|
|
40
|
+
- Bump @fluentui-react-native/badge to v0.0.34
|
|
41
|
+
|
|
7
42
|
## 0.14.27
|
|
8
43
|
|
|
9
|
-
Tue, 17 May 2022 16:41:
|
|
44
|
+
Tue, 17 May 2022 16:41:49 GMT
|
|
10
45
|
|
|
11
46
|
### Patches
|
|
12
47
|
|
package/SPEC.md
ADDED
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
# Avatar
|
|
2
|
+
|
|
3
|
+
## Background
|
|
4
|
+
|
|
5
|
+
The Avatar component represents a person or entity. It displays the person's image, initials, or an icon, and can be either circular or square.
|
|
6
|
+
Previously it was a component PersonaCoin which used an old version of framework. There are more details in MIGRATION.md.
|
|
7
|
+
|
|
8
|
+
```ts
|
|
9
|
+
import { JSAvatar } from '@fluentui-react-native/experimental-avatar';
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Sample Code
|
|
13
|
+
|
|
14
|
+
Basic examples:
|
|
15
|
+
|
|
16
|
+
```jsx
|
|
17
|
+
<JSAvatar />
|
|
18
|
+
<JSAvatar icon={{ svgSource: { uri: 'https://www.example.com/test.svg', viewBox: '0 0 100 100' } }} size={120} />
|
|
19
|
+
<JSAvatar src="../../path-to-image.png" active="active" activeAppearance="ring" size={56} />
|
|
20
|
+
<JSAvatar shape="square" avatarColor="purple" name="Richard Feynman" />
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
More examples on the [Test pages for the Avatar](../../../apps/fluent-tester/src/FluentTester/TestComponents/Avatar). Instructions on running the tester app can be found [here](../../../apps/fluent-tester/README.md).
|
|
24
|
+
|
|
25
|
+
## Variants
|
|
26
|
+
|
|
27
|
+
### Active
|
|
28
|
+
|
|
29
|
+
Optional activity indicator.
|
|
30
|
+
Active prop can be `unset`, `active` and `inactive`. Default is `unset`.
|
|
31
|
+
|
|
32
|
+
- active: the avatar will be decorated according to activeAppearance, e.g. `ring`.
|
|
33
|
+
- inactive: the avatar will be partially transparent (0.8 opacity).
|
|
34
|
+
- unset: normal display
|
|
35
|
+
|
|
36
|
+
### ActiveAppearance
|
|
37
|
+
|
|
38
|
+
`activeAppearance` can be used when `active` prop set to `active`.
|
|
39
|
+
It adds `ring` as extra visual.
|
|
40
|
+
|
|
41
|
+
### Badge
|
|
42
|
+
|
|
43
|
+
The `Avatar` component can include presence badge when active prop is undefined or `unset`.
|
|
44
|
+
|
|
45
|
+
### Color
|
|
46
|
+
|
|
47
|
+
The Avatar supports color variants when displaying initials or an icon:
|
|
48
|
+
|
|
49
|
+
- Neutral - Gray (default).
|
|
50
|
+
- Brand - Brand colors from the theme
|
|
51
|
+
- Colorful - Pick from a list of pre-defined Avatar colors. The color will be assigned based on a hash of the name (to "randomly" assign a person a color). The color name (like darkRed) can also be specified explicitly in case the use case requires a different algorithm to pick the color.
|
|
52
|
+
|
|
53
|
+
### Icon
|
|
54
|
+
|
|
55
|
+
The `Avatar` component can include an `icon` that appears if there's no image or initials.
|
|
56
|
+
|
|
57
|
+
### Image
|
|
58
|
+
|
|
59
|
+
The `Avatar` component can include an `image`.
|
|
60
|
+
|
|
61
|
+
### Initials
|
|
62
|
+
|
|
63
|
+
Initials can be passed using `initials` prop or generated from `name` prop using getInitials method.
|
|
64
|
+
Here are the requirements from Web spec:
|
|
65
|
+
|
|
66
|
+
1. If only one word is provided, pull the first letter of the word.
|
|
67
|
+
2. If 2 words provided, pull first letter of both words.
|
|
68
|
+
3. If 2+ words provided, pull first letter of first word and last word.
|
|
69
|
+
4. Ignore suffixes (i.e. Jr, III).
|
|
70
|
+
5. Ignore words in parantheses Ignore special characters i.e. parantheses, dashes If numeric, fall back to Icon If first character is not alphabetic, fall back to icon.
|
|
71
|
+
|
|
72
|
+
But requirements are still being discussed. This area will be updated once we come up with final solition. There are different implementations in different teams.
|
|
73
|
+
|
|
74
|
+
### Name
|
|
75
|
+
|
|
76
|
+
Name prop is used to generate initials.
|
|
77
|
+
|
|
78
|
+
### Shape
|
|
79
|
+
|
|
80
|
+
The Avatar supports a circular and square (with rounded corners) shape.
|
|
81
|
+
|
|
82
|
+
### Sizes
|
|
83
|
+
|
|
84
|
+
`Avatar` supports next sizes: `20, 24, 28, 32, 36, 40, 48, 56, 64, 72, 96, 120`.
|
|
85
|
+
Default size for win32 is 24.
|
|
86
|
+
|
|
87
|
+
## API
|
|
88
|
+
|
|
89
|
+
### Slots
|
|
90
|
+
|
|
91
|
+
The `Avatar` component has the following slots:
|
|
92
|
+
|
|
93
|
+
- `root` - The outer container representing the `Avatar` wrapper.
|
|
94
|
+
- `image` - If specified, renders an `image`
|
|
95
|
+
- `initials` - If specified, renders initials when there's no `image`
|
|
96
|
+
- `icon` - If specified, renders an `icon` if there's no `image` or `initials`.
|
|
97
|
+
- `initialsBackground` - It's a wrapper for initials and icon.
|
|
98
|
+
- `ring` - If specified, renders the ring for the `Avatar` when active prop is set to `active`.
|
|
99
|
+
- `badge` - If specified, renders presence badge. Example: `badge={{ status: 'outOfOffice' }}.`.
|
|
100
|
+
|
|
101
|
+
The slots can be modified using the `compose` function on the `Avatar`. For more information on using the `compose` API, please see [this page](../../framework/composition/README.md).
|
|
102
|
+
|
|
103
|
+
### Props
|
|
104
|
+
|
|
105
|
+
```ts
|
|
106
|
+
export interface JSAvatarProps extends IViewProps, AvatarConfigurableProps {
|
|
107
|
+
/**
|
|
108
|
+
* Activity indicator
|
|
109
|
+
* * active: the avatar will be decorated according to activeAppearance
|
|
110
|
+
* * inactive: the avatar will be reduced in size and partially transparent
|
|
111
|
+
* * unset: normal display
|
|
112
|
+
*
|
|
113
|
+
* @defaultvalue unset
|
|
114
|
+
*/
|
|
115
|
+
active?: AvatarActive;
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* The appearance when `active="active"`
|
|
119
|
+
*
|
|
120
|
+
* @defaultvalue ring
|
|
121
|
+
*/
|
|
122
|
+
activeAppearance?: AvatarActiveAppearance;
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Badge shows the avatar's presence status.
|
|
126
|
+
* Badge can be shown only if `active` prop is undefined or unset
|
|
127
|
+
*/
|
|
128
|
+
badge?: PresenceBadgeProps;
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Icon to be displayed when the avatar doesn't have an image or initials.
|
|
132
|
+
*
|
|
133
|
+
* @defaultvalue `PersonRegular` (the default icon's size depends on the Avatar's size)
|
|
134
|
+
*/
|
|
135
|
+
icon?: IconSourcesType;
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Specify a string to be used instead of the name, to determine which color to use when color="colorful".
|
|
139
|
+
* Use this when a name is not available, but there is another unique identifier that can be used instead.
|
|
140
|
+
*/
|
|
141
|
+
idForColor?: string;
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* The Avatar's image.
|
|
145
|
+
*/
|
|
146
|
+
image?: ImageProps;
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* The initials are displayed when there is no image (including while the image is loading).
|
|
150
|
+
*
|
|
151
|
+
* It is usually not necessary to specify custom initials; by default they will be derived from the `name` prop, using the `getInitials` function.
|
|
152
|
+
*/
|
|
153
|
+
initials?: string;
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* The name of the person or entity represented by this Avatar. This should always be provided if it is available.
|
|
157
|
+
*
|
|
158
|
+
* The name will be used to determine the initials displayed when there is no icon, as well as provided to
|
|
159
|
+
* accessibility tools.
|
|
160
|
+
*/
|
|
161
|
+
name?: string;
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* Size of the avatar in pixels.
|
|
165
|
+
*
|
|
166
|
+
* Size is restricted to a limited set of supported values recommended for most uses (see `AvatarSizeValue`) and
|
|
167
|
+
* based on design guidelines for the Avatar control.
|
|
168
|
+
*
|
|
169
|
+
* @defaultvalue 24
|
|
170
|
+
*/
|
|
171
|
+
size?: AvatarSize;
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* The avatar can have a circular or square shape.
|
|
175
|
+
* @defaultvalue circular
|
|
176
|
+
*/
|
|
177
|
+
shape?: AvatarShape;
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* Currently used for image URL, will be deprecated when image prop works
|
|
181
|
+
*/
|
|
182
|
+
src?: string;
|
|
183
|
+
}
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
### Styling Tokens
|
|
187
|
+
|
|
188
|
+
Tokens can be used to customize the styling of the control by using the `customize` function on the `Avatar`. For more information on using the `customize` API, please see [this page](../../framework/composition/README.md). The `Avatar` has the following tokens:
|
|
189
|
+
|
|
190
|
+
```ts
|
|
191
|
+
export interface JSAvatarTokens extends IBackgroundColorTokens, IForegroundColorTokens, AvatarConfigurableProps, IBorderTokens, FontTokens {
|
|
192
|
+
/**
|
|
193
|
+
* Avatar ocality which is changed depending on `active` prop.
|
|
194
|
+
*/
|
|
195
|
+
avatarOpacity?: number;
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* The size of presence badge.
|
|
199
|
+
*/
|
|
200
|
+
badgeSize?: BadgeSize;
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* The icon color.
|
|
204
|
+
*/
|
|
205
|
+
iconColor?: ColorValue;
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* The size of the icon.
|
|
209
|
+
*/
|
|
210
|
+
iconSize?: number;
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* The height of the avatar.
|
|
214
|
+
*/
|
|
215
|
+
height?: number;
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* Avatar shapes:
|
|
219
|
+
*/
|
|
220
|
+
circular?: JSAvatarTokens;
|
|
221
|
+
square?: JSAvatarTokens;
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* Token for inactive value of `active` prop
|
|
225
|
+
*/
|
|
226
|
+
inactive?: JSAvatarTokens;
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* The width of the avatar.
|
|
230
|
+
*/
|
|
231
|
+
width?: number;
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* Avatar sizes:
|
|
235
|
+
*/
|
|
236
|
+
size20?: JSAvatarTokens;
|
|
237
|
+
size24?: JSAvatarTokens;
|
|
238
|
+
size28?: JSAvatarTokens;
|
|
239
|
+
size32?: JSAvatarTokens;
|
|
240
|
+
size36?: JSAvatarTokens;
|
|
241
|
+
size40?: JSAvatarTokens;
|
|
242
|
+
size48?: JSAvatarTokens;
|
|
243
|
+
size56?: JSAvatarTokens;
|
|
244
|
+
size64?: JSAvatarTokens;
|
|
245
|
+
size72?: JSAvatarTokens;
|
|
246
|
+
size96?: JSAvatarTokens;
|
|
247
|
+
size120?: JSAvatarTokens;
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* Avatar colors:
|
|
251
|
+
*/
|
|
252
|
+
neutral?: JSAvatarTokens;
|
|
253
|
+
brand?: JSAvatarTokens;
|
|
254
|
+
darkRed?: JSAvatarTokens;
|
|
255
|
+
cranberry?: JSAvatarTokens;
|
|
256
|
+
red?: JSAvatarTokens;
|
|
257
|
+
pumpkin?: JSAvatarTokens;
|
|
258
|
+
peach?: JSAvatarTokens;
|
|
259
|
+
marigold?: JSAvatarTokens;
|
|
260
|
+
gold?: JSAvatarTokens;
|
|
261
|
+
brass?: JSAvatarTokens;
|
|
262
|
+
brown?: JSAvatarTokens;
|
|
263
|
+
forest?: JSAvatarTokens;
|
|
264
|
+
seafoam?: JSAvatarTokens;
|
|
265
|
+
darkGreen?: JSAvatarTokens;
|
|
266
|
+
lightTeal?: JSAvatarTokens;
|
|
267
|
+
teal?: JSAvatarTokens;
|
|
268
|
+
steel?: JSAvatarTokens;
|
|
269
|
+
blue?: JSAvatarTokens;
|
|
270
|
+
royalBlue?: JSAvatarTokens;
|
|
271
|
+
cornflower?: JSAvatarTokens;
|
|
272
|
+
navy?: JSAvatarTokens;
|
|
273
|
+
lavender?: JSAvatarTokens;
|
|
274
|
+
purple?: JSAvatarTokens;
|
|
275
|
+
grape?: JSAvatarTokens;
|
|
276
|
+
lilac?: JSAvatarTokens;
|
|
277
|
+
pink?: JSAvatarTokens;
|
|
278
|
+
magenta?: JSAvatarTokens;
|
|
279
|
+
plum?: JSAvatarTokens;
|
|
280
|
+
beige?: JSAvatarTokens;
|
|
281
|
+
mink?: JSAvatarTokens;
|
|
282
|
+
platinum?: JSAvatarTokens;
|
|
283
|
+
anchor?: JSAvatarTokens;
|
|
284
|
+
}
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
## Behaviors
|
|
288
|
+
|
|
289
|
+
### States
|
|
290
|
+
|
|
291
|
+
The following section describes the different states which `Avatar` can be in as a result of interaction.
|
|
292
|
+
|
|
293
|
+
#### showRing state
|
|
294
|
+
|
|
295
|
+
Ring is shown when `showRing` is set to true
|
|
296
|
+
|
|
297
|
+
#### transparentRing state
|
|
298
|
+
|
|
299
|
+
Makes ring transparent
|
|
300
|
+
|
|
301
|
+
#### showBadge state
|
|
302
|
+
|
|
303
|
+
showBadge is set to true when `active` prop is `unset` or undefined
|
|
304
|
+
|
|
305
|
+
### Interaction
|
|
306
|
+
|
|
307
|
+
For now Avatar doesn't support interactions.
|
|
308
|
+
For the next step we will need to add tooltip and onClick handler.
|
|
309
|
+
|
|
310
|
+
## Accessibility
|
package/lib/JSAvatar.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"JSAvatar.d.ts","sourceRoot":"","sources":["../src/JSAvatar.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAA8B,aAAa,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"JSAvatar.d.ts","sourceRoot":"","sources":["../src/JSAvatar.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAA8B,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAS5F;;;;;;;GAOG;AACH,eAAO,MAAM,YAAY,UAAW,MAAM,SAAS,aAAa,aAAa,aAAa,KAAG,OAa5F,CAAC;AAEF,eAAO,MAAM,QAAQ,8KA+CnB,CAAC"}
|
package/lib/JSAvatar.js
CHANGED
|
@@ -29,6 +29,7 @@ import { useAvatar } from './useAvatar';
|
|
|
29
29
|
import { PresenceBadge } from '@fluentui-react-native/badge';
|
|
30
30
|
import { Icon } from '@fluentui-react-native/icon';
|
|
31
31
|
import { createIconProps } from '@fluentui-react-native/interactive-hooks';
|
|
32
|
+
import { SvgXml } from 'react-native-svg';
|
|
32
33
|
/**
|
|
33
34
|
* A function which determines if a set of styles should be applied to the compoent given the current state and props of the avatar.
|
|
34
35
|
*
|
|
@@ -65,8 +66,9 @@ export var JSAvatar = compose(__assign(__assign({ displayName: JSAvatarName }, s
|
|
|
65
66
|
var _a = mergeProps(avatar.props, final), activeAppearance = _a.activeAppearance, icon = _a.icon, initials = _a.initials, image = _a.image, badge = _a.badge, mergedProps = __rest(_a, ["activeAppearance", "icon", "initials", "image", "badge"]);
|
|
66
67
|
var _b = avatar.state, showRing = _b.showRing, transparentRing = _b.transparentRing, showBadge = _b.showBadge;
|
|
67
68
|
var svgIconsEnabled = ['ios', 'macos', 'win32', 'android'].includes(Platform.OS);
|
|
69
|
+
var fallBackIconXml = "<svg width=\"14\" height=\"16\" viewBox=\"0 0 14 16\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M7 0C4.79086 0 3 1.79086 3 4C3 6.20914 4.79086 8 7 8C9.20914 8 11 6.20914 11 4C11 1.79086 9.20914 0 7 0ZM4 4C4 2.34315 5.34315 1 7 1C8.65685 1 10 2.34315 10 4C10 5.65685 8.65685 7 7 7C5.34315 7 4 5.65685 4 4ZM2.00873 9C0.903151 9 0 9.88687 0 11C0 12.6912 0.83281 13.9663 2.13499 14.7966C3.41697 15.614 5.14526 16 7 16C8.85474 16 10.583 15.614 11.865 14.7966C13.1672 13.9663 14 12.6912 14 11C14 9.89557 13.1045 9.00001 12 9.00001L2.00873 9ZM1 11C1 10.4467 1.44786 10 2.00873 10L12 10C12.5522 10 13 10.4478 13 11C13 12.3088 12.3777 13.2837 11.3274 13.9534C10.2568 14.636 8.73511 15 7 15C5.26489 15 3.74318 14.636 2.67262 13.9534C1.62226 13.2837 1 12.3088 1 11Z\" fill=\"currentColor\"/>\n </svg>\n ";
|
|
68
70
|
return (withSlots(Slots.root, __assign({}, mergedProps),
|
|
69
|
-
image.source ? (withSlots(Slots.image, __assign({}, image))) : (withSlots(Slots.initialsBackground, null, initials ? withSlots(Slots.initials, null, initials) : userProps.icon
|
|
71
|
+
image.source ? (withSlots(Slots.image, __assign({}, image))) : (withSlots(Slots.initialsBackground, null, initials ? (withSlots(Slots.initials, null, initials)) : userProps.icon ? (withSlots(Slots.icon, __assign({}, iconProps))) : (withSlots(SvgXml, { xml: fallBackIconXml })))),
|
|
70
72
|
showRing && !transparentRing && withSlots(Slots.ring, null),
|
|
71
73
|
svgIconsEnabled && showBadge && withSlots(Slots.badge, __assign({}, badge))));
|
|
72
74
|
};
|
package/lib/JSAvatar.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"JSAvatar.js","sourceRoot":"","sources":["../src/JSAvatar.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,qBAAqB;AACrB,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAC3D,OAAO,EAA+B,YAAY,EAAiB,MAAM,kBAAkB,CAAC;AAC5F,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,OAAO,EAAY,UAAU,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAC5F,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,0CAA0C,CAAC;
|
|
1
|
+
{"version":3,"file":"JSAvatar.js","sourceRoot":"","sources":["../src/JSAvatar.tsx"],"names":[],"mappings":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AK,CAAC,KAAK,eAAK,KAAK,EAAI,CAC3B,CAAC,CAAC,CAAC,CACF,UAAC,KAAK,CAAC,kBAAkB,QACtB,QAAQ,CAAC,CAAC,CAAC,CACV,UAAC,KAAK,CAAC,QAAQ,QAAE,QAAQ,CAAkB,CAC5C,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CACnB,UAAC,KAAK,CAAC,IAAI,eAAK,SAAS,EAAI,CAC9B,CAAC,CAAC,CAAC,CACF,UAAC,MAAM,IAAC,GAAG,EAAE,eAAe,GAAI,CACjC,CACwB,CAC5B;gBACA,QAAQ,IAAI,CAAC,eAAe,IAAI,UAAC,KAAK,CAAC,IAAI,OAAG;gBAC9C,eAAe,IAAI,SAAS,IAAI,UAAC,KAAK,CAAC,KAAK,eAAK,KAAK,EAAI,CAChD,CACd,CAAC;QACJ,CAAC,CAAC;IACJ,CAAC,IACD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"JSAvatar.styling.d.ts","sourceRoot":"","sources":["../src/JSAvatar.styling.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,cAAc,EAAE,eAAe,EAAE,aAAa,EAAsC,MAAM,kBAAkB,CAAC;AACpI,OAAO,EAAS,iBAAiB,EAAc,MAAM,kCAAkC,CAAC;AAYxF,eAAO,MAAM,YAAY,EAAE,CAAC,MAAM,cAAc,CAAC,
|
|
1
|
+
{"version":3,"file":"JSAvatar.styling.d.ts","sourceRoot":"","sources":["../src/JSAvatar.styling.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,cAAc,EAAE,eAAe,EAAE,aAAa,EAAsC,MAAM,kBAAkB,CAAC;AACpI,OAAO,EAAS,iBAAiB,EAAc,MAAM,kCAAkC,CAAC;AAYxF,eAAO,MAAM,YAAY,EAAE,CAAC,MAAM,cAAc,CAAC,EAShD,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,iBAAiB,CAAC,aAAa,EAAE,eAAe,EAAE,cAAc,CA+G7F,CAAC"}
|
package/lib/JSAvatar.styling.js
CHANGED
|
@@ -28,7 +28,14 @@ var nameMap = {
|
|
|
28
28
|
center: 'center',
|
|
29
29
|
end: 'flex-end',
|
|
30
30
|
};
|
|
31
|
-
export var avatarStates = __spreadArray(__spreadArray(__spreadArray([], AvatarColors, true), AvatarSizesForTokens, true), [
|
|
31
|
+
export var avatarStates = __spreadArray(__spreadArray(__spreadArray([], AvatarColors, true), AvatarSizesForTokens, true), [
|
|
32
|
+
'circular',
|
|
33
|
+
'square',
|
|
34
|
+
'inactive',
|
|
35
|
+
'ringColor',
|
|
36
|
+
'ringBackgroundColor',
|
|
37
|
+
'iconColor',
|
|
38
|
+
], false);
|
|
32
39
|
export var stylingSettings = {
|
|
33
40
|
tokens: [defaultJSAvatarTokens, JSAvatarName],
|
|
34
41
|
states: avatarStates,
|
|
@@ -50,39 +57,42 @@ export var stylingSettings = {
|
|
|
50
57
|
}, ['horizontalIconAlignment', 'verticalIconAlignment', 'avatarOpacity', 'height', 'width']),
|
|
51
58
|
initials: buildProps(function (tokens, theme) {
|
|
52
59
|
return {
|
|
53
|
-
style: __assign(__assign({}, fontStyles.from(tokens, theme)), { color: tokens.color }),
|
|
60
|
+
style: __assign(__assign({}, fontStyles.from(tokens, theme)), { color: tokens.color, textAlign: 'center' }),
|
|
54
61
|
};
|
|
55
62
|
}, __spreadArray(['color'], fontStyles.keys, true)),
|
|
56
63
|
initialsBackground: buildProps(function (tokens, theme) {
|
|
57
64
|
var backgroundColor = tokens.backgroundColor;
|
|
58
65
|
return {
|
|
59
|
-
style: __assign(__assign({}, borderStyles.from(tokens, theme)), { width: tokens.width, height: tokens.height, flexGrow: 1, alignSelf: 'stretch', justifyContent: 'center', alignItems: 'center', backgroundColor: backgroundColor }),
|
|
66
|
+
style: __assign(__assign({}, borderStyles.from(tokens, theme)), { width: tokens.width, height: tokens.height, flexGrow: 1, alignSelf: 'stretch', justifyContent: 'center', alignItems: 'center', backgroundColor: backgroundColor, borderWidth: tokens.borderWidth, borderColor: tokens.borderColor }),
|
|
60
67
|
};
|
|
61
|
-
}, __spreadArray(['backgroundColor', 'width', 'height'], borderStyles.keys, true)),
|
|
68
|
+
}, __spreadArray(['backgroundColor', 'width', 'height', 'borderColor', 'borderWidth'], borderStyles.keys, true)),
|
|
62
69
|
image: buildProps(function (tokens) {
|
|
63
70
|
return {
|
|
64
71
|
style: {
|
|
65
72
|
borderRadius: tokens.borderRadius,
|
|
66
73
|
width: tokens.width,
|
|
67
74
|
height: tokens.height,
|
|
75
|
+
borderWidth: tokens.borderWidth,
|
|
76
|
+
borderColor: tokens.borderColor,
|
|
68
77
|
},
|
|
69
78
|
};
|
|
70
|
-
}, ['borderRadius', 'width', 'height']),
|
|
79
|
+
}, ['borderRadius', 'width', 'height', 'borderColor', 'borderWidth']),
|
|
71
80
|
icon: buildProps(function (tokens) {
|
|
72
81
|
return {
|
|
73
82
|
style: {
|
|
74
83
|
position: 'absolute',
|
|
84
|
+
color: tokens.iconColor,
|
|
75
85
|
width: tokens.iconSize,
|
|
76
86
|
height: tokens.iconSize,
|
|
77
87
|
},
|
|
78
88
|
};
|
|
79
|
-
}, ['iconSize']),
|
|
89
|
+
}, ['iconSize', 'iconColor']),
|
|
80
90
|
ring: buildProps(function (tokens, theme) {
|
|
81
91
|
var ringConfig = getRingConfig(tokens.width);
|
|
82
92
|
return {
|
|
83
|
-
style: __assign({ borderStyle: 'solid',
|
|
93
|
+
style: __assign(__assign({ borderStyle: 'solid', width: ringConfig.size, height: ringConfig.size, position: 'absolute', top: -ringConfig.stroke * 2, left: -ringConfig.stroke * 2 }, borderStyles.from(tokens, theme)), { borderWidth: ringConfig.stroke, borderColor: tokens.ringColor }),
|
|
84
94
|
};
|
|
85
|
-
}, __spreadArray(['width', 'height'], borderStyles.keys, true)),
|
|
95
|
+
}, __spreadArray(['width', 'height', 'ringColor'], borderStyles.keys, true)),
|
|
86
96
|
badge: buildProps(function (tokens) {
|
|
87
97
|
return {
|
|
88
98
|
size: tokens.badgeSize,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"JSAvatar.styling.js","sourceRoot":"","sources":["../src/JSAvatar.styling.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,YAAY,EAAkD,YAAY,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACpI,OAAO,EAA4B,UAAU,EAAE,MAAM,kCAAkC,CAAC;AACxF,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAEzD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAEzE,IAAM,OAAO,GAA8B;IACzC,KAAK,EAAE,YAAY;IACnB,MAAM,EAAE,QAAQ;IAChB,GAAG,EAAE,UAAU;CAChB,CAAC;AAEF,MAAM,CAAC,IAAM,YAAY,
|
|
1
|
+
{"version":3,"file":"JSAvatar.styling.js","sourceRoot":"","sources":["../src/JSAvatar.styling.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,YAAY,EAAkD,YAAY,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACpI,OAAO,EAA4B,UAAU,EAAE,MAAM,kCAAkC,CAAC;AACxF,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAEzD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAEzE,IAAM,OAAO,GAA8B;IACzC,KAAK,EAAE,YAAY;IACnB,MAAM,EAAE,QAAQ;IAChB,GAAG,EAAE,UAAU;CAChB,CAAC;AAEF,MAAM,CAAC,IAAM,YAAY,iDACpB,YAAY,SACZ,oBAAoB;IACvB,UAAU;IACV,QAAQ;IACR,UAAU;IACV,WAAW;IACX,qBAAq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,CAAC,IAAI,EACtB,MAAM,EAAE,UAAU,CAAC,IAAI,EACvB,QAAQ,EAAE,UAAU,EACpB,GAAG,EAAE,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,EAC3B,IAAI,EAAE,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,IACzB,YAAY,CAAC,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,KACnC,WAAW,EAAE,UAAU,CAAC,MAAM,EAC9B,WAAW,EAAE,MAAM,CAAC,SAAS,GAC9B;aACF,CAAC;QACJ,CAAC,iBACA,OAAO,EAAE,QAAQ,EAAE,WAAW,GAAK,YAAY,CAAC,IAAI,QACtD;QACD,KAAK,EAAE,UAAU,CACf,UAAC,MAAsB;YACrB,OAAO;gBACL,IAAI,EAAE,MAAM,CAAC,SAAS;gBACtB,KAAK,EAAE,UAAU;aAClB,CAAC;QACJ,CAAC,EACD,CAAC,WAAW,CAAC,CACd;KACF;CACF,CAAC"}
|
package/lib/JSAvatar.types.d.ts
CHANGED
|
@@ -14,13 +14,12 @@ export declare type AvatarSize = typeof AvatarSizes[number];
|
|
|
14
14
|
export declare type AvatarNamedColor = typeof AvatarColors[number];
|
|
15
15
|
export declare type AvatarShape = 'circular' | 'square';
|
|
16
16
|
export declare type AvatarActive = 'active' | 'inactive' | 'unset';
|
|
17
|
-
export declare type AvatarActiveAppearance = 'ring'
|
|
17
|
+
export declare type AvatarActiveAppearance = 'ring';
|
|
18
18
|
export declare type AvatarColor = 'neutral' | 'brand' | 'colorful' | AvatarNamedColor;
|
|
19
19
|
export declare type IconAlignment = 'start' | 'center' | 'end';
|
|
20
20
|
export interface RingConfig {
|
|
21
21
|
accent?: boolean;
|
|
22
22
|
transparent?: boolean;
|
|
23
|
-
ringBackgroundColor?: ColorValue;
|
|
24
23
|
ringThickness?: number;
|
|
25
24
|
innerGap?: number;
|
|
26
25
|
}
|
|
@@ -53,6 +52,10 @@ export interface JSAvatarProps extends IViewProps, AvatarConfigurableProps {
|
|
|
53
52
|
* @defaultvalue ring
|
|
54
53
|
*/
|
|
55
54
|
activeAppearance?: AvatarActiveAppearance;
|
|
55
|
+
/**
|
|
56
|
+
* Badge shows the avatar's presence status.
|
|
57
|
+
* Badge can be shown only if `active` prop is undefined or unset
|
|
58
|
+
*/
|
|
56
59
|
badge?: PresenceBadgeProps;
|
|
57
60
|
/**
|
|
58
61
|
* Icon to be displayed when the avatar doesn't have an image or initials.
|
|
@@ -64,7 +67,10 @@ export interface JSAvatarProps extends IViewProps, AvatarConfigurableProps {
|
|
|
64
67
|
* Specify a string to be used instead of the name, to determine which color to use when color="colorful".
|
|
65
68
|
* Use this when a name is not available, but there is another unique identifier that can be used instead.
|
|
66
69
|
*/
|
|
67
|
-
idForColor?: string
|
|
70
|
+
idForColor?: string;
|
|
71
|
+
/**
|
|
72
|
+
* The Avatar's image.
|
|
73
|
+
*/
|
|
68
74
|
image?: ImageProps;
|
|
69
75
|
/**
|
|
70
76
|
* (optional) Custom initials.
|
|
@@ -96,14 +102,20 @@ export interface JSAvatarProps extends IViewProps, AvatarConfigurableProps {
|
|
|
96
102
|
* @defaultvalue circular
|
|
97
103
|
*/
|
|
98
104
|
shape?: AvatarShape;
|
|
105
|
+
/**
|
|
106
|
+
* Currently used for image URL, will be deprecated when image prop works
|
|
107
|
+
*/
|
|
99
108
|
src?: string;
|
|
100
109
|
}
|
|
101
110
|
export interface JSAvatarTokens extends IBackgroundColorTokens, IForegroundColorTokens, AvatarConfigurableProps, IBorderTokens, FontTokens {
|
|
111
|
+
iconColor?: ColorValue;
|
|
102
112
|
iconSize?: number;
|
|
103
113
|
height?: number;
|
|
104
114
|
horizontalIconAlignment?: IconAlignment;
|
|
105
115
|
verticalIconAlignment?: IconAlignment;
|
|
106
116
|
circular?: JSAvatarTokens;
|
|
117
|
+
ringColor?: ColorValue;
|
|
118
|
+
ringBackgroundColor?: ColorValue;
|
|
107
119
|
square?: JSAvatarTokens;
|
|
108
120
|
inactive?: JSAvatarTokens;
|
|
109
121
|
avatarOpacity?: number;
|