@fluentui-react-native/experimental-avatar 0.14.13 → 0.14.16
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 +70 -1
- package/CHANGELOG.md +30 -2
- package/lib/JSAvatar.d.ts.map +1 -1
- package/lib/JSAvatar.helpers.d.ts +1 -4
- package/lib/JSAvatar.helpers.d.ts.map +1 -1
- package/lib/JSAvatar.helpers.js +12 -37
- package/lib/JSAvatar.helpers.js.map +1 -1
- package/lib/JSAvatar.js +8 -8
- package/lib/JSAvatar.js.map +1 -1
- package/lib/JSAvatar.styling.d.ts.map +1 -1
- package/lib/JSAvatar.styling.js +5 -7
- package/lib/JSAvatar.styling.js.map +1 -1
- package/lib/JSAvatar.types.d.ts +10 -11
- package/lib/JSAvatar.types.d.ts.map +1 -1
- package/lib/JSAvatar.types.js +14 -0
- package/lib/JSAvatar.types.js.map +1 -1
- package/lib/useAvatar.js +7 -11
- package/lib/useAvatar.js.map +1 -1
- package/lib-commonjs/JSAvatar.d.ts.map +1 -1
- package/lib-commonjs/JSAvatar.helpers.d.ts +1 -4
- package/lib-commonjs/JSAvatar.helpers.d.ts.map +1 -1
- package/lib-commonjs/JSAvatar.helpers.js +13 -40
- package/lib-commonjs/JSAvatar.helpers.js.map +1 -1
- package/lib-commonjs/JSAvatar.js +8 -8
- package/lib-commonjs/JSAvatar.js.map +1 -1
- package/lib-commonjs/JSAvatar.styling.d.ts.map +1 -1
- package/lib-commonjs/JSAvatar.styling.js +5 -7
- package/lib-commonjs/JSAvatar.styling.js.map +1 -1
- package/lib-commonjs/JSAvatar.types.d.ts +10 -11
- package/lib-commonjs/JSAvatar.types.d.ts.map +1 -1
- package/lib-commonjs/JSAvatar.types.js +15 -1
- package/lib-commonjs/JSAvatar.types.js.map +1 -1
- package/lib-commonjs/useAvatar.js +7 -11
- package/lib-commonjs/useAvatar.js.map +1 -1
- package/package.json +9 -8
- package/src/JSAvatar.helpers.ts +13 -42
- package/src/JSAvatar.styling.ts +7 -23
- package/src/JSAvatar.tsx +9 -9
- package/src/JSAvatar.types.ts +23 -14
- package/src/useAvatar.ts +15 -15
package/src/useAvatar.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { JSAvatarProps, AvatarInfo, JSAvatarState } from './JSAvatar.types';
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import { ImageProps, ImageSourcePropType } from 'react-native';
|
|
3
|
+
import { PresenceBadgeProps } from '@fluentui-react-native/badge';
|
|
4
4
|
/**
|
|
5
5
|
* Re-usable hook for FURN Avatar.
|
|
6
6
|
* This hook configures Avatar props and state for FURN Avatar.
|
|
@@ -9,34 +9,34 @@ import { getPresenceIconSource } from './JSAvatar.helpers';
|
|
|
9
9
|
* @returns configured props and state for FURN Avatar
|
|
10
10
|
*/
|
|
11
11
|
export const useAvatar = (props: JSAvatarProps): AvatarInfo => {
|
|
12
|
-
const {
|
|
13
|
-
|
|
14
|
-
const personaPhotoSource =
|
|
15
|
-
imageUrl === undefined
|
|
16
|
-
? undefined
|
|
17
|
-
: {
|
|
18
|
-
uri: imageUrl,
|
|
19
|
-
};
|
|
12
|
+
const { active, accessibilityLabel, activeAppearance, badge, src, ring, shape, ...rest } = props;
|
|
20
13
|
|
|
21
|
-
const iconSource = presence === undefined ? undefined : getPresenceIconSource(presence, isOutOfOffice || false);
|
|
22
14
|
const showRing = active === 'active' && activeAppearance === 'ring';
|
|
23
15
|
const transparentRing = !!ring?.transparent;
|
|
24
16
|
|
|
17
|
+
const imageProps: ImageProps = {
|
|
18
|
+
accessibilityLabel,
|
|
19
|
+
source: src ? ({ uri: src } as ImageSourcePropType) : undefined,
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const badgeProps: PresenceBadgeProps = {
|
|
23
|
+
size: 'small',
|
|
24
|
+
...badge,
|
|
25
|
+
};
|
|
26
|
+
|
|
25
27
|
const state: JSAvatarState = {
|
|
26
|
-
iconSource,
|
|
27
|
-
personaPhotoSource,
|
|
28
28
|
showRing,
|
|
29
29
|
transparentRing,
|
|
30
30
|
};
|
|
31
31
|
|
|
32
32
|
return {
|
|
33
33
|
props: {
|
|
34
|
-
children: initials,
|
|
35
|
-
accessibilityLabel: imageDescription,
|
|
36
34
|
shape: shape || 'circular',
|
|
37
35
|
...rest,
|
|
38
36
|
active,
|
|
39
37
|
activeAppearance,
|
|
38
|
+
image: imageProps,
|
|
39
|
+
badge: badgeProps,
|
|
40
40
|
},
|
|
41
41
|
state: {
|
|
42
42
|
...state,
|