@fluentui/react-avatar 9.4.4 → 9.4.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 (202) hide show
  1. package/.swcrc +30 -0
  2. package/CHANGELOG.json +82 -1
  3. package/CHANGELOG.md +22 -2
  4. package/lib/Avatar.js.map +1 -1
  5. package/lib/AvatarGroup.js.map +1 -1
  6. package/lib/AvatarGroupItem.js.map +1 -1
  7. package/lib/AvatarGroupPopover.js.map +1 -1
  8. package/lib/components/Avatar/Avatar.js.map +1 -1
  9. package/lib/components/Avatar/Avatar.types.js.map +1 -1
  10. package/lib/components/Avatar/index.js.map +1 -1
  11. package/lib/components/Avatar/renderAvatar.js +1 -11
  12. package/lib/components/Avatar/renderAvatar.js.map +1 -1
  13. package/lib/components/Avatar/useAvatar.js +2 -2
  14. package/lib/components/Avatar/useAvatar.js.map +1 -1
  15. package/lib/components/Avatar/useAvatarStyles.js.map +1 -1
  16. package/lib/components/AvatarGroup/AvatarGroup.js.map +1 -1
  17. package/lib/components/AvatarGroup/AvatarGroup.types.js.map +1 -1
  18. package/lib/components/AvatarGroup/index.js.map +1 -1
  19. package/lib/components/AvatarGroup/renderAvatarGroup.js +1 -3
  20. package/lib/components/AvatarGroup/renderAvatarGroup.js.map +1 -1
  21. package/lib/components/AvatarGroup/useAvatarGroup.js +1 -0
  22. package/lib/components/AvatarGroup/useAvatarGroup.js.map +1 -1
  23. package/lib/components/AvatarGroup/useAvatarGroupContextValues.js.map +1 -1
  24. package/lib/components/AvatarGroup/useAvatarGroupStyles.js.map +1 -1
  25. package/lib/components/AvatarGroupItem/AvatarGroupItem.js.map +1 -1
  26. package/lib/components/AvatarGroupItem/AvatarGroupItem.types.js.map +1 -1
  27. package/lib/components/AvatarGroupItem/index.js.map +1 -1
  28. package/lib/components/AvatarGroupItem/renderAvatarGroupItem.js +1 -7
  29. package/lib/components/AvatarGroupItem/renderAvatarGroupItem.js.map +1 -1
  30. package/lib/components/AvatarGroupItem/useAvatarGroupItem.js +1 -0
  31. package/lib/components/AvatarGroupItem/useAvatarGroupItem.js.map +1 -1
  32. package/lib/components/AvatarGroupItem/useAvatarGroupItemStyles.js.map +1 -1
  33. package/lib/components/AvatarGroupPopover/AvatarGroupPopover.js +1 -0
  34. package/lib/components/AvatarGroupPopover/AvatarGroupPopover.js.map +1 -1
  35. package/lib/components/AvatarGroupPopover/AvatarGroupPopover.types.js +1 -1
  36. package/lib/components/AvatarGroupPopover/AvatarGroupPopover.types.js.map +1 -1
  37. package/lib/components/AvatarGroupPopover/index.js.map +1 -1
  38. package/lib/components/AvatarGroupPopover/renderAvatarGroupPopover.js +3 -13
  39. package/lib/components/AvatarGroupPopover/renderAvatarGroupPopover.js.map +1 -1
  40. package/lib/components/AvatarGroupPopover/useAvatarGroupPopover.js +4 -4
  41. package/lib/components/AvatarGroupPopover/useAvatarGroupPopover.js.map +1 -1
  42. package/lib/components/AvatarGroupPopover/useAvatarGroupPopoverContextValues.js.map +1 -1
  43. package/lib/components/AvatarGroupPopover/useAvatarGroupPopoverStyles.js.map +1 -1
  44. package/lib/contexts/AvatarContext.js +2 -4
  45. package/lib/contexts/AvatarContext.js.map +1 -1
  46. package/lib/contexts/AvatarGroupContext.js.map +1 -1
  47. package/lib/contexts/index.js.map +1 -1
  48. package/lib/index.js.map +1 -1
  49. package/lib/utils/getInitials.js +5 -8
  50. package/lib/utils/getInitials.js.map +1 -1
  51. package/lib/utils/index.js.map +1 -1
  52. package/lib/utils/partitionAvatarGroupItems.js +3 -4
  53. package/lib/utils/partitionAvatarGroupItems.js.map +1 -1
  54. package/lib-commonjs/Avatar.js +5 -4
  55. package/lib-commonjs/Avatar.js.map +1 -1
  56. package/lib-commonjs/AvatarGroup.js +5 -4
  57. package/lib-commonjs/AvatarGroup.js.map +1 -1
  58. package/lib-commonjs/AvatarGroupItem.js +5 -4
  59. package/lib-commonjs/AvatarGroupItem.js.map +1 -1
  60. package/lib-commonjs/AvatarGroupPopover.js +5 -4
  61. package/lib-commonjs/AvatarGroupPopover.js.map +1 -1
  62. package/lib-commonjs/components/Avatar/Avatar.js +19 -17
  63. package/lib-commonjs/components/Avatar/Avatar.js.map +1 -1
  64. package/lib-commonjs/components/Avatar/Avatar.types.js +3 -2
  65. package/lib-commonjs/components/Avatar/Avatar.types.js.map +1 -1
  66. package/lib-commonjs/components/Avatar/index.js +9 -8
  67. package/lib-commonjs/components/Avatar/index.js.map +1 -1
  68. package/lib-commonjs/components/Avatar/renderAvatar.js +13 -23
  69. package/lib-commonjs/components/Avatar/renderAvatar.js.map +1 -1
  70. package/lib-commonjs/components/Avatar/useAvatar.js +186 -158
  71. package/lib-commonjs/components/Avatar/useAvatar.js.map +1 -1
  72. package/lib-commonjs/components/Avatar/useAvatarStyles.js +889 -510
  73. package/lib-commonjs/components/Avatar/useAvatarStyles.js.map +1 -1
  74. package/lib-commonjs/components/AvatarGroup/AvatarGroup.js +21 -23
  75. package/lib-commonjs/components/AvatarGroup/AvatarGroup.js.map +1 -1
  76. package/lib-commonjs/components/AvatarGroup/AvatarGroup.types.js +3 -2
  77. package/lib-commonjs/components/AvatarGroup/AvatarGroup.types.js.map +1 -1
  78. package/lib-commonjs/components/AvatarGroup/index.js +10 -9
  79. package/lib-commonjs/components/AvatarGroup/index.js.map +1 -1
  80. package/lib-commonjs/components/AvatarGroup/renderAvatarGroup.js +16 -21
  81. package/lib-commonjs/components/AvatarGroup/renderAvatarGroup.js.map +1 -1
  82. package/lib-commonjs/components/AvatarGroup/useAvatarGroup.js +33 -33
  83. package/lib-commonjs/components/AvatarGroup/useAvatarGroup.js.map +1 -1
  84. package/lib-commonjs/components/AvatarGroup/useAvatarGroupContextValues.js +16 -17
  85. package/lib-commonjs/components/AvatarGroup/useAvatarGroupContextValues.js.map +1 -1
  86. package/lib-commonjs/components/AvatarGroup/useAvatarGroupStyles.js +47 -37
  87. package/lib-commonjs/components/AvatarGroup/useAvatarGroupStyles.js.map +1 -1
  88. package/lib-commonjs/components/AvatarGroupItem/AvatarGroupItem.js +19 -21
  89. package/lib-commonjs/components/AvatarGroupItem/AvatarGroupItem.js.map +1 -1
  90. package/lib-commonjs/components/AvatarGroupItem/AvatarGroupItem.types.js +3 -2
  91. package/lib-commonjs/components/AvatarGroupItem/AvatarGroupItem.types.js.map +1 -1
  92. package/lib-commonjs/components/AvatarGroupItem/index.js +9 -8
  93. package/lib-commonjs/components/AvatarGroupItem/index.js.map +1 -1
  94. package/lib-commonjs/components/AvatarGroupItem/renderAvatarGroupItem.js +13 -22
  95. package/lib-commonjs/components/AvatarGroupItem/renderAvatarGroupItem.js.map +1 -1
  96. package/lib-commonjs/components/AvatarGroupItem/useAvatarGroupItem.js +59 -68
  97. package/lib-commonjs/components/AvatarGroupItem/useAvatarGroupItem.js.map +1 -1
  98. package/lib-commonjs/components/AvatarGroupItem/useAvatarGroupItemStyles.js +379 -224
  99. package/lib-commonjs/components/AvatarGroupItem/useAvatarGroupItemStyles.js.map +1 -1
  100. package/lib-commonjs/components/AvatarGroupPopover/AvatarGroupPopover.js +21 -22
  101. package/lib-commonjs/components/AvatarGroupPopover/AvatarGroupPopover.js.map +1 -1
  102. package/lib-commonjs/components/AvatarGroupPopover/AvatarGroupPopover.types.js +5 -2
  103. package/lib-commonjs/components/AvatarGroupPopover/AvatarGroupPopover.types.js.map +1 -1
  104. package/lib-commonjs/components/AvatarGroupPopover/index.js +9 -8
  105. package/lib-commonjs/components/AvatarGroupPopover/index.js.map +1 -1
  106. package/lib-commonjs/components/AvatarGroupPopover/renderAvatarGroupPopover.js +19 -32
  107. package/lib-commonjs/components/AvatarGroupPopover/renderAvatarGroupPopover.js.map +1 -1
  108. package/lib-commonjs/components/AvatarGroupPopover/useAvatarGroupPopover.js +89 -99
  109. package/lib-commonjs/components/AvatarGroupPopover/useAvatarGroupPopover.js.map +1 -1
  110. package/lib-commonjs/components/AvatarGroupPopover/useAvatarGroupPopoverContextValues.js +15 -13
  111. package/lib-commonjs/components/AvatarGroupPopover/useAvatarGroupPopoverContextValues.js.map +1 -1
  112. package/lib-commonjs/components/AvatarGroupPopover/useAvatarGroupPopoverStyles.js +527 -272
  113. package/lib-commonjs/components/AvatarGroupPopover/useAvatarGroupPopoverStyles.js.map +1 -1
  114. package/lib-commonjs/contexts/AvatarContext.js +18 -17
  115. package/lib-commonjs/contexts/AvatarContext.js.map +1 -1
  116. package/lib-commonjs/contexts/AvatarGroupContext.js +17 -12
  117. package/lib-commonjs/contexts/AvatarGroupContext.js.map +1 -1
  118. package/lib-commonjs/contexts/index.js +6 -5
  119. package/lib-commonjs/contexts/index.js.map +1 -1
  120. package/lib-commonjs/index.js +45 -172
  121. package/lib-commonjs/index.js.map +1 -1
  122. package/lib-commonjs/utils/getInitials.js +44 -60
  123. package/lib-commonjs/utils/getInitials.js.map +1 -1
  124. package/lib-commonjs/utils/index.js +14 -16
  125. package/lib-commonjs/utils/index.js.map +1 -1
  126. package/lib-commonjs/utils/partitionAvatarGroupItems.js +25 -26
  127. package/lib-commonjs/utils/partitionAvatarGroupItems.js.map +1 -1
  128. package/package.json +14 -13
  129. package/lib-amd/Avatar.js +0 -6
  130. package/lib-amd/Avatar.js.map +0 -1
  131. package/lib-amd/AvatarGroup.js +0 -6
  132. package/lib-amd/AvatarGroup.js.map +0 -1
  133. package/lib-amd/AvatarGroupItem.js +0 -6
  134. package/lib-amd/AvatarGroupItem.js.map +0 -1
  135. package/lib-amd/AvatarGroupPopover.js +0 -6
  136. package/lib-amd/AvatarGroupPopover.js.map +0 -1
  137. package/lib-amd/components/Avatar/Avatar.js +0 -14
  138. package/lib-amd/components/Avatar/Avatar.js.map +0 -1
  139. package/lib-amd/components/Avatar/Avatar.types.js +0 -5
  140. package/lib-amd/components/Avatar/Avatar.types.js.map +0 -1
  141. package/lib-amd/components/Avatar/index.js +0 -10
  142. package/lib-amd/components/Avatar/index.js.map +0 -1
  143. package/lib-amd/components/Avatar/renderAvatar.js +0 -16
  144. package/lib-amd/components/Avatar/renderAvatar.js.map +0 -1
  145. package/lib-amd/components/Avatar/useAvatar.js +0 -178
  146. package/lib-amd/components/Avatar/useAvatar.js.map +0 -1
  147. package/lib-amd/components/Avatar/useAvatarStyles.js +0 -425
  148. package/lib-amd/components/Avatar/useAvatarStyles.js.map +0 -1
  149. package/lib-amd/components/AvatarGroup/AvatarGroup.js +0 -19
  150. package/lib-amd/components/AvatarGroup/AvatarGroup.js.map +0 -1
  151. package/lib-amd/components/AvatarGroup/AvatarGroup.types.js +0 -5
  152. package/lib-amd/components/AvatarGroup/AvatarGroup.types.js.map +0 -1
  153. package/lib-amd/components/AvatarGroup/index.js +0 -11
  154. package/lib-amd/components/AvatarGroup/index.js.map +0 -1
  155. package/lib-amd/components/AvatarGroup/renderAvatarGroup.js +0 -15
  156. package/lib-amd/components/AvatarGroup/renderAvatarGroup.js.map +0 -1
  157. package/lib-amd/components/AvatarGroup/useAvatarGroup.js +0 -29
  158. package/lib-amd/components/AvatarGroup/useAvatarGroup.js.map +0 -1
  159. package/lib-amd/components/AvatarGroup/useAvatarGroupContextValues.js +0 -15
  160. package/lib-amd/components/AvatarGroup/useAvatarGroupContextValues.js.map +0 -1
  161. package/lib-amd/components/AvatarGroup/useAvatarGroupStyles.js +0 -36
  162. package/lib-amd/components/AvatarGroup/useAvatarGroupStyles.js.map +0 -1
  163. package/lib-amd/components/AvatarGroupItem/AvatarGroupItem.js +0 -18
  164. package/lib-amd/components/AvatarGroupItem/AvatarGroupItem.js.map +0 -1
  165. package/lib-amd/components/AvatarGroupItem/AvatarGroupItem.types.js +0 -5
  166. package/lib-amd/components/AvatarGroupItem/AvatarGroupItem.types.js.map +0 -1
  167. package/lib-amd/components/AvatarGroupItem/index.js +0 -10
  168. package/lib-amd/components/AvatarGroupItem/index.js.map +0 -1
  169. package/lib-amd/components/AvatarGroupItem/renderAvatarGroupItem.js +0 -16
  170. package/lib-amd/components/AvatarGroupItem/renderAvatarGroupItem.js.map +0 -1
  171. package/lib-amd/components/AvatarGroupItem/useAvatarGroupItem.js +0 -58
  172. package/lib-amd/components/AvatarGroupItem/useAvatarGroupItem.js.map +0 -1
  173. package/lib-amd/components/AvatarGroupItem/useAvatarGroupItemStyles.js +0 -236
  174. package/lib-amd/components/AvatarGroupItem/useAvatarGroupItemStyles.js.map +0 -1
  175. package/lib-amd/components/AvatarGroupPopover/AvatarGroupPopover.js +0 -19
  176. package/lib-amd/components/AvatarGroupPopover/AvatarGroupPopover.js.map +0 -1
  177. package/lib-amd/components/AvatarGroupPopover/AvatarGroupPopover.types.js +0 -5
  178. package/lib-amd/components/AvatarGroupPopover/AvatarGroupPopover.types.js.map +0 -1
  179. package/lib-amd/components/AvatarGroupPopover/index.js +0 -10
  180. package/lib-amd/components/AvatarGroupPopover/index.js.map +0 -1
  181. package/lib-amd/components/AvatarGroupPopover/renderAvatarGroupPopover.js +0 -20
  182. package/lib-amd/components/AvatarGroupPopover/renderAvatarGroupPopover.js.map +0 -1
  183. package/lib-amd/components/AvatarGroupPopover/useAvatarGroupPopover.js +0 -86
  184. package/lib-amd/components/AvatarGroupPopover/useAvatarGroupPopover.js.map +0 -1
  185. package/lib-amd/components/AvatarGroupPopover/useAvatarGroupPopoverContextValues.js +0 -14
  186. package/lib-amd/components/AvatarGroupPopover/useAvatarGroupPopoverContextValues.js.map +0 -1
  187. package/lib-amd/components/AvatarGroupPopover/useAvatarGroupPopoverStyles.js +0 -136
  188. package/lib-amd/components/AvatarGroupPopover/useAvatarGroupPopoverStyles.js.map +0 -1
  189. package/lib-amd/contexts/AvatarContext.js +0 -17
  190. package/lib-amd/contexts/AvatarContext.js.map +0 -1
  191. package/lib-amd/contexts/AvatarGroupContext.js +0 -20
  192. package/lib-amd/contexts/AvatarGroupContext.js.map +0 -1
  193. package/lib-amd/contexts/index.js +0 -7
  194. package/lib-amd/contexts/index.js.map +0 -1
  195. package/lib-amd/index.js +0 -33
  196. package/lib-amd/index.js.map +0 -1
  197. package/lib-amd/utils/getInitials.js +0 -87
  198. package/lib-amd/utils/getInitials.js.map +0 -1
  199. package/lib-amd/utils/index.js +0 -8
  200. package/lib-amd/utils/index.js.map +0 -1
  201. package/lib-amd/utils/partitionAvatarGroupItems.js +0 -32
  202. package/lib-amd/utils/partitionAvatarGroupItems.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"names":["UNWANTED_ENCLOSURES_REGEX","UNWANTED_CHARS_REGEX","PHONENUMBER_REGEX","MULTIPLE_WHITESPACES_REGEX","UNSUPPORTED_TEXT_REGEX","getInitialsLatin","displayName","isRtl","firstInitialOnly","initials","splits","split","length","charAt","toUpperCase","cleanupDisplayName","replace","trim","getInitials","options","test","allowPhoneInitials","exports"],"sources":["../src/packages/react-components/react-avatar/src/utils/getInitials.ts"],"sourcesContent":["/**\n * Regular expressions matching characters to ignore when calculating the initials.\n */\n\n/**\n * Regular expression matching characters within various types of enclosures, including the enclosures themselves\n * so for example, (xyz) [xyz] {xyz} all would be ignored\n */\nconst UNWANTED_ENCLOSURES_REGEX: RegExp = /[\\(\\[\\{][^\\)\\]\\}]*[\\)\\]\\}]/g;\n\n/**\n * Regular expression matching special ASCII characters except space, plus some unicode special characters.\n * Applies after unwanted enclosures have been removed\n */\nconst UNWANTED_CHARS_REGEX: RegExp = /[\\0-\\u001F\\!-/:-@\\[-`\\{-\\u00BF\\u0250-\\u036F\\uD800-\\uFFFF]/g;\n\n/**\n * Regular expression matching phone numbers. Applied after chars matching UNWANTED_CHARS_REGEX have been removed\n * and number has been trimmed for whitespaces\n */\nconst PHONENUMBER_REGEX: RegExp = /^\\d+[\\d\\s]*(:?ext|x|)\\s*\\d+$/i;\n\n/** Regular expression matching one or more spaces. */\nconst MULTIPLE_WHITESPACES_REGEX: RegExp = /\\s+/g;\n\n/**\n * Regular expression matching languages for which we currently don't support initials.\n * Arabic: Arabic, Arabic Supplement, Arabic Extended-A.\n * Korean: Hangul Jamo, Hangul Compatibility Jamo, Hangul Jamo Extended-A, Hangul Syllables, Hangul Jamo Extended-B.\n * Japanese: Hiragana, Katakana.\n * CJK: CJK Unified Ideographs Extension A, CJK Unified Ideographs, CJK Compatibility Ideographs,\n * CJK Unified Ideographs Extension B\n */\n// eslint-disable-next-line @fluentui/max-len\nconst UNSUPPORTED_TEXT_REGEX: RegExp =\n /[\\u0600-\\u06FF\\u0750-\\u077F\\u08A0-\\u08FF\\u1100-\\u11FF\\u3130-\\u318F\\uA960-\\uA97F\\uAC00-\\uD7AF\\uD7B0-\\uD7FF\\u3040-\\u309F\\u30A0-\\u30FF\\u3400-\\u4DBF\\u4E00-\\u9FFF\\uF900-\\uFAFF]|[\\uD840-\\uD869][\\uDC00-\\uDED6]/;\n\nfunction getInitialsLatin(displayName: string, isRtl: boolean, firstInitialOnly?: boolean): string {\n let initials = '';\n\n const splits: string[] = displayName.split(' ');\n if (splits.length !== 0) {\n initials += splits[0].charAt(0).toUpperCase();\n }\n\n if (!firstInitialOnly) {\n if (splits.length === 2) {\n initials += splits[1].charAt(0).toUpperCase();\n } else if (splits.length === 3) {\n initials += splits[2].charAt(0).toUpperCase();\n }\n }\n\n if (isRtl && initials.length > 1) {\n return initials.charAt(1) + initials.charAt(0);\n }\n\n return initials;\n}\n\nfunction cleanupDisplayName(displayName: string): string {\n displayName = displayName.replace(UNWANTED_ENCLOSURES_REGEX, '');\n displayName = displayName.replace(UNWANTED_CHARS_REGEX, '');\n displayName = displayName.replace(MULTIPLE_WHITESPACES_REGEX, ' ');\n displayName = displayName.trim();\n\n return displayName;\n}\n\n/**\n * Get (up to 2 characters) initials based on display name of the persona.\n *\n * @param displayName - The full name of the person or entity\n * @param isRtl - Whether the display is in RTL\n * @param options - Extra options to control the behavior of getInitials\n *\n * @returns The 1 or 2 character initials based on the name. Or an empty string if no initials\n * could be derived from the name.\n *\n * @internal\n */\nexport function getInitials(\n displayName: string | undefined | null,\n isRtl: boolean,\n options?: {\n /** Should initials be generated from phone numbers (default false) */\n allowPhoneInitials?: boolean;\n\n /** Returns only the first initial */\n firstInitialOnly?: boolean;\n },\n): string {\n if (!displayName) {\n return '';\n }\n\n displayName = cleanupDisplayName(displayName);\n\n // For names containing CJK characters, and phone numbers, we don't display initials\n if (\n UNSUPPORTED_TEXT_REGEX.test(displayName) ||\n (!options?.allowPhoneInitials && PHONENUMBER_REGEX.test(displayName))\n ) {\n return '';\n }\n\n return getInitialsLatin(displayName, isRtl, options?.firstInitialOnly);\n}\n"],"mappings":";;AAAA;;;;;;;AAIA;;;;AAIA,MAAMA,yBAAyB,GAAW,6BAA6B;AAEvE;;;;AAIA,MAAMC,oBAAoB,GAAW,4DAA4D;AAEjG;;;;AAIA,MAAMC,iBAAiB,GAAW,+BAA+B;AAEjE;AACA,MAAMC,0BAA0B,GAAW,MAAM;AAEjD;;;;;;;;AAQA;AACA,MAAMC,sBAAsB,GAC1B,4MAA4M;AAE9M,SAASC,gBAAgBA,CAACC,WAAmB,EAAEC,KAAc,EAAEC,gBAA0B;EACvF,IAAIC,QAAQ,GAAG,EAAE;EAEjB,MAAMC,MAAM,GAAaJ,WAAW,CAACK,KAAK,CAAC,GAAG,CAAC;EAC/C,IAAID,MAAM,CAACE,MAAM,KAAK,CAAC,EAAE;IACvBH,QAAQ,IAAIC,MAAM,CAAC,CAAC,CAAC,CAACG,MAAM,CAAC,CAAC,CAAC,CAACC,WAAW,EAAE;;EAG/C,IAAI,CAACN,gBAAgB,EAAE;IACrB,IAAIE,MAAM,CAACE,MAAM,KAAK,CAAC,EAAE;MACvBH,QAAQ,IAAIC,MAAM,CAAC,CAAC,CAAC,CAACG,MAAM,CAAC,CAAC,CAAC,CAACC,WAAW,EAAE;KAC9C,MAAM,IAAIJ,MAAM,CAACE,MAAM,KAAK,CAAC,EAAE;MAC9BH,QAAQ,IAAIC,MAAM,CAAC,CAAC,CAAC,CAACG,MAAM,CAAC,CAAC,CAAC,CAACC,WAAW,EAAE;;;EAIjD,IAAIP,KAAK,IAAIE,QAAQ,CAACG,MAAM,GAAG,CAAC,EAAE;IAChC,OAAOH,QAAQ,CAACI,MAAM,CAAC,CAAC,CAAC,GAAGJ,QAAQ,CAACI,MAAM,CAAC,CAAC,CAAC;;EAGhD,OAAOJ,QAAQ;AACjB;AAEA,SAASM,kBAAkBA,CAACT,WAAmB;EAC7CA,WAAW,GAAGA,WAAW,CAACU,OAAO,CAAChB,yBAAyB,EAAE,EAAE,CAAC;EAChEM,WAAW,GAAGA,WAAW,CAACU,OAAO,CAACf,oBAAoB,EAAE,EAAE,CAAC;EAC3DK,WAAW,GAAGA,WAAW,CAACU,OAAO,CAACb,0BAA0B,EAAE,GAAG,CAAC;EAClEG,WAAW,GAAGA,WAAW,CAACW,IAAI,EAAE;EAEhC,OAAOX,WAAW;AACpB;AAEA;;;;;;;;;;;;AAYA,SAAgBY,WAAWA,CACzBZ,WAAsC,EACtCC,KAAc,EACdY,OAMC;EAED,IAAI,CAACb,WAAW,EAAE;IAChB,OAAO,EAAE;;EAGXA,WAAW,GAAGS,kBAAkB,CAACT,WAAW,CAAC;EAE7C;EACA,IACEF,sBAAsB,CAACgB,IAAI,CAACd,WAAW,CAAC,IACvC,EAACa,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEE,kBAAkB,KAAInB,iBAAiB,CAACkB,IAAI,CAACd,WAAW,CAAE,EACrE;IACA,OAAO,EAAE;;EAGX,OAAOD,gBAAgB,CAACC,WAAW,EAAEC,KAAK,EAAEY,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAEX,gBAAgB,CAAC;AACxE;AA1BAc,OAAA,CAAAJ,WAAA,GAAAA,WAAA"}
1
+ {"version":3,"sources":["../../lib/utils/getInitials.js"],"sourcesContent":["/**\n * Regular expressions matching characters to ignore when calculating the initials.\n */ /**\n * Regular expression matching characters within various types of enclosures, including the enclosures themselves\n * so for example, (xyz) [xyz] {xyz} all would be ignored\n */const UNWANTED_ENCLOSURES_REGEX = /[\\(\\[\\{][^\\)\\]\\}]*[\\)\\]\\}]/g;\n/**\n * Regular expression matching special ASCII characters except space, plus some unicode special characters.\n * Applies after unwanted enclosures have been removed\n */\nconst UNWANTED_CHARS_REGEX = /[\\0-\\u001F\\!-/:-@\\[-`\\{-\\u00BF\\u0250-\\u036F\\uD800-\\uFFFF]/g;\n/**\n * Regular expression matching phone numbers. Applied after chars matching UNWANTED_CHARS_REGEX have been removed\n * and number has been trimmed for whitespaces\n */\nconst PHONENUMBER_REGEX = /^\\d+[\\d\\s]*(:?ext|x|)\\s*\\d+$/i;\n/** Regular expression matching one or more spaces. */\nconst MULTIPLE_WHITESPACES_REGEX = /\\s+/g;\n/**\n * Regular expression matching languages for which we currently don't support initials.\n * Arabic: Arabic, Arabic Supplement, Arabic Extended-A.\n * Korean: Hangul Jamo, Hangul Compatibility Jamo, Hangul Jamo Extended-A, Hangul Syllables, Hangul Jamo Extended-B.\n * Japanese: Hiragana, Katakana.\n * CJK: CJK Unified Ideographs Extension A, CJK Unified Ideographs, CJK Compatibility Ideographs,\n * CJK Unified Ideographs Extension B\n */ // eslint-disable-next-line @fluentui/max-len\nconst UNSUPPORTED_TEXT_REGEX = /[\\u0600-\\u06FF\\u0750-\\u077F\\u08A0-\\u08FF\\u1100-\\u11FF\\u3130-\\u318F\\uA960-\\uA97F\\uAC00-\\uD7AF\\uD7B0-\\uD7FF\\u3040-\\u309F\\u30A0-\\u30FF\\u3400-\\u4DBF\\u4E00-\\u9FFF\\uF900-\\uFAFF]|[\\uD840-\\uD869][\\uDC00-\\uDED6]/;\nfunction getInitialsLatin(displayName, isRtl, firstInitialOnly) {\n let initials = '';\n const splits = displayName.split(' ');\n if (splits.length !== 0) {\n initials += splits[0].charAt(0).toUpperCase();\n }\n if (!firstInitialOnly) {\n if (splits.length === 2) {\n initials += splits[1].charAt(0).toUpperCase();\n } else if (splits.length === 3) {\n initials += splits[2].charAt(0).toUpperCase();\n }\n }\n if (isRtl && initials.length > 1) {\n return initials.charAt(1) + initials.charAt(0);\n }\n return initials;\n}\nfunction cleanupDisplayName(displayName) {\n displayName = displayName.replace(UNWANTED_ENCLOSURES_REGEX, '');\n displayName = displayName.replace(UNWANTED_CHARS_REGEX, '');\n displayName = displayName.replace(MULTIPLE_WHITESPACES_REGEX, ' ');\n displayName = displayName.trim();\n return displayName;\n}\n/**\n * Get (up to 2 characters) initials based on display name of the persona.\n *\n * @param displayName - The full name of the person or entity\n * @param isRtl - Whether the display is in RTL\n * @param options - Extra options to control the behavior of getInitials\n *\n * @returns The 1 or 2 character initials based on the name. Or an empty string if no initials\n * could be derived from the name.\n *\n * @internal\n */\nexport function getInitials(displayName, isRtl, options) {\n if (!displayName) {\n return '';\n }\n displayName = cleanupDisplayName(displayName);\n // For names containing CJK characters, and phone numbers, we don't display initials\n if (UNSUPPORTED_TEXT_REGEX.test(displayName) || !(options === null || options === void 0 ? void 0 : options.allowPhoneInitials) && PHONENUMBER_REGEX.test(displayName)) {\n return '';\n }\n return getInitialsLatin(displayName, isRtl, options === null || options === void 0 ? void 0 : options.firstInitialOnly);\n}\n//# sourceMappingURL=getInitials.js.map"],"names":["getInitials","UNWANTED_ENCLOSURES_REGEX","UNWANTED_CHARS_REGEX","PHONENUMBER_REGEX","MULTIPLE_WHITESPACES_REGEX","UNSUPPORTED_TEXT_REGEX","getInitialsLatin","displayName","isRtl","firstInitialOnly","initials","splits","split","length","charAt","toUpperCase","cleanupDisplayName","replace","trim","options","test","allowPhoneInitials"],"mappings":"AAAA;;CAEC,GAAG;;;IAGA;;;;+BA2DYA;;aAAAA;;AA3DV,MAAMC,4BAA4B;AACxC;;;CAGC,GACD,MAAMC,uBAAuB;AAC7B;;;CAGC,GACD,MAAMC,oBAAoB;AAC1B,oDAAoD,GACpD,MAAMC,6BAA6B;AACnC;;;;;;;CAOC,GAAG,6CAA6C;AACjD,MAAMC,yBAAyB;AAC/B,SAASC,iBAAiBC,WAAW,EAAEC,KAAK,EAAEC,gBAAgB,EAAE;IAC9D,IAAIC,WAAW;IACf,MAAMC,SAASJ,YAAYK,KAAK,CAAC;IACjC,IAAID,OAAOE,MAAM,KAAK,GAAG;QACvBH,YAAYC,MAAM,CAAC,EAAE,CAACG,MAAM,CAAC,GAAGC,WAAW;IAC7C,CAAC;IACD,IAAI,CAACN,kBAAkB;QACrB,IAAIE,OAAOE,MAAM,KAAK,GAAG;YACvBH,YAAYC,MAAM,CAAC,EAAE,CAACG,MAAM,CAAC,GAAGC,WAAW;QAC7C,OAAO,IAAIJ,OAAOE,MAAM,KAAK,GAAG;YAC9BH,YAAYC,MAAM,CAAC,EAAE,CAACG,MAAM,CAAC,GAAGC,WAAW;QAC7C,CAAC;IACH,CAAC;IACD,IAAIP,SAASE,SAASG,MAAM,GAAG,GAAG;QAChC,OAAOH,SAASI,MAAM,CAAC,KAAKJ,SAASI,MAAM,CAAC;IAC9C,CAAC;IACD,OAAOJ;AACT;AACA,SAASM,mBAAmBT,WAAW,EAAE;IACvCA,cAAcA,YAAYU,OAAO,CAAChB,2BAA2B;IAC7DM,cAAcA,YAAYU,OAAO,CAACf,sBAAsB;IACxDK,cAAcA,YAAYU,OAAO,CAACb,4BAA4B;IAC9DG,cAAcA,YAAYW,IAAI;IAC9B,OAAOX;AACT;AAaO,SAASP,YAAYO,WAAW,EAAEC,KAAK,EAAEW,OAAO,EAAE;IACvD,IAAI,CAACZ,aAAa;QAChB,OAAO;IACT,CAAC;IACDA,cAAcS,mBAAmBT;IACjC,oFAAoF;IACpF,IAAIF,uBAAuBe,IAAI,CAACb,gBAAgB,CAAEY,CAAAA,YAAY,IAAI,IAAIA,YAAY,KAAK,IAAI,KAAK,IAAIA,QAAQE,kBAAkB,AAAD,KAAMlB,kBAAkBiB,IAAI,CAACb,cAAc;QACtK,OAAO;IACT,CAAC;IACD,OAAOD,iBAAiBC,aAAaC,OAAOW,YAAY,IAAI,IAAIA,YAAY,KAAK,IAAI,KAAK,IAAIA,QAAQV,gBAAgB;AACxH,EACA,uCAAuC"}
@@ -1,21 +1,19 @@
1
1
  "use strict";
2
-
3
2
  Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.partitionAvatarGroupItems = exports.getInitials = void 0;
7
- var getInitials_1 = /*#__PURE__*/require("./getInitials");
8
- Object.defineProperty(exports, "getInitials", {
9
- enumerable: true,
10
- get: function () {
11
- return getInitials_1.getInitials;
12
- }
3
+ value: true
13
4
  });
14
- var partitionAvatarGroupItems_1 = /*#__PURE__*/require("./partitionAvatarGroupItems");
15
- Object.defineProperty(exports, "partitionAvatarGroupItems", {
16
- enumerable: true,
17
- get: function () {
18
- return partitionAvatarGroupItems_1.partitionAvatarGroupItems;
19
- }
5
+ function _export(target, all) {
6
+ for(var name in all)Object.defineProperty(target, name, {
7
+ enumerable: true,
8
+ get: all[name]
9
+ });
10
+ }
11
+ _export(exports, {
12
+ getInitials: ()=>_getInitials.getInitials,
13
+ partitionAvatarGroupItems: ()=>_partitionAvatarGroupItems.partitionAvatarGroupItems
20
14
  });
15
+ const _getInitials = require("./getInitials");
16
+ const _partitionAvatarGroupItems = require("./partitionAvatarGroupItems");
17
+ //# sourceMappingURL=index.js.map
18
+
21
19
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["getInitials_1","require","Object","defineProperty","exports","enumerable","get","getInitials","partitionAvatarGroupItems_1","partitionAvatarGroupItems"],"sources":["../src/packages/react-components/react-avatar/src/utils/index.ts"],"sourcesContent":["export { getInitials } from './getInitials';\nexport { partitionAvatarGroupItems } from './partitionAvatarGroupItems';\nexport type { PartitionAvatarGroupItems, PartitionAvatarGroupItemsOptions } from './partitionAvatarGroupItems';\n"],"mappings":";;;;;;AAAA,IAAAA,aAAA,gBAAAC,OAAA;AAASC,MAAA,CAAAC,cAAA,CAAAC,OAAA;EAAAC,UAAA;EAAAC,GAAA,WAAAA,CAAA;IAAA,OAAAN,aAAA,CAAAO,WAAW;EAAA;AAAA;AACpB,IAAAC,2BAAA,gBAAAP,OAAA;AAASC,MAAA,CAAAC,cAAA,CAAAC,OAAA;EAAAC,UAAA;EAAAC,GAAA,WAAAA,CAAA;IAAA,OAAAE,2BAAA,CAAAC,yBAAyB;EAAA;AAAA"}
1
+ {"version":3,"sources":["../../lib/utils/index.js"],"sourcesContent":["export { getInitials } from './getInitials';\nexport { partitionAvatarGroupItems } from './partitionAvatarGroupItems';\n//# sourceMappingURL=index.js.map"],"names":["getInitials","partitionAvatarGroupItems"],"mappings":";;;;;;;;;;;IAASA,WAAW,MAAXA,wBAAW;IACXC,yBAAyB,MAAzBA,oDAAyB;;6BADN;2CACc;CAC1C,iCAAiC"}
@@ -1,35 +1,34 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.partitionAvatarGroupItems = void 0;
7
1
  /**
8
2
  * Get the inline items and overflowing items based on the array of AvatarGroupItems needed for AvatarGroup.
9
3
  *
10
4
  * @param options - Configure the partition options
11
5
  *
12
6
  * @returns Two arrays split into inline items and overflow items based on maxInlineItems.
13
- */
14
- const partitionAvatarGroupItems = options => {
15
- var _a;
16
- const {
17
- items
18
- } = options;
19
- const isPie = options.layout === 'pie';
20
- if (isPie) {
7
+ */ "use strict";
8
+ Object.defineProperty(exports, "__esModule", {
9
+ value: true
10
+ });
11
+ Object.defineProperty(exports, "partitionAvatarGroupItems", {
12
+ enumerable: true,
13
+ get: ()=>partitionAvatarGroupItems
14
+ });
15
+ const partitionAvatarGroupItems = (options)=>{
16
+ const { items } = options;
17
+ const isPie = options.layout === 'pie';
18
+ if (isPie) {
19
+ return {
20
+ inlineItems: items.slice(0, 3),
21
+ overflowItems: items.length > 0 ? items : undefined
22
+ };
23
+ }
24
+ var _options_maxInlineItems;
25
+ const maxInlineItems = (_options_maxInlineItems = options.maxInlineItems) !== null && _options_maxInlineItems !== void 0 ? _options_maxInlineItems : 5;
26
+ const inlineCount = -(maxInlineItems - (items.length > maxInlineItems ? 1 : 0));
27
+ const overflowItems = items.slice(0, inlineCount);
21
28
  return {
22
- inlineItems: items.slice(0, 3),
23
- overflowItems: items.length > 0 ? items : undefined
29
+ inlineItems: items.slice(inlineCount),
30
+ overflowItems: overflowItems.length > 0 ? overflowItems : undefined
24
31
  };
25
- }
26
- const maxInlineItems = (_a = options.maxInlineItems) !== null && _a !== void 0 ? _a : 5;
27
- const inlineCount = -(maxInlineItems - (items.length > maxInlineItems ? 1 : 0));
28
- const overflowItems = items.slice(0, inlineCount);
29
- return {
30
- inlineItems: items.slice(inlineCount),
31
- overflowItems: overflowItems.length > 0 ? overflowItems : undefined
32
- };
33
- };
34
- exports.partitionAvatarGroupItems = partitionAvatarGroupItems;
32
+ }; //# sourceMappingURL=partitionAvatarGroupItems.js.map
33
+
35
34
  //# sourceMappingURL=partitionAvatarGroupItems.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["partitionAvatarGroupItems","options","items","isPie","layout","inlineItems","slice","overflowItems","length","undefined","maxInlineItems","_a","inlineCount","exports"],"sources":["../src/packages/react-components/react-avatar/src/utils/partitionAvatarGroupItems.ts"],"sourcesContent":["export type PartitionAvatarGroupItemsOptions<T> = {\n items: readonly T[];\n layout?: 'spread' | 'stack' | 'pie';\n maxInlineItems?: number;\n};\n\nexport type PartitionAvatarGroupItems<T> = {\n inlineItems: readonly T[];\n overflowItems?: readonly T[];\n};\n\n/**\n * Get the inline items and overflowing items based on the array of AvatarGroupItems needed for AvatarGroup.\n *\n * @param options - Configure the partition options\n *\n * @returns Two arrays split into inline items and overflow items based on maxInlineItems.\n */\nexport const partitionAvatarGroupItems = <T>(\n options: PartitionAvatarGroupItemsOptions<T>,\n): PartitionAvatarGroupItems<T> => {\n const { items } = options;\n const isPie = options.layout === 'pie';\n\n if (isPie) {\n return {\n inlineItems: items.slice(0, 3),\n overflowItems: items.length > 0 ? items : undefined,\n };\n }\n\n const maxInlineItems = options.maxInlineItems ?? 5;\n const inlineCount = -(maxInlineItems - (items.length > maxInlineItems ? 1 : 0));\n const overflowItems = items.slice(0, inlineCount);\n\n return {\n inlineItems: items.slice(inlineCount),\n overflowItems: overflowItems.length > 0 ? overflowItems : undefined,\n };\n};\n"],"mappings":";;;;;;AAWA;;;;;;;AAOO,MAAMA,yBAAyB,GACpCC,OAA4C,IACZ;;EAChC,MAAM;IAAEC;EAAK,CAAE,GAAGD,OAAO;EACzB,MAAME,KAAK,GAAGF,OAAO,CAACG,MAAM,KAAK,KAAK;EAEtC,IAAID,KAAK,EAAE;IACT,OAAO;MACLE,WAAW,EAAEH,KAAK,CAACI,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC;MAC9BC,aAAa,EAAEL,KAAK,CAACM,MAAM,GAAG,CAAC,GAAGN,KAAK,GAAGO;KAC3C;;EAGH,MAAMC,cAAc,GAAG,CAAAC,EAAA,GAAAV,OAAO,CAACS,cAAc,cAAAC,EAAA,cAAAA,EAAA,GAAI,CAAC;EAClD,MAAMC,WAAW,GAAG,EAAEF,cAAc,IAAIR,KAAK,CAACM,MAAM,GAAGE,cAAc,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;EAC/E,MAAMH,aAAa,GAAGL,KAAK,CAACI,KAAK,CAAC,CAAC,EAAEM,WAAW,CAAC;EAEjD,OAAO;IACLP,WAAW,EAAEH,KAAK,CAACI,KAAK,CAACM,WAAW,CAAC;IACrCL,aAAa,EAAEA,aAAa,CAACC,MAAM,GAAG,CAAC,GAAGD,aAAa,GAAGE;GAC3D;AACH,CAAC;AArBYI,OAAA,CAAAb,yBAAyB,GAAAA,yBAAA"}
1
+ {"version":3,"sources":["../../lib/utils/partitionAvatarGroupItems.js"],"sourcesContent":["/**\n * Get the inline items and overflowing items based on the array of AvatarGroupItems needed for AvatarGroup.\n *\n * @param options - Configure the partition options\n *\n * @returns Two arrays split into inline items and overflow items based on maxInlineItems.\n */export const partitionAvatarGroupItems = options => {\n const {\n items\n } = options;\n const isPie = options.layout === 'pie';\n if (isPie) {\n return {\n inlineItems: items.slice(0, 3),\n overflowItems: items.length > 0 ? items : undefined\n };\n }\n var _options_maxInlineItems;\n const maxInlineItems = (_options_maxInlineItems = options.maxInlineItems) !== null && _options_maxInlineItems !== void 0 ? _options_maxInlineItems : 5;\n const inlineCount = -(maxInlineItems - (items.length > maxInlineItems ? 1 : 0));\n const overflowItems = items.slice(0, inlineCount);\n return {\n inlineItems: items.slice(inlineCount),\n overflowItems: overflowItems.length > 0 ? overflowItems : undefined\n };\n};\n//# sourceMappingURL=partitionAvatarGroupItems.js.map"],"names":["partitionAvatarGroupItems","options","items","isPie","layout","inlineItems","slice","overflowItems","length","undefined","_options_maxInlineItems","maxInlineItems","inlineCount"],"mappings":"AAAA;;;;;;CAMC;;;;+BAAeA;;aAAAA;;AAAN,MAAMA,4BAA4BC,CAAAA,UAAW;IACrD,MAAM,EACJC,MAAK,EACN,GAAGD;IACJ,MAAME,QAAQF,QAAQG,MAAM,KAAK;IACjC,IAAID,OAAO;QACT,OAAO;YACLE,aAAaH,MAAMI,KAAK,CAAC,GAAG;YAC5BC,eAAeL,MAAMM,MAAM,GAAG,IAAIN,QAAQO,SAAS;QACrD;IACF,CAAC;IACD,IAAIC;IACJ,MAAMC,iBAAiB,AAACD,CAAAA,0BAA0BT,QAAQU,cAAc,AAAD,MAAO,IAAI,IAAID,4BAA4B,KAAK,IAAIA,0BAA0B,CAAC;IACtJ,MAAME,cAAc,CAAED,CAAAA,iBAAkBT,CAAAA,MAAMM,MAAM,GAAGG,iBAAiB,IAAI,CAAC,AAAD,CAAC;IAC7E,MAAMJ,gBAAgBL,MAAMI,KAAK,CAAC,GAAGM;IACrC,OAAO;QACLP,aAAaH,MAAMI,KAAK,CAACM;QACzBL,eAAeA,cAAcC,MAAM,GAAG,IAAID,gBAAgBE,SAAS;IACrE;AACF,GACA,qDAAqD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluentui/react-avatar",
3
- "version": "9.4.4",
3
+ "version": "9.4.5",
4
4
  "description": "React components for building Microsoft web experiences.",
5
5
  "main": "lib-commonjs/index.js",
6
6
  "module": "lib/index.js",
@@ -24,29 +24,29 @@
24
24
  "test": "jest --passWithNoTests",
25
25
  "storybook": "start-storybook",
26
26
  "type-check": "tsc -b tsconfig.json",
27
- "generate-api": "tsc -p ./tsconfig.lib.json --emitDeclarationOnly && just-scripts api-extractor"
27
+ "generate-api": "just-scripts generate-api"
28
28
  },
29
29
  "devDependencies": {
30
30
  "@fluentui/eslint-plugin": "*",
31
31
  "@fluentui/react-conformance": "*",
32
- "@fluentui/react-conformance-griffel": "9.0.0-beta.19",
32
+ "@fluentui/react-conformance-griffel": "9.0.0-beta.20",
33
33
  "es6-weak-map": "^2.0.2",
34
34
  "@fluentui/scripts-api-extractor": "*",
35
35
  "@fluentui/scripts-cypress": "*",
36
36
  "@fluentui/scripts-tasks": "*"
37
37
  },
38
38
  "dependencies": {
39
- "@fluentui/react-badge": "^9.1.4",
40
- "@fluentui/react-context-selector": "^9.1.14",
41
- "@fluentui/react-icons": "^2.0.175",
42
- "@fluentui/react-popover": "^9.5.4",
43
- "@fluentui/react-shared-contexts": "^9.3.1",
44
- "@fluentui/react-tabster": "^9.6.0",
45
- "@fluentui/react-theme": "^9.1.6",
46
- "@fluentui/react-tooltip": "^9.2.4",
47
- "@fluentui/react-utilities": "^9.7.1",
39
+ "@fluentui/react-badge": "^9.1.5",
40
+ "@fluentui/react-context-selector": "^9.1.15",
41
+ "@fluentui/react-icons": "^2.0.196",
42
+ "@fluentui/react-popover": "^9.5.5",
43
+ "@fluentui/react-shared-contexts": "^9.3.2",
44
+ "@fluentui/react-tabster": "^9.6.1",
45
+ "@fluentui/react-theme": "^9.1.7",
46
+ "@fluentui/react-tooltip": "^9.2.5",
47
+ "@fluentui/react-utilities": "^9.7.2",
48
48
  "@griffel/react": "^1.5.2",
49
- "tslib": "^2.1.0"
49
+ "@swc/helpers": "^0.4.14"
50
50
  },
51
51
  "peerDependencies": {
52
52
  "@types/react": ">=16.8.0 <19.0.0",
@@ -64,6 +64,7 @@
64
64
  "exports": {
65
65
  ".": {
66
66
  "types": "./dist/index.d.ts",
67
+ "node": "./lib-commonjs/index.js",
67
68
  "import": "./lib/index.js",
68
69
  "require": "./lib-commonjs/index.js"
69
70
  },
package/lib-amd/Avatar.js DELETED
@@ -1,6 +0,0 @@
1
- define(["require", "exports", "tslib", "./components/Avatar/index"], function (require, exports, tslib_1, index_1) {
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- tslib_1.__exportStar(index_1, exports);
5
- });
6
- //# sourceMappingURL=Avatar.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Avatar.js","sourceRoot":"","sources":["../../../../../../../packages/react-components/react-avatar/src/Avatar.ts"],"names":[],"mappings":";;;IAAA,uCAA0C","sourcesContent":["export * from './components/Avatar/index';\n"]}
@@ -1,6 +0,0 @@
1
- define(["require", "exports", "tslib", "./components/AvatarGroup/index"], function (require, exports, tslib_1, index_1) {
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- tslib_1.__exportStar(index_1, exports);
5
- });
6
- //# sourceMappingURL=AvatarGroup.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AvatarGroup.js","sourceRoot":"","sources":["../../../../../../../packages/react-components/react-avatar/src/AvatarGroup.ts"],"names":[],"mappings":";;;IAAA,uCAA+C","sourcesContent":["export * from './components/AvatarGroup/index';\n"]}
@@ -1,6 +0,0 @@
1
- define(["require", "exports", "tslib", "./components/AvatarGroupItem/index"], function (require, exports, tslib_1, index_1) {
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- tslib_1.__exportStar(index_1, exports);
5
- });
6
- //# sourceMappingURL=AvatarGroupItem.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AvatarGroupItem.js","sourceRoot":"","sources":["../../../../../../../packages/react-components/react-avatar/src/AvatarGroupItem.ts"],"names":[],"mappings":";;;IAAA,uCAAmD","sourcesContent":["export * from './components/AvatarGroupItem/index';\n"]}
@@ -1,6 +0,0 @@
1
- define(["require", "exports", "tslib", "./components/AvatarGroupPopover/index"], function (require, exports, tslib_1, index_1) {
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- tslib_1.__exportStar(index_1, exports);
5
- });
6
- //# sourceMappingURL=AvatarGroupPopover.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AvatarGroupPopover.js","sourceRoot":"","sources":["../../../../../../../packages/react-components/react-avatar/src/AvatarGroupPopover.ts"],"names":[],"mappings":";;;IAAA,uCAAsD","sourcesContent":["export * from './components/AvatarGroupPopover/index';\n"]}
@@ -1,14 +0,0 @@
1
- define(["require", "exports", "react", "./renderAvatar", "./useAvatar", "@fluentui/react-shared-contexts", "./useAvatarStyles"], function (require, exports, React, renderAvatar_1, useAvatar_1, react_shared_contexts_1, useAvatarStyles_1) {
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.Avatar = void 0;
5
- exports.Avatar = React.forwardRef(function (props, ref) {
6
- var state = useAvatar_1.useAvatar_unstable(props, ref);
7
- useAvatarStyles_1.useAvatarStyles_unstable(state);
8
- var useCustomStyles = react_shared_contexts_1.useCustomStyleHooks_unstable().useAvatarStyles_unstable;
9
- useCustomStyles(state);
10
- return renderAvatar_1.renderAvatar_unstable(state);
11
- });
12
- exports.Avatar.displayName = 'Avatar';
13
- });
14
- //# sourceMappingURL=Avatar.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Avatar.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-avatar/src/components/Avatar/Avatar.tsx"],"names":[],"mappings":";;;;IAQa,QAAA,MAAM,GAAqC,KAAK,CAAC,UAAU,CAAC,UAAC,KAAK,EAAE,GAAG;QAClF,IAAM,KAAK,GAAG,8BAAkB,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;QAE7C,0CAAwB,CAAC,KAAK,CAAC,CAAC;QAExB,IAA0B,eAAe,GAAK,oDAA4B,EAAE,yBAAnC,CAAoC;QACrF,eAAe,CAAC,KAAK,CAAC,CAAC;QAEvB,OAAO,oCAAqB,CAAC,KAAK,CAAC,CAAC;IACtC,CAAC,CAAC,CAAC;IAEH,cAAM,CAAC,WAAW,GAAG,QAAQ,CAAC","sourcesContent":["import * as React from 'react';\nimport { renderAvatar_unstable } from './renderAvatar';\nimport { useAvatar_unstable } from './useAvatar';\nimport { useCustomStyleHooks_unstable } from '@fluentui/react-shared-contexts';\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 const { useAvatarStyles_unstable: useCustomStyles } = useCustomStyleHooks_unstable();\n useCustomStyles(state);\n\n return renderAvatar_unstable(state);\n});\n\nAvatar.displayName = 'Avatar';\n"]}
@@ -1,5 +0,0 @@
1
- define(["require", "exports"], function (require, exports) {
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- });
5
- //# sourceMappingURL=Avatar.types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Avatar.types.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-avatar/src/components/Avatar/Avatar.types.ts"],"names":[],"mappings":"","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\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?: '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?: 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"]}
@@ -1,10 +0,0 @@
1
- define(["require", "exports", "tslib", "./Avatar.types", "./Avatar", "./renderAvatar", "./useAvatar", "./useAvatarStyles"], function (require, exports, tslib_1, Avatar_types_1, Avatar_1, renderAvatar_1, useAvatar_1, useAvatarStyles_1) {
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- tslib_1.__exportStar(Avatar_types_1, exports);
5
- tslib_1.__exportStar(Avatar_1, exports);
6
- tslib_1.__exportStar(renderAvatar_1, exports);
7
- tslib_1.__exportStar(useAvatar_1, exports);
8
- tslib_1.__exportStar(useAvatarStyles_1, exports);
9
- });
10
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-avatar/src/components/Avatar/index.ts"],"names":[],"mappings":";;;IAAA,8CAA+B;IAC/B,wCAAyB;IACzB,8CAA+B;IAC/B,2CAA4B;IAC5B,iDAAkC","sourcesContent":["export * from './Avatar.types';\nexport * from './Avatar';\nexport * from './renderAvatar';\nexport * from './useAvatar';\nexport * from './useAvatarStyles';\n"]}
@@ -1,16 +0,0 @@
1
- define(["require", "exports", "tslib", "react", "@fluentui/react-utilities"], function (require, exports, tslib_1, React, react_utilities_1) {
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.renderAvatar_unstable = void 0;
5
- var renderAvatar_unstable = function (state) {
6
- var _a = react_utilities_1.getSlots(state), slots = _a.slots, slotProps = _a.slotProps;
7
- return (React.createElement(slots.root, tslib_1.__assign({}, slotProps.root),
8
- slots.initials && React.createElement(slots.initials, tslib_1.__assign({}, slotProps.initials)),
9
- slots.icon && React.createElement(slots.icon, tslib_1.__assign({}, slotProps.icon)),
10
- slots.image && React.createElement(slots.image, tslib_1.__assign({}, slotProps.image)),
11
- slots.badge && React.createElement(slots.badge, tslib_1.__assign({}, slotProps.badge)),
12
- state.activeAriaLabelElement));
13
- };
14
- exports.renderAvatar_unstable = renderAvatar_unstable;
15
- });
16
- //# sourceMappingURL=renderAvatar.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"renderAvatar.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-avatar/src/components/Avatar/renderAvatar.tsx"],"names":[],"mappings":";;;;IAIO,IAAM,qBAAqB,GAAG,UAAC,KAAkB;QAChD,IAAA,KAAuB,0BAAQ,CAAc,KAAK,CAAC,EAAjD,KAAK,WAAA,EAAE,SAAS,eAAiC,CAAC;QAE1D,OAAO,CACL,oBAAC,KAAK,CAAC,IAAI,uBAAK,SAAS,CAAC,IAAI;YAC3B,KAAK,CAAC,QAAQ,IAAI,oBAAC,KAAK,CAAC,QAAQ,uBAAK,SAAS,CAAC,QAAQ,EAAI;YAC5D,KAAK,CAAC,IAAI,IAAI,oBAAC,KAAK,CAAC,IAAI,uBAAK,SAAS,CAAC,IAAI,EAAI;YAChD,KAAK,CAAC,KAAK,IAAI,oBAAC,KAAK,CAAC,KAAK,uBAAK,SAAS,CAAC,KAAK,EAAI;YACnD,KAAK,CAAC,KAAK,IAAI,oBAAC,KAAK,CAAC,KAAK,uBAAK,SAAS,CAAC,KAAK,EAAI;YACnD,KAAK,CAAC,sBAAsB,CAClB,CACd,CAAC;IACJ,CAAC,CAAC;IAZW,QAAA,qBAAqB,yBAYhC","sourcesContent":["import * as React from 'react';\nimport { getSlots } from '@fluentui/react-utilities';\nimport type { AvatarSlots, AvatarState } from './Avatar.types';\n\nexport const renderAvatar_unstable = (state: AvatarState) => {\n const { slots, slotProps } = getSlots<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"]}
@@ -1,178 +0,0 @@
1
- define(["require", "exports", "tslib", "react", "@fluentui/react-utilities", "../../utils/index", "@fluentui/react-icons", "@fluentui/react-badge", "@fluentui/react-shared-contexts", "../../contexts/AvatarContext"], function (require, exports, tslib_1, React, react_utilities_1, index_1, react_icons_1, react_badge_1, react_shared_contexts_1, AvatarContext_1) {
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.useAvatar_unstable = exports.DEFAULT_STRINGS = void 0;
5
- exports.DEFAULT_STRINGS = {
6
- active: 'active',
7
- inactive: 'inactive',
8
- };
9
- var useAvatar_unstable = function (props, ref) {
10
- var _a;
11
- var dir = react_shared_contexts_1.useFluent_unstable().dir;
12
- var contextSize = AvatarContext_1.useAvatarContext().size;
13
- var name = props.name, _b = props.size, size = _b === void 0 ? contextSize !== null && contextSize !== void 0 ? contextSize : 32 : _b, _c = props.shape, shape = _c === void 0 ? 'circular' : _c, _d = props.active, active = _d === void 0 ? 'unset' : _d, _e = props.activeAppearance, activeAppearance = _e === void 0 ? 'ring' : _e, idForColor = props.idForColor;
14
- var _f = props.color, color = _f === void 0 ? 'neutral' : _f;
15
- // Resolve 'colorful' to a specific color name
16
- if (color === 'colorful') {
17
- color = avatarColors[getHashCode((_a = idForColor !== null && idForColor !== void 0 ? idForColor : name) !== null && _a !== void 0 ? _a : '') % avatarColors.length];
18
- }
19
- var baseId = react_utilities_1.useId('avatar-');
20
- var root = react_utilities_1.getNativeElementProps('span', tslib_1.__assign(tslib_1.__assign({ role: 'img', id: baseId }, props), { ref: ref }),
21
- /* excludedPropNames: */ ['name']);
22
- var _g = React.useState(undefined), imageHidden = _g[0], setImageHidden = _g[1];
23
- var image = react_utilities_1.resolveShorthand(props.image, {
24
- defaultProps: {
25
- alt: '',
26
- role: 'presentation',
27
- 'aria-hidden': true,
28
- hidden: imageHidden,
29
- },
30
- });
31
- // Hide the image if it fails to load and restore it on a successful load
32
- if (image) {
33
- image.onError = react_utilities_1.mergeCallbacks(image.onError, function () { return setImageHidden(true); });
34
- image.onLoad = react_utilities_1.mergeCallbacks(image.onLoad, function () { return setImageHidden(undefined); });
35
- }
36
- // Resolve the initials slot, defaulted to getInitials.
37
- var initials = react_utilities_1.resolveShorthand(props.initials, {
38
- required: true,
39
- defaultProps: {
40
- children: index_1.getInitials(name, dir === 'rtl', { firstInitialOnly: size <= 16 }),
41
- id: baseId + '__initials',
42
- },
43
- });
44
- // Don't render the initials slot if it's empty
45
- if (!(initials === null || initials === void 0 ? void 0 : initials.children)) {
46
- initials = undefined;
47
- }
48
- // Render the icon slot *only if* there aren't any initials or image to display
49
- var icon = undefined;
50
- if (!initials && (!image || imageHidden)) {
51
- icon = react_utilities_1.resolveShorthand(props.icon, {
52
- required: true,
53
- defaultProps: {
54
- children: React.createElement(react_icons_1.PersonRegular, null),
55
- 'aria-hidden': true,
56
- },
57
- });
58
- }
59
- var badge = react_utilities_1.resolveShorthand(props.badge, {
60
- defaultProps: {
61
- size: getBadgeSize(size),
62
- id: baseId + '__badge',
63
- },
64
- });
65
- var activeAriaLabelElement;
66
- // Resolve aria-label and/or aria-labelledby if not provided by the user
67
- if (!root['aria-label'] && !root['aria-labelledby']) {
68
- if (name) {
69
- root['aria-label'] = name;
70
- // Include the badge in labelledby if it exists
71
- if (badge) {
72
- root['aria-labelledby'] = root.id + ' ' + badge.id;
73
- }
74
- }
75
- else if (initials) {
76
- // root's aria-label should be the name, but fall back to being labelledby the initials if name is missing
77
- root['aria-labelledby'] = initials.id + (badge ? ' ' + badge.id : '');
78
- }
79
- // Add the active state to the aria label
80
- if (active === 'active' || active === 'inactive') {
81
- var activeText = exports.DEFAULT_STRINGS[active];
82
- if (root['aria-labelledby']) {
83
- // If using aria-labelledby, render a hidden span and append it to the labelledby
84
- var activeId = baseId + '__active';
85
- root['aria-labelledby'] += ' ' + activeId;
86
- activeAriaLabelElement = (React.createElement("span", { hidden: true, id: activeId }, activeText));
87
- }
88
- else if (root['aria-label']) {
89
- // Otherwise, just append it to the aria-label
90
- root['aria-label'] += ' ' + activeText;
91
- }
92
- }
93
- }
94
- return {
95
- size: size,
96
- shape: shape,
97
- active: active,
98
- activeAppearance: activeAppearance,
99
- activeAriaLabelElement: activeAriaLabelElement,
100
- color: color,
101
- components: {
102
- root: 'span',
103
- initials: 'span',
104
- icon: 'span',
105
- image: 'img',
106
- badge: react_badge_1.PresenceBadge,
107
- },
108
- root: root,
109
- initials: initials,
110
- icon: icon,
111
- image: image,
112
- badge: badge,
113
- };
114
- };
115
- exports.useAvatar_unstable = useAvatar_unstable;
116
- var getBadgeSize = function (size) {
117
- if (size >= 96) {
118
- return 'extra-large';
119
- }
120
- else if (size >= 64) {
121
- return 'large';
122
- }
123
- else if (size >= 56) {
124
- return 'medium';
125
- }
126
- else if (size >= 40) {
127
- return 'small';
128
- }
129
- else if (size >= 28) {
130
- return 'extra-small';
131
- }
132
- else {
133
- return 'tiny';
134
- }
135
- };
136
- var avatarColors = [
137
- 'dark-red',
138
- 'cranberry',
139
- 'red',
140
- 'pumpkin',
141
- 'peach',
142
- 'marigold',
143
- 'gold',
144
- 'brass',
145
- 'brown',
146
- 'forest',
147
- 'seafoam',
148
- 'dark-green',
149
- 'light-teal',
150
- 'teal',
151
- 'steel',
152
- 'blue',
153
- 'royal-blue',
154
- 'cornflower',
155
- 'navy',
156
- 'lavender',
157
- 'purple',
158
- 'grape',
159
- 'lilac',
160
- 'pink',
161
- 'magenta',
162
- 'plum',
163
- 'beige',
164
- 'mink',
165
- 'platinum',
166
- 'anchor',
167
- ];
168
- var getHashCode = function (str) {
169
- var hashCode = 0;
170
- for (var len = str.length - 1; len >= 0; len--) {
171
- var ch = str.charCodeAt(len);
172
- var shift = len % 8;
173
- hashCode ^= (ch << shift) + (ch >> (8 - shift)); // eslint-disable-line no-bitwise
174
- }
175
- return hashCode;
176
- };
177
- });
178
- //# sourceMappingURL=useAvatar.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useAvatar.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-avatar/src/components/Avatar/useAvatar.tsx"],"names":[],"mappings":"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","sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps, mergeCallbacks, resolveShorthand, useId } from '@fluentui/react-utilities';\nimport { getInitials } from '../../utils/index';\nimport type { AvatarNamedColor, AvatarProps, AvatarState } from './Avatar.types';\nimport { PersonRegular } from '@fluentui/react-icons';\nimport { PresenceBadge } from '@fluentui/react-badge';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport { useAvatarContext } from '../../contexts/AvatarContext';\n\nexport const DEFAULT_STRINGS = {\n active: 'active',\n inactive: 'inactive',\n};\n\nexport const useAvatar_unstable = (props: AvatarProps, ref: React.Ref<HTMLElement>): AvatarState => {\n const { dir } = useFluent();\n const { size: contextSize } = useAvatarContext();\n const {\n name,\n size = contextSize ?? (32 as const),\n shape = 'circular',\n active = 'unset',\n activeAppearance = 'ring',\n idForColor,\n } = props;\n let { color = 'neutral' } = props;\n\n // Resolve 'colorful' to a specific color name\n if (color === 'colorful') {\n color = avatarColors[getHashCode(idForColor ?? name ?? '') % avatarColors.length];\n }\n\n const baseId = useId('avatar-');\n\n const root: AvatarState['root'] = getNativeElementProps(\n 'span',\n {\n role: 'img',\n id: baseId,\n // aria-label and/or aria-labelledby are resolved below\n ...props,\n ref,\n },\n /* excludedPropNames: */ ['name'],\n );\n\n const [imageHidden, setImageHidden] = React.useState<true | undefined>(undefined);\n const image: AvatarState['image'] = resolveShorthand(props.image, {\n defaultProps: {\n alt: '',\n role: 'presentation',\n 'aria-hidden': true,\n hidden: imageHidden,\n },\n });\n\n // Hide the image if it fails to load and restore it on a successful load\n if (image) {\n image.onError = mergeCallbacks(image.onError, () => setImageHidden(true));\n image.onLoad = mergeCallbacks(image.onLoad, () => setImageHidden(undefined));\n }\n\n // Resolve the initials slot, defaulted to getInitials.\n let initials: AvatarState['initials'] = resolveShorthand(props.initials, {\n required: true,\n defaultProps: {\n children: getInitials(name, dir === 'rtl', { firstInitialOnly: size <= 16 }),\n id: baseId + '__initials',\n },\n });\n\n // Don't render the initials slot if it's empty\n if (!initials?.children) {\n initials = undefined;\n }\n\n // Render the icon slot *only if* there aren't any initials or image to display\n let icon: AvatarState['icon'] = undefined;\n if (!initials && (!image || imageHidden)) {\n icon = resolveShorthand(props.icon, {\n required: true,\n defaultProps: {\n children: <PersonRegular />,\n 'aria-hidden': true,\n },\n });\n }\n\n const badge: AvatarState['badge'] = resolveShorthand(props.badge, {\n defaultProps: {\n size: getBadgeSize(size),\n id: baseId + '__badge',\n },\n });\n\n let activeAriaLabelElement: AvatarState['activeAriaLabelElement'];\n\n // Resolve aria-label and/or aria-labelledby if not provided by the user\n if (!root['aria-label'] && !root['aria-labelledby']) {\n if (name) {\n root['aria-label'] = name;\n\n // Include the badge in labelledby if it exists\n if (badge) {\n root['aria-labelledby'] = root.id + ' ' + badge.id;\n }\n } else if (initials) {\n // root's aria-label should be the name, but fall back to being labelledby the initials if name is missing\n root['aria-labelledby'] = initials.id + (badge ? ' ' + badge.id : '');\n }\n\n // Add the active state to the aria label\n if (active === 'active' || active === 'inactive') {\n const activeText = DEFAULT_STRINGS[active];\n if (root['aria-labelledby']) {\n // If using aria-labelledby, render a hidden span and append it to the labelledby\n const activeId = baseId + '__active';\n root['aria-labelledby'] += ' ' + activeId;\n activeAriaLabelElement = (\n <span hidden id={activeId}>\n {activeText}\n </span>\n );\n } else if (root['aria-label']) {\n // Otherwise, just append it to the aria-label\n root['aria-label'] += ' ' + activeText;\n }\n }\n }\n\n return {\n size,\n shape,\n active,\n activeAppearance,\n activeAriaLabelElement,\n color,\n\n components: {\n root: 'span',\n initials: 'span',\n icon: 'span',\n image: 'img',\n badge: PresenceBadge,\n },\n\n root,\n initials,\n icon,\n image,\n badge,\n };\n};\n\nconst getBadgeSize = (size: AvatarState['size']) => {\n if (size >= 96) {\n return 'extra-large';\n } else if (size >= 64) {\n return 'large';\n } else if (size >= 56) {\n return 'medium';\n } else if (size >= 40) {\n return 'small';\n } else if (size >= 28) {\n return 'extra-small';\n } else {\n return 'tiny';\n }\n};\n\nconst avatarColors: 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\nconst getHashCode = (str: string): number => {\n let hashCode = 0;\n for (let len: number = str.length - 1; len >= 0; len--) {\n const ch = str.charCodeAt(len);\n const shift = len % 8;\n hashCode ^= (ch << shift) + (ch >> (8 - shift)); // eslint-disable-line no-bitwise\n }\n\n return hashCode;\n};\n"]}