@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.
Files changed (40) hide show
  1. package/CHANGELOG.json +70 -1
  2. package/CHANGELOG.md +30 -2
  3. package/lib/JSAvatar.d.ts.map +1 -1
  4. package/lib/JSAvatar.helpers.d.ts +1 -4
  5. package/lib/JSAvatar.helpers.d.ts.map +1 -1
  6. package/lib/JSAvatar.helpers.js +12 -37
  7. package/lib/JSAvatar.helpers.js.map +1 -1
  8. package/lib/JSAvatar.js +8 -8
  9. package/lib/JSAvatar.js.map +1 -1
  10. package/lib/JSAvatar.styling.d.ts.map +1 -1
  11. package/lib/JSAvatar.styling.js +5 -7
  12. package/lib/JSAvatar.styling.js.map +1 -1
  13. package/lib/JSAvatar.types.d.ts +10 -11
  14. package/lib/JSAvatar.types.d.ts.map +1 -1
  15. package/lib/JSAvatar.types.js +14 -0
  16. package/lib/JSAvatar.types.js.map +1 -1
  17. package/lib/useAvatar.js +7 -11
  18. package/lib/useAvatar.js.map +1 -1
  19. package/lib-commonjs/JSAvatar.d.ts.map +1 -1
  20. package/lib-commonjs/JSAvatar.helpers.d.ts +1 -4
  21. package/lib-commonjs/JSAvatar.helpers.d.ts.map +1 -1
  22. package/lib-commonjs/JSAvatar.helpers.js +13 -40
  23. package/lib-commonjs/JSAvatar.helpers.js.map +1 -1
  24. package/lib-commonjs/JSAvatar.js +8 -8
  25. package/lib-commonjs/JSAvatar.js.map +1 -1
  26. package/lib-commonjs/JSAvatar.styling.d.ts.map +1 -1
  27. package/lib-commonjs/JSAvatar.styling.js +5 -7
  28. package/lib-commonjs/JSAvatar.styling.js.map +1 -1
  29. package/lib-commonjs/JSAvatar.types.d.ts +10 -11
  30. package/lib-commonjs/JSAvatar.types.d.ts.map +1 -1
  31. package/lib-commonjs/JSAvatar.types.js +15 -1
  32. package/lib-commonjs/JSAvatar.types.js.map +1 -1
  33. package/lib-commonjs/useAvatar.js +7 -11
  34. package/lib-commonjs/useAvatar.js.map +1 -1
  35. package/package.json +9 -8
  36. package/src/JSAvatar.helpers.ts +13 -42
  37. package/src/JSAvatar.styling.ts +7 -23
  38. package/src/JSAvatar.tsx +9 -9
  39. package/src/JSAvatar.types.ts +23 -14
  40. 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 { getPresenceIconSource } from './JSAvatar.helpers';
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 { imageUrl, imageDescription, initials, presence, isOutOfOffice, ring, shape, active, activeAppearance, ...rest } = props;
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,