Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ storiesOf('AvatarGroup Converged', module)
{
includeHighContrast: true,
includeDarkMode: true,
includeRtl: true,
},
)
.addStory(
Expand All @@ -118,11 +119,13 @@ storiesOf('AvatarGroup Converged', module)
{
includeHighContrast: true,
includeDarkMode: true,
includeRtl: true,
},
)
.addStory('layoutPie', () => <AvatarGroupList layout="pie" />, {
includeHighContrast: true,
includeDarkMode: true,
includeRtl: true,
})
.addStory('overflowIndicator', () => <AvatarGroupList overflowIndicator="icon" />, {
includeHighContrast: true,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "fix: AvatarGroup's pie layout places inline items correctly in rtl.",
"packageName": "@fluentui/react-avatar",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { makeStyles, mergeClasses, shorthands } from '@griffel/react';
import { tokens, typographyStyles } from '@fluentui/react-theme';
import { useSizeStyles } from '../../Avatar';
import { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';
import type { AvatarGroupItemSlots, AvatarGroupItemState } from './AvatarGroupItem.types';
import type { AvatarGroupProps } from '../../AvatarGroup';
import type { AvatarSizes } from '../../Avatar';
Expand Down Expand Up @@ -128,6 +129,33 @@ const usePieStyles = makeStyles({
transformOrigin: '0 0',
},
},
rtlSlices: {
// Two slices
// 1st of 2 items
'&:nth-of-type(1):nth-last-of-type(2)': {
clipPath: `inset(0 25% 0 calc(25% + (var(${avatarGroupItemDividerWidthVar}) / 2)))`,
},
// 2nd of 2 items
'&:nth-of-type(2):nth-last-of-type(1)': {
clipPath: `inset(0 calc(25% + (var(${avatarGroupItemDividerWidthVar}) / 2)) 0 25%)`,
},

// Three slices
// 1st of 3 items
'&:nth-of-type(1):nth-last-of-type(3)': {
clipPath: `inset(0 25% 0 calc(25% + (var(${avatarGroupItemDividerWidthVar}) / 2)))`,
},
// 2nd of 3 items
'&:nth-of-type(2):nth-last-of-type(2)': {
clipPath: `inset(0 var(${avatarGroupItemDividerWidthVar}) var(${avatarGroupItemDividerWidthVar}) 0)`,
left: '0',
},
// 3rd of 3 items
'&:nth-of-type(3):nth-last-of-type(1)': {
clipPath: `inset(var(${avatarGroupItemDividerWidthVar}) var(${avatarGroupItemDividerWidthVar}) 0 0)`,
left: '0',
},
},
thick: { [avatarGroupItemDividerWidthVar]: tokens.strokeWidthThick },
thicker: { [avatarGroupItemDividerWidthVar]: tokens.strokeWidthThicker },
thickest: { [avatarGroupItemDividerWidthVar]: tokens.strokeWidthThickest },
Expand All @@ -138,6 +166,7 @@ const usePieStyles = makeStyles({
*/
export const useAvatarGroupItemStyles_unstable = (state: AvatarGroupItemState): AvatarGroupItemState => {
const { isOverflowItem, layout, size } = state;
const { dir } = useFluent();

const avatarStyles = useAvatarStyles();
const overflowLabelStyles = useOverflowLabelStyles();
Expand Down Expand Up @@ -166,6 +195,10 @@ export const useAvatarGroupItemStyles_unstable = (state: AvatarGroupItemState):
}

rootClasses.push(pieStyles.slices);

if (dir === 'rtl') {
rootClasses.push(pieStyles.rtlSlices);
}
}
} else {
rootClasses.push(rootStyles.overflowItem);
Expand Down