@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.
Files changed (117) hide show
  1. package/CHANGELOG.json +106 -1
  2. package/CHANGELOG.md +39 -2
  3. package/lib/Avatar.d.ts +69 -2
  4. package/lib/Avatar.d.ts.map +1 -1
  5. package/lib/Avatar.js +32 -38
  6. package/lib/Avatar.js.map +1 -1
  7. package/lib/JSAvatar.d.ts +12 -0
  8. package/lib/JSAvatar.d.ts.map +1 -0
  9. package/lib/{Avatar.helpers.d.ts → JSAvatar.helpers.d.ts} +3 -3
  10. package/lib/JSAvatar.helpers.d.ts.map +1 -0
  11. package/lib/{Avatar.helpers.js → JSAvatar.helpers.js} +1 -1
  12. package/lib/JSAvatar.helpers.js.map +1 -0
  13. package/lib/JSAvatar.js +62 -0
  14. package/lib/JSAvatar.js.map +1 -0
  15. package/lib/JSAvatar.styling.d.ts +5 -0
  16. package/lib/JSAvatar.styling.d.ts.map +1 -0
  17. package/lib/{Avatar.styling.js → JSAvatar.styling.js} +35 -43
  18. package/lib/JSAvatar.styling.js.map +1 -0
  19. package/{lib-commonjs/Avatar.types.d.ts → lib/JSAvatar.types.d.ts} +20 -12
  20. package/lib/JSAvatar.types.d.ts.map +1 -0
  21. package/lib/JSAvatar.types.js +2 -0
  22. package/lib/JSAvatar.types.js.map +1 -0
  23. package/lib/JSAvatarTokens.d.ts +5 -0
  24. package/lib/JSAvatarTokens.d.ts.map +1 -0
  25. package/lib/JSAvatarTokens.js +18 -0
  26. package/lib/JSAvatarTokens.js.map +1 -0
  27. package/lib/index.d.ts +2 -1
  28. package/lib/index.d.ts.map +1 -1
  29. package/lib/index.js +2 -1
  30. package/lib/index.js.map +1 -1
  31. package/lib/useAvatar.d.ts +2 -2
  32. package/lib/useAvatar.d.ts.map +1 -1
  33. package/lib/useAvatar.js +3 -3
  34. package/lib/useAvatar.js.map +1 -1
  35. package/lib-commonjs/Avatar.d.ts +69 -2
  36. package/lib-commonjs/Avatar.d.ts.map +1 -1
  37. package/lib-commonjs/Avatar.js +31 -37
  38. package/lib-commonjs/Avatar.js.map +1 -1
  39. package/lib-commonjs/JSAvatar.d.ts +12 -0
  40. package/lib-commonjs/JSAvatar.d.ts.map +1 -0
  41. package/lib-commonjs/{Avatar.helpers.d.ts → JSAvatar.helpers.d.ts} +3 -3
  42. package/lib-commonjs/JSAvatar.helpers.d.ts.map +1 -0
  43. package/lib-commonjs/{Avatar.helpers.js → JSAvatar.helpers.js} +1 -1
  44. package/lib-commonjs/JSAvatar.helpers.js.map +1 -0
  45. package/lib-commonjs/JSAvatar.js +64 -0
  46. package/lib-commonjs/JSAvatar.js.map +1 -0
  47. package/lib-commonjs/JSAvatar.styling.d.ts +5 -0
  48. package/lib-commonjs/JSAvatar.styling.d.ts.map +1 -0
  49. package/lib-commonjs/JSAvatar.styling.js +125 -0
  50. package/lib-commonjs/JSAvatar.styling.js.map +1 -0
  51. package/{lib/Avatar.types.d.ts → lib-commonjs/JSAvatar.types.d.ts} +20 -12
  52. package/lib-commonjs/JSAvatar.types.d.ts.map +1 -0
  53. package/lib-commonjs/{Avatar.types.js → JSAvatar.types.js} +2 -2
  54. package/lib-commonjs/JSAvatar.types.js.map +1 -0
  55. package/lib-commonjs/JSAvatarTokens.d.ts +5 -0
  56. package/lib-commonjs/JSAvatarTokens.d.ts.map +1 -0
  57. package/lib-commonjs/JSAvatarTokens.js +20 -0
  58. package/lib-commonjs/JSAvatarTokens.js.map +1 -0
  59. package/lib-commonjs/index.d.ts +2 -1
  60. package/lib-commonjs/index.d.ts.map +1 -1
  61. package/lib-commonjs/index.js +2 -1
  62. package/lib-commonjs/index.js.map +1 -1
  63. package/lib-commonjs/useAvatar.d.ts +2 -2
  64. package/lib-commonjs/useAvatar.d.ts.map +1 -1
  65. package/lib-commonjs/useAvatar.js +4 -4
  66. package/lib-commonjs/useAvatar.js.map +1 -1
  67. package/package.json +5 -5
  68. package/src/Avatar.tsx +127 -37
  69. package/src/{Avatar.helpers.ts → JSAvatar.helpers.ts} +2 -2
  70. package/src/{Avatar.styling.ts → JSAvatar.styling.ts} +24 -20
  71. package/src/JSAvatar.tsx +56 -0
  72. package/src/{Avatar.types.ts → JSAvatar.types.ts} +20 -11
  73. package/src/{AvatarTokens.ts → JSAvatarTokens.ts} +11 -4
  74. package/src/index.ts +2 -1
  75. package/src/useAvatar.ts +6 -5
  76. package/lib/Avatar.helpers.d.ts.map +0 -1
  77. package/lib/Avatar.helpers.js.map +0 -1
  78. package/lib/Avatar.ios.d.ts +0 -70
  79. package/lib/Avatar.ios.d.ts.map +0 -1
  80. package/lib/Avatar.ios.js +0 -45
  81. package/lib/Avatar.ios.js.map +0 -1
  82. package/lib/Avatar.macos.d.ts +0 -70
  83. package/lib/Avatar.macos.d.ts.map +0 -1
  84. package/lib/Avatar.macos.js +0 -45
  85. package/lib/Avatar.macos.js.map +0 -1
  86. package/lib/Avatar.styling.d.ts +0 -4
  87. package/lib/Avatar.styling.d.ts.map +0 -1
  88. package/lib/Avatar.styling.js.map +0 -1
  89. package/lib/Avatar.types.d.ts.map +0 -1
  90. package/lib/Avatar.types.js +0 -2
  91. package/lib/Avatar.types.js.map +0 -1
  92. package/lib/AvatarTokens.d.ts +0 -5
  93. package/lib/AvatarTokens.d.ts.map +0 -1
  94. package/lib/AvatarTokens.js +0 -11
  95. package/lib/AvatarTokens.js.map +0 -1
  96. package/lib-commonjs/Avatar.helpers.d.ts.map +0 -1
  97. package/lib-commonjs/Avatar.helpers.js.map +0 -1
  98. package/lib-commonjs/Avatar.ios.d.ts +0 -70
  99. package/lib-commonjs/Avatar.ios.d.ts.map +0 -1
  100. package/lib-commonjs/Avatar.ios.js +0 -47
  101. package/lib-commonjs/Avatar.ios.js.map +0 -1
  102. package/lib-commonjs/Avatar.macos.d.ts +0 -70
  103. package/lib-commonjs/Avatar.macos.d.ts.map +0 -1
  104. package/lib-commonjs/Avatar.macos.js +0 -47
  105. package/lib-commonjs/Avatar.macos.js.map +0 -1
  106. package/lib-commonjs/Avatar.styling.d.ts +0 -4
  107. package/lib-commonjs/Avatar.styling.d.ts.map +0 -1
  108. package/lib-commonjs/Avatar.styling.js +0 -133
  109. package/lib-commonjs/Avatar.styling.js.map +0 -1
  110. package/lib-commonjs/Avatar.types.d.ts.map +0 -1
  111. package/lib-commonjs/Avatar.types.js.map +0 -1
  112. package/lib-commonjs/AvatarTokens.d.ts +0 -5
  113. package/lib-commonjs/AvatarTokens.d.ts.map +0 -1
  114. package/lib-commonjs/AvatarTokens.js +0 -13
  115. package/lib-commonjs/AvatarTokens.js.map +0 -1
  116. package/src/Avatar.ios.tsx +0 -134
  117. package/src/Avatar.macos.tsx +0 -134
@@ -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
- });