@fluentui/react-avatar 9.10.4 → 9.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -2
- package/dist/index.d.ts +54 -4
- 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/renderAvatar.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 -9
- package/lib/components/AvatarGroup/useAvatarGroup.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 -7
- package/lib/components/AvatarGroupItem/useAvatarGroupItem.js.map +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 +46 -8
- package/lib/components/AvatarGroupPopover/useAvatarGroupPopover.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/renderAvatar.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 -9
- package/lib-commonjs/components/AvatarGroup/useAvatarGroup.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 -10
- package/lib-commonjs/components/AvatarGroupItem/useAvatarGroupItem.js.map +1 -1
- 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 +51 -11
- package/lib-commonjs/components/AvatarGroupPopover/useAvatarGroupPopover.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 +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,26 @@
|
|
|
1
1
|
# Change Log - @fluentui/react-avatar
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Wed, 01 Apr 2026 15:50:19 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## [9.11.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-avatar_v9.11.0)
|
|
8
|
+
|
|
9
|
+
Wed, 01 Apr 2026 15:50:19 GMT
|
|
10
|
+
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-avatar_v9.10.4..@fluentui/react-avatar_v9.11.0)
|
|
11
|
+
|
|
12
|
+
### Minor changes
|
|
13
|
+
|
|
14
|
+
- feat: expose base hooks for Avatar ([PR #35899](https://github.com/microsoft/fluentui/pull/35899) by dmytrokirpa@microsoft.com)
|
|
15
|
+
- Bump @fluentui/react-tooltip to v9.10.0 ([PR #35912](https://github.com/microsoft/fluentui/pull/35912) by beachball)
|
|
16
|
+
|
|
17
|
+
### Patches
|
|
18
|
+
|
|
19
|
+
- fix: support initials calculation for GB18030-2022 extension characters ([PR #35878](https://github.com/microsoft/fluentui/pull/35878) by dmytrokirpa@microsoft.com)
|
|
20
|
+
|
|
7
21
|
## [9.10.4](https://github.com/microsoft/fluentui/tree/@fluentui/react-avatar_v9.10.4)
|
|
8
22
|
|
|
9
|
-
Mon, 30 Mar 2026 14:
|
|
23
|
+
Mon, 30 Mar 2026 14:37:41 GMT
|
|
10
24
|
[Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-avatar_v9.10.3..@fluentui/react-avatar_v9.10.4)
|
|
11
25
|
|
|
12
26
|
### Patches
|
package/dist/index.d.ts
CHANGED
|
@@ -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/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"}
|
|
@@ -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,3 +1,4 @@
|
|
|
1
|
+
'use client';
|
|
1
2
|
import * as React from 'react';
|
|
2
3
|
import { getIntrinsicElementProps, slot } from '@fluentui/react-utilities';
|
|
3
4
|
/**
|
|
@@ -9,22 +10,29 @@ import { getIntrinsicElementProps, slot } from '@fluentui/react-utilities';
|
|
|
9
10
|
* @param props - props from this instance of AvatarGroup
|
|
10
11
|
* @param ref - reference to root HTMLElement of AvatarGroup
|
|
11
12
|
*/ export const useAvatarGroup_unstable = (props, ref)=>{
|
|
12
|
-
const {
|
|
13
|
+
const { size = defaultAvatarGroupSize, ...baseProps } = props;
|
|
14
|
+
const state = useAvatarGroupBase_unstable(baseProps, ref);
|
|
15
|
+
return {
|
|
16
|
+
size,
|
|
17
|
+
...state
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Create the base state to render AvatarGroup, without design-specific props.
|
|
22
|
+
*
|
|
23
|
+
* @param props - props from this instance of AvatarGroup
|
|
24
|
+
* @param ref - reference to root HTMLDivElement of AvatarGroup
|
|
25
|
+
*/ export const useAvatarGroupBase_unstable = (props, ref)=>{
|
|
26
|
+
const { layout = 'spread' } = props;
|
|
13
27
|
const root = slot.always(getIntrinsicElementProps('div', {
|
|
14
28
|
role: 'group',
|
|
15
29
|
...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
|
-
]), {
|
|
30
|
+
ref
|
|
31
|
+
}), {
|
|
23
32
|
elementType: 'div'
|
|
24
33
|
});
|
|
25
34
|
return {
|
|
26
35
|
layout,
|
|
27
|
-
size,
|
|
28
36
|
components: {
|
|
29
37
|
root: 'div'
|
|
30
38
|
},
|
|
@@ -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 * 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":["React","getIntrinsicElementProps","slot","useAvatarGroup_unstable","props","ref","size","defaultAvatarGroupSize","baseProps","state","useAvatarGroupBase_unstable","layout","root","always","role","elementType","components"],"mappings":"AAAA;AAEA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,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 +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 { 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"}
|
|
@@ -14,12 +14,41 @@ import { useHasParentContext } from '@fluentui/react-context-selector';
|
|
|
14
14
|
* @param props - props from this instance of AvatarGroupItem
|
|
15
15
|
* @param ref - reference to root HTMLElement of AvatarGroupItem
|
|
16
16
|
*/ export const useAvatarGroupItem_unstable = (props, ref)=>{
|
|
17
|
-
const
|
|
17
|
+
const state = useAvatarGroupItemBase_unstable(props, ref);
|
|
18
18
|
const groupSize = useAvatarGroupContext_unstable((ctx)=>ctx.size);
|
|
19
|
+
const size = groupSize !== null && groupSize !== void 0 ? groupSize : defaultAvatarGroupSize;
|
|
20
|
+
return {
|
|
21
|
+
size,
|
|
22
|
+
...state,
|
|
23
|
+
components: {
|
|
24
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
25
|
+
...state.components,
|
|
26
|
+
avatar: Avatar
|
|
27
|
+
},
|
|
28
|
+
avatar: slot.always(props.avatar, {
|
|
29
|
+
defaultProps: {
|
|
30
|
+
size,
|
|
31
|
+
color: 'colorful',
|
|
32
|
+
...state.avatar
|
|
33
|
+
},
|
|
34
|
+
elementType: Avatar
|
|
35
|
+
})
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Create the base state required to render AvatarGroupItem, without default slot props or component types.
|
|
40
|
+
*
|
|
41
|
+
* The returned state can be modified with hooks such as useAvatarGroupItemStyles_unstable,
|
|
42
|
+
* before being passed to renderAvatarGroupItem_unstable.
|
|
43
|
+
*
|
|
44
|
+
* @param props - props from this instance of AvatarGroupItem
|
|
45
|
+
* @param ref - reference to root HTMLElement of AvatarGroupItem
|
|
46
|
+
* @returns AvatarGroupItem state without default slot props or component types
|
|
47
|
+
*/ export const useAvatarGroupItemBase_unstable = (props, ref)=>{
|
|
48
|
+
const groupIsOverflow = useAvatarGroupContext_unstable((ctx)=>ctx.isOverflow);
|
|
19
49
|
const layout = useAvatarGroupContext_unstable((ctx)=>ctx.layout);
|
|
20
50
|
// Since the primary slot is not an intrinsic element, getPartitionedNativeProps cannot be used here.
|
|
21
51
|
const { style, className, overflowLabel, ...avatarSlotProps } = props;
|
|
22
|
-
const size = groupSize !== null && groupSize !== void 0 ? groupSize : defaultAvatarGroupSize;
|
|
23
52
|
const hasAvatarGroupContext = useHasParentContext(AvatarGroupContext);
|
|
24
53
|
if (process.env.NODE_ENV !== 'production' && !hasAvatarGroupContext) {
|
|
25
54
|
// eslint-disable-next-line no-console
|
|
@@ -28,10 +57,9 @@ import { useHasParentContext } from '@fluentui/react-context-selector';
|
|
|
28
57
|
return {
|
|
29
58
|
isOverflowItem: groupIsOverflow,
|
|
30
59
|
layout,
|
|
31
|
-
size,
|
|
32
60
|
components: {
|
|
33
61
|
root: groupIsOverflow ? 'li' : 'div',
|
|
34
|
-
avatar:
|
|
62
|
+
avatar: 'span',
|
|
35
63
|
overflowLabel: 'span'
|
|
36
64
|
},
|
|
37
65
|
root: slot.always(props.root, {
|
|
@@ -44,11 +72,9 @@ import { useHasParentContext } from '@fluentui/react-context-selector';
|
|
|
44
72
|
avatar: slot.always(props.avatar, {
|
|
45
73
|
defaultProps: {
|
|
46
74
|
ref,
|
|
47
|
-
size,
|
|
48
|
-
color: 'colorful',
|
|
49
75
|
...avatarSlotProps
|
|
50
76
|
},
|
|
51
|
-
elementType:
|
|
77
|
+
elementType: 'span'
|
|
52
78
|
}),
|
|
53
79
|
overflowLabel: slot.always(overflowLabel, {
|
|
54
80
|
defaultProps: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/AvatarGroupItem/useAvatarGroupItem.ts"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { Avatar } from '../Avatar/Avatar';\nimport { AvatarGroupContext, useAvatarGroupContext_unstable } from '../../contexts/AvatarGroupContext';\nimport { defaultAvatarGroupSize } from '../AvatarGroup/useAvatarGroup';\nimport { slot } from '@fluentui/react-utilities';\nimport { useHasParentContext } from '@fluentui/react-context-selector';\nimport type {
|
|
1
|
+
{"version":3,"sources":["../src/components/AvatarGroupItem/useAvatarGroupItem.ts"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { Avatar } from '../Avatar/Avatar';\nimport { AvatarGroupContext, useAvatarGroupContext_unstable } from '../../contexts/AvatarGroupContext';\nimport { defaultAvatarGroupSize } from '../AvatarGroup/useAvatarGroup';\nimport { slot } from '@fluentui/react-utilities';\nimport { useHasParentContext } from '@fluentui/react-context-selector';\nimport type {\n AvatarGroupItemBaseProps,\n AvatarGroupItemBaseState,\n AvatarGroupItemProps,\n AvatarGroupItemState,\n} from './AvatarGroupItem.types';\n\n/**\n * Create the state required to render AvatarGroupItem.\n *\n * The returned state can be modified with hooks such as useAvatarGroupItemStyles_unstable,\n * before being passed to renderAvatarGroupItem_unstable.\n *\n * @param props - props from this instance of AvatarGroupItem\n * @param ref - reference to root HTMLElement of AvatarGroupItem\n */\nexport const useAvatarGroupItem_unstable = (\n props: AvatarGroupItemProps,\n ref: React.Ref<HTMLElement>,\n): AvatarGroupItemState => {\n const state = useAvatarGroupItemBase_unstable(props, ref);\n const groupSize = useAvatarGroupContext_unstable(ctx => ctx.size);\n const size = groupSize ?? defaultAvatarGroupSize;\n\n return {\n size,\n ...state,\n components: {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n ...state.components,\n avatar: Avatar,\n },\n avatar: slot.always(props.avatar, {\n defaultProps: { size, color: 'colorful', ...state.avatar },\n elementType: Avatar,\n }),\n };\n};\n\n/**\n * Create the base state required to render AvatarGroupItem, without default slot props or component types.\n *\n * The returned state can be modified with hooks such as useAvatarGroupItemStyles_unstable,\n * before being passed to renderAvatarGroupItem_unstable.\n *\n * @param props - props from this instance of AvatarGroupItem\n * @param ref - reference to root HTMLElement of AvatarGroupItem\n * @returns AvatarGroupItem state without default slot props or component types\n */\nexport const useAvatarGroupItemBase_unstable = (\n props: AvatarGroupItemBaseProps,\n ref: React.Ref<HTMLElement>,\n): AvatarGroupItemBaseState => {\n const groupIsOverflow = useAvatarGroupContext_unstable(ctx => ctx.isOverflow);\n const layout = useAvatarGroupContext_unstable(ctx => ctx.layout);\n // Since the primary slot is not an intrinsic element, getPartitionedNativeProps cannot be used here.\n const { style, className, overflowLabel, ...avatarSlotProps } = props;\n const hasAvatarGroupContext = useHasParentContext(AvatarGroupContext);\n\n if (process.env.NODE_ENV !== 'production' && !hasAvatarGroupContext) {\n // eslint-disable-next-line no-console\n console.warn('AvatarGroupItem must only be used inside an AvatarGroup component.');\n }\n\n return {\n isOverflowItem: groupIsOverflow,\n layout,\n components: {\n root: groupIsOverflow ? 'li' : 'div',\n avatar: 'span',\n overflowLabel: 'span',\n },\n root: slot.always(props.root, {\n defaultProps: {\n style,\n className,\n },\n elementType: groupIsOverflow ? 'li' : 'div',\n }),\n avatar: slot.always(props.avatar, {\n defaultProps: {\n ref,\n ...avatarSlotProps,\n },\n elementType: 'span',\n }),\n overflowLabel: slot.always(overflowLabel, {\n defaultProps: {\n // Avatar already has its aria-label set to the name, this will prevent the name to be read twice.\n 'aria-hidden': true,\n children: props.name,\n },\n elementType: 'span',\n }),\n };\n};\n"],"names":["React","Avatar","AvatarGroupContext","useAvatarGroupContext_unstable","defaultAvatarGroupSize","slot","useHasParentContext","useAvatarGroupItem_unstable","props","ref","state","useAvatarGroupItemBase_unstable","groupSize","ctx","size","components","avatar","always","defaultProps","color","elementType","groupIsOverflow","isOverflow","layout","style","className","overflowLabel","avatarSlotProps","hasAvatarGroupContext","process","env","NODE_ENV","console","warn","isOverflowItem","root","children","name"],"mappings":"AAAA;AAEA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,SAASC,kBAAkB,EAAEC,8BAA8B,QAAQ,oCAAoC;AACvG,SAASC,sBAAsB,QAAQ,gCAAgC;AACvE,SAASC,IAAI,QAAQ,4BAA4B;AACjD,SAASC,mBAAmB,QAAQ,mCAAmC;AAQvE;;;;;;;;CAQC,GACD,OAAO,MAAMC,8BAA8B,CACzCC,OACAC;IAEA,MAAMC,QAAQC,gCAAgCH,OAAOC;IACrD,MAAMG,YAAYT,+BAA+BU,CAAAA,MAAOA,IAAIC,IAAI;IAChE,MAAMA,OAAOF,sBAAAA,uBAAAA,YAAaR;IAE1B,OAAO;QACLU;QACA,GAAGJ,KAAK;QACRK,YAAY;YACV,4DAA4D;YAC5D,GAAGL,MAAMK,UAAU;YACnBC,QAAQf;QACV;QACAe,QAAQX,KAAKY,MAAM,CAACT,MAAMQ,MAAM,EAAE;YAChCE,cAAc;gBAAEJ;gBAAMK,OAAO;gBAAY,GAAGT,MAAMM,MAAM;YAAC;YACzDI,aAAanB;QACf;IACF;AACF,EAAE;AAEF;;;;;;;;;CASC,GACD,OAAO,MAAMU,kCAAkC,CAC7CH,OACAC;IAEA,MAAMY,kBAAkBlB,+BAA+BU,CAAAA,MAAOA,IAAIS,UAAU;IAC5E,MAAMC,SAASpB,+BAA+BU,CAAAA,MAAOA,IAAIU,MAAM;IAC/D,qGAAqG;IACrG,MAAM,EAAEC,KAAK,EAAEC,SAAS,EAAEC,aAAa,EAAE,GAAGC,iBAAiB,GAAGnB;IAChE,MAAMoB,wBAAwBtB,oBAAoBJ;IAElD,IAAI2B,QAAQC,GAAG,CAACC,QAAQ,KAAK,gBAAgB,CAACH,uBAAuB;QACnE,sCAAsC;QACtCI,QAAQC,IAAI,CAAC;IACf;IAEA,OAAO;QACLC,gBAAgBb;QAChBE;QACAR,YAAY;YACVoB,MAAMd,kBAAkB,OAAO;YAC/BL,QAAQ;YACRU,eAAe;QACjB;QACAS,MAAM9B,KAAKY,MAAM,CAACT,MAAM2B,IAAI,EAAE;YAC5BjB,cAAc;gBACZM;gBACAC;YACF;YACAL,aAAaC,kBAAkB,OAAO;QACxC;QACAL,QAAQX,KAAKY,MAAM,CAACT,MAAMQ,MAAM,EAAE;YAChCE,cAAc;gBACZT;gBACA,GAAGkB,eAAe;YACpB;YACAP,aAAa;QACf;QACAM,eAAerB,KAAKY,MAAM,CAACS,eAAe;YACxCR,cAAc;gBACZ,kGAAkG;gBAClG,eAAe;gBACfkB,UAAU5B,MAAM6B,IAAI;YACtB;YACAjB,aAAa;QACf;IACF;AACF,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/AvatarGroupPopover/AvatarGroupPopover.types.ts"],"sourcesContent":["import * as React from 'react';\nimport type { AvatarSize } from '../Avatar/Avatar.types';\nimport type { AvatarGroupProps } from '../AvatarGroup/AvatarGroup.types';\nimport type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\nimport type { PopoverProps, PopoverSurface } from '@fluentui/react-popover';\nimport type { TooltipProps } from '@fluentui/react-tooltip';\n\nexport type AvatarGroupPopoverSlots = {\n root: NonNullable<Slot<PopoverProps>>;\n\n /**\n * Button that triggers the Popover.\n */\n triggerButton: NonNullable<Slot<'button'>>;\n\n /**\n * List that contains the overflowed AvatarGroupItems.\n */\n content: NonNullable<Slot<'ul'>>;\n\n /**\n * PopoverSurface that contains the content.\n */\n popoverSurface: NonNullable<Slot<typeof PopoverSurface>>;\n\n /**\n * Tooltip shown when triggerButton is hovered.\n */\n tooltip: NonNullable<Slot<TooltipProps>>;\n};\n\n/**\n * AvatarGroupPopover Props\n */\nexport type AvatarGroupPopoverProps = Omit<ComponentProps<Partial<AvatarGroupPopoverSlots>>, 'children'> & {\n /**\n * Whether the triggerButton should render an icon instead of the number of overflowed AvatarGroupItems.\n * Note: The indicator will default to `icon` when the size is less than 24.\n * @default count\n */\n indicator?: 'count' | 'icon';\n\n /**\n * Number of AvatarGroupItems that will be rendered.\n *\n * Note: AvatarGroupPopover handles counting the number of children, but when using a react fragment to wrap the\n * children, this is not possible and therefore it has do be added manually.\n */\n count?: number;\n\n children: React.ReactNode;\n};\n\n/**\n * State used in rendering AvatarGroupPopover\n */\nexport type AvatarGroupPopoverState = ComponentState<AvatarGroupPopoverSlots> &\n Required<Pick<AvatarGroupPopoverProps, 'count' | 'indicator'>> & {\n popoverOpen: boolean;\n layout: AvatarGroupProps['layout'];\n size: AvatarSize;\n };\n"],"names":["React"],"mappings":"AAAA,YAAYA,WAAW,QAAQ"}
|
|
1
|
+
{"version":3,"sources":["../src/components/AvatarGroupPopover/AvatarGroupPopover.types.ts"],"sourcesContent":["import * as React from 'react';\nimport type { AvatarSize } from '../Avatar/Avatar.types';\nimport type { AvatarGroupProps } from '../AvatarGroup/AvatarGroup.types';\nimport type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\nimport type { PopoverProps, PopoverSurface } from '@fluentui/react-popover';\nimport type { TooltipProps } from '@fluentui/react-tooltip';\n\nexport type AvatarGroupPopoverSlots = {\n root: NonNullable<Slot<PopoverProps>>;\n\n /**\n * Button that triggers the Popover.\n */\n triggerButton: NonNullable<Slot<'button'>>;\n\n /**\n * List that contains the overflowed AvatarGroupItems.\n */\n content: NonNullable<Slot<'ul'>>;\n\n /**\n * PopoverSurface that contains the content.\n */\n popoverSurface: NonNullable<Slot<typeof PopoverSurface>>;\n\n /**\n * Tooltip shown when triggerButton is hovered.\n */\n tooltip: NonNullable<Slot<TooltipProps>>;\n};\n\n/**\n * AvatarGroupPopover Props\n */\nexport type AvatarGroupPopoverProps = Omit<ComponentProps<Partial<AvatarGroupPopoverSlots>>, 'children'> & {\n /**\n * Whether the triggerButton should render an icon instead of the number of overflowed AvatarGroupItems.\n * Note: The indicator will default to `icon` when the size is less than 24.\n * @default count\n */\n indicator?: 'count' | 'icon';\n\n /**\n * Number of AvatarGroupItems that will be rendered.\n *\n * Note: AvatarGroupPopover handles counting the number of children, but when using a react fragment to wrap the\n * children, this is not possible and therefore it has do be added manually.\n */\n count?: number;\n\n children: React.ReactNode;\n};\n\nexport type AvatarGroupPopoverBaseProps = AvatarGroupPopoverProps;\n\n/**\n * State used in rendering AvatarGroupPopover\n */\nexport type AvatarGroupPopoverState = ComponentState<AvatarGroupPopoverSlots> &\n Required<Pick<AvatarGroupPopoverProps, 'count' | 'indicator'>> & {\n popoverOpen: boolean;\n layout: AvatarGroupProps['layout'];\n size: AvatarSize;\n };\n\nexport type AvatarGroupPopoverBaseState = Omit<AvatarGroupPopoverState, 'size'>;\n"],"names":["React"],"mappings":"AAAA,YAAYA,WAAW,QAAQ"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { AvatarGroupPopover } from './AvatarGroupPopover';
|
|
2
2
|
export { renderAvatarGroupPopover_unstable } from './renderAvatarGroupPopover';
|
|
3
|
-
export { useAvatarGroupPopover_unstable } from './useAvatarGroupPopover';
|
|
3
|
+
export { useAvatarGroupPopover_unstable, useAvatarGroupPopoverBase_unstable } from './useAvatarGroupPopover';
|
|
4
4
|
export { avatarGroupPopoverClassNames, useAvatarGroupPopoverStyles_unstable } from './useAvatarGroupPopoverStyles.styles';
|
|
5
5
|
export { useAvatarGroupPopoverContextValues_unstable } from './useAvatarGroupPopoverContextValues';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/AvatarGroupPopover/index.ts"],"sourcesContent":["export { AvatarGroupPopover } from './AvatarGroupPopover';\nexport type {\n AvatarGroupPopoverProps,\n AvatarGroupPopoverSlots,\n AvatarGroupPopoverState,\n} from './AvatarGroupPopover.types';\nexport { renderAvatarGroupPopover_unstable } from './renderAvatarGroupPopover';\nexport { useAvatarGroupPopover_unstable } from './useAvatarGroupPopover';\nexport {\n avatarGroupPopoverClassNames,\n useAvatarGroupPopoverStyles_unstable,\n} from './useAvatarGroupPopoverStyles.styles';\nexport { useAvatarGroupPopoverContextValues_unstable } from './useAvatarGroupPopoverContextValues';\n"],"names":["AvatarGroupPopover","renderAvatarGroupPopover_unstable","useAvatarGroupPopover_unstable","avatarGroupPopoverClassNames","useAvatarGroupPopoverStyles_unstable","useAvatarGroupPopoverContextValues_unstable"],"mappings":"AAAA,SAASA,kBAAkB,QAAQ,uBAAuB;
|
|
1
|
+
{"version":3,"sources":["../src/components/AvatarGroupPopover/index.ts"],"sourcesContent":["export { AvatarGroupPopover } from './AvatarGroupPopover';\nexport type {\n AvatarGroupPopoverProps,\n AvatarGroupPopoverSlots,\n AvatarGroupPopoverState,\n AvatarGroupPopoverBaseProps,\n AvatarGroupPopoverBaseState,\n} from './AvatarGroupPopover.types';\nexport { renderAvatarGroupPopover_unstable } from './renderAvatarGroupPopover';\nexport { useAvatarGroupPopover_unstable, useAvatarGroupPopoverBase_unstable } from './useAvatarGroupPopover';\nexport {\n avatarGroupPopoverClassNames,\n useAvatarGroupPopoverStyles_unstable,\n} from './useAvatarGroupPopoverStyles.styles';\nexport { useAvatarGroupPopoverContextValues_unstable } from './useAvatarGroupPopoverContextValues';\n"],"names":["AvatarGroupPopover","renderAvatarGroupPopover_unstable","useAvatarGroupPopover_unstable","useAvatarGroupPopoverBase_unstable","avatarGroupPopoverClassNames","useAvatarGroupPopoverStyles_unstable","useAvatarGroupPopoverContextValues_unstable"],"mappings":"AAAA,SAASA,kBAAkB,QAAQ,uBAAuB;AAQ1D,SAASC,iCAAiC,QAAQ,6BAA6B;AAC/E,SAASC,8BAA8B,EAAEC,kCAAkC,QAAQ,0BAA0B;AAC7G,SACEC,4BAA4B,EAC5BC,oCAAoC,QAC/B,uCAAuC;AAC9C,SAASC,2CAA2C,QAAQ,uCAAuC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/AvatarGroupPopover/renderAvatarGroupPopover.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\nimport { AvatarGroupProvider } from '../../contexts/AvatarGroupContext';\nimport { AvatarGroupContextValues } from '../AvatarGroup/AvatarGroup.types';\n\nimport { assertSlots } from '@fluentui/react-utilities';\nimport type { JSXElement } from '@fluentui/react-utilities';\nimport { PopoverTrigger } from '@fluentui/react-popover';\nimport type {
|
|
1
|
+
{"version":3,"sources":["../src/components/AvatarGroupPopover/renderAvatarGroupPopover.tsx"],"sourcesContent":["/** @jsxRuntime automatic */\n/** @jsxImportSource @fluentui/react-jsx-runtime */\nimport { AvatarGroupProvider } from '../../contexts/AvatarGroupContext';\nimport { AvatarGroupContextValues } from '../AvatarGroup/AvatarGroup.types';\n\nimport { assertSlots } from '@fluentui/react-utilities';\nimport type { JSXElement } from '@fluentui/react-utilities';\nimport { PopoverTrigger } from '@fluentui/react-popover';\nimport type { AvatarGroupPopoverBaseState, AvatarGroupPopoverSlots } from './AvatarGroupPopover.types';\n\n/**\n * Render the final JSX of AvatarGroupPopover\n */\nexport const renderAvatarGroupPopover_unstable = (\n state: AvatarGroupPopoverBaseState,\n contextValues: AvatarGroupContextValues,\n): JSXElement => {\n assertSlots<AvatarGroupPopoverSlots>(state);\n\n return (\n <state.root>\n <PopoverTrigger disableButtonEnhancement>\n <state.tooltip>\n <state.triggerButton />\n </state.tooltip>\n </PopoverTrigger>\n <state.popoverSurface>\n <AvatarGroupProvider value={contextValues.avatarGroup}>\n <state.content />\n </AvatarGroupProvider>\n </state.popoverSurface>\n </state.root>\n );\n};\n"],"names":["AvatarGroupProvider","assertSlots","PopoverTrigger","renderAvatarGroupPopover_unstable","state","contextValues","root","disableButtonEnhancement","tooltip","triggerButton","popoverSurface","value","avatarGroup","content"],"mappings":"AAAA,0BAA0B,GAC1B,iDAAiD;AACjD,SAASA,mBAAmB,QAAQ,oCAAoC;AAGxE,SAASC,WAAW,QAAQ,4BAA4B;AAExD,SAASC,cAAc,QAAQ,0BAA0B;AAGzD;;CAEC,GACD,OAAO,MAAMC,oCAAoC,CAC/CC,OACAC;IAEAJ,YAAqCG;IAErC,qBACE,MAACA,MAAME,IAAI;;0BACT,KAACJ;gBAAeK,wBAAwB;0BACtC,cAAA,KAACH,MAAMI,OAAO;8BACZ,cAAA,KAACJ,MAAMK,aAAa;;;0BAGxB,KAACL,MAAMM,cAAc;0BACnB,cAAA,KAACV;oBAAoBW,OAAON,cAAcO,WAAW;8BACnD,cAAA,KAACR,MAAMS,OAAO;;;;;AAKxB,EAAE"}
|
|
@@ -17,7 +17,48 @@ import { Tooltip } from '@fluentui/react-tooltip';
|
|
|
17
17
|
var _useAvatarGroupContext_unstable;
|
|
18
18
|
const size = (_useAvatarGroupContext_unstable = useAvatarGroupContext_unstable((ctx)=>ctx.size)) !== null && _useAvatarGroupContext_unstable !== void 0 ? _useAvatarGroupContext_unstable : defaultAvatarGroupSize;
|
|
19
19
|
const layout = useAvatarGroupContext_unstable((ctx)=>ctx.layout);
|
|
20
|
-
const { indicator = size < 24 ? 'icon' : 'count',
|
|
20
|
+
const { indicator = size < 24 ? 'icon' : 'count', ...baseProps } = props;
|
|
21
|
+
const state = useAvatarGroupPopoverBase_unstable({
|
|
22
|
+
indicator,
|
|
23
|
+
...baseProps
|
|
24
|
+
});
|
|
25
|
+
if (layout === 'pie') {
|
|
26
|
+
state.triggerButton.children = null;
|
|
27
|
+
} else if (indicator === 'icon') {
|
|
28
|
+
state.triggerButton.children = /*#__PURE__*/ React.createElement(MoreHorizontalRegular, null);
|
|
29
|
+
}
|
|
30
|
+
return {
|
|
31
|
+
size,
|
|
32
|
+
...state,
|
|
33
|
+
components: {
|
|
34
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
35
|
+
...state.components,
|
|
36
|
+
root: Popover,
|
|
37
|
+
popoverSurface: PopoverSurface,
|
|
38
|
+
tooltip: Tooltip
|
|
39
|
+
},
|
|
40
|
+
root: slot.always(state.root, {
|
|
41
|
+
elementType: Popover
|
|
42
|
+
}),
|
|
43
|
+
popoverSurface: slot.always(props.popoverSurface, {
|
|
44
|
+
defaultProps: state.popoverSurface,
|
|
45
|
+
elementType: PopoverSurface
|
|
46
|
+
}),
|
|
47
|
+
tooltip: slot.always(props.tooltip, {
|
|
48
|
+
defaultProps: state.tooltip,
|
|
49
|
+
elementType: Tooltip
|
|
50
|
+
})
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* Handles popover open/closed state, indicator display, and slot configuration.
|
|
55
|
+
* Use directly for custom implementations or use useAvatarGroupPopover_unstable for defaults.
|
|
56
|
+
*
|
|
57
|
+
* @param props - AvatarGroupPopover props
|
|
58
|
+
* @returns AvatarGroupPopover state
|
|
59
|
+
*/ export const useAvatarGroupPopoverBase_unstable = (props)=>{
|
|
60
|
+
const layout = useAvatarGroupContext_unstable((ctx)=>ctx.layout);
|
|
61
|
+
const { indicator = 'count', count = React.Children.count(props.children), children, ...restOfProps } = props;
|
|
21
62
|
const [popoverOpen, setPopoverOpen] = useControllableState({
|
|
22
63
|
state: props.open,
|
|
23
64
|
defaultState: props.defaultOpen,
|
|
@@ -31,9 +72,7 @@ import { Tooltip } from '@fluentui/react-tooltip';
|
|
|
31
72
|
let triggerButtonChildren;
|
|
32
73
|
if (layout === 'pie') {
|
|
33
74
|
triggerButtonChildren = null;
|
|
34
|
-
} else if (indicator === '
|
|
35
|
-
triggerButtonChildren = /*#__PURE__*/ React.createElement(MoreHorizontalRegular, null);
|
|
36
|
-
} else {
|
|
75
|
+
} else if (indicator === 'count') {
|
|
37
76
|
triggerButtonChildren = count > 99 ? '99+' : `+${count}`;
|
|
38
77
|
}
|
|
39
78
|
return {
|
|
@@ -41,7 +80,6 @@ import { Tooltip } from '@fluentui/react-tooltip';
|
|
|
41
80
|
indicator,
|
|
42
81
|
layout,
|
|
43
82
|
popoverOpen,
|
|
44
|
-
size,
|
|
45
83
|
components: {
|
|
46
84
|
root: Popover,
|
|
47
85
|
triggerButton: 'button',
|
|
@@ -58,7 +96,7 @@ import { Tooltip } from '@fluentui/react-tooltip';
|
|
|
58
96
|
open: popoverOpen,
|
|
59
97
|
onOpenChange: handleOnPopoverChange
|
|
60
98
|
}, {
|
|
61
|
-
elementType:
|
|
99
|
+
elementType: 'div'
|
|
62
100
|
}),
|
|
63
101
|
triggerButton: slot.always(props.triggerButton, {
|
|
64
102
|
defaultProps: {
|
|
@@ -79,14 +117,14 @@ import { Tooltip } from '@fluentui/react-tooltip';
|
|
|
79
117
|
'aria-label': 'Overflow',
|
|
80
118
|
tabIndex: 0
|
|
81
119
|
},
|
|
82
|
-
elementType:
|
|
120
|
+
elementType: 'div'
|
|
83
121
|
}),
|
|
84
122
|
tooltip: slot.always(props.tooltip, {
|
|
85
123
|
defaultProps: {
|
|
86
124
|
content: 'View more people.',
|
|
87
125
|
relationship: 'label'
|
|
88
126
|
},
|
|
89
|
-
elementType:
|
|
127
|
+
elementType: 'div'
|
|
90
128
|
})
|
|
91
129
|
};
|
|
92
130
|
};
|