@fluentui-react-native/experimental-avatar 0.14.19 → 0.14.22

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 (48) hide show
  1. package/CHANGELOG.json +58 -1
  2. package/CHANGELOG.md +28 -2
  3. package/FRNAvatar.podspec +3 -3
  4. package/ios/AvatarViewManager.swift +1 -9
  5. package/ios/FRNAvatarViewManager.h +0 -2
  6. package/ios/FRNAvatarViewManager.m +14 -44
  7. package/lib/JSAvatar.d.ts.map +1 -1
  8. package/lib/JSAvatar.helpers.d.ts +0 -5
  9. package/lib/JSAvatar.helpers.d.ts.map +1 -1
  10. package/lib/JSAvatar.helpers.js +0 -28
  11. package/lib/JSAvatar.helpers.js.map +1 -1
  12. package/lib/JSAvatar.js +2 -0
  13. package/lib/JSAvatar.js.map +1 -1
  14. package/lib/JSAvatar.styling.d.ts.map +1 -1
  15. package/lib/JSAvatar.styling.js +14 -34
  16. package/lib/JSAvatar.styling.js.map +1 -1
  17. package/lib/JSAvatar.types.d.ts +63 -17
  18. package/lib/JSAvatar.types.d.ts.map +1 -1
  19. package/lib/JSAvatar.types.js +35 -0
  20. package/lib/JSAvatar.types.js.map +1 -1
  21. package/lib/JSAvatarTokens.d.ts.map +1 -1
  22. package/lib/JSAvatarTokens.js +103 -5
  23. package/lib/JSAvatarTokens.js.map +1 -1
  24. package/lib-commonjs/JSAvatar.d.ts.map +1 -1
  25. package/lib-commonjs/JSAvatar.helpers.d.ts +0 -5
  26. package/lib-commonjs/JSAvatar.helpers.d.ts.map +1 -1
  27. package/lib-commonjs/JSAvatar.helpers.js +1 -30
  28. package/lib-commonjs/JSAvatar.helpers.js.map +1 -1
  29. package/lib-commonjs/JSAvatar.js +2 -0
  30. package/lib-commonjs/JSAvatar.js.map +1 -1
  31. package/lib-commonjs/JSAvatar.styling.d.ts.map +1 -1
  32. package/lib-commonjs/JSAvatar.styling.js +12 -32
  33. package/lib-commonjs/JSAvatar.styling.js.map +1 -1
  34. package/lib-commonjs/JSAvatar.types.d.ts +63 -17
  35. package/lib-commonjs/JSAvatar.types.d.ts.map +1 -1
  36. package/lib-commonjs/JSAvatar.types.js +36 -1
  37. package/lib-commonjs/JSAvatar.types.js.map +1 -1
  38. package/lib-commonjs/JSAvatarTokens.d.ts.map +1 -1
  39. package/lib-commonjs/JSAvatarTokens.js +103 -5
  40. package/lib-commonjs/JSAvatarTokens.js.map +1 -1
  41. package/package.json +3 -3
  42. package/src/JSAvatar.helpers.ts +0 -31
  43. package/src/JSAvatar.styling.ts +15 -35
  44. package/src/JSAvatar.tsx +2 -0
  45. package/src/JSAvatar.types.ts +98 -39
  46. package/src/JSAvatarTokens.ts +103 -5
  47. package/ios/FRNAvatarStorage.h +0 -16
  48. package/ios/FRNAvatarStorage.m +0 -23
@@ -1,15 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.defaultJSAvatarTokens = void 0;
4
- var JSAvatar_helpers_1 = require("./JSAvatar.helpers");
5
4
  var theme_tokens_1 = require("@fluentui-react-native/theme-tokens");
6
- var defaultJSAvatarTokens = function () {
5
+ var defaultJSAvatarTokens = function (t) {
7
6
  return ({
8
7
  horizontalIconAlignment: 'end',
9
8
  verticalIconAlignment: 'end',
10
- color: 'white',
11
- iconStrokeColor: 'white',
12
- backgroundColor: (0, JSAvatar_helpers_1.convertCoinColorFluent)('cornflower'),
9
+ color: theme_tokens_1.globalTokens.color.white,
10
+ backgroundColor: theme_tokens_1.globalTokens.color.cornflower.primary,
13
11
  avatarOpacity: 1,
14
12
  circular: {
15
13
  borderRadius: theme_tokens_1.globalTokens.corner.radius.circle,
@@ -104,6 +102,106 @@ var defaultJSAvatarTokens = function () {
104
102
  iconSize: 40,
105
103
  initialsSize: 48,
106
104
  },
105
+ neutral: {
106
+ backgroundColor: t.colors.neutralBackground6,
107
+ color: t.colors.neutralForeground3,
108
+ ringColor: t.colors.defaultBorder,
109
+ },
110
+ brand: {
111
+ backgroundColor: t.colors.brandBackgroundStatic,
112
+ color: t.colors.neutralForegroundOnBrand,
113
+ ringColor: t.colors.brandedBorder,
114
+ },
115
+ darkRed: {
116
+ backgroundColor: theme_tokens_1.globalTokens.color.darkRed.primary,
117
+ },
118
+ cranberry: {
119
+ backgroundColor: theme_tokens_1.globalTokens.color.cranberry.primary,
120
+ },
121
+ red: {
122
+ backgroundColor: theme_tokens_1.globalTokens.color.red.primary,
123
+ },
124
+ pumpkin: {
125
+ backgroundColor: theme_tokens_1.globalTokens.color.pumpkin.primary,
126
+ },
127
+ peach: {
128
+ backgroundColor: theme_tokens_1.globalTokens.color.peach.primary,
129
+ },
130
+ marigold: {
131
+ backgroundColor: theme_tokens_1.globalTokens.color.marigold.primary,
132
+ },
133
+ gold: {
134
+ backgroundColor: theme_tokens_1.globalTokens.color.gold.primary,
135
+ },
136
+ brass: {
137
+ backgroundColor: theme_tokens_1.globalTokens.color.brass.primary,
138
+ },
139
+ brown: {
140
+ backgroundColor: theme_tokens_1.globalTokens.color.brown.primary,
141
+ },
142
+ forest: {
143
+ backgroundColor: theme_tokens_1.globalTokens.color.forest.primary,
144
+ },
145
+ seafoam: {
146
+ backgroundColor: theme_tokens_1.globalTokens.color.seafoam.primary,
147
+ },
148
+ darkGreen: {
149
+ backgroundColor: theme_tokens_1.globalTokens.color.darkGreen.primary,
150
+ },
151
+ lightTeal: {
152
+ backgroundColor: theme_tokens_1.globalTokens.color.lightTeal.primary,
153
+ },
154
+ teal: {
155
+ backgroundColor: theme_tokens_1.globalTokens.color.teal.primary,
156
+ },
157
+ steel: {
158
+ backgroundColor: theme_tokens_1.globalTokens.color.steel.primary,
159
+ },
160
+ blue: {
161
+ backgroundColor: theme_tokens_1.globalTokens.color.blue.primary,
162
+ },
163
+ royalBlue: {
164
+ backgroundColor: theme_tokens_1.globalTokens.color.royalBlue.primary,
165
+ },
166
+ cornflower: {
167
+ backgroundColor: theme_tokens_1.globalTokens.color.cornflower.primary,
168
+ },
169
+ navy: {
170
+ backgroundColor: theme_tokens_1.globalTokens.color.navy.primary,
171
+ },
172
+ lavender: {
173
+ backgroundColor: theme_tokens_1.globalTokens.color.lavender.primary,
174
+ },
175
+ purple: {
176
+ backgroundColor: theme_tokens_1.globalTokens.color.purple.primary,
177
+ },
178
+ grape: {
179
+ backgroundColor: theme_tokens_1.globalTokens.color.grape.primary,
180
+ },
181
+ lilac: {
182
+ backgroundColor: theme_tokens_1.globalTokens.color.lilac.primary,
183
+ },
184
+ pink: {
185
+ backgroundColor: theme_tokens_1.globalTokens.color.pink.primary,
186
+ },
187
+ magenta: {
188
+ backgroundColor: theme_tokens_1.globalTokens.color.magenta.primary,
189
+ },
190
+ plum: {
191
+ backgroundColor: theme_tokens_1.globalTokens.color.plum.primary,
192
+ },
193
+ beige: {
194
+ backgroundColor: theme_tokens_1.globalTokens.color.beige.primary,
195
+ },
196
+ mink: {
197
+ backgroundColor: theme_tokens_1.globalTokens.color.mink.primary,
198
+ },
199
+ platinum: {
200
+ backgroundColor: theme_tokens_1.globalTokens.color.platinum.primary,
201
+ },
202
+ anchor: {
203
+ backgroundColor: theme_tokens_1.globalTokens.color.anchor.primary,
204
+ },
107
205
  });
108
206
  };
109
207
  exports.defaultJSAvatarTokens = defaultJSAvatarTokens;
@@ -1 +1 @@
1
- {"version":3,"file":"JSAvatarTokens.js","sourceRoot":"","sources":["../src/JSAvatarTokens.ts"],"names":[],"mappings":";;;AAGA,uDAA4D;AAC5D,oEAAmE;AAE5D,IAAM,qBAAqB,GAAyC;IACzE,OAAA,CAAC;QACC,uBAAuB,EAAE,KAAK;QAC9B,qBAAqB,EAAE,KAAK;QAC5B,KAAK,EAAE,OAAO;QACd,eAAe,EAAE,OAAO;QACxB,eAAe,EAAE,IAAA,yCAAsB,EAAC,YAAY,CAAC;QACrD,aAAa,EAAE,CAAC;QAChB,QAAQ,EAAE;YACR,YAAY,EAAE,2BAAY,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM;SAChD;QACD,MAAM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YACN,eAAe,EAAE,2BAAY,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO;SACnD;QACD,KAAK,EAAE;YACL,eAAe,EAAE,2BAAY,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO;SAClD;QACD,KAAK,EAAE;YACL,eAAe,EAAE,2BAAY,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO;SAClD;QACD,IAAI,EAAE;YACJ,eAAe,EAAE,2BAAY,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO;SACjD;QACD,OAAO,EAAE;YACP,eAAe,EAAE,2BAAY,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO;SACpD;QACD,IAAI,EAAE;YACJ,eAAe,EAAE,2BAAY,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO;SACjD;QACD,KAAK,EAAE;YACL,eAAe,EAAE,2BAAY,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO;SAClD;QACD,IAAI,EAAE;YACJ,eAAe,EAAE,2BAAY,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO;SACjD;QACD,QAAQ,EAAE;YACR,eAAe,EAAE,2BAAY,CAAC,KAAK,CAAC,QAAQ,CAAC,OAAO;SACrD;QACD,MAAM,EAAE;YACN,eAAe,EAAE,2BAAY,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO;SACnD;KACiB,CAAA;AAvMpB,CAuMoB,CAAC;AAxMV,QAAA,qBAAqB,yBAwMX"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluentui-react-native/experimental-avatar",
3
- "version": "0.14.19",
3
+ "version": "0.14.22",
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>",
@@ -28,8 +28,8 @@
28
28
  "@fluentui-react-native/adapters": "^0.8.5",
29
29
  "@fluentui-react-native/badge": "^0.0.32",
30
30
  "@fluentui-react-native/component-cache": "^1.3.2",
31
- "@fluentui-react-native/icon": "^0.11.18",
32
- "@fluentui-react-native/interactive-hooks": "^0.15.4",
31
+ "@fluentui-react-native/icon": "^0.11.20",
32
+ "@fluentui-react-native/interactive-hooks": "^0.15.5",
33
33
  "@fluentui-react-native/framework": "0.7.25",
34
34
  "@fluentui-react-native/theme-tokens": "^0.16.2",
35
35
  "@fluentui-react-native/tokens": "^0.11.11",
@@ -1,4 +1,3 @@
1
- import { AvatarColor } from './JSAvatar.types';
2
1
  import { globalTokens } from '@fluentui-react-native/theme-tokens';
3
2
 
4
3
  const sizeAdjustment = {
@@ -13,36 +12,6 @@ export type AvatarSizeConfig = {
13
12
  initialsSize: number;
14
13
  };
15
14
 
16
- const colorTableFluent: { [P in AvatarColor]: string } = {
17
- cornflower: globalTokens.color.cornflower.primary,
18
- blue: globalTokens.color.blue.primary,
19
- royalBlue: globalTokens.color.royalBlue.primary,
20
- teal: globalTokens.color.teal.primary,
21
- forest: globalTokens.color.forest.primary,
22
- darkGreen: globalTokens.color.darkGreen.primary,
23
- berry: globalTokens.color.berry.primary,
24
- hotPink: globalTokens.color.hotPink.primary,
25
- grape: globalTokens.color.grape.primary,
26
- purple: globalTokens.color.purple.primary,
27
- pumpkin: globalTokens.color.pumpkin.primary,
28
- red: globalTokens.color.red.primary,
29
- burgundy: globalTokens.color.burgundy.primary,
30
- orchid: globalTokens.color.orchid.primary,
31
- brass: globalTokens.color.brass.primary,
32
- darkRed: globalTokens.color.darkRed.primary,
33
- beige: globalTokens.color.beige.primary,
34
- platinum: globalTokens.color.platinum.primary,
35
- steel: globalTokens.color.steel.primary,
36
- brown: globalTokens.color.brown.primary,
37
- };
38
-
39
- /**
40
- * Converts the AvatarColor into a hex color value
41
- */
42
- export function convertCoinColorFluent(coinColor: AvatarColor): string {
43
- return colorTableFluent[coinColor];
44
- }
45
-
46
15
  export function getRingConfig(size: number): any {
47
16
  if (size <= 48) {
48
17
  return {
@@ -1,8 +1,8 @@
1
- import { JSAvatarName, JSAvatarTokens, AvatarSlotProps, JSAvatarProps } from './JSAvatar.types';
1
+ import { JSAvatarName, JSAvatarTokens, AvatarSlotProps, JSAvatarProps, AvatarColors, AvatarSizes } from './JSAvatar.types';
2
2
  import { Theme, UseStylingOptions, buildProps } from '@fluentui-react-native/framework';
3
3
  import { defaultJSAvatarTokens } from './JSAvatarTokens';
4
4
  import { ViewStyle } from 'react-native';
5
- import { convertCoinColorFluent, getRingConfig } from './JSAvatar.helpers';
5
+ import { getRingConfig } from './JSAvatar.helpers';
6
6
  import { borderStyles } from '@fluentui-react-native/tokens';
7
7
 
8
8
  const nameMap: { [key: string]: string } = {
@@ -11,23 +11,7 @@ const nameMap: { [key: string]: string } = {
11
11
  end: 'flex-end',
12
12
  };
13
13
 
14
- export const avatarStates: (keyof JSAvatarTokens)[] = [
15
- 'circular',
16
- 'square',
17
- 'inactive',
18
- 'size20',
19
- 'size24',
20
- 'size28',
21
- 'size32',
22
- 'size36',
23
- 'size40',
24
- 'size48',
25
- 'size56',
26
- 'size64',
27
- 'size72',
28
- 'size96',
29
- 'size120',
30
- ];
14
+ export const avatarStates: (keyof JSAvatarTokens)[] = [...AvatarColors, ...AvatarSizes, 'circular', 'square', 'inactive'];
31
15
 
32
16
  export const stylingSettings: UseStylingOptions<JSAvatarProps, AvatarSlotProps, JSAvatarTokens> = {
33
17
  tokens: [defaultJSAvatarTokens, JSAvatarName],
@@ -35,17 +19,17 @@ export const stylingSettings: UseStylingOptions<JSAvatarProps, AvatarSlotProps,
35
19
  slotProps: {
36
20
  root: buildProps(
37
21
  (tokens: JSAvatarTokens) => {
38
- const { horizontalIconAlignment, verticalIconAlignment } = tokens;
22
+ const { horizontalIconAlignment, verticalIconAlignment, width, height, avatarOpacity } = tokens;
39
23
  return {
40
24
  style: {
41
25
  flexDirection: 'row',
42
- width: tokens.width,
43
- height: tokens.height,
26
+ width: width,
27
+ height: height,
44
28
  justifyContent: nameMap[horizontalIconAlignment || 'end'] as ViewStyle['justifyContent'],
45
29
  alignItems: nameMap[verticalIconAlignment || 'end'] as ViewStyle['alignItems'],
46
30
  horizontalIconAlignment,
47
31
  verticalIconAlignment,
48
- opacity: tokens.avatarOpacity,
32
+ opacity: avatarOpacity,
49
33
  },
50
34
  };
51
35
  },
@@ -56,18 +40,16 @@ export const stylingSettings: UseStylingOptions<JSAvatarProps, AvatarSlotProps,
56
40
  return {
57
41
  style: {
58
42
  fontSize: tokens.initialsSize,
43
+ color: tokens.color,
59
44
  },
60
45
  };
61
46
  },
62
- ['initialsSize'],
47
+ ['initialsSize', 'color'],
63
48
  ),
64
49
  initialsBackground: buildProps(
65
50
  (tokens: JSAvatarTokens, theme: Theme) => {
66
- const { backgroundColor, coinColorFluent } = tokens;
67
- let effectiveBackgroundColor = backgroundColor;
68
- if (coinColorFluent) {
69
- effectiveBackgroundColor = convertCoinColorFluent(coinColorFluent);
70
- }
51
+ const { backgroundColor } = tokens;
52
+
71
53
  return {
72
54
  style: {
73
55
  ...borderStyles.from(tokens, theme),
@@ -77,11 +59,11 @@ export const stylingSettings: UseStylingOptions<JSAvatarProps, AvatarSlotProps,
77
59
  alignSelf: 'stretch',
78
60
  justifyContent: 'center',
79
61
  alignItems: 'center',
80
- backgroundColor: effectiveBackgroundColor,
62
+ backgroundColor: backgroundColor,
81
63
  },
82
64
  };
83
65
  },
84
- ['coinColorFluent', 'backgroundColor', 'width', 'height', ...borderStyles.keys],
66
+ ['backgroundColor', 'width', 'height', ...borderStyles.keys],
85
67
  ),
86
68
  image: buildProps(
87
69
  (tokens: JSAvatarTokens) => {
@@ -110,12 +92,10 @@ export const stylingSettings: UseStylingOptions<JSAvatarProps, AvatarSlotProps,
110
92
  ring: buildProps(
111
93
  (tokens: JSAvatarTokens, theme: Theme) => {
112
94
  const ringConfig = getRingConfig(tokens.width);
113
-
114
- const ringColor = tokens.ringColor;
115
95
  return {
116
96
  style: {
117
97
  borderStyle: 'solid',
118
- borderColor: ringColor,
98
+ borderColor: tokens.ringColor,
119
99
  borderWidth: ringConfig.stroke,
120
100
  width: ringConfig.size,
121
101
  height: ringConfig.size,
@@ -126,7 +106,7 @@ export const stylingSettings: UseStylingOptions<JSAvatarProps, AvatarSlotProps,
126
106
  },
127
107
  };
128
108
  },
129
- ['width', 'height', ...borderStyles.keys],
109
+ ['width', 'height', 'ringColor', ...borderStyles.keys],
130
110
  ),
131
111
  badge: buildProps(
132
112
  (tokens: JSAvatarTokens) => {
package/src/JSAvatar.tsx CHANGED
@@ -22,6 +22,8 @@ export const avatarLookup = (layer: string, state: JSAvatarState, userProps: JSA
22
22
  userProps[layer] ||
23
23
  layer === userProps['shape'] ||
24
24
  (!userProps['shape'] && layer === 'circular') ||
25
+ layer === userProps['avatarColor'] ||
26
+ (!userProps['avatarColor'] && layer === 'brand') ||
25
27
  layer === userProps['size'] ||
26
28
  (!userProps['size'] && layer === 'size56') ||
27
29
  (userProps.active === 'inactive' && layer === 'inactive')
@@ -19,36 +19,51 @@ export const AvatarSizes = [
19
19
  'size96',
20
20
  'size120',
21
21
  ] as const;
22
+
23
+ /**
24
+ * Sets color of the avatar when there is no picture. Uses fluent color names
25
+ */
26
+ export const AvatarColors = [
27
+ 'darkRed',
28
+ 'cranberry',
29
+ 'red',
30
+ 'pumpkin',
31
+ 'peach',
32
+ 'marigold',
33
+ 'gold',
34
+ 'brass',
35
+ 'brown',
36
+ 'forest',
37
+ 'seafoam',
38
+ 'darkGreen',
39
+ 'lightTeal',
40
+ 'teal',
41
+ 'steel',
42
+ 'blue',
43
+ 'royalBlue',
44
+ 'cornflower',
45
+ 'navy',
46
+ 'lavender',
47
+ 'purple',
48
+ 'grape',
49
+ 'lilac',
50
+ 'pink',
51
+ 'magenta',
52
+ 'plum',
53
+ 'beige',
54
+ 'mink',
55
+ 'platinum',
56
+ 'anchor',
57
+ ] as const;
22
58
  export type AvatarSize = typeof AvatarSizes[number];
59
+ export type AvatarNamedColor = typeof AvatarColors[number];
23
60
 
24
61
  export type AvatarShape = 'circular' | 'square';
25
62
  export type AvatarActive = 'active' | 'inactive' | 'unset';
26
63
  export type AvatarActiveAppearance = 'ring' | 'shadow' | 'glow' | 'ring-shadow' | 'ring-glow';
64
+ export type AvatarColor = 'neutral' | 'brand' | 'colorful' | AvatarNamedColor;
65
+ export type IconAlignment = 'start' | 'center' | 'end';
27
66
 
28
- /**
29
- * Sets color of the avatar when there is no picture. Uses fluent color names
30
- */
31
- export type AvatarColor =
32
- | 'cornflower'
33
- | 'blue'
34
- | 'royalBlue'
35
- | 'teal'
36
- | 'forest'
37
- | 'darkGreen'
38
- | 'berry'
39
- | 'hotPink'
40
- | 'grape'
41
- | 'purple'
42
- | 'pumpkin'
43
- | 'red'
44
- | 'burgundy'
45
- | 'orchid'
46
- | 'brass'
47
- | 'darkRed'
48
- | 'beige'
49
- | 'platinum'
50
- | 'steel'
51
- | 'brown';
52
67
  export interface RingConfig {
53
68
  accent?: boolean;
54
69
  transparent?: boolean;
@@ -59,9 +74,18 @@ export interface RingConfig {
59
74
  }
60
75
 
61
76
  export interface AvatarConfigurableProps {
77
+ /**
78
+ * The color when displaying either an icon or initials.
79
+ * * neutral (default): gray
80
+ * * brand: color from the brand palette
81
+ * * colorful: picks a color from a set of pre-defined colors, based on a hash of the name (or idForColor if provided)
82
+ * * [AvatarNamedColor]: a specific color from the theme
83
+ *
84
+ * @defaultvalue neutral
85
+ */
86
+ avatarColor?: AvatarColor;
62
87
  size?: AvatarSize;
63
88
  ring?: RingConfig;
64
- coinColorFluent?: AvatarColor;
65
89
  }
66
90
 
67
91
  export interface JSAvatarProps extends IViewProps, AvatarConfigurableProps {
@@ -69,6 +93,13 @@ export interface JSAvatarProps extends IViewProps, AvatarConfigurableProps {
69
93
  activeAppearance?: AvatarActiveAppearance;
70
94
  badge?: PresenceBadgeProps;
71
95
  icon?: IconSourcesType;
96
+
97
+ /**
98
+ * Specify a string to be used instead of the name, to determine which color to use when color="colorful".
99
+ * Use this when a name is not available, but there is another unique identifier that can be used instead.
100
+ */
101
+ idForColor?: string | undefined;
102
+
72
103
  image?: ImageProps;
73
104
  initials?: string;
74
105
  name?: string;
@@ -76,22 +107,8 @@ export interface JSAvatarProps extends IViewProps, AvatarConfigurableProps {
76
107
  src?: string;
77
108
  }
78
109
 
79
- export interface AvatarSlotProps {
80
- root: ViewProps;
81
- image: ImageProps;
82
- initials: TextProps;
83
- initialsBackground: ViewProps;
84
- icon: IconProps;
85
- ring: ViewProps;
86
- badge: BadgeProps;
87
- }
88
-
89
- export type IconAlignment = 'start' | 'center' | 'end';
90
-
91
110
  export interface JSAvatarTokens extends IBackgroundColorTokens, IForegroundColorTokens, AvatarConfigurableProps, IBorderTokens {
92
111
  iconSize?: number;
93
- iconStrokeWidth?: number;
94
- iconStrokeColor?: string;
95
112
  initialsSize?: number;
96
113
  height?: number;
97
114
  horizontalIconAlignment?: IconAlignment;
@@ -115,6 +132,48 @@ export interface JSAvatarTokens extends IBackgroundColorTokens, IForegroundColor
115
132
  size120?: JSAvatarTokens;
116
133
  width?: number;
117
134
  badgeSize?: BadgeSize;
135
+ neutral?: JSAvatarTokens;
136
+ brand?: JSAvatarTokens;
137
+ darkRed?: JSAvatarTokens;
138
+ cranberry?: JSAvatarTokens;
139
+ red?: JSAvatarTokens;
140
+ pumpkin?: JSAvatarTokens;
141
+ peach?: JSAvatarTokens;
142
+ marigold?: JSAvatarTokens;
143
+ gold?: JSAvatarTokens;
144
+ brass?: JSAvatarTokens;
145
+ brown?: JSAvatarTokens;
146
+ forest?: JSAvatarTokens;
147
+ seafoam?: JSAvatarTokens;
148
+ darkGreen?: JSAvatarTokens;
149
+ lightTeal?: JSAvatarTokens;
150
+ teal?: JSAvatarTokens;
151
+ steel?: JSAvatarTokens;
152
+ blue?: JSAvatarTokens;
153
+ royalBlue?: JSAvatarTokens;
154
+ cornflower?: JSAvatarTokens;
155
+ navy?: JSAvatarTokens;
156
+ lavender?: JSAvatarTokens;
157
+ purple?: JSAvatarTokens;
158
+ grape?: JSAvatarTokens;
159
+ lilac?: JSAvatarTokens;
160
+ pink?: JSAvatarTokens;
161
+ magenta?: JSAvatarTokens;
162
+ plum?: JSAvatarTokens;
163
+ beige?: JSAvatarTokens;
164
+ mink?: JSAvatarTokens;
165
+ platinum?: JSAvatarTokens;
166
+ anchor?: JSAvatarTokens;
167
+ }
168
+
169
+ export interface AvatarSlotProps {
170
+ root: ViewProps;
171
+ image: ImageProps;
172
+ initials: TextProps;
173
+ initialsBackground: ViewProps;
174
+ icon: IconProps;
175
+ ring: ViewProps;
176
+ badge: BadgeProps;
118
177
  }
119
178
 
120
179
  export interface JSAvatarState {
@@ -1,16 +1,14 @@
1
1
  import { Theme } from '@fluentui-react-native/framework';
2
2
  import { TokenSettings } from '@fluentui-react-native/use-styling';
3
3
  import { JSAvatarTokens } from '.';
4
- import { convertCoinColorFluent } from './JSAvatar.helpers';
5
4
  import { globalTokens } from '@fluentui-react-native/theme-tokens';
6
5
 
7
- export const defaultJSAvatarTokens: TokenSettings<JSAvatarTokens, Theme> = () =>
6
+ export const defaultJSAvatarTokens: TokenSettings<JSAvatarTokens, Theme> = (t: Theme) =>
8
7
  ({
9
8
  horizontalIconAlignment: 'end',
10
9
  verticalIconAlignment: 'end',
11
- color: 'white', // initials is always 'white', unless overriden by token
12
- iconStrokeColor: 'white', // icon stroke color is always 'white', unless overriden by token
13
- backgroundColor: convertCoinColorFluent('cornflower'),
10
+ color: globalTokens.color.white,
11
+ backgroundColor: globalTokens.color.cornflower.primary,
14
12
  avatarOpacity: 1,
15
13
  circular: {
16
14
  borderRadius: globalTokens.corner.radius.circle,
@@ -105,4 +103,104 @@ export const defaultJSAvatarTokens: TokenSettings<JSAvatarTokens, Theme> = () =>
105
103
  iconSize: 40,
106
104
  initialsSize: 48,
107
105
  },
106
+ neutral: {
107
+ backgroundColor: t.colors.neutralBackground6,
108
+ color: t.colors.neutralForeground3,
109
+ ringColor: t.colors.defaultBorder,
110
+ },
111
+ brand: {
112
+ backgroundColor: t.colors.brandBackgroundStatic,
113
+ color: t.colors.neutralForegroundOnBrand,
114
+ ringColor: t.colors.brandedBorder,
115
+ },
116
+ darkRed: {
117
+ backgroundColor: globalTokens.color.darkRed.primary,
118
+ },
119
+ cranberry: {
120
+ backgroundColor: globalTokens.color.cranberry.primary,
121
+ },
122
+ red: {
123
+ backgroundColor: globalTokens.color.red.primary,
124
+ },
125
+ pumpkin: {
126
+ backgroundColor: globalTokens.color.pumpkin.primary,
127
+ },
128
+ peach: {
129
+ backgroundColor: globalTokens.color.peach.primary,
130
+ },
131
+ marigold: {
132
+ backgroundColor: globalTokens.color.marigold.primary,
133
+ },
134
+ gold: {
135
+ backgroundColor: globalTokens.color.gold.primary,
136
+ },
137
+ brass: {
138
+ backgroundColor: globalTokens.color.brass.primary,
139
+ },
140
+ brown: {
141
+ backgroundColor: globalTokens.color.brown.primary,
142
+ },
143
+ forest: {
144
+ backgroundColor: globalTokens.color.forest.primary,
145
+ },
146
+ seafoam: {
147
+ backgroundColor: globalTokens.color.seafoam.primary,
148
+ },
149
+ darkGreen: {
150
+ backgroundColor: globalTokens.color.darkGreen.primary,
151
+ },
152
+ lightTeal: {
153
+ backgroundColor: globalTokens.color.lightTeal.primary,
154
+ },
155
+ teal: {
156
+ backgroundColor: globalTokens.color.teal.primary,
157
+ },
158
+ steel: {
159
+ backgroundColor: globalTokens.color.steel.primary,
160
+ },
161
+ blue: {
162
+ backgroundColor: globalTokens.color.blue.primary,
163
+ },
164
+ royalBlue: {
165
+ backgroundColor: globalTokens.color.royalBlue.primary,
166
+ },
167
+ cornflower: {
168
+ backgroundColor: globalTokens.color.cornflower.primary,
169
+ },
170
+ navy: {
171
+ backgroundColor: globalTokens.color.navy.primary,
172
+ },
173
+ lavender: {
174
+ backgroundColor: globalTokens.color.lavender.primary,
175
+ },
176
+ purple: {
177
+ backgroundColor: globalTokens.color.purple.primary,
178
+ },
179
+ grape: {
180
+ backgroundColor: globalTokens.color.grape.primary,
181
+ },
182
+ lilac: {
183
+ backgroundColor: globalTokens.color.lilac.primary,
184
+ },
185
+ pink: {
186
+ backgroundColor: globalTokens.color.pink.primary,
187
+ },
188
+ magenta: {
189
+ backgroundColor: globalTokens.color.magenta.primary,
190
+ },
191
+ plum: {
192
+ backgroundColor: globalTokens.color.plum.primary,
193
+ },
194
+ beige: {
195
+ backgroundColor: globalTokens.color.beige.primary,
196
+ },
197
+ mink: {
198
+ backgroundColor: globalTokens.color.mink.primary,
199
+ },
200
+ platinum: {
201
+ backgroundColor: globalTokens.color.platinum.primary,
202
+ },
203
+ anchor: {
204
+ backgroundColor: globalTokens.color.anchor.primary,
205
+ },
108
206
  } as JSAvatarTokens);
@@ -1,16 +0,0 @@
1
- #ifndef FRNAvatarStorage_h
2
- #define FRNAvatarStorage_h
3
-
4
- @import FluentUI;
5
-
6
- NS_ASSUME_NONNULL_BEGIN
7
-
8
- @interface MSFAvatar (FRNAvatarViewManagerAdditons)
9
-
10
- + (NSMutableDictionary *)storage;
11
-
12
- @end
13
-
14
- NS_ASSUME_NONNULL_END
15
-
16
- #endif /* FRNAvatarStorage_h */
@@ -1,23 +0,0 @@
1
- #import <Foundation/Foundation.h>
2
- #import "FRNAvatarStorage.h"
3
-
4
- NS_ASSUME_NONNULL_BEGIN
5
-
6
- @implementation MSFAvatar (FRNAvatarViewManagerAdditons)
7
-
8
- static NSMutableDictionary *s_sharedInstance;
9
-
10
- +(NSMutableDictionary *)storage
11
- {
12
- if (s_sharedInstance == nil) {
13
- static dispatch_once_t onceToken;
14
- dispatch_once(&onceToken, ^{
15
- s_sharedInstance = [NSMutableDictionary new];
16
- });
17
- }
18
- return s_sharedInstance;
19
- }
20
-
21
- @end
22
-
23
- NS_ASSUME_NONNULL_END