@fluentui/react-avatar 9.11.5 → 9.11.7

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,39 @@
1
1
  # Change Log - @fluentui/react-avatar
2
2
 
3
- <!-- This log was last generated on Tue, 11 Aug 2026 17:16:03 GMT and should not be manually modified. -->
3
+ <!-- This log was last generated on Mon, 21 Sep 2026 16:12:52 GMT and should not be manually modified. -->
4
4
 
5
5
  <!-- Start content -->
6
6
 
7
+ ## [9.11.7](https://github.com/microsoft/fluentui/tree/@fluentui/react-avatar_v9.11.7)
8
+
9
+ Mon, 21 Sep 2026 16:12:52 GMT
10
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-avatar_v9.11.6..@fluentui/react-avatar_v9.11.7)
11
+
12
+ ### Patches
13
+
14
+ - feat: add badge support for Avatar base hooks ([PR #36694](https://github.com/microsoft/fluentui/pull/36694) by dmytrokirpa@microsoft.com)
15
+ - fix: remove unused react-dom and @types/react-dom peer dependencies, mark @types/react as optional ([PR #36559](https://github.com/microsoft/fluentui/pull/36559) by martinhochel@microsoft.com)
16
+ - Bump @fluentui/react-badge to v9.5.6 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
17
+ - Bump @fluentui/react-context-selector to v9.2.20 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
18
+ - Bump @fluentui/react-jsx-runtime to v9.4.6 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
19
+ - Bump @fluentui/react-popover to v9.14.8 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
20
+ - Bump @fluentui/react-shared-contexts to v9.26.4 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
21
+ - Bump @fluentui/react-tabster to v9.26.18 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
22
+ - Bump @fluentui/react-tooltip to v9.10.6 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
23
+ - Bump @fluentui/react-utilities to v9.26.7 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
24
+
25
+ ## [9.11.6](https://github.com/microsoft/fluentui/tree/@fluentui/react-avatar_v9.11.6)
26
+
27
+ Mon, 24 Aug 2026 16:40:04 GMT
28
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-avatar_v9.11.5..@fluentui/react-avatar_v9.11.6)
29
+
30
+ ### Patches
31
+
32
+ - Bump @fluentui/react-popover to v9.14.7 ([commit](https://github.com/microsoft/fluentui/commit/undefined) by beachball)
33
+
7
34
  ## [9.11.5](https://github.com/microsoft/fluentui/tree/@fluentui/react-avatar_v9.11.5)
8
35
 
9
- Tue, 11 Aug 2026 17:16:03 GMT
36
+ Tue, 11 Aug 2026 17:20:14 GMT
10
37
  [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-avatar_v9.11.4..@fluentui/react-avatar_v9.11.5)
11
38
 
12
39
  ### Patches
package/dist/index.d.cts CHANGED
@@ -7,6 +7,7 @@ import type { JSXElement } from '@fluentui/react-utilities';
7
7
  import type { PopoverProps } from '@fluentui/react-popover';
8
8
  import type { PopoverSurface } from '@fluentui/react-popover';
9
9
  import type { PresenceBadge } from '@fluentui/react-badge';
10
+ import type { PresenceBadgeBaseProps } from '@fluentui/react-badge';
10
11
  import { Provider } from 'react';
11
12
  import { ProviderProps } from 'react';
12
13
  import * as React_2 from 'react';
@@ -16,9 +17,16 @@ import type { TooltipProps } from '@fluentui/react-tooltip';
16
17
 
17
18
  export declare const Avatar: ForwardRefComponent<AvatarProps>;
18
19
 
19
- export declare type AvatarBaseProps = ComponentProps<Omit<AvatarSlots, 'badge'>> & Pick<AvatarProps, 'name'>;
20
+ export declare type AvatarBaseProps = ComponentProps<AvatarBaseSlots> & Pick<AvatarProps, 'active' | 'name'>;
20
21
 
21
- export declare type AvatarBaseState = ComponentState<Omit<AvatarSlots, 'badge'>> & Pick<AvatarState, 'activeAriaLabelElement'>;
22
+ export declare type AvatarBaseSlots = Omit<AvatarSlots, 'badge'> & {
23
+ /**
24
+ * Badge to show the avatar's presence status.
25
+ */
26
+ badge?: Slot<PresenceBadgeBaseProps>;
27
+ };
28
+
29
+ export declare type AvatarBaseState = ComponentState<AvatarBaseSlots> & Pick<AvatarState, 'active' | 'activeAriaLabelElement'>;
22
30
 
23
31
  export declare const avatarClassNames: SlotClassNames<AvatarSlots>;
24
32
 
package/dist/index.d.ts CHANGED
@@ -7,6 +7,7 @@ import type { JSXElement } from '@fluentui/react-utilities';
7
7
  import type { PopoverProps } from '@fluentui/react-popover';
8
8
  import type { PopoverSurface } from '@fluentui/react-popover';
9
9
  import type { PresenceBadge } from '@fluentui/react-badge';
10
+ import type { PresenceBadgeBaseProps } from '@fluentui/react-badge';
10
11
  import { Provider } from 'react';
11
12
  import { ProviderProps } from 'react';
12
13
  import * as React_2 from 'react';
@@ -16,9 +17,16 @@ import type { TooltipProps } from '@fluentui/react-tooltip';
16
17
 
17
18
  export declare const Avatar: ForwardRefComponent<AvatarProps>;
18
19
 
19
- export declare type AvatarBaseProps = ComponentProps<Omit<AvatarSlots, 'badge'>> & Pick<AvatarProps, 'name'>;
20
+ export declare type AvatarBaseProps = ComponentProps<AvatarBaseSlots> & Pick<AvatarProps, 'active' | 'name'>;
20
21
 
21
- export declare type AvatarBaseState = ComponentState<Omit<AvatarSlots, 'badge'>> & Pick<AvatarState, 'activeAriaLabelElement'>;
22
+ export declare type AvatarBaseSlots = Omit<AvatarSlots, 'badge'> & {
23
+ /**
24
+ * Badge to show the avatar's presence status.
25
+ */
26
+ badge?: Slot<PresenceBadgeBaseProps>;
27
+ };
28
+
29
+ export declare type AvatarBaseState = ComponentState<AvatarBaseSlots> & Pick<AvatarState, 'active' | 'activeAriaLabelElement'>;
22
30
 
23
31
  export declare const avatarClassNames: SlotClassNames<AvatarSlots>;
24
32
 
package/lib/Avatar.js.map CHANGED
@@ -1 +1 @@
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,+BAA4B"}
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 AvatarBaseSlots,\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":"AAaA,SACEA,MAAM,EACNC,eAAe,EACfC,gBAAgB,EAChBC,qBAAqB,EACrBC,wBAAwB,EACxBC,kBAAkB,EAClBC,sBAAsB,EACtBC,aAAa,QACR,+BAA4B"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/Avatar/Avatar.types.ts"],"sourcesContent":["import type { 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
+ {"version":3,"sources":["../src/components/Avatar/Avatar.types.ts"],"sourcesContent":["import type { PresenceBadge, PresenceBadgeBaseProps } 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\nexport type AvatarBaseSlots = Omit<AvatarSlots, 'badge'> & {\n /**\n * Badge to show the avatar's presence status.\n */\n badge?: Slot<PresenceBadgeBaseProps>;\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<AvatarBaseSlots> & Pick<AvatarProps, 'active' | '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<AvatarBaseSlots> & Pick<AvatarState, 'active' | 'activeAriaLabelElement'>;\n"],"names":[],"mappings":"AAsLA,WAAuH"}
@@ -1 +1 @@
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,cAAW;AAClC,SAASC,qBAAqB,QAAQ,oBAAiB;AACvD,SAASC,eAAe,EAAEC,kBAAkB,EAAEC,sBAAsB,QAAQ,iBAAc;AAC1F,SAASC,gBAAgB,EAAEC,wBAAwB,EAAEC,aAAa,QAAQ,8BAA2B"}
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 AvatarBaseSlots,\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":"AAaA,SAASA,MAAM,QAAQ,cAAW;AAClC,SAASC,qBAAqB,QAAQ,oBAAiB;AACvD,SAASC,eAAe,EAAEC,kBAAkB,EAAEC,sBAAsB,QAAQ,iBAAc;AAC1F,SAASC,gBAAgB,EAAEC,wBAAwB,EAAEC,aAAa,QAAQ,8BAA2B"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/Avatar/renderAvatar.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { assertSlots } from '@fluentui/react-utilities';\nimport type { JSXElement } from '@fluentui/react-utilities';\n\nimport type { AvatarSlots, AvatarBaseState } from './Avatar.types';\n\nexport const renderAvatar_unstable = (state: AvatarBaseState): JSXElement => {\n assertSlots<AvatarSlots>(state);\n\n return (\n <state.root>\n {state.initials && <state.initials />}\n {state.icon && <state.icon />}\n {state.image && <state.image />}\n {state.badge && <state.badge />}\n {state.activeAriaLabelElement}\n </state.root>\n );\n};\n"],"names":["assertSlots","renderAvatar_unstable","state","root","initials","icon","image","badge","activeAriaLabelElement"],"mappings":"AAAA,0BAA0B,GAC1B,iDAAiD;AAEjD,SAASA,WAAW,QAAQ,4BAA4B;AAKxD,OAAO,MAAMC,wBAAwB,CAACC;IACpCF,YAAyBE;IAEzB,qBACE,MAACA,MAAMC,IAAI;;YACRD,MAAME,QAAQ,kBAAI,KAACF,MAAME,QAAQ;YACjCF,MAAMG,IAAI,kBAAI,KAACH,MAAMG,IAAI;YACzBH,MAAMI,KAAK,kBAAI,KAACJ,MAAMI,KAAK;YAC3BJ,MAAMK,KAAK,kBAAI,KAACL,MAAMK,KAAK;YAC3BL,MAAMM,sBAAsB;;;AAGnC,EAAE"}
1
+ {"version":3,"sources":["../src/components/Avatar/renderAvatar.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { assertSlots } from '@fluentui/react-utilities';\nimport type { JSXElement } from '@fluentui/react-utilities';\n\nimport type { AvatarBaseSlots, AvatarBaseState } from './Avatar.types';\n\nexport const renderAvatar_unstable = (state: AvatarBaseState): JSXElement => {\n assertSlots<AvatarBaseSlots>(state);\n\n return (\n <state.root>\n {state.initials && <state.initials />}\n {state.icon && <state.icon />}\n {state.image && <state.image />}\n {state.badge && <state.badge />}\n {state.activeAriaLabelElement}\n </state.root>\n );\n};\n"],"names":["assertSlots","renderAvatar_unstable","state","root","initials","icon","image","badge","activeAriaLabelElement"],"mappings":"AAAA,0BAA0B,GAC1B,iDAAiD;AAEjD,SAASA,WAAW,QAAQ,4BAA4B;AAKxD,OAAO,MAAMC,wBAAwB,CAACC;IACpCF,YAA6BE;IAE7B,qBACE,MAACA,MAAMC,IAAI;;YACRD,MAAME,QAAQ,kBAAI,KAACF,MAAME,QAAQ;YACjCF,MAAMG,IAAI,kBAAI,KAACH,MAAMG,IAAI;YACzBH,MAAMI,KAAK,kBAAI,KAACJ,MAAMI,KAAK;YAC3BJ,MAAMK,KAAK,kBAAI,KAACL,MAAMK,KAAK;YAC3BL,MAAMM,sBAAsB;;;AAGnC,EAAE"}
@@ -13,7 +13,7 @@ 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 { 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;
16
+ const { size = contextSize !== null && contextSize !== void 0 ? contextSize : 32, shape = contextShape !== null && contextShape !== void 0 ? contextShape : 'circular', activeAppearance = 'ring', idForColor, color: propColor = 'neutral', ...rest } = props;
17
17
  const state = useAvatarBase_unstable(rest, ref);
18
18
  var _ref;
19
19
  // Resolve 'colorful' to a specific color name
@@ -38,55 +38,16 @@ export const useAvatar_unstable = (props, ref)=>{
38
38
  }
39
39
  const badge = slot.optional(props.badge, {
40
40
  defaultProps: {
41
- size: getBadgeSize(size),
42
- id: state.root.id + '__badge'
41
+ ...state.badge,
42
+ size: getBadgeSize(size)
43
43
  },
44
44
  elementType: PresenceBadge
45
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
- // eslint-disable-next-line react-hooks/immutability
55
- state.root['aria-labelledby'] = state.root.id + ' ' + badge.id;
56
- }
57
- } else if (state.initials) {
58
- // root's aria-label should be the name, but fall back to being labelledby the initials if name is missing
59
- // eslint-disable-next-line react-hooks/immutability
60
- state.root['aria-labelledby'] = state.initials.id + (badge ? ' ' + badge.id : '');
61
- // eslint-disable-next-line react-hooks/immutability
62
- delete state.root['aria-label'];
63
- }
64
- // Add the active state to the aria label
65
- if (active === 'active' || active === 'inactive') {
66
- const activeText = DEFAULT_STRINGS[active];
67
- if (state.root['aria-labelledby']) {
68
- // If using aria-labelledby, render a hidden span and append it to the labelledby
69
- const activeId = state.root.id + '__active';
70
- // eslint-disable-next-line react-hooks/immutability
71
- state.root['aria-labelledby'] += ' ' + activeId;
72
- activeAriaLabelElement = /*#__PURE__*/ React.createElement("span", {
73
- hidden: true,
74
- id: activeId
75
- }, activeText);
76
- } else if (state.root['aria-label']) {
77
- // Otherwise, just append it to the aria-label
78
- // eslint-disable-next-line react-hooks/immutability
79
- state.root['aria-label'] += ' ' + activeText;
80
- }
81
- }
82
- }
83
46
  return {
84
47
  ...state,
85
48
  size,
86
49
  shape,
87
- active,
88
50
  activeAppearance,
89
- activeAriaLabelElement,
90
51
  color,
91
52
  badge,
92
53
  // eslint-disable-next-line @typescript-eslint/no-deprecated
@@ -100,7 +61,7 @@ export const useAvatar_unstable = (props, ref)=>{
100
61
  * Base hook for Avatar component, manages state and structure common to all variants of Avatar
101
62
  */ export const useAvatarBase_unstable = (props, ref)=>{
102
63
  const { dir } = useFluent();
103
- const { name, image: imageProp, initials: initialsProp, ...rest } = props;
64
+ const { name, image: imageProp, initials: initialsProp, badge, active = 'unset', ...rest } = props;
104
65
  const baseId = useId('avatar-');
105
66
  const root = slot.always({
106
67
  role: 'img',
@@ -153,28 +114,55 @@ export const useAvatar_unstable = (props, ref)=>{
153
114
  elementType: 'span'
154
115
  });
155
116
  }
117
+ const badgeSlot = slot.optional(badge, {
118
+ defaultProps: {
119
+ id: root.id + '__badge'
120
+ },
121
+ elementType: 'div'
122
+ });
156
123
  let activeAriaLabelElement;
157
- // Resolve aria-label and/or aria-labelledby if not provided by the user
158
- if (!root['aria-label'] && !root['aria-labelledby']) {
124
+ // Resolve aria-label and/or aria-labelledby, including the badge, if not provided by the user
125
+ const userProvidedAriaLabel = props['aria-label'] !== undefined;
126
+ const userProvidedAriaLabelledby = props['aria-labelledby'] !== undefined;
127
+ if (!userProvidedAriaLabel && !userProvidedAriaLabelledby) {
159
128
  if (name) {
160
129
  root['aria-label'] = name;
130
+ if (badgeSlot) {
131
+ root['aria-labelledby'] = root.id + ' ' + badgeSlot.id;
132
+ }
161
133
  } else if (initials) {
162
134
  // root's aria-label should be the name, but fall back to being labelledby the initials if name is missing
163
- root['aria-labelledby'] = initials.id;
135
+ root['aria-labelledby'] = initials.id + (badgeSlot ? ' ' + badgeSlot.id : '');
136
+ }
137
+ if (active === 'active' || active === 'inactive') {
138
+ const activeText = DEFAULT_STRINGS[active];
139
+ if (root['aria-labelledby']) {
140
+ const activeId = root.id + '__active';
141
+ root['aria-labelledby'] += ' ' + activeId;
142
+ activeAriaLabelElement = /*#__PURE__*/ React.createElement("span", {
143
+ hidden: true,
144
+ id: activeId
145
+ }, activeText);
146
+ } else if (root['aria-label']) {
147
+ root['aria-label'] += ' ' + activeText;
148
+ }
164
149
  }
165
150
  }
166
151
  return {
152
+ active,
167
153
  activeAriaLabelElement,
168
154
  components: {
169
155
  root: 'span',
170
156
  initials: 'span',
171
157
  icon: 'span',
172
- image: 'img'
158
+ image: 'img',
159
+ badge: 'div'
173
160
  },
174
161
  root,
175
162
  initials,
176
163
  icon,
177
- image
164
+ image,
165
+ badge: badgeSlot
178
166
  };
179
167
  };
180
168
  const getBadgeSize = (size)=>{
@@ -1 +1 @@
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 // eslint-disable-next-line react-hooks/immutability\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 && !state.icon.hasOwnProperty('children')) {\n // eslint-disable-next-line react-hooks/immutability\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 // eslint-disable-next-line react-hooks/immutability\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 // eslint-disable-next-line react-hooks/immutability\n state.root['aria-labelledby'] = state.initials.id + (badge ? ' ' + badge.id : '');\n // eslint-disable-next-line react-hooks/immutability\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 // eslint-disable-next-line react-hooks/immutability\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 // eslint-disable-next-line react-hooks/immutability\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, image: imageProp, initials: initialsProp, ...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(imageProp, {\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(initialsProp, {\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","hasOwnProperty","badge","getBadgeSize","root","activeAriaLabelElement","userProvidedAriaLabel","undefined","userProvidedAriaLabelledby","activeText","activeId","span","hidden","components","image","imageProp","initialsProp","baseId","always","role","imageHidden","setImageHidden","useState","alt","src","onError","onLoad","str","hashCode","len","ch","charCodeAt","shift"],"mappings":"AAAA;AAEA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,cAAc,EAAEC,KAAK,EAAEC,IAAI,QAAQ,4BAA4B;AACxE,SAASC,WAAW,QAAQ,uBAAoB;AAEhD,SAASC,aAAa,QAAQ,wBAAwB;AACtD,SAASC,aAAa,QAAQ,wBAAwB;AACtD,SAASC,sBAAsBC,SAAS,QAAQ,kCAAkC;AAClF,SAASC,gBAAgB,QAAQ,kCAA+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,EACJU,OAAOC,wBAAAA,yBAAAA,cAAgB,EAAY,EACnCH,QAAQC,yBAAAA,0BAAAA,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,uBAAAA,wBAAAA,aAAcR,MAAMgB,IAAI,cAAxBR,kBAAAA,OAA4B,MAAMM,aAAaG,MAAM,CAAC,GAC/EP;IAEN,IAAIE,MAAMM,Q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AEF,MAAMX,eAAe,CAACxB;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,CAACsC;IACnB,IAAIC,WAAW;IACf,IAAK,IAAIC,MAAcF,IAAIpC,MAAM,GAAG,GAAGsC,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 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 // eslint-disable-next-line react-hooks/immutability\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 && !state.icon.hasOwnProperty('children')) {\n // eslint-disable-next-line react-hooks/immutability\n state.icon.children = <PersonRegular />;\n }\n\n const badge: AvatarState['badge'] = slot.optional(props.badge, {\n defaultProps: { ...state.badge, size: getBadgeSize(size) },\n elementType: PresenceBadge,\n });\n\n return {\n ...state,\n size,\n shape,\n activeAppearance,\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, image: imageProp, initials: initialsProp, badge, active = 'unset', ...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(imageProp, {\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(initialsProp, {\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 const badgeSlot: AvatarBaseState['badge'] = slot.optional(badge, {\n defaultProps: { id: root.id + '__badge' },\n elementType: 'div',\n });\n\n let activeAriaLabelElement: AvatarBaseState['activeAriaLabelElement'];\n\n // Resolve aria-label and/or aria-labelledby, including the badge, if not provided by the user\n const userProvidedAriaLabel = props['aria-label'] !== undefined;\n const userProvidedAriaLabelledby = props['aria-labelledby'] !== undefined;\n if (!userProvidedAriaLabel && !userProvidedAriaLabelledby) {\n if (name) {\n root['aria-label'] = name;\n if (badgeSlot) {\n root['aria-labelledby'] = root.id + ' ' + badgeSlot.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 + (badgeSlot ? ' ' + badgeSlot.id : '');\n }\n\n if (active === 'active' || active === 'inactive') {\n const activeText = DEFAULT_STRINGS[active];\n if (root['aria-labelledby']) {\n const activeId = root.id + '__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 root['aria-label'] += ' ' + activeText;\n }\n }\n }\n\n return {\n active,\n activeAriaLabelElement,\n components: { root: 'span', initials: 'span', icon: 'span', image: 'img', badge: 'div' },\n root,\n initials,\n icon,\n image,\n badge: badgeSlot,\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","hasOwnProperty","badge","getBadgeSize","components","image","imageProp","initialsProp","baseId","root","always","role","imageHidden","setImageHidden","useState","undefined","alt","hidden","src","onError","onLoad","badgeSlot","activeAriaLabelElement","userProvidedAriaLabel","userProvidedAriaLabelledby","activeText","activeId","span","str","hashCode","len","ch","charCodeAt","shift"],"mappings":"AAAA;AAEA,YAAYA,WAAW,QAAQ;AAC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;AACT"}
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 useAvatarBase_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 AvatarBaseProps,\n AvatarBaseState,\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 useAvatarGroupBase_unstable,\n} from './AvatarGroup';\nexport type {\n AvatarGroupProps,\n AvatarGroupSlots,\n AvatarGroupState,\n AvatarGroupContextValue,\n AvatarGroupContextValues,\n AvatarGroupBaseProps,\n AvatarGroupBaseState,\n} from './AvatarGroup';\nexport {\n AvatarGroupItem,\n avatarGroupItemClassNames,\n renderAvatarGroupItem_unstable,\n useAvatarGroupItemStyles_unstable,\n useAvatarGroupItem_unstable,\n useAvatarGroupItemBase_unstable,\n} from './AvatarGroupItem';\nexport type {\n AvatarGroupItemProps,\n AvatarGroupItemSlots,\n AvatarGroupItemState,\n AvatarGroupItemBaseProps,\n AvatarGroupItemBaseState,\n} from './AvatarGroupItem';\nexport {\n AvatarGroupPopover,\n avatarGroupPopoverClassNames,\n renderAvatarGroupPopover_unstable,\n useAvatarGroupPopover_unstable,\n useAvatarGroupPopoverContextValues_unstable,\n useAvatarGroupPopoverStyles_unstable,\n useAvatarGroupPopoverBase_unstable,\n} from './AvatarGroupPopover';\nexport type {\n AvatarGroupPopoverProps,\n AvatarGroupPopoverSlots,\n AvatarGroupPopoverState,\n AvatarGroupPopoverBaseProps,\n AvatarGroupPopoverBaseState,\n} 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","useAvatarBase_unstable","getInitials","partitionAvatarGroupItems","AvatarGroup","avatarGroupClassNames","renderAvatarGroup_unstable","useAvatarGroupContextValues","useAvatarGroupStyles_unstable","useAvatarGroup_unstable","useAvatarGroupBase_unstable","AvatarGroupItem","avatarGroupItemClassNames","renderAvatarGroupItem_unstable","useAvatarGroupItemStyles_unstable","useAvatarGroupItem_unstable","useAvatarGroupItemBase_unstable","AvatarGroupPopover","avatarGroupPopoverClassNames","renderAvatarGroupPopover_unstable","useAvatarGroupPopover_unstable","useAvatarGroupPopoverContextValues_unstable","useAvatarGroupPopoverStyles_unstable","useAvatarGroupPopoverBase_unstable","AvatarContextProvider","AvatarGroupProvider","useAvatarContext","useAvatarGroupContext_unstable"],"mappings":"AAAA,SACEA,MAAM,EACNC,gBAAgB,EAChBC,qBAAqB,EACrBC,wBAAwB,EACxBC,kBAAkB,EAClBC,sBAAsB,QACjB,cAAW;AAalB,SAASC,WAAW,EAAEC,yBAAyB,QAAQ,mBAAgB;AAEvE,SACEC,WAAW,EACXC,qBAAqB,EACrBC,0BAA0B,EAC1BC,2BAA2B,EAC3BC,6BAA6B,EAC7BC,uBAAuB,EACvBC,2BAA2B,QACtB,mBAAgB;AAUvB,SACEC,eAAe,EACfC,yBAAyB,EACzBC,8BAA8B,EAC9BC,iCAAiC,EACjCC,2BAA2B,EAC3BC,+BAA+B,QAC1B,uBAAoB;AAQ3B,SACEC,kBAAkB,EAClBC,4BAA4B,EAC5BC,iCAAiC,EACjCC,8BAA8B,EAC9BC,2CAA2C,EAC3CC,oCAAoC,EACpCC,kCAAkC,QAC7B,0BAAuB;AAQ9B,SACEC,qBAAqB,EACrBC,mBAAmB,EACnBC,gBAAgB,EAChBC,8BAA8B,QACzB,sBAAmB"}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["export {\n Avatar,\n avatarClassNames,\n renderAvatar_unstable,\n useAvatarStyles_unstable,\n useAvatar_unstable,\n useAvatarBase_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 AvatarBaseProps,\n AvatarBaseSlots,\n AvatarBaseState,\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 useAvatarGroupBase_unstable,\n} from './AvatarGroup';\nexport type {\n AvatarGroupProps,\n AvatarGroupSlots,\n AvatarGroupState,\n AvatarGroupContextValue,\n AvatarGroupContextValues,\n AvatarGroupBaseProps,\n AvatarGroupBaseState,\n} from './AvatarGroup';\nexport {\n AvatarGroupItem,\n avatarGroupItemClassNames,\n renderAvatarGroupItem_unstable,\n useAvatarGroupItemStyles_unstable,\n useAvatarGroupItem_unstable,\n useAvatarGroupItemBase_unstable,\n} from './AvatarGroupItem';\nexport type {\n AvatarGroupItemProps,\n AvatarGroupItemSlots,\n AvatarGroupItemState,\n AvatarGroupItemBaseProps,\n AvatarGroupItemBaseState,\n} from './AvatarGroupItem';\nexport {\n AvatarGroupPopover,\n avatarGroupPopoverClassNames,\n renderAvatarGroupPopover_unstable,\n useAvatarGroupPopover_unstable,\n useAvatarGroupPopoverContextValues_unstable,\n useAvatarGroupPopoverStyles_unstable,\n useAvatarGroupPopoverBase_unstable,\n} from './AvatarGroupPopover';\nexport type {\n AvatarGroupPopoverProps,\n AvatarGroupPopoverSlots,\n AvatarGroupPopoverState,\n AvatarGroupPopoverBaseProps,\n AvatarGroupPopoverBaseState,\n} 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","useAvatarBase_unstable","getInitials","partitionAvatarGroupItems","AvatarGroup","avatarGroupClassNames","renderAvatarGroup_unstable","useAvatarGroupContextValues","useAvatarGroupStyles_unstable","useAvatarGroup_unstable","useAvatarGroupBase_unstable","AvatarGroupItem","avatarGroupItemClassNames","renderAvatarGroupItem_unstable","useAvatarGroupItemStyles_unstable","useAvatarGroupItem_unstable","useAvatarGroupItemBase_unstable","AvatarGroupPopover","avatarGroupPopoverClassNames","renderAvatarGroupPopover_unstable","useAvatarGroupPopover_unstable","useAvatarGroupPopoverContextValues_unstable","useAvatarGroupPopoverStyles_unstable","useAvatarGroupPopoverBase_unstable","AvatarContextProvider","AvatarGroupProvider","useAvatarContext","useAvatarGroupContext_unstable"],"mappings":"AAAA,SACEA,MAAM,EACNC,gBAAgB,EAChBC,qBAAqB,EACrBC,wBAAwB,EACxBC,kBAAkB,EAClBC,sBAAsB,QACjB,cAAW;AAclB,SAASC,WAAW,EAAEC,yBAAyB,QAAQ,mBAAgB;AAEvE,SACEC,WAAW,EACXC,qBAAqB,EACrBC,0BAA0B,EAC1BC,2BAA2B,EAC3BC,6BAA6B,EAC7BC,uBAAuB,EACvBC,2BAA2B,QACtB,mBAAgB;AAUvB,SACEC,eAAe,EACfC,yBAAyB,EACzBC,8BAA8B,EAC9BC,iCAAiC,EACjCC,2BAA2B,EAC3BC,+BAA+B,QAC1B,uBAAoB;AAQ3B,SACEC,kBAAkB,EAClBC,4BAA4B,EAC5BC,iCAAiC,EACjCC,8BAA8B,EAC9BC,2CAA2C,EAC3CC,oCAAoC,EACpCC,kCAAkC,QAC7B,0BAAuB;AAQ9B,SACEC,qBAAqB,EACrBC,mBAAmB,EACnBC,gBAAgB,EAChBC,8BAA8B,QACzB,sBAAmB"}
@@ -1 +1 @@
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,+BAA4B"}
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 AvatarBaseSlots,\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":";;;;;;;;;;;IAcEA;4BAAM;;;eACNC,sBAAe;;;eACfC,uBAAgB;;;eAChBC,4BAAqB;;0BAGC;eAAtBG;;;eAFAF,+BAAwB;;;eACxBC,yBAAkB;;;eAElBE,oBAAa;;;uBACR,+BAA4B"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/Avatar/Avatar.types.ts"],"sourcesContent":["import type { 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":""}
1
+ {"version":3,"sources":["../src/components/Avatar/Avatar.types.ts"],"sourcesContent":["import type { PresenceBadge, PresenceBadgeBaseProps } 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\nexport type AvatarBaseSlots = Omit<AvatarSlots, 'badge'> & {\n /**\n * Badge to show the avatar's presence status.\n */\n badge?: Slot<PresenceBadgeBaseProps>;\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<AvatarBaseSlots> & Pick<AvatarProps, 'active' | '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<AvatarBaseSlots> & Pick<AvatarState, 'active' | 'activeAriaLabelElement'>;\n"],"names":[],"mappings":""}
@@ -1 +1 @@
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,cAAW;8BACI,oBAAiB;2BACqB,iBAAc;uCAChB,8BAA2B"}
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 AvatarBaseSlots,\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":";;;;;;;;;;;IAaSA;6BAAM;;;eAENE,0BAAe;;IACfG;sDAAgB;;;eAFhBJ,mCAAqB;;0BACsC;eAAtBG;;;eACnBE,+CAAwB;;;eADzBH,6BAAkB;;;eACSI,oCAAa;;;wBAH3C,cAAW;8BACI,oBAAiB;2BACqB,iBAAc;uCAChB,8BAA2B"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/Avatar/renderAvatar.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { assertSlots } from '@fluentui/react-utilities';\nimport type { JSXElement } from '@fluentui/react-utilities';\n\nimport type { AvatarSlots, AvatarBaseState } from './Avatar.types';\n\nexport const renderAvatar_unstable = (state: AvatarBaseState): JSXElement => {\n assertSlots<AvatarSlots>(state);\n\n return (\n <state.root>\n {state.initials && <state.initials />}\n {state.icon && <state.icon />}\n {state.image && <state.image />}\n {state.badge && <state.badge />}\n {state.activeAriaLabelElement}\n </state.root>\n );\n};\n"],"names":["assertSlots","renderAvatar_unstable","state","root","initials","icon","image","badge","activeAriaLabelElement"],"mappings":";;;;+BAQaC;;;;;;4BAPb,iCAAiD;gCAErB,4BAA4B;AAKjD,8BAA8B,CAACC;QACpCF,2BAAAA,EAAyBE;IAEzB,OAAA,WAAA,OACE,gBAAA,EAACA,MAAMC,IAAI,EAAA;;YACRD,MAAME,QAAQ,IAAA,WAAA,OAAI,eAAA,EAACF,MAAME,QAAQ,EAAA,CAAA;YACjCF,MAAMG,IAAI,IAAA,WAAA,OAAI,eAAA,EAACH,MAAMG,IAAI,EAAA,CAAA;YACzBH,MAAMI,KAAK,IAAA,WAAA,OAAI,eAAA,EAACJ,MAAMI,KAAK,EAAA,CAAA;YAC3BJ,MAAMK,KAAK,IAAA,WAAA,OAAI,eAAA,EAACL,MAAMK,KAAK,EAAA,CAAA;YAC3BL,MAAMM,sBAAsB;;;AAGnC,EAAE"}
1
+ {"version":3,"sources":["../src/components/Avatar/renderAvatar.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\n\nimport { assertSlots } from '@fluentui/react-utilities';\nimport type { JSXElement } from '@fluentui/react-utilities';\n\nimport type { AvatarBaseSlots, AvatarBaseState } from './Avatar.types';\n\nexport const renderAvatar_unstable = (state: AvatarBaseState): JSXElement => {\n assertSlots<AvatarBaseSlots>(state);\n\n return (\n <state.root>\n {state.initials && <state.initials />}\n {state.icon && <state.icon />}\n {state.image && <state.image />}\n {state.badge && <state.badge />}\n {state.activeAriaLabelElement}\n </state.root>\n );\n};\n"],"names":["assertSlots","renderAvatar_unstable","state","root","initials","icon","image","badge","activeAriaLabelElement"],"mappings":";;;;+BAQaC;;;;;;4BAPb,iCAAiD;gCAErB,4BAA4B;AAKjD,8BAA8B,CAACC;QACpCF,2BAAAA,EAA6BE;IAE7B,OAAA,WAAA,OACE,gBAAA,EAACA,MAAMC,IAAI,EAAA;;YACRD,MAAME,QAAQ,IAAA,WAAA,OAAI,eAAA,EAACF,MAAME,QAAQ,EAAA,CAAA;YACjCF,MAAMG,IAAI,IAAA,WAAA,OAAI,eAAA,EAACH,MAAMG,IAAI,EAAA,CAAA;YACzBH,MAAMI,KAAK,IAAA,WAAA,OAAI,eAAA,EAACJ,MAAMI,KAAK,EAAA,CAAA;YAC3BJ,MAAMK,KAAK,IAAA,WAAA,OAAI,eAAA,EAACL,MAAMK,KAAK,EAAA,CAAA;YAC3BL,MAAMM,sBAAsB;;;AAGnC,EAAE"}
@@ -35,7 +35,7 @@ const DEFAULT_STRINGS = {
35
35
  const useAvatar_unstable = (props, ref)=>{
36
36
  const { dir } = (0, _reactsharedcontexts.useFluent_unstable)();
37
37
  const { shape: contextShape, size: contextSize } = (0, _AvatarContext.useAvatarContext)();
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;
38
+ const { size = contextSize !== null && contextSize !== void 0 ? contextSize : 32, shape = contextShape !== null && contextShape !== void 0 ? contextShape : 'circular', activeAppearance = 'ring', idForColor, color: propColor = 'neutral', ...rest } = props;
39
39
  const state = useAvatarBase_unstable(rest, ref);
40
40
  var _ref;
41
41
  // Resolve 'colorful' to a specific color name
@@ -60,55 +60,16 @@ const useAvatar_unstable = (props, ref)=>{
60
60
  }
61
61
  const badge = _reactutilities.slot.optional(props.badge, {
62
62
  defaultProps: {
63
- size: getBadgeSize(size),
64
- id: state.root.id + '__badge'
63
+ ...state.badge,
64
+ size: getBadgeSize(size)
65
65
  },
66
66
  elementType: _reactbadge.PresenceBadge
67
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
- // eslint-disable-next-line react-hooks/immutability
77
- state.root['aria-labelledby'] = state.root.id + ' ' + badge.id;
78
- }
79
- } else if (state.initials) {
80
- // root's aria-label should be the name, but fall back to being labelledby the initials if name is missing
81
- // eslint-disable-next-line react-hooks/immutability
82
- state.root['aria-labelledby'] = state.initials.id + (badge ? ' ' + badge.id : '');
83
- // eslint-disable-next-line react-hooks/immutability
84
- delete state.root['aria-label'];
85
- }
86
- // Add the active state to the aria label
87
- if (active === 'active' || active === 'inactive') {
88
- const activeText = DEFAULT_STRINGS[active];
89
- if (state.root['aria-labelledby']) {
90
- // If using aria-labelledby, render a hidden span and append it to the labelledby
91
- const activeId = state.root.id + '__active';
92
- // eslint-disable-next-line react-hooks/immutability
93
- state.root['aria-labelledby'] += ' ' + activeId;
94
- activeAriaLabelElement = /*#__PURE__*/ _react.createElement("span", {
95
- hidden: true,
96
- id: activeId
97
- }, activeText);
98
- } else if (state.root['aria-label']) {
99
- // Otherwise, just append it to the aria-label
100
- // eslint-disable-next-line react-hooks/immutability
101
- state.root['aria-label'] += ' ' + activeText;
102
- }
103
- }
104
- }
105
68
  return {
106
69
  ...state,
107
70
  size,
108
71
  shape,
109
- active,
110
72
  activeAppearance,
111
- activeAriaLabelElement,
112
73
  color,
113
74
  badge,
114
75
  // eslint-disable-next-line @typescript-eslint/no-deprecated
@@ -120,7 +81,7 @@ const useAvatar_unstable = (props, ref)=>{
120
81
  };
121
82
  const useAvatarBase_unstable = (props, ref)=>{
122
83
  const { dir } = (0, _reactsharedcontexts.useFluent_unstable)();
123
- const { name, image: imageProp, initials: initialsProp, ...rest } = props;
84
+ const { name, image: imageProp, initials: initialsProp, badge, active = 'unset', ...rest } = props;
124
85
  const baseId = (0, _reactutilities.useId)('avatar-');
125
86
  const root = _reactutilities.slot.always({
126
87
  role: 'img',
@@ -173,28 +134,55 @@ const useAvatarBase_unstable = (props, ref)=>{
173
134
  elementType: 'span'
174
135
  });
175
136
  }
137
+ const badgeSlot = _reactutilities.slot.optional(badge, {
138
+ defaultProps: {
139
+ id: root.id + '__badge'
140
+ },
141
+ elementType: 'div'
142
+ });
176
143
  let activeAriaLabelElement;
177
- // Resolve aria-label and/or aria-labelledby if not provided by the user
178
- if (!root['aria-label'] && !root['aria-labelledby']) {
144
+ // Resolve aria-label and/or aria-labelledby, including the badge, if not provided by the user
145
+ const userProvidedAriaLabel = props['aria-label'] !== undefined;
146
+ const userProvidedAriaLabelledby = props['aria-labelledby'] !== undefined;
147
+ if (!userProvidedAriaLabel && !userProvidedAriaLabelledby) {
179
148
  if (name) {
180
149
  root['aria-label'] = name;
150
+ if (badgeSlot) {
151
+ root['aria-labelledby'] = root.id + ' ' + badgeSlot.id;
152
+ }
181
153
  } else if (initials) {
182
154
  // root's aria-label should be the name, but fall back to being labelledby the initials if name is missing
183
- root['aria-labelledby'] = initials.id;
155
+ root['aria-labelledby'] = initials.id + (badgeSlot ? ' ' + badgeSlot.id : '');
156
+ }
157
+ if (active === 'active' || active === 'inactive') {
158
+ const activeText = DEFAULT_STRINGS[active];
159
+ if (root['aria-labelledby']) {
160
+ const activeId = root.id + '__active';
161
+ root['aria-labelledby'] += ' ' + activeId;
162
+ activeAriaLabelElement = /*#__PURE__*/ _react.createElement("span", {
163
+ hidden: true,
164
+ id: activeId
165
+ }, activeText);
166
+ } else if (root['aria-label']) {
167
+ root['aria-label'] += ' ' + activeText;
168
+ }
184
169
  }
185
170
  }
186
171
  return {
172
+ active,
187
173
  activeAriaLabelElement,
188
174
  components: {
189
175
  root: 'span',
190
176
  initials: 'span',
191
177
  icon: 'span',
192
- image: 'img'
178
+ image: 'img',
179
+ badge: 'div'
193
180
  },
194
181
  root,
195
182
  initials,
196
183
  icon,
197
- image
184
+ image,
185
+ badge: badgeSlot
198
186
  };
199
187
  };
200
188
  const getBadgeSize = (size)=>{
@@ -1 +1 @@
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 // eslint-disable-next-line react-hooks/immutability\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 && !state.icon.hasOwnProperty('children')) {\n // eslint-disable-next-line react-hooks/immutability\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 // eslint-disable-next-line react-hooks/immutability\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 // eslint-disable-next-line react-hooks/immutability\n state.root['aria-labelledby'] = state.initials.id + (badge ? ' ' + badge.id : '');\n // eslint-disable-next-line react-hooks/immutability\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 // eslint-disable-next-line react-hooks/immutability\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 // eslint-disable-next-line react-hooks/immutability\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, image: imageProp, initials: initialsProp, ...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(imageProp, {\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(initialsProp, {\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","hasOwnProperty","badge","getBadgeSize","root","activeAriaLabelElement","userProvidedAriaLabel","undefined","userProvidedAriaLabelledby","activeText","activeId","span","hidden","components","image","imageProp","initialsProp","baseId","always","role","imageHidden","setImageHidden","useState","alt","src","onError","onLoad","str","hashCode","len","ch","charCodeAt","shift"],"mappings":"AAAA;;;;;;;;;;;;IAWaU,eAAAA;;;0BA0GAiB;eAAAA;;IArGAd,kBAAAA;;;;;iEAdU,QAAQ;gCACa,4BAA4B;uBAC5C,uBAAoB;4BAElB,wBAAwB;4BACxB,wBAAwB;qCACN,kCAAkC;+BACjD,kCAA+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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;IACA;IACA;IACA;CACD;AAED,MAAMC,cAAc,CAACsC;IACnB,IAAIC,WAAW;IACf,IAAK,IAAIC,MAAcF,IAAIpC,MAAM,GAAG,GAAGsC,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 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 // eslint-disable-next-line react-hooks/immutability\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 && !state.icon.hasOwnProperty('children')) {\n // eslint-disable-next-line react-hooks/immutability\n state.icon.children = <PersonRegular />;\n }\n\n const badge: AvatarState['badge'] = slot.optional(props.badge, {\n defaultProps: { ...state.badge, size: getBadgeSize(size) },\n elementType: PresenceBadge,\n });\n\n return {\n ...state,\n size,\n shape,\n activeAppearance,\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, image: imageProp, initials: initialsProp, badge, active = 'unset', ...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(imageProp, {\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(initialsProp, {\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 const badgeSlot: AvatarBaseState['badge'] = slot.optional(badge, {\n defaultProps: { id: root.id + '__badge' },\n elementType: 'div',\n });\n\n let activeAriaLabelElement: AvatarBaseState['activeAriaLabelElement'];\n\n // Resolve aria-label and/or aria-labelledby, including the badge, if not provided by the user\n const userProvidedAriaLabel = props['aria-label'] !== undefined;\n const userProvidedAriaLabelledby = props['aria-labelledby'] !== undefined;\n if (!userProvidedAriaLabel && !userProvidedAriaLabelledby) {\n if (name) {\n root['aria-label'] = name;\n if (badgeSlot) {\n root['aria-labelledby'] = root.id + ' ' + badgeSlot.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 + (badgeSlot ? ' ' + badgeSlot.id : '');\n }\n\n if (active === 'active' || active === 'inactive') {\n const activeText = DEFAULT_STRINGS[active];\n if (root['aria-labelledby']) {\n const activeId = root.id + '__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 root['aria-label'] += ' ' + activeText;\n }\n }\n }\n\n return {\n active,\n activeAriaLabelElement,\n components: { root: 'span', initials: 'span', icon: 'span', image: 'img', badge: 'div' },\n root,\n initials,\n icon,\n image,\n badge: badgeSlot,\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","hasOwnProperty","badge","getBadgeSize","components","image","imageProp","initialsProp","baseId","root","always","role","imageHidden","setImageHidden","useState","undefined","alt","hidden","src","onError","onLoad","badgeSlot","activeAriaLabelElement","userProvidedAriaLabel","userProvidedAriaLabelledby","activeText","activeId","span","str","hashCode","len","ch","charCodeAt","shift"],"mappings":"AAAA;;;;;;;;;;;;IAWaU,eAAAA;;;0BA8DAiB;eAAAA;;IAzDAd,kBAAAA;;;;;iEAdU,QAAQ;gCACa,4BAA4B;uBAC5C,uBAAoB;4BAElB,wBAAwB;4BACxB,wBAAwB;qCACN,kCAAkC;+BACjD,kCAA+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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B,IAAI,MAAMiB;gBACjCJ,yBAAAA,WAAAA,GACE,OAAA,aAAA,CAACK,QAAAA;oBAAKV,QAAAA;oBAAOnB,IAAI4B;mBACdD;YAGP,OAAO,IAAIhB,IAAI,CAAC,aAAa,EAAE;gBAC7BA,IAAI,CAAC,aAAa,IAAI,MAAMgB;YAC9B;QACF;IACF;IAEA,OAAO;QACLtD;QACAmD;QACAlB,YAAY;YAAEK,MAAM;YAAQjB,UAAU;YAAQQ,MAAM;YAAQK,OAAO;YAAOH,OAAO;QAAM;QACvFO;QACAjB;QACAQ;QACAK;QACAH,OAAOmB;IACT;AACF,EAAE;AAEF,MAAMlB,eAAe,CAACxB;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,CAACuC;IACnB,IAAIC,WAAW;IACf,IAAK,IAAIC,MAAcF,IAAIrC,MAAM,GAAG,GAAGuC,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 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["export {\n Avatar,\n avatarClassNames,\n renderAvatar_unstable,\n useAvatarStyles_unstable,\n useAvatar_unstable,\n useAvatarBase_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 AvatarBaseProps,\n AvatarBaseState,\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 useAvatarGroupBase_unstable,\n} from './AvatarGroup';\nexport type {\n AvatarGroupProps,\n AvatarGroupSlots,\n AvatarGroupState,\n AvatarGroupContextValue,\n AvatarGroupContextValues,\n AvatarGroupBaseProps,\n AvatarGroupBaseState,\n} from './AvatarGroup';\nexport {\n AvatarGroupItem,\n avatarGroupItemClassNames,\n renderAvatarGroupItem_unstable,\n useAvatarGroupItemStyles_unstable,\n useAvatarGroupItem_unstable,\n useAvatarGroupItemBase_unstable,\n} from './AvatarGroupItem';\nexport type {\n AvatarGroupItemProps,\n AvatarGroupItemSlots,\n AvatarGroupItemState,\n AvatarGroupItemBaseProps,\n AvatarGroupItemBaseState,\n} from './AvatarGroupItem';\nexport {\n AvatarGroupPopover,\n avatarGroupPopoverClassNames,\n renderAvatarGroupPopover_unstable,\n useAvatarGroupPopover_unstable,\n useAvatarGroupPopoverContextValues_unstable,\n useAvatarGroupPopoverStyles_unstable,\n useAvatarGroupPopoverBase_unstable,\n} from './AvatarGroupPopover';\nexport type {\n AvatarGroupPopoverProps,\n AvatarGroupPopoverSlots,\n AvatarGroupPopoverState,\n AvatarGroupPopoverBaseProps,\n AvatarGroupPopoverBaseState,\n} 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","useAvatarBase_unstable","getInitials","partitionAvatarGroupItems","AvatarGroup","avatarGroupClassNames","renderAvatarGroup_unstable","useAvatarGroupContextValues","useAvatarGroupStyles_unstable","useAvatarGroup_unstable","useAvatarGroupBase_unstable","AvatarGroupItem","avatarGroupItemClassNames","renderAvatarGroupItem_unstable","useAvatarGroupItemStyles_unstable","useAvatarGroupItem_unstable","useAvatarGroupItemBase_unstable","AvatarGroupPopover","avatarGroupPopoverClassNames","renderAvatarGroupPopover_unstable","useAvatarGroupPopover_unstable","useAvatarGroupPopoverContextValues_unstable","useAvatarGroupPopoverStyles_unstable","useAvatarGroupPopoverBase_unstable","AvatarContextProvider","AvatarGroupProvider","useAvatarContext","useAvatarGroupContext_unstable"],"mappings":";;;;;;;;;;;IACEA,MAAM;;;IAuEN4B,qBAAqB;;;;eAjDrBpB,wBAAW;;;eAkBXO,gCAAe;;;eAefM,sCAAkB;;;eAiBlBQ,2BAAmB;;;eAvEnB5B,wBAAgB;;;eAsBhBQ,kCAAqB;;6BAkBI;eAAzBO;;gCAe4B;eAA5BM;;IArCOhB;iCAAW;;;eAAEC,gCAAyB;;;eAuB7CU,+CAA8B;;IAe9BM;oEAAiC;;;eAjCjCb,uCAA0B;;;eAtB1BR,6BAAqB;;;eAGrBG,8BAAsB;;oBAoEN;eAAhByB;;;eA7CAhB,wCAA2B;;;eAH3BH,wCAA2B;;IAiD3BoB;qDAA8B;;;eA7B9BX,gDAA+B;;;eAF/BF,kDAAiC;;;eACjCC,4CAA2B;;;eAiB3BQ,sDAAkC;;IAFlCF;8EAA2C;;IAC3CC,oCAAoC;;;;eAFpCF,kDAA8B;;;eAhC9BZ,0CAA6B;;;eAC7BC,oCAAuB;;;eAxBvBV,gCAAwB;;;eACxBC,0BAAkB;;;wBAEb,cAAW;uBAaqC,mBAAgB;6BAUhE,mBAAgB;iCAiBhB,uBAAoB;oCAgBpB,0BAAuB;wBAavB,sBAAmB"}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["export {\n Avatar,\n avatarClassNames,\n renderAvatar_unstable,\n useAvatarStyles_unstable,\n useAvatar_unstable,\n useAvatarBase_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 AvatarBaseProps,\n AvatarBaseSlots,\n AvatarBaseState,\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 useAvatarGroupBase_unstable,\n} from './AvatarGroup';\nexport type {\n AvatarGroupProps,\n AvatarGroupSlots,\n AvatarGroupState,\n AvatarGroupContextValue,\n AvatarGroupContextValues,\n AvatarGroupBaseProps,\n AvatarGroupBaseState,\n} from './AvatarGroup';\nexport {\n AvatarGroupItem,\n avatarGroupItemClassNames,\n renderAvatarGroupItem_unstable,\n useAvatarGroupItemStyles_unstable,\n useAvatarGroupItem_unstable,\n useAvatarGroupItemBase_unstable,\n} from './AvatarGroupItem';\nexport type {\n AvatarGroupItemProps,\n AvatarGroupItemSlots,\n AvatarGroupItemState,\n AvatarGroupItemBaseProps,\n AvatarGroupItemBaseState,\n} from './AvatarGroupItem';\nexport {\n AvatarGroupPopover,\n avatarGroupPopoverClassNames,\n renderAvatarGroupPopover_unstable,\n useAvatarGroupPopover_unstable,\n useAvatarGroupPopoverContextValues_unstable,\n useAvatarGroupPopoverStyles_unstable,\n useAvatarGroupPopoverBase_unstable,\n} from './AvatarGroupPopover';\nexport type {\n AvatarGroupPopoverProps,\n AvatarGroupPopoverSlots,\n AvatarGroupPopoverState,\n AvatarGroupPopoverBaseProps,\n AvatarGroupPopoverBaseState,\n} 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","useAvatarBase_unstable","getInitials","partitionAvatarGroupItems","AvatarGroup","avatarGroupClassNames","renderAvatarGroup_unstable","useAvatarGroupContextValues","useAvatarGroupStyles_unstable","useAvatarGroup_unstable","useAvatarGroupBase_unstable","AvatarGroupItem","avatarGroupItemClassNames","renderAvatarGroupItem_unstable","useAvatarGroupItemStyles_unstable","useAvatarGroupItem_unstable","useAvatarGroupItemBase_unstable","AvatarGroupPopover","avatarGroupPopoverClassNames","renderAvatarGroupPopover_unstable","useAvatarGroupPopover_unstable","useAvatarGroupPopoverContextValues_unstable","useAvatarGroupPopoverStyles_unstable","useAvatarGroupPopoverBase_unstable","AvatarContextProvider","AvatarGroupProvider","useAvatarContext","useAvatarGroupContext_unstable"],"mappings":";;;;;;;;;;;IACEA,MAAM;;;IAwEN4B,qBAAqB;;;;eAjDrBpB,wBAAW;;;eAkBXO,gCAAe;;;eAefM,sCAAkB;;;eAiBlBQ,2BAAmB;;;eAxEnB5B,wBAAgB;;;eAuBhBQ,kCAAqB;;6BAkBI;eAAzBO;;gCAe4B;eAA5BM;;IArCOhB;iCAAW;;;eAAEC,gCAAyB;;;eAuB7CU,+CAA8B;;IAe9BM;oEAAiC;;;eAjCjCb,uCAA0B;;;eAvB1BR,6BAAqB;;;eAGrBG,8BAAsB;;oBAqEN;eAAhByB;;;eA7CAhB,wCAA2B;;;eAH3BH,wCAA2B;;IAiD3BoB;qDAA8B;;;eA7B9BX,gDAA+B;;;eAF/BF,kDAAiC;;;eACjCC,4CAA2B;;;eAiB3BQ,sDAAkC;;IAFlCF;8EAA2C;;IAC3CC,oCAAoC;;;;eAFpCF,kDAA8B;;;eAhC9BZ,0CAA6B;;;eAC7BC,oCAAuB;;;eAzBvBV,gCAAwB;;;eACxBC,0BAAkB;;;wBAEb,cAAW;uBAcqC,mBAAgB;6BAUhE,mBAAgB;iCAiBhB,uBAAoB;oCAgBpB,0BAAuB;wBAavB,sBAAmB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluentui/react-avatar",
3
- "version": "9.11.5",
3
+ "version": "9.11.7",
4
4
  "description": "React components for building Microsoft web experiences.",
5
5
  "main": "lib-commonjs/index.cjs",
6
6
  "module": "lib/index.js",
@@ -15,24 +15,27 @@
15
15
  "es6-weak-map": "^2.0.2"
16
16
  },
17
17
  "dependencies": {
18
- "@fluentui/react-badge": "^9.5.5",
19
- "@fluentui/react-context-selector": "^9.2.19",
18
+ "@fluentui/react-badge": "^9.5.6",
19
+ "@fluentui/react-context-selector": "^9.2.20",
20
20
  "@fluentui/react-icons": "^2.0.245",
21
- "@fluentui/react-jsx-runtime": "^9.4.5",
22
- "@fluentui/react-popover": "^9.14.6",
23
- "@fluentui/react-shared-contexts": "^9.26.3",
24
- "@fluentui/react-tabster": "^9.26.17",
21
+ "@fluentui/react-jsx-runtime": "^9.4.6",
22
+ "@fluentui/react-popover": "^9.14.8",
23
+ "@fluentui/react-shared-contexts": "^9.26.4",
24
+ "@fluentui/react-tabster": "^9.26.18",
25
25
  "@fluentui/react-theme": "^9.2.2",
26
- "@fluentui/react-tooltip": "^9.10.5",
27
- "@fluentui/react-utilities": "^9.26.6",
26
+ "@fluentui/react-tooltip": "^9.10.6",
27
+ "@fluentui/react-utilities": "^9.26.7",
28
28
  "@griffel/react": "^1.5.32",
29
29
  "@swc/helpers": "^0.5.1"
30
30
  },
31
31
  "peerDependencies": {
32
32
  "@types/react": ">=16.14.0 <20.0.0",
33
- "@types/react-dom": ">=16.9.0 <20.0.0",
34
- "react": ">=16.14.0 <20.0.0",
35
- "react-dom": ">=16.14.0 <20.0.0"
33
+ "react": ">=16.14.0 <20.0.0"
34
+ },
35
+ "peerDependenciesMeta": {
36
+ "@types/react": {
37
+ "optional": true
38
+ }
36
39
  },
37
40
  "beachball": {
38
41
  "disallowedChangeTypes": [