Skip to content

Commit 5c92b50

Browse files
authored
feat!: add reverse variant for avatar group Lumo theme (#10437)
1 parent f97d916 commit 5c92b50

File tree

16 files changed

+26
-29
lines changed

16 files changed

+26
-29
lines changed

packages/avatar-group/src/styles/vaadin-avatar-group-base-styles.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,18 +33,19 @@ export const avatarGroupStyles = css`
3333
::slotted(vaadin-avatar) {
3434
--_overlap: max(0px, var(--vaadin-avatar-group-overlap, 8px));
3535
--_gap: max(0px, var(--vaadin-avatar-group-gap, 2px));
36-
mask-image: url('data:image/svg+xml;utf8,<svg viewBox="0 0 300 300" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M300 0H0V300H300V0ZM150 200C177.614 200 200 177.614 200 150C200 122.386 177.614 100 150 100C122.386 100 100 122.386 100 150C100 177.614 122.386 200 150 200Z" fill="black"/></svg>');
37-
mask-size: calc((100% - var(--vaadin-focus-ring-width) * 2) * 3);
38-
mask-position: calc(50% + (100% - var(--vaadin-focus-ring-width) * 2 - var(--_overlap)) * var(--_d));
36+
--_outline-width: var(--vaadin-focus-ring-width);
3937
--_d: var(--_dir);
38+
mask-image: url('data:image/svg+xml;utf8,<svg viewBox="0 0 300 300" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M300 0H0V300H300V0ZM150 200C177.614 200 200 177.614 200 150C200 122.386 177.614 100 150 100C122.386 100 100 122.386 100 150C100 177.614 122.386 200 150 200Z" fill="black"/></svg>');
39+
mask-size: calc((100% - var(--_outline-width) * 2) * 3);
40+
mask-position: calc(50% + (100% - var(--_outline-width) * 2 - var(--_overlap)) * var(--_d));
4041
}
4142
4243
:host(:dir(rtl)) ::slotted(vaadin-avatar) {
4344
--_d: calc(var(--_dir) * -1);
4445
}
4546
4647
::slotted(vaadin-avatar:not(:first-of-type)) {
47-
margin-inline-start: calc((var(--vaadin-focus-ring-width) + var(--_overlap) - var(--_gap)) * -1);
48+
margin-inline-start: calc((var(--_outline-width) + var(--_overlap) - var(--_gap)) * -1);
4849
}
4950
5051
:host(:not([theme~='reverse'])) ::slotted(vaadin-avatar:last-child),

packages/avatar-group/src/vaadin-avatar-group.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,10 @@ class AvatarGroup extends AvatarGroupMixin(ElementMixin(ThemableMixin(PolylitMix
7373
return avatarGroupStyles;
7474
}
7575

76+
static get lumoInjector() {
77+
return { ...super.lumoInjector, includeBaseStyles: true };
78+
}
79+
7680
/** @protected */
7781
render() {
7882
return html`

packages/avatar-group/test/visual/base/avatar-group.test.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@ describe('avatar-group', () => {
1717
await visualDiff(div, 'basic');
1818
});
1919

20+
it('reverse', async () => {
21+
element.items = [{ name: 'Abc Def' }, { name: 'Ghi Jkl' }, { name: 'Mno Pqr' }, { name: 'Stu Vwx' }];
22+
element.setAttribute('theme', 'reverse');
23+
await visualDiff(div, 'reverse');
24+
});
25+
2026
it('max-items-visible', async () => {
2127
element.maxItemsVisible = 3;
2228
element.items = [{ name: 'Abc Def' }, { name: 'Ghi Jkl' }, { name: 'Mno Pqr' }, { name: 'Stu Vwx' }];
1.82 KB
Loading

packages/avatar-group/test/visual/lumo/avatar-group.test.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@ describe('avatar-group', () => {
2020
await visualDiff(div, 'basic');
2121
});
2222

23+
it('reverse', async () => {
24+
element.items = [{ name: 'Abc Def' }, { name: 'Ghi Jkl' }, { name: 'Mno Pqr' }, { name: 'Stu Vwx' }];
25+
element.setAttribute('theme', 'reverse');
26+
await visualDiff(div, 'reverse');
27+
});
28+
2329
it('max-items-visible', async () => {
2430
element.maxItemsVisible = 3;
2531
element.items = [{ name: 'Abc Def' }, { name: 'Ghi Jkl' }, { name: 'Mno Pqr' }, { name: 'Stu Vwx' }];
-394 Bytes
Loading
-308 Bytes
Loading
-266 Bytes
Loading
-138 Bytes
Loading
-781 Bytes
Loading

0 commit comments

Comments
 (0)