@fluentui/react-avatar 9.0.0-rc.9 → 9.0.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 (91) hide show
  1. package/CHANGELOG.json +544 -1
  2. package/CHANGELOG.md +131 -2
  3. package/MIGRATION-AvatarGroup.md +35 -0
  4. package/README-AvatarGroup.md +39 -0
  5. package/README.md +16 -11
  6. package/SPEC.md +1 -135
  7. package/dist/index.d.ts +90 -27
  8. package/lib/AvatarGroupItem.js +2 -0
  9. package/lib/AvatarGroupItem.js.map +1 -0
  10. package/lib/components/Avatar/Avatar.js.map +1 -1
  11. package/lib/components/Avatar/Avatar.types.js.map +1 -1
  12. package/lib/components/Avatar/renderAvatar.js.map +1 -1
  13. package/lib/components/Avatar/useAvatar.js +4 -7
  14. package/lib/components/Avatar/useAvatar.js.map +1 -1
  15. package/lib/components/Avatar/useAvatarStyles.js +63 -68
  16. package/lib/components/Avatar/useAvatarStyles.js.map +1 -1
  17. package/lib/components/AvatarGroup/AvatarGroup.js +2 -1
  18. package/lib/components/AvatarGroup/AvatarGroup.js.map +1 -1
  19. package/lib/components/AvatarGroup/AvatarGroup.types.js.map +1 -1
  20. package/lib/components/AvatarGroup/renderAvatarGroup.js +32 -4
  21. package/lib/components/AvatarGroup/renderAvatarGroup.js.map +1 -1
  22. package/lib/components/AvatarGroup/useAvatarGroup.js +67 -28
  23. package/lib/components/AvatarGroup/useAvatarGroup.js.map +1 -1
  24. package/lib/components/AvatarGroup/useAvatarGroupStyles.js +280 -15
  25. package/lib/components/AvatarGroup/useAvatarGroupStyles.js.map +1 -1
  26. package/lib/components/AvatarGroupItem/AvatarGroupItem.js +16 -0
  27. package/lib/components/AvatarGroupItem/AvatarGroupItem.js.map +1 -0
  28. package/lib/components/AvatarGroupItem/AvatarGroupItem.types.js +2 -0
  29. package/lib/components/AvatarGroupItem/AvatarGroupItem.types.js.map +1 -0
  30. package/lib/components/AvatarGroupItem/index.js +6 -0
  31. package/lib/components/AvatarGroupItem/index.js.map +1 -0
  32. package/lib/components/AvatarGroupItem/renderAvatarGroupItem.js +17 -0
  33. package/lib/components/AvatarGroupItem/renderAvatarGroupItem.js.map +1 -0
  34. package/lib/components/AvatarGroupItem/useAvatarGroupItem.js +70 -0
  35. package/lib/components/AvatarGroupItem/useAvatarGroupItem.js.map +1 -0
  36. package/lib/components/AvatarGroupItem/useAvatarGroupItemStyles.js +356 -0
  37. package/lib/components/AvatarGroupItem/useAvatarGroupItemStyles.js.map +1 -0
  38. package/lib/contexts/AvatarGroupContext.js +7 -0
  39. package/lib/contexts/AvatarGroupContext.js.map +1 -0
  40. package/lib/contexts/AvatarGroupContext.types.js +2 -0
  41. package/lib/contexts/AvatarGroupContext.types.js.map +1 -0
  42. package/lib/contexts/index.js +2 -0
  43. package/lib/contexts/index.js.map +1 -0
  44. package/lib/index.js +2 -2
  45. package/lib/index.js.map +1 -1
  46. package/lib/utils/getInitials.js +2 -0
  47. package/lib/utils/getInitials.js.map +1 -1
  48. package/lib-commonjs/AvatarGroupItem.js +10 -0
  49. package/lib-commonjs/AvatarGroupItem.js.map +1 -0
  50. package/lib-commonjs/components/Avatar/Avatar.js.map +1 -1
  51. package/lib-commonjs/components/Avatar/renderAvatar.js.map +1 -1
  52. package/lib-commonjs/components/Avatar/useAvatar.js +4 -7
  53. package/lib-commonjs/components/Avatar/useAvatar.js.map +1 -1
  54. package/lib-commonjs/components/Avatar/useAvatarStyles.js +65 -70
  55. package/lib-commonjs/components/Avatar/useAvatarStyles.js.map +1 -1
  56. package/lib-commonjs/components/AvatarGroup/AvatarGroup.js +2 -1
  57. package/lib-commonjs/components/AvatarGroup/AvatarGroup.js.map +1 -1
  58. package/lib-commonjs/components/AvatarGroup/renderAvatarGroup.js +35 -4
  59. package/lib-commonjs/components/AvatarGroup/renderAvatarGroup.js.map +1 -1
  60. package/lib-commonjs/components/AvatarGroup/useAvatarGroup.js +70 -31
  61. package/lib-commonjs/components/AvatarGroup/useAvatarGroup.js.map +1 -1
  62. package/lib-commonjs/components/AvatarGroup/useAvatarGroupStyles.js +284 -15
  63. package/lib-commonjs/components/AvatarGroup/useAvatarGroupStyles.js.map +1 -1
  64. package/lib-commonjs/components/AvatarGroupItem/AvatarGroupItem.js +27 -0
  65. package/lib-commonjs/components/AvatarGroupItem/AvatarGroupItem.js.map +1 -0
  66. package/lib-commonjs/components/AvatarGroupItem/AvatarGroupItem.types.js +6 -0
  67. package/lib-commonjs/components/AvatarGroupItem/AvatarGroupItem.types.js.map +1 -0
  68. package/lib-commonjs/components/AvatarGroupItem/index.js +18 -0
  69. package/lib-commonjs/components/AvatarGroupItem/index.js.map +1 -0
  70. package/lib-commonjs/components/AvatarGroupItem/renderAvatarGroupItem.js +28 -0
  71. package/lib-commonjs/components/AvatarGroupItem/renderAvatarGroupItem.js.map +1 -0
  72. package/lib-commonjs/components/AvatarGroupItem/useAvatarGroupItem.js +84 -0
  73. package/lib-commonjs/components/AvatarGroupItem/useAvatarGroupItem.js.map +1 -0
  74. package/lib-commonjs/components/AvatarGroupItem/useAvatarGroupItemStyles.js +370 -0
  75. package/lib-commonjs/components/AvatarGroupItem/useAvatarGroupItemStyles.js.map +1 -0
  76. package/lib-commonjs/contexts/AvatarGroupContext.js +15 -0
  77. package/lib-commonjs/contexts/AvatarGroupContext.js.map +1 -0
  78. package/lib-commonjs/contexts/AvatarGroupContext.types.js +6 -0
  79. package/lib-commonjs/contexts/AvatarGroupContext.types.js.map +1 -0
  80. package/lib-commonjs/contexts/index.js +10 -0
  81. package/lib-commonjs/contexts/index.js.map +1 -0
  82. package/lib-commonjs/index.js +34 -8
  83. package/lib-commonjs/index.js.map +1 -1
  84. package/lib-commonjs/utils/getInitials.js +2 -0
  85. package/lib-commonjs/utils/getInitials.js.map +1 -1
  86. package/lib-commonjs/utils/index.js.map +1 -1
  87. package/package.json +16 -16
  88. package/lib/components/AvatarGroup/AvatarGroup.strings.js +0 -4
  89. package/lib/components/AvatarGroup/AvatarGroup.strings.js.map +0 -1
  90. package/lib-commonjs/components/AvatarGroup/AvatarGroup.strings.js +0 -10
  91. package/lib-commonjs/components/AvatarGroup/AvatarGroup.strings.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,12 +1,141 @@
1
1
  # Change Log - @fluentui/react-avatar
2
2
 
3
- This log was last generated on Mon, 23 May 2022 12:10:26 GMT and should not be manually modified.
3
+ This log was last generated on Thu, 14 Jul 2022 17:03:22 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## [9.0.2](https://github.com/microsoft/fluentui/tree/@fluentui/react-avatar_v9.0.2)
8
+
9
+ Thu, 14 Jul 2022 17:03:22 GMT
10
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-avatar_v9.0.1..@fluentui/react-avatar_v9.0.2)
11
+
12
+ ### Patches
13
+
14
+ - chore: Update @fluentui/react-icons dependency to v2.0.175 ([PR #23812](https://github.com/microsoft/fluentui/pull/23812) by ololubek@microsoft.com)
15
+ - fix: Remove override of role=list in AvatarGroup's PopoverSurface and fix trapFocus when Popover is triggered. ([PR #23823](https://github.com/microsoft/fluentui/pull/23823) by esteban.230@hotmail.com)
16
+ - fix: Fixing focus indicator for pie layouts. ([PR #23860](https://github.com/microsoft/fluentui/pull/23860) by esteban.230@hotmail.com)
17
+ - Bump @fluentui/react-badge to v9.0.2 ([PR #23909](https://github.com/microsoft/fluentui/pull/23909) by beachball)
18
+ - Bump @fluentui/react-context-selector to v9.0.1 ([PR #23909](https://github.com/microsoft/fluentui/pull/23909) by beachball)
19
+ - Bump @fluentui/react-popover to v9.0.2 ([PR #23909](https://github.com/microsoft/fluentui/pull/23909) by beachball)
20
+ - Bump @fluentui/react-tabster to v9.0.2 ([PR #23909](https://github.com/microsoft/fluentui/pull/23909) by beachball)
21
+ - Bump @fluentui/react-tooltip to v9.0.2 ([PR #23909](https://github.com/microsoft/fluentui/pull/23909) by beachball)
22
+ - Bump @fluentui/react-utilities to v9.0.1-0 ([PR #23909](https://github.com/microsoft/fluentui/pull/23909) by beachball)
23
+ - Bump @fluentui/react-conformance-griffel to v9.0.0-beta.11 ([PR #23909](https://github.com/microsoft/fluentui/pull/23909) by beachball)
24
+
25
+ ## [9.0.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-avatar_v9.0.1)
26
+
27
+ Tue, 28 Jun 2022 17:39:46 GMT
28
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-avatar_v9.0.0..@fluentui/react-avatar_v9.0.1)
29
+
30
+ ### Patches
31
+
32
+ - fix: Use caret dependency range for Griffel ([PR #23754](https://github.com/microsoft/fluentui/pull/23754) by lingfangao@hotmail.com)
33
+ - Bump @fluentui/react-badge to v9.0.1 ([PR #23754](https://github.com/microsoft/fluentui/pull/23754) by beachball)
34
+ - Bump @fluentui/react-popover to v9.0.1 ([PR #23754](https://github.com/microsoft/fluentui/pull/23754) by beachball)
35
+ - Bump @fluentui/react-tabster to v9.0.1 ([PR #23754](https://github.com/microsoft/fluentui/pull/23754) by beachball)
36
+ - Bump @fluentui/react-tooltip to v9.0.1 ([PR #23754](https://github.com/microsoft/fluentui/pull/23754) by beachball)
37
+ - Bump @fluentui/react-conformance-griffel to v9.0.0-beta.10 ([PR #23754](https://github.com/microsoft/fluentui/pull/23754) by beachball)
38
+
39
+ ## [9.0.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-avatar_v9.0.0)
40
+
41
+ Tue, 28 Jun 2022 15:14:14 GMT
42
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-avatar_v9.0.0-rc.13..@fluentui/react-avatar_v9.0.0)
43
+
44
+ ### Patches
45
+
46
+ - feat: Initial 9.0.0 release ([PR #23733](https://github.com/microsoft/fluentui/pull/23733) by lingfangao@hotmail.com)
47
+ - Bump @fluentui/react-badge to v9.0.0 ([commit](https://github.com/microsoft/fluentui/commit/ba6c5d651559b91c815429c9a9357c4d5a390f3e) by beachball)
48
+ - Bump @fluentui/react-context-selector to v9.0.0 ([commit](https://github.com/microsoft/fluentui/commit/ba6c5d651559b91c815429c9a9357c4d5a390f3e) by beachball)
49
+ - Bump @fluentui/react-popover to v9.0.0 ([commit](https://github.com/microsoft/fluentui/commit/ba6c5d651559b91c815429c9a9357c4d5a390f3e) by beachball)
50
+ - Bump @fluentui/react-shared-contexts to v9.0.0 ([commit](https://github.com/microsoft/fluentui/commit/ba6c5d651559b91c815429c9a9357c4d5a390f3e) by beachball)
51
+ - Bump @fluentui/react-tabster to v9.0.0 ([commit](https://github.com/microsoft/fluentui/commit/ba6c5d651559b91c815429c9a9357c4d5a390f3e) by beachball)
52
+ - Bump @fluentui/react-theme to v9.0.0 ([commit](https://github.com/microsoft/fluentui/commit/ba6c5d651559b91c815429c9a9357c4d5a390f3e) by beachball)
53
+ - Bump @fluentui/react-tooltip to v9.0.0 ([commit](https://github.com/microsoft/fluentui/commit/ba6c5d651559b91c815429c9a9357c4d5a390f3e) by beachball)
54
+ - Bump @fluentui/react-utilities to v9.0.0 ([commit](https://github.com/microsoft/fluentui/commit/ba6c5d651559b91c815429c9a9357c4d5a390f3e) by beachball)
55
+ - Bump @fluentui/react-conformance-griffel to v9.0.0-beta.9 ([commit](https://github.com/microsoft/fluentui/commit/ba6c5d651559b91c815429c9a9357c4d5a390f3e) by beachball)
56
+
57
+ ### Changes
58
+
59
+ - fix: Fix wrong border radius for outline in webkit browsers. ([PR #23576](https://github.com/microsoft/fluentui/pull/23576) by esteban.230@hotmail.com)
60
+ - Adding AvatarGroupItem implementation and AvatarGroup context. ([PR #23310](https://github.com/microsoft/fluentui/pull/23310) by esteban.230@hotmail.com)
61
+ - chore: Using ::before and ::after instead of :before and :after. ([PR #23469](https://github.com/microsoft/fluentui/pull/23469) by Humberto.Morimoto@microsoft.com)
62
+ - chore: Update @fluentui/react-icons to latest version ([PR #23459](https://github.com/microsoft/fluentui/pull/23459) by olfedias@microsoft.com)
63
+ - docs: Adding AvatarGroup stories. ([PR #23493](https://github.com/microsoft/fluentui/pull/23493) by esteban.230@hotmail.com)
64
+ - Bump Griffel dependencies ([PR #23688](https://github.com/microsoft/fluentui/pull/23688) by lingfangao@hotmail.com)
65
+ - PresenceBadge accessibility: fix placement of aria-label, sort out Avatar usage and examples ([PR #23256](https://github.com/microsoft/fluentui/pull/23256) by sarah.higley@microsoft.com)
66
+ - Adding layout styles to AvatarGroupItem. ([PR #23468](https://github.com/microsoft/fluentui/pull/23468) by esteban.230@hotmail.com)
67
+ - chore: Adding scheduler as a peer dependency since this package has a dependency on @fluentui/react-context-selector. ([PR #23681](https://github.com/microsoft/fluentui/pull/23681) by Humberto.Morimoto@microsoft.com)
68
+ - Adding layout styles and overflow button styles to AvatarGroup. ([PR #23437](https://github.com/microsoft/fluentui/pull/23437) by esteban.230@hotmail.com)
69
+ - fix: Fixing focus indicator and adding a focus ring to root for the pie layout. ([PR #23528](https://github.com/microsoft/fluentui/pull/23528) by esteban.230@hotmail.com)
70
+ - Update 9.0.0-rc dependencies to use caret range ([PR #23732](https://github.com/microsoft/fluentui/pull/23732) by lingfangao@hotmail.com)
71
+ - chore: Added warning for AvatarGroup to check if children are of type AvatarGroupItem and for AvatarGroupItem to check if it's being used inside an AvatarGroup. ([PR #23498](https://github.com/microsoft/fluentui/pull/23498) by esteban.230@hotmail.com)
72
+
73
+ ## [9.0.0-rc.13](https://github.com/microsoft/fluentui/tree/@fluentui/react-avatar_v9.0.0-rc.13)
74
+
75
+ Thu, 23 Jun 2022 14:25:31 GMT
76
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-avatar_v9.0.0-rc.12..@fluentui/react-avatar_v9.0.0-rc.13)
77
+
78
+ ### Changes
79
+
80
+ - Bump @fluentui/react-badge to v9.0.0-rc.13 ([PR #23608](https://github.com/microsoft/fluentui/pull/23608) by beachball)
81
+ - Bump @fluentui/react-button to v9.0.0-rc.14 ([PR #23608](https://github.com/microsoft/fluentui/pull/23608) by beachball)
82
+ - Bump @fluentui/react-popover to v9.0.0-rc.14 ([PR #23608](https://github.com/microsoft/fluentui/pull/23608) by beachball)
83
+ - Bump @fluentui/react-tooltip to v9.0.0-rc.14 ([PR #23608](https://github.com/microsoft/fluentui/pull/23608) by beachball)
84
+ - Bump @fluentui/react-theme to v9.0.0-rc.10 ([PR #23608](https://github.com/microsoft/fluentui/pull/23608) by beachball)
85
+ - Bump @fluentui/react-shared-contexts to v9.0.0-rc.11 ([PR #23608](https://github.com/microsoft/fluentui/pull/23608) by beachball)
86
+
87
+ ## [9.0.0-rc.12](https://github.com/microsoft/fluentui/tree/@fluentui/react-avatar_v9.0.0-rc.12)
88
+
89
+ Tue, 31 May 2022 21:28:35 GMT
90
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-avatar_v9.0.0-rc.11..@fluentui/react-avatar_v9.0.0-rc.12)
91
+
92
+ ### Changes
93
+
94
+ - chore: Update Griffel to latest version ([PR #23275](https://github.com/microsoft/fluentui/pull/23275) by olfedias@microsoft.com)
95
+ - updates import to react-shared-components ([PR #23325](https://github.com/microsoft/fluentui/pull/23325) by bernardo.sunderhus@gmail.com)
96
+ - Creating AvatarGroupItem component. ([PR #23287](https://github.com/microsoft/fluentui/pull/23287) by esteban.230@hotmail.com)
97
+ - Adding .beta to AvatarGroup stories so it's not shown in the docsite. ([PR #23216](https://github.com/microsoft/fluentui/pull/23216) by esteban.230@hotmail.com)
98
+ - Bump @fluentui/react-badge to v9.0.0-rc.12 ([PR #23325](https://github.com/microsoft/fluentui/pull/23325) by beachball)
99
+ - Bump @fluentui/react-button to v9.0.0-rc.13 ([PR #23325](https://github.com/microsoft/fluentui/pull/23325) by beachball)
100
+ - Bump @fluentui/react-popover to v9.0.0-rc.13 ([PR #23325](https://github.com/microsoft/fluentui/pull/23325) by beachball)
101
+ - Bump @fluentui/react-tooltip to v9.0.0-rc.13 ([PR #23325](https://github.com/microsoft/fluentui/pull/23325) by beachball)
102
+ - Bump @fluentui/react-shared-contexts to v9.0.0-rc.10 ([PR #23325](https://github.com/microsoft/fluentui/pull/23325) by beachball)
103
+ - Bump @fluentui/react-utilities to v9.0.0-rc.10 ([PR #23325](https://github.com/microsoft/fluentui/pull/23325) by beachball)
104
+ - Bump @fluentui/react-conformance-griffel to v9.0.0-beta.8 ([PR #23325](https://github.com/microsoft/fluentui/pull/23325) by beachball)
105
+
106
+ ## [9.0.0-rc.11](https://github.com/microsoft/fluentui/tree/@fluentui/react-avatar_v9.0.0-rc.11)
107
+
108
+ Thu, 26 May 2022 21:01:22 GMT
109
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-avatar_v9.0.0-rc.10..@fluentui/react-avatar_v9.0.0-rc.11)
110
+
111
+ ### Changes
112
+
113
+ - fix react-avatar: use initials as a fallback label even when no id is manually defined ([PR #23258](https://github.com/microsoft/fluentui/pull/23258) by sarah.higley@microsoft.com)
114
+ - Bump @fluentui/react-badge to v9.0.0-rc.11 ([PR #23267](https://github.com/microsoft/fluentui/pull/23267) by beachball)
115
+ - Bump @fluentui/react-button to v9.0.0-rc.12 ([PR #23267](https://github.com/microsoft/fluentui/pull/23267) by beachball)
116
+ - Bump @fluentui/react-popover to v9.0.0-rc.12 ([PR #23267](https://github.com/microsoft/fluentui/pull/23267) by beachball)
117
+ - Bump @fluentui/react-tooltip to v9.0.0-rc.12 ([PR #23267](https://github.com/microsoft/fluentui/pull/23267) by beachball)
118
+
119
+ ## [9.0.0-rc.10](https://github.com/microsoft/fluentui/tree/@fluentui/react-avatar_v9.0.0-rc.10)
120
+
121
+ Mon, 23 May 2022 18:56:40 GMT
122
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-avatar_v9.0.0-rc.9..@fluentui/react-avatar_v9.0.0-rc.10)
123
+
124
+ ### Changes
125
+
126
+ - BREAKING: update string unions to use spinal-case ([PR #23092](https://github.com/microsoft/fluentui/pull/23092) by seanmonahan@microsoft.com)
127
+ - Removing <componentName>ClassName exports. ([PR #23092](https://github.com/microsoft/fluentui/pull/23092) by esteban.230@hotmail.com)
128
+ - Bump @fluentui/react-badge to v9.0.0-rc.10 ([PR #23146](https://github.com/microsoft/fluentui/pull/23146) by beachball)
129
+ - Bump @fluentui/react-button to v9.0.0-rc.11 ([PR #23146](https://github.com/microsoft/fluentui/pull/23146) by beachball)
130
+ - Bump @fluentui/react-popover to v9.0.0-rc.11 ([PR #23146](https://github.com/microsoft/fluentui/pull/23146) by beachball)
131
+ - Bump @fluentui/react-tooltip to v9.0.0-rc.11 ([PR #23146](https://github.com/microsoft/fluentui/pull/23146) by beachball)
132
+ - Bump @fluentui/react-theme to v9.0.0-rc.9 ([PR #23146](https://github.com/microsoft/fluentui/pull/23146) by beachball)
133
+ - Bump @fluentui/react-shared-contexts to v9.0.0-rc.9 ([PR #23146](https://github.com/microsoft/fluentui/pull/23146) by beachball)
134
+ - Bump @fluentui/react-conformance-griffel to v9.0.0-beta.7 ([PR #23146](https://github.com/microsoft/fluentui/pull/23146) by beachball)
135
+
7
136
  ## [9.0.0-rc.9](https://github.com/microsoft/fluentui/tree/@fluentui/react-avatar_v9.0.0-rc.9)
8
137
 
9
- Mon, 23 May 2022 12:10:26 GMT
138
+ Mon, 23 May 2022 12:14:00 GMT
10
139
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-avatar_v9.0.0-rc.8..@fluentui/react-avatar_v9.0.0-rc.9)
11
140
 
12
141
  ### Changes
@@ -0,0 +1,35 @@
1
+ # AvatarGroup Migration
2
+
3
+ ## Migration from v0
4
+
5
+ `v0` does not have a component similar to `AvatarGroup`.
6
+
7
+ ## Migration from v8
8
+
9
+ AvatarGroup and Facepile have similar APIs, but the main difference is how they interact with AvatarGroupItem/Persona. AvatarGroup receives AvatarGroupItems as children and places them in their respective place, this means AvatarGroup has no control over AvatarGroupItem. `size` is the only property of AvatarGroupItem that is modified by AvatarGroup to make all AvatarGroupItems the same size. Face adding functionality is not supported.
10
+
11
+ Avatars must not be used inside an AvatarGroup, instead AvatarGroupItems are used since it has extra functionality used only in AvatarGroups. This includes adding a label when the AvatarGroupItem is rendered in the overflow Popover and specific styling for each layout.
12
+
13
+ AvatarGroup has extra functionality that Facepile does not have, this includes:
14
+ - When the AvatarGroupItems are overflowing, a Popover is rendered that contains all the overflowed AvatarGroupItems. The Popover is triggered when the overflow button is clicked.
15
+ - AvatarGroup supports three layouts: `spread` (default), `stack`, and `pie`.
16
+
17
+ ## Property mapping
18
+
19
+ | v8 `Facepile` | v9 `AvatarGroup` |
20
+ | ------------------------ | -------------------------------------------------------- |
21
+ | `personas` | `children` |
22
+ | `addButtonProps` | - |
23
+ | `className` | `className` |
24
+ | `getPersonaProps` | `AvatarGroupItem`'s props |
25
+ | `maxDisplayablePersonas` | `maxAvatars` |
26
+ | `onRenderPersona` | Render function for the AvatarGroupItem |
27
+ | `onRenderPersonaCoin` | Render function for the `avatar` slot in AvatarGroupItem |
28
+ | `onRenderPersonaWrapper` | - |
29
+ | `overflowButtonProps` | `overflowButton` slot props |
30
+ | `overflowButtonType` | `overflowIndicator` |
31
+ | `overflowPersonas` | - |
32
+ | `personaSize` | `size` |
33
+ | `showAddButton` | - |
34
+ | `showTooltip` | - |
35
+ | `styles` | (theme) |
@@ -0,0 +1,39 @@
1
+ # @fluentui/react-avatar
2
+
3
+ **React AvatarGroup component for [Fluent UI](https://dev.microsoft.com/fluentui)**
4
+
5
+ The AvatarGroup component represents a group of multiple people or entities by taking care of the arrangement of individual Avatars in a spread, stack, or pie layout.
6
+
7
+ ## STATUS: WIP 🚧
8
+
9
+ These are not production-ready components and **should never be used in product**. This space is useful for testing new components whose APIs might change before final release.
10
+
11
+ ## Usage
12
+
13
+ To import AvatarGroup and AvatarGroupItem:
14
+
15
+ ```js
16
+ import { AvatarGroup, AvatarGroupItem } from '@fluentui/react-avatar';
17
+ ```
18
+
19
+ Once the AvatarGroup component graduates to a production release, the component will be available at:
20
+
21
+ ```js
22
+ import { AvatarGroup, AvatarGroupItem } from '@fluentui/react-components';
23
+ ```
24
+
25
+ ### Examples
26
+
27
+ ```jsx
28
+ <AvatarGroup>
29
+ <AvatarGroupItem name="Katri Athokas" />
30
+ <AvatarGroupItem name="Elvia Atkins" />
31
+ <AvatarGroupItem name="Cameron Evans" />
32
+ <AvatarGroupItem name="Wanda Howard" />
33
+ <AvatarGroupItem name="Mona Kane" />
34
+ <AvatarGroupItem name="Allan Munger" />
35
+ <AvatarGroupItem name="Daisy Phillips" />
36
+ <AvatarGroupItem name="Robert Tolbert" />
37
+ <AvatarGroupItem name="Kevin Sturgis" />
38
+ </AvatarGroup>
39
+ ```
package/README.md CHANGED
@@ -1,23 +1,13 @@
1
1
  # @fluentui/react-avatar
2
2
 
3
- **React Avatar components for [Fluent UI](https://dev.microsoft.com/fluentui)**
3
+ **React Avatar components for [Fluent UI](https://react.fluentui.dev/)**
4
4
 
5
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
6
 
7
- ## STATUS: WIP 🚧
8
-
9
- These are not production-ready components and **should never be used in product**. This space is useful for testing new components whose APIs might change before final release.
10
-
11
7
  ## Usage
12
8
 
13
9
  To import Avatar:
14
10
 
15
- ```js
16
- import { Avatar } from '@fluentui/react-avatar';
17
- ```
18
-
19
- Once the Avatar component graduates to a production release, the component will be available at:
20
-
21
11
  ```js
22
12
  import { Avatar } from '@fluentui/react-components';
23
13
  ```
@@ -42,3 +32,18 @@ With active state indication:
42
32
  <Avatar name="Daisy Phillips" active={true} activeAppearance="ring-shadow" />
43
33
  <Avatar name="Robin Counts" active={false} activeAppearance="ring-shadow" />
44
34
  ```
35
+
36
+ See [Fluent UI Storybook](https://react.fluentui.dev/) for more detailed usage examples.
37
+
38
+ Alternatively, run Storybook locally with:
39
+
40
+ 1. `yarn start`
41
+ 2. Select `react-avatar` from the list.
42
+
43
+ ### Specification
44
+
45
+ See [SPEC.md](./SPEC.md).
46
+
47
+ ### Migration Guide
48
+
49
+ If you're upgrading to Fluent UI v9 see [MIGRATION.md](./MIGRATION.md) for guidance on updating to the latest Avatar implementation.
package/SPEC.md CHANGED
@@ -95,141 +95,7 @@ From [Avatar.types.tsx](https://github.com/microsoft/fluentui/blob/master/packag
95
95
 
96
96
  ### Props
97
97
 
98
- ```ts
99
- export type AvatarSlots = {
100
- root: Slot<'span'>;
101
-
102
- /**
103
- * The Avatar's image.
104
- *
105
- * Usage e.g.: `image={{ src: '...' }}`
106
- */
107
- image?: Slot<'img'>;
108
-
109
- /**
110
- * (optional) Custom initials.
111
- *
112
- * It is usually not necessary to specify custom initials; by default they will be derived from the `name` prop,
113
- * using the `getInitials` function.
114
- *
115
- * The initials are displayed when there is no image (including while the image is loading).
116
- */
117
- initials?: Slot<'span'>;
118
-
119
- /**
120
- * Icon to be displayed when the avatar doesn't have an image or initials.
121
- *
122
- * @defaultvalue `PersonRegular` (the default icon's size depends on the Avatar's size)
123
- */
124
- icon?: Slot<'span'>;
125
-
126
- /**
127
- * Badge to show the avatar's presence status.
128
- */
129
- badge?: Slot<typeof PresenceBadge>;
130
- };
131
-
132
- export type AvatarProps = Omit<ComponentProps<AvatarSlots>, 'color'> & {
133
- /**
134
- * The name of the person or entity represented by this Avatar. This should always be provided if it is available.
135
- *
136
- * The name will be used to determine the initials displayed when there is no icon, as well as provided to
137
- * accessibility tools.
138
- */
139
- name?: string;
140
-
141
- /**
142
- * Size of the avatar in pixels.
143
- *
144
- * Size is restricted to a limited set of supported values recommended for most uses (see `AvatarSizeValue`) and
145
- * based on design guidelines for the Avatar control.
146
- *
147
- * If a non-supported size is neeeded, set `size` to the next-smaller supported size, and set `width` and `height`
148
- * to override the rendered size.
149
- *
150
- * For example, to set the avatar to 45px in size:
151
- * `<Avatar size={40} style={{ width: '45px', height: '45px' }} />`
152
- *
153
- * @defaultvalue 32
154
- */
155
- size?: 20 | 24 | 28 | 32 | 36 | 40 | 48 | 56 | 64 | 72 | 96 | 120 | 128;
156
-
157
- /**
158
- * The avatar can have a circular or square shape.
159
- * @defaultvalue circular
160
- */
161
- shape?: 'circular' | 'square';
162
-
163
- /**
164
- * Optional activity indicator
165
- * * active: the avatar will be decorated according to activeAppearance
166
- * * inactive: the avatar will be reduced in size and partially transparent
167
- * * unset: normal display
168
- *
169
- * @defaultvalue unset
170
- */
171
- active?: 'active' | 'inactive' | 'unset';
172
-
173
- /**
174
- * The appearance when `active="active"`
175
- *
176
- * @defaultvalue ring
177
- */
178
- activeAppearance?: 'ring' | 'shadow' | 'ring-shadow';
179
-
180
- /**
181
- * The color when displaying either an icon or initials.
182
- * * neutral (default): gray
183
- * * brand: color from the brand palette
184
- * * colorful: picks a color from a set of pre-defined colors, based on a hash of the name (or idForColor if provided)
185
- * * [AvatarNamedColor]: a specific color from the theme
186
- *
187
- * @defaultvalue neutral
188
- */
189
- color?: 'neutral' | 'brand' | 'colorful' | AvatarNamedColor;
190
-
191
- /**
192
- * Specify a string to be used instead of the name, to determine which color to use when color="colorful".
193
- * Use this when a name is not available, but there is another unique identifier that can be used instead.
194
- */
195
- idForColor?: string | undefined;
196
- };
197
-
198
- /**
199
- * A specific named color for the Avatar
200
- */
201
- export type AvatarNamedColor =
202
- | 'darkRed'
203
- | 'cranberry'
204
- | 'red'
205
- | 'pumpkin'
206
- | 'peach'
207
- | 'marigold'
208
- | 'gold'
209
- | 'brass'
210
- | 'brown'
211
- | 'forest'
212
- | 'seafoam'
213
- | 'darkGreen'
214
- | 'lightTeal'
215
- | 'teal'
216
- | 'steel'
217
- | 'blue'
218
- | 'royalBlue'
219
- | 'cornflower'
220
- | 'navy'
221
- | 'lavender'
222
- | 'purple'
223
- | 'grape'
224
- | 'lilac'
225
- | 'pink'
226
- | 'magenta'
227
- | 'plum'
228
- | 'beige'
229
- | 'mink'
230
- | 'platinum'
231
- | 'anchor';
232
- ```
98
+ See API at [Avatar.types.ts](./src/components/Avatar/Avatar.types.ts).
233
99
 
234
100
  ## Structure
235
101
 
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
- import { Button } from '@fluentui/react-button';
1
+ /// <reference types="react" />
2
+
2
3
  import type { ComponentProps } from '@fluentui/react-utilities';
3
4
  import type { ComponentState } from '@fluentui/react-utilities';
4
5
  import type { ForwardRefComponent } from '@fluentui/react-utilities';
@@ -11,20 +12,57 @@ import { TooltipProps } from '@fluentui/react-tooltip';
11
12
 
12
13
  export declare const Avatar: ForwardRefComponent<AvatarProps>;
13
14
 
14
- /**
15
- * @deprecated Use `avatarClassNames.root` instead.
16
- */
17
- export declare const avatarClassName = "fui-Avatar";
18
-
19
15
  export declare const avatarClassNames: SlotClassNames<AvatarSlots>;
20
16
 
21
17
  /**
22
- * AvatarGroup component - TODO: add more docs
18
+ * The AvatarGroup component represents a group of multiple people or entities by taking care of the arrangement
19
+ * of individual Avatars in a spread, stack, or pie layout.
23
20
  */
24
21
  export declare const AvatarGroup: ForwardRefComponent<AvatarGroupProps>;
25
22
 
26
23
  export declare const avatarGroupClassNames: SlotClassNames<AvatarGroupSlots>;
27
24
 
25
+ /**
26
+ * The AvatarGroupItem component represents a single person or entity.
27
+ * AvatarGroupItem should only be used in an AvatarGroup component.
28
+ */
29
+ export declare const AvatarGroupItem: ForwardRefComponent<AvatarGroupItemProps>;
30
+
31
+ export declare const avatarGroupItemClassNames: SlotClassNames<AvatarGroupItemSlots>;
32
+
33
+ /**
34
+ * AvatarGroupItem Props
35
+ */
36
+ export declare type AvatarGroupItemProps = Omit<ComponentProps<Partial<AvatarGroupItemSlots>, 'avatar'>, 'size' | 'shape'>;
37
+
38
+ export declare type AvatarGroupItemSlots = {
39
+ root: NonNullable<Slot<'div'>>;
40
+ /**
41
+ * Avatar that represents a person or entity.
42
+ */
43
+ avatar: NonNullable<Slot<typeof Avatar>>;
44
+ /**
45
+ * Label used for the name of the AvatarGroupItem when rendered as an overflow item.
46
+ * The content of the label, by default, is the `name` prop from the `avatar` slot.
47
+ */
48
+ overflowLabel: NonNullable<Slot<'span'>>;
49
+ };
50
+
51
+ /**
52
+ * State used in rendering AvatarGroupItem
53
+ */
54
+ export declare type AvatarGroupItemState = ComponentState<AvatarGroupItemSlots> & {
55
+ /**
56
+ * Whether the Avatar is an overflow item.
57
+ *
58
+ * @default false
59
+ */
60
+ isOverflowItem?: boolean;
61
+ nonOverflowAvatarsCount: number;
62
+ layout: AvatarGroupProps['layout'];
63
+ size: AvatarSizes;
64
+ };
65
+
28
66
  /**
29
67
  * AvatarGroup Props
30
68
  */
@@ -36,57 +74,59 @@ export declare type AvatarGroupProps = ComponentProps<AvatarGroupSlots> & {
36
74
  layout?: 'spread' | 'stack' | 'pie';
37
75
  /**
38
76
  * Maximum number of Avatars to be displayed before overflowing.
39
- * NOTE: if pie layout is used, `maxAvatars` will be ignored.
77
+ * Note: if pie layout is used, `maxAvatars` will be ignored.
40
78
  * @default 5
41
79
  */
42
80
  maxAvatars?: number;
43
81
  /**
44
82
  * Whether the overflow indicator should render an icon instead of the number of overflowed avatars.
45
- * @default false
83
+ * Note: The overflowIndicator will default to `icon` when the size is less than 24.
84
+ * @default count
46
85
  */
47
- overflowIndicator?: 'number-overflowed' | 'icon';
86
+ overflowIndicator?: 'count' | 'icon';
48
87
  /**
49
88
  * Size of the avatars.
50
89
  * @default 32
51
90
  */
52
91
  size?: AvatarSizes;
53
- /**
54
- * Strings for localizing text in the tooltip.
55
- */
56
- strings?: AvatarGroupStrings;
57
92
  };
58
93
 
59
94
  export declare type AvatarGroupSlots = {
60
- root: Slot<'div'>;
95
+ root: NonNullable<Slot<'div'>>;
61
96
  /**
62
97
  * Popover trigger slot that can be used to change the overflow indicator.
63
98
  */
64
- popoverTrigger?: Slot<typeof Button>;
99
+ overflowButton?: NonNullable<Slot<'button'>>;
65
100
  /**
66
- * Popover surface that will be displayed when the popover is triggered.
101
+ * List that contains the overflow AvatarGroupItems.
67
102
  */
68
- popoverSurface?: Slot<typeof PopoverSurface>;
103
+ overflowContent?: NonNullable<Slot<'div'>>;
104
+ /**
105
+ * PopoverSurface that contains the overflow content.
106
+ */
107
+ overflowSurface?: NonNullable<Slot<typeof PopoverSurface>>;
69
108
  };
70
109
 
71
110
  /**
72
111
  * State used in rendering AvatarGroup
73
112
  */
74
- export declare type AvatarGroupState = ComponentState<AvatarGroupSlots> & {
75
- tooltipContent: TooltipProps['content'];
76
- };
77
-
78
- declare type AvatarGroupStrings = {
113
+ export declare type AvatarGroupState = ComponentState<AvatarGroupSlots> & Required<Pick<AvatarGroupProps, 'layout' | 'size' | 'overflowIndicator'>> & {
114
+ /**
115
+ * Whether there are more Avatars than `maxAvatars`.
116
+ * @default false
117
+ */
118
+ hasOverflow: boolean;
79
119
  /**
80
- * Text applied to the overflow indicator's tooltip.
81
- * Can include the token "\{numOverflowedAvatars\}" which will be replaced with the number of overflowed avatars.
120
+ * Tooltip content for the overflow indicator.
82
121
  */
83
- tooltipContent: string;
122
+ tooltipContent: TooltipProps['content'];
123
+ nonOverflowAvatarsCount: number;
84
124
  };
85
125
 
86
126
  /**
87
127
  * A specific named color for the Avatar
88
128
  */
89
- export declare type AvatarNamedColor = 'darkRed' | 'cranberry' | 'red' | 'pumpkin' | 'peach' | 'marigold' | 'gold' | 'brass' | 'brown' | 'forest' | 'seafoam' | 'darkGreen' | 'lightTeal' | 'teal' | 'steel' | 'blue' | 'royalBlue' | 'cornflower' | 'navy' | 'lavender' | 'purple' | 'grape' | 'lilac' | 'pink' | 'magenta' | 'plum' | 'beige' | 'mink' | 'platinum' | 'anchor';
129
+ export declare type AvatarNamedColor = 'dark-red' | 'cranberry' | 'red' | 'pumpkin' | 'peach' | 'marigold' | 'gold' | 'brass' | 'brown' | 'forest' | 'seafoam' | 'dark-green' | 'light-teal' | 'teal' | 'steel' | 'blue' | 'royal-blue' | 'cornflower' | 'navy' | 'lavender' | 'purple' | 'grape' | 'lilac' | 'pink' | 'magenta' | 'plum' | 'beige' | 'mink' | 'platinum' | 'anchor';
90
130
 
91
131
  /**
92
132
  * Properties for Avatar
@@ -209,6 +249,8 @@ export declare type AvatarState = ComponentState<AvatarSlots> & Required<Pick<Av
209
249
  *
210
250
  * @returns The 1 or 2 character initials based on the name. Or an empty string if no initials
211
251
  * could be derived from the name.
252
+ *
253
+ * @internal
212
254
  */
213
255
  export declare function getInitials(displayName: string | undefined | null, isRtl: boolean, options?: {
214
256
  /** Should initials be generated from phone numbers (default false) */
@@ -224,6 +266,11 @@ export declare const renderAvatar_unstable: (state: AvatarState) => JSX.Element;
224
266
  */
225
267
  export declare const renderAvatarGroup_unstable: (state: AvatarGroupState) => JSX.Element;
226
268
 
269
+ /**
270
+ * Render the final JSX of AvatarGroupItem
271
+ */
272
+ export declare const renderAvatarGroupItem_unstable: (state: AvatarGroupItemState) => JSX.Element;
273
+
227
274
  export declare const useAvatar_unstable: (props: AvatarProps, ref: React_2.Ref<HTMLElement>) => AvatarState;
228
275
 
229
276
  /**
@@ -237,6 +284,22 @@ export declare const useAvatar_unstable: (props: AvatarProps, ref: React_2.Ref<H
237
284
  */
238
285
  export declare const useAvatarGroup_unstable: (props: AvatarGroupProps, ref: React_2.Ref<HTMLElement>) => AvatarGroupState;
239
286
 
287
+ /**
288
+ * Create the state required to render AvatarGroupItem.
289
+ *
290
+ * The returned state can be modified with hooks such as useAvatarGroupItemStyles_unstable,
291
+ * before being passed to renderAvatarGroupItem_unstable.
292
+ *
293
+ * @param props - props from this instance of AvatarGroupItem
294
+ * @param ref - reference to root HTMLElement of AvatarGroupItem
295
+ */
296
+ export declare const useAvatarGroupItem_unstable: (props: AvatarGroupItemProps, ref: React_2.Ref<HTMLElement>) => AvatarGroupItemState;
297
+
298
+ /**
299
+ * Apply styling to the AvatarGroupItem slots based on the state
300
+ */
301
+ export declare const useAvatarGroupItemStyles_unstable: (state: AvatarGroupItemState) => AvatarGroupItemState;
302
+
240
303
  /**
241
304
  * Apply styling to the AvatarGroup slots based on the state
242
305
  */
@@ -0,0 +1,2 @@
1
+ export * from './components/AvatarGroupItem/index';
2
+ //# sourceMappingURL=AvatarGroupItem.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AvatarGroupItem.js","sourceRoot":"../src/","sources":["AvatarGroupItem.ts"],"names":[],"mappings":"AAAA,cAAc,oCAAoC,CAAC","sourcesContent":["export * from './components/AvatarGroupItem/index';\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["components/Avatar/Avatar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,qBAAT,QAAsC,gBAAtC;AACA,SAAS,kBAAT,QAAmC,aAAnC;AACA,SAAS,wBAAT,QAAyC,mBAAzC;AAIA,OAAO,MAAM,MAAM,gBAAqC,KAAK,CAAC,UAAN,CAAiB,CAAC,KAAD,EAAQ,GAAR,KAAe;AACtF,QAAM,KAAK,GAAG,kBAAkB,CAAC,KAAD,EAAQ,GAAR,CAAhC;AAEA,EAAA,wBAAwB,CAAC,KAAD,CAAxB;AAEA,SAAO,qBAAqB,CAAC,KAAD,CAA5B;AACD,CANuD,CAAjD;AAQP,MAAM,CAAC,WAAP,GAAqB,QAArB","sourcesContent":["import * as React from 'react';\nimport { renderAvatar_unstable } from './renderAvatar';\nimport { useAvatar_unstable } from './useAvatar';\nimport { useAvatarStyles_unstable } from './useAvatarStyles';\nimport type { AvatarProps } from './Avatar.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\n\nexport const Avatar: ForwardRefComponent<AvatarProps> = React.forwardRef((props, ref) => {\n const state = useAvatar_unstable(props, ref);\n\n useAvatarStyles_unstable(state);\n\n return renderAvatar_unstable(state);\n});\n\nAvatar.displayName = 'Avatar';\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["components/Avatar/Avatar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,qBAAT,QAAsC,gBAAtC;AACA,SAAS,kBAAT,QAAmC,aAAnC;AACA,SAAS,wBAAT,QAAyC,mBAAzC;AAIA,OAAO,MAAM,MAAM,gBAAqC,KAAK,CAAC,UAAN,CAAiB,CAAC,KAAD,EAAQ,GAAR,KAAe;EACtF,MAAM,KAAK,GAAG,kBAAkB,CAAC,KAAD,EAAQ,GAAR,CAAhC;EAEA,wBAAwB,CAAC,KAAD,CAAxB;EAEA,OAAO,qBAAqB,CAAC,KAAD,CAA5B;AACD,CANuD,CAAjD;AAQP,MAAM,CAAC,WAAP,GAAqB,QAArB","sourcesContent":["import * as React from 'react';\nimport { renderAvatar_unstable } from './renderAvatar';\nimport { useAvatar_unstable } from './useAvatar';\nimport { useAvatarStyles_unstable } from './useAvatarStyles';\nimport type { AvatarProps } from './Avatar.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\n\nexport const Avatar: ForwardRefComponent<AvatarProps> = React.forwardRef((props, ref) => {\n const state = useAvatar_unstable(props, ref);\n\n useAvatarStyles_unstable(state);\n\n return renderAvatar_unstable(state);\n});\n\nAvatar.displayName = 'Avatar';\n"],"sourceRoot":"../src/"}
@@ -1 +1 @@
1
- {"version":3,"file":"Avatar.types.js","sourceRoot":"../src/","sources":["components/Avatar/Avatar.types.ts"],"names":[],"mappings":"","sourcesContent":["import { PresenceBadge } from '@fluentui/react-badge';\nimport type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\n\nexport type AvatarSlots = {\n root: Slot<'span'>;\n\n /**\n * The Avatar's image.\n *\n * Usage e.g.: `image={{ src: '...' }}`\n */\n image?: Slot<'img'>;\n\n /**\n * (optional) Custom initials.\n *\n * It is usually not necessary to specify custom initials; by default they will be derived from the `name` prop,\n * using the `getInitials` function.\n *\n * The initials are displayed when there is no image (including while the image is loading).\n */\n initials?: Slot<'span'>;\n\n /**\n * Icon to be displayed when the avatar doesn't have an image or initials.\n *\n * @default `PersonRegular` (the default icon's size depends on the Avatar's size)\n */\n icon?: Slot<'span'>;\n\n /**\n * Badge to show the avatar's presence status.\n */\n badge?: Slot<typeof PresenceBadge>;\n};\n\n/**\n * A specific named color for the Avatar\n */\nexport type AvatarNamedColor =\n | 'darkRed'\n | 'cranberry'\n | 'red'\n | 'pumpkin'\n | 'peach'\n | 'marigold'\n | 'gold'\n | 'brass'\n | 'brown'\n | 'forest'\n | 'seafoam'\n | 'darkGreen'\n | 'lightTeal'\n | 'teal'\n | 'steel'\n | 'blue'\n | 'royalBlue'\n | 'cornflower'\n | 'navy'\n | 'lavender'\n | 'purple'\n | 'grape'\n | 'lilac'\n | 'pink'\n | 'magenta'\n | 'plum'\n | 'beige'\n | 'mink'\n | 'platinum'\n | 'anchor';\n\n/**\n * Sizes that can be used for the Avatar\n */\nexport type AvatarSizes = 16 | 20 | 24 | 28 | 32 | 36 | 40 | 48 | 56 | 64 | 72 | 96 | 120 | 128;\n\n/**\n * Properties for Avatar\n */\nexport type AvatarProps = Omit<ComponentProps<AvatarSlots>, 'color'> & {\n /**\n * Optional activity indicator\n * * active: the avatar will be decorated according to activeAppearance\n * * inactive: the avatar will be reduced in size and partially transparent\n * * unset: normal display\n *\n * @default unset\n */\n active?: 'active' | 'inactive' | 'unset';\n\n /**\n * The appearance when `active=\"active\"`\n *\n * @default ring\n */\n activeAppearance?: 'ring' | 'shadow' | 'ring-shadow';\n\n /**\n * The color when displaying either an icon or initials.\n * * neutral (default): gray\n * * brand: color from the brand palette\n * * colorful: picks a color from a set of pre-defined colors, based on a hash of the name (or idForColor if provided)\n * * [AvatarNamedColor]: a specific color from the theme\n *\n * @default neutral\n */\n color?: 'neutral' | 'brand' | 'colorful' | AvatarNamedColor;\n\n /**\n * Specify a string to be used instead of the name, to determine which color to use when color=\"colorful\".\n * Use this when a name is not available, but there is another unique identifier that can be used instead.\n */\n idForColor?: string | undefined;\n\n /**\n * The name of the person or entity represented by this Avatar. This should always be provided if it is available.\n *\n * The name will be used to determine the initials displayed when there is no icon, as well as provided to\n * accessibility tools.\n */\n name?: string;\n\n /**\n * The avatar can have a circular or square shape.\n * @default circular\n */\n shape?: 'circular' | 'square';\n\n /**\n * Size of the avatar in pixels.\n *\n * Size is restricted to a limited set of supported values recommended for most uses (see `AvatarSizeValue`) and\n * based on design guidelines for the Avatar control.\n *\n * Note: At size 16, if initials are displayed, only the first initial will be rendered.\n *\n * If a non-supported size is neeeded, set `size` to the next-smaller supported size, and set `width` and `height`\n * to override the rendered size.\n *\n * For example, to set the avatar to 45px in size:\n * `<Avatar size={40} style={{ width: '45px', height: '45px' }} />`\n *\n * @default 32\n */\n size?: AvatarSizes;\n};\n\n/**\n * State used in rendering Avatar\n */\nexport type AvatarState = ComponentState<AvatarSlots> &\n Required<Pick<AvatarProps, 'active' | 'activeAppearance' | 'shape' | 'size'>> & {\n /**\n * The Avatar's color, it matches props.color but with `'colorful'` resolved to a named color\n */\n color: NonNullable<Exclude<AvatarProps['color'], 'colorful'>>;\n };\n"]}
1
+ {"version":3,"file":"Avatar.types.js","sourceRoot":"../src/","sources":["components/Avatar/Avatar.types.ts"],"names":[],"mappings":"","sourcesContent":["import { PresenceBadge } from '@fluentui/react-badge';\nimport type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\n\nexport type AvatarSlots = {\n root: Slot<'span'>;\n\n /**\n * The Avatar's image.\n *\n * Usage e.g.: `image={{ src: '...' }}`\n */\n image?: Slot<'img'>;\n\n /**\n * (optional) Custom initials.\n *\n * It is usually not necessary to specify custom initials; by default they will be derived from the `name` prop,\n * using the `getInitials` function.\n *\n * The initials are displayed when there is no image (including while the image is loading).\n */\n initials?: Slot<'span'>;\n\n /**\n * Icon to be displayed when the avatar doesn't have an image or initials.\n *\n * @default `PersonRegular` (the default icon's size depends on the Avatar's size)\n */\n icon?: Slot<'span'>;\n\n /**\n * Badge to show the avatar's presence status.\n */\n badge?: Slot<typeof PresenceBadge>;\n};\n\n/**\n * A specific named color for the Avatar\n */\nexport type AvatarNamedColor =\n | 'dark-red'\n | 'cranberry'\n | 'red'\n | 'pumpkin'\n | 'peach'\n | 'marigold'\n | 'gold'\n | 'brass'\n | 'brown'\n | 'forest'\n | 'seafoam'\n | 'dark-green'\n | 'light-teal'\n | 'teal'\n | 'steel'\n | 'blue'\n | 'royal-blue'\n | 'cornflower'\n | 'navy'\n | 'lavender'\n | 'purple'\n | 'grape'\n | 'lilac'\n | 'pink'\n | 'magenta'\n | 'plum'\n | 'beige'\n | 'mink'\n | 'platinum'\n | 'anchor';\n\n/**\n * Sizes that can be used for the Avatar\n */\nexport type AvatarSizes = 16 | 20 | 24 | 28 | 32 | 36 | 40 | 48 | 56 | 64 | 72 | 96 | 120 | 128;\n\n/**\n * Properties for Avatar\n */\nexport type AvatarProps = Omit<ComponentProps<AvatarSlots>, 'color'> & {\n /**\n * Optional activity indicator\n * * active: the avatar will be decorated according to activeAppearance\n * * inactive: the avatar will be reduced in size and partially transparent\n * * unset: normal display\n *\n * @default unset\n */\n active?: 'active' | 'inactive' | 'unset';\n\n /**\n * The appearance when `active=\"active\"`\n *\n * @default ring\n */\n activeAppearance?: 'ring' | 'shadow' | 'ring-shadow';\n\n /**\n * The color when displaying either an icon or initials.\n * * neutral (default): gray\n * * brand: color from the brand palette\n * * colorful: picks a color from a set of pre-defined colors, based on a hash of the name (or idForColor if provided)\n * * [AvatarNamedColor]: a specific color from the theme\n *\n * @default neutral\n */\n color?: 'neutral' | 'brand' | 'colorful' | AvatarNamedColor;\n\n /**\n * Specify a string to be used instead of the name, to determine which color to use when color=\"colorful\".\n * Use this when a name is not available, but there is another unique identifier that can be used instead.\n */\n idForColor?: string | undefined;\n\n /**\n * The name of the person or entity represented by this Avatar. This should always be provided if it is available.\n *\n * The name will be used to determine the initials displayed when there is no icon, as well as provided to\n * accessibility tools.\n */\n name?: string;\n\n /**\n * The avatar can have a circular or square shape.\n * @default circular\n */\n shape?: 'circular' | 'square';\n\n /**\n * Size of the avatar in pixels.\n *\n * Size is restricted to a limited set of supported values recommended for most uses (see `AvatarSizeValue`) and\n * based on design guidelines for the Avatar control.\n *\n * Note: At size 16, if initials are displayed, only the first initial will be rendered.\n *\n * If a non-supported size is neeeded, set `size` to the next-smaller supported size, and set `width` and `height`\n * to override the rendered size.\n *\n * For example, to set the avatar to 45px in size:\n * `<Avatar size={40} style={{ width: '45px', height: '45px' }} />`\n *\n * @default 32\n */\n size?: AvatarSizes;\n};\n\n/**\n * State used in rendering Avatar\n */\nexport type AvatarState = ComponentState<AvatarSlots> &\n Required<Pick<AvatarProps, 'active' | 'activeAppearance' | 'shape' | 'size'>> & {\n /**\n * The Avatar's color, it matches props.color but with `'colorful'` resolved to a named color\n */\n color: NonNullable<Exclude<AvatarProps['color'], 'colorful'>>;\n };\n"]}