@fluentui-react-native/experimental-avatar 0.14.45 → 0.15.2
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 +61 -1
- package/CHANGELOG.md +26 -2
- package/FRNAvatar.podspec +2 -2
- package/{lib-commonjs/Avatar.d.ts → lib/NativeAvatar.d.ts} +6 -6
- package/lib/NativeAvatar.d.ts.map +1 -0
- package/lib/{Avatar.js → NativeAvatar.js} +3 -3
- package/lib/NativeAvatar.js.map +1 -0
- package/lib/index.d.ts +1 -3
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -3
- package/lib/index.js.map +1 -1
- package/{lib/Avatar.d.ts → lib-commonjs/NativeAvatar.d.ts} +6 -6
- package/lib-commonjs/NativeAvatar.d.ts.map +1 -0
- package/lib-commonjs/{Avatar.js → NativeAvatar.js} +4 -4
- package/lib-commonjs/NativeAvatar.js.map +1 -0
- package/lib-commonjs/index.d.ts +1 -3
- package/lib-commonjs/index.d.ts.map +1 -1
- package/lib-commonjs/index.js +1 -3
- package/lib-commonjs/index.js.map +1 -1
- package/package.json +2 -10
- package/src/{Avatar.tsx → NativeAvatar.tsx} +11 -11
- package/src/__tests__/Avatar.test.jsx +129 -0
- package/src/__tests__/__snapshots__/{JSAvatar.test.jsx.snap → Avatar.test.jsx.snap} +0 -0
- package/src/index.ts +1 -3
- package/MIGRATION.md +0 -157
- package/SPEC.md +0 -295
- package/jest.config.js +0 -2
- package/lib/Avatar.d.ts.map +0 -1
- package/lib/Avatar.js.map +0 -1
- package/lib/JSAvatar.d.ts +0 -12
- package/lib/JSAvatar.d.ts.map +0 -1
- package/lib/JSAvatar.js +0 -84
- package/lib/JSAvatar.js.map +0 -1
- package/lib/JSAvatar.styling.d.ts +0 -5
- package/lib/JSAvatar.styling.d.ts.map +0 -1
- package/lib/JSAvatar.styling.js +0 -158
- package/lib/JSAvatar.styling.js.map +0 -1
- package/lib/JSAvatar.types.d.ts +0 -213
- package/lib/JSAvatar.types.d.ts.map +0 -1
- package/lib/JSAvatar.types.js +0 -56
- package/lib/JSAvatar.types.js.map +0 -1
- package/lib/JSAvatarTokens.d.ts +0 -5
- package/lib/JSAvatarTokens.d.ts.map +0 -1
- package/lib/JSAvatarTokens.js +0 -198
- package/lib/JSAvatarTokens.js.map +0 -1
- package/lib/JSAvatarTokens.win32.d.ts +0 -5
- package/lib/JSAvatarTokens.win32.d.ts.map +0 -1
- package/lib/JSAvatarTokens.win32.js +0 -201
- package/lib/JSAvatarTokens.win32.js.map +0 -1
- package/lib/getHashCode.d.ts +0 -8
- package/lib/getHashCode.d.ts.map +0 -1
- package/lib/getHashCode.js +0 -16
- package/lib/getHashCode.js.map +0 -1
- package/lib/titles.d.ts +0 -2
- package/lib/titles.d.ts.map +0 -1
- package/lib/titles.js +0 -109
- package/lib/titles.js.map +0 -1
- package/lib/useAvatar.d.ts +0 -33
- package/lib/useAvatar.d.ts.map +0 -1
- package/lib/useAvatar.js +0 -106
- package/lib/useAvatar.js.map +0 -1
- package/lib-commonjs/Avatar.d.ts.map +0 -1
- package/lib-commonjs/Avatar.js.map +0 -1
- package/lib-commonjs/JSAvatar.d.ts +0 -12
- package/lib-commonjs/JSAvatar.d.ts.map +0 -1
- package/lib-commonjs/JSAvatar.js +0 -88
- package/lib-commonjs/JSAvatar.js.map +0 -1
- package/lib-commonjs/JSAvatar.styling.d.ts +0 -5
- package/lib-commonjs/JSAvatar.styling.d.ts.map +0 -1
- package/lib-commonjs/JSAvatar.styling.js +0 -161
- package/lib-commonjs/JSAvatar.styling.js.map +0 -1
- package/lib-commonjs/JSAvatar.types.d.ts +0 -213
- package/lib-commonjs/JSAvatar.types.d.ts.map +0 -1
- package/lib-commonjs/JSAvatar.types.js +0 -59
- package/lib-commonjs/JSAvatar.types.js.map +0 -1
- package/lib-commonjs/JSAvatarTokens.d.ts +0 -5
- package/lib-commonjs/JSAvatarTokens.d.ts.map +0 -1
- package/lib-commonjs/JSAvatarTokens.js +0 -202
- package/lib-commonjs/JSAvatarTokens.js.map +0 -1
- package/lib-commonjs/JSAvatarTokens.win32.d.ts +0 -5
- package/lib-commonjs/JSAvatarTokens.win32.d.ts.map +0 -1
- package/lib-commonjs/JSAvatarTokens.win32.js +0 -205
- package/lib-commonjs/JSAvatarTokens.win32.js.map +0 -1
- package/lib-commonjs/getHashCode.d.ts +0 -8
- package/lib-commonjs/getHashCode.d.ts.map +0 -1
- package/lib-commonjs/getHashCode.js +0 -20
- package/lib-commonjs/getHashCode.js.map +0 -1
- package/lib-commonjs/titles.d.ts +0 -2
- package/lib-commonjs/titles.d.ts.map +0 -1
- package/lib-commonjs/titles.js +0 -112
- package/lib-commonjs/titles.js.map +0 -1
- package/lib-commonjs/useAvatar.d.ts +0 -33
- package/lib-commonjs/useAvatar.d.ts.map +0 -1
- package/lib-commonjs/useAvatar.js +0 -113
- package/lib-commonjs/useAvatar.js.map +0 -1
- package/src/JSAvatar.styling.ts +0 -201
- package/src/JSAvatar.tsx +0 -96
- package/src/JSAvatar.types.ts +0 -286
- package/src/JSAvatarTokens.ts +0 -201
- package/src/JSAvatarTokens.win32.ts +0 -204
- package/src/__tests__/JSAvatar.test.jsx +0 -96
- package/src/getHashCode.ts +0 -16
- package/src/titles.ts +0 -108
- package/src/useAvatar.ts +0 -126
package/src/JSAvatar.types.ts
DELETED
|
@@ -1,286 +0,0 @@
|
|
|
1
|
-
import type { IViewProps } from '@fluentui-react-native/adapters';
|
|
2
|
-
import { ImageProps, ViewProps, TextProps, ColorValue } from 'react-native';
|
|
3
|
-
import { IBackgroundColorTokens, IForegroundColorTokens, IBorderTokens, FontTokens } from '@fluentui-react-native/tokens';
|
|
4
|
-
import { BadgeProps, PresenceBadgeProps, BadgeSize } from '@fluentui-react-native/badge';
|
|
5
|
-
import { IconProps, IconSourcesType } from '@fluentui-react-native/icon';
|
|
6
|
-
|
|
7
|
-
export const JSAvatarName = 'Avatar';
|
|
8
|
-
export const AvatarSizesForTokens = [
|
|
9
|
-
'size20',
|
|
10
|
-
'size24',
|
|
11
|
-
'size28',
|
|
12
|
-
'size32',
|
|
13
|
-
'size36',
|
|
14
|
-
'size40',
|
|
15
|
-
'size48',
|
|
16
|
-
'size56',
|
|
17
|
-
'size64',
|
|
18
|
-
'size72',
|
|
19
|
-
'size96',
|
|
20
|
-
'size120',
|
|
21
|
-
] as const;
|
|
22
|
-
|
|
23
|
-
export const AvatarSizes = [20, 24, 28, 32, 36, 40, 48, 56, 64, 72, 96, 120] as const;
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Sets color of the avatar when there is no picture. Uses fluent color names
|
|
27
|
-
*/
|
|
28
|
-
export const AvatarColors = [
|
|
29
|
-
'darkRed',
|
|
30
|
-
'cranberry',
|
|
31
|
-
'red',
|
|
32
|
-
'pumpkin',
|
|
33
|
-
'peach',
|
|
34
|
-
'marigold',
|
|
35
|
-
'gold',
|
|
36
|
-
'brass',
|
|
37
|
-
'brown',
|
|
38
|
-
'forest',
|
|
39
|
-
'seafoam',
|
|
40
|
-
'darkGreen',
|
|
41
|
-
'lightTeal',
|
|
42
|
-
'teal',
|
|
43
|
-
'steel',
|
|
44
|
-
'blue',
|
|
45
|
-
'royalBlue',
|
|
46
|
-
'cornflower',
|
|
47
|
-
'navy',
|
|
48
|
-
'lavender',
|
|
49
|
-
'purple',
|
|
50
|
-
'grape',
|
|
51
|
-
'lilac',
|
|
52
|
-
'pink',
|
|
53
|
-
'magenta',
|
|
54
|
-
'plum',
|
|
55
|
-
'beige',
|
|
56
|
-
'mink',
|
|
57
|
-
'platinum',
|
|
58
|
-
'anchor',
|
|
59
|
-
'burgundy',
|
|
60
|
-
'hotPink',
|
|
61
|
-
'orchid',
|
|
62
|
-
] as const;
|
|
63
|
-
export const ColorSchemes = ['neutral', 'brand', 'colorful'] as const;
|
|
64
|
-
export type AvatarSize = typeof AvatarSizes[number];
|
|
65
|
-
export type AvatarNamedColor = typeof AvatarColors[number];
|
|
66
|
-
export type AvatarColorSchemes = typeof ColorSchemes[number];
|
|
67
|
-
|
|
68
|
-
export type AvatarShape = 'circular' | 'square';
|
|
69
|
-
export type AvatarActive = 'active' | 'inactive' | 'unset';
|
|
70
|
-
export type AvatarActiveAppearance = 'ring';
|
|
71
|
-
export type AvatarColor = AvatarColorSchemes | AvatarNamedColor | ColorValue;
|
|
72
|
-
|
|
73
|
-
export interface AvatarConfigurableProps {
|
|
74
|
-
/**
|
|
75
|
-
* Optional activity indicator
|
|
76
|
-
* * active: the avatar will be decorated according to activeAppearance
|
|
77
|
-
* * inactive: the avatar will be reduced in size and partially transparent
|
|
78
|
-
* * unset: normal display
|
|
79
|
-
*
|
|
80
|
-
* @defaultvalue unset
|
|
81
|
-
*/
|
|
82
|
-
active?: AvatarActive;
|
|
83
|
-
/**
|
|
84
|
-
* The color when displaying either an icon or initials.
|
|
85
|
-
* * neutral (default): gray
|
|
86
|
-
* * brand: color from the brand palette
|
|
87
|
-
* * colorful: picks a color from a set of pre-defined colors, based on a hash of the name (or idForColor if provided)
|
|
88
|
-
* * [AvatarNamedColor]: a specific color from the theme
|
|
89
|
-
*
|
|
90
|
-
* @defaultvalue neutral
|
|
91
|
-
*/
|
|
92
|
-
avatarColor?: AvatarColor;
|
|
93
|
-
initialsColor?: ColorValue;
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* Ring props
|
|
97
|
-
*/
|
|
98
|
-
ringInnerGap?: number;
|
|
99
|
-
ringBackgroundColor?: ColorValue;
|
|
100
|
-
ringColor?: ColorValue;
|
|
101
|
-
ringThickness?: number;
|
|
102
|
-
transparentRing?: boolean;
|
|
103
|
-
|
|
104
|
-
/**
|
|
105
|
-
* Size of the avatar in pixels.
|
|
106
|
-
*
|
|
107
|
-
* Size is restricted to a limited set of supported values recommended for most uses (see `AvatarSizeValue`) and
|
|
108
|
-
* based on design guidelines for the Avatar control.
|
|
109
|
-
*
|
|
110
|
-
* @defaultvalue 24
|
|
111
|
-
*/
|
|
112
|
-
size?: AvatarSize;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
export interface JSAvatarProps extends IViewProps, AvatarConfigurableProps {
|
|
116
|
-
/**
|
|
117
|
-
* The appearance when `active="active"`
|
|
118
|
-
*
|
|
119
|
-
* @defaultvalue ring
|
|
120
|
-
*/
|
|
121
|
-
activeAppearance?: AvatarActiveAppearance;
|
|
122
|
-
|
|
123
|
-
/**
|
|
124
|
-
* Badge shows the avatar's presence status.
|
|
125
|
-
* Badge can be shown only if `active` prop is undefined or unset
|
|
126
|
-
*/
|
|
127
|
-
badge?: PresenceBadgeProps;
|
|
128
|
-
|
|
129
|
-
/**
|
|
130
|
-
* Icon to be displayed when the avatar doesn't have an image or initials.
|
|
131
|
-
*
|
|
132
|
-
* @defaultvalue `PersonRegular` (the default icon's size depends on the Avatar's size)
|
|
133
|
-
*/
|
|
134
|
-
icon?: IconSourcesType;
|
|
135
|
-
|
|
136
|
-
/**
|
|
137
|
-
* Specify a string to be used instead of the name, to determine which color to use when color="colorful".
|
|
138
|
-
* Use this when a name is not available, but there is another unique identifier that can be used instead.
|
|
139
|
-
*/
|
|
140
|
-
idForColor?: string;
|
|
141
|
-
|
|
142
|
-
/**
|
|
143
|
-
* (optional) Custom initials.
|
|
144
|
-
*
|
|
145
|
-
* It is usually not necessary to specify custom initials; by default they will be derived from the `name` prop,
|
|
146
|
-
* using the `getInitials` function.
|
|
147
|
-
*
|
|
148
|
-
* The initials are displayed when there is no image (including while the image is loading).
|
|
149
|
-
*/
|
|
150
|
-
initials?: string;
|
|
151
|
-
|
|
152
|
-
/**
|
|
153
|
-
* The name of the person or entity represented by this Avatar. This should always be provided if it is available.
|
|
154
|
-
*
|
|
155
|
-
* The name will be used to determine the initials displayed when there is no icon, as well as provided to
|
|
156
|
-
* accessibility tools.
|
|
157
|
-
*/
|
|
158
|
-
name?: string;
|
|
159
|
-
|
|
160
|
-
/**
|
|
161
|
-
* The avatar can have a circular or square shape.
|
|
162
|
-
* @defaultvalue circular
|
|
163
|
-
*/
|
|
164
|
-
shape?: AvatarShape;
|
|
165
|
-
|
|
166
|
-
/**
|
|
167
|
-
* Shorthand for passing image URL instead of using `image` prop
|
|
168
|
-
*/
|
|
169
|
-
imageUrl?: string;
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
export interface JSAvatarTokens extends IBackgroundColorTokens, IForegroundColorTokens, AvatarConfigurableProps, IBorderTokens, FontTokens {
|
|
173
|
-
/**
|
|
174
|
-
* Avatar opacity which is changed depending on `active` prop.
|
|
175
|
-
*/
|
|
176
|
-
avatarOpacity?: number;
|
|
177
|
-
|
|
178
|
-
/**
|
|
179
|
-
* The size of presence badge.
|
|
180
|
-
*/
|
|
181
|
-
badgeSize?: BadgeSize;
|
|
182
|
-
|
|
183
|
-
/**
|
|
184
|
-
* The icon color.
|
|
185
|
-
*/
|
|
186
|
-
iconColor?: ColorValue;
|
|
187
|
-
|
|
188
|
-
/**
|
|
189
|
-
* The size of the icon.
|
|
190
|
-
*/
|
|
191
|
-
iconSize?: number;
|
|
192
|
-
|
|
193
|
-
/**
|
|
194
|
-
* Avatar shapes:
|
|
195
|
-
*/
|
|
196
|
-
circular?: JSAvatarTokens;
|
|
197
|
-
square?: JSAvatarTokens;
|
|
198
|
-
|
|
199
|
-
/**
|
|
200
|
-
* Token for inactive value of `active` prop
|
|
201
|
-
*/
|
|
202
|
-
inactive?: JSAvatarTokens;
|
|
203
|
-
|
|
204
|
-
/**
|
|
205
|
-
* Avatar sizes:
|
|
206
|
-
*/
|
|
207
|
-
size20?: JSAvatarTokens;
|
|
208
|
-
size24?: JSAvatarTokens;
|
|
209
|
-
size28?: JSAvatarTokens;
|
|
210
|
-
size32?: JSAvatarTokens;
|
|
211
|
-
size36?: JSAvatarTokens;
|
|
212
|
-
size40?: JSAvatarTokens;
|
|
213
|
-
size48?: JSAvatarTokens;
|
|
214
|
-
size56?: JSAvatarTokens;
|
|
215
|
-
size64?: JSAvatarTokens;
|
|
216
|
-
size72?: JSAvatarTokens;
|
|
217
|
-
size96?: JSAvatarTokens;
|
|
218
|
-
size120?: JSAvatarTokens;
|
|
219
|
-
|
|
220
|
-
/**
|
|
221
|
-
* Avatar colors:
|
|
222
|
-
*/
|
|
223
|
-
neutral?: JSAvatarTokens;
|
|
224
|
-
brand?: JSAvatarTokens;
|
|
225
|
-
darkRed?: JSAvatarTokens;
|
|
226
|
-
cranberry?: JSAvatarTokens;
|
|
227
|
-
red?: JSAvatarTokens;
|
|
228
|
-
pumpkin?: JSAvatarTokens;
|
|
229
|
-
peach?: JSAvatarTokens;
|
|
230
|
-
marigold?: JSAvatarTokens;
|
|
231
|
-
gold?: JSAvatarTokens;
|
|
232
|
-
brass?: JSAvatarTokens;
|
|
233
|
-
brown?: JSAvatarTokens;
|
|
234
|
-
forest?: JSAvatarTokens;
|
|
235
|
-
seafoam?: JSAvatarTokens;
|
|
236
|
-
darkGreen?: JSAvatarTokens;
|
|
237
|
-
lightTeal?: JSAvatarTokens;
|
|
238
|
-
teal?: JSAvatarTokens;
|
|
239
|
-
steel?: JSAvatarTokens;
|
|
240
|
-
blue?: JSAvatarTokens;
|
|
241
|
-
royalBlue?: JSAvatarTokens;
|
|
242
|
-
cornflower?: JSAvatarTokens;
|
|
243
|
-
navy?: JSAvatarTokens;
|
|
244
|
-
lavender?: JSAvatarTokens;
|
|
245
|
-
purple?: JSAvatarTokens;
|
|
246
|
-
grape?: JSAvatarTokens;
|
|
247
|
-
lilac?: JSAvatarTokens;
|
|
248
|
-
pink?: JSAvatarTokens;
|
|
249
|
-
magenta?: JSAvatarTokens;
|
|
250
|
-
plum?: JSAvatarTokens;
|
|
251
|
-
beige?: JSAvatarTokens;
|
|
252
|
-
mink?: JSAvatarTokens;
|
|
253
|
-
platinum?: JSAvatarTokens;
|
|
254
|
-
anchor?: JSAvatarTokens;
|
|
255
|
-
burgundy?: JSAvatarTokens;
|
|
256
|
-
hotPink?: JSAvatarTokens;
|
|
257
|
-
orchid?: JSAvatarTokens;
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
export interface AvatarSlotProps {
|
|
261
|
-
root: ViewProps;
|
|
262
|
-
image: ImageProps;
|
|
263
|
-
initials: TextProps;
|
|
264
|
-
initialsBackground: ViewProps;
|
|
265
|
-
icon: IconProps;
|
|
266
|
-
ring: ViewProps;
|
|
267
|
-
badge: BadgeProps;
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
export interface JSAvatarState {
|
|
271
|
-
showRing: boolean;
|
|
272
|
-
transparentRing: boolean;
|
|
273
|
-
showBadge: boolean;
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
export interface AvatarInfo {
|
|
277
|
-
props: JSAvatarProps;
|
|
278
|
-
state: JSAvatarState;
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
export interface JSAvatarType {
|
|
282
|
-
props: JSAvatarProps;
|
|
283
|
-
slotProps: AvatarSlotProps;
|
|
284
|
-
tokens: JSAvatarTokens;
|
|
285
|
-
state: JSAvatarState;
|
|
286
|
-
}
|
package/src/JSAvatarTokens.ts
DELETED
|
@@ -1,201 +0,0 @@
|
|
|
1
|
-
import { Theme } from '@fluentui-react-native/framework';
|
|
2
|
-
import { TokenSettings } from '@fluentui-react-native/use-styling';
|
|
3
|
-
import { JSAvatarTokens } from '.';
|
|
4
|
-
import { globalTokens } from '@fluentui-react-native/theme-tokens';
|
|
5
|
-
|
|
6
|
-
export const defaultJSAvatarTokens: TokenSettings<JSAvatarTokens, Theme> = (t: Theme) =>
|
|
7
|
-
({
|
|
8
|
-
color: t.colors.neutralForeground3,
|
|
9
|
-
backgroundColor: t.colors.neutralBackground6,
|
|
10
|
-
avatarOpacity: 1,
|
|
11
|
-
fontFamily: t.typography.families.primary,
|
|
12
|
-
fontWeight: globalTokens.font.weight.semibold,
|
|
13
|
-
fontSize: globalTokens.font.size[200],
|
|
14
|
-
size: 24,
|
|
15
|
-
iconSize: 16,
|
|
16
|
-
iconColor: t.colors.neutralForeground3,
|
|
17
|
-
ringColor: t.colors.transparentStroke,
|
|
18
|
-
borderColor: globalTokens.color.white,
|
|
19
|
-
borderWidth: t.host.appearance === 'highContrast' ? 1 : 0,
|
|
20
|
-
circular: {
|
|
21
|
-
borderRadius: globalTokens.corner.radius.circle,
|
|
22
|
-
},
|
|
23
|
-
square: {
|
|
24
|
-
borderRadius: globalTokens.corner.radius.medium,
|
|
25
|
-
},
|
|
26
|
-
inactive: {
|
|
27
|
-
avatarOpacity: 0.8,
|
|
28
|
-
},
|
|
29
|
-
size20: {
|
|
30
|
-
size: 20,
|
|
31
|
-
badgeSize: 'smallest',
|
|
32
|
-
iconSize: 16,
|
|
33
|
-
fontSize: globalTokens.font.size[100],
|
|
34
|
-
square: {
|
|
35
|
-
borderRadius: globalTokens.corner.radius.small,
|
|
36
|
-
},
|
|
37
|
-
},
|
|
38
|
-
size24: {
|
|
39
|
-
size: 24,
|
|
40
|
-
badgeSize: 'smallest',
|
|
41
|
-
iconSize: 16,
|
|
42
|
-
fontSize: globalTokens.font.size[100],
|
|
43
|
-
square: {
|
|
44
|
-
borderRadius: globalTokens.corner.radius.small,
|
|
45
|
-
},
|
|
46
|
-
},
|
|
47
|
-
size28: {
|
|
48
|
-
size: 28,
|
|
49
|
-
badgeSize: 'smaller',
|
|
50
|
-
iconSize: 20,
|
|
51
|
-
fontWeight: globalTokens.font.weight.semibold,
|
|
52
|
-
fontSize: globalTokens.font.size[100],
|
|
53
|
-
},
|
|
54
|
-
size32: {
|
|
55
|
-
size: 32,
|
|
56
|
-
badgeSize: 'smaller',
|
|
57
|
-
iconSize: 20,
|
|
58
|
-
fontSize: globalTokens.font.size[100],
|
|
59
|
-
},
|
|
60
|
-
size36: {
|
|
61
|
-
size: 36,
|
|
62
|
-
badgeSize: 'smaller',
|
|
63
|
-
iconSize: 20,
|
|
64
|
-
},
|
|
65
|
-
size40: {
|
|
66
|
-
size: 40,
|
|
67
|
-
badgeSize: 'small',
|
|
68
|
-
iconSize: 20,
|
|
69
|
-
},
|
|
70
|
-
size48: {
|
|
71
|
-
size: 48,
|
|
72
|
-
badgeSize: 'small',
|
|
73
|
-
iconSize: 24,
|
|
74
|
-
},
|
|
75
|
-
size56: {
|
|
76
|
-
size: 56,
|
|
77
|
-
badgeSize: 'medium',
|
|
78
|
-
iconSize: 28,
|
|
79
|
-
fontSize: globalTokens.font.size[400],
|
|
80
|
-
square: {
|
|
81
|
-
borderRadius: globalTokens.corner.radius.large,
|
|
82
|
-
},
|
|
83
|
-
},
|
|
84
|
-
size64: {
|
|
85
|
-
size: 64,
|
|
86
|
-
badgeSize: 'large',
|
|
87
|
-
iconSize: 32,
|
|
88
|
-
fontSize: globalTokens.font.size[500],
|
|
89
|
-
square: {
|
|
90
|
-
borderRadius: globalTokens.corner.radius.large,
|
|
91
|
-
},
|
|
92
|
-
},
|
|
93
|
-
size72: {
|
|
94
|
-
size: 72,
|
|
95
|
-
badgeSize: 'large',
|
|
96
|
-
iconSize: 32,
|
|
97
|
-
fontSize: globalTokens.font.size[500],
|
|
98
|
-
square: {
|
|
99
|
-
borderRadius: globalTokens.corner.radius.large,
|
|
100
|
-
},
|
|
101
|
-
},
|
|
102
|
-
size96: {
|
|
103
|
-
size: 96,
|
|
104
|
-
badgeSize: 'largest',
|
|
105
|
-
iconSize: 48,
|
|
106
|
-
fontWeight: globalTokens.font.weight.regular,
|
|
107
|
-
fontSize: globalTokens.font.size[700],
|
|
108
|
-
square: {
|
|
109
|
-
borderRadius: globalTokens.corner.radius.extraLarge,
|
|
110
|
-
},
|
|
111
|
-
},
|
|
112
|
-
size120: {
|
|
113
|
-
size: 120,
|
|
114
|
-
badgeSize: 'largest',
|
|
115
|
-
iconSize: 48,
|
|
116
|
-
fontWeight: globalTokens.font.weight.regular,
|
|
117
|
-
fontSize: globalTokens.font.size[900],
|
|
118
|
-
square: {
|
|
119
|
-
borderRadius: globalTokens.corner.radius.extraLarge,
|
|
120
|
-
},
|
|
121
|
-
},
|
|
122
|
-
neutral: {
|
|
123
|
-
backgroundColor: t.colors.neutralBackground6,
|
|
124
|
-
color: t.colors.neutralForeground3,
|
|
125
|
-
iconColor: t.colors.neutralForeground3,
|
|
126
|
-
ringColor: t.colors.transparentStroke,
|
|
127
|
-
},
|
|
128
|
-
brand: {
|
|
129
|
-
backgroundColor: t.colors.brandBackgroundStatic,
|
|
130
|
-
color: t.colors.neutralForegroundOnBrand,
|
|
131
|
-
iconColor: t.colors.neutralForegroundOnBrand,
|
|
132
|
-
ringColor: t.colors.transparentStroke,
|
|
133
|
-
},
|
|
134
|
-
darkRed: getColorProps('darkRed', t),
|
|
135
|
-
cranberry: getColorProps('cranberry', t),
|
|
136
|
-
red: getColorProps('red', t),
|
|
137
|
-
pumpkin: getColorProps('pumpkin', t),
|
|
138
|
-
peach: getColorProps('peach', t),
|
|
139
|
-
marigold: getColorProps('marigold', t),
|
|
140
|
-
gold: getColorProps('gold', t),
|
|
141
|
-
brass: getColorProps('brass', t),
|
|
142
|
-
brown: getColorProps('brown', t),
|
|
143
|
-
forest: getColorProps('forest', t),
|
|
144
|
-
seafoam: getColorProps('seafoam', t),
|
|
145
|
-
darkGreen: getColorProps('darkGreen', t),
|
|
146
|
-
lightTeal: getColorProps('lightTeal', t),
|
|
147
|
-
teal: getColorProps('teal', t),
|
|
148
|
-
steel: getColorProps('steel', t),
|
|
149
|
-
blue: getColorProps('blue', t),
|
|
150
|
-
royalBlue: getColorProps('royalBlue', t),
|
|
151
|
-
cornflower: getColorProps('cornflower', t),
|
|
152
|
-
navy: getColorProps('navy', t),
|
|
153
|
-
lavender: getColorProps('lavender', t),
|
|
154
|
-
purple: getColorProps('purple', t),
|
|
155
|
-
grape: getColorProps('grape', t),
|
|
156
|
-
lilac: getColorProps('lilac', t),
|
|
157
|
-
pink: getColorProps('pink', t),
|
|
158
|
-
magenta: getColorProps('magenta', t),
|
|
159
|
-
plum: getColorProps('plum', t),
|
|
160
|
-
beige: getColorProps('beige', t),
|
|
161
|
-
mink: getColorProps('mink', t),
|
|
162
|
-
platinum: getColorProps('platinum', t),
|
|
163
|
-
anchor: getColorProps('anchor', t),
|
|
164
|
-
burgundy: getColorProps('burgundy', t),
|
|
165
|
-
hotPink: getColorProps('hotPink', t),
|
|
166
|
-
orchid: getColorProps('orchid', t),
|
|
167
|
-
} as JSAvatarTokens);
|
|
168
|
-
|
|
169
|
-
/**
|
|
170
|
-
* A function which returns object of props depending on color and theme.
|
|
171
|
-
* @param color
|
|
172
|
-
* @param theme
|
|
173
|
-
* @returns object of props - backgroundColor, color and ringColor
|
|
174
|
-
*/
|
|
175
|
-
function getColorProps(color: string, theme: Theme) {
|
|
176
|
-
const themeAppearance = theme.host.appearance;
|
|
177
|
-
switch (themeAppearance) {
|
|
178
|
-
case 'light':
|
|
179
|
-
default:
|
|
180
|
-
return {
|
|
181
|
-
backgroundColor: globalTokens.color[color].tint40,
|
|
182
|
-
color: globalTokens.color[color].shade30,
|
|
183
|
-
iconColor: globalTokens.color[color].shade30,
|
|
184
|
-
ringColor: globalTokens.color[color].primary,
|
|
185
|
-
};
|
|
186
|
-
case 'dark':
|
|
187
|
-
return {
|
|
188
|
-
backgroundColor: globalTokens.color[color].shade30,
|
|
189
|
-
color: globalTokens.color[color].tint40,
|
|
190
|
-
iconColor: globalTokens.color[color].tint40,
|
|
191
|
-
ringColor: globalTokens.color[color].tint30,
|
|
192
|
-
};
|
|
193
|
-
case 'highContrast':
|
|
194
|
-
return {
|
|
195
|
-
backgroundColor: theme.colors.neutralBackground6,
|
|
196
|
-
color: theme.colors.neutralForeground3,
|
|
197
|
-
iconColor: theme.colors.neutralForeground3,
|
|
198
|
-
ringColor: theme.colors.transparentStroke,
|
|
199
|
-
};
|
|
200
|
-
}
|
|
201
|
-
}
|
|
@@ -1,204 +0,0 @@
|
|
|
1
|
-
import { Theme } from '@fluentui-react-native/framework';
|
|
2
|
-
import { TokenSettings } from '@fluentui-react-native/use-styling';
|
|
3
|
-
import { JSAvatarTokens } from '.';
|
|
4
|
-
import { globalTokens } from '@fluentui-react-native/theme-tokens';
|
|
5
|
-
|
|
6
|
-
export const defaultJSAvatarTokens: TokenSettings<JSAvatarTokens, Theme> = (t: Theme) =>
|
|
7
|
-
({
|
|
8
|
-
badgeSize: 'smallest',
|
|
9
|
-
color: t.colors.neutralForeground3,
|
|
10
|
-
backgroundColor: t.colors.neutralBackground6,
|
|
11
|
-
avatarOpacity: 1,
|
|
12
|
-
fontFamily: t.typography.families.primary,
|
|
13
|
-
fontWeight: globalTokens.font.weight.semibold,
|
|
14
|
-
fontSize: globalTokens.font.size[200],
|
|
15
|
-
size: 24,
|
|
16
|
-
iconSize: 16,
|
|
17
|
-
iconColor: t.colors.neutralForeground3,
|
|
18
|
-
ringColor: t.colors.transparentStroke,
|
|
19
|
-
borderColor: globalTokens.color.white,
|
|
20
|
-
borderWidth: t.name === 'HighContrast' ? 1 : 0,
|
|
21
|
-
circular: {
|
|
22
|
-
borderRadius: globalTokens.corner.radius.circle,
|
|
23
|
-
},
|
|
24
|
-
square: {
|
|
25
|
-
borderRadius: globalTokens.corner.radius.medium,
|
|
26
|
-
},
|
|
27
|
-
inactive: {
|
|
28
|
-
avatarOpacity: 0.8,
|
|
29
|
-
},
|
|
30
|
-
size20: {
|
|
31
|
-
size: 20,
|
|
32
|
-
badgeSize: 'smallest',
|
|
33
|
-
iconSize: 16,
|
|
34
|
-
fontSize: globalTokens.font.size[100],
|
|
35
|
-
square: {
|
|
36
|
-
borderRadius: globalTokens.corner.radius.small,
|
|
37
|
-
},
|
|
38
|
-
},
|
|
39
|
-
size24: {
|
|
40
|
-
size: 24,
|
|
41
|
-
badgeSize: 'smallest',
|
|
42
|
-
iconSize: 16,
|
|
43
|
-
fontSize: globalTokens.font.size[100],
|
|
44
|
-
square: {
|
|
45
|
-
borderRadius: globalTokens.corner.radius.small,
|
|
46
|
-
},
|
|
47
|
-
},
|
|
48
|
-
size28: {
|
|
49
|
-
size: 28,
|
|
50
|
-
badgeSize: 'smaller',
|
|
51
|
-
iconSize: 20,
|
|
52
|
-
fontWeight: globalTokens.font.weight.semibold,
|
|
53
|
-
fontSize: globalTokens.font.size[100],
|
|
54
|
-
},
|
|
55
|
-
size32: {
|
|
56
|
-
size: 32,
|
|
57
|
-
badgeSize: 'smaller',
|
|
58
|
-
iconSize: 20,
|
|
59
|
-
fontSize: globalTokens.font.size[100],
|
|
60
|
-
},
|
|
61
|
-
size36: {
|
|
62
|
-
size: 36,
|
|
63
|
-
badgeSize: 'smaller',
|
|
64
|
-
iconSize: 20,
|
|
65
|
-
},
|
|
66
|
-
size40: {
|
|
67
|
-
size: 40,
|
|
68
|
-
badgeSize: 'small',
|
|
69
|
-
iconSize: 20,
|
|
70
|
-
},
|
|
71
|
-
size48: {
|
|
72
|
-
size: 48,
|
|
73
|
-
badgeSize: 'small',
|
|
74
|
-
iconSize: 24,
|
|
75
|
-
},
|
|
76
|
-
size56: {
|
|
77
|
-
size: 56,
|
|
78
|
-
badgeSize: 'medium',
|
|
79
|
-
iconSize: 28,
|
|
80
|
-
fontSize: globalTokens.font.size[400],
|
|
81
|
-
square: {
|
|
82
|
-
borderRadius: globalTokens.corner.radius.large,
|
|
83
|
-
},
|
|
84
|
-
},
|
|
85
|
-
size64: {
|
|
86
|
-
size: 64,
|
|
87
|
-
badgeSize: 'large',
|
|
88
|
-
iconSize: 32,
|
|
89
|
-
fontSize: globalTokens.font.size[500],
|
|
90
|
-
square: {
|
|
91
|
-
borderRadius: globalTokens.corner.radius.large,
|
|
92
|
-
},
|
|
93
|
-
},
|
|
94
|
-
size72: {
|
|
95
|
-
size: 72,
|
|
96
|
-
badgeSize: 'large',
|
|
97
|
-
iconSize: 32,
|
|
98
|
-
fontSize: globalTokens.font.size[500],
|
|
99
|
-
square: {
|
|
100
|
-
borderRadius: globalTokens.corner.radius.large,
|
|
101
|
-
},
|
|
102
|
-
},
|
|
103
|
-
size96: {
|
|
104
|
-
size: 96,
|
|
105
|
-
badgeSize: 'largest',
|
|
106
|
-
iconSize: 48,
|
|
107
|
-
fontWeight: globalTokens.font.weight.regular,
|
|
108
|
-
fontSize: globalTokens.font.size[700],
|
|
109
|
-
square: {
|
|
110
|
-
borderRadius: globalTokens.corner.radius.extraLarge,
|
|
111
|
-
},
|
|
112
|
-
},
|
|
113
|
-
size120: {
|
|
114
|
-
size: 120,
|
|
115
|
-
badgeSize: 'largest',
|
|
116
|
-
iconSize: 48,
|
|
117
|
-
fontWeight: globalTokens.font.weight.regular,
|
|
118
|
-
fontSize: globalTokens.font.size[900],
|
|
119
|
-
square: {
|
|
120
|
-
borderRadius: globalTokens.corner.radius.extraLarge,
|
|
121
|
-
},
|
|
122
|
-
},
|
|
123
|
-
neutral: {
|
|
124
|
-
backgroundColor: t.colors.neutralBackground6,
|
|
125
|
-
color: t.colors.neutralForeground3,
|
|
126
|
-
iconColor: t.colors.neutralForeground3,
|
|
127
|
-
ringColor: t.colors.transparentStroke,
|
|
128
|
-
},
|
|
129
|
-
brand: {
|
|
130
|
-
backgroundColor: t.colors.brandBackgroundStatic,
|
|
131
|
-
color: t.colors.neutralForegroundOnBrand,
|
|
132
|
-
iconColor: t.colors.neutralForegroundOnBrand,
|
|
133
|
-
ringColor: t.colors.transparentStroke,
|
|
134
|
-
},
|
|
135
|
-
darkRed: getColorProps('darkRed', t),
|
|
136
|
-
cranberry: getColorProps('cranberry', t),
|
|
137
|
-
red: getColorProps('red', t),
|
|
138
|
-
pumpkin: getColorProps('pumpkin', t),
|
|
139
|
-
peach: getColorProps('peach', t),
|
|
140
|
-
marigold: getColorProps('marigold', t),
|
|
141
|
-
gold: getColorProps('gold', t),
|
|
142
|
-
brass: getColorProps('brass', t),
|
|
143
|
-
brown: getColorProps('brown', t),
|
|
144
|
-
forest: getColorProps('forest', t),
|
|
145
|
-
seafoam: getColorProps('seafoam', t),
|
|
146
|
-
darkGreen: getColorProps('darkGreen', t),
|
|
147
|
-
lightTeal: getColorProps('lightTeal', t),
|
|
148
|
-
teal: getColorProps('teal', t),
|
|
149
|
-
steel: getColorProps('steel', t),
|
|
150
|
-
blue: getColorProps('blue', t),
|
|
151
|
-
royalBlue: getColorProps('royalBlue', t),
|
|
152
|
-
cornflower: getColorProps('cornflower', t),
|
|
153
|
-
navy: getColorProps('navy', t),
|
|
154
|
-
lavender: getColorProps('lavender', t),
|
|
155
|
-
purple: getColorProps('purple', t),
|
|
156
|
-
grape: getColorProps('grape', t),
|
|
157
|
-
lilac: getColorProps('lilac', t),
|
|
158
|
-
pink: getColorProps('pink', t),
|
|
159
|
-
magenta: getColorProps('magenta', t),
|
|
160
|
-
plum: getColorProps('plum', t),
|
|
161
|
-
beige: getColorProps('beige', t),
|
|
162
|
-
mink: getColorProps('mink', t),
|
|
163
|
-
platinum: getColorProps('platinum', t),
|
|
164
|
-
anchor: getColorProps('anchor', t),
|
|
165
|
-
burgundy: getColorProps('burgundy', t),
|
|
166
|
-
hotPink: getColorProps('hotPink', t),
|
|
167
|
-
orchid: getColorProps('orchid', t),
|
|
168
|
-
} as JSAvatarTokens);
|
|
169
|
-
|
|
170
|
-
/**
|
|
171
|
-
* A function which returns object of props depending on color and theme.
|
|
172
|
-
* @param color
|
|
173
|
-
* @param theme
|
|
174
|
-
* @returns object of props - backgroundColor, color and ringColor
|
|
175
|
-
*/
|
|
176
|
-
function getColorProps(color: string, theme: Theme) {
|
|
177
|
-
const themeAppearance = theme.name;
|
|
178
|
-
switch (themeAppearance) {
|
|
179
|
-
case 'White':
|
|
180
|
-
case 'Colorful':
|
|
181
|
-
default:
|
|
182
|
-
return {
|
|
183
|
-
backgroundColor: globalTokens.color[color].tint40,
|
|
184
|
-
color: globalTokens.color[color].shade30,
|
|
185
|
-
iconColor: globalTokens.color[color].shade30,
|
|
186
|
-
ringColor: globalTokens.color[color].primary,
|
|
187
|
-
};
|
|
188
|
-
case 'DarkGray':
|
|
189
|
-
case 'Black':
|
|
190
|
-
return {
|
|
191
|
-
backgroundColor: globalTokens.color[color].shade30,
|
|
192
|
-
color: globalTokens.color[color].tint40,
|
|
193
|
-
iconColor: globalTokens.color[color].tint40,
|
|
194
|
-
ringColor: globalTokens.color[color].tint30,
|
|
195
|
-
};
|
|
196
|
-
case 'HighContrast':
|
|
197
|
-
return {
|
|
198
|
-
backgroundColor: theme.colors.neutralBackground6,
|
|
199
|
-
color: theme.colors.neutralForeground3,
|
|
200
|
-
iconColor: theme.colors.neutralForeground3,
|
|
201
|
-
ringColor: theme.colors.transparentStroke,
|
|
202
|
-
};
|
|
203
|
-
}
|
|
204
|
-
}
|