@fluentui/react-avatar 9.9.13 → 9.10.0

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.md CHANGED
@@ -1,12 +1,42 @@
1
1
  # Change Log - @fluentui/react-avatar
2
2
 
3
- This log was last generated on Wed, 17 Dec 2025 18:06:04 GMT and should not be manually modified.
3
+ This log was last generated on Thu, 12 Feb 2026 10:42:46 GMT and should not be manually modified.
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## [9.10.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-avatar_v9.10.0)
8
+
9
+ Thu, 12 Feb 2026 10:42:46 GMT
10
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-avatar_v9.9.14..@fluentui/react-avatar_v9.10.0)
11
+
12
+ ### Minor changes
13
+
14
+ - feat: add base hooks for Avatar component ([PR #35696](https://github.com/microsoft/fluentui/pull/35696) by dmytrokirpa@microsoft.com)
15
+ - Bump @fluentui/react-badge to v9.4.14 ([PR #35743](https://github.com/microsoft/fluentui/pull/35743) by beachball)
16
+ - Bump @fluentui/react-popover to v9.13.1 ([PR #35743](https://github.com/microsoft/fluentui/pull/35743) by beachball)
17
+ - Bump @fluentui/react-tooltip to v9.9.1 ([PR #35743](https://github.com/microsoft/fluentui/pull/35743) by beachball)
18
+ - Bump @fluentui/react-jsx-runtime to v9.4.0 ([PR #35743](https://github.com/microsoft/fluentui/pull/35743) by beachball)
19
+
20
+ ## [9.9.14](https://github.com/microsoft/fluentui/tree/@fluentui/react-avatar_v9.9.14)
21
+
22
+ Thu, 22 Jan 2026 17:07:02 GMT
23
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-avatar_v9.9.13..@fluentui/react-avatar_v9.9.14)
24
+
25
+ ### Patches
26
+
27
+ - Bump @fluentui/react-badge to v9.4.13 ([PR #35574](https://github.com/microsoft/fluentui/pull/35574) by beachball)
28
+ - Bump @fluentui/react-context-selector to v9.2.14 ([PR #35574](https://github.com/microsoft/fluentui/pull/35574) by beachball)
29
+ - Bump @fluentui/react-popover to v9.13.0 ([PR #35574](https://github.com/microsoft/fluentui/pull/35574) by beachball)
30
+ - Bump @fluentui/react-shared-contexts to v9.26.1 ([PR #35574](https://github.com/microsoft/fluentui/pull/35574) by beachball)
31
+ - Bump @fluentui/react-tabster to v9.26.12 ([PR #35574](https://github.com/microsoft/fluentui/pull/35574) by beachball)
32
+ - Bump @fluentui/react-theme to v9.2.1 ([PR #35574](https://github.com/microsoft/fluentui/pull/35574) by beachball)
33
+ - Bump @fluentui/react-tooltip to v9.9.0 ([PR #35574](https://github.com/microsoft/fluentui/pull/35574) by beachball)
34
+ - Bump @fluentui/react-utilities to v9.26.1 ([PR #35574](https://github.com/microsoft/fluentui/pull/35574) by beachball)
35
+ - Bump @fluentui/react-jsx-runtime to v9.3.5 ([PR #35574](https://github.com/microsoft/fluentui/pull/35574) by beachball)
36
+
7
37
  ## [9.9.13](https://github.com/microsoft/fluentui/tree/@fluentui/react-avatar_v9.9.13)
8
38
 
9
- Wed, 17 Dec 2025 18:06:04 GMT
39
+ Wed, 17 Dec 2025 18:10:11 GMT
10
40
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-avatar_v9.9.12..@fluentui/react-avatar_v9.9.13)
11
41
 
12
42
  ### Patches
package/lib/Avatar.js CHANGED
@@ -1 +1 @@
1
- export { Avatar, DEFAULT_STRINGS, avatarClassNames, renderAvatar_unstable, useAvatarStyles_unstable, useAvatar_unstable, useSizeStyles } from './components/Avatar/index';
1
+ export { Avatar, DEFAULT_STRINGS, avatarClassNames, renderAvatar_unstable, useAvatarStyles_unstable, useAvatar_unstable, useAvatarBase_unstable, useSizeStyles } from './components/Avatar/index';
package/lib/Avatar.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/Avatar.ts"],"sourcesContent":["export type {\n AvatarNamedColor,\n AvatarProps,\n AvatarShape,\n AvatarSize,\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n AvatarSizes,\n AvatarSlots,\n AvatarState,\n} from './components/Avatar/index';\nexport {\n Avatar,\n DEFAULT_STRINGS,\n avatarClassNames,\n renderAvatar_unstable,\n useAvatarStyles_unstable,\n useAvatar_unstable,\n useSizeStyles,\n} from './components/Avatar/index';\n"],"names":["Avatar","DEFAULT_STRINGS","avatarClassNames","renderAvatar_unstable","useAvatarStyles_unstable","useAvatar_unstable","useSizeStyles"],"mappings":"AAUA,SACEA,MAAM,EACNC,eAAe,EACfC,gBAAgB,EAChBC,qBAAqB,EACrBC,wBAAwB,EACxBC,kBAAkB,EAClBC,aAAa,QACR,4BAA4B"}
1
+ {"version":3,"sources":["../src/Avatar.ts"],"sourcesContent":["export type {\n AvatarNamedColor,\n AvatarBaseProps,\n AvatarProps,\n AvatarShape,\n AvatarSize,\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n AvatarSizes,\n AvatarSlots,\n AvatarBaseState,\n AvatarState,\n} from './components/Avatar/index';\nexport {\n Avatar,\n DEFAULT_STRINGS,\n avatarClassNames,\n renderAvatar_unstable,\n useAvatarStyles_unstable,\n useAvatar_unstable,\n useAvatarBase_unstable,\n useSizeStyles,\n} from './components/Avatar/index';\n"],"names":["Avatar","DEFAULT_STRINGS","avatarClassNames","renderAvatar_unstable","useAvatarStyles_unstable","useAvatar_unstable","useAvatarBase_unstable","useSizeStyles"],"mappings":"AAYA,SACEA,MAAM,EACNC,eAAe,EACfC,gBAAgB,EAChBC,qBAAqB,EACrBC,wBAAwB,EACxBC,kBAAkB,EAClBC,sBAAsB,EACtBC,aAAa,QACR,4BAA4B"}
@@ -1,3 +1 @@
1
- /**
2
- * State used in rendering Avatar
3
- */ export { };
1
+ export { };
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/Avatar/Avatar.types.ts"],"sourcesContent":["import { PresenceBadge } from '@fluentui/react-badge';\nimport type { ComponentProps, ComponentState, JSXElement, Slot } from '@fluentui/react-utilities';\n\n/**\n * Sizes for the avatar\n * @deprecated use AvatarSize instead\n */\nexport type AvatarSizes = AvatarSize;\n/**\n * Sizes for the avatar\n */\nexport type AvatarSize = 16 | 20 | 24 | 28 | 32 | 36 | 40 | 48 | 56 | 64 | 72 | 96 | 120 | 128;\n\n/**\n * Shape of the avatar\n */\nexport type AvatarShape = 'circular' | 'square';\n\nexport type AvatarSlots = {\n root: Slot<'span'>;\n\n /**\n * The Avatar's image.\n *\n * Usage e.g.: `image={{ src: '...' }}`\n */\n image?: Slot<'img'>;\n\n /**\n * (optional) Custom initials.\n *\n * It is usually not necessary to specify custom initials; by default they will be derived from the `name` prop,\n * using the `getInitials` function.\n *\n * The initials are displayed when there is no image (including while the image is loading).\n */\n initials?: Slot<'span'>;\n\n /**\n * Icon to be displayed when the avatar doesn't have an image or initials.\n *\n * @default `PersonRegular` (the default icon's size depends on the Avatar's size)\n */\n icon?: Slot<'span'>;\n\n /**\n * Badge to show the avatar's presence status.\n */\n badge?: Slot<typeof PresenceBadge>;\n};\n\n/**\n * A specific named color for the Avatar\n */\nexport type AvatarNamedColor =\n | 'dark-red'\n | 'cranberry'\n | 'red'\n | 'pumpkin'\n | 'peach'\n | 'marigold'\n | 'gold'\n | 'brass'\n | 'brown'\n | 'forest'\n | 'seafoam'\n | 'dark-green'\n | 'light-teal'\n | 'teal'\n | 'steel'\n | 'blue'\n | 'royal-blue'\n | 'cornflower'\n | 'navy'\n | 'lavender'\n | 'purple'\n | 'grape'\n | 'lilac'\n | 'pink'\n | 'magenta'\n | 'plum'\n | 'beige'\n | 'mink'\n | 'platinum'\n | 'anchor';\n\n/**\n * Properties for Avatar\n */\nexport type AvatarProps = Omit<ComponentProps<AvatarSlots>, 'color'> & {\n /**\n * Optional activity indicator\n * * active: the avatar will be decorated according to activeAppearance\n * * inactive: the avatar will be reduced in size and partially transparent\n * * unset: normal display\n *\n * @default unset\n */\n active?: 'active' | 'inactive' | 'unset';\n\n /**\n * The appearance when `active=\"active\"`\n *\n * @default ring\n */\n activeAppearance?: 'ring' | 'shadow' | 'ring-shadow';\n\n /**\n * The color when displaying either an icon or initials.\n * * neutral (default): gray\n * * brand: color from the brand palette\n * * colorful: picks a color from a set of pre-defined colors, based on a hash of the name (or idForColor if provided)\n * * [AvatarNamedColor]: a specific color from the theme\n *\n * @default neutral\n */\n color?: 'neutral' | 'brand' | 'colorful' | AvatarNamedColor;\n\n /**\n * Specify a string to be used instead of the name, to determine which color to use when color=\"colorful\".\n * Use this when a name is not available, but there is another unique identifier that can be used instead.\n */\n idForColor?: string | undefined;\n\n /**\n * The name of the person or entity represented by this Avatar. This should always be provided if it is available.\n *\n * The name is used to determine the initials displayed when there is no image. It is also provided to\n * accessibility tools.\n */\n name?: string;\n\n /**\n * The avatar can have a circular or square shape.\n * @default circular\n */\n shape?: AvatarShape;\n\n /**\n * Size of the avatar in pixels.\n *\n * Size is restricted to a limited set of supported values recommended for most uses (see `AvatarSizeValue`) and\n * based on design guidelines for the Avatar control.\n *\n * Note: At size 16, if initials are displayed, only the first initial will be rendered.\n *\n * If a non-supported size is needed, 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?: JSXElement;\n };\n"],"names":[],"mappings":"AA6JA;;CAEC,GACD,WAWI"}
1
+ {"version":3,"sources":["../src/components/Avatar/Avatar.types.ts"],"sourcesContent":["import { PresenceBadge } from '@fluentui/react-badge';\nimport type { ComponentProps, ComponentState, JSXElement, Slot } from '@fluentui/react-utilities';\n\n/**\n * Sizes for the avatar\n * @deprecated use AvatarSize instead\n */\nexport type AvatarSizes = AvatarSize;\n/**\n * Sizes for the avatar\n */\nexport type AvatarSize = 16 | 20 | 24 | 28 | 32 | 36 | 40 | 48 | 56 | 64 | 72 | 96 | 120 | 128;\n\n/**\n * Shape of the avatar\n */\nexport type AvatarShape = 'circular' | 'square';\n\nexport type AvatarSlots = {\n root: Slot<'span'>;\n\n /**\n * The Avatar's image.\n *\n * Usage e.g.: `image={{ src: '...' }}`\n */\n image?: Slot<'img'>;\n\n /**\n * (optional) Custom initials.\n *\n * It is usually not necessary to specify custom initials; by default they will be derived from the `name` prop,\n * using the `getInitials` function.\n *\n * The initials are displayed when there is no image (including while the image is loading).\n */\n initials?: Slot<'span'>;\n\n /**\n * Icon to be displayed when the avatar doesn't have an image or initials.\n *\n * @default `PersonRegular` (the default icon's size depends on the Avatar's size)\n */\n icon?: Slot<'span'>;\n\n /**\n * Badge to show the avatar's presence status.\n */\n badge?: Slot<typeof PresenceBadge>;\n};\n\n/**\n * A specific named color for the Avatar\n */\nexport type AvatarNamedColor =\n | 'dark-red'\n | 'cranberry'\n | 'red'\n | 'pumpkin'\n | 'peach'\n | 'marigold'\n | 'gold'\n | 'brass'\n | 'brown'\n | 'forest'\n | 'seafoam'\n | 'dark-green'\n | 'light-teal'\n | 'teal'\n | 'steel'\n | 'blue'\n | 'royal-blue'\n | 'cornflower'\n | 'navy'\n | 'lavender'\n | 'purple'\n | 'grape'\n | 'lilac'\n | 'pink'\n | 'magenta'\n | 'plum'\n | 'beige'\n | 'mink'\n | 'platinum'\n | 'anchor';\n\n/**\n * Properties for Avatar\n */\nexport type AvatarProps = Omit<ComponentProps<AvatarSlots>, 'color'> & {\n /**\n * Optional activity indicator\n * * active: the avatar will be decorated according to activeAppearance\n * * inactive: the avatar will be reduced in size and partially transparent\n * * unset: normal display\n *\n * @default unset\n */\n active?: 'active' | 'inactive' | 'unset';\n\n /**\n * The appearance when `active=\"active\"`\n *\n * @default ring\n */\n activeAppearance?: 'ring' | 'shadow' | 'ring-shadow';\n\n /**\n * The color when displaying either an icon or initials.\n * * neutral (default): gray\n * * brand: color from the brand palette\n * * colorful: picks a color from a set of pre-defined colors, based on a hash of the name (or idForColor if provided)\n * * [AvatarNamedColor]: a specific color from the theme\n *\n * @default neutral\n */\n color?: 'neutral' | 'brand' | 'colorful' | AvatarNamedColor;\n\n /**\n * Specify a string to be used instead of the name, to determine which color to use when color=\"colorful\".\n * Use this when a name is not available, but there is another unique identifier that can be used instead.\n */\n idForColor?: string | undefined;\n\n /**\n * The name of the person or entity represented by this Avatar. This should always be provided if it is available.\n *\n * The name is used to determine the initials displayed when there is no image. It is also provided to\n * accessibility tools.\n */\n name?: string;\n\n /**\n * The avatar can have a circular or square shape.\n * @default circular\n */\n shape?: AvatarShape;\n\n /**\n * Size of the avatar in pixels.\n *\n * Size is restricted to a limited set of supported values recommended for most uses (see `AvatarSizeValue`) and\n * based on design guidelines for the Avatar control.\n *\n * Note: At size 16, if initials are displayed, only the first initial will be rendered.\n *\n * If a non-supported size is needed, 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\nexport type AvatarBaseProps = ComponentProps<Omit<AvatarSlots, 'badge'>> & Pick<AvatarProps, 'name'>;\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?: JSXElement;\n };\n\nexport type AvatarBaseState = ComponentState<Omit<AvatarSlots, 'badge'>> & Pick<AvatarState, 'activeAriaLabelElement'>;\n"],"names":[],"mappings":"AA+KA,WAAuH"}
@@ -1,4 +1,4 @@
1
1
  export { Avatar } from './Avatar';
2
2
  export { renderAvatar_unstable } from './renderAvatar';
3
- export { DEFAULT_STRINGS, useAvatar_unstable } from './useAvatar';
3
+ export { DEFAULT_STRINGS, useAvatar_unstable, useAvatarBase_unstable } from './useAvatar';
4
4
  export { avatarClassNames, useAvatarStyles_unstable, useSizeStyles } from './useAvatarStyles.styles';
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/Avatar/index.ts"],"sourcesContent":["export type {\n AvatarNamedColor,\n AvatarProps,\n AvatarShape,\n AvatarSize,\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n AvatarSizes,\n AvatarSlots,\n AvatarState,\n} from './Avatar.types';\nexport { Avatar } from './Avatar';\nexport { renderAvatar_unstable } from './renderAvatar';\nexport { DEFAULT_STRINGS, useAvatar_unstable } from './useAvatar';\nexport { avatarClassNames, useAvatarStyles_unstable, useSizeStyles } from './useAvatarStyles.styles';\n"],"names":["Avatar","renderAvatar_unstable","DEFAULT_STRINGS","useAvatar_unstable","avatarClassNames","useAvatarStyles_unstable","useSizeStyles"],"mappings":"AAUA,SAASA,MAAM,QAAQ,WAAW;AAClC,SAASC,qBAAqB,QAAQ,iBAAiB;AACvD,SAASC,eAAe,EAAEC,kBAAkB,QAAQ,cAAc;AAClE,SAASC,gBAAgB,EAAEC,wBAAwB,EAAEC,aAAa,QAAQ,2BAA2B"}
1
+ {"version":3,"sources":["../src/components/Avatar/index.ts"],"sourcesContent":["export type {\n AvatarNamedColor,\n AvatarBaseProps,\n AvatarProps,\n AvatarShape,\n AvatarSize,\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n AvatarSizes,\n AvatarSlots,\n AvatarBaseState,\n AvatarState,\n} from './Avatar.types';\nexport { Avatar } from './Avatar';\nexport { renderAvatar_unstable } from './renderAvatar';\nexport { DEFAULT_STRINGS, useAvatar_unstable, useAvatarBase_unstable } from './useAvatar';\nexport { avatarClassNames, useAvatarStyles_unstable, useSizeStyles } from './useAvatarStyles.styles';\n"],"names":["Avatar","renderAvatar_unstable","DEFAULT_STRINGS","useAvatar_unstable","useAvatarBase_unstable","avatarClassNames","useAvatarStyles_unstable","useSizeStyles"],"mappings":"AAYA,SAASA,MAAM,QAAQ,WAAW;AAClC,SAASC,qBAAqB,QAAQ,iBAAiB;AACvD,SAASC,eAAe,EAAEC,kBAAkB,EAAEC,sBAAsB,QAAQ,cAAc;AAC1F,SAASC,gBAAgB,EAAEC,wBAAwB,EAAEC,aAAa,QAAQ,2BAA2B"}
@@ -1,6 +1,6 @@
1
1
  'use client';
2
2
  import * as React from 'react';
3
- import { getIntrinsicElementProps, mergeCallbacks, useId, slot } from '@fluentui/react-utilities';
3
+ import { mergeCallbacks, useId, slot } from '@fluentui/react-utilities';
4
4
  import { getInitials } from '../../utils/index';
5
5
  import { PersonRegular } from '@fluentui/react-icons';
6
6
  import { PresenceBadge } from '@fluentui/react-badge';
@@ -13,23 +13,96 @@ export const DEFAULT_STRINGS = {
13
13
  export const useAvatar_unstable = (props, ref)=>{
14
14
  const { dir } = useFluent();
15
15
  const { shape: contextShape, size: contextSize } = useAvatarContext();
16
- const { name, size = contextSize !== null && contextSize !== void 0 ? contextSize : 32, shape = contextShape !== null && contextShape !== void 0 ? contextShape : 'circular', active = 'unset', activeAppearance = 'ring', idForColor } = props;
17
- let { color = 'neutral' } = props;
16
+ const { size = contextSize !== null && contextSize !== void 0 ? contextSize : 32, shape = contextShape !== null && contextShape !== void 0 ? contextShape : 'circular', active = 'unset', activeAppearance = 'ring', idForColor, color: propColor = 'neutral', ...rest } = props;
17
+ const state = useAvatarBase_unstable(rest, ref);
18
+ var _ref;
18
19
  // Resolve 'colorful' to a specific color name
19
- if (color === 'colorful') {
20
- var _ref;
21
- color = avatarColors[getHashCode((_ref = idForColor !== null && idForColor !== void 0 ? idForColor : name) !== null && _ref !== void 0 ? _ref : '') % avatarColors.length];
20
+ const color = propColor === 'colorful' ? avatarColors[getHashCode((_ref = idForColor !== null && idForColor !== void 0 ? idForColor : props.name) !== null && _ref !== void 0 ? _ref : '') % avatarColors.length] : propColor;
21
+ if (state.initials) {
22
+ var _state_initials;
23
+ state.initials = slot.optional(props.initials, {
24
+ renderByDefault: true,
25
+ defaultProps: {
26
+ children: getInitials(props.name, dir === 'rtl', {
27
+ firstInitialOnly: size <= 16
28
+ }),
29
+ id: (_state_initials = state.initials) === null || _state_initials === void 0 ? void 0 : _state_initials.id
30
+ },
31
+ elementType: 'span'
32
+ });
33
+ }
34
+ if (state.icon) {
35
+ var _state_icon;
36
+ var _children;
37
+ (_children = (_state_icon = state.icon).children) !== null && _children !== void 0 ? _children : _state_icon.children = /*#__PURE__*/ React.createElement(PersonRegular, null);
38
+ }
39
+ const badge = slot.optional(props.badge, {
40
+ defaultProps: {
41
+ size: getBadgeSize(size),
42
+ id: state.root.id + '__badge'
43
+ },
44
+ elementType: PresenceBadge
45
+ });
46
+ let activeAriaLabelElement = state.activeAriaLabelElement;
47
+ // Enhance aria-label and/or aria-labelledby to include badge and active state
48
+ // Only process if aria attributes were not explicitly provided by the user
49
+ const userProvidedAriaLabel = props['aria-label'] !== undefined;
50
+ const userProvidedAriaLabelledby = props['aria-labelledby'] !== undefined;
51
+ if (!userProvidedAriaLabel && !userProvidedAriaLabelledby) {
52
+ if (props.name) {
53
+ if (badge) {
54
+ state.root['aria-labelledby'] = state.root.id + ' ' + badge.id;
55
+ }
56
+ } else if (state.initials) {
57
+ // root's aria-label should be the name, but fall back to being labelledby the initials if name is missing
58
+ state.root['aria-labelledby'] = state.initials.id + (badge ? ' ' + badge.id : '');
59
+ delete state.root['aria-label'];
60
+ }
61
+ // Add the active state to the aria label
62
+ if (active === 'active' || active === 'inactive') {
63
+ const activeText = DEFAULT_STRINGS[active];
64
+ if (state.root['aria-labelledby']) {
65
+ // If using aria-labelledby, render a hidden span and append it to the labelledby
66
+ const activeId = state.root.id + '__active';
67
+ state.root['aria-labelledby'] += ' ' + activeId;
68
+ activeAriaLabelElement = /*#__PURE__*/ React.createElement("span", {
69
+ hidden: true,
70
+ id: activeId
71
+ }, activeText);
72
+ } else if (state.root['aria-label']) {
73
+ // Otherwise, just append it to the aria-label
74
+ state.root['aria-label'] += ' ' + activeText;
75
+ }
76
+ }
22
77
  }
78
+ return {
79
+ ...state,
80
+ size,
81
+ shape,
82
+ active,
83
+ activeAppearance,
84
+ activeAriaLabelElement,
85
+ color,
86
+ badge,
87
+ // eslint-disable-next-line @typescript-eslint/no-deprecated
88
+ components: {
89
+ ...state.components,
90
+ badge: PresenceBadge
91
+ }
92
+ };
93
+ };
94
+ /**
95
+ * Base hook for Avatar component, manages state and structure common to all variants of Avatar
96
+ */ export const useAvatarBase_unstable = (props, ref)=>{
97
+ const { dir } = useFluent();
98
+ const { name, ...rest } = props;
23
99
  const baseId = useId('avatar-');
24
- const root = slot.always(getIntrinsicElementProps('span', {
100
+ const root = slot.always({
25
101
  role: 'img',
26
102
  id: baseId,
27
- // aria-label and/or aria-labelledby are resolved below
28
- ...props,
29
- ref
30
- }, /* excludedPropNames: */ [
31
- 'name'
32
- ]), {
103
+ ref,
104
+ ...rest
105
+ }, {
33
106
  elementType: 'span'
34
107
  });
35
108
  const [imageHidden, setImageHidden] = React.useState(undefined);
@@ -41,91 +114,62 @@ export const useAvatar_unstable = (props, ref)=>{
41
114
  hidden: imageHidden
42
115
  },
43
116
  elementType: 'img'
44
- }); // Image shouldn't be rendered if its src is not set
117
+ });
118
+ // Image shouldn't be rendered if its src is not set
45
119
  if (!(image === null || image === void 0 ? void 0 : image.src)) {
46
120
  image = undefined;
47
- } // Hide the image if it fails to load and restore it on a successful load
121
+ }
122
+ // Hide the image if it fails to load and restore it on a successful load
48
123
  if (image) {
49
124
  image.onError = mergeCallbacks(image.onError, ()=>setImageHidden(true));
50
125
  image.onLoad = mergeCallbacks(image.onLoad, ()=>setImageHidden(undefined));
51
- } // Resolve the initials slot, defaulted to getInitials.
126
+ }
127
+ // Resolve the initials slot, defaulted to getInitials
52
128
  let initials = slot.optional(props.initials, {
53
129
  renderByDefault: true,
54
130
  defaultProps: {
55
- children: getInitials(name, dir === 'rtl', {
56
- firstInitialOnly: size <= 16
57
- }),
131
+ children: getInitials(name, dir === 'rtl'),
58
132
  id: baseId + '__initials'
59
133
  },
60
134
  elementType: 'span'
61
- }); // Don't render the initials slot if it's empty
135
+ });
136
+ // Don't render the initials slot if it's empty
62
137
  if (!(initials === null || initials === void 0 ? void 0 : initials.children)) {
63
138
  initials = undefined;
64
- } // Render the icon slot *only if* there aren't any initials or image to display
139
+ }
140
+ // Render the icon slot *only if* there aren't any initials or image to display
65
141
  let icon = undefined;
66
142
  if (!initials && (!image || imageHidden)) {
67
143
  icon = slot.optional(props.icon, {
68
144
  renderByDefault: true,
69
145
  defaultProps: {
70
- children: /*#__PURE__*/ React.createElement(PersonRegular, null),
71
146
  'aria-hidden': true
72
147
  },
73
148
  elementType: 'span'
74
149
  });
75
150
  }
76
- const badge = slot.optional(props.badge, {
77
- defaultProps: {
78
- size: getBadgeSize(size),
79
- id: baseId + '__badge'
80
- },
81
- elementType: PresenceBadge
82
- });
83
- let activeAriaLabelElement; // Resolve aria-label and/or aria-labelledby if not provided by the user
151
+ let activeAriaLabelElement;
152
+ // Resolve aria-label and/or aria-labelledby if not provided by the user
84
153
  if (!root['aria-label'] && !root['aria-labelledby']) {
85
154
  if (name) {
86
- root['aria-label'] = name; // Include the badge in labelledby if it exists
87
- if (badge) {
88
- root['aria-labelledby'] = root.id + ' ' + badge.id;
89
- }
155
+ root['aria-label'] = name;
90
156
  } else if (initials) {
91
157
  // root's aria-label should be the name, but fall back to being labelledby the initials if name is missing
92
- root['aria-labelledby'] = initials.id + (badge ? ' ' + badge.id : '');
93
- } // Add the active state to the aria label
94
- if (active === 'active' || active === 'inactive') {
95
- const activeText = DEFAULT_STRINGS[active];
96
- if (root['aria-labelledby']) {
97
- // If using aria-labelledby, render a hidden span and append it to the labelledby
98
- const activeId = baseId + '__active';
99
- root['aria-labelledby'] += ' ' + activeId;
100
- activeAriaLabelElement = /*#__PURE__*/ React.createElement("span", {
101
- hidden: true,
102
- id: activeId
103
- }, activeText);
104
- } else if (root['aria-label']) {
105
- // Otherwise, just append it to the aria-label
106
- root['aria-label'] += ' ' + activeText;
107
- }
158
+ root['aria-labelledby'] = initials.id;
108
159
  }
109
160
  }
110
161
  return {
111
- size,
112
- shape,
113
- active,
114
- activeAppearance,
115
162
  activeAriaLabelElement,
116
- color,
117
163
  components: {
118
164
  root: 'span',
119
165
  initials: 'span',
120
166
  icon: 'span',
121
- image: 'img',
122
- badge: PresenceBadge
167
+ image: 'img'
123
168
  },
124
169
  root,
125
170
  initials,
126
171
  icon,
127
- image,
128
- badge
172
+ image
129
173
  };
130
174
  };
131
175
  const getBadgeSize = (size)=>{
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/Avatar/useAvatar.tsx"],"sourcesContent":["'use client';\n\nimport * 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;AAEA,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,MAAMC,kBAAkB;IAC7BC,QAAQ;IACRC,UAAU;AACZ,EAAE;AAEF,OAAO,MAAMC,qBAAqB,CAACC,OAAoBC;IACrD,MAAM,EAAEC,GAAG,EAAE,GAAGR;IAChB,MAAM,EAAES,OAAOC,YAAY,EAAEC,MAAMC,WAAW,EAAE,GAAGX;IACnD,MAAM,EACJY,IAAI,EACJF,OAAOC,wBAAAA,yBAAAA,cAAgB,EAAY,EACnCH,QAAQC,yBAAAA,0BAAAA,eAAgB,UAAU,EAClCP,SAAS,OAAO,EAChBW,mBAAmB,MAAM,EACzBC,UAAU,EACX,GAAGT;IACJ,IAAI,EAAEU,QAAQ,SAAS,EAAE,GAAGV;IAE5B,8CAA8C;IAC9C,IAAIU,UAAU,YAAY;YACSD;QAAjCC,QAAQC,YAAY,CAACC,YAAYH,CAAAA,OAAAA,uBAAAA,wBAAAA,aAAcF,kBAAdE,kBAAAA,OAAsB,MAAME,aAAaE,MAAM,CAAC;IACnF;IAEA,MAAMC,SAAS1B,MAAM;IAErB,MA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,IAAIA,QAAQ,IAAI;QACd,OAAO;IACT,OAAO,IAAIA,QAAQ,IAAI;QACrB,OAAO;IACT,OAAO,IAAIA,QAAQ,IAAI;QACrB,OAAO;IACT,OAAO,IAAIA,QAAQ,IAAI;QACrB,OAAO;IACT,OAAO,IAAIA,QAAQ,IAAI;QACrB,OAAO;IACT,OAAO;QACL,OAAO;IACT;AACF;AAEA,MAAMM,eAAmC;IACvC;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACD;AAED,MAAMC,cAAc,CAACgC;IACnB,IAAIC,WAAW;IACf,IAAK,IAAIC,MAAcF,IAAI/B,MAAM,GAAG,GAAGiC,OAAO,GAAGA,MAAO;QACtD,MAAMC,KAAKH,IAAII,UAAU,CAACF;QAC1B,MAAMG,QAAQH,MAAM;QACpBD,YAAY,AAACE,CAAAA,MAAME,KAAI,IAAMF,CAAAA,MAAO,IAAIE,KAAK,GAAI,iCAAiC;IACpF;IAEA,OAAOJ;AACT"}
1
+ {"version":3,"sources":["../src/components/Avatar/useAvatar.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { mergeCallbacks, useId, slot } from '@fluentui/react-utilities';\nimport { getInitials } from '../../utils/index';\nimport type { AvatarBaseProps, AvatarBaseState, 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 size = contextSize ?? (32 as const),\n shape = contextShape ?? 'circular',\n active = 'unset',\n activeAppearance = 'ring',\n idForColor,\n color: propColor = 'neutral',\n ...rest\n } = props;\n\n const state = useAvatarBase_unstable(rest, ref);\n\n // Resolve 'colorful' to a specific color name\n const color: AvatarState['color'] =\n propColor === 'colorful'\n ? avatarColors[getHashCode(idForColor ?? props.name ?? '') % avatarColors.length]\n : propColor;\n\n if (state.initials) {\n state.initials = slot.optional(props.initials, {\n renderByDefault: true,\n defaultProps: {\n children: getInitials(props.name, dir === 'rtl', { firstInitialOnly: size <= 16 }),\n id: state.initials?.id,\n },\n elementType: 'span',\n });\n }\n\n if (state.icon) {\n state.icon.children ??= <PersonRegular />;\n }\n\n const badge: AvatarState['badge'] = slot.optional(props.badge, {\n defaultProps: { size: getBadgeSize(size), id: state.root.id + '__badge' },\n elementType: PresenceBadge,\n });\n\n let activeAriaLabelElement: AvatarState['activeAriaLabelElement'] = state.activeAriaLabelElement;\n\n // Enhance aria-label and/or aria-labelledby to include badge and active state\n // Only process if aria attributes were not explicitly provided by the user\n const userProvidedAriaLabel = props['aria-label'] !== undefined;\n const userProvidedAriaLabelledby = props['aria-labelledby'] !== undefined;\n\n if (!userProvidedAriaLabel && !userProvidedAriaLabelledby) {\n if (props.name) {\n if (badge) {\n state.root['aria-labelledby'] = state.root.id + ' ' + badge.id;\n }\n } else if (state.initials) {\n // root's aria-label should be the name, but fall back to being labelledby the initials if name is missing\n state.root['aria-labelledby'] = state.initials.id + (badge ? ' ' + badge.id : '');\n delete state.root['aria-label'];\n }\n // Add the active state to the aria label\n if (active === 'active' || active === 'inactive') {\n const activeText = DEFAULT_STRINGS[active];\n if (state.root['aria-labelledby']) {\n // If using aria-labelledby, render a hidden span and append it to the labelledby\n const activeId = state.root.id + '__active';\n state.root['aria-labelledby'] += ' ' + activeId;\n activeAriaLabelElement = (\n <span hidden id={activeId}>\n {activeText}\n </span>\n );\n } else if (state.root['aria-label']) {\n // Otherwise, just append it to the aria-label\n state.root['aria-label'] += ' ' + activeText;\n }\n }\n }\n\n return {\n ...state,\n size,\n shape,\n active,\n activeAppearance,\n activeAriaLabelElement,\n color,\n badge,\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n components: { ...state.components, badge: PresenceBadge },\n };\n};\n\n/**\n * Base hook for Avatar component, manages state and structure common to all variants of Avatar\n */\nexport const useAvatarBase_unstable = (props: AvatarBaseProps, ref?: React.Ref<HTMLElement>): AvatarBaseState => {\n const { dir } = useFluent();\n const { name, ...rest } = props;\n\n const baseId = useId('avatar-');\n\n const root: AvatarBaseState['root'] = slot.always(\n {\n role: 'img',\n id: baseId,\n ref,\n ...rest,\n },\n { elementType: 'span' },\n );\n\n const [imageHidden, setImageHidden] = React.useState<true | undefined>(undefined);\n\n let image: AvatarBaseState['image'] = slot.optional(props.image, {\n defaultProps: { alt: '', role: 'presentation', 'aria-hidden': true, hidden: imageHidden },\n elementType: 'img',\n });\n\n // Image shouldn't be rendered if its src is not set\n if (!image?.src) {\n image = undefined;\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: AvatarBaseState['initials'] = slot.optional(props.initials, {\n renderByDefault: true,\n defaultProps: {\n children: getInitials(name, dir === 'rtl'),\n id: baseId + '__initials',\n },\n elementType: 'span',\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: AvatarBaseState['icon'] = undefined;\n if (!initials && (!image || imageHidden)) {\n icon = slot.optional(props.icon, {\n renderByDefault: true,\n defaultProps: {\n 'aria-hidden': true,\n },\n elementType: 'span',\n });\n }\n\n let activeAriaLabelElement: AvatarBaseState['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 } 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;\n }\n }\n\n return {\n activeAriaLabelElement,\n components: { root: 'span', initials: 'span', icon: 'span', image: 'img' },\n root,\n initials,\n icon,\n image,\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"],"names":["React","mergeCallbacks","useId","slot","getInitials","PersonRegular","PresenceBadge","useFluent_unstable","useFluent","useAvatarContext","DEFAULT_STRINGS","active","inactive","useAvatar_unstable","props","ref","dir","shape","contextShape","size","contextSize","activeAppearance","idForColor","color","propColor","rest","state","useAvatarBase_unstable","avatarColors","getHashCode","name","length","initials","optional","renderByDefault","defaultProps","children","firstInitialOnly","id","elementType","icon","badge","getBadgeSize","root","activeAriaLabelElement","userProvidedAriaLabel","undefined","userProvidedAriaLabelledby","activeText","activeId","span","hidden","components","baseId","always","role","imageHidden","setImageHidden","useState","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IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACD;AAED,MAAMC,cAAc,CAACmC;IACnB,IAAIC,WAAW;IACf,IAAK,IAAIC,MAAcF,IAAIjC,MAAM,GAAG,GAAGmC,OAAO,GAAGA,MAAO;QACtD,MAAMC,KAAKH,IAAII,UAAU,CAACF;QAC1B,MAAMG,QAAQH,MAAM;QACpBD,YAAY,AAACE,CAAAA,MAAME,KAAI,IAAMF,CAAAA,MAAO,IAAIE,KAAK,GAAI,iCAAiC;IACpF;IAEA,OAAOJ;AACT"}
@@ -18,7 +18,7 @@ import { useHasParentContext } from '@fluentui/react-context-selector';
18
18
  const groupSize = useAvatarGroupContext_unstable((ctx)=>ctx.size);
19
19
  const layout = useAvatarGroupContext_unstable((ctx)=>ctx.layout);
20
20
  // Since the primary slot is not an intrinsic element, getPartitionedNativeProps cannot be used here.
21
- const { style, className, ...avatarSlotProps } = props;
21
+ const { style, className, overflowLabel, ...avatarSlotProps } = props;
22
22
  const size = groupSize !== null && groupSize !== void 0 ? groupSize : defaultAvatarGroupSize;
23
23
  const hasAvatarGroupContext = useHasParentContext(AvatarGroupContext);
24
24
  if (process.env.NODE_ENV !== 'production' && !hasAvatarGroupContext) {
@@ -50,7 +50,7 @@ import { useHasParentContext } from '@fluentui/react-context-selector';
50
50
  },
51
51
  elementType: Avatar
52
52
  }),
53
- overflowLabel: slot.always(props.overflowLabel, {
53
+ overflowLabel: slot.always(overflowLabel, {
54
54
  defaultProps: {
55
55
  // Avatar already has its aria-label set to the name, this will prevent the name to be read twice.
56
56
  'aria-hidden': true,
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/AvatarGroupItem/useAvatarGroupItem.ts"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { Avatar } from '../Avatar/Avatar';\nimport { AvatarGroupContext, useAvatarGroupContext_unstable } from '../../contexts/AvatarGroupContext';\nimport { defaultAvatarGroupSize } from '../AvatarGroup/useAvatarGroup';\nimport { slot } from '@fluentui/react-utilities';\nimport { useHasParentContext } from '@fluentui/react-context-selector';\nimport type { AvatarGroupItemProps, AvatarGroupItemState } from './AvatarGroupItem.types';\n\n/**\n * Create the state required to render AvatarGroupItem.\n *\n * The returned state can be modified with hooks such as useAvatarGroupItemStyles_unstable,\n * before being passed to renderAvatarGroupItem_unstable.\n *\n * @param props - props from this instance of AvatarGroupItem\n * @param ref - reference to root HTMLElement of AvatarGroupItem\n */\nexport const useAvatarGroupItem_unstable = (\n props: AvatarGroupItemProps,\n ref: React.Ref<HTMLElement>,\n): AvatarGroupItemState => {\n const groupIsOverflow = useAvatarGroupContext_unstable(ctx => ctx.isOverflow);\n const groupSize = useAvatarGroupContext_unstable(ctx => ctx.size);\n const layout = useAvatarGroupContext_unstable(ctx => ctx.layout);\n // Since the primary slot is not an intrinsic element, getPartitionedNativeProps cannot be used here.\n const { style, className, ...avatarSlotProps } = props;\n const size = groupSize ?? defaultAvatarGroupSize;\n const hasAvatarGroupContext = useHasParentContext(AvatarGroupContext);\n\n if (process.env.NODE_ENV !== 'production' && !hasAvatarGroupContext) {\n // eslint-disable-next-line no-console\n console.warn('AvatarGroupItem must only be used inside an AvatarGroup component.');\n }\n\n return {\n isOverflowItem: groupIsOverflow,\n layout,\n size,\n components: {\n root: groupIsOverflow ? 'li' : 'div',\n avatar: Avatar,\n overflowLabel: 'span',\n },\n root: slot.always(props.root, {\n defaultProps: {\n style,\n className,\n },\n elementType: groupIsOverflow ? 'li' : 'div',\n }),\n avatar: slot.always(props.avatar, {\n defaultProps: {\n ref,\n size,\n color: 'colorful',\n ...avatarSlotProps,\n },\n elementType: Avatar,\n }),\n overflowLabel: slot.always(props.overflowLabel, {\n defaultProps: {\n // Avatar already has its aria-label set to the name, this will prevent the name to be read twice.\n 'aria-hidden': true,\n children: props.name,\n },\n elementType: 'span',\n }),\n };\n};\n"],"names":["React","Avatar","AvatarGroupContext","useAvatarGroupContext_unstable","defaultAvatarGroupSize","slot","useHasParentContext","useAvatarGroupItem_unstable","props","ref","groupIsOverflow","ctx","isOverflow","groupSize","size","layout","style","className","avatarSlotProps","hasAvatarGroupContext","process","env","NODE_ENV","console","warn","isOverflowItem","components","root","avatar","overflowLabel","always","defaultProps","elementType","color","children","name"],"mappings":"AAAA;AAEA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,SAASC,kBAAkB,EAAEC,8BAA8B,QAAQ,oCAAoC;AACvG,SAASC,sBAAsB,QAAQ,gCAAgC;AACvE,SAASC,IAAI,QAAQ,4BAA4B;AACjD,SAASC,mBAAmB,QAAQ,mCAAmC;AAGvE;;;;;;;;CAQC,GACD,OAAO,MAAMC,8BAA8B,CACzCC,OACAC;IAEA,MAAMC,kBAAkBP,+BAA+BQ,CAAAA,MAAOA,IAAIC,UAAU;IAC5E,MAAMC,YAAYV,+BAA+BQ,CAAAA,MAAOA,IAAIG,IAAI;IAChE,MAAMC,SAASZ,+BAA+BQ,CAAAA,MAAOA,IAAII,MAAM;IAC/D,qGAAqG;IACrG,MAAM,EAAEC,KAAK,EAAEC,SAAS,EAAE,GAAGC,iBAAiB,GAAGV;IACjD,MAAMM,OAAOD,sBAAAA,uBAAAA,YAAaT;IAC1B,MAAMe,wBAAwBb,oBAAoBJ;IAElD,IAAIkB,QAAQC,GAAG,CAACC,QAAQ,KAAK,gBAAgB,CAACH,uBAAuB;QACnE,sCAAsC;QACtCI,QAAQC,IAAI,CAAC;IACf;IAEA,OAAO;QACLC,gBAAgBf;QAChBK;QACAD;QACAY,YAAY;YACVC,MAAMjB,kBAAkB,OAAO;YAC/BkB,QAAQ3B;YACR4B,eAAe;QACjB;QACAF,MAAMtB,KAAKyB,MAAM,CAACtB,MAAMmB,IAAI,EAAE;YAC5BI,cAAc;gBACZf;gBACAC;YACF;YACAe,aAAatB,kBAAkB,OAAO;QACxC;QACAkB,QAAQvB,KAAKyB,MAAM,CAACtB,MAAMoB,MAAM,EAAE;YAChCG,cAAc;gBACZtB;gBACAK;gBACAmB,OAAO;gBACP,GAAGf,eAAe;YACpB;YACAc,aAAa/B;QACf;QACA4B,eAAexB,KAAKyB,MAAM,CAACtB,MAAMqB,aAAa,EAAE;YAC9CE,cAAc;gBACZ,kGAAkG;gBAClG,eAAe;gBACfG,UAAU1B,MAAM2B,IAAI;YACtB;YACAH,aAAa;QACf;IACF;AACF,EAAE"}
1
+ {"version":3,"sources":["../src/components/AvatarGroupItem/useAvatarGroupItem.ts"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { Avatar } from '../Avatar/Avatar';\nimport { AvatarGroupContext, useAvatarGroupContext_unstable } from '../../contexts/AvatarGroupContext';\nimport { defaultAvatarGroupSize } from '../AvatarGroup/useAvatarGroup';\nimport { slot } from '@fluentui/react-utilities';\nimport { useHasParentContext } from '@fluentui/react-context-selector';\nimport type { AvatarGroupItemProps, AvatarGroupItemState } from './AvatarGroupItem.types';\n\n/**\n * Create the state required to render AvatarGroupItem.\n *\n * The returned state can be modified with hooks such as useAvatarGroupItemStyles_unstable,\n * before being passed to renderAvatarGroupItem_unstable.\n *\n * @param props - props from this instance of AvatarGroupItem\n * @param ref - reference to root HTMLElement of AvatarGroupItem\n */\nexport const useAvatarGroupItem_unstable = (\n props: AvatarGroupItemProps,\n ref: React.Ref<HTMLElement>,\n): AvatarGroupItemState => {\n const groupIsOverflow = useAvatarGroupContext_unstable(ctx => ctx.isOverflow);\n const groupSize = useAvatarGroupContext_unstable(ctx => ctx.size);\n const layout = useAvatarGroupContext_unstable(ctx => ctx.layout);\n // Since the primary slot is not an intrinsic element, getPartitionedNativeProps cannot be used here.\n const { style, className, overflowLabel, ...avatarSlotProps } = props;\n const size = groupSize ?? defaultAvatarGroupSize;\n const hasAvatarGroupContext = useHasParentContext(AvatarGroupContext);\n\n if (process.env.NODE_ENV !== 'production' && !hasAvatarGroupContext) {\n // eslint-disable-next-line no-console\n console.warn('AvatarGroupItem must only be used inside an AvatarGroup component.');\n }\n\n return {\n isOverflowItem: groupIsOverflow,\n layout,\n size,\n components: {\n root: groupIsOverflow ? 'li' : 'div',\n avatar: Avatar,\n overflowLabel: 'span',\n },\n root: slot.always(props.root, {\n defaultProps: {\n style,\n className,\n },\n elementType: groupIsOverflow ? 'li' : 'div',\n }),\n avatar: slot.always(props.avatar, {\n defaultProps: {\n ref,\n size,\n color: 'colorful',\n ...avatarSlotProps,\n },\n elementType: Avatar,\n }),\n overflowLabel: slot.always(overflowLabel, {\n defaultProps: {\n // Avatar already has its aria-label set to the name, this will prevent the name to be read twice.\n 'aria-hidden': true,\n children: props.name,\n },\n elementType: 'span',\n }),\n };\n};\n"],"names":["React","Avatar","AvatarGroupContext","useAvatarGroupContext_unstable","defaultAvatarGroupSize","slot","useHasParentContext","useAvatarGroupItem_unstable","props","ref","groupIsOverflow","ctx","isOverflow","groupSize","size","layout","style","className","overflowLabel","avatarSlotProps","hasAvatarGroupContext","process","env","NODE_ENV","console","warn","isOverflowItem","components","root","avatar","always","defaultProps","elementType","color","children","name"],"mappings":"AAAA;AAEA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,SAASC,kBAAkB,EAAEC,8BAA8B,QAAQ,oCAAoC;AACvG,SAASC,sBAAsB,QAAQ,gCAAgC;AACvE,SAASC,IAAI,QAAQ,4BAA4B;AACjD,SAASC,mBAAmB,QAAQ,mCAAmC;AAGvE;;;;;;;;CAQC,GACD,OAAO,MAAMC,8BAA8B,CACzCC,OACAC;IAEA,MAAMC,kBAAkBP,+BAA+BQ,CAAAA,MAAOA,IAAIC,UAAU;IAC5E,MAAMC,YAAYV,+BAA+BQ,CAAAA,MAAOA,IAAIG,IAAI;IAChE,MAAMC,SAASZ,+BAA+BQ,CAAAA,MAAOA,IAAII,MAAM;IAC/D,qGAAqG;IACrG,MAAM,EAAEC,KAAK,EAAEC,SAAS,EAAEC,aAAa,EAAE,GAAGC,iBAAiB,GAAGX;IAChE,MAAMM,OAAOD,sBAAAA,uBAAAA,YAAaT;IAC1B,MAAMgB,wBAAwBd,oBAAoBJ;IAElD,IAAImB,QAAQC,GAAG,CAACC,QAAQ,KAAK,gBAAgB,CAACH,uBAAuB;QACnE,sCAAsC;QACtCI,QAAQC,IAAI,CAAC;IACf;IAEA,OAAO;QACLC,gBAAgBhB;QAChBK;QACAD;QACAa,YAAY;YACVC,MAAMlB,kBAAkB,OAAO;YAC/BmB,QAAQ5B;YACRiB,eAAe;QACjB;QACAU,MAAMvB,KAAKyB,MAAM,CAACtB,MAAMoB,IAAI,EAAE;YAC5BG,cAAc;gBACZf;gBACAC;YACF;YACAe,aAAatB,kBAAkB,OAAO;QACxC;QACAmB,QAAQxB,KAAKyB,MAAM,CAACtB,MAAMqB,MAAM,EAAE;YAChCE,cAAc;gBACZtB;gBACAK;gBACAmB,OAAO;gBACP,GAAGd,eAAe;YACpB;YACAa,aAAa/B;QACf;QACAiB,eAAeb,KAAKyB,MAAM,CAACZ,eAAe;YACxCa,cAAc;gBACZ,kGAAkG;gBAClG,eAAe;gBACfG,UAAU1B,MAAM2B,IAAI;YACtB;YACAH,aAAa;QACf;IACF;AACF,EAAE"}
package/lib/index.js CHANGED
@@ -4,3 +4,6 @@ export { AvatarGroup, avatarGroupClassNames, renderAvatarGroup_unstable, useAvat
4
4
  export { AvatarGroupItem, avatarGroupItemClassNames, renderAvatarGroupItem_unstable, useAvatarGroupItemStyles_unstable, useAvatarGroupItem_unstable } from './AvatarGroupItem';
5
5
  export { AvatarGroupPopover, avatarGroupPopoverClassNames, renderAvatarGroupPopover_unstable, useAvatarGroupPopover_unstable, useAvatarGroupPopoverContextValues_unstable, useAvatarGroupPopoverStyles_unstable } from './AvatarGroupPopover';
6
6
  export { AvatarContextProvider, AvatarGroupProvider, useAvatarContext, useAvatarGroupContext_unstable } from './contexts/index';
7
+ // Experimental APIs, will be undocumented in experimental branch
8
+ // export { useAvatarBase_unstable } from './Avatar';
9
+ // export type { AvatarBaseProps, AvatarBaseState } from './Avatar';
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["export {\n Avatar,\n avatarClassNames,\n renderAvatar_unstable,\n useAvatarStyles_unstable,\n useAvatar_unstable,\n} from './Avatar';\nexport type {\n AvatarNamedColor,\n AvatarProps,\n AvatarSlots,\n AvatarState,\n AvatarShape,\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n AvatarSizes,\n AvatarSize,\n} from './Avatar';\nexport { getInitials, partitionAvatarGroupItems } from './utils/index';\nexport type { PartitionAvatarGroupItems, PartitionAvatarGroupItemsOptions } from './utils/index';\nexport {\n AvatarGroup,\n avatarGroupClassNames,\n renderAvatarGroup_unstable,\n useAvatarGroupContextValues,\n useAvatarGroupStyles_unstable,\n useAvatarGroup_unstable,\n} from './AvatarGroup';\nexport type {\n AvatarGroupProps,\n AvatarGroupSlots,\n AvatarGroupState,\n AvatarGroupContextValue,\n AvatarGroupContextValues,\n} from './AvatarGroup';\nexport {\n AvatarGroupItem,\n avatarGroupItemClassNames,\n renderAvatarGroupItem_unstable,\n useAvatarGroupItemStyles_unstable,\n useAvatarGroupItem_unstable,\n} from './AvatarGroupItem';\nexport type { AvatarGroupItemProps, AvatarGroupItemSlots, AvatarGroupItemState } from './AvatarGroupItem';\nexport {\n AvatarGroupPopover,\n avatarGroupPopoverClassNames,\n renderAvatarGroupPopover_unstable,\n useAvatarGroupPopover_unstable,\n useAvatarGroupPopoverContextValues_unstable,\n useAvatarGroupPopoverStyles_unstable,\n} from './AvatarGroupPopover';\nexport type { AvatarGroupPopoverProps, AvatarGroupPopoverSlots, AvatarGroupPopoverState } from './AvatarGroupPopover';\nexport {\n AvatarContextProvider,\n AvatarGroupProvider,\n useAvatarContext,\n useAvatarGroupContext_unstable,\n} from './contexts/index';\nexport type { AvatarContextValue } from './contexts/index';\n"],"names":["Avatar","avatarClassNames","renderAvatar_unstable","useAvatarStyles_unstable","useAvatar_unstable","getInitials","partitionAvatarGroupItems","AvatarGroup","avatarGroupClassNames","renderAvatarGroup_unstable","useAvatarGroupContextValues","useAvatarGroupStyles_unstable","useAvatarGroup_unstable","AvatarGroupItem","avatarGroupItemClassNames","renderAvatarGroupItem_unstable","useAvatarGroupItemStyles_unstable","useAvatarGroupItem_unstable","AvatarGroupPopover","avatarGroupPopoverClassNames","renderAvatarGroupPopover_unstable","useAvatarGroupPopover_unstable","useAvatarGroupPopoverContextValues_unstable","useAvatarGroupPopoverStyles_unstable","AvatarContextProvider","AvatarGroupProvider","useAvatarContext","useAvatarGroupContext_unstable"],"mappings":"AAAA,SACEA,MAAM,EACNC,gBAAgB,EAChBC,qBAAqB,EACrBC,wBAAwB,EACxBC,kBAAkB,QACb,WAAW;AAWlB,SAASC,WAAW,EAAEC,yBAAyB,QAAQ,gBAAgB;AAEvE,SACEC,WAAW,EACXC,qBAAqB,EACrBC,0BAA0B,EAC1BC,2BAA2B,EAC3BC,6BAA6B,EAC7BC,uBAAuB,QAClB,gBAAgB;AAQvB,SACEC,eAAe,EACfC,yBAAyB,EACzBC,8BAA8B,EAC9BC,iCAAiC,EACjCC,2BAA2B,QACtB,oBAAoB;AAE3B,SACEC,kBAAkB,EAClBC,4BAA4B,EAC5BC,iCAAiC,EACjCC,8BAA8B,EAC9BC,2CAA2C,EAC3CC,oCAAoC,QAC/B,uBAAuB;AAE9B,SACEC,qBAAqB,EACrBC,mBAAmB,EACnBC,gBAAgB,EAChBC,8BAA8B,QACzB,mBAAmB"}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["export {\n Avatar,\n avatarClassNames,\n renderAvatar_unstable,\n useAvatarStyles_unstable,\n useAvatar_unstable,\n} from './Avatar';\nexport type {\n AvatarNamedColor,\n AvatarProps,\n AvatarSlots,\n AvatarState,\n AvatarShape,\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n AvatarSizes,\n AvatarSize,\n} from './Avatar';\nexport { getInitials, partitionAvatarGroupItems } from './utils/index';\nexport type { PartitionAvatarGroupItems, PartitionAvatarGroupItemsOptions } from './utils/index';\nexport {\n AvatarGroup,\n avatarGroupClassNames,\n renderAvatarGroup_unstable,\n useAvatarGroupContextValues,\n useAvatarGroupStyles_unstable,\n useAvatarGroup_unstable,\n} from './AvatarGroup';\nexport type {\n AvatarGroupProps,\n AvatarGroupSlots,\n AvatarGroupState,\n AvatarGroupContextValue,\n AvatarGroupContextValues,\n} from './AvatarGroup';\nexport {\n AvatarGroupItem,\n avatarGroupItemClassNames,\n renderAvatarGroupItem_unstable,\n useAvatarGroupItemStyles_unstable,\n useAvatarGroupItem_unstable,\n} from './AvatarGroupItem';\nexport type { AvatarGroupItemProps, AvatarGroupItemSlots, AvatarGroupItemState } from './AvatarGroupItem';\nexport {\n AvatarGroupPopover,\n avatarGroupPopoverClassNames,\n renderAvatarGroupPopover_unstable,\n useAvatarGroupPopover_unstable,\n useAvatarGroupPopoverContextValues_unstable,\n useAvatarGroupPopoverStyles_unstable,\n} from './AvatarGroupPopover';\nexport type { AvatarGroupPopoverProps, AvatarGroupPopoverSlots, AvatarGroupPopoverState } from './AvatarGroupPopover';\nexport {\n AvatarContextProvider,\n AvatarGroupProvider,\n useAvatarContext,\n useAvatarGroupContext_unstable,\n} from './contexts/index';\nexport type { AvatarContextValue } from './contexts/index';\n\n// Experimental APIs, will be undocumented in experimental branch\n// export { useAvatarBase_unstable } from './Avatar';\n// export type { AvatarBaseProps, AvatarBaseState } from './Avatar';\n"],"names":["Avatar","avatarClassNames","renderAvatar_unstable","useAvatarStyles_unstable","useAvatar_unstable","getInitials","partitionAvatarGroupItems","AvatarGroup","avatarGroupClassNames","renderAvatarGroup_unstable","useAvatarGroupContextValues","useAvatarGroupStyles_unstable","useAvatarGroup_unstable","AvatarGroupItem","avatarGroupItemClassNames","renderAvatarGroupItem_unstable","useAvatarGroupItemStyles_unstable","useAvatarGroupItem_unstable","AvatarGroupPopover","avatarGroupPopoverClassNames","renderAvatarGroupPopover_unstable","useAvatarGroupPopover_unstable","useAvatarGroupPopoverContextValues_unstable","useAvatarGroupPopoverStyles_unstable","AvatarContextProvider","AvatarGroupProvider","useAvatarContext","useAvatarGroupContext_unstable"],"mappings":"AAAA,SACEA,MAAM,EACNC,gBAAgB,EAChBC,qBAAqB,EACrBC,wBAAwB,EACxBC,kBAAkB,QACb,WAAW;AAWlB,SAASC,WAAW,EAAEC,yBAAyB,QAAQ,gBAAgB;AAEvE,SACEC,WAAW,EACXC,qBAAqB,EACrBC,0BAA0B,EAC1BC,2BAA2B,EAC3BC,6BAA6B,EAC7BC,uBAAuB,QAClB,gBAAgB;AAQvB,SACEC,eAAe,EACfC,yBAAyB,EACzBC,8BAA8B,EAC9BC,iCAAiC,EACjCC,2BAA2B,QACtB,oBAAoB;AAE3B,SACEC,kBAAkB,EAClBC,4BAA4B,EAC5BC,iCAAiC,EACjCC,8BAA8B,EAC9BC,2CAA2C,EAC3CC,oCAAoC,QAC/B,uBAAuB;AAE9B,SACEC,qBAAqB,EACrBC,mBAAmB,EACnBC,gBAAgB,EAChBC,8BAA8B,QACzB,mBAAmB;CAG1B,iEAAiE;CACjE,qDAAqD;CACrD,oEAAoE"}
@@ -21,6 +21,9 @@ _export(exports, {
21
21
  renderAvatar_unstable: function() {
22
22
  return _index.renderAvatar_unstable;
23
23
  },
24
+ useAvatarBase_unstable: function() {
25
+ return _index.useAvatarBase_unstable;
26
+ },
24
27
  useAvatarStyles_unstable: function() {
25
28
  return _index.useAvatarStyles_unstable;
26
29
  },
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/Avatar.ts"],"sourcesContent":["export type {\n AvatarNamedColor,\n AvatarProps,\n AvatarShape,\n AvatarSize,\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n AvatarSizes,\n AvatarSlots,\n AvatarState,\n} from './components/Avatar/index';\nexport {\n Avatar,\n DEFAULT_STRINGS,\n avatarClassNames,\n renderAvatar_unstable,\n useAvatarStyles_unstable,\n useAvatar_unstable,\n useSizeStyles,\n} from './components/Avatar/index';\n"],"names":["Avatar","DEFAULT_STRINGS","avatarClassNames","renderAvatar_unstable","useAvatarStyles_unstable","useAvatar_unstable","useSizeStyles"],"mappings":";;;;;;;;;;;;eAWEA,aAAM;;;eACNC,sBAAe;;;eACfC,uBAAgB;;;eAChBC,4BAAqB;;;eACrBC,+BAAwB;;;eACxBC,yBAAkB;;;eAClBC,oBAAa;;;uBACR,4BAA4B"}
1
+ {"version":3,"sources":["../src/Avatar.ts"],"sourcesContent":["export type {\n AvatarNamedColor,\n AvatarBaseProps,\n AvatarProps,\n AvatarShape,\n AvatarSize,\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n AvatarSizes,\n AvatarSlots,\n AvatarBaseState,\n AvatarState,\n} from './components/Avatar/index';\nexport {\n Avatar,\n DEFAULT_STRINGS,\n avatarClassNames,\n renderAvatar_unstable,\n useAvatarStyles_unstable,\n useAvatar_unstable,\n useAvatarBase_unstable,\n useSizeStyles,\n} from './components/Avatar/index';\n"],"names":["Avatar","DEFAULT_STRINGS","avatarClassNames","renderAvatar_unstable","useAvatarStyles_unstable","useAvatar_unstable","useAvatarBase_unstable","useSizeStyles"],"mappings":";;;;;;;;;;;IAaEA;4BAAM;;;eACNC,sBAAe;;;eACfC,uBAAgB;;;eAChBC,4BAAqB;;0BAGC;eAAtBG;;;eAFAF,+BAAwB;;;eACxBC,yBAAkB;;;eAElBE,oBAAa;;;uBACR,4BAA4B"}
@@ -1,6 +1,4 @@
1
- /**
2
- * State used in rendering Avatar
3
- */ "use strict";
1
+ "use strict";
4
2
  Object.defineProperty(exports, "__esModule", {
5
3
  value: true
6
4
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/Avatar/Avatar.types.ts"],"sourcesContent":["import { PresenceBadge } from '@fluentui/react-badge';\nimport type { ComponentProps, ComponentState, JSXElement, Slot } from '@fluentui/react-utilities';\n\n/**\n * Sizes for the avatar\n * @deprecated use AvatarSize instead\n */\nexport type AvatarSizes = AvatarSize;\n/**\n * Sizes for the avatar\n */\nexport type AvatarSize = 16 | 20 | 24 | 28 | 32 | 36 | 40 | 48 | 56 | 64 | 72 | 96 | 120 | 128;\n\n/**\n * Shape of the avatar\n */\nexport type AvatarShape = 'circular' | 'square';\n\nexport type AvatarSlots = {\n root: Slot<'span'>;\n\n /**\n * The Avatar's image.\n *\n * Usage e.g.: `image={{ src: '...' }}`\n */\n image?: Slot<'img'>;\n\n /**\n * (optional) Custom initials.\n *\n * It is usually not necessary to specify custom initials; by default they will be derived from the `name` prop,\n * using the `getInitials` function.\n *\n * The initials are displayed when there is no image (including while the image is loading).\n */\n initials?: Slot<'span'>;\n\n /**\n * Icon to be displayed when the avatar doesn't have an image or initials.\n *\n * @default `PersonRegular` (the default icon's size depends on the Avatar's size)\n */\n icon?: Slot<'span'>;\n\n /**\n * Badge to show the avatar's presence status.\n */\n badge?: Slot<typeof PresenceBadge>;\n};\n\n/**\n * A specific named color for the Avatar\n */\nexport type AvatarNamedColor =\n | 'dark-red'\n | 'cranberry'\n | 'red'\n | 'pumpkin'\n | 'peach'\n | 'marigold'\n | 'gold'\n | 'brass'\n | 'brown'\n | 'forest'\n | 'seafoam'\n | 'dark-green'\n | 'light-teal'\n | 'teal'\n | 'steel'\n | 'blue'\n | 'royal-blue'\n | 'cornflower'\n | 'navy'\n | 'lavender'\n | 'purple'\n | 'grape'\n | 'lilac'\n | 'pink'\n | 'magenta'\n | 'plum'\n | 'beige'\n | 'mink'\n | 'platinum'\n | 'anchor';\n\n/**\n * Properties for Avatar\n */\nexport type AvatarProps = Omit<ComponentProps<AvatarSlots>, 'color'> & {\n /**\n * Optional activity indicator\n * * active: the avatar will be decorated according to activeAppearance\n * * inactive: the avatar will be reduced in size and partially transparent\n * * unset: normal display\n *\n * @default unset\n */\n active?: 'active' | 'inactive' | 'unset';\n\n /**\n * The appearance when `active=\"active\"`\n *\n * @default ring\n */\n activeAppearance?: 'ring' | 'shadow' | 'ring-shadow';\n\n /**\n * The color when displaying either an icon or initials.\n * * neutral (default): gray\n * * brand: color from the brand palette\n * * colorful: picks a color from a set of pre-defined colors, based on a hash of the name (or idForColor if provided)\n * * [AvatarNamedColor]: a specific color from the theme\n *\n * @default neutral\n */\n color?: 'neutral' | 'brand' | 'colorful' | AvatarNamedColor;\n\n /**\n * Specify a string to be used instead of the name, to determine which color to use when color=\"colorful\".\n * Use this when a name is not available, but there is another unique identifier that can be used instead.\n */\n idForColor?: string | undefined;\n\n /**\n * The name of the person or entity represented by this Avatar. This should always be provided if it is available.\n *\n * The name is used to determine the initials displayed when there is no image. It is also provided to\n * accessibility tools.\n */\n name?: string;\n\n /**\n * The avatar can have a circular or square shape.\n * @default circular\n */\n shape?: AvatarShape;\n\n /**\n * Size of the avatar in pixels.\n *\n * Size is restricted to a limited set of supported values recommended for most uses (see `AvatarSizeValue`) and\n * based on design guidelines for the Avatar control.\n *\n * Note: At size 16, if initials are displayed, only the first initial will be rendered.\n *\n * If a non-supported size is needed, 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?: JSXElement;\n };\n"],"names":[],"mappings":"AA6JA;;CAEC,GACD,WAWI"}
1
+ {"version":3,"sources":["../src/components/Avatar/Avatar.types.ts"],"sourcesContent":["import { PresenceBadge } from '@fluentui/react-badge';\nimport type { ComponentProps, ComponentState, JSXElement, Slot } from '@fluentui/react-utilities';\n\n/**\n * Sizes for the avatar\n * @deprecated use AvatarSize instead\n */\nexport type AvatarSizes = AvatarSize;\n/**\n * Sizes for the avatar\n */\nexport type AvatarSize = 16 | 20 | 24 | 28 | 32 | 36 | 40 | 48 | 56 | 64 | 72 | 96 | 120 | 128;\n\n/**\n * Shape of the avatar\n */\nexport type AvatarShape = 'circular' | 'square';\n\nexport type AvatarSlots = {\n root: Slot<'span'>;\n\n /**\n * The Avatar's image.\n *\n * Usage e.g.: `image={{ src: '...' }}`\n */\n image?: Slot<'img'>;\n\n /**\n * (optional) Custom initials.\n *\n * It is usually not necessary to specify custom initials; by default they will be derived from the `name` prop,\n * using the `getInitials` function.\n *\n * The initials are displayed when there is no image (including while the image is loading).\n */\n initials?: Slot<'span'>;\n\n /**\n * Icon to be displayed when the avatar doesn't have an image or initials.\n *\n * @default `PersonRegular` (the default icon's size depends on the Avatar's size)\n */\n icon?: Slot<'span'>;\n\n /**\n * Badge to show the avatar's presence status.\n */\n badge?: Slot<typeof PresenceBadge>;\n};\n\n/**\n * A specific named color for the Avatar\n */\nexport type AvatarNamedColor =\n | 'dark-red'\n | 'cranberry'\n | 'red'\n | 'pumpkin'\n | 'peach'\n | 'marigold'\n | 'gold'\n | 'brass'\n | 'brown'\n | 'forest'\n | 'seafoam'\n | 'dark-green'\n | 'light-teal'\n | 'teal'\n | 'steel'\n | 'blue'\n | 'royal-blue'\n | 'cornflower'\n | 'navy'\n | 'lavender'\n | 'purple'\n | 'grape'\n | 'lilac'\n | 'pink'\n | 'magenta'\n | 'plum'\n | 'beige'\n | 'mink'\n | 'platinum'\n | 'anchor';\n\n/**\n * Properties for Avatar\n */\nexport type AvatarProps = Omit<ComponentProps<AvatarSlots>, 'color'> & {\n /**\n * Optional activity indicator\n * * active: the avatar will be decorated according to activeAppearance\n * * inactive: the avatar will be reduced in size and partially transparent\n * * unset: normal display\n *\n * @default unset\n */\n active?: 'active' | 'inactive' | 'unset';\n\n /**\n * The appearance when `active=\"active\"`\n *\n * @default ring\n */\n activeAppearance?: 'ring' | 'shadow' | 'ring-shadow';\n\n /**\n * The color when displaying either an icon or initials.\n * * neutral (default): gray\n * * brand: color from the brand palette\n * * colorful: picks a color from a set of pre-defined colors, based on a hash of the name (or idForColor if provided)\n * * [AvatarNamedColor]: a specific color from the theme\n *\n * @default neutral\n */\n color?: 'neutral' | 'brand' | 'colorful' | AvatarNamedColor;\n\n /**\n * Specify a string to be used instead of the name, to determine which color to use when color=\"colorful\".\n * Use this when a name is not available, but there is another unique identifier that can be used instead.\n */\n idForColor?: string | undefined;\n\n /**\n * The name of the person or entity represented by this Avatar. This should always be provided if it is available.\n *\n * The name is used to determine the initials displayed when there is no image. It is also provided to\n * accessibility tools.\n */\n name?: string;\n\n /**\n * The avatar can have a circular or square shape.\n * @default circular\n */\n shape?: AvatarShape;\n\n /**\n * Size of the avatar in pixels.\n *\n * Size is restricted to a limited set of supported values recommended for most uses (see `AvatarSizeValue`) and\n * based on design guidelines for the Avatar control.\n *\n * Note: At size 16, if initials are displayed, only the first initial will be rendered.\n *\n * If a non-supported size is needed, 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\nexport type AvatarBaseProps = ComponentProps<Omit<AvatarSlots, 'badge'>> & Pick<AvatarProps, 'name'>;\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?: JSXElement;\n };\n\nexport type AvatarBaseState = ComponentState<Omit<AvatarSlots, 'badge'>> & Pick<AvatarState, 'activeAriaLabelElement'>;\n"],"names":[],"mappings":""}
@@ -21,6 +21,9 @@ _export(exports, {
21
21
  renderAvatar_unstable: function() {
22
22
  return _renderAvatar.renderAvatar_unstable;
23
23
  },
24
+ useAvatarBase_unstable: function() {
25
+ return _useAvatar.useAvatarBase_unstable;
26
+ },
24
27
  useAvatarStyles_unstable: function() {
25
28
  return _useAvatarStylesstyles.useAvatarStyles_unstable;
26
29
  },
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/Avatar/index.ts"],"sourcesContent":["export type {\n AvatarNamedColor,\n AvatarProps,\n AvatarShape,\n AvatarSize,\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n AvatarSizes,\n AvatarSlots,\n AvatarState,\n} from './Avatar.types';\nexport { Avatar } from './Avatar';\nexport { renderAvatar_unstable } from './renderAvatar';\nexport { DEFAULT_STRINGS, useAvatar_unstable } from './useAvatar';\nexport { avatarClassNames, useAvatarStyles_unstable, useSizeStyles } from './useAvatarStyles.styles';\n"],"names":["Avatar","renderAvatar_unstable","DEFAULT_STRINGS","useAvatar_unstable","avatarClassNames","useAvatarStyles_unstable","useSizeStyles"],"mappings":";;;;;;;;;;;;eAUSA,cAAM;;;eAENE,0BAAe;;;eACfE,uCAAgB;;;eAFhBH,mCAAqB;;;eAEHI,+CAAwB;;;eADzBF,6BAAkB;;;eACSG,oCAAa;;;wBAH3C,WAAW;8BACI,iBAAiB;2BACH,cAAc;uCACQ,2BAA2B"}
1
+ {"version":3,"sources":["../src/components/Avatar/index.ts"],"sourcesContent":["export type {\n AvatarNamedColor,\n AvatarBaseProps,\n AvatarProps,\n AvatarShape,\n AvatarSize,\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n AvatarSizes,\n AvatarSlots,\n AvatarBaseState,\n AvatarState,\n} from './Avatar.types';\nexport { Avatar } from './Avatar';\nexport { renderAvatar_unstable } from './renderAvatar';\nexport { DEFAULT_STRINGS, useAvatar_unstable, useAvatarBase_unstable } from './useAvatar';\nexport { avatarClassNames, useAvatarStyles_unstable, useSizeStyles } from './useAvatarStyles.styles';\n"],"names":["Avatar","renderAvatar_unstable","DEFAULT_STRINGS","useAvatar_unstable","useAvatarBase_unstable","avatarClassNames","useAvatarStyles_unstable","useSizeStyles"],"mappings":";;;;;;;;;;;IAYSA;6BAAM;;;eAENE,0BAAe;;IACfG;sDAAgB;;;eAFhBJ,mCAAqB;;0BACsC;eAAtBG;;;eACnBE,+CAAwB;;;eADzBH,6BAAkB;;;eACSI,oCAAa;;;wBAH3C,WAAW;8BACI,iBAAiB;2BACqB,cAAc;uCAChB,2BAA2B"}
@@ -13,6 +13,9 @@ _export(exports, {
13
13
  DEFAULT_STRINGS: function() {
14
14
  return DEFAULT_STRINGS;
15
15
  },
16
+ useAvatarBase_unstable: function() {
17
+ return useAvatarBase_unstable;
18
+ },
16
19
  useAvatar_unstable: function() {
17
20
  return useAvatar_unstable;
18
21
  }
@@ -32,23 +35,94 @@ const DEFAULT_STRINGS = {
32
35
  const useAvatar_unstable = (props, ref)=>{
33
36
  const { dir } = (0, _reactsharedcontexts.useFluent_unstable)();
34
37
  const { shape: contextShape, size: contextSize } = (0, _AvatarContext.useAvatarContext)();
35
- const { name, size = contextSize !== null && contextSize !== void 0 ? contextSize : 32, shape = contextShape !== null && contextShape !== void 0 ? contextShape : 'circular', active = 'unset', activeAppearance = 'ring', idForColor } = props;
36
- let { color = 'neutral' } = props;
38
+ const { size = contextSize !== null && contextSize !== void 0 ? contextSize : 32, shape = contextShape !== null && contextShape !== void 0 ? contextShape : 'circular', active = 'unset', activeAppearance = 'ring', idForColor, color: propColor = 'neutral', ...rest } = props;
39
+ const state = useAvatarBase_unstable(rest, ref);
40
+ var _ref;
37
41
  // Resolve 'colorful' to a specific color name
38
- if (color === 'colorful') {
39
- var _ref;
40
- color = avatarColors[getHashCode((_ref = idForColor !== null && idForColor !== void 0 ? idForColor : name) !== null && _ref !== void 0 ? _ref : '') % avatarColors.length];
42
+ const color = propColor === 'colorful' ? avatarColors[getHashCode((_ref = idForColor !== null && idForColor !== void 0 ? idForColor : props.name) !== null && _ref !== void 0 ? _ref : '') % avatarColors.length] : propColor;
43
+ if (state.initials) {
44
+ var _state_initials;
45
+ state.initials = _reactutilities.slot.optional(props.initials, {
46
+ renderByDefault: true,
47
+ defaultProps: {
48
+ children: (0, _index.getInitials)(props.name, dir === 'rtl', {
49
+ firstInitialOnly: size <= 16
50
+ }),
51
+ id: (_state_initials = state.initials) === null || _state_initials === void 0 ? void 0 : _state_initials.id
52
+ },
53
+ elementType: 'span'
54
+ });
55
+ }
56
+ if (state.icon) {
57
+ var _state_icon;
58
+ var _children;
59
+ (_children = (_state_icon = state.icon).children) !== null && _children !== void 0 ? _children : _state_icon.children = /*#__PURE__*/ _react.createElement(_reacticons.PersonRegular, null);
41
60
  }
61
+ const badge = _reactutilities.slot.optional(props.badge, {
62
+ defaultProps: {
63
+ size: getBadgeSize(size),
64
+ id: state.root.id + '__badge'
65
+ },
66
+ elementType: _reactbadge.PresenceBadge
67
+ });
68
+ let activeAriaLabelElement = state.activeAriaLabelElement;
69
+ // Enhance aria-label and/or aria-labelledby to include badge and active state
70
+ // Only process if aria attributes were not explicitly provided by the user
71
+ const userProvidedAriaLabel = props['aria-label'] !== undefined;
72
+ const userProvidedAriaLabelledby = props['aria-labelledby'] !== undefined;
73
+ if (!userProvidedAriaLabel && !userProvidedAriaLabelledby) {
74
+ if (props.name) {
75
+ if (badge) {
76
+ state.root['aria-labelledby'] = state.root.id + ' ' + badge.id;
77
+ }
78
+ } else if (state.initials) {
79
+ // root's aria-label should be the name, but fall back to being labelledby the initials if name is missing
80
+ state.root['aria-labelledby'] = state.initials.id + (badge ? ' ' + badge.id : '');
81
+ delete state.root['aria-label'];
82
+ }
83
+ // Add the active state to the aria label
84
+ if (active === 'active' || active === 'inactive') {
85
+ const activeText = DEFAULT_STRINGS[active];
86
+ if (state.root['aria-labelledby']) {
87
+ // If using aria-labelledby, render a hidden span and append it to the labelledby
88
+ const activeId = state.root.id + '__active';
89
+ state.root['aria-labelledby'] += ' ' + activeId;
90
+ activeAriaLabelElement = /*#__PURE__*/ _react.createElement("span", {
91
+ hidden: true,
92
+ id: activeId
93
+ }, activeText);
94
+ } else if (state.root['aria-label']) {
95
+ // Otherwise, just append it to the aria-label
96
+ state.root['aria-label'] += ' ' + activeText;
97
+ }
98
+ }
99
+ }
100
+ return {
101
+ ...state,
102
+ size,
103
+ shape,
104
+ active,
105
+ activeAppearance,
106
+ activeAriaLabelElement,
107
+ color,
108
+ badge,
109
+ // eslint-disable-next-line @typescript-eslint/no-deprecated
110
+ components: {
111
+ ...state.components,
112
+ badge: _reactbadge.PresenceBadge
113
+ }
114
+ };
115
+ };
116
+ const useAvatarBase_unstable = (props, ref)=>{
117
+ const { dir } = (0, _reactsharedcontexts.useFluent_unstable)();
118
+ const { name, ...rest } = props;
42
119
  const baseId = (0, _reactutilities.useId)('avatar-');
43
- const root = _reactutilities.slot.always((0, _reactutilities.getIntrinsicElementProps)('span', {
120
+ const root = _reactutilities.slot.always({
44
121
  role: 'img',
45
122
  id: baseId,
46
- // aria-label and/or aria-labelledby are resolved below
47
- ...props,
48
- ref
49
- }, /* excludedPropNames: */ [
50
- 'name'
51
- ]), {
123
+ ref,
124
+ ...rest
125
+ }, {
52
126
  elementType: 'span'
53
127
  });
54
128
  const [imageHidden, setImageHidden] = _react.useState(undefined);
@@ -60,91 +134,62 @@ const useAvatar_unstable = (props, ref)=>{
60
134
  hidden: imageHidden
61
135
  },
62
136
  elementType: 'img'
63
- }); // Image shouldn't be rendered if its src is not set
137
+ });
138
+ // Image shouldn't be rendered if its src is not set
64
139
  if (!(image === null || image === void 0 ? void 0 : image.src)) {
65
140
  image = undefined;
66
- } // Hide the image if it fails to load and restore it on a successful load
141
+ }
142
+ // Hide the image if it fails to load and restore it on a successful load
67
143
  if (image) {
68
144
  image.onError = (0, _reactutilities.mergeCallbacks)(image.onError, ()=>setImageHidden(true));
69
145
  image.onLoad = (0, _reactutilities.mergeCallbacks)(image.onLoad, ()=>setImageHidden(undefined));
70
- } // Resolve the initials slot, defaulted to getInitials.
146
+ }
147
+ // Resolve the initials slot, defaulted to getInitials
71
148
  let initials = _reactutilities.slot.optional(props.initials, {
72
149
  renderByDefault: true,
73
150
  defaultProps: {
74
- children: (0, _index.getInitials)(name, dir === 'rtl', {
75
- firstInitialOnly: size <= 16
76
- }),
151
+ children: (0, _index.getInitials)(name, dir === 'rtl'),
77
152
  id: baseId + '__initials'
78
153
  },
79
154
  elementType: 'span'
80
- }); // Don't render the initials slot if it's empty
155
+ });
156
+ // Don't render the initials slot if it's empty
81
157
  if (!(initials === null || initials === void 0 ? void 0 : initials.children)) {
82
158
  initials = undefined;
83
- } // Render the icon slot *only if* there aren't any initials or image to display
159
+ }
160
+ // Render the icon slot *only if* there aren't any initials or image to display
84
161
  let icon = undefined;
85
162
  if (!initials && (!image || imageHidden)) {
86
163
  icon = _reactutilities.slot.optional(props.icon, {
87
164
  renderByDefault: true,
88
165
  defaultProps: {
89
- children: /*#__PURE__*/ _react.createElement(_reacticons.PersonRegular, null),
90
166
  'aria-hidden': true
91
167
  },
92
168
  elementType: 'span'
93
169
  });
94
170
  }
95
- const badge = _reactutilities.slot.optional(props.badge, {
96
- defaultProps: {
97
- size: getBadgeSize(size),
98
- id: baseId + '__badge'
99
- },
100
- elementType: _reactbadge.PresenceBadge
101
- });
102
- let activeAriaLabelElement; // Resolve aria-label and/or aria-labelledby if not provided by the user
171
+ let activeAriaLabelElement;
172
+ // Resolve aria-label and/or aria-labelledby if not provided by the user
103
173
  if (!root['aria-label'] && !root['aria-labelledby']) {
104
174
  if (name) {
105
- root['aria-label'] = name; // Include the badge in labelledby if it exists
106
- if (badge) {
107
- root['aria-labelledby'] = root.id + ' ' + badge.id;
108
- }
175
+ root['aria-label'] = name;
109
176
  } else if (initials) {
110
177
  // root's aria-label should be the name, but fall back to being labelledby the initials if name is missing
111
- root['aria-labelledby'] = initials.id + (badge ? ' ' + badge.id : '');
112
- } // Add the active state to the aria label
113
- if (active === 'active' || active === 'inactive') {
114
- const activeText = DEFAULT_STRINGS[active];
115
- if (root['aria-labelledby']) {
116
- // If using aria-labelledby, render a hidden span and append it to the labelledby
117
- const activeId = baseId + '__active';
118
- root['aria-labelledby'] += ' ' + activeId;
119
- activeAriaLabelElement = /*#__PURE__*/ _react.createElement("span", {
120
- hidden: true,
121
- id: activeId
122
- }, activeText);
123
- } else if (root['aria-label']) {
124
- // Otherwise, just append it to the aria-label
125
- root['aria-label'] += ' ' + activeText;
126
- }
178
+ root['aria-labelledby'] = initials.id;
127
179
  }
128
180
  }
129
181
  return {
130
- size,
131
- shape,
132
- active,
133
- activeAppearance,
134
182
  activeAriaLabelElement,
135
- color,
136
183
  components: {
137
184
  root: 'span',
138
185
  initials: 'span',
139
186
  icon: 'span',
140
- image: 'img',
141
- badge: _reactbadge.PresenceBadge
187
+ image: 'img'
142
188
  },
143
189
  root,
144
190
  initials,
145
191
  icon,
146
- image,
147
- badge
192
+ image
148
193
  };
149
194
  };
150
195
  const getBadgeSize = (size)=>{
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/Avatar/useAvatar.tsx"],"sourcesContent":["'use client';\n\nimport * 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;;;;;;;;;;;;IAWaW,eAAAA;;;IAKAG,kBAAAA;;;;;iEAdU,QAAQ;gCACuC,4BAA4B;uBACtE,oBAAoB;4BAElB,wBAAwB;4BACxB,wBAAwB;qCACN,kCAAkC;+BACjD,+BAA+B;AAEzD,wBAAwB;IAC7BF,QAAQ;IACRC,UAAU;AACZ,EAAE;AAEK,2BAA2B,CAACE,OAAoBC;IACrD,MAAM,EAAEC,GAAG,EAAE,OAAGR,uCAAAA;IAChB,MAAM,EAAES,OAAOC,YAAY,EAAEC,MAAMC,WAAW,EAAE,OAAGX,+BAAAA;IACnD,MAAM,EACJY,IAAI,EACJF,OAAOC,gBAAAA,QAAAA,gBAAAA,KAAAA,IAAAA,cAAgB,EAAY,EACnCH,QAAQC,iBAAAA,QAAAA,iBAAAA,KAAAA,IAAAA,eAAgB,UAAU,EAClCP,SAAS,OAAO,EAChBW,mBAAmB,MAAM,EACzBC,UAAU,EACX,GAAGT;IACJ,IAAI,EAAEU,QAAQ,SAAS,EAAE,GAAGV;IAE5B,8CAA8C;IAC9C,IAAIU,UAAU,YAAY;YACSD;QAAjCC,QAAQC,YAAY,CAACC,YAAYH,CAAAA,OAAAA,eAAAA,QAAAA,eAAAA,KAAAA,IAAAA,aAAcF,IAAAA,MAAAA,QAAdE,SAAAA,KAAAA,IAAAA,OAAsB,MAAME,aAAaE,MAAM,CAAC;IACnF;IAEA,MAAMC,aAAS1B,qBAAAA,EAAM;IAErB,MAAM2B,OAA4B1B,oBAAAA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F;IACA,OAAO;QACLnC;QACAF;QACAN;QACAW;QACA+B;QACA7B;QACAiC,YAAY;YAAE5B,MAAM;YAAQiB,UAAU;YAAQI,MAAM;YAAQZ,OAAO;YAAOa,OAAO7C,yBAAAA;QAAc;QAC/FuB;QACAiB;QACAI;QACAZ;QACAa;IACF;AACF,EAAE;AACF,MAAMC,eAAe,CAACjC;IACpB,IAAIA,QAAQ,IAAI;QACd,OAAO;IACT,OAAO,IAAIA,QAAQ,IAAI;QACrB,OAAO;IACT,OAAO,IAAIA,QAAQ,IAAI;QACrB,OAAO;IACT,OAAO,IAAIA,QAAQ,IAAI;QACrB,OAAO;IACT,OAAO,IAAIA,QAAQ,IAAI;QACrB,OAAO;IACT,OAAO;QACL,OAAO;IACT;AACF;AAEA,MAAMM,eAAmC;IACvC;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACD;AAED,MAAMC,cAAc,CAACgC;IACnB,IAAIC,WAAW;IACf,IAAK,IAAIC,MAAcF,IAAI/B,MAAM,GAAG,GAAGiC,OAAO,GAAGA,MAAO;QACtD,MAAMC,KAAKH,IAAII,UAAU,CAACF;QAC1B,MAAMG,QAAQH,MAAM;QACpBD,YAAaE,CAAAA,MAAME,KAAAA,CAAI,IAAMF,MAAO,IAAIE,KAAAA,CAAK,EAAI,iCAAiC;IACpF;IAEA,OAAOJ;AACT"}
1
+ {"version":3,"sources":["../src/components/Avatar/useAvatar.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { mergeCallbacks, useId, slot } from '@fluentui/react-utilities';\nimport { getInitials } from '../../utils/index';\nimport type { AvatarBaseProps, AvatarBaseState, 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 size = contextSize ?? (32 as const),\n shape = contextShape ?? 'circular',\n active = 'unset',\n activeAppearance = 'ring',\n idForColor,\n color: propColor = 'neutral',\n ...rest\n } = props;\n\n const state = useAvatarBase_unstable(rest, ref);\n\n // Resolve 'colorful' to a specific color name\n const color: AvatarState['color'] =\n propColor === 'colorful'\n ? avatarColors[getHashCode(idForColor ?? props.name ?? '') % avatarColors.length]\n : propColor;\n\n if (state.initials) {\n state.initials = slot.optional(props.initials, {\n renderByDefault: true,\n defaultProps: {\n children: getInitials(props.name, dir === 'rtl', { firstInitialOnly: size <= 16 }),\n id: state.initials?.id,\n },\n elementType: 'span',\n });\n }\n\n if (state.icon) {\n state.icon.children ??= <PersonRegular />;\n }\n\n const badge: AvatarState['badge'] = slot.optional(props.badge, {\n defaultProps: { size: getBadgeSize(size), id: state.root.id + '__badge' },\n elementType: PresenceBadge,\n });\n\n let activeAriaLabelElement: AvatarState['activeAriaLabelElement'] = state.activeAriaLabelElement;\n\n // Enhance aria-label and/or aria-labelledby to include badge and active state\n // Only process if aria attributes were not explicitly provided by the user\n const userProvidedAriaLabel = props['aria-label'] !== undefined;\n const userProvidedAriaLabelledby = props['aria-labelledby'] !== undefined;\n\n if (!userProvidedAriaLabel && !userProvidedAriaLabelledby) {\n if (props.name) {\n if (badge) {\n state.root['aria-labelledby'] = state.root.id + ' ' + badge.id;\n }\n } else if (state.initials) {\n // root's aria-label should be the name, but fall back to being labelledby the initials if name is missing\n state.root['aria-labelledby'] = state.initials.id + (badge ? ' ' + badge.id : '');\n delete state.root['aria-label'];\n }\n // Add the active state to the aria label\n if (active === 'active' || active === 'inactive') {\n const activeText = DEFAULT_STRINGS[active];\n if (state.root['aria-labelledby']) {\n // If using aria-labelledby, render a hidden span and append it to the labelledby\n const activeId = state.root.id + '__active';\n state.root['aria-labelledby'] += ' ' + activeId;\n activeAriaLabelElement = (\n <span hidden id={activeId}>\n {activeText}\n </span>\n );\n } else if (state.root['aria-label']) {\n // Otherwise, just append it to the aria-label\n state.root['aria-label'] += ' ' + activeText;\n }\n }\n }\n\n return {\n ...state,\n size,\n shape,\n active,\n activeAppearance,\n activeAriaLabelElement,\n color,\n badge,\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n components: { ...state.components, badge: PresenceBadge },\n };\n};\n\n/**\n * Base hook for Avatar component, manages state and structure common to all variants of Avatar\n */\nexport const useAvatarBase_unstable = (props: AvatarBaseProps, ref?: React.Ref<HTMLElement>): AvatarBaseState => {\n const { dir } = useFluent();\n const { name, ...rest } = props;\n\n const baseId = useId('avatar-');\n\n const root: AvatarBaseState['root'] = slot.always(\n {\n role: 'img',\n id: baseId,\n ref,\n ...rest,\n },\n { elementType: 'span' },\n );\n\n const [imageHidden, setImageHidden] = React.useState<true | undefined>(undefined);\n\n let image: AvatarBaseState['image'] = slot.optional(props.image, {\n defaultProps: { alt: '', role: 'presentation', 'aria-hidden': true, hidden: imageHidden },\n elementType: 'img',\n });\n\n // Image shouldn't be rendered if its src is not set\n if (!image?.src) {\n image = undefined;\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: AvatarBaseState['initials'] = slot.optional(props.initials, {\n renderByDefault: true,\n defaultProps: {\n children: getInitials(name, dir === 'rtl'),\n id: baseId + '__initials',\n },\n elementType: 'span',\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: AvatarBaseState['icon'] = undefined;\n if (!initials && (!image || imageHidden)) {\n icon = slot.optional(props.icon, {\n renderByDefault: true,\n defaultProps: {\n 'aria-hidden': true,\n },\n elementType: 'span',\n });\n }\n\n let activeAriaLabelElement: AvatarBaseState['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 } 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;\n }\n }\n\n return {\n activeAriaLabelElement,\n components: { root: 'span', initials: 'span', icon: 'span', image: 'img' },\n root,\n initials,\n icon,\n image,\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"],"names":["React","mergeCallbacks","useId","slot","getInitials","PersonRegular","PresenceBadge","useFluent_unstable","useFluent","useAvatarContext","DEFAULT_STRINGS","active","inactive","useAvatar_unstable","props","ref","dir","shape","contextShape","size","contextSize","activeAppearance","idForColor","color","propColor","rest","state","useAvatarBase_unstable","avatarColors","getHashCode","name","length","initials","optional","renderByDefault","defaultProps","children","firstInitialOnly","id","elementType","icon","badge","getBadgeSize","root","activeAriaLabelElement","userProvidedAriaLabel","undefined","userProvidedAriaLabelledby","activeText","activeId","span","hidden","components","baseId","always","role","imageHidden","setImageHidden","useState","image","alt","src","onError","onLoad","str","hashCode","len","ch","charCodeAt","shift"],"mappings":"AAAA;;;;;;;;;;;;IAWaU,eAAAA;;;IAmGAiB,sBAAAA;;;IA9FAd,kBAAAA;;;;;iEAdU,QAAQ;gCACa,4BAA4B;uBAC5C,oBAAoB;4BAElB,wBAAwB;4BACxB,wBAAwB;qCACN,kCAAkC;+BACjD,+BAA+B;AAEzD,wBAAwB;IAC7BF,QAAQ;IACRC,UAAU;AACZ,EAAE;AAEK,2BAA2B,CAACE,OAAoBC;IACrD,MAAM,EAAEC,GAAG,EAAE,OAAGR,uCAAAA;IAChB,MAAM,EAAES,OAAOC,YAAY,EAAEC,MAAMC,WAAW,EAAE,OAAGX,+BAAAA;IACnD,MAAM,EACJU,OAAOC,gBAAAA,QAAAA,gBAAAA,KAAAA,IAAAA,cAAgB,EAAY,EACnCH,QAAQC,iBAAAA,QAAAA,iBAAAA,KAAAA,IAAAA,eAAgB,UAAU,EAClCP,SAAS,OAAO,EAChBU,mBAAmB,MAAM,EACzBC,UAAU,EACVC,OAAOC,YAAY,SAAS,EAC5B,GAAGC,MACJ,GAAGX;IAEJ,MAAMY,QAAQC,uBAAuBF,MAAMV;QAKZO;IAH/B,8CAA8C;IAC9C,MAAMC,QACJC,cAAc,aACVI,YAAY,CAACC,YAAYP,CAAAA,OAAAA,eAAAA,QAAAA,eAAAA,KAAAA,IAAAA,aAAcR,MAAMgB,IAAAA,AAAI,MAAA,QAAxBR,SAAAA,KAAAA,IAAAA,OAA4B,MAAMM,aAAaG,MAAM,CAAC,GAC/EP;IAEN,IAAIE,MAAMM,QAAQ,EAA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AO,IAAIE,UAAU;YACnB,0GAA0G;YAC1GW,IAAI,CAAC,kBAAkB,GAAGX,SAASM,EAAE;QACvC;IACF;IAEA,OAAO;QACLM;QACAQ,YAAY;YAAET,MAAM;YAAQX,UAAU;YAAQQ,MAAM;YAAQmB,OAAO;QAAM;QACzEhB;QACAX;QACAQ;QACAmB;IACF;AACF,EAAE;AAEF,MAAMjB,eAAe,CAACvB;IACpB,IAAIA,QAAQ,IAAI;QACd,OAAO;IACT,OAAO,IAAIA,QAAQ,IAAI;QACrB,OAAO;IACT,OAAO,IAAIA,QAAQ,IAAI;QACrB,OAAO;IACT,OAAO,IAAIA,QAAQ,IAAI;QACrB,OAAO;IACT,OAAO,IAAIA,QAAQ,IAAI;QACrB,OAAO;IACT,OAAO;QACL,OAAO;IACT;AACF;AAEA,MAAMS,eAAmC;IACvC;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACD;AAED,MAAMC,cAAc,CAACmC;IACnB,IAAIC,WAAW;IACf,IAAK,IAAIC,MAAcF,IAAIjC,MAAM,GAAG,GAAGmC,OAAO,GAAGA,MAAO;QACtD,MAAMC,KAAKH,IAAII,UAAU,CAACF;QAC1B,MAAMG,QAAQH,MAAM;QACpBD,YAAaE,CAAAA,MAAME,KAAAA,CAAI,IAAMF,MAAO,IAAIE,KAAAA,CAAK,EAAI,iCAAiC;IACpF;IAEA,OAAOJ;AACT"}
@@ -21,7 +21,7 @@ const useAvatarGroupItem_unstable = (props, ref)=>{
21
21
  const groupSize = (0, _AvatarGroupContext.useAvatarGroupContext_unstable)((ctx)=>ctx.size);
22
22
  const layout = (0, _AvatarGroupContext.useAvatarGroupContext_unstable)((ctx)=>ctx.layout);
23
23
  // Since the primary slot is not an intrinsic element, getPartitionedNativeProps cannot be used here.
24
- const { style, className, ...avatarSlotProps } = props;
24
+ const { style, className, overflowLabel, ...avatarSlotProps } = props;
25
25
  const size = groupSize !== null && groupSize !== void 0 ? groupSize : _useAvatarGroup.defaultAvatarGroupSize;
26
26
  const hasAvatarGroupContext = (0, _reactcontextselector.useHasParentContext)(_AvatarGroupContext.AvatarGroupContext);
27
27
  if (process.env.NODE_ENV !== 'production' && !hasAvatarGroupContext) {
@@ -53,7 +53,7 @@ const useAvatarGroupItem_unstable = (props, ref)=>{
53
53
  },
54
54
  elementType: _Avatar.Avatar
55
55
  }),
56
- overflowLabel: _reactutilities.slot.always(props.overflowLabel, {
56
+ overflowLabel: _reactutilities.slot.always(overflowLabel, {
57
57
  defaultProps: {
58
58
  // Avatar already has its aria-label set to the name, this will prevent the name to be read twice.
59
59
  'aria-hidden': true,
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/AvatarGroupItem/useAvatarGroupItem.ts"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { Avatar } from '../Avatar/Avatar';\nimport { AvatarGroupContext, useAvatarGroupContext_unstable } from '../../contexts/AvatarGroupContext';\nimport { defaultAvatarGroupSize } from '../AvatarGroup/useAvatarGroup';\nimport { slot } from '@fluentui/react-utilities';\nimport { useHasParentContext } from '@fluentui/react-context-selector';\nimport type { AvatarGroupItemProps, AvatarGroupItemState } from './AvatarGroupItem.types';\n\n/**\n * Create the state required to render AvatarGroupItem.\n *\n * The returned state can be modified with hooks such as useAvatarGroupItemStyles_unstable,\n * before being passed to renderAvatarGroupItem_unstable.\n *\n * @param props - props from this instance of AvatarGroupItem\n * @param ref - reference to root HTMLElement of AvatarGroupItem\n */\nexport const useAvatarGroupItem_unstable = (\n props: AvatarGroupItemProps,\n ref: React.Ref<HTMLElement>,\n): AvatarGroupItemState => {\n const groupIsOverflow = useAvatarGroupContext_unstable(ctx => ctx.isOverflow);\n const groupSize = useAvatarGroupContext_unstable(ctx => ctx.size);\n const layout = useAvatarGroupContext_unstable(ctx => ctx.layout);\n // Since the primary slot is not an intrinsic element, getPartitionedNativeProps cannot be used here.\n const { style, className, ...avatarSlotProps } = props;\n const size = groupSize ?? defaultAvatarGroupSize;\n const hasAvatarGroupContext = useHasParentContext(AvatarGroupContext);\n\n if (process.env.NODE_ENV !== 'production' && !hasAvatarGroupContext) {\n // eslint-disable-next-line no-console\n console.warn('AvatarGroupItem must only be used inside an AvatarGroup component.');\n }\n\n return {\n isOverflowItem: groupIsOverflow,\n layout,\n size,\n components: {\n root: groupIsOverflow ? 'li' : 'div',\n avatar: Avatar,\n overflowLabel: 'span',\n },\n root: slot.always(props.root, {\n defaultProps: {\n style,\n className,\n },\n elementType: groupIsOverflow ? 'li' : 'div',\n }),\n avatar: slot.always(props.avatar, {\n defaultProps: {\n ref,\n size,\n color: 'colorful',\n ...avatarSlotProps,\n },\n elementType: Avatar,\n }),\n overflowLabel: slot.always(props.overflowLabel, {\n defaultProps: {\n // Avatar already has its aria-label set to the name, this will prevent the name to be read twice.\n 'aria-hidden': true,\n children: props.name,\n },\n elementType: 'span',\n }),\n };\n};\n"],"names":["React","Avatar","AvatarGroupContext","useAvatarGroupContext_unstable","defaultAvatarGroupSize","slot","useHasParentContext","useAvatarGroupItem_unstable","props","ref","groupIsOverflow","ctx","isOverflow","groupSize","size","layout","style","className","avatarSlotProps","hasAvatarGroupContext","process","env","NODE_ENV","console","warn","isOverflowItem","components","root","avatar","overflowLabel","always","defaultProps","elementType","color","children","name"],"mappings":"AAAA;;;;;+BAmBaO;;;;;;;iEAjBU,QAAQ;wBACR,mBAAmB;oCACyB,oCAAoC;gCAChE,gCAAgC;gCAClD,4BAA4B;sCACb,mCAAmC;AAYhE,oCAAoC,CACzCC,OACAC;IAEA,MAAMC,sBAAkBP,kDAAAA,EAA+BQ,CAAAA,MAAOA,IAAIC,UAAU;IAC5E,MAAMC,gBAAYV,kDAAAA,EAA+BQ,CAAAA,MAAOA,IAAIG,IAAI;IAChE,MAAMC,aAASZ,kDAAAA,EAA+BQ,CAAAA,MAAOA,IAAII,MAAM;IAC/D,qGAAqG;IACrG,MAAM,EAAEC,KAAK,EAAEC,SAAS,EAAE,GAAGC,iBAAiB,GAAGV;IACjD,MAAMM,OAAOD,cAAAA,QAAAA,cAAAA,KAAAA,IAAAA,YAAaT,sCAAAA;IAC1B,MAAMe,4BAAwBb,yCAAAA,EAAoBJ,sCAAAA;IAElD,IAAIkB,QAAQC,GAAG,CAACC,QAAQ,KAAK,gBAAgB,CAACH,uBAAuB;QACnE,sCAAsC;QACtCI,QAAQC,IAAI,CAAC;IACf;IAEA,OAAO;QACLC,gBAAgBf;QAChBK;QACAD;QACAY,YAAY;YACVC,MAAMjB,kBAAkB,OAAO;YAC/BkB,QAAQ3B,cAAAA;YACR4B,eAAe;QACjB;QACAF,MAAMtB,oBAAAA,CAAKyB,MAAM,CAACtB,MAAMmB,IAAI,EAAE;YAC5BI,cAAc;gBACZf;gBACAC;YACF;YACAe,aAAatB,kBAAkB,OAAO;QACxC;QACAkB,QAAQvB,oBAAAA,CAAKyB,MAAM,CAACtB,MAAMoB,MAAM,EAAE;YAChCG,cAAc;gBACZtB;gBACAK;gBACAmB,OAAO;gBACP,GAAGf,eAAe;YACpB;YACAc,aAAa/B,cAAAA;QACf;QACA4B,eAAexB,oBAAAA,CAAKyB,MAAM,CAACtB,MAAMqB,aAAa,EAAE;YAC9CE,cAAc;gBACZ,kGAAkG;gBAClG,eAAe;gBACfG,UAAU1B,MAAM2B,IAAI;YACtB;YACAH,aAAa;QACf;IACF;AACF,EAAE"}
1
+ {"version":3,"sources":["../src/components/AvatarGroupItem/useAvatarGroupItem.ts"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { Avatar } from '../Avatar/Avatar';\nimport { AvatarGroupContext, useAvatarGroupContext_unstable } from '../../contexts/AvatarGroupContext';\nimport { defaultAvatarGroupSize } from '../AvatarGroup/useAvatarGroup';\nimport { slot } from '@fluentui/react-utilities';\nimport { useHasParentContext } from '@fluentui/react-context-selector';\nimport type { AvatarGroupItemProps, AvatarGroupItemState } from './AvatarGroupItem.types';\n\n/**\n * Create the state required to render AvatarGroupItem.\n *\n * The returned state can be modified with hooks such as useAvatarGroupItemStyles_unstable,\n * before being passed to renderAvatarGroupItem_unstable.\n *\n * @param props - props from this instance of AvatarGroupItem\n * @param ref - reference to root HTMLElement of AvatarGroupItem\n */\nexport const useAvatarGroupItem_unstable = (\n props: AvatarGroupItemProps,\n ref: React.Ref<HTMLElement>,\n): AvatarGroupItemState => {\n const groupIsOverflow = useAvatarGroupContext_unstable(ctx => ctx.isOverflow);\n const groupSize = useAvatarGroupContext_unstable(ctx => ctx.size);\n const layout = useAvatarGroupContext_unstable(ctx => ctx.layout);\n // Since the primary slot is not an intrinsic element, getPartitionedNativeProps cannot be used here.\n const { style, className, overflowLabel, ...avatarSlotProps } = props;\n const size = groupSize ?? defaultAvatarGroupSize;\n const hasAvatarGroupContext = useHasParentContext(AvatarGroupContext);\n\n if (process.env.NODE_ENV !== 'production' && !hasAvatarGroupContext) {\n // eslint-disable-next-line no-console\n console.warn('AvatarGroupItem must only be used inside an AvatarGroup component.');\n }\n\n return {\n isOverflowItem: groupIsOverflow,\n layout,\n size,\n components: {\n root: groupIsOverflow ? 'li' : 'div',\n avatar: Avatar,\n overflowLabel: 'span',\n },\n root: slot.always(props.root, {\n defaultProps: {\n style,\n className,\n },\n elementType: groupIsOverflow ? 'li' : 'div',\n }),\n avatar: slot.always(props.avatar, {\n defaultProps: {\n ref,\n size,\n color: 'colorful',\n ...avatarSlotProps,\n },\n elementType: Avatar,\n }),\n overflowLabel: slot.always(overflowLabel, {\n defaultProps: {\n // Avatar already has its aria-label set to the name, this will prevent the name to be read twice.\n 'aria-hidden': true,\n children: props.name,\n },\n elementType: 'span',\n }),\n };\n};\n"],"names":["React","Avatar","AvatarGroupContext","useAvatarGroupContext_unstable","defaultAvatarGroupSize","slot","useHasParentContext","useAvatarGroupItem_unstable","props","ref","groupIsOverflow","ctx","isOverflow","groupSize","size","layout","style","className","overflowLabel","avatarSlotProps","hasAvatarGroupContext","process","env","NODE_ENV","console","warn","isOverflowItem","components","root","avatar","always","defaultProps","elementType","color","children","name"],"mappings":"AAAA;;;;;+BAmBaO;;;;;;;iEAjBU,QAAQ;wBACR,mBAAmB;oCACyB,oCAAoC;gCAChE,gCAAgC;gCAClD,4BAA4B;sCACb,mCAAmC;AAYhE,oCAAoC,CACzCC,OACAC;IAEA,MAAMC,sBAAkBP,kDAAAA,EAA+BQ,CAAAA,MAAOA,IAAIC,UAAU;IAC5E,MAAMC,gBAAYV,kDAAAA,EAA+BQ,CAAAA,MAAOA,IAAIG,IAAI;IAChE,MAAMC,aAASZ,kDAAAA,EAA+BQ,CAAAA,MAAOA,IAAII,MAAM;IAC/D,qGAAqG;IACrG,MAAM,EAAEC,KAAK,EAAEC,SAAS,EAAEC,aAAa,EAAE,GAAGC,iBAAiB,GAAGX;IAChE,MAAMM,OAAOD,cAAAA,QAAAA,cAAAA,KAAAA,IAAAA,YAAaT,sCAAAA;IAC1B,MAAMgB,wBAAwBd,6CAAAA,EAAoBJ,sCAAAA;IAElD,IAAImB,QAAQC,GAAG,CAACC,QAAQ,KAAK,gBAAgB,CAACH,uBAAuB;QACnE,sCAAsC;QACtCI,QAAQC,IAAI,CAAC;IACf;IAEA,OAAO;QACLC,gBAAgBhB;QAChBK;QACAD;QACAa,YAAY;YACVC,MAAMlB,kBAAkB,OAAO;YAC/BmB,QAAQ5B,cAAAA;YACRiB,eAAe;QACjB;QACAU,MAAMvB,oBAAAA,CAAKyB,MAAM,CAACtB,MAAMoB,IAAI,EAAE;YAC5BG,cAAc;gBACZf;gBACAC;YACF;YACAe,aAAatB,kBAAkB,OAAO;QACxC;QACAmB,QAAQxB,oBAAAA,CAAKyB,MAAM,CAACtB,MAAMqB,MAAM,EAAE;YAChCE,cAAc;gBACZtB;gBACAK;gBACAmB,OAAO;gBACP,GAAGd,eAAe;YACpB;YACAa,aAAa/B,cAAAA;QACf;QACAiB,eAAeb,oBAAAA,CAAKyB,MAAM,CAACZ,eAAe;YACxCa,cAAc;gBACZ,kGAAkG;gBAClG,eAAe;gBACfG,UAAU1B,MAAM2B,IAAI;YACtB;YACAH,aAAa;QACf;IACF;AACF,EAAE"}
@@ -100,3 +100,6 @@ const _AvatarGroup = require("./AvatarGroup");
100
100
  const _AvatarGroupItem = require("./AvatarGroupItem");
101
101
  const _AvatarGroupPopover = require("./AvatarGroupPopover");
102
102
  const _index1 = require("./contexts/index");
103
+ // Experimental APIs, will be undocumented in experimental branch
104
+ // export { useAvatarBase_unstable } from './Avatar';
105
+ // export type { AvatarBaseProps, AvatarBaseState } from './Avatar';
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["export {\n Avatar,\n avatarClassNames,\n renderAvatar_unstable,\n useAvatarStyles_unstable,\n useAvatar_unstable,\n} from './Avatar';\nexport type {\n AvatarNamedColor,\n AvatarProps,\n AvatarSlots,\n AvatarState,\n AvatarShape,\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n AvatarSizes,\n AvatarSize,\n} from './Avatar';\nexport { getInitials, partitionAvatarGroupItems } from './utils/index';\nexport type { PartitionAvatarGroupItems, PartitionAvatarGroupItemsOptions } from './utils/index';\nexport {\n AvatarGroup,\n avatarGroupClassNames,\n renderAvatarGroup_unstable,\n useAvatarGroupContextValues,\n useAvatarGroupStyles_unstable,\n useAvatarGroup_unstable,\n} from './AvatarGroup';\nexport type {\n AvatarGroupProps,\n AvatarGroupSlots,\n AvatarGroupState,\n AvatarGroupContextValue,\n AvatarGroupContextValues,\n} from './AvatarGroup';\nexport {\n AvatarGroupItem,\n avatarGroupItemClassNames,\n renderAvatarGroupItem_unstable,\n useAvatarGroupItemStyles_unstable,\n useAvatarGroupItem_unstable,\n} from './AvatarGroupItem';\nexport type { AvatarGroupItemProps, AvatarGroupItemSlots, AvatarGroupItemState } from './AvatarGroupItem';\nexport {\n AvatarGroupPopover,\n avatarGroupPopoverClassNames,\n renderAvatarGroupPopover_unstable,\n useAvatarGroupPopover_unstable,\n useAvatarGroupPopoverContextValues_unstable,\n useAvatarGroupPopoverStyles_unstable,\n} from './AvatarGroupPopover';\nexport type { AvatarGroupPopoverProps, AvatarGroupPopoverSlots, AvatarGroupPopoverState } from './AvatarGroupPopover';\nexport {\n AvatarContextProvider,\n AvatarGroupProvider,\n useAvatarContext,\n useAvatarGroupContext_unstable,\n} from './contexts/index';\nexport type { AvatarContextValue } from './contexts/index';\n"],"names":["Avatar","avatarClassNames","renderAvatar_unstable","useAvatarStyles_unstable","useAvatar_unstable","getInitials","partitionAvatarGroupItems","AvatarGroup","avatarGroupClassNames","renderAvatarGroup_unstable","useAvatarGroupContextValues","useAvatarGroupStyles_unstable","useAvatarGroup_unstable","AvatarGroupItem","avatarGroupItemClassNames","renderAvatarGroupItem_unstable","useAvatarGroupItemStyles_unstable","useAvatarGroupItem_unstable","AvatarGroupPopover","avatarGroupPopoverClassNames","renderAvatarGroupPopover_unstable","useAvatarGroupPopover_unstable","useAvatarGroupPopoverContextValues_unstable","useAvatarGroupPopoverStyles_unstable","AvatarContextProvider","AvatarGroupProvider","useAvatarContext","useAvatarGroupContext_unstable"],"mappings":";;;;;;;;;;;IACEA;6BAAM;;;eAmDNwB,6BAAqB;;;eAhCrBjB,wBAAW;;;eAeXM,gCAAe;;;eAQfK,sCAAkB;;uBAUC;eAAnBO;;;eAnDAxB,wBAAgB;;;eAmBhBO,kCAAqB;;;eAerBM,0CAAyB;;;eAQzBK,gDAA4B;;;eA3BrBd,kBAAW;;;eAAEC,gCAAyB;;;eAoB7CS,+CAA8B;;IAQ9BK,iCAAiC;;;;eAvBjCX,uCAA0B;;;eAnB1BP,6BAAqB;;;eAmDrBwB,wBAAgB;;IA/BhBhB;uDAA2B;;kCAgCG;eAA9BiB;;;eAjBAX,kDAAiC;;;eACjCC,4CAA2B;;;eAQ3BK,+DAA2C;;;eAC3CC,wDAAoC;;;eAFpCF,kDAA8B;;IAtB9BV;yDAA6B;;;eAC7BC,oCAAuB;;;eArBvBT,gCAAwB;;;eACxBC,0BAAkB;;;wBACb,WAAW;uBAWqC,gBAAgB;6BAShE,gBAAgB;iCAchB,oBAAoB;oCASpB,uBAAuB;wBAOvB,mBAAmB"}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["export {\n Avatar,\n avatarClassNames,\n renderAvatar_unstable,\n useAvatarStyles_unstable,\n useAvatar_unstable,\n} from './Avatar';\nexport type {\n AvatarNamedColor,\n AvatarProps,\n AvatarSlots,\n AvatarState,\n AvatarShape,\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n AvatarSizes,\n AvatarSize,\n} from './Avatar';\nexport { getInitials, partitionAvatarGroupItems } from './utils/index';\nexport type { PartitionAvatarGroupItems, PartitionAvatarGroupItemsOptions } from './utils/index';\nexport {\n AvatarGroup,\n avatarGroupClassNames,\n renderAvatarGroup_unstable,\n useAvatarGroupContextValues,\n useAvatarGroupStyles_unstable,\n useAvatarGroup_unstable,\n} from './AvatarGroup';\nexport type {\n AvatarGroupProps,\n AvatarGroupSlots,\n AvatarGroupState,\n AvatarGroupContextValue,\n AvatarGroupContextValues,\n} from './AvatarGroup';\nexport {\n AvatarGroupItem,\n avatarGroupItemClassNames,\n renderAvatarGroupItem_unstable,\n useAvatarGroupItemStyles_unstable,\n useAvatarGroupItem_unstable,\n} from './AvatarGroupItem';\nexport type { AvatarGroupItemProps, AvatarGroupItemSlots, AvatarGroupItemState } from './AvatarGroupItem';\nexport {\n AvatarGroupPopover,\n avatarGroupPopoverClassNames,\n renderAvatarGroupPopover_unstable,\n useAvatarGroupPopover_unstable,\n useAvatarGroupPopoverContextValues_unstable,\n useAvatarGroupPopoverStyles_unstable,\n} from './AvatarGroupPopover';\nexport type { AvatarGroupPopoverProps, AvatarGroupPopoverSlots, AvatarGroupPopoverState } from './AvatarGroupPopover';\nexport {\n AvatarContextProvider,\n AvatarGroupProvider,\n useAvatarContext,\n useAvatarGroupContext_unstable,\n} from './contexts/index';\nexport type { AvatarContextValue } from './contexts/index';\n\n// Experimental APIs, will be undocumented in experimental branch\n// export { useAvatarBase_unstable } from './Avatar';\n// export type { AvatarBaseProps, AvatarBaseState } from './Avatar';\n"],"names":["Avatar","avatarClassNames","renderAvatar_unstable","useAvatarStyles_unstable","useAvatar_unstable","getInitials","partitionAvatarGroupItems","AvatarGroup","avatarGroupClassNames","renderAvatarGroup_unstable","useAvatarGroupContextValues","useAvatarGroupStyles_unstable","useAvatarGroup_unstable","AvatarGroupItem","avatarGroupItemClassNames","renderAvatarGroupItem_unstable","useAvatarGroupItemStyles_unstable","useAvatarGroupItem_unstable","AvatarGroupPopover","avatarGroupPopoverClassNames","renderAvatarGroupPopover_unstable","useAvatarGroupPopover_unstable","useAvatarGroupPopoverContextValues_unstable","useAvatarGroupPopoverStyles_unstable","AvatarContextProvider","AvatarGroupProvider","useAvatarContext","useAvatarGroupContext_unstable"],"mappings":";;;;;;;;;;;IACEA,MAAM;;;yBAmDe;eAArBwB;;;eAhCAjB,wBAAW;;;eAeXM,gCAAe;;;eAQfK,sCAAkB;;;eAUlBO,2BAAmB;;;eAnDnBxB,wBAAgB;;IAmBhBO,qBAAqB;;;6BAeI;eAAzBM;;;eAQAK,gDAA4B;;;eA3BrBd,kBAAW;;;eAAEC,gCAAyB;;IAoB7CS,8BAA8B;;;;eAQ9BK,qDAAiC;;;eAvBjCX,uCAA0B;;;eAnB1BP,6BAAqB;;;eAmDrBwB,wBAAgB;;;eA/BhBhB,wCAA2B;;;eAgC3BiB,sCAA8B;;IAjB9BX,iCAAiC;;;;eACjCC,4CAA2B;;;eAQ3BK,+DAA2C;;;eAC3CC,wDAAoC;;kCAFN;eAA9BF;;;eAtBAV,0CAA6B;;;eAC7BC,oCAAuB;;4BArBC;eAAxBT;;;eACAC,0BAAkB;;;wBACb,WAAW;uBAWqC,gBAAgB;6BAShE,gBAAgB;iCAchB,oBAAoB;oCASpB,uBAAuB;wBAOvB,mBAAmB;CAG1B,iEAAiE;CACjE,qDAAqD;CACrD,oEAAoE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluentui/react-avatar",
3
- "version": "9.9.13",
3
+ "version": "9.10.0",
4
4
  "description": "React components for building Microsoft web experiences.",
5
5
  "main": "lib-commonjs/index.js",
6
6
  "module": "lib/index.js",
@@ -12,25 +12,19 @@
12
12
  },
13
13
  "license": "MIT",
14
14
  "devDependencies": {
15
- "@fluentui/react-provider": "*",
16
- "@fluentui/eslint-plugin": "*",
17
- "@fluentui/react-conformance": "*",
18
- "@fluentui/react-conformance-griffel": "*",
19
- "es6-weak-map": "^2.0.2",
20
- "@fluentui/scripts-api-extractor": "*",
21
- "@fluentui/scripts-cypress": "*"
15
+ "es6-weak-map": "^2.0.2"
22
16
  },
23
17
  "dependencies": {
24
- "@fluentui/react-badge": "^9.4.12",
25
- "@fluentui/react-context-selector": "^9.2.13",
18
+ "@fluentui/react-badge": "^9.4.14",
19
+ "@fluentui/react-context-selector": "^9.2.14",
26
20
  "@fluentui/react-icons": "^2.0.245",
27
- "@fluentui/react-popover": "^9.12.13",
28
- "@fluentui/react-shared-contexts": "^9.26.0",
29
- "@fluentui/react-tabster": "^9.26.11",
30
- "@fluentui/react-theme": "^9.2.0",
31
- "@fluentui/react-tooltip": "^9.8.12",
32
- "@fluentui/react-utilities": "^9.26.0",
33
- "@fluentui/react-jsx-runtime": "^9.3.4",
21
+ "@fluentui/react-popover": "^9.13.1",
22
+ "@fluentui/react-shared-contexts": "^9.26.1",
23
+ "@fluentui/react-tabster": "^9.26.12",
24
+ "@fluentui/react-theme": "^9.2.1",
25
+ "@fluentui/react-tooltip": "^9.9.1",
26
+ "@fluentui/react-utilities": "^9.26.1",
27
+ "@fluentui/react-jsx-runtime": "^9.4.0",
34
28
  "@griffel/react": "^1.5.32",
35
29
  "@swc/helpers": "^0.5.1"
36
30
  },