@fluentui-react-native/experimental-avatar 0.13.0 → 0.13.4
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 +106 -1
- package/CHANGELOG.md +39 -2
- package/lib/Avatar.d.ts +69 -2
- package/lib/Avatar.d.ts.map +1 -1
- package/lib/Avatar.js +32 -38
- package/lib/Avatar.js.map +1 -1
- package/lib/JSAvatar.d.ts +12 -0
- package/lib/JSAvatar.d.ts.map +1 -0
- package/lib/{Avatar.helpers.d.ts → JSAvatar.helpers.d.ts} +3 -3
- package/lib/JSAvatar.helpers.d.ts.map +1 -0
- package/lib/{Avatar.helpers.js → JSAvatar.helpers.js} +1 -1
- package/lib/JSAvatar.helpers.js.map +1 -0
- package/lib/JSAvatar.js +62 -0
- package/lib/JSAvatar.js.map +1 -0
- package/lib/JSAvatar.styling.d.ts +5 -0
- package/lib/JSAvatar.styling.d.ts.map +1 -0
- package/lib/{Avatar.styling.js → JSAvatar.styling.js} +35 -43
- package/lib/JSAvatar.styling.js.map +1 -0
- package/{lib-commonjs/Avatar.types.d.ts → lib/JSAvatar.types.d.ts} +20 -12
- package/lib/JSAvatar.types.d.ts.map +1 -0
- package/lib/JSAvatar.types.js +2 -0
- package/lib/JSAvatar.types.js.map +1 -0
- package/lib/JSAvatarTokens.d.ts +5 -0
- package/lib/JSAvatarTokens.d.ts.map +1 -0
- package/lib/JSAvatarTokens.js +18 -0
- package/lib/JSAvatarTokens.js.map +1 -0
- package/lib/index.d.ts +2 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -1
- package/lib/index.js.map +1 -1
- package/lib/useAvatar.d.ts +2 -2
- package/lib/useAvatar.d.ts.map +1 -1
- package/lib/useAvatar.js +3 -3
- package/lib/useAvatar.js.map +1 -1
- package/lib-commonjs/Avatar.d.ts +69 -2
- package/lib-commonjs/Avatar.d.ts.map +1 -1
- package/lib-commonjs/Avatar.js +31 -37
- package/lib-commonjs/Avatar.js.map +1 -1
- package/lib-commonjs/JSAvatar.d.ts +12 -0
- package/lib-commonjs/JSAvatar.d.ts.map +1 -0
- package/lib-commonjs/{Avatar.helpers.d.ts → JSAvatar.helpers.d.ts} +3 -3
- package/lib-commonjs/JSAvatar.helpers.d.ts.map +1 -0
- package/lib-commonjs/{Avatar.helpers.js → JSAvatar.helpers.js} +1 -1
- package/lib-commonjs/JSAvatar.helpers.js.map +1 -0
- package/lib-commonjs/JSAvatar.js +64 -0
- package/lib-commonjs/JSAvatar.js.map +1 -0
- package/lib-commonjs/JSAvatar.styling.d.ts +5 -0
- package/lib-commonjs/JSAvatar.styling.d.ts.map +1 -0
- package/lib-commonjs/JSAvatar.styling.js +125 -0
- package/lib-commonjs/JSAvatar.styling.js.map +1 -0
- package/{lib/Avatar.types.d.ts → lib-commonjs/JSAvatar.types.d.ts} +20 -12
- package/lib-commonjs/JSAvatar.types.d.ts.map +1 -0
- package/lib-commonjs/{Avatar.types.js → JSAvatar.types.js} +2 -2
- package/lib-commonjs/JSAvatar.types.js.map +1 -0
- package/lib-commonjs/JSAvatarTokens.d.ts +5 -0
- package/lib-commonjs/JSAvatarTokens.d.ts.map +1 -0
- package/lib-commonjs/JSAvatarTokens.js +20 -0
- package/lib-commonjs/JSAvatarTokens.js.map +1 -0
- package/lib-commonjs/index.d.ts +2 -1
- package/lib-commonjs/index.d.ts.map +1 -1
- package/lib-commonjs/index.js +2 -1
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/useAvatar.d.ts +2 -2
- package/lib-commonjs/useAvatar.d.ts.map +1 -1
- package/lib-commonjs/useAvatar.js +4 -4
- package/lib-commonjs/useAvatar.js.map +1 -1
- package/package.json +5 -5
- package/src/Avatar.tsx +127 -37
- package/src/{Avatar.helpers.ts → JSAvatar.helpers.ts} +2 -2
- package/src/{Avatar.styling.ts → JSAvatar.styling.ts} +24 -20
- package/src/JSAvatar.tsx +56 -0
- package/src/{Avatar.types.ts → JSAvatar.types.ts} +20 -11
- package/src/{AvatarTokens.ts → JSAvatarTokens.ts} +11 -4
- package/src/index.ts +2 -1
- package/src/useAvatar.ts +6 -5
- package/lib/Avatar.helpers.d.ts.map +0 -1
- package/lib/Avatar.helpers.js.map +0 -1
- package/lib/Avatar.ios.d.ts +0 -70
- package/lib/Avatar.ios.d.ts.map +0 -1
- package/lib/Avatar.ios.js +0 -45
- package/lib/Avatar.ios.js.map +0 -1
- package/lib/Avatar.macos.d.ts +0 -70
- package/lib/Avatar.macos.d.ts.map +0 -1
- package/lib/Avatar.macos.js +0 -45
- package/lib/Avatar.macos.js.map +0 -1
- package/lib/Avatar.styling.d.ts +0 -4
- package/lib/Avatar.styling.d.ts.map +0 -1
- package/lib/Avatar.styling.js.map +0 -1
- package/lib/Avatar.types.d.ts.map +0 -1
- package/lib/Avatar.types.js +0 -2
- package/lib/Avatar.types.js.map +0 -1
- package/lib/AvatarTokens.d.ts +0 -5
- package/lib/AvatarTokens.d.ts.map +0 -1
- package/lib/AvatarTokens.js +0 -11
- package/lib/AvatarTokens.js.map +0 -1
- package/lib-commonjs/Avatar.helpers.d.ts.map +0 -1
- package/lib-commonjs/Avatar.helpers.js.map +0 -1
- package/lib-commonjs/Avatar.ios.d.ts +0 -70
- package/lib-commonjs/Avatar.ios.d.ts.map +0 -1
- package/lib-commonjs/Avatar.ios.js +0 -47
- package/lib-commonjs/Avatar.ios.js.map +0 -1
- package/lib-commonjs/Avatar.macos.d.ts +0 -70
- package/lib-commonjs/Avatar.macos.d.ts.map +0 -1
- package/lib-commonjs/Avatar.macos.js +0 -47
- package/lib-commonjs/Avatar.macos.js.map +0 -1
- package/lib-commonjs/Avatar.styling.d.ts +0 -4
- package/lib-commonjs/Avatar.styling.d.ts.map +0 -1
- package/lib-commonjs/Avatar.styling.js +0 -133
- package/lib-commonjs/Avatar.styling.js.map +0 -1
- package/lib-commonjs/Avatar.types.d.ts.map +0 -1
- package/lib-commonjs/Avatar.types.js.map +0 -1
- package/lib-commonjs/AvatarTokens.d.ts +0 -5
- package/lib-commonjs/AvatarTokens.d.ts.map +0 -1
- package/lib-commonjs/AvatarTokens.js +0 -13
- package/lib-commonjs/AvatarTokens.js.map +0 -1
- package/src/Avatar.ios.tsx +0 -134
- package/src/Avatar.macos.tsx +0 -134
package/src/Avatar.macos.tsx
DELETED
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
/** @jsx withSlots */
|
|
2
|
-
import { compose, UseSlots, buildProps, mergeProps, withSlots } from '@fluentui-react-native/framework';
|
|
3
|
-
import { ImageURISource, NativeModules, ViewProps, ColorValue } from 'react-native';
|
|
4
|
-
import { ensureNativeComponent } from '@fluentui-react-native/component-cache';
|
|
5
|
-
|
|
6
|
-
const avatarName = 'Avatar';
|
|
7
|
-
|
|
8
|
-
const NativeAvatarView = ensureNativeComponent('FRNAvatarView');
|
|
9
|
-
|
|
10
|
-
export type Size = 'xSmall' | 'small' | 'medium' | 'large' | 'xLarge' | 'xxLarge';
|
|
11
|
-
|
|
12
|
-
export type AvatarStyle = 'default' | 'accent' | 'group' | 'outlined' | 'outlinedPrimary' | 'overflow';
|
|
13
|
-
|
|
14
|
-
export type Presence = 'none' | 'available' | 'away' | 'blocked' | 'doNotDisturb' | 'offline' | 'unknown';
|
|
15
|
-
|
|
16
|
-
interface ExportedConstants {
|
|
17
|
-
sizes: { [key in Size]: number };
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
const ExportedNativeConstants: ExportedConstants = NativeModules.FRNAvatarViewManager;
|
|
21
|
-
|
|
22
|
-
export type AvatarTokens = {
|
|
23
|
-
/**
|
|
24
|
-
* Supported Avatar sizes
|
|
25
|
-
*/
|
|
26
|
-
size?: Size;
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Supported Avatar styles
|
|
30
|
-
*/
|
|
31
|
-
avatarStyle?: AvatarStyle;
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
export type AvatarProps = AvatarTokens & {
|
|
35
|
-
/**
|
|
36
|
-
* The image to be displayed
|
|
37
|
-
*/
|
|
38
|
-
imageSource?: ImageURISource;
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* The primary text to create initials with (e.g. a name)
|
|
42
|
-
*/
|
|
43
|
-
primaryText?: string;
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* The secondary text to create initials with if primary text is not provided (e.g. an email address)
|
|
47
|
-
*/
|
|
48
|
-
secondaryText?: string;
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* A custom color for the ring around the Avatar
|
|
52
|
-
*/
|
|
53
|
-
ringColor?: ColorValue;
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* A custom color for the avatar initials when no image is shown
|
|
57
|
-
*/
|
|
58
|
-
foregroundColor?: ColorValue;
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* A custom color for the avatar background when no image is shown
|
|
62
|
-
*/
|
|
63
|
-
backgroundColor?: ColorValue;
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* The avatar view's presence state.
|
|
67
|
-
*/
|
|
68
|
-
presence?: Presence;
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* A boolean inidicating whether the ring is visible
|
|
72
|
-
*/
|
|
73
|
-
isRingVisible?: boolean;
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* A boolean indicating whether the Inner Ring Gap is transparent
|
|
77
|
-
*/
|
|
78
|
-
isTransparent?: boolean;
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* A boolean indicating out of office status
|
|
82
|
-
*/
|
|
83
|
-
isOutOfOffice?: boolean;
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* A boolean indicating whether the gap between the avatar and ring is visible.
|
|
87
|
-
*/
|
|
88
|
-
hasRingInnerGap?: boolean;
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* An image to be shown as the backdrop of the ring, rather then a solid color.
|
|
92
|
-
* Takes precendence over `ringColor`
|
|
93
|
-
*/
|
|
94
|
-
customBorderImageSource?: ImageURISource;
|
|
95
|
-
};
|
|
96
|
-
|
|
97
|
-
const tokensThatAreAlsoProps: (keyof AvatarTokens)[] = ['size', 'avatarStyle'];
|
|
98
|
-
|
|
99
|
-
export type NativeAvatarViewProps = ViewProps & AvatarProps;
|
|
100
|
-
interface AvatarType {
|
|
101
|
-
props: AvatarProps;
|
|
102
|
-
slotProps: { root: NativeAvatarViewProps };
|
|
103
|
-
tokens: AvatarTokens;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
export const Avatar = compose<AvatarType>({
|
|
107
|
-
displayName: avatarName,
|
|
108
|
-
tokens: [
|
|
109
|
-
{
|
|
110
|
-
size: 'small',
|
|
111
|
-
avatarStyle: 'default',
|
|
112
|
-
},
|
|
113
|
-
avatarName,
|
|
114
|
-
],
|
|
115
|
-
tokensThatAreAlsoProps,
|
|
116
|
-
slots: { root: NativeAvatarView },
|
|
117
|
-
slotProps: {
|
|
118
|
-
root: buildProps<NativeAvatarViewProps, AvatarTokens>(
|
|
119
|
-
(tokens) => ({
|
|
120
|
-
size: tokens.size,
|
|
121
|
-
style: {
|
|
122
|
-
height: ExportedNativeConstants.sizes[tokens.size],
|
|
123
|
-
width: ExportedNativeConstants.sizes[tokens.size],
|
|
124
|
-
},
|
|
125
|
-
}),
|
|
126
|
-
['size'],
|
|
127
|
-
),
|
|
128
|
-
},
|
|
129
|
-
render: (props: AvatarProps, useSlots: UseSlots<AvatarType>) => {
|
|
130
|
-
const Root = useSlots(props).root;
|
|
131
|
-
|
|
132
|
-
return (rest: AvatarProps) => <Root {...mergeProps(props, rest)} />;
|
|
133
|
-
},
|
|
134
|
-
});
|