@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.
Files changed (40) hide show
  1. package/CHANGELOG.json +112 -1
  2. package/CHANGELOG.md +37 -2
  3. package/SPEC.md +310 -0
  4. package/lib/JSAvatar.d.ts.map +1 -1
  5. package/lib/JSAvatar.js +3 -1
  6. package/lib/JSAvatar.js.map +1 -1
  7. package/lib/JSAvatar.styling.d.ts.map +1 -1
  8. package/lib/JSAvatar.styling.js +18 -8
  9. package/lib/JSAvatar.styling.js.map +1 -1
  10. package/lib/JSAvatar.types.d.ts +15 -3
  11. package/lib/JSAvatar.types.d.ts.map +1 -1
  12. package/lib/JSAvatarTokens.d.ts.map +1 -1
  13. package/lib/JSAvatarTokens.js +73 -153
  14. package/lib/JSAvatarTokens.js.map +1 -1
  15. package/lib/JSAvatarTokens.win32.d.ts +5 -0
  16. package/lib/JSAvatarTokens.win32.d.ts.map +1 -0
  17. package/lib/JSAvatarTokens.win32.js +210 -0
  18. package/lib/JSAvatarTokens.win32.js.map +1 -0
  19. package/lib-commonjs/JSAvatar.d.ts.map +1 -1
  20. package/lib-commonjs/JSAvatar.js +3 -1
  21. package/lib-commonjs/JSAvatar.js.map +1 -1
  22. package/lib-commonjs/JSAvatar.styling.d.ts.map +1 -1
  23. package/lib-commonjs/JSAvatar.styling.js +18 -8
  24. package/lib-commonjs/JSAvatar.styling.js.map +1 -1
  25. package/lib-commonjs/JSAvatar.types.d.ts +15 -3
  26. package/lib-commonjs/JSAvatar.types.d.ts.map +1 -1
  27. package/lib-commonjs/JSAvatarTokens.d.ts.map +1 -1
  28. package/lib-commonjs/JSAvatarTokens.js +73 -153
  29. package/lib-commonjs/JSAvatarTokens.js.map +1 -1
  30. package/lib-commonjs/JSAvatarTokens.win32.d.ts +5 -0
  31. package/lib-commonjs/JSAvatarTokens.win32.d.ts.map +1 -0
  32. package/lib-commonjs/JSAvatarTokens.win32.js +214 -0
  33. package/lib-commonjs/JSAvatarTokens.win32.js.map +1 -0
  34. package/package.json +9 -8
  35. package/src/JSAvatar.styling.ts +22 -6
  36. package/src/JSAvatar.tsx +12 -1
  37. package/src/JSAvatar.types.ts +17 -3
  38. package/src/JSAvatarTokens.ts +74 -153
  39. package/src/JSAvatarTokens.win32.ts +213 -0
  40. package/src/__tests__/__snapshots__/JSAvatar.test.jsx.snap +59 -1
@@ -0,0 +1,214 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.defaultJSAvatarTokens = void 0;
4
+ var theme_tokens_1 = require("@fluentui-react-native/theme-tokens");
5
+ var defaultJSAvatarTokens = function (t) {
6
+ return ({
7
+ horizontalIconAlignment: 'end',
8
+ verticalIconAlignment: 'end',
9
+ color: theme_tokens_1.globalTokens.color.white,
10
+ backgroundColor: theme_tokens_1.globalTokens.color.cornflower.primary,
11
+ avatarOpacity: 1,
12
+ fontFamily: t.typography.families.primary,
13
+ fontWeight: theme_tokens_1.globalTokens.font.weight.semibold,
14
+ fontSize: theme_tokens_1.globalTokens.font.size[200],
15
+ width: 24,
16
+ height: 24,
17
+ iconSize: 16,
18
+ iconColor: theme_tokens_1.globalTokens.color.white,
19
+ ringColor: t.colors.transparentStroke,
20
+ borderColor: theme_tokens_1.globalTokens.color.white,
21
+ borderWidth: t.name === 'HighContrast' ? 1 : 0,
22
+ circular: {
23
+ borderRadius: theme_tokens_1.globalTokens.corner.radius.circle,
24
+ },
25
+ square: {
26
+ borderRadius: theme_tokens_1.globalTokens.corner.radius.medium,
27
+ },
28
+ inactive: {
29
+ avatarOpacity: 0.8,
30
+ },
31
+ size20: {
32
+ width: 20,
33
+ height: 20,
34
+ badgeSize: 'smallest',
35
+ iconSize: 16,
36
+ fontSize: theme_tokens_1.globalTokens.font.size[100],
37
+ square: {
38
+ borderRadius: theme_tokens_1.globalTokens.corner.radius.small,
39
+ },
40
+ },
41
+ size24: {
42
+ width: 24,
43
+ height: 24,
44
+ badgeSize: 'smallest',
45
+ iconSize: 16,
46
+ fontSize: theme_tokens_1.globalTokens.font.size[100],
47
+ square: {
48
+ borderRadius: theme_tokens_1.globalTokens.corner.radius.small,
49
+ },
50
+ },
51
+ size28: {
52
+ width: 28,
53
+ height: 28,
54
+ badgeSize: 'smaller',
55
+ iconSize: 20,
56
+ fontWeight: theme_tokens_1.globalTokens.font.weight.semibold,
57
+ fontSize: theme_tokens_1.globalTokens.font.size[100],
58
+ },
59
+ size32: {
60
+ width: 32,
61
+ height: 32,
62
+ badgeSize: 'smaller',
63
+ iconSize: 20,
64
+ fontSize: theme_tokens_1.globalTokens.font.size[100],
65
+ },
66
+ size36: {
67
+ width: 36,
68
+ height: 36,
69
+ badgeSize: 'smaller',
70
+ iconSize: 20,
71
+ },
72
+ size40: {
73
+ width: 40,
74
+ height: 40,
75
+ badgeSize: 'small',
76
+ iconSize: 20,
77
+ },
78
+ size48: {
79
+ width: 48,
80
+ height: 48,
81
+ badgeSize: 'small',
82
+ iconSize: 24,
83
+ },
84
+ size56: {
85
+ width: 56,
86
+ height: 56,
87
+ badgeSize: 'medium',
88
+ iconSize: 28,
89
+ fontSize: theme_tokens_1.globalTokens.font.size[400],
90
+ square: {
91
+ borderRadius: theme_tokens_1.globalTokens.corner.radius.large,
92
+ },
93
+ },
94
+ size64: {
95
+ width: 64,
96
+ height: 64,
97
+ badgeSize: 'large',
98
+ iconSize: 32,
99
+ fontSize: theme_tokens_1.globalTokens.font.size[500],
100
+ square: {
101
+ borderRadius: theme_tokens_1.globalTokens.corner.radius.large,
102
+ },
103
+ },
104
+ size72: {
105
+ width: 72,
106
+ height: 72,
107
+ badgeSize: 'large',
108
+ iconSize: 32,
109
+ fontSize: theme_tokens_1.globalTokens.font.size[500],
110
+ square: {
111
+ borderRadius: theme_tokens_1.globalTokens.corner.radius.large,
112
+ },
113
+ },
114
+ size96: {
115
+ width: 96,
116
+ height: 96,
117
+ badgeSize: 'largest',
118
+ iconSize: 48,
119
+ fontWeight: theme_tokens_1.globalTokens.font.weight.regular,
120
+ fontSize: theme_tokens_1.globalTokens.font.size[700],
121
+ square: {
122
+ borderRadius: theme_tokens_1.globalTokens.corner.radius.extraLarge,
123
+ },
124
+ },
125
+ size120: {
126
+ width: 120,
127
+ height: 120,
128
+ badgeSize: 'largest',
129
+ iconSize: 48,
130
+ fontWeight: theme_tokens_1.globalTokens.font.weight.regular,
131
+ fontSize: theme_tokens_1.globalTokens.font.size[900],
132
+ square: {
133
+ borderRadius: theme_tokens_1.globalTokens.corner.radius.extraLarge,
134
+ },
135
+ },
136
+ neutral: {
137
+ backgroundColor: t.colors.neutralBackground6,
138
+ color: t.colors.neutralForeground3,
139
+ ringColor: t.colors.transparentStroke,
140
+ },
141
+ brand: {
142
+ backgroundColor: t.colors.brandBackgroundStatic,
143
+ color: t.colors.neutralForegroundOnBrand,
144
+ ringColor: t.colors.transparentStroke,
145
+ },
146
+ darkRed: getColorProps('darkRed', t),
147
+ cranberry: getColorProps('cranberry', t),
148
+ red: getColorProps('red', t),
149
+ pumpkin: getColorProps('pumpkin', t),
150
+ peach: getColorProps('peach', t),
151
+ marigold: getColorProps('marigold', t),
152
+ gold: getColorProps('gold', t),
153
+ brass: getColorProps('brass', t),
154
+ brown: getColorProps('brown', t),
155
+ forest: getColorProps('forest', t),
156
+ seafoam: getColorProps('seafoam', t),
157
+ darkGreen: getColorProps('darkGreen', t),
158
+ lightTeal: getColorProps('lightTeal', t),
159
+ teal: getColorProps('teal', t),
160
+ steel: getColorProps('steel', t),
161
+ blue: getColorProps('blue', t),
162
+ royalBlue: getColorProps('royalBlue', t),
163
+ cornflower: getColorProps('cornflower', t),
164
+ navy: getColorProps('navy', t),
165
+ lavender: getColorProps('lavender', t),
166
+ purple: getColorProps('purple', t),
167
+ grape: getColorProps('grape', t),
168
+ lilac: getColorProps('lilac', t),
169
+ pink: getColorProps('pink', t),
170
+ magenta: getColorProps('magenta', t),
171
+ plum: getColorProps('plum', t),
172
+ beige: getColorProps('beige', t),
173
+ mink: getColorProps('mink', t),
174
+ platinum: getColorProps('platinum', t),
175
+ anchor: getColorProps('anchor', t),
176
+ });
177
+ };
178
+ exports.defaultJSAvatarTokens = defaultJSAvatarTokens;
179
+ /**
180
+ * A function which returns object of props depending on color and theme.
181
+ * @param color
182
+ * @param theme
183
+ * @returns object of props - backgroundColor, color and ringColor
184
+ */
185
+ function getColorProps(color, theme) {
186
+ var themeAppearance = theme.name;
187
+ switch (themeAppearance) {
188
+ case 'White':
189
+ case 'Colorful':
190
+ default:
191
+ return {
192
+ backgroundColor: theme_tokens_1.globalTokens.color[color].tint40,
193
+ color: theme_tokens_1.globalTokens.color[color].shade30,
194
+ iconColor: theme_tokens_1.globalTokens.color[color].shade30,
195
+ ringColor: theme_tokens_1.globalTokens.color[color].primary,
196
+ };
197
+ case 'DarkGray':
198
+ case 'Black':
199
+ return {
200
+ backgroundColor: theme_tokens_1.globalTokens.color[color].shade30,
201
+ color: theme_tokens_1.globalTokens.color[color].tint40,
202
+ iconColor: theme_tokens_1.globalTokens.color[color].tint40,
203
+ ringColor: theme_tokens_1.globalTokens.color[color].tint30,
204
+ };
205
+ case 'HighContrast':
206
+ return {
207
+ backgroundColor: theme.colors.neutralBackground6,
208
+ color: theme.colors.neutralForeground3,
209
+ iconColor: theme.colors.neutralForeground3,
210
+ ringColor: theme.colors.transparentStroke,
211
+ };
212
+ }
213
+ }
214
+ //# sourceMappingURL=JSAvatarTokens.win32.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"JSAvatarTokens.win32.js","sourceRoot":"","sources":["../src/JSAvatarTokens.win32.ts"],"names":[],"mappings":";;;AAGA,oEAAmE;AAE5D,IAAM,qBAAqB,GAAyC,UAAC,CAAQ;IAClF,OAAA,CAAC;QACC,uBAAuB,EAAE,KAAK;QAC9B,qBAAqB,EAAE,KAAK;QAC5B,KAAK,EAAE,2BAAY,CAAC,KAAK,CAAC,KAAK;QAC/B,eAAe,EAAE,2BAAY,CAAC,K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YACV,OAAO;gBACL,eAAe,EAAE,2BAAY,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,OAAO;gBAClD,KAAK,EAAE,2BAAY,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,MAAM;gBACvC,SAAS,EAAE,2BAAY,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,MAAM;gBAC3C,SAAS,EAAE,2BAAY,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,MAAM;aAC5C,CAAC;QACJ,KAAK,cAAc;YACjB,OAAO;gBACL,eAAe,EAAE,KAAK,CAAC,MAAM,CAAC,kBAAkB;gBAChD,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,kBAAkB;gBACtC,SAAS,EAAE,KAAK,CAAC,MAAM,CAAC,kBAAkB;gBAC1C,SAAS,EAAE,KAAK,CAAC,MAAM,CAAC,iBAAiB;aAC1C,CAAC;KACL;AACH,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluentui-react-native/experimental-avatar",
3
- "version": "0.14.27",
3
+ "version": "0.14.30",
4
4
  "description": "A cross-platform Avatar component using the Fluent Design System. Currently only implemented on iOS",
5
5
  "license": "MIT",
6
6
  "author": "Microsoft <fluentuinativeowners@microsoft.com>",
@@ -26,14 +26,15 @@
26
26
  },
27
27
  "dependencies": {
28
28
  "@fluentui-react-native/adapters": "^0.8.5",
29
- "@fluentui-react-native/badge": "^0.0.33",
29
+ "@fluentui-react-native/badge": "^0.0.36",
30
30
  "@fluentui-react-native/component-cache": "^1.3.2",
31
- "@fluentui-react-native/icon": "^0.11.21",
32
- "@fluentui-react-native/interactive-hooks": "^0.15.6",
33
- "@fluentui-react-native/framework": "0.7.26",
34
- "@fluentui-react-native/theme-tokens": "^0.16.2",
35
- "@fluentui-react-native/tokens": "^0.12.0",
36
- "@fluentui-react-native/use-styling": "^0.8.3"
31
+ "@fluentui-react-native/framework": "0.7.28",
32
+ "@fluentui-react-native/icon": "^0.11.23",
33
+ "@fluentui-react-native/interactive-hooks": "^0.15.8",
34
+ "@fluentui-react-native/theme-tokens": "^0.16.3",
35
+ "@fluentui-react-native/tokens": "^0.12.2",
36
+ "@fluentui-react-native/use-styling": "^0.8.3",
37
+ "react-native-svg": "^12.3.0"
37
38
  },
38
39
  "devDependencies": {
39
40
  "@fluentui-react-native/eslint-config-rules": "^0.1.1",
@@ -11,7 +11,16 @@ const nameMap: { [key: string]: string } = {
11
11
  end: 'flex-end',
12
12
  };
13
13
 
14
- export const avatarStates: (keyof JSAvatarTokens)[] = [...AvatarColors, ...AvatarSizesForTokens, 'circular', 'square', 'inactive'];
14
+ export const avatarStates: (keyof JSAvatarTokens)[] = [
15
+ ...AvatarColors,
16
+ ...AvatarSizesForTokens,
17
+ 'circular',
18
+ 'square',
19
+ 'inactive',
20
+ 'ringColor',
21
+ 'ringBackgroundColor',
22
+ 'iconColor',
23
+ ];
15
24
 
16
25
  export const stylingSettings: UseStylingOptions<JSAvatarProps, AvatarSlotProps, JSAvatarTokens> = {
17
26
  tokens: [defaultJSAvatarTokens, JSAvatarName],
@@ -41,6 +50,7 @@ export const stylingSettings: UseStylingOptions<JSAvatarProps, AvatarSlotProps,
41
50
  style: {
42
51
  ...fontStyles.from(tokens, theme),
43
52
  color: tokens.color,
53
+ textAlign: 'center',
44
54
  },
45
55
  };
46
56
  },
@@ -60,10 +70,12 @@ export const stylingSettings: UseStylingOptions<JSAvatarProps, AvatarSlotProps,
60
70
  justifyContent: 'center',
61
71
  alignItems: 'center',
62
72
  backgroundColor: backgroundColor,
73
+ borderWidth: tokens.borderWidth,
74
+ borderColor: tokens.borderColor,
63
75
  },
64
76
  };
65
77
  },
66
- ['backgroundColor', 'width', 'height', ...borderStyles.keys],
78
+ ['backgroundColor', 'width', 'height', 'borderColor', 'borderWidth', ...borderStyles.keys],
67
79
  ),
68
80
  image: buildProps(
69
81
  (tokens: JSAvatarTokens) => {
@@ -72,22 +84,25 @@ export const stylingSettings: UseStylingOptions<JSAvatarProps, AvatarSlotProps,
72
84
  borderRadius: tokens.borderRadius,
73
85
  width: tokens.width,
74
86
  height: tokens.height,
87
+ borderWidth: tokens.borderWidth,
88
+ borderColor: tokens.borderColor,
75
89
  },
76
90
  };
77
91
  },
78
- ['borderRadius', 'width', 'height'],
92
+ ['borderRadius', 'width', 'height', 'borderColor', 'borderWidth'],
79
93
  ),
80
94
  icon: buildProps(
81
95
  (tokens: JSAvatarTokens) => {
82
96
  return {
83
97
  style: {
84
98
  position: 'absolute',
99
+ color: tokens.iconColor,
85
100
  width: tokens.iconSize,
86
101
  height: tokens.iconSize,
87
102
  },
88
103
  };
89
104
  },
90
- ['iconSize'],
105
+ ['iconSize', 'iconColor'],
91
106
  ),
92
107
  ring: buildProps(
93
108
  (tokens: JSAvatarTokens, theme: Theme) => {
@@ -95,17 +110,18 @@ export const stylingSettings: UseStylingOptions<JSAvatarProps, AvatarSlotProps,
95
110
  return {
96
111
  style: {
97
112
  borderStyle: 'solid',
98
- borderWidth: ringConfig.stroke,
99
113
  width: ringConfig.size,
100
114
  height: ringConfig.size,
101
115
  position: 'absolute',
102
116
  top: -ringConfig.stroke * 2,
103
117
  left: -ringConfig.stroke * 2,
104
118
  ...borderStyles.from(tokens, theme),
119
+ borderWidth: ringConfig.stroke,
120
+ borderColor: tokens.ringColor,
105
121
  },
106
122
  };
107
123
  },
108
- ['width', 'height', ...borderStyles.keys],
124
+ ['width', 'height', 'ringColor', ...borderStyles.keys],
109
125
  ),
110
126
  badge: buildProps(
111
127
  (tokens: JSAvatarTokens) => {
package/src/JSAvatar.tsx CHANGED
@@ -7,6 +7,7 @@ import { useAvatar } from './useAvatar';
7
7
  import { PresenceBadge } from '@fluentui-react-native/badge';
8
8
  import { Icon } from '@fluentui-react-native/icon';
9
9
  import { createIconProps } from '@fluentui-react-native/interactive-hooks';
10
+ import { SvgXml } from 'react-native-svg';
10
11
 
11
12
  /**
12
13
  * A function which determines if a set of styles should be applied to the compoent given the current state and props of the avatar.
@@ -52,6 +53,10 @@ export const JSAvatar = compose<JSAvatarType>({
52
53
  const { activeAppearance, icon, initials, image, badge, ...mergedProps } = mergeProps(avatar.props, final);
53
54
  const { showRing, transparentRing, showBadge } = avatar.state;
54
55
  const svgIconsEnabled = ['ios', 'macos', 'win32', 'android'].includes(Platform.OS as string);
56
+ const fallBackIconXml = `<svg width="14" height="16" viewBox="0 0 14 16" fill="none" xmlns="http://www.w3.org/2000/svg">
57
+ <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"/>
58
+ </svg>
59
+ `;
55
60
 
56
61
  return (
57
62
  <Slots.root {...mergedProps}>
@@ -59,7 +64,13 @@ export const JSAvatar = compose<JSAvatarType>({
59
64
  <Slots.image {...image} />
60
65
  ) : (
61
66
  <Slots.initialsBackground>
62
- {initials ? <Slots.initials>{initials}</Slots.initials> : userProps.icon && <Slots.icon {...iconProps} />}
67
+ {initials ? (
68
+ <Slots.initials>{initials}</Slots.initials>
69
+ ) : userProps.icon ? (
70
+ <Slots.icon {...iconProps} />
71
+ ) : (
72
+ <SvgXml xml={fallBackIconXml} />
73
+ )}
63
74
  </Slots.initialsBackground>
64
75
  )}
65
76
  {showRing && !transparentRing && <Slots.ring />}
@@ -62,14 +62,13 @@ export type AvatarNamedColor = typeof AvatarColors[number];
62
62
 
63
63
  export type AvatarShape = 'circular' | 'square';
64
64
  export type AvatarActive = 'active' | 'inactive' | 'unset';
65
- export type AvatarActiveAppearance = 'ring' | 'shadow' | 'glow' | 'ring-shadow' | 'ring-glow';
65
+ export type AvatarActiveAppearance = 'ring';
66
66
  export type AvatarColor = 'neutral' | 'brand' | 'colorful' | AvatarNamedColor;
67
67
  export type IconAlignment = 'start' | 'center' | 'end';
68
68
 
69
69
  export interface RingConfig {
70
70
  accent?: boolean;
71
71
  transparent?: boolean;
72
- ringBackgroundColor?: ColorValue; // inner/outer rings
73
72
  ringThickness?: number;
74
73
  innerGap?: number;
75
74
  }
@@ -105,6 +104,11 @@ export interface JSAvatarProps extends IViewProps, AvatarConfigurableProps {
105
104
  * @defaultvalue ring
106
105
  */
107
106
  activeAppearance?: AvatarActiveAppearance;
107
+
108
+ /**
109
+ * Badge shows the avatar's presence status.
110
+ * Badge can be shown only if `active` prop is undefined or unset
111
+ */
108
112
  badge?: PresenceBadgeProps;
109
113
 
110
114
  /**
@@ -118,8 +122,11 @@ export interface JSAvatarProps extends IViewProps, AvatarConfigurableProps {
118
122
  * Specify a string to be used instead of the name, to determine which color to use when color="colorful".
119
123
  * Use this when a name is not available, but there is another unique identifier that can be used instead.
120
124
  */
121
- idForColor?: string | undefined;
125
+ idForColor?: string;
122
126
 
127
+ /**
128
+ * The Avatar's image.
129
+ */
123
130
  image?: ImageProps;
124
131
 
125
132
  /**
@@ -155,15 +162,22 @@ export interface JSAvatarProps extends IViewProps, AvatarConfigurableProps {
155
162
  * @defaultvalue circular
156
163
  */
157
164
  shape?: AvatarShape;
165
+
166
+ /**
167
+ * Currently used for image URL, will be deprecated when image prop works
168
+ */
158
169
  src?: string;
159
170
  }
160
171
 
161
172
  export interface JSAvatarTokens extends IBackgroundColorTokens, IForegroundColorTokens, AvatarConfigurableProps, IBorderTokens, FontTokens {
173
+ iconColor?: ColorValue;
162
174
  iconSize?: number;
163
175
  height?: number;
164
176
  horizontalIconAlignment?: IconAlignment;
165
177
  verticalIconAlignment?: IconAlignment;
166
178
  circular?: JSAvatarTokens;
179
+ ringColor?: ColorValue;
180
+ ringBackgroundColor?: ColorValue;
167
181
  square?: JSAvatarTokens;
168
182
  inactive?: JSAvatarTokens;
169
183
  avatarOpacity?: number;