@fluentui/react-avatar 9.5.40 → 9.5.42

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.
package/CHANGELOG.json CHANGED
@@ -2,7 +2,91 @@
2
2
  "name": "@fluentui/react-avatar",
3
3
  "entries": [
4
4
  {
5
- "date": "Thu, 12 Oct 2023 14:52:34 GMT",
5
+ "date": "Mon, 23 Oct 2023 09:48:56 GMT",
6
+ "tag": "@fluentui/react-avatar_v9.5.42",
7
+ "version": "9.5.42",
8
+ "comments": {
9
+ "patch": [
10
+ {
11
+ "author": "beachball",
12
+ "package": "@fluentui/react-avatar",
13
+ "comment": "Bump @fluentui/react-popover to v9.8.17",
14
+ "commit": "e4ef1febe8a185dddc10f8936944d177d50bc396"
15
+ },
16
+ {
17
+ "author": "beachball",
18
+ "package": "@fluentui/react-avatar",
19
+ "comment": "Bump @fluentui/react-tabster to v9.14.1",
20
+ "commit": "e4ef1febe8a185dddc10f8936944d177d50bc396"
21
+ },
22
+ {
23
+ "author": "beachball",
24
+ "package": "@fluentui/react-avatar",
25
+ "comment": "Bump @fluentui/react-tooltip to v9.3.18",
26
+ "commit": "e4ef1febe8a185dddc10f8936944d177d50bc396"
27
+ }
28
+ ]
29
+ }
30
+ },
31
+ {
32
+ "date": "Wed, 18 Oct 2023 17:54:01 GMT",
33
+ "tag": "@fluentui/react-avatar_v9.5.41",
34
+ "version": "9.5.41",
35
+ "comments": {
36
+ "patch": [
37
+ {
38
+ "author": "bernardo.sunderhus@gmail.com",
39
+ "package": "@fluentui/react-avatar",
40
+ "commit": "967882a55a7333effea42e4c24a64e8547309116",
41
+ "comment": "chore: migrate from getNativeElementProps to getIntrinsicElementProps"
42
+ },
43
+ {
44
+ "author": "beachball",
45
+ "package": "@fluentui/react-avatar",
46
+ "comment": "Bump @fluentui/react-badge to v9.2.10",
47
+ "commit": "c0d3065982e1646c54ba00c1d524248b792dbcad"
48
+ },
49
+ {
50
+ "author": "beachball",
51
+ "package": "@fluentui/react-avatar",
52
+ "comment": "Bump @fluentui/react-context-selector to v9.1.41",
53
+ "commit": "c0d3065982e1646c54ba00c1d524248b792dbcad"
54
+ },
55
+ {
56
+ "author": "beachball",
57
+ "package": "@fluentui/react-avatar",
58
+ "comment": "Bump @fluentui/react-popover to v9.8.16",
59
+ "commit": "c0d3065982e1646c54ba00c1d524248b792dbcad"
60
+ },
61
+ {
62
+ "author": "beachball",
63
+ "package": "@fluentui/react-avatar",
64
+ "comment": "Bump @fluentui/react-tabster to v9.14.0",
65
+ "commit": "c0d3065982e1646c54ba00c1d524248b792dbcad"
66
+ },
67
+ {
68
+ "author": "beachball",
69
+ "package": "@fluentui/react-avatar",
70
+ "comment": "Bump @fluentui/react-tooltip to v9.3.17",
71
+ "commit": "c0d3065982e1646c54ba00c1d524248b792dbcad"
72
+ },
73
+ {
74
+ "author": "beachball",
75
+ "package": "@fluentui/react-avatar",
76
+ "comment": "Bump @fluentui/react-utilities to v9.15.1",
77
+ "commit": "c0d3065982e1646c54ba00c1d524248b792dbcad"
78
+ },
79
+ {
80
+ "author": "beachball",
81
+ "package": "@fluentui/react-avatar",
82
+ "comment": "Bump @fluentui/react-jsx-runtime to v9.0.18",
83
+ "commit": "c0d3065982e1646c54ba00c1d524248b792dbcad"
84
+ }
85
+ ]
86
+ }
87
+ },
88
+ {
89
+ "date": "Thu, 12 Oct 2023 14:55:44 GMT",
6
90
  "tag": "@fluentui/react-avatar_v9.5.40",
7
91
  "version": "9.5.40",
8
92
  "comments": {
@@ -11,25 +95,25 @@
11
95
  "author": "beachball",
12
96
  "package": "@fluentui/react-avatar",
13
97
  "comment": "Bump @fluentui/react-badge to v9.2.9",
14
- "commit": "1a52f5b27e2f71f7257c470bc9c7552ea5e07867"
98
+ "commit": "8178c3cae60005bc21137aa1f3e766e18cdb4a30"
15
99
  },
16
100
  {
17
101
  "author": "beachball",
18
102
  "package": "@fluentui/react-avatar",
19
103
  "comment": "Bump @fluentui/react-popover to v9.8.15",
20
- "commit": "1a52f5b27e2f71f7257c470bc9c7552ea5e07867"
104
+ "commit": "8178c3cae60005bc21137aa1f3e766e18cdb4a30"
21
105
  },
22
106
  {
23
107
  "author": "beachball",
24
108
  "package": "@fluentui/react-avatar",
25
109
  "comment": "Bump @fluentui/react-tooltip to v9.3.16",
26
- "commit": "1a52f5b27e2f71f7257c470bc9c7552ea5e07867"
110
+ "commit": "8178c3cae60005bc21137aa1f3e766e18cdb4a30"
27
111
  },
28
112
  {
29
113
  "author": "beachball",
30
114
  "package": "@fluentui/react-avatar",
31
115
  "comment": "Bump @fluentui/react-jsx-runtime to v9.0.17",
32
- "commit": "1a52f5b27e2f71f7257c470bc9c7552ea5e07867"
116
+ "commit": "8178c3cae60005bc21137aa1f3e766e18cdb4a30"
33
117
  }
34
118
  ]
35
119
  }
package/CHANGELOG.md CHANGED
@@ -1,20 +1,47 @@
1
1
  # Change Log - @fluentui/react-avatar
2
2
 
3
- This log was last generated on Thu, 12 Oct 2023 14:52:34 GMT and should not be manually modified.
3
+ This log was last generated on Mon, 23 Oct 2023 09:48:56 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## [9.5.42](https://github.com/microsoft/fluentui/tree/@fluentui/react-avatar_v9.5.42)
8
+
9
+ Mon, 23 Oct 2023 09:48:56 GMT
10
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-avatar_v9.5.41..@fluentui/react-avatar_v9.5.42)
11
+
12
+ ### Patches
13
+
14
+ - Bump @fluentui/react-popover to v9.8.17 ([commit](https://github.com/microsoft/fluentui/commit/e4ef1febe8a185dddc10f8936944d177d50bc396) by beachball)
15
+ - Bump @fluentui/react-tabster to v9.14.1 ([commit](https://github.com/microsoft/fluentui/commit/e4ef1febe8a185dddc10f8936944d177d50bc396) by beachball)
16
+ - Bump @fluentui/react-tooltip to v9.3.18 ([commit](https://github.com/microsoft/fluentui/commit/e4ef1febe8a185dddc10f8936944d177d50bc396) by beachball)
17
+
18
+ ## [9.5.41](https://github.com/microsoft/fluentui/tree/@fluentui/react-avatar_v9.5.41)
19
+
20
+ Wed, 18 Oct 2023 17:54:01 GMT
21
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-avatar_v9.5.40..@fluentui/react-avatar_v9.5.41)
22
+
23
+ ### Patches
24
+
25
+ - chore: migrate from getNativeElementProps to getIntrinsicElementProps ([PR #29499](https://github.com/microsoft/fluentui/pull/29499) by bernardo.sunderhus@gmail.com)
26
+ - Bump @fluentui/react-badge to v9.2.10 ([PR #29560](https://github.com/microsoft/fluentui/pull/29560) by beachball)
27
+ - Bump @fluentui/react-context-selector to v9.1.41 ([PR #29560](https://github.com/microsoft/fluentui/pull/29560) by beachball)
28
+ - Bump @fluentui/react-popover to v9.8.16 ([PR #29560](https://github.com/microsoft/fluentui/pull/29560) by beachball)
29
+ - Bump @fluentui/react-tabster to v9.14.0 ([PR #29560](https://github.com/microsoft/fluentui/pull/29560) by beachball)
30
+ - Bump @fluentui/react-tooltip to v9.3.17 ([PR #29560](https://github.com/microsoft/fluentui/pull/29560) by beachball)
31
+ - Bump @fluentui/react-utilities to v9.15.1 ([PR #29560](https://github.com/microsoft/fluentui/pull/29560) by beachball)
32
+ - Bump @fluentui/react-jsx-runtime to v9.0.18 ([PR #29560](https://github.com/microsoft/fluentui/pull/29560) by beachball)
33
+
7
34
  ## [9.5.40](https://github.com/microsoft/fluentui/tree/@fluentui/react-avatar_v9.5.40)
8
35
 
9
- Thu, 12 Oct 2023 14:52:34 GMT
36
+ Thu, 12 Oct 2023 14:55:44 GMT
10
37
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-avatar_v9.5.39..@fluentui/react-avatar_v9.5.40)
11
38
 
12
39
  ### Patches
13
40
 
14
- - Bump @fluentui/react-badge to v9.2.9 ([PR #29488](https://github.com/microsoft/fluentui/pull/29488) by beachball)
15
- - Bump @fluentui/react-popover to v9.8.15 ([PR #29488](https://github.com/microsoft/fluentui/pull/29488) by beachball)
16
- - Bump @fluentui/react-tooltip to v9.3.16 ([PR #29488](https://github.com/microsoft/fluentui/pull/29488) by beachball)
17
- - Bump @fluentui/react-jsx-runtime to v9.0.17 ([PR #29488](https://github.com/microsoft/fluentui/pull/29488) by beachball)
41
+ - Bump @fluentui/react-badge to v9.2.9 ([PR #29513](https://github.com/microsoft/fluentui/pull/29513) by beachball)
42
+ - Bump @fluentui/react-popover to v9.8.15 ([PR #29513](https://github.com/microsoft/fluentui/pull/29513) by beachball)
43
+ - Bump @fluentui/react-tooltip to v9.3.16 ([PR #29513](https://github.com/microsoft/fluentui/pull/29513) by beachball)
44
+ - Bump @fluentui/react-jsx-runtime to v9.0.17 ([PR #29513](https://github.com/microsoft/fluentui/pull/29513) by beachball)
18
45
 
19
46
  ## [9.5.39](https://github.com/microsoft/fluentui/tree/@fluentui/react-avatar_v9.5.39)
20
47
 
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { getNativeElementProps, mergeCallbacks, useId, slot } from '@fluentui/react-utilities';
2
+ import { getIntrinsicElementProps, mergeCallbacks, useId, slot } from '@fluentui/react-utilities';
3
3
  import { getInitials } from '../../utils/index';
4
4
  import { PersonRegular } from '@fluentui/react-icons';
5
5
  import { PresenceBadge } from '@fluentui/react-badge';
@@ -20,7 +20,7 @@ export const useAvatar_unstable = (props, ref)=>{
20
20
  color = avatarColors[getHashCode((_ref = idForColor !== null && idForColor !== void 0 ? idForColor : name) !== null && _ref !== void 0 ? _ref : '') % avatarColors.length];
21
21
  }
22
22
  const baseId = useId('avatar-');
23
- const root = slot.always(getNativeElementProps('span', {
23
+ const root = slot.always(getIntrinsicElementProps('span', {
24
24
  role: 'img',
25
25
  id: baseId,
26
26
  // aria-label and/or aria-labelledby are resolved below
@@ -1 +1 @@
1
- {"version":3,"sources":["useAvatar.tsx"],"sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps, mergeCallbacks, useId, slot } 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 { shape: contextShape, size: contextSize } = useAvatarContext();\n const {\n name,\n size = contextSize ?? (32 as const),\n shape = contextShape ?? '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'] = slot.always(\n 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 { elementType: 'span' },\n );\n const [imageHidden, setImageHidden] = React.useState<true | undefined>(undefined);\n let image: AvatarState['image'] = slot.optional(props.image, {\n defaultProps: { alt: '', role: 'presentation', 'aria-hidden': true, hidden: imageHidden },\n elementType: 'img',\n }); // Image shouldn't be rendered if its src is not set\n if (!image?.src) {\n image = undefined;\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 } // Resolve the initials slot, defaulted to getInitials.\n let initials: AvatarState['initials'] = slot.optional(props.initials, {\n renderByDefault: true,\n defaultProps: {\n children: getInitials(name, dir === 'rtl', { firstInitialOnly: size <= 16 }),\n id: baseId + '__initials',\n },\n elementType: 'span',\n }); // Don't render the initials slot if it's empty\n if (!initials?.children) {\n initials = undefined;\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 = slot.optional(props.icon, {\n renderByDefault: true,\n defaultProps: { children: <PersonRegular />, 'aria-hidden': true },\n elementType: 'span',\n });\n }\n const badge: AvatarState['badge'] = slot.optional(props.badge, {\n defaultProps: { size: getBadgeSize(size), id: baseId + '__badge' },\n elementType: PresenceBadge,\n });\n let activeAriaLabelElement: AvatarState['activeAriaLabelElement']; // 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; // 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 } // 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 return {\n size,\n shape,\n active,\n activeAppearance,\n activeAriaLabelElement,\n color,\n components: { root: 'span', initials: 'span', icon: 'span', image: 'img', badge: PresenceBadge },\n root,\n initials,\n icon,\n image,\n badge,\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"],"names":["React","getNativeElementProps","mergeCallbacks","useId","slot","getInitials","PersonRegular","PresenceBadge","useFluent_unstable","useFluent","useAvatarContext","DEFAULT_STRINGS","active","inactive","useAvatar_unstable","props","ref","dir","shape","contextShape","size","contextSize","name","activeAppearance","idForColor","color","avatarColors","getHashCode","length","baseId","root","always","role","id","elementType","imageHidden","setImageHidden","useState","undefined","image","optional","defaultProps","alt","hidden","src","onError","onLoad","initials","renderByDefault","children","firstInitialOnly","icon","badge","getBadgeSize","activeAriaLabelElement","activeText","activeId","span","components","str","hashCode","len","ch","charCodeAt","shift"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,qBAAqB,EAAEC,cAAc,EAAEC,KAAK,EAAEC,IAAI,QAAQ,4BAA4B;AAC/F,SAASC,WAAW,QAAQ,oBAAoB;AAEhD,SAASC,aAAa,QAAQ,wBAAwB;AACtD,SAASC,aAAa,QAAQ,wBAAwB;AACtD,SAASC,sBAAsBC,SAAS,QAAQ,kCAAkC;AAClF,SAASC,gBAAgB,QAAQ,+BAA+B;AAEhE,OAAO,MAAMC,kBAAkB;IAC7BC,QAAQ;IACRC,UAAU;AACZ,EAAE;AAEF,OAAO,MAAMC,qBAAqB,CAACC,OAAoBC;IACrD,MAAM,EAAEC,GAAG,EAAE,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["useAvatar.tsx"],"sourcesContent":["import * as React from 'react';\nimport { getIntrinsicElementProps, mergeCallbacks, useId, slot } 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 { shape: contextShape, size: contextSize } = useAvatarContext();\n const {\n name,\n size = contextSize ?? (32 as const),\n shape = contextShape ?? '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'] = slot.always(\n getIntrinsicElementProps(\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 { elementType: 'span' },\n );\n const [imageHidden, setImageHidden] = React.useState<true | undefined>(undefined);\n let image: AvatarState['image'] = slot.optional(props.image, {\n defaultProps: { alt: '', role: 'presentation', 'aria-hidden': true, hidden: imageHidden },\n elementType: 'img',\n }); // Image shouldn't be rendered if its src is not set\n if (!image?.src) {\n image = undefined;\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 } // Resolve the initials slot, defaulted to getInitials.\n let initials: AvatarState['initials'] = slot.optional(props.initials, {\n renderByDefault: true,\n defaultProps: {\n children: getInitials(name, dir === 'rtl', { firstInitialOnly: size <= 16 }),\n id: baseId + '__initials',\n },\n elementType: 'span',\n }); // Don't render the initials slot if it's empty\n if (!initials?.children) {\n initials = undefined;\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 = slot.optional(props.icon, {\n renderByDefault: true,\n defaultProps: { children: <PersonRegular />, 'aria-hidden': true },\n elementType: 'span',\n });\n }\n const badge: AvatarState['badge'] = slot.optional(props.badge, {\n defaultProps: { size: getBadgeSize(size), id: baseId + '__badge' },\n elementType: PresenceBadge,\n });\n let activeAriaLabelElement: AvatarState['activeAriaLabelElement']; // 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; // 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 } // 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 return {\n size,\n shape,\n active,\n activeAppearance,\n activeAriaLabelElement,\n color,\n components: { root: 'span', initials: 'span', icon: 'span', image: 'img', badge: PresenceBadge },\n root,\n initials,\n icon,\n image,\n badge,\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"],"names":["React","getIntrinsicElementProps","mergeCallbacks","useId","slot","getInitials","PersonRegular","PresenceBadge","useFluent_unstable","useFluent","useAvatarContext","DEFAULT_STRINGS","active","inactive","useAvatar_unstable","props","ref","dir","shape","contextShape","size","contextSize","name","activeAppearance","idForColor","color","avatarColors","getHashCode","length","baseId","root","always","role","id","elementType","imageHidden","setImageHidden","useState","undefined","image","optional","defaultProps","alt","hidden","src","onError","onLoad","initials","renderByDefault","children","firstInitialOnly","icon","badge","getBadgeSize","activeAriaLabelElement","activeText","activeId","span","components","str","hashCode","len","ch","charCodeAt","shift"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,wBAAwB,EAAEC,cAAc,EAAEC,KAAK,EAAEC,IAAI,QAAQ,4BAA4B;AAClG,SAASC,WAAW,QAAQ,oBAAoB;AAEhD,SAASC,aAAa,QAAQ,wBAAwB;AACtD,SAASC,aAAa,QAAQ,wBAAwB;AACtD,SAASC,sBAAsBC,SAAS,QAAQ,kCAAkC;AAClF,SAASC,gBAAgB,QAAQ,+BAA+B;AAEhE,OAAO,MA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D,YAAY,AAACE,CAAAA,MAAME,KAAI,IAAMF,CAAAA,MAAO,IAAIE,KAAK,GAAI,iCAAiC;IACpF;IAEA,OAAOJ;AACT"}
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { getNativeElementProps, slot } from '@fluentui/react-utilities';
2
+ import { getIntrinsicElementProps, slot } from '@fluentui/react-utilities';
3
3
  /**
4
4
  * Create the state required to render AvatarGroup.
5
5
  *
@@ -10,10 +10,13 @@ import { getNativeElementProps, slot } from '@fluentui/react-utilities';
10
10
  * @param ref - reference to root HTMLElement of AvatarGroup
11
11
  */ export const useAvatarGroup_unstable = (props, ref)=>{
12
12
  const { layout = 'spread', size = defaultAvatarGroupSize } = props;
13
- const root = slot.always(getNativeElementProps('div', {
13
+ const root = slot.always(getIntrinsicElementProps('div', {
14
14
  role: 'group',
15
15
  ...props,
16
- ref
16
+ // FIXME:
17
+ // `ref` is wrongly assigned to be `HTMLElement` instead of `HTMLDivElement`
18
+ // but since it would be a breaking change to fix it, we are casting ref to it's proper type
19
+ ref: ref
17
20
  }, [
18
21
  'size'
19
22
  ]), {
@@ -1 +1 @@
1
- {"version":3,"sources":["useAvatarGroup.tsx"],"sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps, slot } from '@fluentui/react-utilities';\nimport type { AvatarGroupProps, AvatarGroupState } from './AvatarGroup.types';\n\n/**\n * Create the state required to render AvatarGroup.\n *\n * The returned state can be modified with hooks such as useAvatarGroupStyles_unstable,\n * before being passed to renderAvatarGroup_unstable.\n *\n * @param props - props from this instance of AvatarGroup\n * @param ref - reference to root HTMLElement of AvatarGroup\n */\nexport const useAvatarGroup_unstable = (props: AvatarGroupProps, ref: React.Ref<HTMLElement>): AvatarGroupState => {\n const { layout = 'spread', size = defaultAvatarGroupSize } = props;\n\n const root = slot.always(\n getNativeElementProps(\n 'div',\n {\n role: 'group',\n ...props,\n ref,\n },\n ['size'],\n ),\n { elementType: 'div' },\n );\n return { layout, size, components: { root: 'div' }, root };\n};\n\nexport const defaultAvatarGroupSize = 32;\n"],"names":["React","getNativeElementProps","slot","useAvatarGroup_unstable","props","ref","layout","size","defaultAvatarGroupSize","root","always","role","elementType","components"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,qBAAqB,EAAEC,IAAI,QAAQ,4BAA4B;AAGxE;;;;;;;;CAQC,GACD,OAAO,MAAMC,0BAA0B,CAACC,OAAyBC;IAC/D,MAAM,EAAEC,SAAS,QAAQ,EAAEC,OAAOC,sBAAsB,EAAE,GAAGJ;IAE7D,MAAMK,OAAOP,KAAKQ,MAAM,CACtBT,sBACE,OACA;QACEU,MAAM;QACN,GAAGP,KAAK;QACRC;IACF,GACA;QAAC;KAAO,GAEV;QAAEO,aAAa;IAAM;IAEvB,OAAO;QAAEN;QAAQC;QAAMM,YAAY;YAAEJ,MAAM;QAAM;QAAGA;IAAK;AAC3D,EAAE;AAEF,OAAO,MAAMD,yBAAyB,GAAG"}
1
+ {"version":3,"sources":["useAvatarGroup.tsx"],"sourcesContent":["import * as React from 'react';\nimport { getIntrinsicElementProps, slot } from '@fluentui/react-utilities';\nimport type { AvatarGroupProps, AvatarGroupState } from './AvatarGroup.types';\n\n/**\n * Create the state required to render AvatarGroup.\n *\n * The returned state can be modified with hooks such as useAvatarGroupStyles_unstable,\n * before being passed to renderAvatarGroup_unstable.\n *\n * @param props - props from this instance of AvatarGroup\n * @param ref - reference to root HTMLElement of AvatarGroup\n */\nexport const useAvatarGroup_unstable = (props: AvatarGroupProps, ref: React.Ref<HTMLElement>): AvatarGroupState => {\n const { layout = 'spread', size = defaultAvatarGroupSize } = props;\n\n const root = slot.always(\n getIntrinsicElementProps(\n 'div',\n {\n role: 'group',\n ...props,\n // FIXME:\n // `ref` is wrongly assigned to be `HTMLElement` instead of `HTMLDivElement`\n // but since it would be a breaking change to fix it, we are casting ref to it's proper type\n ref: ref as React.Ref<HTMLDivElement>,\n },\n ['size'],\n ),\n { elementType: 'div' },\n );\n return { layout, size, components: { root: 'div' }, root };\n};\n\nexport const defaultAvatarGroupSize = 32;\n"],"names":["React","getIntrinsicElementProps","slot","useAvatarGroup_unstable","props","ref","layout","size","defaultAvatarGroupSize","root","always","role","elementType","components"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,wBAAwB,EAAEC,IAAI,QAAQ,4BAA4B;AAG3E;;;;;;;;CAQC,GACD,OAAO,MAAMC,0BAA0B,CAACC,OAAyBC;IAC/D,MAAM,EAAEC,SAAS,QAAQ,EAAEC,OAAOC,sBAAsB,EAAE,GAAGJ;IAE7D,MAAMK,OAAOP,KAAKQ,MAAM,CACtBT,yBACE,OACA;QACEU,MAAM;QACN,GAAGP,KAAK;QACR,SAAS;QACT,4EAA4E;QAC5E,4FAA4F;QAC5FC,KAAKA;IACP,GACA;QAAC;KAAO,GAEV;QAAEO,aAAa;IAAM;IAEvB,OAAO;QAAEN;QAAQC;QAAMM,YAAY;YAAEJ,MAAM;QAAM;QAAGA;IAAK;AAC3D,EAAE;AAEF,OAAO,MAAMD,yBAAyB,GAAG"}
@@ -39,7 +39,7 @@ const useAvatar_unstable = (props, ref)=>{
39
39
  color = avatarColors[getHashCode((_ref = idForColor !== null && idForColor !== void 0 ? idForColor : name) !== null && _ref !== void 0 ? _ref : '') % avatarColors.length];
40
40
  }
41
41
  const baseId = (0, _reactutilities.useId)('avatar-');
42
- const root = _reactutilities.slot.always((0, _reactutilities.getNativeElementProps)('span', {
42
+ const root = _reactutilities.slot.always((0, _reactutilities.getIntrinsicElementProps)('span', {
43
43
  role: 'img',
44
44
  id: baseId,
45
45
  // aria-label and/or aria-labelledby are resolved below
@@ -1 +1 @@
1
- {"version":3,"sources":["useAvatar.js"],"sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps, mergeCallbacks, useId, slot } from '@fluentui/react-utilities';\nimport { getInitials } from '../../utils/index';\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';\nexport const DEFAULT_STRINGS = {\n active: 'active',\n inactive: 'inactive'\n};\nexport const useAvatar_unstable = (props, ref)=>{\n const { dir } = useFluent();\n const { shape: contextShape, size: contextSize } = useAvatarContext();\n const { name, size = contextSize !== null && contextSize !== void 0 ? contextSize : 32, shape = contextShape !== null && contextShape !== void 0 ? contextShape : 'circular', active = 'unset', activeAppearance = 'ring', idForColor } = props;\n let { color = 'neutral' } = props;\n // Resolve 'colorful' to a specific color name\n if (color === 'colorful') {\n var _ref;\n color = avatarColors[getHashCode((_ref = idForColor !== null && idForColor !== void 0 ? idForColor : name) !== null && _ref !== void 0 ? _ref : '') % avatarColors.length];\n }\n const baseId = useId('avatar-');\n const root = slot.always(getNativeElementProps('span', {\n role: 'img',\n id: baseId,\n // aria-label and/or aria-labelledby are resolved below\n ...props,\n ref\n }, /* excludedPropNames: */ [\n 'name'\n ]), {\n elementType: 'span'\n });\n const [imageHidden, setImageHidden] = React.useState(undefined);\n let image = slot.optional(props.image, {\n defaultProps: {\n alt: '',\n role: 'presentation',\n 'aria-hidden': true,\n hidden: imageHidden\n },\n elementType: 'img'\n }); // Image shouldn't be rendered if its src is not set\n if (!(image === null || image === void 0 ? void 0 : image.src)) {\n image = undefined;\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 } // Resolve the initials slot, defaulted to getInitials.\n let initials = slot.optional(props.initials, {\n renderByDefault: true,\n defaultProps: {\n children: getInitials(name, dir === 'rtl', {\n firstInitialOnly: size <= 16\n }),\n id: baseId + '__initials'\n },\n elementType: 'span'\n }); // Don't render the initials slot if it's empty\n if (!(initials === null || initials === void 0 ? void 0 : initials.children)) {\n initials = undefined;\n } // Render the icon slot *only if* there aren't any initials or image to display\n let icon = undefined;\n if (!initials && (!image || imageHidden)) {\n icon = slot.optional(props.icon, {\n renderByDefault: true,\n defaultProps: {\n children: /*#__PURE__*/ React.createElement(PersonRegular, null),\n 'aria-hidden': true\n },\n elementType: 'span'\n });\n }\n const badge = slot.optional(props.badge, {\n defaultProps: {\n size: getBadgeSize(size),\n id: baseId + '__badge'\n },\n elementType: PresenceBadge\n });\n let activeAriaLabelElement; // 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; // 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 } // 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 = /*#__PURE__*/ React.createElement(\"span\", {\n hidden: true,\n id: activeId\n }, activeText);\n } else if (root['aria-label']) {\n // Otherwise, just append it to the aria-label\n root['aria-label'] += ' ' + activeText;\n }\n }\n }\n return {\n size,\n shape,\n active,\n activeAppearance,\n activeAriaLabelElement,\n color,\n components: {\n root: 'span',\n initials: 'span',\n icon: 'span',\n image: 'img',\n badge: PresenceBadge\n },\n root,\n initials,\n icon,\n image,\n badge\n };\n};\nconst getBadgeSize = (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};\nconst avatarColors = [\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];\nconst getHashCode = (str)=>{\n let hashCode = 0;\n for(let len = 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 return hashCode;\n};\n"],"names":["DEFAULT_STRINGS","useAvatar_unstable","active","inactive","props","ref","dir","useFluent","shape","contextShape","size","contextSize","useAvatarContext","name","activeAppearance","idForColor","color","_ref","avatarColors","getHashCode","length","baseId","useId","root","slot","always","getNativeElementProps","role","id","elementType","imageHidden","setImageHidden","React","useState","undefined","image","optional","defaultProps","alt","hidden","src","onError","mergeCallbacks","onLoad","initials","renderByDefault","children","getInitials","firstInitialOnly","icon","createElement","PersonRegular","badge","getBadgeSize","PresenceBadge","activeAriaLabelElement","activeText","activeId","components","str","hashCode","len","ch","charCodeAt","shift"],"mappings":";;;;;;;;;;;IAOaA,eAAe;eAAfA;;IAIAC,kBAAkB;eAAlBA;;;;iEAXU;gCAC4C;uBACvC;4BACE;4BACA;qCACkB;+BACf;AAC1B,MAAMD,kBAAkB;IAC3BE,QAAQ;IACRC,UAAU;AACd;AACO,MAAMF,qBAAqB,CAACG,OAAOC;IACtC,MAAM,EAAEC,GAAG,EAAE,GAAGC,IAAAA,uCAAS;IACzB,MAAM,EAAEC,OAAOC,YAAY,EAAEC,MAAMC,WAAW,EAAE,GAAGC,IAAAA,+BAAgB;IACnE,MAAM,EAAEC,IAAI,EAAEH,OAAOC,gBAAgB,QAAQA,gBAAgB,KAAK,IAAIA,cAAc,EAAE,EAAEH,QAAQC,iBAAiB,QAAQA,iBAAiB,KAAK,IAAIA,eAAe,UAAU,EAAEP,SAAS,OAAO,EAAEY,mBAAmB,MAAM,EAAE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AAI,iCAAiC;IACpF;IACA,OAAOJ;AACX"}
1
+ {"version":3,"sources":["useAvatar.js"],"sourcesContent":["import * as React from 'react';\nimport { getIntrinsicElementProps, mergeCallbacks, useId, slot } from '@fluentui/react-utilities';\nimport { getInitials } from '../../utils/index';\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';\nexport const DEFAULT_STRINGS = {\n active: 'active',\n inactive: 'inactive'\n};\nexport const useAvatar_unstable = (props, ref)=>{\n const { dir } = useFluent();\n const { shape: contextShape, size: contextSize } = useAvatarContext();\n const { name, size = contextSize !== null && contextSize !== void 0 ? contextSize : 32, shape = contextShape !== null && contextShape !== void 0 ? contextShape : 'circular', active = 'unset', activeAppearance = 'ring', idForColor } = props;\n let { color = 'neutral' } = props;\n // Resolve 'colorful' to a specific color name\n if (color === 'colorful') {\n var _ref;\n color = avatarColors[getHashCode((_ref = idForColor !== null && idForColor !== void 0 ? idForColor : name) !== null && _ref !== void 0 ? _ref : '') % avatarColors.length];\n }\n const baseId = useId('avatar-');\n const root = slot.always(getIntrinsicElementProps('span', {\n role: 'img',\n id: baseId,\n // aria-label and/or aria-labelledby are resolved below\n ...props,\n ref\n }, /* excludedPropNames: */ [\n 'name'\n ]), {\n elementType: 'span'\n });\n const [imageHidden, setImageHidden] = React.useState(undefined);\n let image = slot.optional(props.image, {\n defaultProps: {\n alt: '',\n role: 'presentation',\n 'aria-hidden': true,\n hidden: imageHidden\n },\n elementType: 'img'\n }); // Image shouldn't be rendered if its src is not set\n if (!(image === null || image === void 0 ? void 0 : image.src)) {\n image = undefined;\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 } // Resolve the initials slot, defaulted to getInitials.\n let initials = slot.optional(props.initials, {\n renderByDefault: true,\n defaultProps: {\n children: getInitials(name, dir === 'rtl', {\n firstInitialOnly: size <= 16\n }),\n id: baseId + '__initials'\n },\n elementType: 'span'\n }); // Don't render the initials slot if it's empty\n if (!(initials === null || initials === void 0 ? void 0 : initials.children)) {\n initials = undefined;\n } // Render the icon slot *only if* there aren't any initials or image to display\n let icon = undefined;\n if (!initials && (!image || imageHidden)) {\n icon = slot.optional(props.icon, {\n renderByDefault: true,\n defaultProps: {\n children: /*#__PURE__*/ React.createElement(PersonRegular, null),\n 'aria-hidden': true\n },\n elementType: 'span'\n });\n }\n const badge = slot.optional(props.badge, {\n defaultProps: {\n size: getBadgeSize(size),\n id: baseId + '__badge'\n },\n elementType: PresenceBadge\n });\n let activeAriaLabelElement; // 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; // 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 } // 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 = /*#__PURE__*/ React.createElement(\"span\", {\n hidden: true,\n id: activeId\n }, activeText);\n } else if (root['aria-label']) {\n // Otherwise, just append it to the aria-label\n root['aria-label'] += ' ' + activeText;\n }\n }\n }\n return {\n size,\n shape,\n active,\n activeAppearance,\n activeAriaLabelElement,\n color,\n components: {\n root: 'span',\n initials: 'span',\n icon: 'span',\n image: 'img',\n badge: PresenceBadge\n },\n root,\n initials,\n icon,\n image,\n badge\n };\n};\nconst getBadgeSize = (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};\nconst avatarColors = [\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];\nconst getHashCode = (str)=>{\n let hashCode = 0;\n for(let len = 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 return hashCode;\n};\n"],"names":["DEFAULT_STRINGS","useAvatar_unstable","active","inactive","props","ref","dir","useFluent","shape","contextShape","size","contextSize","useAvatarContext","name","activeAppearance","idForColor","color","_ref","avatarColors","getHashCode","length","baseId","useId","root","slot","always","getIntrinsicElementProps","role","id","elementType","imageHidden","setImageHidden","React","useState","undefined","image","optional","defaultProps","alt","hidden","src","onError","mergeCallbacks","onLoad","initials","renderByDefault","children","getInitials","firstInitialOnly","icon","createElement","PersonRegular","badge","getBadgeSize","PresenceBadge","activeAriaLabelElement","activeText","activeId","components","str","hashCode","len","ch","charCodeAt","shift"],"mappings":";;;;;;;;;;;IAOaA,eAAe;eAAfA;;IAIAC,kBAAkB;eAAlBA;;;;iEAXU;gCAC+C;uBAC1C;4BACE;4BACA;qCACkB;+BACf;AAC1B,MAAMD,kBAAkB;IAC3BE,QAAQ;IACRC,UAAU;AACd;AACO,MAAMF,qBAAqB,CAACG,OAAOC;IACtC,MAAM,EAAEC,GAAG,EAAE,GAAGC,IAAAA,uCAAS;IACzB,MAAM,EAAEC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ACH;AACD,MAAMC,cAAc,CAACwC;IACjB,IAAIC,WAAW;IACf,IAAI,IAAIC,MAAMF,IAAIvC,MAAM,GAAG,GAAGyC,OAAO,GAAGA,MAAM;QAC1C,MAAMC,KAAKH,IAAII,UAAU,CAACF;QAC1B,MAAMG,QAAQH,MAAM;QACpBD,YAAY,AAACE,CAAAA,MAAME,KAAI,IAAMF,CAAAA,MAAM,IAAIE,KAAI,GAAI,iCAAiC;IACpF;IACA,OAAOJ;AACX"}
@@ -21,10 +21,13 @@ const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
21
21
  const _reactutilities = require("@fluentui/react-utilities");
22
22
  const useAvatarGroup_unstable = (props, ref)=>{
23
23
  const { layout = 'spread', size = defaultAvatarGroupSize } = props;
24
- const root = _reactutilities.slot.always((0, _reactutilities.getNativeElementProps)('div', {
24
+ const root = _reactutilities.slot.always((0, _reactutilities.getIntrinsicElementProps)('div', {
25
25
  role: 'group',
26
26
  ...props,
27
- ref
27
+ // FIXME:
28
+ // `ref` is wrongly assigned to be `HTMLElement` instead of `HTMLDivElement`
29
+ // but since it would be a breaking change to fix it, we are casting ref to it's proper type
30
+ ref: ref
28
31
  }, [
29
32
  'size'
30
33
  ]), {
@@ -1 +1 @@
1
- {"version":3,"sources":["useAvatarGroup.js"],"sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps, slot } from '@fluentui/react-utilities';\n/**\n * Create the state required to render AvatarGroup.\n *\n * The returned state can be modified with hooks such as useAvatarGroupStyles_unstable,\n * before being passed to renderAvatarGroup_unstable.\n *\n * @param props - props from this instance of AvatarGroup\n * @param ref - reference to root HTMLElement of AvatarGroup\n */ export const useAvatarGroup_unstable = (props, ref)=>{\n const { layout = 'spread', size = defaultAvatarGroupSize } = props;\n const root = slot.always(getNativeElementProps('div', {\n role: 'group',\n ...props,\n ref\n }, [\n 'size'\n ]), {\n elementType: 'div'\n });\n return {\n layout,\n size,\n components: {\n root: 'div'\n },\n root\n };\n};\nexport const defaultAvatarGroupSize = 32;\n"],"names":["useAvatarGroup_unstable","defaultAvatarGroupSize","props","ref","layout","size","root","slot","always","getNativeElementProps","role","elementType","components"],"mappings":";;;;;;;;;;;IAUiBA,uBAAuB;eAAvBA;;IAoBJC,sBAAsB;eAAtBA;;;;iEA9BU;gCACqB;AASjC,MAAMD,0BAA0B,CAACE,OAAOC;IAC/C,MAAM,EAAEC,SAAS,QAAQ,EAAEC,OAAOJ,sBAAsB,EAAE,GAAGC;IAC7D,MAAMI,OAAOC,oBAAI,CAACC,MAAM,CAACC,IAAAA,qCAAqB,EAAC,OAAO;QAClDC,MAAM;QACN,GAAGR,KAAK;QACRC;IACJ,GAAG;QACC;KACH,GAAG;QACAQ,aAAa;IACjB;IACA,OAAO;QACHP;QACAC;QACAO,YAAY;YACRN,MAAM;QACV;QACAA;IACJ;AACJ;AACO,MAAML,yBAAyB"}
1
+ {"version":3,"sources":["useAvatarGroup.js"],"sourcesContent":["import * as React from 'react';\nimport { getIntrinsicElementProps, slot } from '@fluentui/react-utilities';\n/**\n * Create the state required to render AvatarGroup.\n *\n * The returned state can be modified with hooks such as useAvatarGroupStyles_unstable,\n * before being passed to renderAvatarGroup_unstable.\n *\n * @param props - props from this instance of AvatarGroup\n * @param ref - reference to root HTMLElement of AvatarGroup\n */ export const useAvatarGroup_unstable = (props, ref)=>{\n const { layout = 'spread', size = defaultAvatarGroupSize } = props;\n const root = slot.always(getIntrinsicElementProps('div', {\n role: 'group',\n ...props,\n // FIXME:\n // `ref` is wrongly assigned to be `HTMLElement` instead of `HTMLDivElement`\n // but since it would be a breaking change to fix it, we are casting ref to it's proper type\n ref: ref\n }, [\n 'size'\n ]), {\n elementType: 'div'\n });\n return {\n layout,\n size,\n components: {\n root: 'div'\n },\n root\n };\n};\nexport const defaultAvatarGroupSize = 32;\n"],"names":["useAvatarGroup_unstable","defaultAvatarGroupSize","props","ref","layout","size","root","slot","always","getIntrinsicElementProps","role","elementType","components"],"mappings":";;;;;;;;;;;IAUiBA,uBAAuB;eAAvBA;;IAuBJC,sBAAsB;eAAtBA;;;;iEAjCU;gCACwB;AASpC,MAAMD,0BAA0B,CAACE,OAAOC;IAC/C,MAAM,EAAEC,SAAS,QAAQ,EAAEC,OAAOJ,sBAAsB,EAAE,GAAGC;IAC7D,MAAMI,OAAOC,oBAAI,CAACC,MAAM,CAACC,IAAAA,wCAAwB,EAAC,OAAO;QACrDC,MAAM;QACN,GAAGR,KAAK;QACR,SAAS;QACT,4EAA4E;QAC5E,4FAA4F;QAC5FC,KAAKA;IACT,GAAG;QACC;KACH,GAAG;QACAQ,aAAa;IACjB;IACA,OAAO;QACHP;QACAC;QACAO,YAAY;YACRN,MAAM;QACV;QACAA;IACJ;AACJ;AACO,MAAML,yBAAyB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluentui/react-avatar",
3
- "version": "9.5.40",
3
+ "version": "9.5.42",
4
4
  "description": "React components for building Microsoft web experiences.",
5
5
  "main": "lib-commonjs/index.js",
6
6
  "module": "lib/index.js",
@@ -37,16 +37,16 @@
37
37
  "@fluentui/scripts-tasks": "*"
38
38
  },
39
39
  "dependencies": {
40
- "@fluentui/react-badge": "^9.2.9",
41
- "@fluentui/react-context-selector": "^9.1.40",
40
+ "@fluentui/react-badge": "^9.2.10",
41
+ "@fluentui/react-context-selector": "^9.1.41",
42
42
  "@fluentui/react-icons": "^2.0.217",
43
- "@fluentui/react-popover": "^9.8.15",
43
+ "@fluentui/react-popover": "^9.8.17",
44
44
  "@fluentui/react-shared-contexts": "^9.10.0",
45
- "@fluentui/react-tabster": "^9.13.6",
45
+ "@fluentui/react-tabster": "^9.14.1",
46
46
  "@fluentui/react-theme": "^9.1.14",
47
- "@fluentui/react-tooltip": "^9.3.16",
48
- "@fluentui/react-utilities": "^9.15.0",
49
- "@fluentui/react-jsx-runtime": "^9.0.17",
47
+ "@fluentui/react-tooltip": "^9.3.18",
48
+ "@fluentui/react-utilities": "^9.15.1",
49
+ "@fluentui/react-jsx-runtime": "^9.0.18",
50
50
  "@griffel/react": "^1.5.14",
51
51
  "@swc/helpers": "^0.5.1"
52
52
  },