An open source design system that's fully customizable and agent ready
TypeScript
feat(AvatarGroup): expose size on the avatar-group-overflow theming target (#5046)
freddymeta15a65d556c7e
diff --git a/.changeset/avatar-group-overflow-size-target.md b/.changeset/avatar-group-overflow-size-target.mdnew file mode 100644index 0000000000..9af665fdee--- /dev/null+++ b/.changeset/avatar-group-overflow-size-target.md@@ -0,0 +1,7 @@+---+'@astryxdesign/core': patch+---++[feat] AvatarGroup: expose `size` on the `avatar-group-overflow` theming target so themes can style the "+N" overflow chip per size (matching `avatar-fallback`); the default chip font is unchanged.++@freddymetadiff --git a/packages/core/src/AvatarGroup/AvatarGroup.doc.mjs b/packages/core/src/AvatarGroup/AvatarGroup.doc.mjsindex 444494b4e6..9b7dd48f4c 100644--- a/packages/core/src/AvatarGroup/AvatarGroup.doc.mjs+++ b/packages/core/src/AvatarGroup/AvatarGroup.doc.mjs@@ -25,7 +25,7 @@ export const docs = {theming: {targets: [{className: 'astryx-avatar-group', visualProps: ['size']},- {className: 'astryx-avatar-group-overflow'},+ {className: 'astryx-avatar-group-overflow', visualProps: ['size']},],},description: 'Stacked avatar display with overlapping layout and optional overflow indicator. Children are Avatar elements.',diff --git a/packages/core/src/AvatarGroup/AvatarGroup.test.tsx b/packages/core/src/AvatarGroup/AvatarGroup.test.tsxindex e578895b22..d3393f7cdc 100644--- a/packages/core/src/AvatarGroup/AvatarGroup.test.tsx+++ b/packages/core/src/AvatarGroup/AvatarGroup.test.tsx@@ -104,6 +104,20 @@ describe('AvatarGroupOverflow', () => {expect(overflow).toHaveTextContent('+5');});+ it('applies the group size class to the overflow chip', () => {+ render(+ <AvatarGroup size="lg">+ <Avatar name="Alice" />+ <AvatarGroupOverflow count={5} />+ </AvatarGroup>,+ );++ const overflow = screen.getByLabelText('5 more');+ expect(overflow.className).toContain('astryx-avatar-group-overflow');+ expect(overflow.className).toContain('lg');+ expect(overflow).toHaveAttribute('data-size', 'lg');+ });+it('renders as button when onClick is provided', () => {render(<AvatarGroup>diff --git a/packages/core/src/AvatarGroup/AvatarGroupOverflow.tsx b/packages/core/src/AvatarGroup/AvatarGroupOverflow.tsxindex 2632ac89d3..cffc6848c0 100644--- a/packages/core/src/AvatarGroup/AvatarGroupOverflow.tsx+++ b/packages/core/src/AvatarGroup/AvatarGroupOverflow.tsx@@ -146,6 +146,7 @@ export function AvatarGroupOverflow({}: AvatarGroupOverflowProps): ReactNode {const t = useTranslator();const group = useAvatarGroup();+ const size = group?.size ?? 'md';const numericSize = group?.numericSize ?? 36;const overlap = group?.overlap ?? 0;@@ -162,7 +163,7 @@ export function AvatarGroupOverflow({aria-label={label}data-avatar-item=""{...mergeProps(- themeProps('avatar-group-overflow'),+ themeProps('avatar-group-overflow', {size}),focusOutlineProps.focusVisible(styles.base,styles.button,@@ -186,7 +187,7 @@ export function AvatarGroupOverflow({{...rest}aria-label={label}{...mergeProps(- themeProps('avatar-group-overflow'),+ themeProps('avatar-group-overflow', {size}),stylex.props(styles.base,styles.overlap,