@vaadin/avatar-group 24.6.0-alpha8 → 24.6.0-beta1

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.
@@ -0,0 +1,51 @@
1
+ /**
2
+ * @license
3
+ * Copyright (c) 2020 - 2024 Vaadin Ltd.
4
+ * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
+ */
6
+ import { css } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
7
+
8
+ export const avatarGroupStyles = css`
9
+ :host {
10
+ display: block;
11
+ width: 100%; /* prevent collapsing inside non-stretching column flex */
12
+ --vaadin-avatar-group-overlap: 8px;
13
+ --vaadin-avatar-group-overlap-border: 2px;
14
+ }
15
+
16
+ :host([hidden]) {
17
+ display: none !important;
18
+ }
19
+
20
+ [part='container'] {
21
+ display: flex;
22
+ position: relative;
23
+ width: 100%;
24
+ flex-wrap: nowrap;
25
+ }
26
+
27
+ ::slotted(vaadin-avatar:not(:first-child)) {
28
+ -webkit-mask-image: url('data:image/svg+xml;utf8,<svg viewBox=%220 0 300 300%22 fill=%22none%22 xmlns=%22http://www.w3.org/2000/svg%22><path fill-rule=%22evenodd%22 clip-rule=%22evenodd%22 d=%22M300 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%22 fill=%22black%22/></svg>');
29
+ mask-image: url('data:image/svg+xml;utf8,<svg viewBox=%220 0 300 300%22 fill=%22none%22 xmlns=%22http://www.w3.org/2000/svg%22><path fill-rule=%22evenodd%22 clip-rule=%22evenodd%22 d=%22M300 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%22 fill=%22black%22/></svg>');
30
+ -webkit-mask-size: calc(
31
+ 300% + var(--vaadin-avatar-group-overlap-border) * 6 - var(--vaadin-avatar-outline-width) * 6
32
+ );
33
+ mask-size: calc(300% + var(--vaadin-avatar-group-overlap-border) * 6 - var(--vaadin-avatar-outline-width) * 6);
34
+ }
35
+
36
+ ::slotted(vaadin-avatar:not([dir='rtl']):not(:first-child)) {
37
+ margin-left: calc(var(--vaadin-avatar-group-overlap) * -1 - var(--vaadin-avatar-outline-width));
38
+ -webkit-mask-position: calc(50% - var(--vaadin-avatar-size) + var(--vaadin-avatar-group-overlap));
39
+ mask-position: calc(50% - var(--vaadin-avatar-size) + var(--vaadin-avatar-group-overlap));
40
+ }
41
+
42
+ ::slotted(vaadin-avatar[dir='rtl']:not(:first-child)) {
43
+ margin-right: calc(var(--vaadin-avatar-group-overlap) * -1);
44
+ -webkit-mask-position: calc(
45
+ 50% + var(--vaadin-avatar-size) - var(--vaadin-avatar-group-overlap) + var(--vaadin-avatar-outline-width)
46
+ );
47
+ mask-position: calc(
48
+ 50% + var(--vaadin-avatar-size) - var(--vaadin-avatar-group-overlap) + var(--vaadin-avatar-outline-width)
49
+ );
50
+ }
51
+ `;
@@ -6,28 +6,10 @@
6
6
  import { AvatarI18n } from '@vaadin/avatar/src/vaadin-avatar.js';
7
7
  import { ControllerMixin } from '@vaadin/component-base/src/controller-mixin.js';
8
8
  import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
9
- import { OverlayClassMixin } from '@vaadin/component-base/src/overlay-class-mixin.js';
10
- import { ResizeMixin } from '@vaadin/component-base/src/resize-mixin.js';
11
9
  import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
10
+ import { AvatarGroupI18n, AvatarGroupItem, AvatarGroupMixin } from './vaadin-avatar-group-mixin.js';
12
11
 
13
- export { AvatarI18n };
14
-
15
- export interface AvatarGroupI18n extends AvatarI18n {
16
- activeUsers: {
17
- one: string;
18
- many: string;
19
- };
20
- joined: string;
21
- left: string;
22
- }
23
-
24
- export interface AvatarGroupItem {
25
- name?: string;
26
- abbr?: string;
27
- img?: string;
28
- colorIndex?: number;
29
- className?: string;
30
- }
12
+ export { AvatarGroupI18n, AvatarGroupItem, AvatarI18n };
31
13
 
32
14
  /**
33
15
  * `<vaadin-avatar-group>` is a Web Component providing avatar group displaying functionality.
@@ -69,73 +51,7 @@ export interface AvatarGroupItem {
69
51
  * - `<vaadin-avatar-group-menu>` - has the same API as [`<vaadin-list-box>`](#/elements/vaadin-list-box).
70
52
  * - `<vaadin-avatar-group-menu-item>` - has the same API as [`<vaadin-item>`](#/elements/vaadin-item).
71
53
  */
72
- declare class AvatarGroup extends ResizeMixin(
73
- OverlayClassMixin(ElementMixin(ThemableMixin(ControllerMixin(HTMLElement)))),
74
- ) {
75
- /**
76
- * An array containing the items which will be stamped as avatars.
77
- *
78
- * The items objects allow to configure [`name`](#/elements/vaadin-avatar#property-name),
79
- * [`abbr`](#/elements/vaadin-avatar#property-abbr), [`img`](#/elements/vaadin-avatar#property-img)
80
- * and [`colorIndex`](#/elements/vaadin-avatar#property-colorIndex) properties on the
81
- * stamped avatars, and set `className` to provide CSS class names.
82
- *
83
- * #### Example
84
- *
85
- * ```js
86
- * group.items = [
87
- * {
88
- * name: 'User name',
89
- * img: 'url-to-image.png',
90
- * className: 'even'
91
- * },
92
- * {
93
- * abbr: 'JD',
94
- * colorIndex: 1,
95
- * className: 'odd'
96
- * },
97
- * ];
98
- * ```
99
- */
100
- items: AvatarGroupItem[] | undefined;
101
-
102
- /**
103
- * The maximum number of avatars to display. By default, all the avatars are displayed.
104
- * When _maxItemsVisible_ is set, the overflowing avatars are grouped into one avatar with
105
- * a dropdown. Setting 0 or 1 has no effect so there are always at least two avatars visible.
106
- * @attr {number} max-items-visible
107
- */
108
- maxItemsVisible: number | null | undefined;
109
-
110
- /**
111
- * The object used to localize this component.
112
- * To change the default localization, replace the entire
113
- * _i18n_ object or just the property you want to modify.
114
- *
115
- * The object has the following JSON structure and default values:
116
- * ```
117
- * {
118
- * // Translation of the anonymous user avatar tooltip.
119
- * anonymous: 'anonymous',
120
- * // Translation of the avatar group accessible label.
121
- * // {count} is replaced with the actual count of users.
122
- * activeUsers: {
123
- * one: 'Currently one active user',
124
- * many: 'Currently {count} active users'
125
- * },
126
- * // Screen reader announcement when user joins group.
127
- * // {user} is replaced with the name or abbreviation.
128
- * // When neither is set, "anonymous" is used instead.
129
- * joined: '{user} joined',
130
- * // Screen reader announcement when user leaves group.
131
- * // {user} is replaced with the name or abbreviation.
132
- * // When neither is set, "anonymous" is used instead.
133
- * left: '{user} left'
134
- * }
135
- * ```
136
- */
137
- i18n: AvatarGroupI18n;
138
- }
54
+ declare class AvatarGroup extends AvatarGroupMixin(ElementMixin(ThemableMixin(ControllerMixin(HTMLElement)))) {}
139
55
 
140
56
  declare global {
141
57
  interface HTMLElementTagNameMap {