@fluentui/react-avatar 9.8.6 → 9.9.0
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.md +25 -2
- package/lib/components/Avatar/Avatar.types.js.map +1 -1
- package/lib/components/Avatar/useAvatarStyles.styles.raw.js +702 -0
- package/lib/components/Avatar/useAvatarStyles.styles.raw.js.map +1 -0
- package/lib/components/AvatarGroup/useAvatarGroupStyles.styles.raw.js +31 -0
- package/lib/components/AvatarGroup/useAvatarGroupStyles.styles.raw.js.map +1 -0
- package/lib/components/AvatarGroupItem/useAvatarGroupItemStyles.styles.raw.js +266 -0
- package/lib/components/AvatarGroupItem/useAvatarGroupItemStyles.styles.raw.js.map +1 -0
- package/lib/components/AvatarGroupPopover/useAvatarGroupPopoverStyles.styles.raw.js +188 -0
- package/lib/components/AvatarGroupPopover/useAvatarGroupPopoverStyles.styles.raw.js.map +1 -0
- package/lib-commonjs/components/Avatar/Avatar.types.js.map +1 -1
- package/lib-commonjs/components/Avatar/useAvatarStyles.styles.raw.js +723 -0
- package/lib-commonjs/components/Avatar/useAvatarStyles.styles.raw.js.map +1 -0
- package/lib-commonjs/components/AvatarGroup/useAvatarGroupStyles.styles.raw.js +47 -0
- package/lib-commonjs/components/AvatarGroup/useAvatarGroupStyles.styles.raw.js.map +1 -0
- package/lib-commonjs/components/AvatarGroupItem/useAvatarGroupItemStyles.styles.raw.js +282 -0
- package/lib-commonjs/components/AvatarGroupItem/useAvatarGroupItemStyles.styles.raw.js.map +1 -0
- package/lib-commonjs/components/AvatarGroupPopover/useAvatarGroupPopoverStyles.styles.raw.js +204 -0
- package/lib-commonjs/components/AvatarGroupPopover/useAvatarGroupPopoverStyles.styles.raw.js.map +1 -0
- package/package.json +5 -5
|
@@ -0,0 +1,723 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: all[name]
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
avatarClassNames: function() {
|
|
13
|
+
return avatarClassNames;
|
|
14
|
+
},
|
|
15
|
+
useAvatarStyles_unstable: function() {
|
|
16
|
+
return useAvatarStyles_unstable;
|
|
17
|
+
},
|
|
18
|
+
useSizeStyles: function() {
|
|
19
|
+
return useSizeStyles;
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
const _reacttheme = require("@fluentui/react-theme");
|
|
23
|
+
const _react = require("@griffel/react");
|
|
24
|
+
const avatarClassNames = {
|
|
25
|
+
root: 'fui-Avatar',
|
|
26
|
+
image: 'fui-Avatar__image',
|
|
27
|
+
initials: 'fui-Avatar__initials',
|
|
28
|
+
icon: 'fui-Avatar__icon',
|
|
29
|
+
badge: 'fui-Avatar__badge'
|
|
30
|
+
};
|
|
31
|
+
// CSS variables used internally in Avatar's styles
|
|
32
|
+
const vars = {
|
|
33
|
+
badgeRadius: '--fui-Avatar-badgeRadius',
|
|
34
|
+
badgeGap: '--fui-Avatar-badgeGap',
|
|
35
|
+
badgeAlign: '--fui-Avatar-badgeAlign',
|
|
36
|
+
ringWidth: '--fui-Avatar-ringWidth'
|
|
37
|
+
};
|
|
38
|
+
const useRootClassName = (0, _react.makeResetStyles)({
|
|
39
|
+
display: 'inline-block',
|
|
40
|
+
flexShrink: 0,
|
|
41
|
+
position: 'relative',
|
|
42
|
+
verticalAlign: 'middle',
|
|
43
|
+
borderRadius: _reacttheme.tokens.borderRadiusCircular,
|
|
44
|
+
fontFamily: _reacttheme.tokens.fontFamilyBase,
|
|
45
|
+
fontWeight: _reacttheme.tokens.fontWeightSemibold,
|
|
46
|
+
fontSize: _reacttheme.tokens.fontSizeBase300,
|
|
47
|
+
width: '32px',
|
|
48
|
+
height: '32px',
|
|
49
|
+
// ::before is the ring, and ::after is the shadow.
|
|
50
|
+
// These are not displayed by default; the ring and shadow clases set content: "" to display them when appropriate.
|
|
51
|
+
'::before,::after': {
|
|
52
|
+
position: 'absolute',
|
|
53
|
+
top: 0,
|
|
54
|
+
left: 0,
|
|
55
|
+
bottom: 0,
|
|
56
|
+
right: 0,
|
|
57
|
+
zIndex: -1,
|
|
58
|
+
margin: `calc(-2 * var(${vars.ringWidth}, 0px))`,
|
|
59
|
+
borderRadius: 'inherit',
|
|
60
|
+
transitionProperty: 'margin, opacity',
|
|
61
|
+
transitionTimingFunction: `${_reacttheme.tokens.curveEasyEaseMax}, ${_reacttheme.tokens.curveLinear}`,
|
|
62
|
+
transitionDuration: `${_reacttheme.tokens.durationUltraSlow}, ${_reacttheme.tokens.durationSlower}`,
|
|
63
|
+
'@media screen and (prefers-reduced-motion: reduce)': {
|
|
64
|
+
transitionDuration: '0.01ms'
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
'::before': {
|
|
68
|
+
borderStyle: 'solid',
|
|
69
|
+
borderWidth: `var(${vars.ringWidth})`
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
const useImageClassName = (0, _react.makeResetStyles)({
|
|
73
|
+
position: 'absolute',
|
|
74
|
+
top: 0,
|
|
75
|
+
left: 0,
|
|
76
|
+
width: '100%',
|
|
77
|
+
height: '100%',
|
|
78
|
+
borderRadius: 'inherit',
|
|
79
|
+
objectFit: 'cover',
|
|
80
|
+
verticalAlign: 'top'
|
|
81
|
+
});
|
|
82
|
+
const useIconInitialsClassName = (0, _react.makeResetStyles)({
|
|
83
|
+
position: 'absolute',
|
|
84
|
+
boxSizing: 'border-box',
|
|
85
|
+
top: 0,
|
|
86
|
+
left: 0,
|
|
87
|
+
width: '100%',
|
|
88
|
+
height: '100%',
|
|
89
|
+
lineHeight: '1',
|
|
90
|
+
border: `${_reacttheme.tokens.strokeWidthThin} solid ${_reacttheme.tokens.colorTransparentStroke}`,
|
|
91
|
+
display: 'flex',
|
|
92
|
+
alignItems: 'center',
|
|
93
|
+
justifyContent: 'center',
|
|
94
|
+
verticalAlign: 'center',
|
|
95
|
+
textAlign: 'center',
|
|
96
|
+
userSelect: 'none',
|
|
97
|
+
borderRadius: 'inherit'
|
|
98
|
+
});
|
|
99
|
+
/**
|
|
100
|
+
* Helper to create a maskImage that punches out a circle larger than the badge by `badgeGap`.
|
|
101
|
+
* This creates a transparent gap between the badge and Avatar.
|
|
102
|
+
*
|
|
103
|
+
* Used by the icon, initials, and image slots, as well as the ring ::before pseudo-element.
|
|
104
|
+
*/ const badgeMask = (margin)=>{
|
|
105
|
+
// Center the cutout at the badge's radius away from the edge.
|
|
106
|
+
// The ring (::before) also has a 2 * ringWidth margin that also needs to be offset.
|
|
107
|
+
const centerOffset = margin ? `calc(var(${vars.badgeRadius}) + ${margin})` : `var(${vars.badgeRadius})`;
|
|
108
|
+
// radial-gradient does not have anti-aliasing, so the transparent and opaque gradient stops are offset by +/- 0.25px
|
|
109
|
+
// to "fade" from transparent to opaque over a half-pixel and ease the transition.
|
|
110
|
+
const innerRadius = `calc(var(${vars.badgeRadius}) + var(${vars.badgeGap}) - 0.25px)`;
|
|
111
|
+
const outerRadius = `calc(var(${vars.badgeRadius}) + var(${vars.badgeGap}) + 0.25px)`;
|
|
112
|
+
return `radial-gradient(circle at bottom ${centerOffset} var(${vars.badgeAlign}) ${centerOffset}, ` + `transparent ${innerRadius}, white ${outerRadius})`;
|
|
113
|
+
};
|
|
114
|
+
const useStyles = (0, _react.makeStyles)({
|
|
115
|
+
textCaption2Strong: {
|
|
116
|
+
fontSize: _reacttheme.tokens.fontSizeBase100
|
|
117
|
+
},
|
|
118
|
+
textCaption1Strong: {
|
|
119
|
+
fontSize: _reacttheme.tokens.fontSizeBase200
|
|
120
|
+
},
|
|
121
|
+
textSubtitle2: {
|
|
122
|
+
fontSize: _reacttheme.tokens.fontSizeBase400
|
|
123
|
+
},
|
|
124
|
+
textSubtitle1: {
|
|
125
|
+
fontSize: _reacttheme.tokens.fontSizeBase500
|
|
126
|
+
},
|
|
127
|
+
textTitle3: {
|
|
128
|
+
fontSize: _reacttheme.tokens.fontSizeBase600
|
|
129
|
+
},
|
|
130
|
+
squareSmall: {
|
|
131
|
+
borderRadius: _reacttheme.tokens.borderRadiusSmall
|
|
132
|
+
},
|
|
133
|
+
squareMedium: {
|
|
134
|
+
borderRadius: _reacttheme.tokens.borderRadiusMedium
|
|
135
|
+
},
|
|
136
|
+
squareLarge: {
|
|
137
|
+
borderRadius: _reacttheme.tokens.borderRadiusLarge
|
|
138
|
+
},
|
|
139
|
+
squareXLarge: {
|
|
140
|
+
borderRadius: _reacttheme.tokens.borderRadiusXLarge
|
|
141
|
+
},
|
|
142
|
+
activeOrInactive: {
|
|
143
|
+
transform: 'perspective(1px)',
|
|
144
|
+
transitionProperty: 'transform, opacity',
|
|
145
|
+
transitionDuration: `${_reacttheme.tokens.durationUltraSlow}, ${_reacttheme.tokens.durationFaster}`,
|
|
146
|
+
transitionTimingFunction: `${_reacttheme.tokens.curveEasyEaseMax}, ${_reacttheme.tokens.curveLinear}`,
|
|
147
|
+
'@media screen and (prefers-reduced-motion: reduce)': {
|
|
148
|
+
transitionDuration: '0.01ms'
|
|
149
|
+
}
|
|
150
|
+
},
|
|
151
|
+
ring: {
|
|
152
|
+
// Show the ::before pseudo-element, which is the ring
|
|
153
|
+
'::before': {
|
|
154
|
+
content: '""'
|
|
155
|
+
}
|
|
156
|
+
},
|
|
157
|
+
ringBadgeCutout: {
|
|
158
|
+
'::before': {
|
|
159
|
+
maskImage: badgeMask(/*margin =*/ `2 * var(${vars.ringWidth})`)
|
|
160
|
+
}
|
|
161
|
+
},
|
|
162
|
+
ringThick: {
|
|
163
|
+
[vars.ringWidth]: _reacttheme.tokens.strokeWidthThick
|
|
164
|
+
},
|
|
165
|
+
ringThicker: {
|
|
166
|
+
[vars.ringWidth]: _reacttheme.tokens.strokeWidthThicker
|
|
167
|
+
},
|
|
168
|
+
ringThickest: {
|
|
169
|
+
[vars.ringWidth]: _reacttheme.tokens.strokeWidthThickest
|
|
170
|
+
},
|
|
171
|
+
shadow: {
|
|
172
|
+
// Show the ::after pseudo-element, which is the shadow
|
|
173
|
+
'::after': {
|
|
174
|
+
content: '""'
|
|
175
|
+
}
|
|
176
|
+
},
|
|
177
|
+
shadow4: {
|
|
178
|
+
'::after': {
|
|
179
|
+
boxShadow: _reacttheme.tokens.shadow4
|
|
180
|
+
}
|
|
181
|
+
},
|
|
182
|
+
shadow8: {
|
|
183
|
+
'::after': {
|
|
184
|
+
boxShadow: _reacttheme.tokens.shadow8
|
|
185
|
+
}
|
|
186
|
+
},
|
|
187
|
+
shadow16: {
|
|
188
|
+
'::after': {
|
|
189
|
+
boxShadow: _reacttheme.tokens.shadow16
|
|
190
|
+
}
|
|
191
|
+
},
|
|
192
|
+
shadow28: {
|
|
193
|
+
'::after': {
|
|
194
|
+
boxShadow: _reacttheme.tokens.shadow28
|
|
195
|
+
}
|
|
196
|
+
},
|
|
197
|
+
inactive: {
|
|
198
|
+
opacity: '0.8',
|
|
199
|
+
transform: 'scale(0.875)',
|
|
200
|
+
transitionTimingFunction: `${_reacttheme.tokens.curveDecelerateMin}, ${_reacttheme.tokens.curveLinear}`,
|
|
201
|
+
'::before,::after': {
|
|
202
|
+
margin: 0,
|
|
203
|
+
opacity: 0,
|
|
204
|
+
transitionTimingFunction: `${_reacttheme.tokens.curveDecelerateMin}, ${_reacttheme.tokens.curveLinear}`
|
|
205
|
+
}
|
|
206
|
+
},
|
|
207
|
+
// Applied to the badge slot
|
|
208
|
+
badge: {
|
|
209
|
+
position: 'absolute',
|
|
210
|
+
bottom: 0,
|
|
211
|
+
right: 0
|
|
212
|
+
},
|
|
213
|
+
// Applied to the image, initials, or icon slot when there is a badge
|
|
214
|
+
badgeCutout: {
|
|
215
|
+
maskImage: badgeMask()
|
|
216
|
+
},
|
|
217
|
+
// Applied to the root when there is a badge
|
|
218
|
+
badgeAlign: {
|
|
219
|
+
// Griffel won't auto-flip the "right" alignment to "left" in RTL if it is inline in the maskImage,
|
|
220
|
+
// so split it out into a css variable that will auto-flip.
|
|
221
|
+
[vars.badgeAlign]: 'right'
|
|
222
|
+
},
|
|
223
|
+
// Badge size: applied to root when there is a badge
|
|
224
|
+
tiny: {
|
|
225
|
+
[vars.badgeRadius]: '3px',
|
|
226
|
+
[vars.badgeGap]: _reacttheme.tokens.strokeWidthThin
|
|
227
|
+
},
|
|
228
|
+
'extra-small': {
|
|
229
|
+
[vars.badgeRadius]: '5px',
|
|
230
|
+
[vars.badgeGap]: _reacttheme.tokens.strokeWidthThin
|
|
231
|
+
},
|
|
232
|
+
small: {
|
|
233
|
+
[vars.badgeRadius]: '6px',
|
|
234
|
+
[vars.badgeGap]: _reacttheme.tokens.strokeWidthThin
|
|
235
|
+
},
|
|
236
|
+
medium: {
|
|
237
|
+
[vars.badgeRadius]: '8px',
|
|
238
|
+
[vars.badgeGap]: _reacttheme.tokens.strokeWidthThin
|
|
239
|
+
},
|
|
240
|
+
large: {
|
|
241
|
+
[vars.badgeRadius]: '10px',
|
|
242
|
+
[vars.badgeGap]: _reacttheme.tokens.strokeWidthThick
|
|
243
|
+
},
|
|
244
|
+
'extra-large': {
|
|
245
|
+
[vars.badgeRadius]: '14px',
|
|
246
|
+
[vars.badgeGap]: _reacttheme.tokens.strokeWidthThick
|
|
247
|
+
},
|
|
248
|
+
icon12: {
|
|
249
|
+
fontSize: '12px'
|
|
250
|
+
},
|
|
251
|
+
icon16: {
|
|
252
|
+
fontSize: '16px'
|
|
253
|
+
},
|
|
254
|
+
icon20: {
|
|
255
|
+
fontSize: '20px'
|
|
256
|
+
},
|
|
257
|
+
icon24: {
|
|
258
|
+
fontSize: '24px'
|
|
259
|
+
},
|
|
260
|
+
icon28: {
|
|
261
|
+
fontSize: '28px'
|
|
262
|
+
},
|
|
263
|
+
icon32: {
|
|
264
|
+
fontSize: '32px'
|
|
265
|
+
},
|
|
266
|
+
icon48: {
|
|
267
|
+
fontSize: '48px'
|
|
268
|
+
}
|
|
269
|
+
});
|
|
270
|
+
const useSizeStyles = (0, _react.makeStyles)({
|
|
271
|
+
16: {
|
|
272
|
+
width: '16px',
|
|
273
|
+
height: '16px'
|
|
274
|
+
},
|
|
275
|
+
20: {
|
|
276
|
+
width: '20px',
|
|
277
|
+
height: '20px'
|
|
278
|
+
},
|
|
279
|
+
24: {
|
|
280
|
+
width: '24px',
|
|
281
|
+
height: '24px'
|
|
282
|
+
},
|
|
283
|
+
28: {
|
|
284
|
+
width: '28px',
|
|
285
|
+
height: '28px'
|
|
286
|
+
},
|
|
287
|
+
32: {
|
|
288
|
+
width: '32px',
|
|
289
|
+
height: '32px'
|
|
290
|
+
},
|
|
291
|
+
36: {
|
|
292
|
+
width: '36px',
|
|
293
|
+
height: '36px'
|
|
294
|
+
},
|
|
295
|
+
40: {
|
|
296
|
+
width: '40px',
|
|
297
|
+
height: '40px'
|
|
298
|
+
},
|
|
299
|
+
48: {
|
|
300
|
+
width: '48px',
|
|
301
|
+
height: '48px'
|
|
302
|
+
},
|
|
303
|
+
56: {
|
|
304
|
+
width: '56px',
|
|
305
|
+
height: '56px'
|
|
306
|
+
},
|
|
307
|
+
64: {
|
|
308
|
+
width: '64px',
|
|
309
|
+
height: '64px'
|
|
310
|
+
},
|
|
311
|
+
72: {
|
|
312
|
+
width: '72px',
|
|
313
|
+
height: '72px'
|
|
314
|
+
},
|
|
315
|
+
96: {
|
|
316
|
+
width: '96px',
|
|
317
|
+
height: '96px'
|
|
318
|
+
},
|
|
319
|
+
120: {
|
|
320
|
+
width: '120px',
|
|
321
|
+
height: '120px'
|
|
322
|
+
},
|
|
323
|
+
128: {
|
|
324
|
+
width: '128px',
|
|
325
|
+
height: '128px'
|
|
326
|
+
}
|
|
327
|
+
});
|
|
328
|
+
const useColorStyles = (0, _react.makeStyles)({
|
|
329
|
+
neutral: {
|
|
330
|
+
color: _reacttheme.tokens.colorNeutralForeground3,
|
|
331
|
+
backgroundColor: _reacttheme.tokens.colorNeutralBackground6
|
|
332
|
+
},
|
|
333
|
+
brand: {
|
|
334
|
+
color: _reacttheme.tokens.colorNeutralForegroundStaticInverted,
|
|
335
|
+
backgroundColor: _reacttheme.tokens.colorBrandBackgroundStatic
|
|
336
|
+
},
|
|
337
|
+
'dark-red': {
|
|
338
|
+
color: _reacttheme.tokens.colorPaletteDarkRedForeground2,
|
|
339
|
+
backgroundColor: _reacttheme.tokens.colorPaletteDarkRedBackground2
|
|
340
|
+
},
|
|
341
|
+
cranberry: {
|
|
342
|
+
color: _reacttheme.tokens.colorPaletteCranberryForeground2,
|
|
343
|
+
backgroundColor: _reacttheme.tokens.colorPaletteCranberryBackground2
|
|
344
|
+
},
|
|
345
|
+
red: {
|
|
346
|
+
color: _reacttheme.tokens.colorPaletteRedForeground2,
|
|
347
|
+
backgroundColor: _reacttheme.tokens.colorPaletteRedBackground2
|
|
348
|
+
},
|
|
349
|
+
pumpkin: {
|
|
350
|
+
color: _reacttheme.tokens.colorPalettePumpkinForeground2,
|
|
351
|
+
backgroundColor: _reacttheme.tokens.colorPalettePumpkinBackground2
|
|
352
|
+
},
|
|
353
|
+
peach: {
|
|
354
|
+
color: _reacttheme.tokens.colorPalettePeachForeground2,
|
|
355
|
+
backgroundColor: _reacttheme.tokens.colorPalettePeachBackground2
|
|
356
|
+
},
|
|
357
|
+
marigold: {
|
|
358
|
+
color: _reacttheme.tokens.colorPaletteMarigoldForeground2,
|
|
359
|
+
backgroundColor: _reacttheme.tokens.colorPaletteMarigoldBackground2
|
|
360
|
+
},
|
|
361
|
+
gold: {
|
|
362
|
+
color: _reacttheme.tokens.colorPaletteGoldForeground2,
|
|
363
|
+
backgroundColor: _reacttheme.tokens.colorPaletteGoldBackground2
|
|
364
|
+
},
|
|
365
|
+
brass: {
|
|
366
|
+
color: _reacttheme.tokens.colorPaletteBrassForeground2,
|
|
367
|
+
backgroundColor: _reacttheme.tokens.colorPaletteBrassBackground2
|
|
368
|
+
},
|
|
369
|
+
brown: {
|
|
370
|
+
color: _reacttheme.tokens.colorPaletteBrownForeground2,
|
|
371
|
+
backgroundColor: _reacttheme.tokens.colorPaletteBrownBackground2
|
|
372
|
+
},
|
|
373
|
+
forest: {
|
|
374
|
+
color: _reacttheme.tokens.colorPaletteForestForeground2,
|
|
375
|
+
backgroundColor: _reacttheme.tokens.colorPaletteForestBackground2
|
|
376
|
+
},
|
|
377
|
+
seafoam: {
|
|
378
|
+
color: _reacttheme.tokens.colorPaletteSeafoamForeground2,
|
|
379
|
+
backgroundColor: _reacttheme.tokens.colorPaletteSeafoamBackground2
|
|
380
|
+
},
|
|
381
|
+
'dark-green': {
|
|
382
|
+
color: _reacttheme.tokens.colorPaletteDarkGreenForeground2,
|
|
383
|
+
backgroundColor: _reacttheme.tokens.colorPaletteDarkGreenBackground2
|
|
384
|
+
},
|
|
385
|
+
'light-teal': {
|
|
386
|
+
color: _reacttheme.tokens.colorPaletteLightTealForeground2,
|
|
387
|
+
backgroundColor: _reacttheme.tokens.colorPaletteLightTealBackground2
|
|
388
|
+
},
|
|
389
|
+
teal: {
|
|
390
|
+
color: _reacttheme.tokens.colorPaletteTealForeground2,
|
|
391
|
+
backgroundColor: _reacttheme.tokens.colorPaletteTealBackground2
|
|
392
|
+
},
|
|
393
|
+
steel: {
|
|
394
|
+
color: _reacttheme.tokens.colorPaletteSteelForeground2,
|
|
395
|
+
backgroundColor: _reacttheme.tokens.colorPaletteSteelBackground2
|
|
396
|
+
},
|
|
397
|
+
blue: {
|
|
398
|
+
color: _reacttheme.tokens.colorPaletteBlueForeground2,
|
|
399
|
+
backgroundColor: _reacttheme.tokens.colorPaletteBlueBackground2
|
|
400
|
+
},
|
|
401
|
+
'royal-blue': {
|
|
402
|
+
color: _reacttheme.tokens.colorPaletteRoyalBlueForeground2,
|
|
403
|
+
backgroundColor: _reacttheme.tokens.colorPaletteRoyalBlueBackground2
|
|
404
|
+
},
|
|
405
|
+
cornflower: {
|
|
406
|
+
color: _reacttheme.tokens.colorPaletteCornflowerForeground2,
|
|
407
|
+
backgroundColor: _reacttheme.tokens.colorPaletteCornflowerBackground2
|
|
408
|
+
},
|
|
409
|
+
navy: {
|
|
410
|
+
color: _reacttheme.tokens.colorPaletteNavyForeground2,
|
|
411
|
+
backgroundColor: _reacttheme.tokens.colorPaletteNavyBackground2
|
|
412
|
+
},
|
|
413
|
+
lavender: {
|
|
414
|
+
color: _reacttheme.tokens.colorPaletteLavenderForeground2,
|
|
415
|
+
backgroundColor: _reacttheme.tokens.colorPaletteLavenderBackground2
|
|
416
|
+
},
|
|
417
|
+
purple: {
|
|
418
|
+
color: _reacttheme.tokens.colorPalettePurpleForeground2,
|
|
419
|
+
backgroundColor: _reacttheme.tokens.colorPalettePurpleBackground2
|
|
420
|
+
},
|
|
421
|
+
grape: {
|
|
422
|
+
color: _reacttheme.tokens.colorPaletteGrapeForeground2,
|
|
423
|
+
backgroundColor: _reacttheme.tokens.colorPaletteGrapeBackground2
|
|
424
|
+
},
|
|
425
|
+
lilac: {
|
|
426
|
+
color: _reacttheme.tokens.colorPaletteLilacForeground2,
|
|
427
|
+
backgroundColor: _reacttheme.tokens.colorPaletteLilacBackground2
|
|
428
|
+
},
|
|
429
|
+
pink: {
|
|
430
|
+
color: _reacttheme.tokens.colorPalettePinkForeground2,
|
|
431
|
+
backgroundColor: _reacttheme.tokens.colorPalettePinkBackground2
|
|
432
|
+
},
|
|
433
|
+
magenta: {
|
|
434
|
+
color: _reacttheme.tokens.colorPaletteMagentaForeground2,
|
|
435
|
+
backgroundColor: _reacttheme.tokens.colorPaletteMagentaBackground2
|
|
436
|
+
},
|
|
437
|
+
plum: {
|
|
438
|
+
color: _reacttheme.tokens.colorPalettePlumForeground2,
|
|
439
|
+
backgroundColor: _reacttheme.tokens.colorPalettePlumBackground2
|
|
440
|
+
},
|
|
441
|
+
beige: {
|
|
442
|
+
color: _reacttheme.tokens.colorPaletteBeigeForeground2,
|
|
443
|
+
backgroundColor: _reacttheme.tokens.colorPaletteBeigeBackground2
|
|
444
|
+
},
|
|
445
|
+
mink: {
|
|
446
|
+
color: _reacttheme.tokens.colorPaletteMinkForeground2,
|
|
447
|
+
backgroundColor: _reacttheme.tokens.colorPaletteMinkBackground2
|
|
448
|
+
},
|
|
449
|
+
platinum: {
|
|
450
|
+
color: _reacttheme.tokens.colorPalettePlatinumForeground2,
|
|
451
|
+
backgroundColor: _reacttheme.tokens.colorPalettePlatinumBackground2
|
|
452
|
+
},
|
|
453
|
+
anchor: {
|
|
454
|
+
color: _reacttheme.tokens.colorPaletteAnchorForeground2,
|
|
455
|
+
backgroundColor: _reacttheme.tokens.colorPaletteAnchorBackground2
|
|
456
|
+
}
|
|
457
|
+
});
|
|
458
|
+
const useRingColorStyles = (0, _react.makeStyles)({
|
|
459
|
+
neutral: {
|
|
460
|
+
'::before': {
|
|
461
|
+
color: _reacttheme.tokens.colorBrandStroke1
|
|
462
|
+
}
|
|
463
|
+
},
|
|
464
|
+
brand: {
|
|
465
|
+
'::before': {
|
|
466
|
+
color: _reacttheme.tokens.colorBrandStroke1
|
|
467
|
+
}
|
|
468
|
+
},
|
|
469
|
+
'dark-red': {
|
|
470
|
+
'::before': {
|
|
471
|
+
color: _reacttheme.tokens.colorPaletteDarkRedBorderActive
|
|
472
|
+
}
|
|
473
|
+
},
|
|
474
|
+
cranberry: {
|
|
475
|
+
'::before': {
|
|
476
|
+
color: _reacttheme.tokens.colorPaletteCranberryBorderActive
|
|
477
|
+
}
|
|
478
|
+
},
|
|
479
|
+
red: {
|
|
480
|
+
'::before': {
|
|
481
|
+
color: _reacttheme.tokens.colorPaletteRedBorderActive
|
|
482
|
+
}
|
|
483
|
+
},
|
|
484
|
+
pumpkin: {
|
|
485
|
+
'::before': {
|
|
486
|
+
color: _reacttheme.tokens.colorPalettePumpkinBorderActive
|
|
487
|
+
}
|
|
488
|
+
},
|
|
489
|
+
peach: {
|
|
490
|
+
'::before': {
|
|
491
|
+
color: _reacttheme.tokens.colorPalettePeachBorderActive
|
|
492
|
+
}
|
|
493
|
+
},
|
|
494
|
+
marigold: {
|
|
495
|
+
'::before': {
|
|
496
|
+
color: _reacttheme.tokens.colorPaletteMarigoldBorderActive
|
|
497
|
+
}
|
|
498
|
+
},
|
|
499
|
+
gold: {
|
|
500
|
+
'::before': {
|
|
501
|
+
color: _reacttheme.tokens.colorPaletteGoldBorderActive
|
|
502
|
+
}
|
|
503
|
+
},
|
|
504
|
+
brass: {
|
|
505
|
+
'::before': {
|
|
506
|
+
color: _reacttheme.tokens.colorPaletteBrassBorderActive
|
|
507
|
+
}
|
|
508
|
+
},
|
|
509
|
+
brown: {
|
|
510
|
+
'::before': {
|
|
511
|
+
color: _reacttheme.tokens.colorPaletteBrownBorderActive
|
|
512
|
+
}
|
|
513
|
+
},
|
|
514
|
+
forest: {
|
|
515
|
+
'::before': {
|
|
516
|
+
color: _reacttheme.tokens.colorPaletteForestBorderActive
|
|
517
|
+
}
|
|
518
|
+
},
|
|
519
|
+
seafoam: {
|
|
520
|
+
'::before': {
|
|
521
|
+
color: _reacttheme.tokens.colorPaletteSeafoamBorderActive
|
|
522
|
+
}
|
|
523
|
+
},
|
|
524
|
+
'dark-green': {
|
|
525
|
+
'::before': {
|
|
526
|
+
color: _reacttheme.tokens.colorPaletteDarkGreenBorderActive
|
|
527
|
+
}
|
|
528
|
+
},
|
|
529
|
+
'light-teal': {
|
|
530
|
+
'::before': {
|
|
531
|
+
color: _reacttheme.tokens.colorPaletteLightTealBorderActive
|
|
532
|
+
}
|
|
533
|
+
},
|
|
534
|
+
teal: {
|
|
535
|
+
'::before': {
|
|
536
|
+
color: _reacttheme.tokens.colorPaletteTealBorderActive
|
|
537
|
+
}
|
|
538
|
+
},
|
|
539
|
+
steel: {
|
|
540
|
+
'::before': {
|
|
541
|
+
color: _reacttheme.tokens.colorPaletteSteelBorderActive
|
|
542
|
+
}
|
|
543
|
+
},
|
|
544
|
+
blue: {
|
|
545
|
+
'::before': {
|
|
546
|
+
color: _reacttheme.tokens.colorPaletteBlueBorderActive
|
|
547
|
+
}
|
|
548
|
+
},
|
|
549
|
+
'royal-blue': {
|
|
550
|
+
'::before': {
|
|
551
|
+
color: _reacttheme.tokens.colorPaletteRoyalBlueBorderActive
|
|
552
|
+
}
|
|
553
|
+
},
|
|
554
|
+
cornflower: {
|
|
555
|
+
'::before': {
|
|
556
|
+
color: _reacttheme.tokens.colorPaletteCornflowerBorderActive
|
|
557
|
+
}
|
|
558
|
+
},
|
|
559
|
+
navy: {
|
|
560
|
+
'::before': {
|
|
561
|
+
color: _reacttheme.tokens.colorPaletteNavyBorderActive
|
|
562
|
+
}
|
|
563
|
+
},
|
|
564
|
+
lavender: {
|
|
565
|
+
'::before': {
|
|
566
|
+
color: _reacttheme.tokens.colorPaletteLavenderBorderActive
|
|
567
|
+
}
|
|
568
|
+
},
|
|
569
|
+
purple: {
|
|
570
|
+
'::before': {
|
|
571
|
+
color: _reacttheme.tokens.colorPalettePurpleBorderActive
|
|
572
|
+
}
|
|
573
|
+
},
|
|
574
|
+
grape: {
|
|
575
|
+
'::before': {
|
|
576
|
+
color: _reacttheme.tokens.colorPaletteGrapeBorderActive
|
|
577
|
+
}
|
|
578
|
+
},
|
|
579
|
+
lilac: {
|
|
580
|
+
'::before': {
|
|
581
|
+
color: _reacttheme.tokens.colorPaletteLilacBorderActive
|
|
582
|
+
}
|
|
583
|
+
},
|
|
584
|
+
pink: {
|
|
585
|
+
'::before': {
|
|
586
|
+
color: _reacttheme.tokens.colorPalettePinkBorderActive
|
|
587
|
+
}
|
|
588
|
+
},
|
|
589
|
+
magenta: {
|
|
590
|
+
'::before': {
|
|
591
|
+
color: _reacttheme.tokens.colorPaletteMagentaBorderActive
|
|
592
|
+
}
|
|
593
|
+
},
|
|
594
|
+
plum: {
|
|
595
|
+
'::before': {
|
|
596
|
+
color: _reacttheme.tokens.colorPalettePlumBorderActive
|
|
597
|
+
}
|
|
598
|
+
},
|
|
599
|
+
beige: {
|
|
600
|
+
'::before': {
|
|
601
|
+
color: _reacttheme.tokens.colorPaletteBeigeBorderActive
|
|
602
|
+
}
|
|
603
|
+
},
|
|
604
|
+
mink: {
|
|
605
|
+
'::before': {
|
|
606
|
+
color: _reacttheme.tokens.colorPaletteMinkBorderActive
|
|
607
|
+
}
|
|
608
|
+
},
|
|
609
|
+
platinum: {
|
|
610
|
+
'::before': {
|
|
611
|
+
color: _reacttheme.tokens.colorPalettePlatinumBorderActive
|
|
612
|
+
}
|
|
613
|
+
},
|
|
614
|
+
anchor: {
|
|
615
|
+
'::before': {
|
|
616
|
+
color: _reacttheme.tokens.colorPaletteAnchorBorderActive
|
|
617
|
+
}
|
|
618
|
+
}
|
|
619
|
+
});
|
|
620
|
+
const useAvatarStyles_unstable = (state)=>{
|
|
621
|
+
'use no memo';
|
|
622
|
+
const { size, shape, active, activeAppearance, color } = state;
|
|
623
|
+
const rootClassName = useRootClassName();
|
|
624
|
+
const imageClassName = useImageClassName();
|
|
625
|
+
const iconInitialsClassName = useIconInitialsClassName();
|
|
626
|
+
const styles = useStyles();
|
|
627
|
+
const sizeStyles = useSizeStyles();
|
|
628
|
+
const colorStyles = useColorStyles();
|
|
629
|
+
const ringColorStyles = useRingColorStyles();
|
|
630
|
+
const rootClasses = [
|
|
631
|
+
rootClassName,
|
|
632
|
+
size !== 32 && sizeStyles[size]
|
|
633
|
+
];
|
|
634
|
+
if (state.badge) {
|
|
635
|
+
rootClasses.push(styles.badgeAlign, styles[state.badge.size || 'medium']);
|
|
636
|
+
}
|
|
637
|
+
if (size <= 24) {
|
|
638
|
+
rootClasses.push(styles.textCaption2Strong);
|
|
639
|
+
} else if (size <= 28) {
|
|
640
|
+
rootClasses.push(styles.textCaption1Strong);
|
|
641
|
+
} else if (size <= 40) {
|
|
642
|
+
// Default text size included in useRootClassName
|
|
643
|
+
} else if (size <= 56) {
|
|
644
|
+
rootClasses.push(styles.textSubtitle2);
|
|
645
|
+
} else if (size <= 96) {
|
|
646
|
+
rootClasses.push(styles.textSubtitle1);
|
|
647
|
+
} else {
|
|
648
|
+
rootClasses.push(styles.textTitle3);
|
|
649
|
+
}
|
|
650
|
+
if (shape === 'square') {
|
|
651
|
+
if (size <= 24) {
|
|
652
|
+
rootClasses.push(styles.squareSmall);
|
|
653
|
+
} else if (size <= 48) {
|
|
654
|
+
rootClasses.push(styles.squareMedium);
|
|
655
|
+
} else if (size <= 72) {
|
|
656
|
+
rootClasses.push(styles.squareLarge);
|
|
657
|
+
} else {
|
|
658
|
+
rootClasses.push(styles.squareXLarge);
|
|
659
|
+
}
|
|
660
|
+
}
|
|
661
|
+
if (active === 'active' || active === 'inactive') {
|
|
662
|
+
rootClasses.push(styles.activeOrInactive);
|
|
663
|
+
if (activeAppearance === 'ring' || activeAppearance === 'ring-shadow') {
|
|
664
|
+
rootClasses.push(styles.ring, ringColorStyles[color]);
|
|
665
|
+
if (state.badge) {
|
|
666
|
+
rootClasses.push(styles.ringBadgeCutout);
|
|
667
|
+
}
|
|
668
|
+
if (size <= 48) {
|
|
669
|
+
rootClasses.push(styles.ringThick);
|
|
670
|
+
} else if (size <= 64) {
|
|
671
|
+
rootClasses.push(styles.ringThicker);
|
|
672
|
+
} else {
|
|
673
|
+
rootClasses.push(styles.ringThickest);
|
|
674
|
+
}
|
|
675
|
+
}
|
|
676
|
+
if (activeAppearance === 'shadow' || activeAppearance === 'ring-shadow') {
|
|
677
|
+
rootClasses.push(styles.shadow);
|
|
678
|
+
if (size <= 28) {
|
|
679
|
+
rootClasses.push(styles.shadow4);
|
|
680
|
+
} else if (size <= 48) {
|
|
681
|
+
rootClasses.push(styles.shadow8);
|
|
682
|
+
} else if (size <= 64) {
|
|
683
|
+
rootClasses.push(styles.shadow16);
|
|
684
|
+
} else {
|
|
685
|
+
rootClasses.push(styles.shadow28);
|
|
686
|
+
}
|
|
687
|
+
}
|
|
688
|
+
// Note: The inactive style overrides some of the activeAppearance styles and must be applied after them
|
|
689
|
+
if (active === 'inactive') {
|
|
690
|
+
rootClasses.push(styles.inactive);
|
|
691
|
+
}
|
|
692
|
+
}
|
|
693
|
+
state.root.className = (0, _react.mergeClasses)(avatarClassNames.root, ...rootClasses, state.root.className);
|
|
694
|
+
if (state.badge) {
|
|
695
|
+
state.badge.className = (0, _react.mergeClasses)(avatarClassNames.badge, styles.badge, state.badge.className);
|
|
696
|
+
}
|
|
697
|
+
if (state.image) {
|
|
698
|
+
state.image.className = (0, _react.mergeClasses)(avatarClassNames.image, imageClassName, colorStyles[color], state.badge && styles.badgeCutout, state.image.className);
|
|
699
|
+
}
|
|
700
|
+
if (state.initials) {
|
|
701
|
+
state.initials.className = (0, _react.mergeClasses)(avatarClassNames.initials, iconInitialsClassName, colorStyles[color], state.badge && styles.badgeCutout, state.initials.className);
|
|
702
|
+
}
|
|
703
|
+
if (state.icon) {
|
|
704
|
+
let iconSizeClass;
|
|
705
|
+
if (size <= 16) {
|
|
706
|
+
iconSizeClass = styles.icon12;
|
|
707
|
+
} else if (size <= 24) {
|
|
708
|
+
iconSizeClass = styles.icon16;
|
|
709
|
+
} else if (size <= 40) {
|
|
710
|
+
iconSizeClass = styles.icon20;
|
|
711
|
+
} else if (size <= 48) {
|
|
712
|
+
iconSizeClass = styles.icon24;
|
|
713
|
+
} else if (size <= 56) {
|
|
714
|
+
iconSizeClass = styles.icon28;
|
|
715
|
+
} else if (size <= 72) {
|
|
716
|
+
iconSizeClass = styles.icon32;
|
|
717
|
+
} else {
|
|
718
|
+
iconSizeClass = styles.icon48;
|
|
719
|
+
}
|
|
720
|
+
state.icon.className = (0, _react.mergeClasses)(avatarClassNames.icon, iconInitialsClassName, iconSizeClass, colorStyles[color], state.badge && styles.badgeCutout, state.icon.className);
|
|
721
|
+
}
|
|
722
|
+
return state;
|
|
723
|
+
};
|