@fluentui-react-native/experimental-avatar 0.14.44 → 0.15.1

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 (103) hide show
  1. package/CHANGELOG.json +61 -1
  2. package/CHANGELOG.md +26 -2
  3. package/FRNAvatar.podspec +2 -2
  4. package/{lib-commonjs/Avatar.d.ts → lib/NativeAvatar.d.ts} +6 -6
  5. package/lib/NativeAvatar.d.ts.map +1 -0
  6. package/lib/{Avatar.js → NativeAvatar.js} +3 -3
  7. package/lib/NativeAvatar.js.map +1 -0
  8. package/lib/index.d.ts +1 -3
  9. package/lib/index.d.ts.map +1 -1
  10. package/lib/index.js +1 -3
  11. package/lib/index.js.map +1 -1
  12. package/{lib/Avatar.d.ts → lib-commonjs/NativeAvatar.d.ts} +6 -6
  13. package/lib-commonjs/NativeAvatar.d.ts.map +1 -0
  14. package/lib-commonjs/{Avatar.js → NativeAvatar.js} +4 -4
  15. package/lib-commonjs/NativeAvatar.js.map +1 -0
  16. package/lib-commonjs/index.d.ts +1 -3
  17. package/lib-commonjs/index.d.ts.map +1 -1
  18. package/lib-commonjs/index.js +1 -3
  19. package/lib-commonjs/index.js.map +1 -1
  20. package/package.json +2 -10
  21. package/src/{Avatar.tsx → NativeAvatar.tsx} +11 -11
  22. package/src/__tests__/{JSAvatar.test.jsx → Avatar.test.jsx} +2 -2
  23. package/src/__tests__/__snapshots__/{JSAvatar.test.jsx.snap → Avatar.test.jsx.snap} +0 -0
  24. package/src/index.ts +1 -3
  25. package/MIGRATION.md +0 -157
  26. package/SPEC.md +0 -295
  27. package/jest.config.js +0 -2
  28. package/lib/Avatar.d.ts.map +0 -1
  29. package/lib/Avatar.js.map +0 -1
  30. package/lib/JSAvatar.d.ts +0 -12
  31. package/lib/JSAvatar.d.ts.map +0 -1
  32. package/lib/JSAvatar.js +0 -84
  33. package/lib/JSAvatar.js.map +0 -1
  34. package/lib/JSAvatar.styling.d.ts +0 -5
  35. package/lib/JSAvatar.styling.d.ts.map +0 -1
  36. package/lib/JSAvatar.styling.js +0 -158
  37. package/lib/JSAvatar.styling.js.map +0 -1
  38. package/lib/JSAvatar.types.d.ts +0 -213
  39. package/lib/JSAvatar.types.d.ts.map +0 -1
  40. package/lib/JSAvatar.types.js +0 -56
  41. package/lib/JSAvatar.types.js.map +0 -1
  42. package/lib/JSAvatarTokens.d.ts +0 -5
  43. package/lib/JSAvatarTokens.d.ts.map +0 -1
  44. package/lib/JSAvatarTokens.js +0 -198
  45. package/lib/JSAvatarTokens.js.map +0 -1
  46. package/lib/JSAvatarTokens.win32.d.ts +0 -5
  47. package/lib/JSAvatarTokens.win32.d.ts.map +0 -1
  48. package/lib/JSAvatarTokens.win32.js +0 -201
  49. package/lib/JSAvatarTokens.win32.js.map +0 -1
  50. package/lib/getHashCode.d.ts +0 -8
  51. package/lib/getHashCode.d.ts.map +0 -1
  52. package/lib/getHashCode.js +0 -16
  53. package/lib/getHashCode.js.map +0 -1
  54. package/lib/titles.d.ts +0 -2
  55. package/lib/titles.d.ts.map +0 -1
  56. package/lib/titles.js +0 -109
  57. package/lib/titles.js.map +0 -1
  58. package/lib/useAvatar.d.ts +0 -33
  59. package/lib/useAvatar.d.ts.map +0 -1
  60. package/lib/useAvatar.js +0 -106
  61. package/lib/useAvatar.js.map +0 -1
  62. package/lib-commonjs/Avatar.d.ts.map +0 -1
  63. package/lib-commonjs/Avatar.js.map +0 -1
  64. package/lib-commonjs/JSAvatar.d.ts +0 -12
  65. package/lib-commonjs/JSAvatar.d.ts.map +0 -1
  66. package/lib-commonjs/JSAvatar.js +0 -88
  67. package/lib-commonjs/JSAvatar.js.map +0 -1
  68. package/lib-commonjs/JSAvatar.styling.d.ts +0 -5
  69. package/lib-commonjs/JSAvatar.styling.d.ts.map +0 -1
  70. package/lib-commonjs/JSAvatar.styling.js +0 -161
  71. package/lib-commonjs/JSAvatar.styling.js.map +0 -1
  72. package/lib-commonjs/JSAvatar.types.d.ts +0 -213
  73. package/lib-commonjs/JSAvatar.types.d.ts.map +0 -1
  74. package/lib-commonjs/JSAvatar.types.js +0 -59
  75. package/lib-commonjs/JSAvatar.types.js.map +0 -1
  76. package/lib-commonjs/JSAvatarTokens.d.ts +0 -5
  77. package/lib-commonjs/JSAvatarTokens.d.ts.map +0 -1
  78. package/lib-commonjs/JSAvatarTokens.js +0 -202
  79. package/lib-commonjs/JSAvatarTokens.js.map +0 -1
  80. package/lib-commonjs/JSAvatarTokens.win32.d.ts +0 -5
  81. package/lib-commonjs/JSAvatarTokens.win32.d.ts.map +0 -1
  82. package/lib-commonjs/JSAvatarTokens.win32.js +0 -205
  83. package/lib-commonjs/JSAvatarTokens.win32.js.map +0 -1
  84. package/lib-commonjs/getHashCode.d.ts +0 -8
  85. package/lib-commonjs/getHashCode.d.ts.map +0 -1
  86. package/lib-commonjs/getHashCode.js +0 -20
  87. package/lib-commonjs/getHashCode.js.map +0 -1
  88. package/lib-commonjs/titles.d.ts +0 -2
  89. package/lib-commonjs/titles.d.ts.map +0 -1
  90. package/lib-commonjs/titles.js +0 -112
  91. package/lib-commonjs/titles.js.map +0 -1
  92. package/lib-commonjs/useAvatar.d.ts +0 -33
  93. package/lib-commonjs/useAvatar.d.ts.map +0 -1
  94. package/lib-commonjs/useAvatar.js +0 -113
  95. package/lib-commonjs/useAvatar.js.map +0 -1
  96. package/src/JSAvatar.styling.ts +0 -201
  97. package/src/JSAvatar.tsx +0 -96
  98. package/src/JSAvatar.types.ts +0 -286
  99. package/src/JSAvatarTokens.ts +0 -201
  100. package/src/JSAvatarTokens.win32.ts +0 -204
  101. package/src/getHashCode.ts +0 -16
  102. package/src/titles.ts +0 -108
  103. package/src/useAvatar.ts +0 -126
@@ -1,201 +0,0 @@
1
- import {
2
- JSAvatarName,
3
- JSAvatarTokens,
4
- AvatarConfigurableProps,
5
- AvatarSlotProps,
6
- JSAvatarProps,
7
- AvatarColors,
8
- AvatarSizesForTokens,
9
- AvatarNamedColor,
10
- ColorSchemes,
11
- AvatarColorSchemes,
12
- } from './JSAvatar.types';
13
- import { Theme, UseStylingOptions, buildProps } from '@fluentui-react-native/framework';
14
- import { defaultJSAvatarTokens } from './JSAvatarTokens';
15
- import { borderStyles, fontStyles } from '@fluentui-react-native/tokens';
16
- import { globalTokens } from '@fluentui-react-native/theme-tokens';
17
-
18
- export const avatarStates: (keyof JSAvatarTokens)[] = [
19
- ...AvatarColors,
20
- ...AvatarSizesForTokens,
21
- 'neutral',
22
- 'brand',
23
- 'circular',
24
- 'square',
25
- 'inactive',
26
- 'iconColor',
27
- 'iconSize',
28
- 'size',
29
- ];
30
-
31
- const tokensThatAreAlsoProps: (keyof AvatarConfigurableProps)[] = [
32
- 'active',
33
- 'avatarColor',
34
- 'initialsColor',
35
- 'ringBackgroundColor',
36
- 'ringColor',
37
- 'ringInnerGap',
38
- 'ringThickness',
39
- ];
40
-
41
- export const stylingSettings: UseStylingOptions<JSAvatarProps, AvatarSlotProps, JSAvatarTokens> = {
42
- tokens: [defaultJSAvatarTokens, JSAvatarName],
43
- tokensThatAreAlsoProps,
44
- states: avatarStates,
45
- slotProps: {
46
- root: buildProps(
47
- (tokens: JSAvatarTokens) => {
48
- const { size, active, avatarOpacity } = tokens;
49
- const ringConfig = getRingConfig(tokens);
50
- const avatarSize = active === 'active' ? ringConfig.size : size;
51
-
52
- return {
53
- style: {
54
- alignItems: 'center',
55
- justifyContent: 'center',
56
- width: avatarSize,
57
- height: avatarSize,
58
- opacity: avatarOpacity,
59
- },
60
- };
61
- },
62
- ['avatarOpacity', 'size'],
63
- ),
64
- initials: buildProps(
65
- (tokens: JSAvatarTokens, theme: Theme) => {
66
- return {
67
- style: {
68
- ...fontStyles.from(tokens, theme),
69
- color: tokens.initialsColor || tokens.color,
70
- textAlign: 'center',
71
- },
72
- };
73
- },
74
- ['color', 'initialsColor', ...fontStyles.keys],
75
- ),
76
- initialsBackground: buildProps(
77
- (tokens: JSAvatarTokens, theme: Theme) => {
78
- const { backgroundColor, size, avatarColor } = tokens;
79
- const _avatarColor =
80
- !avatarColor || AvatarColors.includes(avatarColor as AvatarNamedColor) || ColorSchemes.includes(avatarColor as AvatarColorSchemes)
81
- ? backgroundColor
82
- : avatarColor;
83
- const ringConfig = getRingConfig(tokens);
84
-
85
- return {
86
- style: {
87
- ...borderStyles.from(tokens, theme),
88
- width: size,
89
- height: size,
90
- justifyContent: 'center',
91
- alignItems: 'center',
92
- backgroundColor: _avatarColor,
93
- borderWidth: tokens.borderWidth,
94
- borderColor: tokens.borderColor,
95
- marginTop: ringConfig.ringThickness,
96
- marginLeft: ringConfig.ringThickness,
97
- },
98
- };
99
- },
100
- ['avatarColor', 'backgroundColor', 'size', 'borderColor', 'borderWidth', 'ringThickness', ...borderStyles.keys],
101
- ),
102
- image: buildProps(
103
- (tokens: JSAvatarTokens) => {
104
- const { borderRadius, size, borderWidth, borderColor } = tokens;
105
- const ringConfig = getRingConfig(tokens);
106
- return {
107
- style: {
108
- borderRadius: borderRadius,
109
- width: size,
110
- height: size,
111
- borderWidth: borderWidth,
112
- borderColor: borderColor,
113
- marginTop: ringConfig.ringThickness,
114
- marginLeft: ringConfig.ringThickness,
115
- },
116
- };
117
- },
118
- ['borderRadius', 'size', 'borderColor', 'borderWidth', 'ringThickness'],
119
- ),
120
- icon: buildProps(
121
- (tokens: JSAvatarTokens) => {
122
- return {
123
- style: {
124
- position: 'absolute',
125
- fontSize: tokens.iconSize || tokens.fontSize,
126
- },
127
- color: tokens.iconColor || tokens.color,
128
- width: tokens.iconSize,
129
- height: tokens.iconSize,
130
- };
131
- },
132
- ['iconSize', 'iconColor'],
133
- ),
134
- ring: buildProps(
135
- (tokens: JSAvatarTokens, theme: Theme) => {
136
- const { ringColor, ringBackgroundColor } = tokens;
137
- const ringConfig = getRingConfig(tokens);
138
- return {
139
- style: {
140
- borderStyle: 'solid',
141
- width: ringConfig.size,
142
- height: ringConfig.size,
143
- ...borderStyles.from(tokens, theme),
144
- borderWidth: ringConfig.ringThickness,
145
- backgroundColor: ringBackgroundColor || 'transparent',
146
- borderColor: ringColor,
147
- },
148
- };
149
- },
150
- ['size', 'ringColor', 'ringBackgroundColor', 'ringThickness', ...borderStyles.keys],
151
- ),
152
- badge: buildProps(
153
- (tokens: JSAvatarTokens) => {
154
- return {
155
- size: tokens.badgeSize,
156
- shape: 'circular',
157
- };
158
- },
159
- ['badgeSize'],
160
- ),
161
- },
162
- };
163
-
164
- function getRingConfig(tokens: JSAvatarTokens): any {
165
- const { size, ringThickness } = tokens;
166
- const SMALL_SIZE = 48;
167
- const MEDIUM_SIZE = 71;
168
-
169
- const strokeSize = {
170
- small: globalTokens.stroke.width.thick,
171
- medium: globalTokens.stroke.width.thicker,
172
- large: globalTokens.stroke.width.thickest,
173
- };
174
- if (ringThickness) {
175
- return {
176
- size: size + ringThickness * 4,
177
- ringThickness,
178
- innerStroke: ringThickness,
179
- };
180
- } else {
181
- if (size <= SMALL_SIZE) {
182
- return {
183
- size: size + strokeSize.small * 4,
184
- ringThickness: strokeSize.small,
185
- innerStroke: strokeSize.small,
186
- };
187
- }
188
- if (size <= MEDIUM_SIZE) {
189
- return {
190
- size: size + strokeSize.medium * 4,
191
- ringThickness: strokeSize.medium,
192
- innerStroke: strokeSize.medium,
193
- };
194
- }
195
- return {
196
- size: size + strokeSize.large * 4,
197
- ringThickness: strokeSize.large,
198
- innerStroke: strokeSize.large,
199
- };
200
- }
201
- }
package/src/JSAvatar.tsx DELETED
@@ -1,96 +0,0 @@
1
- /** @jsx withSlots */
2
- import { Image, View, Text, Platform } from 'react-native';
3
- import { Fragment } from 'react';
4
- import { JSAvatarProps, JSAvatarType, JSAvatarName, JSAvatarState, AvatarSlotProps } from './JSAvatar.types';
5
- import { stylingSettings } from './JSAvatar.styling';
6
- import { compose, UseSlots, mergeProps, withSlots, Slots } from '@fluentui-react-native/framework';
7
- import { useAvatar } from './useAvatar';
8
- import { PresenceBadge } from '@fluentui-react-native/badge';
9
- import { Icon } from '@fluentui-react-native/icon';
10
- import { Svg, Path, SvgProps } from 'react-native-svg';
11
- import { SvgIconProps } from '@fluentui-react-native/icon';
12
-
13
- /**
14
- * A function which determines if a set of styles should be applied to the compoent given the current state and props of the avatar.
15
- *
16
- * @param layer The name of the state that is being checked for
17
- * @param state The current state of the avatar
18
- * @param userProps The props that were passed into the avatar
19
- * @returns Whether the styles that are assigned to the layer should be applied to the avatar
20
- */
21
- export const avatarLookup = (layer: string, state: JSAvatarState, userProps: JSAvatarProps): boolean => {
22
- const size = userProps.size;
23
- const avatarSize = size ? `size${size}` : '';
24
- return (
25
- state[layer] ||
26
- userProps[layer] ||
27
- layer === userProps['shape'] ||
28
- (!userProps['shape'] && layer === 'circular') ||
29
- layer === userProps['avatarColor'] ||
30
- layer === avatarSize ||
31
- (userProps.active === 'inactive' && layer === 'inactive')
32
- );
33
- };
34
-
35
- export const JSAvatar = compose<JSAvatarType>({
36
- displayName: JSAvatarName,
37
- ...stylingSettings,
38
- slots: {
39
- root: View,
40
- image: Image,
41
- initials: Text,
42
- initialsBackground: View,
43
- icon: Icon,
44
- ring: View,
45
- badge: PresenceBadge,
46
- },
47
- useRender: (userProps: JSAvatarProps, useSlots: UseSlots<JSAvatarType>) => {
48
- const avatar = useAvatar(userProps);
49
- const Slots = useSlots(avatar.props, (layer) => avatarLookup(layer, avatar.state, avatar.props));
50
-
51
- return (final: JSAvatarProps) => {
52
- const { showRing, transparentRing, showBadge } = avatar.state;
53
- const { badge, ...mergedProps } = avatar.props;
54
- const svgIconsEnabled = ['ios', 'macos', 'win32', 'android'].includes(Platform.OS as string);
55
- const RingComponent = showRing && !transparentRing ? Slots.ring : Fragment;
56
-
57
- return (
58
- <Slots.root {...mergedProps}>
59
- <RingComponent>{renderAvatar(final, avatar.props, Slots, svgIconsEnabled)}</RingComponent>
60
- {svgIconsEnabled && showBadge && <Slots.badge {...badge} />}
61
- </Slots.root>
62
- );
63
- };
64
- },
65
- });
66
-
67
- function renderAvatar(final: JSAvatarProps, avatarProps: JSAvatarProps, Slots: Slots<AvatarSlotProps>, svgIconsEnabled?: boolean) {
68
- const { icon, initials, imageUrl } = mergeProps(avatarProps, final);
69
- return imageUrl ? (
70
- <Slots.image source={{ uri: imageUrl }} />
71
- ) : (
72
- <Slots.initialsBackground accessible={false}>
73
- {initials ? (
74
- <Slots.initials accessible={false}>{initials}</Slots.initials>
75
- ) : avatarProps.icon ? (
76
- <Slots.icon {...icon} accessible={false} />
77
- ) : (
78
- svgIconsEnabled && <Slots.icon svgSource={svgProps} accessible={false} />
79
- )}
80
- </Slots.initialsBackground>
81
- );
82
- }
83
-
84
- const fallbackIconSvg: React.FunctionComponent<SvgProps> = () => {
85
- return (
86
- <Svg viewBox="0 0 14 16">
87
- <Path
88
- fill="currentColor"
89
- 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"
90
- ></Path>
91
- </Svg>
92
- );
93
- };
94
- const svgProps: SvgIconProps = {
95
- src: fallbackIconSvg,
96
- };
@@ -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
- }