@fluentui/react-avatar 9.10.4 → 9.11.1
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 +34 -2
- package/dist/index.d.ts +56 -6
- package/lib/AvatarGroup.js +1 -1
- package/lib/AvatarGroup.js.map +1 -1
- package/lib/AvatarGroupItem.js +1 -1
- package/lib/AvatarGroupItem.js.map +1 -1
- package/lib/AvatarGroupPopover.js +1 -1
- package/lib/AvatarGroupPopover.js.map +1 -1
- package/lib/components/Avatar/Avatar.types.js.map +1 -1
- package/lib/components/Avatar/renderAvatar.js.map +1 -1
- package/lib/components/Avatar/useAvatar.js +5 -7
- package/lib/components/Avatar/useAvatar.js.map +1 -1
- package/lib/components/AvatarGroup/AvatarGroup.types.js.map +1 -1
- package/lib/components/AvatarGroup/index.js +1 -1
- package/lib/components/AvatarGroup/index.js.map +1 -1
- package/lib/components/AvatarGroup/renderAvatarGroup.js.map +1 -1
- package/lib/components/AvatarGroup/useAvatarGroup.js +17 -10
- package/lib/components/AvatarGroup/useAvatarGroup.js.map +1 -1
- package/lib/components/AvatarGroup/useAvatarGroupContextValues.js +7 -2
- package/lib/components/AvatarGroup/useAvatarGroupContextValues.js.map +1 -1
- package/lib/components/AvatarGroupItem/AvatarGroupItem.types.js +1 -3
- package/lib/components/AvatarGroupItem/AvatarGroupItem.types.js.map +1 -1
- package/lib/components/AvatarGroupItem/index.js +1 -1
- package/lib/components/AvatarGroupItem/index.js.map +1 -1
- package/lib/components/AvatarGroupItem/renderAvatarGroupItem.js.map +1 -1
- package/lib/components/AvatarGroupItem/useAvatarGroupItem.js +33 -8
- package/lib/components/AvatarGroupItem/useAvatarGroupItem.js.map +1 -1
- package/lib/components/AvatarGroupPopover/AvatarGroupPopover.js +0 -1
- package/lib/components/AvatarGroupPopover/AvatarGroupPopover.js.map +1 -1
- package/lib/components/AvatarGroupPopover/AvatarGroupPopover.types.js +1 -1
- package/lib/components/AvatarGroupPopover/AvatarGroupPopover.types.js.map +1 -1
- package/lib/components/AvatarGroupPopover/index.js +1 -1
- package/lib/components/AvatarGroupPopover/index.js.map +1 -1
- package/lib/components/AvatarGroupPopover/renderAvatarGroupPopover.js.map +1 -1
- package/lib/components/AvatarGroupPopover/useAvatarGroupPopover.js +49 -11
- package/lib/components/AvatarGroupPopover/useAvatarGroupPopover.js.map +1 -1
- package/lib/components/AvatarGroupPopover/useAvatarGroupPopoverContextValues.js +6 -4
- package/lib/components/AvatarGroupPopover/useAvatarGroupPopoverContextValues.js.map +1 -1
- package/lib/contexts/AvatarGroupContext.js.map +1 -1
- package/lib/index.js +4 -7
- package/lib/index.js.map +1 -1
- package/lib/utils/getInitials.js +32 -12
- package/lib/utils/getInitials.js.map +1 -1
- package/lib-commonjs/AvatarGroup.js +3 -0
- package/lib-commonjs/AvatarGroup.js.map +1 -1
- package/lib-commonjs/AvatarGroupItem.js +3 -0
- package/lib-commonjs/AvatarGroupItem.js.map +1 -1
- package/lib-commonjs/AvatarGroupPopover.js +3 -0
- package/lib-commonjs/AvatarGroupPopover.js.map +1 -1
- package/lib-commonjs/components/Avatar/Avatar.types.js.map +1 -1
- package/lib-commonjs/components/Avatar/renderAvatar.js.map +1 -1
- package/lib-commonjs/components/Avatar/useAvatar.js +5 -7
- package/lib-commonjs/components/Avatar/useAvatar.js.map +1 -1
- package/lib-commonjs/components/AvatarGroup/AvatarGroup.types.js.map +1 -1
- package/lib-commonjs/components/AvatarGroup/index.js +3 -0
- package/lib-commonjs/components/AvatarGroup/index.js.map +1 -1
- package/lib-commonjs/components/AvatarGroup/renderAvatarGroup.js.map +1 -1
- package/lib-commonjs/components/AvatarGroup/useAvatarGroup.js +15 -11
- package/lib-commonjs/components/AvatarGroup/useAvatarGroup.js.map +1 -1
- package/lib-commonjs/components/AvatarGroup/useAvatarGroupContextValues.js +8 -2
- package/lib-commonjs/components/AvatarGroup/useAvatarGroupContextValues.js.map +1 -1
- package/lib-commonjs/components/AvatarGroupItem/AvatarGroupItem.types.js +1 -3
- package/lib-commonjs/components/AvatarGroupItem/AvatarGroupItem.types.js.map +1 -1
- package/lib-commonjs/components/AvatarGroupItem/index.js +3 -0
- package/lib-commonjs/components/AvatarGroupItem/index.js.map +1 -1
- package/lib-commonjs/components/AvatarGroupItem/renderAvatarGroupItem.js.map +1 -1
- package/lib-commonjs/components/AvatarGroupItem/useAvatarGroupItem.js +35 -12
- package/lib-commonjs/components/AvatarGroupItem/useAvatarGroupItem.js.map +1 -1
- package/lib-commonjs/components/AvatarGroupPopover/AvatarGroupPopover.js +0 -2
- package/lib-commonjs/components/AvatarGroupPopover/AvatarGroupPopover.js.map +1 -1
- package/lib-commonjs/components/AvatarGroupPopover/AvatarGroupPopover.types.js +0 -2
- package/lib-commonjs/components/AvatarGroupPopover/AvatarGroupPopover.types.js.map +1 -1
- package/lib-commonjs/components/AvatarGroupPopover/index.js +3 -0
- package/lib-commonjs/components/AvatarGroupPopover/index.js.map +1 -1
- package/lib-commonjs/components/AvatarGroupPopover/renderAvatarGroupPopover.js.map +1 -1
- package/lib-commonjs/components/AvatarGroupPopover/useAvatarGroupPopover.js +54 -14
- package/lib-commonjs/components/AvatarGroupPopover/useAvatarGroupPopover.js.map +1 -1
- package/lib-commonjs/components/AvatarGroupPopover/useAvatarGroupPopoverContextValues.js +7 -4
- package/lib-commonjs/components/AvatarGroupPopover/useAvatarGroupPopoverContextValues.js.map +1 -1
- package/lib-commonjs/contexts/AvatarGroupContext.js.map +1 -1
- package/lib-commonjs/index.js +12 -3
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/utils/getInitials.js +32 -12
- package/lib-commonjs/utils/getInitials.js.map +1 -1
- package/package.json +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,44 @@
|
|
|
1
1
|
# Change Log - @fluentui/react-avatar
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Thu, 23 Apr 2026 11:59:39 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## [9.11.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-avatar_v9.11.1)
|
|
8
|
+
|
|
9
|
+
Thu, 23 Apr 2026 11:59:39 GMT
|
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-avatar_v9.11.0..@fluentui/react-avatar_v9.11.1)
|
|
11
|
+
|
|
12
|
+
### Patches
|
|
13
|
+
|
|
14
|
+
- fix: drop unnecessary dependencies from base hooks ([PR #35972](https://github.com/microsoft/fluentui/pull/35972) by dmytrokirpa@microsoft.com)
|
|
15
|
+
- perf: memoize context values in use*ContextValues hooks ([PR #36008](https://github.com/microsoft/fluentui/pull/36008) by olfedias@microsoft.com)
|
|
16
|
+
- fix: prevent spreading of custom props on html element ([PR #36017](https://github.com/microsoft/fluentui/pull/36017) by dmytrokirpa@microsoft.com)
|
|
17
|
+
- Bump @fluentui/react-badge to v9.5.2 ([PR #35996](https://github.com/microsoft/fluentui/pull/35996) by beachball)
|
|
18
|
+
- Bump @fluentui/react-context-selector to v9.2.16 ([PR #35996](https://github.com/microsoft/fluentui/pull/35996) by beachball)
|
|
19
|
+
- Bump @fluentui/react-popover to v9.14.2 ([PR #35996](https://github.com/microsoft/fluentui/pull/35996) by beachball)
|
|
20
|
+
- Bump @fluentui/react-tabster to v9.26.14 ([PR #35996](https://github.com/microsoft/fluentui/pull/35996) by beachball)
|
|
21
|
+
- Bump @fluentui/react-tooltip to v9.10.1 ([PR #35996](https://github.com/microsoft/fluentui/pull/35996) by beachball)
|
|
22
|
+
- Bump @fluentui/react-utilities to v9.26.3 ([PR #35996](https://github.com/microsoft/fluentui/pull/35996) by beachball)
|
|
23
|
+
- Bump @fluentui/react-jsx-runtime to v9.4.2 ([PR #35996](https://github.com/microsoft/fluentui/pull/35996) by beachball)
|
|
24
|
+
|
|
25
|
+
## [9.11.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-avatar_v9.11.0)
|
|
26
|
+
|
|
27
|
+
Wed, 01 Apr 2026 15:52:39 GMT
|
|
28
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-avatar_v9.10.4..@fluentui/react-avatar_v9.11.0)
|
|
29
|
+
|
|
30
|
+
### Minor changes
|
|
31
|
+
|
|
32
|
+
- feat: expose base hooks for Avatar ([PR #35899](https://github.com/microsoft/fluentui/pull/35899) by dmytrokirpa@microsoft.com)
|
|
33
|
+
- Bump @fluentui/react-tooltip to v9.10.0 ([PR #35912](https://github.com/microsoft/fluentui/pull/35912) by beachball)
|
|
34
|
+
|
|
35
|
+
### Patches
|
|
36
|
+
|
|
37
|
+
- fix: support initials calculation for GB18030-2022 extension characters ([PR #35878](https://github.com/microsoft/fluentui/pull/35878) by dmytrokirpa@microsoft.com)
|
|
38
|
+
|
|
7
39
|
## [9.10.4](https://github.com/microsoft/fluentui/tree/@fluentui/react-avatar_v9.10.4)
|
|
8
40
|
|
|
9
|
-
Mon, 30 Mar 2026 14:
|
|
41
|
+
Mon, 30 Mar 2026 14:37:41 GMT
|
|
10
42
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-avatar_v9.10.3..@fluentui/react-avatar_v9.10.4)
|
|
11
43
|
|
|
12
44
|
### Patches
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { ComponentProps } from '@fluentui/react-utilities';
|
|
2
2
|
import type { ComponentState } from '@fluentui/react-utilities';
|
|
3
|
-
import { ContextSelector } from '@fluentui/react-context-selector';
|
|
3
|
+
import type { ContextSelector } from '@fluentui/react-context-selector';
|
|
4
4
|
import { FC } from 'react';
|
|
5
5
|
import type { ForwardRefComponent } from '@fluentui/react-utilities';
|
|
6
6
|
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
|
-
import { PresenceBadge } from '@fluentui/react-badge';
|
|
9
|
+
import type { PresenceBadge } from '@fluentui/react-badge';
|
|
10
10
|
import { Provider } from 'react';
|
|
11
11
|
import { ProviderProps } from 'react';
|
|
12
12
|
import * as React_2 from 'react';
|
|
@@ -16,6 +16,10 @@ import type { TooltipProps } from '@fluentui/react-tooltip';
|
|
|
16
16
|
|
|
17
17
|
export declare const Avatar: ForwardRefComponent<AvatarProps>;
|
|
18
18
|
|
|
19
|
+
export declare type AvatarBaseProps = ComponentProps<Omit<AvatarSlots, 'badge'>> & Pick<AvatarProps, 'name'>;
|
|
20
|
+
|
|
21
|
+
export declare type AvatarBaseState = ComponentState<Omit<AvatarSlots, 'badge'>> & Pick<AvatarState, 'activeAriaLabelElement'>;
|
|
22
|
+
|
|
19
23
|
export declare const avatarClassNames: SlotClassNames<AvatarSlots>;
|
|
20
24
|
|
|
21
25
|
/**
|
|
@@ -37,6 +41,10 @@ export declare interface AvatarContextValue {
|
|
|
37
41
|
*/
|
|
38
42
|
export declare const AvatarGroup: ForwardRefComponent<AvatarGroupProps>;
|
|
39
43
|
|
|
44
|
+
export declare type AvatarGroupBaseProps = Omit<AvatarGroupProps, 'size'>;
|
|
45
|
+
|
|
46
|
+
export declare type AvatarGroupBaseState = Omit<AvatarGroupState, 'size'>;
|
|
47
|
+
|
|
40
48
|
export declare const avatarGroupClassNames: SlotClassNames<AvatarGroupSlots>;
|
|
41
49
|
|
|
42
50
|
export declare type AvatarGroupContextValue = Pick<AvatarGroupProps, 'size' | 'layout'> & {
|
|
@@ -53,6 +61,10 @@ export declare type AvatarGroupContextValues = {
|
|
|
53
61
|
*/
|
|
54
62
|
export declare const AvatarGroupItem: ForwardRefComponent<AvatarGroupItemProps>;
|
|
55
63
|
|
|
64
|
+
export declare type AvatarGroupItemBaseProps = AvatarGroupItemProps;
|
|
65
|
+
|
|
66
|
+
export declare type AvatarGroupItemBaseState = Omit<AvatarGroupItemState, 'size'>;
|
|
67
|
+
|
|
56
68
|
export declare const avatarGroupItemClassNames: SlotClassNames<AvatarGroupItemSlots>;
|
|
57
69
|
|
|
58
70
|
/**
|
|
@@ -92,6 +104,10 @@ export declare type AvatarGroupItemState = ComponentState<AvatarGroupItemSlots>
|
|
|
92
104
|
*/
|
|
93
105
|
export declare const AvatarGroupPopover: React_2.FC<AvatarGroupPopoverProps>;
|
|
94
106
|
|
|
107
|
+
export declare type AvatarGroupPopoverBaseProps = AvatarGroupPopoverProps;
|
|
108
|
+
|
|
109
|
+
export declare type AvatarGroupPopoverBaseState = Omit<AvatarGroupPopoverState, 'size'>;
|
|
110
|
+
|
|
95
111
|
export declare const avatarGroupPopoverClassNames: SlotClassNames<AvatarGroupPopoverSlots>;
|
|
96
112
|
|
|
97
113
|
/**
|
|
@@ -341,25 +357,30 @@ export declare type PartitionAvatarGroupItemsOptions<T> = {
|
|
|
341
357
|
maxInlineItems?: number;
|
|
342
358
|
};
|
|
343
359
|
|
|
344
|
-
export declare const renderAvatar_unstable: (state:
|
|
360
|
+
export declare const renderAvatar_unstable: (state: AvatarBaseState) => JSXElement;
|
|
345
361
|
|
|
346
362
|
/**
|
|
347
363
|
* Render the final JSX of AvatarGroup
|
|
348
364
|
*/
|
|
349
|
-
export declare const renderAvatarGroup_unstable: (state:
|
|
365
|
+
export declare const renderAvatarGroup_unstable: (state: AvatarGroupBaseState, contextValues: AvatarGroupContextValues) => JSXElement;
|
|
350
366
|
|
|
351
367
|
/**
|
|
352
368
|
* Render the final JSX of AvatarGroupItem
|
|
353
369
|
*/
|
|
354
|
-
export declare const renderAvatarGroupItem_unstable: (state:
|
|
370
|
+
export declare const renderAvatarGroupItem_unstable: (state: AvatarGroupItemBaseState) => JSXElement;
|
|
355
371
|
|
|
356
372
|
/**
|
|
357
373
|
* Render the final JSX of AvatarGroupPopover
|
|
358
374
|
*/
|
|
359
|
-
export declare const renderAvatarGroupPopover_unstable: (state:
|
|
375
|
+
export declare const renderAvatarGroupPopover_unstable: (state: AvatarGroupPopoverBaseState, contextValues: AvatarGroupContextValues) => JSXElement;
|
|
360
376
|
|
|
361
377
|
export declare const useAvatar_unstable: (props: AvatarProps, ref: React_2.Ref<HTMLElement>) => AvatarState;
|
|
362
378
|
|
|
379
|
+
/**
|
|
380
|
+
* Base hook for Avatar component, manages state and structure common to all variants of Avatar
|
|
381
|
+
*/
|
|
382
|
+
export declare const useAvatarBase_unstable: (props: AvatarBaseProps, ref?: React_2.Ref<HTMLElement>) => AvatarBaseState;
|
|
383
|
+
|
|
363
384
|
/**
|
|
364
385
|
* @internal
|
|
365
386
|
*/
|
|
@@ -376,6 +397,14 @@ export declare const useAvatarContext: () => AvatarContextValue;
|
|
|
376
397
|
*/
|
|
377
398
|
export declare const useAvatarGroup_unstable: (props: AvatarGroupProps, ref: React_2.Ref<HTMLElement>) => AvatarGroupState;
|
|
378
399
|
|
|
400
|
+
/**
|
|
401
|
+
* Create the base state to render AvatarGroup, without design-specific props.
|
|
402
|
+
*
|
|
403
|
+
* @param props - props from this instance of AvatarGroup
|
|
404
|
+
* @param ref - reference to root HTMLDivElement of AvatarGroup
|
|
405
|
+
*/
|
|
406
|
+
export declare const useAvatarGroupBase_unstable: (props: AvatarGroupBaseProps, ref: React_2.Ref<HTMLDivElement>) => AvatarGroupBaseState;
|
|
407
|
+
|
|
379
408
|
export declare const useAvatarGroupContext_unstable: <T>(selector: ContextSelector<AvatarGroupContextValue, T>) => T;
|
|
380
409
|
|
|
381
410
|
export declare const useAvatarGroupContextValues: (state: AvatarGroupState) => AvatarGroupContextValues;
|
|
@@ -391,6 +420,18 @@ export declare const useAvatarGroupContextValues: (state: AvatarGroupState) => A
|
|
|
391
420
|
*/
|
|
392
421
|
export declare const useAvatarGroupItem_unstable: (props: AvatarGroupItemProps, ref: React_2.Ref<HTMLElement>) => AvatarGroupItemState;
|
|
393
422
|
|
|
423
|
+
/**
|
|
424
|
+
* Create the base state required to render AvatarGroupItem, without default slot props or component types.
|
|
425
|
+
*
|
|
426
|
+
* The returned state can be modified with hooks such as useAvatarGroupItemStyles_unstable,
|
|
427
|
+
* before being passed to renderAvatarGroupItem_unstable.
|
|
428
|
+
*
|
|
429
|
+
* @param props - props from this instance of AvatarGroupItem
|
|
430
|
+
* @param ref - reference to root HTMLElement of AvatarGroupItem
|
|
431
|
+
* @returns AvatarGroupItem state without default slot props or component types
|
|
432
|
+
*/
|
|
433
|
+
export declare const useAvatarGroupItemBase_unstable: (props: AvatarGroupItemBaseProps, ref: React_2.Ref<HTMLElement>) => AvatarGroupItemBaseState;
|
|
434
|
+
|
|
394
435
|
/**
|
|
395
436
|
* Apply styling to the AvatarGroupItem slots based on the state
|
|
396
437
|
*/
|
|
@@ -406,6 +447,15 @@ export declare const useAvatarGroupItemStyles_unstable: (state: AvatarGroupItemS
|
|
|
406
447
|
*/
|
|
407
448
|
export declare const useAvatarGroupPopover_unstable: (props: AvatarGroupPopoverProps) => AvatarGroupPopoverState;
|
|
408
449
|
|
|
450
|
+
/**
|
|
451
|
+
* Handles popover open/closed state, indicator display, and slot configuration.
|
|
452
|
+
* Use directly for custom implementations or use useAvatarGroupPopover_unstable for defaults.
|
|
453
|
+
*
|
|
454
|
+
* @param props - AvatarGroupPopover props
|
|
455
|
+
* @returns AvatarGroupPopover state
|
|
456
|
+
*/
|
|
457
|
+
export declare const useAvatarGroupPopoverBase_unstable: (props: AvatarGroupPopoverBaseProps) => AvatarGroupPopoverBaseState;
|
|
458
|
+
|
|
409
459
|
export declare const useAvatarGroupPopoverContextValues_unstable: (state: AvatarGroupPopoverState) => AvatarGroupContextValues;
|
|
410
460
|
|
|
411
461
|
/**
|
package/lib/AvatarGroup.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { AvatarGroup, avatarGroupClassNames, defaultAvatarGroupSize, renderAvatarGroup_unstable, useAvatarGroupContextValues, useAvatarGroupStyles_unstable, useAvatarGroup_unstable } from './components/AvatarGroup/index';
|
|
1
|
+
export { AvatarGroup, avatarGroupClassNames, defaultAvatarGroupSize, renderAvatarGroup_unstable, useAvatarGroupContextValues, useAvatarGroupStyles_unstable, useAvatarGroup_unstable, useAvatarGroupBase_unstable } from './components/AvatarGroup/index';
|
package/lib/AvatarGroup.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/AvatarGroup.ts"],"sourcesContent":["export type {\n AvatarGroupContextValue,\n AvatarGroupContextValues,\n AvatarGroupProps,\n AvatarGroupSlots,\n AvatarGroupState,\n} from './components/AvatarGroup/index';\nexport {\n AvatarGroup,\n avatarGroupClassNames,\n defaultAvatarGroupSize,\n renderAvatarGroup_unstable,\n useAvatarGroupContextValues,\n useAvatarGroupStyles_unstable,\n useAvatarGroup_unstable,\n} from './components/AvatarGroup/index';\n"],"names":["AvatarGroup","avatarGroupClassNames","defaultAvatarGroupSize","renderAvatarGroup_unstable","useAvatarGroupContextValues","useAvatarGroupStyles_unstable","useAvatarGroup_unstable"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/AvatarGroup.ts"],"sourcesContent":["export type {\n AvatarGroupContextValue,\n AvatarGroupContextValues,\n AvatarGroupProps,\n AvatarGroupSlots,\n AvatarGroupState,\n AvatarGroupBaseProps,\n AvatarGroupBaseState,\n} from './components/AvatarGroup/index';\nexport {\n AvatarGroup,\n avatarGroupClassNames,\n defaultAvatarGroupSize,\n renderAvatarGroup_unstable,\n useAvatarGroupContextValues,\n useAvatarGroupStyles_unstable,\n useAvatarGroup_unstable,\n useAvatarGroupBase_unstable,\n} from './components/AvatarGroup/index';\n"],"names":["AvatarGroup","avatarGroupClassNames","defaultAvatarGroupSize","renderAvatarGroup_unstable","useAvatarGroupContextValues","useAvatarGroupStyles_unstable","useAvatarGroup_unstable","useAvatarGroupBase_unstable"],"mappings":"AASA,SACEA,WAAW,EACXC,qBAAqB,EACrBC,sBAAsB,EACtBC,0BAA0B,EAC1BC,2BAA2B,EAC3BC,6BAA6B,EAC7BC,uBAAuB,EACvBC,2BAA2B,QACtB,iCAAiC"}
|
package/lib/AvatarGroupItem.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { AvatarGroupItem, avatarGroupItemClassNames, renderAvatarGroupItem_unstable, useAvatarGroupItemStyles_unstable, useAvatarGroupItem_unstable, useGroupChildClassName } from './components/AvatarGroupItem/index';
|
|
1
|
+
export { AvatarGroupItem, avatarGroupItemClassNames, renderAvatarGroupItem_unstable, useAvatarGroupItemStyles_unstable, useAvatarGroupItem_unstable, useGroupChildClassName, useAvatarGroupItemBase_unstable } from './components/AvatarGroupItem/index';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/AvatarGroupItem.ts"],"sourcesContent":["export type {\n AvatarGroupItemProps,\n AvatarGroupItemSlots,\n AvatarGroupItemState,\n} from './components/AvatarGroupItem/index';\nexport {\n AvatarGroupItem,\n avatarGroupItemClassNames,\n renderAvatarGroupItem_unstable,\n useAvatarGroupItemStyles_unstable,\n useAvatarGroupItem_unstable,\n useGroupChildClassName,\n} from './components/AvatarGroupItem/index';\n"],"names":["AvatarGroupItem","avatarGroupItemClassNames","renderAvatarGroupItem_unstable","useAvatarGroupItemStyles_unstable","useAvatarGroupItem_unstable","useGroupChildClassName"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/AvatarGroupItem.ts"],"sourcesContent":["export type {\n AvatarGroupItemProps,\n AvatarGroupItemSlots,\n AvatarGroupItemState,\n AvatarGroupItemBaseProps,\n AvatarGroupItemBaseState,\n} from './components/AvatarGroupItem/index';\nexport {\n AvatarGroupItem,\n avatarGroupItemClassNames,\n renderAvatarGroupItem_unstable,\n useAvatarGroupItemStyles_unstable,\n useAvatarGroupItem_unstable,\n useGroupChildClassName,\n useAvatarGroupItemBase_unstable,\n} from './components/AvatarGroupItem/index';\n"],"names":["AvatarGroupItem","avatarGroupItemClassNames","renderAvatarGroupItem_unstable","useAvatarGroupItemStyles_unstable","useAvatarGroupItem_unstable","useGroupChildClassName","useAvatarGroupItemBase_unstable"],"mappings":"AAOA,SACEA,eAAe,EACfC,yBAAyB,EACzBC,8BAA8B,EAC9BC,iCAAiC,EACjCC,2BAA2B,EAC3BC,sBAAsB,EACtBC,+BAA+B,QAC1B,qCAAqC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { AvatarGroupPopover, avatarGroupPopoverClassNames, renderAvatarGroupPopover_unstable, useAvatarGroupPopoverContextValues_unstable, useAvatarGroupPopoverStyles_unstable, useAvatarGroupPopover_unstable } from './components/AvatarGroupPopover/index';
|
|
1
|
+
export { AvatarGroupPopover, avatarGroupPopoverClassNames, renderAvatarGroupPopover_unstable, useAvatarGroupPopoverContextValues_unstable, useAvatarGroupPopoverStyles_unstable, useAvatarGroupPopover_unstable, useAvatarGroupPopoverBase_unstable } from './components/AvatarGroupPopover/index';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/AvatarGroupPopover.ts"],"sourcesContent":["export type {\n AvatarGroupPopoverProps,\n AvatarGroupPopoverSlots,\n AvatarGroupPopoverState,\n} from './components/AvatarGroupPopover/index';\nexport {\n AvatarGroupPopover,\n avatarGroupPopoverClassNames,\n renderAvatarGroupPopover_unstable,\n useAvatarGroupPopoverContextValues_unstable,\n useAvatarGroupPopoverStyles_unstable,\n useAvatarGroupPopover_unstable,\n} from './components/AvatarGroupPopover/index';\n"],"names":["AvatarGroupPopover","avatarGroupPopoverClassNames","renderAvatarGroupPopover_unstable","useAvatarGroupPopoverContextValues_unstable","useAvatarGroupPopoverStyles_unstable","useAvatarGroupPopover_unstable"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/AvatarGroupPopover.ts"],"sourcesContent":["export type {\n AvatarGroupPopoverProps,\n AvatarGroupPopoverSlots,\n AvatarGroupPopoverState,\n AvatarGroupPopoverBaseProps,\n AvatarGroupPopoverBaseState,\n} from './components/AvatarGroupPopover/index';\nexport {\n AvatarGroupPopover,\n avatarGroupPopoverClassNames,\n renderAvatarGroupPopover_unstable,\n useAvatarGroupPopoverContextValues_unstable,\n useAvatarGroupPopoverStyles_unstable,\n useAvatarGroupPopover_unstable,\n useAvatarGroupPopoverBase_unstable,\n} from './components/AvatarGroupPopover/index';\n"],"names":["AvatarGroupPopover","avatarGroupPopoverClassNames","renderAvatarGroupPopover_unstable","useAvatarGroupPopoverContextValues_unstable","useAvatarGroupPopoverStyles_unstable","useAvatarGroupPopover_unstable","useAvatarGroupPopoverBase_unstable"],"mappings":"AAOA,SACEA,kBAAkB,EAClBC,4BAA4B,EAC5BC,iCAAiC,EACjCC,2CAA2C,EAC3CC,oCAAoC,EACpCC,8BAA8B,EAC9BC,kCAAkC,QAC7B,wCAAwC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/Avatar/Avatar.types.ts"],"sourcesContent":["import { PresenceBadge } from '@fluentui/react-badge';\nimport type { ComponentProps, ComponentState, JSXElement, Slot } from '@fluentui/react-utilities';\n\n/**\n * Sizes for the avatar\n * @deprecated use AvatarSize instead\n */\nexport type AvatarSizes = AvatarSize;\n/**\n * Sizes for the avatar\n */\nexport type AvatarSize = 16 | 20 | 24 | 28 | 32 | 36 | 40 | 48 | 56 | 64 | 72 | 96 | 120 | 128;\n\n/**\n * Shape of the avatar\n */\nexport type AvatarShape = 'circular' | 'square';\n\nexport type AvatarSlots = {\n root: Slot<'span'>;\n\n /**\n * The Avatar's image.\n *\n * Usage e.g.: `image={{ src: '...' }}`\n */\n image?: Slot<'img'>;\n\n /**\n * (optional) Custom initials.\n *\n * It is usually not necessary to specify custom initials; by default they will be derived from the `name` prop,\n * using the `getInitials` function.\n *\n * The initials are displayed when there is no image (including while the image is loading).\n */\n initials?: Slot<'span'>;\n\n /**\n * Icon to be displayed when the avatar doesn't have an image or initials.\n *\n * @default `PersonRegular` (the default icon's size depends on the Avatar's size)\n */\n icon?: Slot<'span'>;\n\n /**\n * Badge to show the avatar's presence status.\n */\n badge?: Slot<typeof PresenceBadge>;\n};\n\n/**\n * A specific named color for the Avatar\n */\nexport type AvatarNamedColor =\n | 'dark-red'\n | 'cranberry'\n | 'red'\n | 'pumpkin'\n | 'peach'\n | 'marigold'\n | 'gold'\n | 'brass'\n | 'brown'\n | 'forest'\n | 'seafoam'\n | 'dark-green'\n | 'light-teal'\n | 'teal'\n | 'steel'\n | 'blue'\n | 'royal-blue'\n | 'cornflower'\n | 'navy'\n | 'lavender'\n | 'purple'\n | 'grape'\n | 'lilac'\n | 'pink'\n | 'magenta'\n | 'plum'\n | 'beige'\n | 'mink'\n | 'platinum'\n | 'anchor';\n\n/**\n * Properties for Avatar\n */\nexport type AvatarProps = Omit<ComponentProps<AvatarSlots>, 'color'> & {\n /**\n * Optional activity indicator\n * * active: the avatar will be decorated according to activeAppearance\n * * inactive: the avatar will be reduced in size and partially transparent\n * * unset: normal display\n *\n * @default unset\n */\n active?: 'active' | 'inactive' | 'unset';\n\n /**\n * The appearance when `active=\"active\"`\n *\n * @default ring\n */\n activeAppearance?: 'ring' | 'shadow' | 'ring-shadow';\n\n /**\n * The color when displaying either an icon or initials.\n * * neutral (default): gray\n * * brand: color from the brand palette\n * * colorful: picks a color from a set of pre-defined colors, based on a hash of the name (or idForColor if provided)\n * * [AvatarNamedColor]: a specific color from the theme\n *\n * @default neutral\n */\n color?: 'neutral' | 'brand' | 'colorful' | AvatarNamedColor;\n\n /**\n * Specify a string to be used instead of the name, to determine which color to use when color=\"colorful\".\n * Use this when a name is not available, but there is another unique identifier that can be used instead.\n */\n idForColor?: string | undefined;\n\n /**\n * The name of the person or entity represented by this Avatar. This should always be provided if it is available.\n *\n * The name is used to determine the initials displayed when there is no image. It is also provided to\n * accessibility tools.\n */\n name?: string;\n\n /**\n * The avatar can have a circular or square shape.\n * @default circular\n */\n shape?: AvatarShape;\n\n /**\n * Size of the avatar in pixels.\n *\n * Size is restricted to a limited set of supported values recommended for most uses (see `AvatarSizeValue`) and\n * based on design guidelines for the Avatar control.\n *\n * Note: At size 16, if initials are displayed, only the first initial will be rendered.\n *\n * If a non-supported size is needed, set `size` to the next-smaller supported size, and set `width` and `height`\n * to override the rendered size.\n *\n * For example, to set the avatar to 45px in size:\n * `<Avatar size={40} style={{ width: '45px', height: '45px' }} />`\n *\n * @default 32\n */\n size?: AvatarSize;\n};\n\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 } 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 +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,
|
|
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"}
|
|
@@ -31,10 +31,8 @@ export const useAvatar_unstable = (props, ref)=>{
|
|
|
31
31
|
elementType: 'span'
|
|
32
32
|
});
|
|
33
33
|
}
|
|
34
|
-
if (state.icon) {
|
|
35
|
-
|
|
36
|
-
var _children;
|
|
37
|
-
(_children = (_state_icon = state.icon).children) !== null && _children !== void 0 ? _children : _state_icon.children = /*#__PURE__*/ React.createElement(PersonRegular, null);
|
|
34
|
+
if (state.icon && !state.icon.hasOwnProperty('children')) {
|
|
35
|
+
state.icon.children = /*#__PURE__*/ React.createElement(PersonRegular, null);
|
|
38
36
|
}
|
|
39
37
|
const badge = slot.optional(props.badge, {
|
|
40
38
|
defaultProps: {
|
|
@@ -95,7 +93,7 @@ export const useAvatar_unstable = (props, ref)=>{
|
|
|
95
93
|
* Base hook for Avatar component, manages state and structure common to all variants of Avatar
|
|
96
94
|
*/ export const useAvatarBase_unstable = (props, ref)=>{
|
|
97
95
|
const { dir } = useFluent();
|
|
98
|
-
const { name, ...rest } = props;
|
|
96
|
+
const { name, image: imageProp, initials: initialsProp, ...rest } = props;
|
|
99
97
|
const baseId = useId('avatar-');
|
|
100
98
|
const root = slot.always({
|
|
101
99
|
role: 'img',
|
|
@@ -106,7 +104,7 @@ export const useAvatar_unstable = (props, ref)=>{
|
|
|
106
104
|
elementType: 'span'
|
|
107
105
|
});
|
|
108
106
|
const [imageHidden, setImageHidden] = React.useState(undefined);
|
|
109
|
-
let image = slot.optional(
|
|
107
|
+
let image = slot.optional(imageProp, {
|
|
110
108
|
defaultProps: {
|
|
111
109
|
alt: '',
|
|
112
110
|
role: 'presentation',
|
|
@@ -125,7 +123,7 @@ export const useAvatar_unstable = (props, ref)=>{
|
|
|
125
123
|
image.onLoad = mergeCallbacks(image.onLoad, ()=>setImageHidden(undefined));
|
|
126
124
|
}
|
|
127
125
|
// Resolve the initials slot, defaulted to getInitials
|
|
128
|
-
let initials = slot.optional(
|
|
126
|
+
let initials = slot.optional(initialsProp, {
|
|
129
127
|
renderByDefault: true,
|
|
130
128
|
defaultProps: {
|
|
131
129
|
children: getInitials(name, dir === 'rtl'),
|
|
@@ -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 state.initials = slot.optional(props.initials, {\n renderByDefault: true,\n defaultProps: {\n children: getInitials(props.name, dir === 'rtl', { firstInitialOnly: size <= 16 }),\n id: state.initials?.id,\n },\n elementType: 'span',\n });\n }\n\n if (state.icon) {\n state.icon.children ??= <PersonRegular />;\n }\n\n const badge: AvatarState['badge'] = slot.optional(props.badge, {\n defaultProps: { size: getBadgeSize(size), id: state.root.id + '__badge' },\n elementType: PresenceBadge,\n });\n\n let activeAriaLabelElement: AvatarState['activeAriaLabelElement'] = state.activeAriaLabelElement;\n\n // Enhance aria-label and/or aria-labelledby to include badge and active state\n // Only process if aria attributes were not explicitly provided by the user\n const userProvidedAriaLabel = props['aria-label'] !== undefined;\n const userProvidedAriaLabelledby = props['aria-labelledby'] !== undefined;\n\n if (!userProvidedAriaLabel && !userProvidedAriaLabelledby) {\n if (props.name) {\n if (badge) {\n state.root['aria-labelledby'] = state.root.id + ' ' + badge.id;\n }\n } else if (state.initials) {\n // root's aria-label should be the name, but fall back to being labelledby the initials if name is missing\n state.root['aria-labelledby'] = state.initials.id + (badge ? ' ' + badge.id : '');\n delete state.root['aria-label'];\n }\n // Add the active state to the aria label\n if (active === 'active' || active === 'inactive') {\n const activeText = DEFAULT_STRINGS[active];\n if (state.root['aria-labelledby']) {\n // If using aria-labelledby, render a hidden span and append it to the labelledby\n const activeId = state.root.id + '__active';\n state.root['aria-labelledby'] += ' ' + activeId;\n activeAriaLabelElement = (\n <span hidden id={activeId}>\n {activeText}\n </span>\n );\n } else if (state.root['aria-label']) {\n // Otherwise, just append it to the aria-label\n state.root['aria-label'] += ' ' + activeText;\n }\n }\n }\n\n return {\n ...state,\n size,\n shape,\n active,\n activeAppearance,\n activeAriaLabelElement,\n color,\n badge,\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n components: { ...state.components, badge: PresenceBadge },\n };\n};\n\n/**\n * Base hook for Avatar component, manages state and structure common to all variants of Avatar\n */\nexport const useAvatarBase_unstable = (props: AvatarBaseProps, ref?: React.Ref<HTMLElement>): AvatarBaseState => {\n const { dir } = useFluent();\n const { name, ...rest } = props;\n\n const baseId = useId('avatar-');\n\n const root: AvatarBaseState['root'] = slot.always(\n {\n role: 'img',\n id: baseId,\n ref,\n ...rest,\n },\n { elementType: 'span' },\n );\n\n const [imageHidden, setImageHidden] = React.useState<true | undefined>(undefined);\n\n let image: AvatarBaseState['image'] = slot.optional(props.image, {\n defaultProps: { alt: '', role: 'presentation', 'aria-hidden': true, hidden: imageHidden },\n elementType: 'img',\n });\n\n // Image shouldn't be rendered if its src is not set\n if (!image?.src) {\n image = undefined;\n }\n\n // Hide the image if it fails to load and restore it on a successful load\n if (image) {\n image.onError = mergeCallbacks(image.onError, () => setImageHidden(true));\n image.onLoad = mergeCallbacks(image.onLoad, () => setImageHidden(undefined));\n }\n\n // Resolve the initials slot, defaulted to getInitials\n let initials: AvatarBaseState['initials'] = slot.optional(props.initials, {\n renderByDefault: true,\n defaultProps: {\n children: getInitials(name, dir === 'rtl'),\n id: baseId + '__initials',\n },\n elementType: 'span',\n });\n\n // Don't render the initials slot if it's empty\n if (!initials?.children) {\n initials = undefined;\n }\n\n // Render the icon slot *only if* there aren't any initials or image to display\n let icon: AvatarBaseState['icon'] = undefined;\n if (!initials && (!image || imageHidden)) {\n icon = slot.optional(props.icon, {\n renderByDefault: true,\n defaultProps: {\n 'aria-hidden': true,\n },\n elementType: 'span',\n });\n }\n\n let activeAriaLabelElement: AvatarBaseState['activeAriaLabelElement'];\n\n // Resolve aria-label and/or aria-labelledby if not provided by the user\n if (!root['aria-label'] && !root['aria-labelledby']) {\n if (name) {\n root['aria-label'] = name;\n } else if (initials) {\n // root's aria-label should be the name, but fall back to being labelledby the initials if name is missing\n root['aria-labelledby'] = initials.id;\n }\n }\n\n return {\n activeAriaLabelElement,\n components: { root: 'span', initials: 'span', icon: 'span', image: 'img' },\n root,\n initials,\n icon,\n image,\n };\n};\n\nconst getBadgeSize = (size: AvatarState['size']) => {\n if (size >= 96) {\n return 'extra-large';\n } else if (size >= 64) {\n return 'large';\n } else if (size >= 56) {\n return 'medium';\n } else if (size >= 40) {\n return 'small';\n } else if (size >= 28) {\n return 'extra-small';\n } else {\n return 'tiny';\n }\n};\n\nconst avatarColors: AvatarNamedColor[] = [\n 'dark-red',\n 'cranberry',\n 'red',\n 'pumpkin',\n 'peach',\n 'marigold',\n 'gold',\n 'brass',\n 'brown',\n 'forest',\n 'seafoam',\n 'dark-green',\n 'light-teal',\n 'teal',\n 'steel',\n 'blue',\n 'royal-blue',\n 'cornflower',\n 'navy',\n 'lavender',\n 'purple',\n 'grape',\n 'lilac',\n 'pink',\n 'magenta',\n 'plum',\n 'beige',\n 'mink',\n 'platinum',\n 'anchor',\n];\n\nconst getHashCode = (str: string): number => {\n let hashCode = 0;\n for (let len: number = str.length - 1; len >= 0; len--) {\n const ch = str.charCodeAt(len);\n const shift = len % 8;\n hashCode ^= (ch << shift) + (ch >> (8 - shift)); // eslint-disable-line no-bitwise\n }\n\n return hashCode;\n};\n"],"names":["React","mergeCallbacks","useId","slot","getInitials","PersonRegular","PresenceBadge","useFluent_unstable","useFluent","useAvatarContext","DEFAULT_STRINGS","active","inactive","useAvatar_unstable","props","ref","dir","shape","contextShape","size","contextSize","activeAppearance","idForColor","color","propColor","rest","state","useAvatarBase_unstable","avatarColors","getHashCode","name","length","initials","optional","renderByDefault","defaultProps","children","firstInitialOnly","id","elementType","icon","badge","getBadgeSize","root","activeAriaLabelElement","userProvidedAriaLabel","undefined","userProvidedAriaLabelledby","activeText","activeId","span","hidden","components","baseId","always","role","imageHidden","setImageHidden","useState","image","alt","src","onError","onL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IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;CACD;AAED,MAAMC,cAAc,CAACmC;IACnB,IAAIC,WAAW;IACf,IAAK,IAAIC,MAAcF,IAAIjC,MAAM,GAAG,GAAGmC,OAAO,GAAGA,MAAO;QACtD,MAAMC,KAAKH,IAAII,UAAU,CAACF;QAC1B,MAAMG,QAAQH,MAAM;QACpBD,YAAY,AAACE,CAAAA,MAAME,KAAI,IAAMF,CAAAA,MAAO,IAAIE,KAAK,GAAI,iCAAiC;IACpF;IAEA,OAAOJ;AACT"}
|
|
1
|
+
{"version":3,"sources":["../src/components/Avatar/useAvatar.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { mergeCallbacks, useId, slot } from '@fluentui/react-utilities';\nimport { getInitials } from '../../utils/index';\nimport type { AvatarBaseProps, AvatarBaseState, AvatarNamedColor, AvatarProps, AvatarState } from './Avatar.types';\nimport { PersonRegular } from '@fluentui/react-icons';\nimport { PresenceBadge } from '@fluentui/react-badge';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport { useAvatarContext } from '../../contexts/AvatarContext';\n\nexport const DEFAULT_STRINGS = {\n active: 'active',\n inactive: 'inactive',\n};\n\nexport const useAvatar_unstable = (props: AvatarProps, ref: React.Ref<HTMLElement>): AvatarState => {\n const { dir } = useFluent();\n const { shape: contextShape, size: contextSize } = useAvatarContext();\n const {\n size = contextSize ?? (32 as const),\n shape = contextShape ?? 'circular',\n active = 'unset',\n activeAppearance = 'ring',\n idForColor,\n color: propColor = 'neutral',\n ...rest\n } = props;\n\n const state = useAvatarBase_unstable(rest, ref);\n\n // Resolve 'colorful' to a specific color name\n const color: AvatarState['color'] =\n propColor === 'colorful'\n ? avatarColors[getHashCode(idForColor ?? props.name ?? '') % avatarColors.length]\n : propColor;\n\n if (state.initials) {\n state.initials = slot.optional(props.initials, {\n renderByDefault: true,\n defaultProps: {\n children: getInitials(props.name, dir === 'rtl', { firstInitialOnly: size <= 16 }),\n id: state.initials?.id,\n },\n elementType: 'span',\n });\n }\n\n if (state.icon && !state.icon.hasOwnProperty('children')) {\n state.icon.children = <PersonRegular />;\n }\n\n const badge: AvatarState['badge'] = slot.optional(props.badge, {\n defaultProps: { size: getBadgeSize(size), id: state.root.id + '__badge' },\n elementType: PresenceBadge,\n });\n\n let activeAriaLabelElement: AvatarState['activeAriaLabelElement'] = state.activeAriaLabelElement;\n\n // Enhance aria-label and/or aria-labelledby to include badge and active state\n // Only process if aria attributes were not explicitly provided by the user\n const userProvidedAriaLabel = props['aria-label'] !== undefined;\n const userProvidedAriaLabelledby = props['aria-labelledby'] !== undefined;\n\n if (!userProvidedAriaLabel && !userProvidedAriaLabelledby) {\n if (props.name) {\n if (badge) {\n state.root['aria-labelledby'] = state.root.id + ' ' + badge.id;\n }\n } else if (state.initials) {\n // root's aria-label should be the name, but fall back to being labelledby the initials if name is missing\n state.root['aria-labelledby'] = state.initials.id + (badge ? ' ' + badge.id : '');\n delete state.root['aria-label'];\n }\n // Add the active state to the aria label\n if (active === 'active' || active === 'inactive') {\n const activeText = DEFAULT_STRINGS[active];\n if (state.root['aria-labelledby']) {\n // If using aria-labelledby, render a hidden span and append it to the labelledby\n const activeId = state.root.id + '__active';\n state.root['aria-labelledby'] += ' ' + activeId;\n activeAriaLabelElement = (\n <span hidden id={activeId}>\n {activeText}\n </span>\n );\n } else if (state.root['aria-label']) {\n // Otherwise, just append it to the aria-label\n state.root['aria-label'] += ' ' + activeText;\n }\n }\n }\n\n return {\n ...state,\n size,\n shape,\n active,\n activeAppearance,\n activeAriaLabelElement,\n color,\n badge,\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n components: { ...state.components, badge: PresenceBadge },\n };\n};\n\n/**\n * Base hook for Avatar component, manages state and structure common to all variants of Avatar\n */\nexport const useAvatarBase_unstable = (props: AvatarBaseProps, ref?: React.Ref<HTMLElement>): AvatarBaseState => {\n const { dir } = useFluent();\n const { name, 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,oBAAoB;AAEhD,SAASC,aAAa,QAAQ,wBAAwB;AACtD,SAASC,aAAa,QAAQ,wBAAwB;AACtD,SAASC,sBAAsBC,SAAS,QAAQ,kCA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,YAAY,AAACE,CAAAA,MAAME,KAAI,IAAMF,CAAAA,MAAO,IAAIE,KAAK,GAAI,iCAAiC;IACpF;IAEA,OAAOJ;AACT"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/AvatarGroup/AvatarGroup.types.ts"],"sourcesContent":["import type { AvatarSize } from '../Avatar/Avatar.types';\nimport type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\n\nexport type AvatarGroupSlots = {\n root: NonNullable<Slot<'div'>>;\n};\n\n/**\n * AvatarGroup Props\n */\nexport type AvatarGroupProps = ComponentProps<AvatarGroupSlots> & {\n /**\n * Layout the AvatarGroupItems should be displayed as.\n * @default spread\n */\n layout?: 'spread' | 'stack' | 'pie';\n\n /**\n * Size of the AvatarGroupItems.\n * @default 32\n */\n size?: AvatarSize;\n};\n\n/**\n * State used in rendering AvatarGroup\n */\nexport type AvatarGroupState = ComponentState<AvatarGroupSlots> & Required<Pick<AvatarGroupProps, 'layout' | 'size'>>;\n\nexport type AvatarGroupContextValue = Pick<AvatarGroupProps, 'size' | 'layout'> & {\n isOverflow?: boolean;\n};\n\nexport type AvatarGroupContextValues = {\n avatarGroup: AvatarGroupContextValue;\n};\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/components/AvatarGroup/AvatarGroup.types.ts"],"sourcesContent":["import type { AvatarSize } from '../Avatar/Avatar.types';\nimport type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\n\nexport type AvatarGroupSlots = {\n root: NonNullable<Slot<'div'>>;\n};\n\n/**\n * AvatarGroup Props\n */\nexport type AvatarGroupProps = ComponentProps<AvatarGroupSlots> & {\n /**\n * Layout the AvatarGroupItems should be displayed as.\n * @default spread\n */\n layout?: 'spread' | 'stack' | 'pie';\n\n /**\n * Size of the AvatarGroupItems.\n * @default 32\n */\n size?: AvatarSize;\n};\n\nexport type AvatarGroupBaseProps = Omit<AvatarGroupProps, 'size'>;\n\n/**\n * State used in rendering AvatarGroup\n */\nexport type AvatarGroupState = ComponentState<AvatarGroupSlots> & Required<Pick<AvatarGroupProps, 'layout' | 'size'>>;\n\nexport type AvatarGroupBaseState = Omit<AvatarGroupState, 'size'>;\n\nexport type AvatarGroupContextValue = Pick<AvatarGroupProps, 'size' | 'layout'> & {\n isOverflow?: boolean;\n};\n\nexport type AvatarGroupContextValues = {\n avatarGroup: AvatarGroupContextValue;\n};\n"],"names":[],"mappings":"AAqCA,WAEE"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { AvatarGroup } from './AvatarGroup';
|
|
2
2
|
export { renderAvatarGroup_unstable } from './renderAvatarGroup';
|
|
3
|
-
export { defaultAvatarGroupSize, useAvatarGroup_unstable } from './useAvatarGroup';
|
|
3
|
+
export { defaultAvatarGroupSize, useAvatarGroup_unstable, useAvatarGroupBase_unstable } from './useAvatarGroup';
|
|
4
4
|
export { avatarGroupClassNames, useAvatarGroupStyles_unstable } from './useAvatarGroupStyles.styles';
|
|
5
5
|
export { useAvatarGroupContextValues } from './useAvatarGroupContextValues';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/AvatarGroup/index.ts"],"sourcesContent":["export { AvatarGroup } from './AvatarGroup';\nexport type {\n AvatarGroupContextValue,\n AvatarGroupContextValues,\n AvatarGroupProps,\n AvatarGroupSlots,\n AvatarGroupState,\n} from './AvatarGroup.types';\nexport { renderAvatarGroup_unstable } from './renderAvatarGroup';\nexport { defaultAvatarGroupSize, useAvatarGroup_unstable } from './useAvatarGroup';\nexport { avatarGroupClassNames, useAvatarGroupStyles_unstable } from './useAvatarGroupStyles.styles';\nexport { useAvatarGroupContextValues } from './useAvatarGroupContextValues';\n"],"names":["AvatarGroup","renderAvatarGroup_unstable","defaultAvatarGroupSize","useAvatarGroup_unstable","avatarGroupClassNames","useAvatarGroupStyles_unstable","useAvatarGroupContextValues"],"mappings":"AAAA,SAASA,WAAW,QAAQ,gBAAgB;
|
|
1
|
+
{"version":3,"sources":["../src/components/AvatarGroup/index.ts"],"sourcesContent":["export { AvatarGroup } from './AvatarGroup';\nexport type {\n AvatarGroupContextValue,\n AvatarGroupContextValues,\n AvatarGroupProps,\n AvatarGroupSlots,\n AvatarGroupState,\n AvatarGroupBaseProps,\n AvatarGroupBaseState,\n} from './AvatarGroup.types';\nexport { renderAvatarGroup_unstable } from './renderAvatarGroup';\nexport { defaultAvatarGroupSize, useAvatarGroup_unstable, useAvatarGroupBase_unstable } from './useAvatarGroup';\nexport { avatarGroupClassNames, useAvatarGroupStyles_unstable } from './useAvatarGroupStyles.styles';\nexport { useAvatarGroupContextValues } from './useAvatarGroupContextValues';\n"],"names":["AvatarGroup","renderAvatarGroup_unstable","defaultAvatarGroupSize","useAvatarGroup_unstable","useAvatarGroupBase_unstable","avatarGroupClassNames","useAvatarGroupStyles_unstable","useAvatarGroupContextValues"],"mappings":"AAAA,SAASA,WAAW,QAAQ,gBAAgB;AAU5C,SAASC,0BAA0B,QAAQ,sBAAsB;AACjE,SAASC,sBAAsB,EAAEC,uBAAuB,EAAEC,2BAA2B,QAAQ,mBAAmB;AAChH,SAASC,qBAAqB,EAAEC,6BAA6B,QAAQ,gCAAgC;AACrG,SAASC,2BAA2B,QAAQ,gCAAgC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/AvatarGroup/renderAvatarGroup.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 { AvatarGroupProvider } from '../../contexts/AvatarGroupContext';\nimport type {
|
|
1
|
+
{"version":3,"sources":["../src/components/AvatarGroup/renderAvatarGroup.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 { AvatarGroupProvider } from '../../contexts/AvatarGroupContext';\nimport type { AvatarGroupSlots, AvatarGroupContextValues, AvatarGroupBaseState } from './AvatarGroup.types';\n\n/**\n * Render the final JSX of AvatarGroup\n */\nexport const renderAvatarGroup_unstable = (\n state: AvatarGroupBaseState,\n contextValues: AvatarGroupContextValues,\n): JSXElement => {\n assertSlots<AvatarGroupSlots>(state);\n\n return (\n <AvatarGroupProvider value={contextValues.avatarGroup}>\n <state.root />\n </AvatarGroupProvider>\n );\n};\n"],"names":["assertSlots","AvatarGroupProvider","renderAvatarGroup_unstable","state","contextValues","value","avatarGroup","root"],"mappings":"AAAA,0BAA0B,GAC1B,iDAAiD;AAEjD,SAASA,WAAW,QAAQ,4BAA4B;AAGxD,SAASC,mBAAmB,QAAQ,oCAAoC;AAGxE;;CAEC,GACD,OAAO,MAAMC,6BAA6B,CACxCC,OACAC;IAEAJ,YAA8BG;IAE9B,qBACE,KAACF;QAAoBI,OAAOD,cAAcE,WAAW;kBACnD,cAAA,KAACH,MAAMI,IAAI;;AAGjB,EAAE"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
'use client';
|
|
2
2
|
import { getIntrinsicElementProps, slot } from '@fluentui/react-utilities';
|
|
3
3
|
/**
|
|
4
4
|
* Create the state required to render AvatarGroup.
|
|
@@ -9,22 +9,29 @@ import { getIntrinsicElementProps, slot } from '@fluentui/react-utilities';
|
|
|
9
9
|
* @param props - props from this instance of AvatarGroup
|
|
10
10
|
* @param ref - reference to root HTMLElement of AvatarGroup
|
|
11
11
|
*/ export const useAvatarGroup_unstable = (props, ref)=>{
|
|
12
|
-
const {
|
|
12
|
+
const { size = defaultAvatarGroupSize, ...baseProps } = props;
|
|
13
|
+
const state = useAvatarGroupBase_unstable(baseProps, ref);
|
|
14
|
+
return {
|
|
15
|
+
size,
|
|
16
|
+
...state
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Create the base state to render AvatarGroup, without design-specific props.
|
|
21
|
+
*
|
|
22
|
+
* @param props - props from this instance of AvatarGroup
|
|
23
|
+
* @param ref - reference to root HTMLDivElement of AvatarGroup
|
|
24
|
+
*/ export const useAvatarGroupBase_unstable = (props, ref)=>{
|
|
25
|
+
const { layout = 'spread' } = props;
|
|
13
26
|
const root = slot.always(getIntrinsicElementProps('div', {
|
|
14
27
|
role: 'group',
|
|
15
28
|
...props,
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
// but since it would be a breaking change to fix it, we are casting ref to it's proper type
|
|
19
|
-
ref: ref
|
|
20
|
-
}, [
|
|
21
|
-
'size'
|
|
22
|
-
]), {
|
|
29
|
+
ref
|
|
30
|
+
}), {
|
|
23
31
|
elementType: 'div'
|
|
24
32
|
});
|
|
25
33
|
return {
|
|
26
34
|
layout,
|
|
27
|
-
size,
|
|
28
35
|
components: {
|
|
29
36
|
root: 'div'
|
|
30
37
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/AvatarGroup/useAvatarGroup.tsx"],"sourcesContent":["
|
|
1
|
+
{"version":3,"sources":["../src/components/AvatarGroup/useAvatarGroup.tsx"],"sourcesContent":["'use client';\n\nimport type * as React from 'react';\nimport { getIntrinsicElementProps, slot } from '@fluentui/react-utilities';\nimport type {\n AvatarGroupBaseProps,\n AvatarGroupBaseState,\n AvatarGroupProps,\n AvatarGroupState,\n} from './AvatarGroup.types';\n\n/**\n * Create the state required to render AvatarGroup.\n *\n * The returned state can be modified with hooks such as useAvatarGroupStyles_unstable,\n * before being passed to renderAvatarGroup_unstable.\n *\n * @param props - props from this instance of AvatarGroup\n * @param ref - reference to root HTMLElement of AvatarGroup\n */\nexport const useAvatarGroup_unstable = (props: AvatarGroupProps, ref: React.Ref<HTMLElement>): AvatarGroupState => {\n const { size = defaultAvatarGroupSize, ...baseProps } = props;\n const state = useAvatarGroupBase_unstable(baseProps, ref as React.Ref<HTMLDivElement>);\n\n return {\n size,\n ...state,\n };\n};\n\n/**\n * Create the base state to render AvatarGroup, without design-specific props.\n *\n * @param props - props from this instance of AvatarGroup\n * @param ref - reference to root HTMLDivElement of AvatarGroup\n */\nexport const useAvatarGroupBase_unstable = (\n props: AvatarGroupBaseProps,\n ref: React.Ref<HTMLDivElement>,\n): AvatarGroupBaseState => {\n const { layout = 'spread' } = props;\n\n const root = slot.always(\n getIntrinsicElementProps('div', {\n role: 'group',\n ...props,\n ref,\n }),\n { elementType: 'div' },\n );\n return { layout, components: { root: 'div' }, root };\n};\n\nexport const defaultAvatarGroupSize = 32;\n"],"names":["getIntrinsicElementProps","slot","useAvatarGroup_unstable","props","ref","size","defaultAvatarGroupSize","baseProps","state","useAvatarGroupBase_unstable","layout","root","always","role","elementType","components"],"mappings":"AAAA;AAGA,SAASA,wBAAwB,EAAEC,IAAI,QAAQ,4BAA4B;AAQ3E;;;;;;;;CAQC,GACD,OAAO,MAAMC,0BAA0B,CAACC,OAAyBC;IAC/D,MAAM,EAAEC,OAAOC,sBAAsB,EAAE,GAAGC,WAAW,GAAGJ;IACxD,MAAMK,QAAQC,4BAA4BF,WAAWH;IAErD,OAAO;QACLC;QACA,GAAGG,KAAK;IACV;AACF,EAAE;AAEF;;;;;CAKC,GACD,OAAO,MAAMC,8BAA8B,CACzCN,OACAC;IAEA,MAAM,EAAEM,SAAS,QAAQ,EAAE,GAAGP;IAE9B,MAAMQ,OAAOV,KAAKW,MAAM,CACtBZ,yBAAyB,OAAO;QAC9Ba,MAAM;QACN,GAAGV,KAAK;QACRC;IACF,IACA;QAAEU,aAAa;IAAM;IAEvB,OAAO;QAAEJ;QAAQK,YAAY;YAAEJ,MAAM;QAAM;QAAGA;IAAK;AACrD,EAAE;AAEF,OAAO,MAAML,yBAAyB,GAAG"}
|
|
@@ -1,9 +1,14 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import * as React from 'react';
|
|
1
3
|
export const useAvatarGroupContextValues = (state)=>{
|
|
2
4
|
const { layout, size } = state;
|
|
3
|
-
const avatarGroup = {
|
|
5
|
+
const avatarGroup = React.useMemo(()=>({
|
|
6
|
+
layout,
|
|
7
|
+
size
|
|
8
|
+
}), [
|
|
4
9
|
layout,
|
|
5
10
|
size
|
|
6
|
-
|
|
11
|
+
]);
|
|
7
12
|
return {
|
|
8
13
|
avatarGroup
|
|
9
14
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/AvatarGroup/useAvatarGroupContextValues.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"sources":["../src/components/AvatarGroup/useAvatarGroupContextValues.ts"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport type { AvatarGroupContextValue, AvatarGroupContextValues, AvatarGroupState } from '../AvatarGroup';\n\nexport const useAvatarGroupContextValues = (state: AvatarGroupState): AvatarGroupContextValues => {\n const { layout, size } = state;\n\n const avatarGroup = React.useMemo<AvatarGroupContextValue>(\n () => ({\n layout,\n size,\n }),\n [layout, size],\n );\n\n return { avatarGroup };\n};\n"],"names":["React","useAvatarGroupContextValues","state","layout","size","avatarGroup","useMemo"],"mappings":"AAAA;AAEA,YAAYA,WAAW,QAAQ;AAG/B,OAAO,MAAMC,8BAA8B,CAACC;IAC1C,MAAM,EAAEC,MAAM,EAAEC,IAAI,EAAE,GAAGF;IAEzB,MAAMG,cAAcL,MAAMM,OAAO,CAC/B,IAAO,CAAA;YACLH;YACAC;QACF,CAAA,GACA;QAACD;QAAQC;KAAK;IAGhB,OAAO;QAAEC;IAAY;AACvB,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/AvatarGroupItem/AvatarGroupItem.types.ts"],"sourcesContent":["import { AvatarGroupProps } from '../AvatarGroup/AvatarGroup.types';\nimport type { Avatar, AvatarSize } from '../../Avatar';\nimport type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\n\nexport type AvatarGroupItemSlots = {\n root: NonNullable<Slot<'div', 'li'>>;\n\n /**\n * Avatar that represents a person or entity.\n */\n avatar: NonNullable<Slot<typeof Avatar>>;\n\n /**\n * Label used for the name of the AvatarGroupItem when rendered as an overflow item.\n * The content of the label, by default, is the `name` prop from the `avatar` slot.\n */\n overflowLabel: NonNullable<Slot<'span'>>;\n};\n\n/**\n * AvatarGroupItem Props\n */\nexport type AvatarGroupItemProps = Omit<ComponentProps<Partial<AvatarGroupItemSlots>, 'avatar'>, 'size' | 'shape'>;\n\n/**\n * State used in rendering AvatarGroupItem\n */\nexport type AvatarGroupItemState = ComponentState<AvatarGroupItemSlots> & {\n /**\n * Whether the Avatar is an overflow item.\n *\n * @default false\n */\n isOverflowItem?: boolean;\n\n layout: AvatarGroupProps['layout'];\n size: AvatarSize;\n};\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/components/AvatarGroupItem/AvatarGroupItem.types.ts"],"sourcesContent":["import type { AvatarGroupProps } from '../AvatarGroup/AvatarGroup.types';\nimport type { Avatar, AvatarSize } from '../../Avatar';\nimport type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\n\nexport type AvatarGroupItemSlots = {\n root: NonNullable<Slot<'div', 'li'>>;\n\n /**\n * Avatar that represents a person or entity.\n */\n avatar: NonNullable<Slot<typeof Avatar>>;\n\n /**\n * Label used for the name of the AvatarGroupItem when rendered as an overflow item.\n * The content of the label, by default, is the `name` prop from the `avatar` slot.\n */\n overflowLabel: NonNullable<Slot<'span'>>;\n};\n\n/**\n * AvatarGroupItem Props\n */\nexport type AvatarGroupItemProps = Omit<ComponentProps<Partial<AvatarGroupItemSlots>, 'avatar'>, 'size' | 'shape'>;\n\nexport type AvatarGroupItemBaseProps = AvatarGroupItemProps;\n\n/**\n * State used in rendering AvatarGroupItem\n */\nexport type AvatarGroupItemState = ComponentState<AvatarGroupItemSlots> & {\n /**\n * Whether the Avatar is an overflow item.\n *\n * @default false\n */\n isOverflowItem?: boolean;\n\n layout: AvatarGroupProps['layout'];\n size: AvatarSize;\n};\n\nexport type AvatarGroupItemBaseState = Omit<AvatarGroupItemState, 'size'>;\n"],"names":[],"mappings":"AAyCA,WAA0E"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { AvatarGroupItem } from './AvatarGroupItem';
|
|
2
2
|
export { renderAvatarGroupItem_unstable } from './renderAvatarGroupItem';
|
|
3
|
-
export { useAvatarGroupItem_unstable } from './useAvatarGroupItem';
|
|
3
|
+
export { useAvatarGroupItem_unstable, useAvatarGroupItemBase_unstable } from './useAvatarGroupItem';
|
|
4
4
|
export { avatarGroupItemClassNames, useAvatarGroupItemStyles_unstable, useGroupChildClassName } from './useAvatarGroupItemStyles.styles';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/AvatarGroupItem/index.ts"],"sourcesContent":["export { AvatarGroupItem } from './AvatarGroupItem';\nexport type {
|
|
1
|
+
{"version":3,"sources":["../src/components/AvatarGroupItem/index.ts"],"sourcesContent":["export { AvatarGroupItem } from './AvatarGroupItem';\nexport type {\n AvatarGroupItemProps,\n AvatarGroupItemSlots,\n AvatarGroupItemState,\n AvatarGroupItemBaseProps,\n AvatarGroupItemBaseState,\n} from './AvatarGroupItem.types';\nexport { renderAvatarGroupItem_unstable } from './renderAvatarGroupItem';\nexport { useAvatarGroupItem_unstable, useAvatarGroupItemBase_unstable } from './useAvatarGroupItem';\nexport {\n avatarGroupItemClassNames,\n useAvatarGroupItemStyles_unstable,\n useGroupChildClassName,\n} from './useAvatarGroupItemStyles.styles';\n"],"names":["AvatarGroupItem","renderAvatarGroupItem_unstable","useAvatarGroupItem_unstable","useAvatarGroupItemBase_unstable","avatarGroupItemClassNames","useAvatarGroupItemStyles_unstable","useGroupChildClassName"],"mappings":"AAAA,SAASA,eAAe,QAAQ,oBAAoB;AAQpD,SAASC,8BAA8B,QAAQ,0BAA0B;AACzE,SAASC,2BAA2B,EAAEC,+BAA+B,QAAQ,uBAAuB;AACpG,SACEC,yBAAyB,EACzBC,iCAAiC,EACjCC,sBAAsB,QACjB,oCAAoC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/AvatarGroupItem/renderAvatarGroupItem.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 {
|
|
1
|
+
{"version":3,"sources":["../src/components/AvatarGroupItem/renderAvatarGroupItem.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 { AvatarGroupItemBaseState, AvatarGroupItemSlots } from './AvatarGroupItem.types';\n\n/**\n * Render the final JSX of AvatarGroupItem\n */\nexport const renderAvatarGroupItem_unstable = (state: AvatarGroupItemBaseState): JSXElement => {\n assertSlots<AvatarGroupItemSlots>(state);\n\n return (\n <state.root>\n <state.avatar />\n {state.isOverflowItem && <state.overflowLabel />}\n </state.root>\n );\n};\n"],"names":["assertSlots","renderAvatarGroupItem_unstable","state","root","avatar","isOverflowItem","overflowLabel"],"mappings":"AAAA,0BAA0B,GAC1B,iDAAiD;AAEjD,SAASA,WAAW,QAAQ,4BAA4B;AAKxD;;CAEC,GACD,OAAO,MAAMC,iCAAiC,CAACC;IAC7CF,YAAkCE;IAElC,qBACE,MAACA,MAAMC,IAAI;;0BACT,KAACD,MAAME,MAAM;YACZF,MAAMG,cAAc,kBAAI,KAACH,MAAMI,aAAa;;;AAGnD,EAAE"}
|