@fluentui-react-native/experimental-avatar 0.14.45 → 0.15.2

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 (104) 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__/Avatar.test.jsx +129 -0
  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/__tests__/JSAvatar.test.jsx +0 -96
  102. package/src/getHashCode.ts +0 -16
  103. package/src/titles.ts +0 -108
  104. package/src/useAvatar.ts +0 -126
package/MIGRATION.md DELETED
@@ -1,157 +0,0 @@
1
- # Avatar Migration
2
-
3
- ## Migration from PersonaCoin component
4
-
5
- ### Component renames
6
-
7
- | `PersonaCoin` | `Avatar` |
8
- | ------------------------------------------------------------ | ------------------------------------------------ |
9
- | `<PersonaCoin size='size24' initials="SN" />` | `<Avatar size={24} initials="SN" />` |
10
- | `<PersonaCoin presence='available' coinColorFluent="red" />` | `<Avatar size={24} initials="SN" />` |
11
- | `<PersonaCoin imageUrl="./path/name.png" />` | `<Avatar image={{source: './path/name.png'}} />` |
12
- | `<PersonaCoin imageDescription="Photo" />` | `<Avatar accessibilityLabel="Photo" />` |
13
-
14
- ### Props that remain as is
15
-
16
- - `icon`
17
- - `initials`
18
- - `size`
19
- - `imageUrl`
20
-
21
- ### Props no longer supported with an equivalent functionality in Avatar
22
-
23
- - `coinColorFluent` => Use `avatarColor` instead.
24
- - `imageDescription` => Use `accessibilityLabel` instead.
25
- - `isOutOfOffice` => `outOfOffice` is part of `badge` slot. Use `badge={{ outOfOffice: true }} />`.
26
- - `presence` => It's part of `badge` slot. Use `badge={{ presence: 'available' }} />`.
27
- - `ring` => `ring` became part of `activeAppearance` prop. It's used together with `active='active'` prop.
28
-
29
- ### New props
30
-
31
- - `active`
32
- - `activeAppearance` - According to Web spec there should be `ring`, `shadow`, `glow`, `ring-shadow`, `ring-glow`.
33
- Currently we support only `ring`. `activeAppearance` can be used when `active` prop set to `active`.
34
- - `name` - is used for generation initials with `getInitials` method.
35
- - `shape` - can be `circular` and `square`.
36
- - `idForColor`
37
-
38
- ### Tokens that remain as is
39
-
40
- - Any props that are part of `IBackgroundColorTokens`, `IForegroundColorTokens`
41
-
42
- - `iconSize`
43
- - `iconWeight`
44
- - `size`
45
-
46
- ### Tokens no longer supported with an equivalent functionality in Avatar
47
-
48
- - `initialsSize` => Use `fontSize` token instead
49
- - `coinColorFluent` => Use `avatarColor` token instead
50
- - `coinSize` => Use size tokens instead.
51
- - `ring` => Use `ringBackgroundColor`, `ringColor`, `ringThickness` and `ringInnerGap`
52
-
53
- ### Tokens no longer supported without an equivalent functionality in Avatar
54
-
55
- - `iconStrokeWidth` and `iconStrokeColor` => This was for activity ring around the Avatar.
56
- We support ring in `activeAppearance` prop. `borderColor` will be changed using `ringColor` token and `borderWidth` using ringThickness token.
57
- - `horizontalIconAlignment` and `verticalIconAlignment` => these props were responsible for presence badge position.
58
-
59
- ### New tokens
60
-
61
- - Any props that are part of `FontTokens` and `IBorderTokens`.
62
- - `avatarOpacity`
63
- - `badgeSize`
64
- - `circular`
65
- - `iconColor`
66
- - `inactive`
67
- - `square`
68
-
69
- Size tokens:
70
-
71
- - `size20`
72
- - `size24`
73
- - `size28`
74
- - `size32`
75
- - `size36`
76
- - `size40`
77
- - `size48`
78
- - `size56`
79
- - `size64`
80
- - `size72`
81
- - `size96`
82
- - `size120`
83
-
84
- Color tokens:
85
-
86
- - `neutral`
87
- - `brand`
88
- - `darkRed`
89
- - `cranberry`
90
- - `red`
91
- - `pumpkin`
92
- - `peach`
93
- - `marigold`
94
- - `gold`
95
- - `brass`
96
- - `brown`
97
- - `forest`
98
- - `seafoam`
99
- - `darkGreen`
100
- - `lightTeal`
101
- - `teal`
102
- - `steel`
103
- - `blue`
104
- - `royalBlue`
105
- - `cornflower`
106
- - `navy`
107
- - `lavender`
108
- - `purple`
109
- - `grape`
110
- - `lilac`
111
- - `pink`
112
- - `magenta`
113
- - `plum`
114
- - `beige`
115
- - `mink`
116
- - `platinum`
117
- - `anchor`
118
-
119
- ### Slots no longer supported with an equivalent functionality in v1 Avatar
120
-
121
- - `photo` => Use `image` slot instead or `imageUrl` prop.
122
-
123
- ### Slots no longer supported without an equivalent functionality in v1 Avatar
124
-
125
- - `glow` => is not suported in this version of Avatar
126
-
127
- ### New slots
128
-
129
- - `badge`
130
-
131
- ### Prop differences due to technical differences and limitations
132
-
133
- - Web uses `image` slot which is part of `react-image` component. They use syntax `image={{ src: './MonaKane.jpg' }}`. If we use similar syntax, our users will need to write `image={{ source: { uri: './MonaKane.jpg' } }} />`. In majority of cases users pass image URL that's why we still have opportunity to pass this parameter using `imageUrl` prop. But there's also a way to pass `image` object similar to Web.
134
-
135
- ### Other Prop differences
136
-
137
- - `avatarColor` => Web uses `color` prop and omits it from `ComponentProps<AvatarSlots>`. Their users can style font color using CSS but our users can style the component via tokens. If we use the same prop name (color), we'll need to omit it from foregroundTokens and come up with a new name for the font color prop. That's why we use `avatarColor` prop instead of `color`.
138
-
139
- ## Property mapping
140
-
141
- | `PersonaCoin` | `Avatar` |
142
- | ------------------ | -------------------- |
143
- | | `active` |
144
- | | `activeAppearance` |
145
- | | `badge` |
146
- | `coinColorFluent` | `avatarColor` |
147
- | `icon` | `icon` |
148
- | | `idForColor` |
149
- | `imageUrl` | `imageUrl` |
150
- | `imageDescription` | `accessibilityLabel` |
151
- | `isOutOfOffice` | |
152
- | `initials` | `initials` |
153
- | | `name` |
154
- | `presence` | |
155
- | `ring` | |
156
- | | `shape` |
157
- | `size` | `size` |
package/SPEC.md DELETED
@@ -1,295 +0,0 @@
1
- # Avatar
2
-
3
- ## Background
4
-
5
- The Avatar component represents a person or entity. It displays the person's image, initials, or an icon, and can be either circular or square.
6
- Previously it was a component PersonaCoin which used an old version of framework. There are more details in MIGRATION.md.
7
-
8
- ```ts
9
- import { JSAvatar } from '@fluentui-react-native/experimental-avatar';
10
- ```
11
-
12
- ## Sample Code
13
-
14
- Basic examples:
15
-
16
- ```jsx
17
- <JSAvatar />
18
- <JSAvatar icon={{ svgSource: { uri: 'https://www.example.com/test.svg', viewBox: '0 0 100 100' } }} size={120} />
19
- <JSAvatar src="../../path-to-image.png" active="active" activeAppearance="ring" size={56} />
20
- <JSAvatar shape="square" avatarColor="purple" name="Richard Feynman" />
21
- ```
22
-
23
- More examples on the [Test pages for the Avatar](../../../apps/fluent-tester/src/FluentTester/TestComponents/Avatar). Instructions on running the tester app can be found [here](../../../apps/fluent-tester/README.md).
24
-
25
- ## Variants
26
-
27
- ### Active
28
-
29
- Optional activity indicator.
30
- Active prop can be `unset`, `active` and `inactive`. Default is `unset`.
31
-
32
- - active: the avatar will be decorated according to activeAppearance, e.g. `ring`.
33
- - inactive: the avatar will be partially transparent (0.8 opacity).
34
- - unset: normal display
35
-
36
- ### ActiveAppearance
37
-
38
- `activeAppearance` can be used when `active` prop set to `active`.
39
- It adds `ring` as extra visual.
40
-
41
- ### Badge
42
-
43
- The `Avatar` component can include presence badge when active prop is undefined or `unset`.
44
-
45
- ### Color
46
-
47
- The Avatar supports color variants when displaying initials or an icon:
48
-
49
- - Neutral - Gray (default).
50
- - Brand - Brand colors from the theme
51
- - Colorful - Pick from a list of pre-defined Avatar colors. The color will be assigned based on a hash of the name (to "randomly" assign a person a color). The color name (like darkRed) can also be specified explicitly in case the use case requires a different algorithm to pick the color.
52
-
53
- ### Icon
54
-
55
- The `Avatar` component can include an `icon` that appears if there's no image or initials.
56
-
57
- ### Image
58
-
59
- The `Avatar` component can include an `image`.
60
-
61
- ### Initials
62
-
63
- Initials can be passed using `initials` prop or generated from `name` prop using getInitials method.
64
- Here are the requirements from Web spec:
65
-
66
- 1. If only one word is provided, pull the first letter of the word.
67
- 2. If 2 words provided, pull first letter of both words.
68
- 3. If 2+ words provided, pull first letter of first word and last word.
69
- 4. Ignore suffixes (i.e. Jr, III).
70
- 5. Ignore words in parantheses Ignore special characters i.e. parantheses, dashes If numeric, fall back to Icon If first character is not alphabetic, fall back to icon.
71
-
72
- But requirements are still being discussed. This area will be updated once we come up with final solition. There are different implementations in different teams.
73
-
74
- ### Name
75
-
76
- Name prop is used to generate initials.
77
-
78
- ### Shape
79
-
80
- The Avatar supports a circular and square (with rounded corners) shape.
81
-
82
- ### Sizes
83
-
84
- `Avatar` supports next sizes: `20, 24, 28, 32, 36, 40, 48, 56, 64, 72, 96, 120`.
85
- Default size for win32 is 24.
86
-
87
- ## API
88
-
89
- ### Slots
90
-
91
- The `Avatar` component has the following slots:
92
-
93
- - `root` - The outer container representing the `Avatar` wrapper.
94
- - `image` - If specified, renders an `image`
95
- - `initials` - If specified, renders initials when there's no `image`
96
- - `icon` - If specified, renders an `icon` if there's no `image` or `initials`.
97
- - `initialsBackground` - It's a wrapper for initials and icon.
98
- - `ring` - If specified, renders the ring for the `Avatar` when active prop is set to `active`.
99
- - `badge` - If specified, renders presence badge. Example: `badge={{ status: 'outOfOffice' }}.`.
100
-
101
- The slots can be modified using the `compose` function on the `Avatar`. For more information on using the `compose` API, please see [this page](../../framework/composition/README.md).
102
-
103
- ### Props
104
-
105
- ```ts
106
- export interface JSAvatarProps extends IViewProps, AvatarConfigurableProps {
107
- /**
108
- * Activity indicator
109
- * * active: the avatar will be decorated according to activeAppearance
110
- * * inactive: the avatar will be reduced in size and partially transparent
111
- * * unset: normal display
112
- *
113
- * @defaultvalue unset
114
- */
115
- active?: AvatarActive;
116
-
117
- /**
118
- * The appearance when `active="active"`
119
- *
120
- * @defaultvalue ring
121
- */
122
- activeAppearance?: AvatarActiveAppearance;
123
-
124
- /**
125
- * Badge shows the avatar's presence status.
126
- * Badge can be shown only if `active` prop is undefined or unset
127
- */
128
- badge?: PresenceBadgeProps;
129
-
130
- /**
131
- * Icon to be displayed when the avatar doesn't have an image or initials.
132
- *
133
- * @defaultvalue `PersonRegular` (the default icon's size depends on the Avatar's size)
134
- */
135
- icon?: IconSourcesType;
136
-
137
- /**
138
- * Specify a string to be used instead of the name, to determine which color to use when color="colorful".
139
- * Use this when a name is not available, but there is another unique identifier that can be used instead.
140
- */
141
- idForColor?: string;
142
-
143
- /**
144
- * The initials are displayed when there is no image (including while the image is loading).
145
- *
146
- * It is usually not necessary to specify custom initials; by default they will be derived from the `name` prop, using the `getInitials` function.
147
- */
148
- initials?: string;
149
-
150
- /**
151
- * The name of the person or entity represented by this Avatar. This should always be provided if it is available.
152
- *
153
- * The name will be used to determine the initials displayed when there is no icon, as well as provided to
154
- * accessibility tools.
155
- */
156
- name?: string;
157
-
158
- /**
159
- * Size of the avatar in pixels.
160
- *
161
- * Size is restricted to a limited set of supported values recommended for most uses (see `AvatarSizeValue`) and
162
- * based on design guidelines for the Avatar control.
163
- *
164
- * @defaultvalue 24
165
- */
166
- size?: AvatarSize;
167
-
168
- /**
169
- * The avatar can have a circular or square shape.
170
- * @defaultvalue circular
171
- */
172
- shape?: AvatarShape;
173
-
174
- /**
175
- * Shorthand for passing image URL instead of using `image` prop
176
- */
177
- imageUrl?: string;
178
- }
179
- ```
180
-
181
- ### Styling Tokens
182
-
183
- Tokens can be used to customize the styling of the control by using the `customize` function on the `Avatar`. For more information on using the `customize` API, please see [this page](../../framework/composition/README.md). The `Avatar` has the following tokens:
184
-
185
- ```ts
186
- export interface JSAvatarTokens extends IBackgroundColorTokens, IForegroundColorTokens, AvatarConfigurableProps, IBorderTokens, FontTokens {
187
- /**
188
- * Avatar opacity which is changed depending on `active` prop.
189
- */
190
- avatarOpacity?: number;
191
-
192
- /**
193
- * The size of presence badge.
194
- */
195
- badgeSize?: BadgeSize;
196
-
197
- /**
198
- * The icon color.
199
- */
200
- iconColor?: ColorValue;
201
-
202
- /**
203
- * The size of the icon.
204
- */
205
- iconSize?: number;
206
-
207
- /**
208
- * Avatar shapes:
209
- */
210
- circular?: JSAvatarTokens;
211
- square?: JSAvatarTokens;
212
-
213
- /**
214
- * Token for inactive value of `active` prop
215
- */
216
- inactive?: JSAvatarTokens;
217
-
218
- /**
219
- * Avatar sizes:
220
- */
221
- size20?: JSAvatarTokens;
222
- size24?: JSAvatarTokens;
223
- size28?: JSAvatarTokens;
224
- size32?: JSAvatarTokens;
225
- size36?: JSAvatarTokens;
226
- size40?: JSAvatarTokens;
227
- size48?: JSAvatarTokens;
228
- size56?: JSAvatarTokens;
229
- size64?: JSAvatarTokens;
230
- size72?: JSAvatarTokens;
231
- size96?: JSAvatarTokens;
232
- size120?: JSAvatarTokens;
233
-
234
- /**
235
- * Avatar colors:
236
- */
237
- neutral?: JSAvatarTokens;
238
- brand?: JSAvatarTokens;
239
- darkRed?: JSAvatarTokens;
240
- cranberry?: JSAvatarTokens;
241
- red?: JSAvatarTokens;
242
- pumpkin?: JSAvatarTokens;
243
- peach?: JSAvatarTokens;
244
- marigold?: JSAvatarTokens;
245
- gold?: JSAvatarTokens;
246
- brass?: JSAvatarTokens;
247
- brown?: JSAvatarTokens;
248
- forest?: JSAvatarTokens;
249
- seafoam?: JSAvatarTokens;
250
- darkGreen?: JSAvatarTokens;
251
- lightTeal?: JSAvatarTokens;
252
- teal?: JSAvatarTokens;
253
- steel?: JSAvatarTokens;
254
- blue?: JSAvatarTokens;
255
- royalBlue?: JSAvatarTokens;
256
- cornflower?: JSAvatarTokens;
257
- navy?: JSAvatarTokens;
258
- lavender?: JSAvatarTokens;
259
- purple?: JSAvatarTokens;
260
- grape?: JSAvatarTokens;
261
- lilac?: JSAvatarTokens;
262
- pink?: JSAvatarTokens;
263
- magenta?: JSAvatarTokens;
264
- plum?: JSAvatarTokens;
265
- beige?: JSAvatarTokens;
266
- mink?: JSAvatarTokens;
267
- platinum?: JSAvatarTokens;
268
- anchor?: JSAvatarTokens;
269
- }
270
- ```
271
-
272
- ## Behaviors
273
-
274
- ### States
275
-
276
- The following section describes the different states which `Avatar` can be in as a result of interaction.
277
-
278
- #### showRing state
279
-
280
- Ring is shown when `showRing` is set to true
281
-
282
- #### transparentRing state
283
-
284
- Makes ring transparent
285
-
286
- #### showBadge state
287
-
288
- showBadge is set to true when `active` prop is `unset` or undefined
289
-
290
- ### Interaction
291
-
292
- For now Avatar doesn't support interactions.
293
- For the next step we will need to add tooltip and onClick handler.
294
-
295
- ## Accessibility
package/jest.config.js DELETED
@@ -1,2 +0,0 @@
1
- const { configureReactNativeJest } = require('@fluentui-react-native/scripts');
2
- module.exports = configureReactNativeJest('android');
@@ -1 +0,0 @@
1
- {"version":3,"file":"Avatar.d.ts","sourceRoot":"","sources":["../src/Avatar.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAiB,SAAS,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAOpF,oBAAY,IAAI,GAAG,QAAQ,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,GAAG,QAAQ,GAAG,SAAS,CAAC;AAElF,oBAAY,WAAW,GAAG,SAAS,GAAG,QAAQ,GAAG,OAAO,GAA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atarProps, JSAvatarState, AvatarSlotProps } from './JSAvatar.types';
2
- /**
3
- * A function which determines if a set of styles should be applied to the compoent given the current state and props of the avatar.
4
- *
5
- * @param layer The name of the state that is being checked for
6
- * @param state The current state of the avatar
7
- * @param userProps The props that were passed into the avatar
8
- * @returns Whether the styles that are assigned to the layer should be applied to the avatar
9
- */
10
- export declare const avatarLookup: (layer: string, state: JSAvatarState, userProps: JSAvatarProps) => boolean;
11
- export declare const JSAvatar: import("@fluentui-react-native/framework").ComposableComponent<JSAvatarProps, AvatarSlotProps, import("./JSAvatar.types").JSAvatarTokens, object>;
12
- //# sourceMappingURL=JSAvatar.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"JSAvatar.d.ts","sourceRoot":"","sources":["../src/JSAvatar.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAA8B,aAAa,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAS7G;;;;;;;GAOG;AACH,eAAO,MAAM,YAAY,UAAW,MAAM,SAAS,aAAa,aAAa,aAAa,KAAG,OAY5F,CAAC;AAEF,eAAO,MAAM,QAAQ,mJA8BnB,CAAC"}
package/lib/JSAvatar.js DELETED
@@ -1,84 +0,0 @@
1
- var __assign = (this && this.__assign) || function () {
2
- __assign = Object.assign || function(t) {
3
- for (var s, i = 1, n = arguments.length; i < n; i++) {
4
- s = arguments[i];
5
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
- t[p] = s[p];
7
- }
8
- return t;
9
- };
10
- return __assign.apply(this, arguments);
11
- };
12
- var __rest = (this && this.__rest) || function (s, e) {
13
- var t = {};
14
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
15
- t[p] = s[p];
16
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
17
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
18
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
19
- t[p[i]] = s[p[i]];
20
- }
21
- return t;
22
- };
23
- /** @jsx withSlots */
24
- import { Image, View, Text, Platform } from 'react-native';
25
- import { Fragment } from 'react';
26
- import { JSAvatarName } from './JSAvatar.types';
27
- import { stylingSettings } from './JSAvatar.styling';
28
- import { compose, mergeProps, withSlots } from '@fluentui-react-native/framework';
29
- import { useAvatar } from './useAvatar';
30
- import { PresenceBadge } from '@fluentui-react-native/badge';
31
- import { Icon } from '@fluentui-react-native/icon';
32
- import { Svg, Path } from 'react-native-svg';
33
- /**
34
- * A function which determines if a set of styles should be applied to the compoent given the current state and props of the avatar.
35
- *
36
- * @param layer The name of the state that is being checked for
37
- * @param state The current state of the avatar
38
- * @param userProps The props that were passed into the avatar
39
- * @returns Whether the styles that are assigned to the layer should be applied to the avatar
40
- */
41
- export var avatarLookup = function (layer, state, userProps) {
42
- var size = userProps.size;
43
- var avatarSize = size ? "size".concat(size) : '';
44
- return (state[layer] ||
45
- userProps[layer] ||
46
- layer === userProps['shape'] ||
47
- (!userProps['shape'] && layer === 'circular') ||
48
- layer === userProps['avatarColor'] ||
49
- layer === avatarSize ||
50
- (userProps.active === 'inactive' && layer === 'inactive'));
51
- };
52
- export var JSAvatar = compose(__assign(__assign({ displayName: JSAvatarName }, stylingSettings), { slots: {
53
- root: View,
54
- image: Image,
55
- initials: Text,
56
- initialsBackground: View,
57
- icon: Icon,
58
- ring: View,
59
- badge: PresenceBadge,
60
- }, useRender: function (userProps, useSlots) {
61
- var avatar = useAvatar(userProps);
62
- var Slots = useSlots(avatar.props, function (layer) { return avatarLookup(layer, avatar.state, avatar.props); });
63
- return function (final) {
64
- var _a = avatar.state, showRing = _a.showRing, transparentRing = _a.transparentRing, showBadge = _a.showBadge;
65
- var _b = avatar.props, badge = _b.badge, mergedProps = __rest(_b, ["badge"]);
66
- var svgIconsEnabled = ['ios', 'macos', 'win32', 'android'].includes(Platform.OS);
67
- var RingComponent = showRing && !transparentRing ? Slots.ring : Fragment;
68
- return (withSlots(Slots.root, __assign({}, mergedProps),
69
- withSlots(RingComponent, null, renderAvatar(final, avatar.props, Slots, svgIconsEnabled)),
70
- svgIconsEnabled && showBadge && withSlots(Slots.badge, __assign({}, badge))));
71
- };
72
- } }));
73
- function renderAvatar(final, avatarProps, Slots, svgIconsEnabled) {
74
- var _a = mergeProps(avatarProps, final), icon = _a.icon, initials = _a.initials, imageUrl = _a.imageUrl;
75
- return imageUrl ? (withSlots(Slots.image, { source: { uri: imageUrl } })) : (withSlots(Slots.initialsBackground, { accessible: false }, initials ? (withSlots(Slots.initials, { accessible: false }, initials)) : avatarProps.icon ? (withSlots(Slots.icon, __assign({}, icon, { accessible: false }))) : (svgIconsEnabled && withSlots(Slots.icon, { svgSource: svgProps, accessible: false }))));
76
- }
77
- var fallbackIconSvg = function () {
78
- return (withSlots(Svg, { viewBox: "0 0 14 16" },
79
- withSlots(Path, { fill: "currentColor", 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" })));
80
- };
81
- var svgProps = {
82
- src: fallbackIconSvg,
83
- };
84
- //# sourceMappingURL=JSAvatar.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"JSAvatar.js","sourceRoot":"","s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CACd,CAAC;QACJ,CAAC,CAAC;IACJ,CAAC,IACD,CAAC;AAEH,SAAS,YAAY,CAAC,KAAoB,EAAE,WAA0B,EAAE,KAA6B,EAAE,eAAyB;IACxH,IAAA,KAA+B,UAAU,CAAC,WAAW,EAAE,KAAK,CAAC,EAA3D,IAAI,UAAA,EAAE,QAAQ,cAAA,EAAE,QAAQ,cAAmC,CAAC;IACpE,OAAO,QAAQ,CAAC,CAAC,CAAC,CAChB,UAAC,KAAK,CAAC,KAAK,IAAC,MAAM,EAAE,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAI,CAC3C,CAAC,CAAC,CAAC,CACF,UAAC,KAAK,CAAC,kBAAkB,IAAC,UAAU,EAAE,KAAK,IACxC,QAAQ,CAAC,CAAC,CAAC,CACV,UAAC,KAAK,CAAC,QAAQ,IAAC,UAAU,EAAE,KAAK,IAAG,QAAQ,CAAkB,CAC/D,CAAC,CAAC,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,CACrB,UAAC,KAAK,CAAC,IAAI,eAAK,IAAI,IAAE,UAAU,EAAE,KAAK,IAAI,CAC5C,CAAC,CAAC,CAAC,CACF,eAAe,IAAI,UAAC,KAAK,CAAC,IAAI,IAAC,SAAS,EAAE,QAAQ,EAAE,UAAU,EAAE,KAAK,GAAI,CAC1E,CACwB,CAC5B,CAAC;AACJ,CAAC;AAED,IAAM,eAAe,GAAsC;IACzD,OAAO,CACL,UAAC,GAAG,IAAC,OAAO,EAAC,WAAW;QACtB,UAAC,IAAI,IACH,IAAI,EAAC,cAAc,EACnB,CAAC,EAAC,opBAAopB,GAChpB,CACJ,CACP,CAAC;AACJ,CAAC,CAAC;AACF,IAAM,QAAQ,GAAiB;IAC7B,GAAG,EAAE,eAAe;CACrB,CAAC"}
@@ -1,5 +0,0 @@
1
- import { JSAvatarTokens, AvatarSlotProps, JSAvatarProps } from './JSAvatar.types';
2
- import { UseStylingOptions } from '@fluentui-react-native/framework';
3
- export declare const avatarStates: (keyof JSAvatarTokens)[];
4
- export declare const stylingSettings: UseStylingOptions<JSAvatarProps, AvatarSlotProps, JSAvatarTokens>;
5
- //# sourceMappingURL=JSAvatar.styling.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"JSAvatar.styling.d.ts","sourceRoot":"","sources":["../src/JSAvatar.styling.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,cAAc,EAEd,eAAe,EACf,aAAa,EAMd,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAS,iBAAiB,EAAc,MAAM,kCAAkC,CAAC;AAKxF,eAAO,MAAM,YAAY,EAAE,CAAC,MAAM,cAAc,CAAC,EAWhD,CAAC;AAYF,eAAO,MAAM,eAAe,EAAE,iBAAiB,CAAC,aAAa,EAAE,eAAe,EAAE,cAAc,CAyH7F,CAAC"}