@fluentui/react-avatar 9.5.4 → 9.5.5

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 (147) hide show
  1. package/CHANGELOG.json +64 -1
  2. package/CHANGELOG.md +19 -2
  3. package/lib/Avatar.js +0 -1
  4. package/lib/Avatar.js.map +1 -1
  5. package/lib/AvatarGroup.js +0 -1
  6. package/lib/AvatarGroup.js.map +1 -1
  7. package/lib/AvatarGroupItem.js +0 -1
  8. package/lib/AvatarGroupItem.js.map +1 -1
  9. package/lib/AvatarGroupPopover.js +0 -1
  10. package/lib/AvatarGroupPopover.js.map +1 -1
  11. package/lib/components/Avatar/Avatar.js +5 -6
  12. package/lib/components/Avatar/Avatar.js.map +1 -1
  13. package/lib/components/Avatar/Avatar.types.js +1 -2
  14. package/lib/components/Avatar/Avatar.types.js.map +1 -1
  15. package/lib/components/Avatar/index.js +0 -1
  16. package/lib/components/Avatar/index.js.map +1 -1
  17. package/lib/components/Avatar/renderAvatar.js +4 -8
  18. package/lib/components/Avatar/renderAvatar.js.map +1 -1
  19. package/lib/components/Avatar/useAvatar.js +165 -148
  20. package/lib/components/Avatar/useAvatar.js.map +1 -1
  21. package/lib/components/Avatar/useAvatarStyles.styles.js.map +1 -1
  22. package/lib/components/AvatarGroup/AvatarGroup.js +6 -8
  23. package/lib/components/AvatarGroup/AvatarGroup.js.map +1 -1
  24. package/lib/components/AvatarGroup/AvatarGroup.types.js +1 -2
  25. package/lib/components/AvatarGroup/AvatarGroup.types.js.map +1 -1
  26. package/lib/components/AvatarGroup/index.js +0 -1
  27. package/lib/components/AvatarGroup/index.js.map +1 -1
  28. package/lib/components/AvatarGroup/renderAvatarGroup.js +6 -11
  29. package/lib/components/AvatarGroup/renderAvatarGroup.js.map +1 -1
  30. package/lib/components/AvatarGroup/useAvatarGroup.js +17 -20
  31. package/lib/components/AvatarGroup/useAvatarGroup.js.map +1 -1
  32. package/lib/components/AvatarGroup/useAvatarGroupContextValues.js +9 -13
  33. package/lib/components/AvatarGroup/useAvatarGroupContextValues.js.map +1 -1
  34. package/lib/components/AvatarGroup/useAvatarGroupStyles.styles.js.map +1 -1
  35. package/lib/components/AvatarGroupItem/AvatarGroupItem.js +5 -7
  36. package/lib/components/AvatarGroupItem/AvatarGroupItem.js.map +1 -1
  37. package/lib/components/AvatarGroupItem/AvatarGroupItem.types.js +1 -2
  38. package/lib/components/AvatarGroupItem/AvatarGroupItem.types.js.map +1 -1
  39. package/lib/components/AvatarGroupItem/index.js +0 -1
  40. package/lib/components/AvatarGroupItem/index.js.map +1 -1
  41. package/lib/components/AvatarGroupItem/renderAvatarGroupItem.js +4 -9
  42. package/lib/components/AvatarGroupItem/renderAvatarGroupItem.js.map +1 -1
  43. package/lib/components/AvatarGroupItem/useAvatarGroupItem.js +45 -51
  44. package/lib/components/AvatarGroupItem/useAvatarGroupItem.js.map +1 -1
  45. package/lib/components/AvatarGroupItem/useAvatarGroupItemStyles.styles.js.map +1 -1
  46. package/lib/components/AvatarGroupPopover/AvatarGroupPopover.js +6 -8
  47. package/lib/components/AvatarGroupPopover/AvatarGroupPopover.js.map +1 -1
  48. package/lib/components/AvatarGroupPopover/AvatarGroupPopover.types.js +0 -1
  49. package/lib/components/AvatarGroupPopover/AvatarGroupPopover.types.js.map +1 -1
  50. package/lib/components/AvatarGroupPopover/index.js +0 -1
  51. package/lib/components/AvatarGroupPopover/index.js.map +1 -1
  52. package/lib/components/AvatarGroupPopover/renderAvatarGroupPopover.js +8 -13
  53. package/lib/components/AvatarGroupPopover/renderAvatarGroupPopover.js.map +1 -1
  54. package/lib/components/AvatarGroupPopover/useAvatarGroupPopover.js +74 -81
  55. package/lib/components/AvatarGroupPopover/useAvatarGroupPopover.js.map +1 -1
  56. package/lib/components/AvatarGroupPopover/useAvatarGroupPopoverContextValues.js +8 -9
  57. package/lib/components/AvatarGroupPopover/useAvatarGroupPopoverContextValues.js.map +1 -1
  58. package/lib/components/AvatarGroupPopover/useAvatarGroupPopoverStyles.styles.js.map +1 -1
  59. package/lib/contexts/AvatarContext.js +3 -6
  60. package/lib/contexts/AvatarContext.js.map +1 -1
  61. package/lib/contexts/AvatarGroupContext.js +2 -4
  62. package/lib/contexts/AvatarGroupContext.js.map +1 -1
  63. package/lib/contexts/index.js +0 -1
  64. package/lib/contexts/index.js.map +1 -1
  65. package/lib/index.js +0 -1
  66. package/lib/index.js.map +1 -1
  67. package/lib/utils/getInitials.js +37 -43
  68. package/lib/utils/getInitials.js.map +1 -1
  69. package/lib/utils/index.js +0 -1
  70. package/lib/utils/index.js.map +1 -1
  71. package/lib/utils/partitionAvatarGroupItems.js +15 -18
  72. package/lib/utils/partitionAvatarGroupItems.js.map +1 -1
  73. package/lib-commonjs/Avatar.js +0 -3
  74. package/lib-commonjs/Avatar.js.map +1 -1
  75. package/lib-commonjs/AvatarGroup.js +0 -3
  76. package/lib-commonjs/AvatarGroup.js.map +1 -1
  77. package/lib-commonjs/AvatarGroupItem.js +0 -3
  78. package/lib-commonjs/AvatarGroupItem.js.map +1 -1
  79. package/lib-commonjs/AvatarGroupPopover.js +0 -3
  80. package/lib-commonjs/AvatarGroupPopover.js.map +1 -1
  81. package/lib-commonjs/components/Avatar/Avatar.js +1 -3
  82. package/lib-commonjs/components/Avatar/Avatar.js.map +1 -1
  83. package/lib-commonjs/components/Avatar/Avatar.types.js +0 -3
  84. package/lib-commonjs/components/Avatar/Avatar.types.js.map +1 -1
  85. package/lib-commonjs/components/Avatar/index.js +0 -3
  86. package/lib-commonjs/components/Avatar/index.js.map +1 -1
  87. package/lib-commonjs/components/Avatar/renderAvatar.js +1 -3
  88. package/lib-commonjs/components/Avatar/renderAvatar.js.map +1 -1
  89. package/lib-commonjs/components/Avatar/useAvatar.js +1 -3
  90. package/lib-commonjs/components/Avatar/useAvatar.js.map +1 -1
  91. package/lib-commonjs/components/Avatar/useAvatarStyles.styles.js +0 -2
  92. package/lib-commonjs/components/Avatar/useAvatarStyles.styles.js.map +1 -1
  93. package/lib-commonjs/components/AvatarGroup/AvatarGroup.js +1 -3
  94. package/lib-commonjs/components/AvatarGroup/AvatarGroup.js.map +1 -1
  95. package/lib-commonjs/components/AvatarGroup/AvatarGroup.types.js +0 -3
  96. package/lib-commonjs/components/AvatarGroup/AvatarGroup.types.js.map +1 -1
  97. package/lib-commonjs/components/AvatarGroup/index.js +0 -3
  98. package/lib-commonjs/components/AvatarGroup/index.js.map +1 -1
  99. package/lib-commonjs/components/AvatarGroup/renderAvatarGroup.js +1 -3
  100. package/lib-commonjs/components/AvatarGroup/renderAvatarGroup.js.map +1 -1
  101. package/lib-commonjs/components/AvatarGroup/useAvatarGroup.js +1 -3
  102. package/lib-commonjs/components/AvatarGroup/useAvatarGroup.js.map +1 -1
  103. package/lib-commonjs/components/AvatarGroup/useAvatarGroupContextValues.js +1 -3
  104. package/lib-commonjs/components/AvatarGroup/useAvatarGroupContextValues.js.map +1 -1
  105. package/lib-commonjs/components/AvatarGroup/useAvatarGroupStyles.styles.js +0 -2
  106. package/lib-commonjs/components/AvatarGroup/useAvatarGroupStyles.styles.js.map +1 -1
  107. package/lib-commonjs/components/AvatarGroupItem/AvatarGroupItem.js +1 -3
  108. package/lib-commonjs/components/AvatarGroupItem/AvatarGroupItem.js.map +1 -1
  109. package/lib-commonjs/components/AvatarGroupItem/AvatarGroupItem.types.js +0 -3
  110. package/lib-commonjs/components/AvatarGroupItem/AvatarGroupItem.types.js.map +1 -1
  111. package/lib-commonjs/components/AvatarGroupItem/index.js +0 -3
  112. package/lib-commonjs/components/AvatarGroupItem/index.js.map +1 -1
  113. package/lib-commonjs/components/AvatarGroupItem/renderAvatarGroupItem.js +1 -3
  114. package/lib-commonjs/components/AvatarGroupItem/renderAvatarGroupItem.js.map +1 -1
  115. package/lib-commonjs/components/AvatarGroupItem/useAvatarGroupItem.js +1 -3
  116. package/lib-commonjs/components/AvatarGroupItem/useAvatarGroupItem.js.map +1 -1
  117. package/lib-commonjs/components/AvatarGroupItem/useAvatarGroupItemStyles.styles.js +0 -2
  118. package/lib-commonjs/components/AvatarGroupItem/useAvatarGroupItemStyles.styles.js.map +1 -1
  119. package/lib-commonjs/components/AvatarGroupPopover/AvatarGroupPopover.js +1 -3
  120. package/lib-commonjs/components/AvatarGroupPopover/AvatarGroupPopover.js.map +1 -1
  121. package/lib-commonjs/components/AvatarGroupPopover/AvatarGroupPopover.types.js +0 -3
  122. package/lib-commonjs/components/AvatarGroupPopover/AvatarGroupPopover.types.js.map +1 -1
  123. package/lib-commonjs/components/AvatarGroupPopover/index.js +0 -3
  124. package/lib-commonjs/components/AvatarGroupPopover/index.js.map +1 -1
  125. package/lib-commonjs/components/AvatarGroupPopover/renderAvatarGroupPopover.js +1 -3
  126. package/lib-commonjs/components/AvatarGroupPopover/renderAvatarGroupPopover.js.map +1 -1
  127. package/lib-commonjs/components/AvatarGroupPopover/useAvatarGroupPopover.js +1 -3
  128. package/lib-commonjs/components/AvatarGroupPopover/useAvatarGroupPopover.js.map +1 -1
  129. package/lib-commonjs/components/AvatarGroupPopover/useAvatarGroupPopoverContextValues.js +1 -3
  130. package/lib-commonjs/components/AvatarGroupPopover/useAvatarGroupPopoverContextValues.js.map +1 -1
  131. package/lib-commonjs/components/AvatarGroupPopover/useAvatarGroupPopoverStyles.styles.js +0 -2
  132. package/lib-commonjs/components/AvatarGroupPopover/useAvatarGroupPopoverStyles.styles.js.map +1 -1
  133. package/lib-commonjs/contexts/AvatarContext.js +1 -3
  134. package/lib-commonjs/contexts/AvatarContext.js.map +1 -1
  135. package/lib-commonjs/contexts/AvatarGroupContext.js +2 -4
  136. package/lib-commonjs/contexts/AvatarGroupContext.js.map +1 -1
  137. package/lib-commonjs/contexts/index.js +0 -3
  138. package/lib-commonjs/contexts/index.js.map +1 -1
  139. package/lib-commonjs/index.js +0 -3
  140. package/lib-commonjs/index.js.map +1 -1
  141. package/lib-commonjs/utils/getInitials.js +4 -6
  142. package/lib-commonjs/utils/getInitials.js.map +1 -1
  143. package/lib-commonjs/utils/index.js +0 -3
  144. package/lib-commonjs/utils/index.js.map +1 -1
  145. package/lib-commonjs/utils/partitionAvatarGroupItems.js +1 -3
  146. package/lib-commonjs/utils/partitionAvatarGroupItems.js.map +1 -1
  147. package/package.json +10 -10
package/CHANGELOG.json CHANGED
@@ -2,7 +2,70 @@
2
2
  "name": "@fluentui/react-avatar",
3
3
  "entries": [
4
4
  {
5
- "date": "Thu, 25 May 2023 09:57:45 GMT",
5
+ "date": "Wed, 31 May 2023 06:42:52 GMT",
6
+ "tag": "@fluentui/react-avatar_v9.5.5",
7
+ "version": "9.5.5",
8
+ "comments": {
9
+ "patch": [
10
+ {
11
+ "author": "seanmonahan@microsoft.com",
12
+ "package": "@fluentui/react-avatar",
13
+ "commit": "d640b972d7ac86bfb76ae6c6329f12cdd33b3b7c",
14
+ "comment": "chore: Update Griffel to v1.5.7."
15
+ },
16
+ {
17
+ "author": "beachball",
18
+ "package": "@fluentui/react-avatar",
19
+ "comment": "Bump @fluentui/react-badge to v9.1.15",
20
+ "commit": "17ca96c6b7f684f36a5c63e40e78b4986a86c713"
21
+ },
22
+ {
23
+ "author": "beachball",
24
+ "package": "@fluentui/react-avatar",
25
+ "comment": "Bump @fluentui/react-context-selector to v9.1.22",
26
+ "commit": "17ca96c6b7f684f36a5c63e40e78b4986a86c713"
27
+ },
28
+ {
29
+ "author": "beachball",
30
+ "package": "@fluentui/react-avatar",
31
+ "comment": "Bump @fluentui/react-popover to v9.6.0",
32
+ "commit": "17ca96c6b7f684f36a5c63e40e78b4986a86c713"
33
+ },
34
+ {
35
+ "author": "beachball",
36
+ "package": "@fluentui/react-avatar",
37
+ "comment": "Bump @fluentui/react-tabster to v9.7.5",
38
+ "commit": "17ca96c6b7f684f36a5c63e40e78b4986a86c713"
39
+ },
40
+ {
41
+ "author": "beachball",
42
+ "package": "@fluentui/react-avatar",
43
+ "comment": "Bump @fluentui/react-tooltip to v9.2.16",
44
+ "commit": "17ca96c6b7f684f36a5c63e40e78b4986a86c713"
45
+ },
46
+ {
47
+ "author": "beachball",
48
+ "package": "@fluentui/react-avatar",
49
+ "comment": "Bump @fluentui/react-utilities to v9.9.2",
50
+ "commit": "17ca96c6b7f684f36a5c63e40e78b4986a86c713"
51
+ },
52
+ {
53
+ "author": "beachball",
54
+ "package": "@fluentui/react-avatar",
55
+ "comment": "Bump @fluentui/react-jsx-runtime to v9.0.0-alpha.6",
56
+ "commit": "17ca96c6b7f684f36a5c63e40e78b4986a86c713"
57
+ },
58
+ {
59
+ "author": "beachball",
60
+ "package": "@fluentui/react-avatar",
61
+ "comment": "Bump @fluentui/react-conformance-griffel to v9.0.0-beta.22",
62
+ "commit": "17ca96c6b7f684f36a5c63e40e78b4986a86c713"
63
+ }
64
+ ]
65
+ }
66
+ },
67
+ {
68
+ "date": "Thu, 25 May 2023 10:00:48 GMT",
6
69
  "tag": "@fluentui/react-avatar_v9.5.4",
7
70
  "version": "9.5.4",
8
71
  "comments": {
package/CHANGELOG.md CHANGED
@@ -1,12 +1,29 @@
1
1
  # Change Log - @fluentui/react-avatar
2
2
 
3
- This log was last generated on Thu, 25 May 2023 09:57:45 GMT and should not be manually modified.
3
+ This log was last generated on Wed, 31 May 2023 06:42:52 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## [9.5.5](https://github.com/microsoft/fluentui/tree/@fluentui/react-avatar_v9.5.5)
8
+
9
+ Wed, 31 May 2023 06:42:52 GMT
10
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-avatar_v9.5.4..@fluentui/react-avatar_v9.5.5)
11
+
12
+ ### Patches
13
+
14
+ - chore: Update Griffel to v1.5.7. ([PR #27925](https://github.com/microsoft/fluentui/pull/27925) by seanmonahan@microsoft.com)
15
+ - Bump @fluentui/react-badge to v9.1.15 ([PR #28054](https://github.com/microsoft/fluentui/pull/28054) by beachball)
16
+ - Bump @fluentui/react-context-selector to v9.1.22 ([PR #28054](https://github.com/microsoft/fluentui/pull/28054) by beachball)
17
+ - Bump @fluentui/react-popover to v9.6.0 ([PR #28054](https://github.com/microsoft/fluentui/pull/28054) by beachball)
18
+ - Bump @fluentui/react-tabster to v9.7.5 ([PR #28054](https://github.com/microsoft/fluentui/pull/28054) by beachball)
19
+ - Bump @fluentui/react-tooltip to v9.2.16 ([PR #28054](https://github.com/microsoft/fluentui/pull/28054) by beachball)
20
+ - Bump @fluentui/react-utilities to v9.9.2 ([PR #28054](https://github.com/microsoft/fluentui/pull/28054) by beachball)
21
+ - Bump @fluentui/react-jsx-runtime to v9.0.0-alpha.6 ([PR #28054](https://github.com/microsoft/fluentui/pull/28054) by beachball)
22
+ - Bump @fluentui/react-conformance-griffel to v9.0.0-beta.22 ([PR #28054](https://github.com/microsoft/fluentui/pull/28054) by beachball)
23
+
7
24
  ## [9.5.4](https://github.com/microsoft/fluentui/tree/@fluentui/react-avatar_v9.5.4)
8
25
 
9
- Thu, 25 May 2023 09:57:45 GMT
26
+ Thu, 25 May 2023 10:00:48 GMT
10
27
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-avatar_v9.5.3..@fluentui/react-avatar_v9.5.4)
11
28
 
12
29
  ### Patches
package/lib/Avatar.js CHANGED
@@ -1,2 +1 @@
1
1
  export * from './components/Avatar/index';
2
- //# sourceMappingURL=Avatar.js.map
package/lib/Avatar.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["../src/Avatar.ts"],"sourcesContent":["export * from './components/Avatar/index';\n"],"mappings":"AAAA,cAAc"}
1
+ {"version":3,"sources":["Avatar.ts"],"sourcesContent":["export * from './components/Avatar/index';\n"],"names":[],"mappings":"AAAA,cAAc,4BAA4B"}
@@ -1,2 +1 @@
1
1
  export * from './components/AvatarGroup/index';
2
- //# sourceMappingURL=AvatarGroup.js.map
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["../src/AvatarGroup.ts"],"sourcesContent":["export * from './components/AvatarGroup/index';\n"],"mappings":"AAAA,cAAc"}
1
+ {"version":3,"sources":["AvatarGroup.ts"],"sourcesContent":["export * from './components/AvatarGroup/index';\n"],"names":[],"mappings":"AAAA,cAAc,iCAAiC"}
@@ -1,2 +1 @@
1
1
  export * from './components/AvatarGroupItem/index';
2
- //# sourceMappingURL=AvatarGroupItem.js.map
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["../src/AvatarGroupItem.ts"],"sourcesContent":["export * from './components/AvatarGroupItem/index';\n"],"mappings":"AAAA,cAAc"}
1
+ {"version":3,"sources":["AvatarGroupItem.ts"],"sourcesContent":["export * from './components/AvatarGroupItem/index';\n"],"names":[],"mappings":"AAAA,cAAc,qCAAqC"}
@@ -1,2 +1 @@
1
1
  export * from './components/AvatarGroupPopover/index';
2
- //# sourceMappingURL=AvatarGroupPopover.js.map
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["../src/AvatarGroupPopover.ts"],"sourcesContent":["export * from './components/AvatarGroupPopover/index';\n"],"mappings":"AAAA,cAAc"}
1
+ {"version":3,"sources":["AvatarGroupPopover.ts"],"sourcesContent":["export * from './components/AvatarGroupPopover/index';\n"],"names":[],"mappings":"AAAA,cAAc,wCAAwC"}
@@ -3,11 +3,10 @@ import { renderAvatar_unstable } from './renderAvatar';
3
3
  import { useAvatar_unstable } from './useAvatar';
4
4
  import { useCustomStyleHook_unstable } from '@fluentui/react-shared-contexts';
5
5
  import { useAvatarStyles_unstable } from './useAvatarStyles.styles';
6
- export const Avatar = /*#__PURE__*/React.forwardRef((props, ref) => {
7
- const state = useAvatar_unstable(props, ref);
8
- useAvatarStyles_unstable(state);
9
- useCustomStyleHook_unstable('useAvatarStyles_unstable')(state);
10
- return renderAvatar_unstable(state);
6
+ export const Avatar = /*#__PURE__*/ React.forwardRef((props, ref)=>{
7
+ const state = useAvatar_unstable(props, ref);
8
+ useAvatarStyles_unstable(state);
9
+ useCustomStyleHook_unstable('useAvatarStyles_unstable')(state);
10
+ return renderAvatar_unstable(state);
11
11
  });
12
12
  Avatar.displayName = 'Avatar';
13
- //# sourceMappingURL=Avatar.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["React","renderAvatar_unstable","useAvatar_unstable","useCustomStyleHook_unstable","useAvatarStyles_unstable","Avatar","forwardRef","props","ref","state","displayName"],"sources":["../../../src/components/Avatar/Avatar.tsx"],"sourcesContent":["import * as React from 'react';\nimport { renderAvatar_unstable } from './renderAvatar';\nimport { useAvatar_unstable } from './useAvatar';\nimport { useCustomStyleHook_unstable } from '@fluentui/react-shared-contexts';\nimport { useAvatarStyles_unstable } from './useAvatarStyles.styles';\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 useCustomStyleHook_unstable('useAvatarStyles_unstable')(state);\n\n return renderAvatar_unstable(state);\n});\n\nAvatar.displayName = 'Avatar';\n"],"mappings":"AAAA,YAAYA,KAAA,MAAW;AACvB,SAASC,qBAAqB,QAAQ;AACtC,SAASC,kBAAkB,QAAQ;AACnC,SAASC,2BAA2B,QAAQ;AAC5C,SAASC,wBAAwB,QAAQ;AAIzC,OAAO,MAAMC,MAAA,gBAA2CL,KAAA,CAAMM,UAAU,CAAC,CAACC,KAAA,EAAOC,GAAA,KAAQ;EACvF,MAAMC,KAAA,GAAQP,kBAAA,CAAmBK,KAAA,EAAOC,GAAA;EAExCJ,wBAAA,CAAyBK,KAAA;EAEzBN,2BAAA,CAA4B,4BAA4BM,KAAA;EAExD,OAAOR,qBAAA,CAAsBQ,KAAA;AAC/B;AAEAJ,MAAA,CAAOK,WAAW,GAAG"}
1
+ {"version":3,"sources":["Avatar.tsx"],"sourcesContent":["import * as React from 'react';\nimport { renderAvatar_unstable } from './renderAvatar';\nimport { useAvatar_unstable } from './useAvatar';\nimport { useCustomStyleHook_unstable } from '@fluentui/react-shared-contexts';\nimport { useAvatarStyles_unstable } from './useAvatarStyles.styles';\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 useCustomStyleHook_unstable('useAvatarStyles_unstable')(state);\n\n return renderAvatar_unstable(state);\n});\n\nAvatar.displayName = 'Avatar';\n"],"names":["React","renderAvatar_unstable","useAvatar_unstable","useCustomStyleHook_unstable","useAvatarStyles_unstable","Avatar","forwardRef","props","ref","state","displayName"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,qBAAqB,QAAQ,iBAAiB;AACvD,SAASC,kBAAkB,QAAQ,cAAc;AACjD,SAASC,2BAA2B,QAAQ,kCAAkC;AAC9E,SAASC,wBAAwB,QAAQ,2BAA2B;AAIpE,OAAO,MAAMC,uBAA2CL,MAAMM,UAAU,CAAC,CAACC,OAAOC,MAAQ;IACvF,MAAMC,QAAQP,mBAAmBK,OAAOC;IAExCJ,yBAAyBK;IAEzBN,4BAA4B,4BAA4BM;IAExD,OAAOR,sBAAsBQ;AAC/B,GAAG;AAEHJ,OAAOK,WAAW,GAAG"}
@@ -1,2 +1 @@
1
- export {};
2
- //# sourceMappingURL=Avatar.types.js.map
1
+ export { };
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["../../../src/components/Avatar/Avatar.types.ts"],"sourcesContent":["import { PresenceBadge } from '@fluentui/react-badge';\nimport type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\n\n/**\n * Sizes for the avatar\n * @deprecated use AvatarSize instead\n */\nexport type AvatarSizes = AvatarSize;\n/**\n * Sizes for the avatar\n */\nexport type AvatarSize = 16 | 20 | 24 | 28 | 32 | 36 | 40 | 48 | 56 | 64 | 72 | 96 | 120 | 128;\n\n/**\n * Shape of the avatar\n */\nexport type AvatarShape = 'circular' | 'square';\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 * 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 is used to determine the initials displayed when there is no image. It is also 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?: AvatarShape;\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?: AvatarSize;\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 /**\n * Hidden span to render the active state label for the purposes of including in the aria-labelledby, if needed.\n */\n activeAriaLabelElement?: JSX.Element;\n };\n"],"mappings":"AAAA"}
1
+ {"version":3,"sources":["Avatar.types.ts"],"sourcesContent":["import { PresenceBadge } from '@fluentui/react-badge';\nimport type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\n\n/**\n * Sizes for the avatar\n * @deprecated use AvatarSize instead\n */\nexport type AvatarSizes = AvatarSize;\n/**\n * Sizes for the avatar\n */\nexport type AvatarSize = 16 | 20 | 24 | 28 | 32 | 36 | 40 | 48 | 56 | 64 | 72 | 96 | 120 | 128;\n\n/**\n * Shape of the avatar\n */\nexport type AvatarShape = 'circular' | 'square';\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 * 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 is used to determine the initials displayed when there is no image. It is also 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?: AvatarShape;\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?: AvatarSize;\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 /**\n * Hidden span to render the active state label for the purposes of including in the aria-labelledby, if needed.\n */\n activeAriaLabelElement?: JSX.Element;\n };\n"],"names":[],"mappings":"AAAA,WA2KI"}
@@ -3,4 +3,3 @@ export * from './Avatar';
3
3
  export * from './renderAvatar';
4
4
  export * from './useAvatar';
5
5
  export * from './useAvatarStyles.styles';
6
- //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["../../../src/components/Avatar/index.ts"],"sourcesContent":["export * from './Avatar.types';\nexport * from './Avatar';\nexport * from './renderAvatar';\nexport * from './useAvatar';\nexport * from './useAvatarStyles.styles';\n"],"mappings":"AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc"}
1
+ {"version":3,"sources":["index.ts"],"sourcesContent":["export * from './Avatar.types';\nexport * from './Avatar';\nexport * from './renderAvatar';\nexport * from './useAvatar';\nexport * from './useAvatarStyles.styles';\n"],"names":[],"mappings":"AAAA,cAAc,iBAAiB;AAC/B,cAAc,WAAW;AACzB,cAAc,iBAAiB;AAC/B,cAAc,cAAc;AAC5B,cAAc,2BAA2B"}
@@ -1,10 +1,6 @@
1
- /** @jsxRuntime classic */ /** @jsx createElement */import { createElement } from '@fluentui/react-jsx-runtime';
1
+ /** @jsxRuntime classic */ /** @jsx createElement */ import { createElement } from '@fluentui/react-jsx-runtime';
2
2
  import { getSlotsNext } from '@fluentui/react-utilities';
3
- export const renderAvatar_unstable = state => {
4
- const {
5
- slots,
6
- slotProps
7
- } = getSlotsNext(state);
8
- return /*#__PURE__*/createElement(slots.root, slotProps.root, slots.initials && /*#__PURE__*/createElement(slots.initials, slotProps.initials), slots.icon && /*#__PURE__*/createElement(slots.icon, slotProps.icon), slots.image && /*#__PURE__*/createElement(slots.image, slotProps.image), slots.badge && /*#__PURE__*/createElement(slots.badge, slotProps.badge), state.activeAriaLabelElement);
3
+ export const renderAvatar_unstable = (state)=>{
4
+ const { slots , slotProps } = getSlotsNext(state);
5
+ return /*#__PURE__*/ createElement(slots.root, slotProps.root, slots.initials && /*#__PURE__*/ createElement(slots.initials, slotProps.initials), slots.icon && /*#__PURE__*/ createElement(slots.icon, slotProps.icon), slots.image && /*#__PURE__*/ createElement(slots.image, slotProps.image), slots.badge && /*#__PURE__*/ createElement(slots.badge, slotProps.badge), state.activeAriaLabelElement);
9
6
  };
10
- //# sourceMappingURL=renderAvatar.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["createElement","getSlotsNext","renderAvatar_unstable","state","slots","slotProps","root","initials","icon","image","badge","activeAriaLabelElement"],"sources":["../../../src/components/Avatar/renderAvatar.tsx"],"sourcesContent":["/** @jsxRuntime classic */\n/** @jsx createElement */\n\nimport { createElement } from '@fluentui/react-jsx-runtime';\n\nimport { getSlotsNext } from '@fluentui/react-utilities';\nimport type { AvatarSlots, AvatarState } from './Avatar.types';\n\nexport const renderAvatar_unstable = (state: AvatarState) => {\n const { slots, slotProps } = getSlotsNext<AvatarSlots>(state);\n\n return (\n <slots.root {...slotProps.root}>\n {slots.initials && <slots.initials {...slotProps.initials} />}\n {slots.icon && <slots.icon {...slotProps.icon} />}\n {slots.image && <slots.image {...slotProps.image} />}\n {slots.badge && <slots.badge {...slotProps.badge} />}\n {state.activeAriaLabelElement}\n </slots.root>\n );\n};\n"],"mappings":"AAAA,2BACA,yBAEA,SAASA,aAAa,QAAQ;AAE9B,SAASC,YAAY,QAAQ;AAG7B,OAAO,MAAMC,qBAAA,GAAyBC,KAAA,IAAuB;EAC3D,MAAM;IAAEC,KAAA;IAAOC;EAAS,CAAE,GAAGJ,YAAA,CAA0BE,KAAA;EAEvD,oBACEH,aAXJ,CAWKI,KAAA,CAAME,IAAI,EAAKD,SAAA,CAAUC,IAAI,EAC3BF,KAAA,CAAMG,QAAQ,iBAAIP,aAZzB,CAY0BI,KAAA,CAAMG,QAAQ,EAAKF,SAAA,CAAUE,QAAQ,GACxDH,KAAA,CAAMI,IAAI,iBAAIR,aAbrB,CAasBI,KAAA,CAAMI,IAAI,EAAKH,SAAA,CAAUG,IAAI,GAC5CJ,KAAA,CAAMK,KAAK,iBAAIT,aAdtB,CAcuBI,KAAA,CAAMK,KAAK,EAAKJ,SAAA,CAAUI,KAAK,GAC/CL,KAAA,CAAMM,KAAK,iBAAIV,aAftB,CAeuBI,KAAA,CAAMM,KAAK,EAAKL,SAAA,CAAUK,KAAK,GAC/CP,KAAA,CAAMQ,sBAAsB;AAGnC"}
1
+ {"version":3,"sources":["renderAvatar.tsx"],"sourcesContent":["/** @jsxRuntime classic */\n/** @jsx createElement */\n\nimport { createElement } from '@fluentui/react-jsx-runtime';\n\nimport { getSlotsNext } from '@fluentui/react-utilities';\nimport type { AvatarSlots, AvatarState } from './Avatar.types';\n\nexport const renderAvatar_unstable = (state: AvatarState) => {\n const { slots, slotProps } = getSlotsNext<AvatarSlots>(state);\n\n return (\n <slots.root {...slotProps.root}>\n {slots.initials && <slots.initials {...slotProps.initials} />}\n {slots.icon && <slots.icon {...slotProps.icon} />}\n {slots.image && <slots.image {...slotProps.image} />}\n {slots.badge && <slots.badge {...slotProps.badge} />}\n {state.activeAriaLabelElement}\n </slots.root>\n );\n};\n"],"names":["createElement","getSlotsNext","renderAvatar_unstable","state","slots","slotProps","root","initials","icon","image","badge","activeAriaLabelElement"],"mappings":"AAAA,wBAAwB,GACxB,uBAAuB,GAEvB,SAASA,aAAa,QAAQ,8BAA8B;AAE5D,SAASC,YAAY,QAAQ,4BAA4B;AAGzD,OAAO,MAAMC,wBAAwB,CAACC,QAAuB;IAC3D,MAAM,EAAEC,MAAK,EAAEC,UAAS,EAAE,GAAGJ,aAA0BE;IAEvD,qBACE,AAXJ,cAWKC,MAAME,IAAI,EAAKD,UAAUC,IAAI,EAC3BF,MAAMG,QAAQ,kBAAI,AAZzB,cAY0BH,MAAMG,QAAQ,EAAKF,UAAUE,QAAQ,GACxDH,MAAMI,IAAI,kBAAI,AAbrB,cAasBJ,MAAMI,IAAI,EAAKH,UAAUG,IAAI,GAC5CJ,MAAMK,KAAK,kBAAI,AAdtB,cAcuBL,MAAMK,KAAK,EAAKJ,UAAUI,KAAK,GAC/CL,MAAMM,KAAK,kBAAI,AAftB,cAeuBN,MAAMM,KAAK,EAAKL,UAAUK,KAAK,GAC/CP,MAAMQ,sBAAsB;AAGnC,EAAE"}
@@ -6,161 +6,178 @@ import { PresenceBadge } from '@fluentui/react-badge';
6
6
  import { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';
7
7
  import { useAvatarContext } from '../../contexts/AvatarContext';
8
8
  export const DEFAULT_STRINGS = {
9
- active: 'active',
10
- inactive: 'inactive'
9
+ active: 'active',
10
+ inactive: 'inactive'
11
11
  };
12
- export const useAvatar_unstable = (props, ref) => {
13
- const {
14
- dir
15
- } = useFluent();
16
- const {
17
- shape: contextShape,
18
- size: contextSize
19
- } = useAvatarContext();
20
- const {
21
- name,
22
- size = contextSize !== null && contextSize !== void 0 ? contextSize : 32,
23
- shape = contextShape !== null && contextShape !== void 0 ? contextShape : 'circular',
24
- active = 'unset',
25
- activeAppearance = 'ring',
26
- idForColor
27
- } = props;
28
- let {
29
- color = 'neutral'
30
- } = props;
31
- // Resolve 'colorful' to a specific color name
32
- if (color === 'colorful') {
33
- var _ref;
34
- color = avatarColors[getHashCode((_ref = idForColor !== null && idForColor !== void 0 ? idForColor : name) !== null && _ref !== void 0 ? _ref : '') % avatarColors.length];
35
- }
36
- const baseId = useId('avatar-');
37
- const root = getNativeElementProps('span', {
38
- role: 'img',
39
- id: baseId,
40
- // aria-label and/or aria-labelledby are resolved below
41
- ...props,
42
- ref
43
- }, /* excludedPropNames: */['name']);
44
- const [imageHidden, setImageHidden] = React.useState(undefined);
45
- const image = resolveShorthand(props.image, {
46
- defaultProps: {
47
- alt: '',
48
- role: 'presentation',
49
- 'aria-hidden': true,
50
- hidden: imageHidden
12
+ export const useAvatar_unstable = (props, ref)=>{
13
+ const { dir } = useFluent();
14
+ const { shape: contextShape , size: contextSize } = useAvatarContext();
15
+ const { name , size =contextSize !== null && contextSize !== void 0 ? contextSize : 32 , shape =contextShape !== null && contextShape !== void 0 ? contextShape : 'circular' , active ='unset' , activeAppearance ='ring' , idForColor } = props;
16
+ let { color ='neutral' } = props;
17
+ // Resolve 'colorful' to a specific color name
18
+ if (color === 'colorful') {
19
+ var _ref;
20
+ color = avatarColors[getHashCode((_ref = idForColor !== null && idForColor !== void 0 ? idForColor : name) !== null && _ref !== void 0 ? _ref : '') % avatarColors.length];
51
21
  }
52
- });
53
- // Hide the image if it fails to load and restore it on a successful load
54
- if (image) {
55
- image.onError = mergeCallbacks(image.onError, () => setImageHidden(true));
56
- image.onLoad = mergeCallbacks(image.onLoad, () => setImageHidden(undefined));
57
- }
58
- // Resolve the initials slot, defaulted to getInitials.
59
- let initials = resolveShorthand(props.initials, {
60
- required: true,
61
- defaultProps: {
62
- children: getInitials(name, dir === 'rtl', {
63
- firstInitialOnly: size <= 16
64
- }),
65
- id: baseId + '__initials'
22
+ const baseId = useId('avatar-');
23
+ const root = getNativeElementProps('span', {
24
+ role: 'img',
25
+ id: baseId,
26
+ // aria-label and/or aria-labelledby are resolved below
27
+ ...props,
28
+ ref
29
+ }, /* excludedPropNames: */ [
30
+ 'name'
31
+ ]);
32
+ const [imageHidden, setImageHidden] = React.useState(undefined);
33
+ const image = resolveShorthand(props.image, {
34
+ defaultProps: {
35
+ alt: '',
36
+ role: 'presentation',
37
+ 'aria-hidden': true,
38
+ hidden: imageHidden
39
+ }
40
+ });
41
+ // Hide the image if it fails to load and restore it on a successful load
42
+ if (image) {
43
+ image.onError = mergeCallbacks(image.onError, ()=>setImageHidden(true));
44
+ image.onLoad = mergeCallbacks(image.onLoad, ()=>setImageHidden(undefined));
66
45
  }
67
- });
68
- // Don't render the initials slot if it's empty
69
- if (!(initials === null || initials === void 0 ? void 0 : initials.children)) {
70
- initials = undefined;
71
- }
72
- // Render the icon slot *only if* there aren't any initials or image to display
73
- let icon = undefined;
74
- if (!initials && (!image || imageHidden)) {
75
- icon = resolveShorthand(props.icon, {
76
- required: true,
77
- defaultProps: {
78
- children: /*#__PURE__*/React.createElement(PersonRegular, null),
79
- 'aria-hidden': true
80
- }
46
+ // Resolve the initials slot, defaulted to getInitials.
47
+ let initials = resolveShorthand(props.initials, {
48
+ required: true,
49
+ defaultProps: {
50
+ children: getInitials(name, dir === 'rtl', {
51
+ firstInitialOnly: size <= 16
52
+ }),
53
+ id: baseId + '__initials'
54
+ }
81
55
  });
82
- }
83
- const badge = resolveShorthand(props.badge, {
84
- defaultProps: {
85
- size: getBadgeSize(size),
86
- id: baseId + '__badge'
56
+ // Don't render the initials slot if it's empty
57
+ if (!(initials === null || initials === void 0 ? void 0 : initials.children)) {
58
+ initials = undefined;
87
59
  }
88
- });
89
- let activeAriaLabelElement;
90
- // Resolve aria-label and/or aria-labelledby if not provided by the user
91
- if (!root['aria-label'] && !root['aria-labelledby']) {
92
- if (name) {
93
- root['aria-label'] = name;
94
- // Include the badge in labelledby if it exists
95
- if (badge) {
96
- root['aria-labelledby'] = root.id + ' ' + badge.id;
97
- }
98
- } else if (initials) {
99
- // root's aria-label should be the name, but fall back to being labelledby the initials if name is missing
100
- root['aria-labelledby'] = initials.id + (badge ? ' ' + badge.id : '');
60
+ // Render the icon slot *only if* there aren't any initials or image to display
61
+ let icon = undefined;
62
+ if (!initials && (!image || imageHidden)) {
63
+ icon = resolveShorthand(props.icon, {
64
+ required: true,
65
+ defaultProps: {
66
+ children: /*#__PURE__*/ React.createElement(PersonRegular, null),
67
+ 'aria-hidden': true
68
+ }
69
+ });
101
70
  }
102
- // Add the active state to the aria label
103
- if (active === 'active' || active === 'inactive') {
104
- const activeText = DEFAULT_STRINGS[active];
105
- if (root['aria-labelledby']) {
106
- // If using aria-labelledby, render a hidden span and append it to the labelledby
107
- const activeId = baseId + '__active';
108
- root['aria-labelledby'] += ' ' + activeId;
109
- activeAriaLabelElement = /*#__PURE__*/React.createElement("span", {
110
- hidden: true,
111
- id: activeId
112
- }, activeText);
113
- } else if (root['aria-label']) {
114
- // Otherwise, just append it to the aria-label
115
- root['aria-label'] += ' ' + activeText;
116
- }
71
+ const badge = resolveShorthand(props.badge, {
72
+ defaultProps: {
73
+ size: getBadgeSize(size),
74
+ id: baseId + '__badge'
75
+ }
76
+ });
77
+ let activeAriaLabelElement;
78
+ // Resolve aria-label and/or aria-labelledby if not provided by the user
79
+ if (!root['aria-label'] && !root['aria-labelledby']) {
80
+ if (name) {
81
+ root['aria-label'] = name;
82
+ // Include the badge in labelledby if it exists
83
+ if (badge) {
84
+ root['aria-labelledby'] = root.id + ' ' + badge.id;
85
+ }
86
+ } else if (initials) {
87
+ // root's aria-label should be the name, but fall back to being labelledby the initials if name is missing
88
+ root['aria-labelledby'] = initials.id + (badge ? ' ' + badge.id : '');
89
+ }
90
+ // Add the active state to the aria label
91
+ if (active === 'active' || active === 'inactive') {
92
+ const activeText = DEFAULT_STRINGS[active];
93
+ if (root['aria-labelledby']) {
94
+ // If using aria-labelledby, render a hidden span and append it to the labelledby
95
+ const activeId = baseId + '__active';
96
+ root['aria-labelledby'] += ' ' + activeId;
97
+ activeAriaLabelElement = /*#__PURE__*/ React.createElement("span", {
98
+ hidden: true,
99
+ id: activeId
100
+ }, activeText);
101
+ } else if (root['aria-label']) {
102
+ // Otherwise, just append it to the aria-label
103
+ root['aria-label'] += ' ' + activeText;
104
+ }
105
+ }
117
106
  }
118
- }
119
- return {
120
- size,
121
- shape,
122
- active,
123
- activeAppearance,
124
- activeAriaLabelElement,
125
- color,
126
- components: {
127
- root: 'span',
128
- initials: 'span',
129
- icon: 'span',
130
- image: 'img',
131
- badge: PresenceBadge
132
- },
133
- root,
134
- initials,
135
- icon,
136
- image,
137
- badge
138
- };
107
+ return {
108
+ size,
109
+ shape,
110
+ active,
111
+ activeAppearance,
112
+ activeAriaLabelElement,
113
+ color,
114
+ components: {
115
+ root: 'span',
116
+ initials: 'span',
117
+ icon: 'span',
118
+ image: 'img',
119
+ badge: PresenceBadge
120
+ },
121
+ root,
122
+ initials,
123
+ icon,
124
+ image,
125
+ badge
126
+ };
139
127
  };
140
- const getBadgeSize = size => {
141
- if (size >= 96) {
142
- return 'extra-large';
143
- } else if (size >= 64) {
144
- return 'large';
145
- } else if (size >= 56) {
146
- return 'medium';
147
- } else if (size >= 40) {
148
- return 'small';
149
- } else if (size >= 28) {
150
- return 'extra-small';
151
- } else {
152
- return 'tiny';
153
- }
128
+ const getBadgeSize = (size)=>{
129
+ if (size >= 96) {
130
+ return 'extra-large';
131
+ } else if (size >= 64) {
132
+ return 'large';
133
+ } else if (size >= 56) {
134
+ return 'medium';
135
+ } else if (size >= 40) {
136
+ return 'small';
137
+ } else if (size >= 28) {
138
+ return 'extra-small';
139
+ } else {
140
+ return 'tiny';
141
+ }
154
142
  };
155
- const avatarColors = ['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'];
156
- const getHashCode = str => {
157
- let hashCode = 0;
158
- for (let len = str.length - 1; len >= 0; len--) {
159
- const ch = str.charCodeAt(len);
160
- const shift = len % 8;
161
- hashCode ^= (ch << shift) + (ch >> 8 - shift); // eslint-disable-line no-bitwise
162
- }
163
-
164
- return hashCode;
143
+ const avatarColors = [
144
+ 'dark-red',
145
+ 'cranberry',
146
+ 'red',
147
+ 'pumpkin',
148
+ 'peach',
149
+ 'marigold',
150
+ 'gold',
151
+ 'brass',
152
+ 'brown',
153
+ 'forest',
154
+ 'seafoam',
155
+ 'dark-green',
156
+ 'light-teal',
157
+ 'teal',
158
+ 'steel',
159
+ 'blue',
160
+ 'royal-blue',
161
+ 'cornflower',
162
+ 'navy',
163
+ 'lavender',
164
+ 'purple',
165
+ 'grape',
166
+ 'lilac',
167
+ 'pink',
168
+ 'magenta',
169
+ 'plum',
170
+ 'beige',
171
+ 'mink',
172
+ 'platinum',
173
+ 'anchor'
174
+ ];
175
+ const getHashCode = (str)=>{
176
+ let hashCode = 0;
177
+ for(let len = str.length - 1; len >= 0; len--){
178
+ const ch = str.charCodeAt(len);
179
+ const shift = len % 8;
180
+ hashCode ^= (ch << shift) + (ch >> 8 - shift); // eslint-disable-line no-bitwise
181
+ }
182
+ return hashCode;
165
183
  };
166
- //# sourceMappingURL=useAvatar.js.map