@vaadin/avatar-group 23.1.0-alpha3 → 23.1.0-beta2
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/avatar-group",
|
|
3
|
-
"version": "23.1.0-
|
|
3
|
+
"version": "23.1.0-beta2",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -35,19 +35,19 @@
|
|
|
35
35
|
],
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@polymer/polymer": "^3.0.0",
|
|
38
|
-
"@vaadin/avatar": "23.1.0-
|
|
39
|
-
"@vaadin/component-base": "23.1.0-
|
|
40
|
-
"@vaadin/item": "23.1.0-
|
|
41
|
-
"@vaadin/list-box": "23.1.0-
|
|
42
|
-
"@vaadin/vaadin-lumo-styles": "23.1.0-
|
|
43
|
-
"@vaadin/vaadin-material-styles": "23.1.0-
|
|
44
|
-
"@vaadin/vaadin-overlay": "23.1.0-
|
|
45
|
-
"@vaadin/vaadin-themable-mixin": "23.1.0-
|
|
38
|
+
"@vaadin/avatar": "23.1.0-beta2",
|
|
39
|
+
"@vaadin/component-base": "23.1.0-beta2",
|
|
40
|
+
"@vaadin/item": "23.1.0-beta2",
|
|
41
|
+
"@vaadin/list-box": "23.1.0-beta2",
|
|
42
|
+
"@vaadin/vaadin-lumo-styles": "23.1.0-beta2",
|
|
43
|
+
"@vaadin/vaadin-material-styles": "23.1.0-beta2",
|
|
44
|
+
"@vaadin/vaadin-overlay": "23.1.0-beta2",
|
|
45
|
+
"@vaadin/vaadin-themable-mixin": "23.1.0-beta2"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@esm-bundle/chai": "^4.3.4",
|
|
49
49
|
"@vaadin/testing-helpers": "^0.3.2",
|
|
50
50
|
"sinon": "^13.0.2"
|
|
51
51
|
},
|
|
52
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "f11f9245a0b5e6bf912725a501c27c24b74e7c8d"
|
|
53
53
|
}
|
|
@@ -190,7 +190,7 @@ class AvatarGroup extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement)
|
|
|
190
190
|
* @type {!Array<!AvatarGroupItem> | undefined}
|
|
191
191
|
*/
|
|
192
192
|
items: {
|
|
193
|
-
type: Array
|
|
193
|
+
type: Array,
|
|
194
194
|
},
|
|
195
195
|
|
|
196
196
|
/**
|
|
@@ -199,7 +199,7 @@ class AvatarGroup extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement)
|
|
|
199
199
|
* a dropdown. Setting 0 or 1 has no effect so there are always at least two avatars visible.
|
|
200
200
|
*/
|
|
201
201
|
maxItemsVisible: {
|
|
202
|
-
type: Number
|
|
202
|
+
type: Number,
|
|
203
203
|
},
|
|
204
204
|
|
|
205
205
|
/**
|
|
@@ -238,32 +238,32 @@ class AvatarGroup extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement)
|
|
|
238
238
|
anonymous: 'anonymous',
|
|
239
239
|
activeUsers: {
|
|
240
240
|
one: 'Currently one active user',
|
|
241
|
-
many: 'Currently {count} active users'
|
|
241
|
+
many: 'Currently {count} active users',
|
|
242
242
|
},
|
|
243
243
|
joined: '{user} joined',
|
|
244
|
-
left: '{user} left'
|
|
244
|
+
left: '{user} left',
|
|
245
245
|
};
|
|
246
|
-
}
|
|
246
|
+
},
|
|
247
247
|
},
|
|
248
248
|
|
|
249
249
|
/** @private */
|
|
250
250
|
__maxReached: {
|
|
251
251
|
type: Boolean,
|
|
252
|
-
computed: '__computeMaxReached(items.length, maxItemsVisible)'
|
|
252
|
+
computed: '__computeMaxReached(items.length, maxItemsVisible)',
|
|
253
253
|
},
|
|
254
254
|
|
|
255
255
|
/** @private */
|
|
256
256
|
__itemsInView: {
|
|
257
257
|
type: Number,
|
|
258
|
-
value: null
|
|
258
|
+
value: null,
|
|
259
259
|
},
|
|
260
260
|
|
|
261
261
|
/** @private */
|
|
262
262
|
_opened: {
|
|
263
263
|
type: Boolean,
|
|
264
264
|
observer: '__openedChanged',
|
|
265
|
-
value: false
|
|
266
|
-
}
|
|
265
|
+
value: false,
|
|
266
|
+
},
|
|
267
267
|
};
|
|
268
268
|
}
|
|
269
269
|
|
|
@@ -271,7 +271,7 @@ class AvatarGroup extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement)
|
|
|
271
271
|
return [
|
|
272
272
|
'__computeMoreTitle(items.length, __itemsInView, maxItemsVisible)',
|
|
273
273
|
'__itemsChanged(items.splices, items.*)',
|
|
274
|
-
'__i18nItemsChanged(i18n.*, items.length)'
|
|
274
|
+
'__i18nItemsChanged(i18n.*, items.length)',
|
|
275
275
|
];
|
|
276
276
|
}
|
|
277
277
|
|
|
@@ -352,7 +352,7 @@ class AvatarGroup extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement)
|
|
|
352
352
|
|
|
353
353
|
/** @private */
|
|
354
354
|
_onVaadinOverlayClose(e) {
|
|
355
|
-
if (e.detail.sourceEvent && e.detail.sourceEvent.composedPath().
|
|
355
|
+
if (e.detail.sourceEvent && e.detail.sourceEvent.composedPath().includes(this)) {
|
|
356
356
|
e.preventDefault();
|
|
357
357
|
}
|
|
358
358
|
}
|
|
@@ -399,14 +399,14 @@ class AvatarGroup extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement)
|
|
|
399
399
|
result.push(item.name || item.abbr || 'anonymous');
|
|
400
400
|
}
|
|
401
401
|
}
|
|
402
|
-
//
|
|
402
|
+
// Override generated title attribute
|
|
403
403
|
this.$.overflow.setAttribute('title', result.join('\n'));
|
|
404
404
|
}
|
|
405
405
|
|
|
406
406
|
/** @private */
|
|
407
407
|
__getLimit(items, itemsInView, maxItemsVisible) {
|
|
408
408
|
let limit = null;
|
|
409
|
-
//
|
|
409
|
+
// Handle max set to 0 or 1
|
|
410
410
|
const adjustedMax = this.__getMax(maxItemsVisible);
|
|
411
411
|
if (maxItemsVisible != null && adjustedMax < items) {
|
|
412
412
|
limit = adjustedMax - 1;
|
|
@@ -428,13 +428,13 @@ class AvatarGroup extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement)
|
|
|
428
428
|
this.$.items.render();
|
|
429
429
|
this.__setItemsInView();
|
|
430
430
|
|
|
431
|
-
//
|
|
431
|
+
// Mutation using group.splice('items')
|
|
432
432
|
if (splices && Array.isArray(splices.indexSplices)) {
|
|
433
433
|
splices.indexSplices.forEach((mutation) => {
|
|
434
434
|
this.__announceItemsChange(items, mutation);
|
|
435
435
|
});
|
|
436
436
|
} else if (Array.isArray(items) && Array.isArray(this.__oldItems)) {
|
|
437
|
-
//
|
|
437
|
+
// Mutation using group.set('items')
|
|
438
438
|
const diff = calculateSplices(items, this.__oldItems);
|
|
439
439
|
diff.forEach((mutation) => {
|
|
440
440
|
this.__announceItemsChange(items, mutation);
|
|
@@ -507,26 +507,26 @@ class AvatarGroup extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement)
|
|
|
507
507
|
const avatars = this._avatars;
|
|
508
508
|
const items = this.items;
|
|
509
509
|
|
|
510
|
-
//
|
|
510
|
+
// Always show at least two avatars
|
|
511
511
|
if (!items || !avatars || avatars.length < 3) {
|
|
512
512
|
return;
|
|
513
513
|
}
|
|
514
514
|
|
|
515
515
|
let result = this.__calculateAvatarsFitWidth();
|
|
516
516
|
|
|
517
|
-
//
|
|
517
|
+
// Only show overlay if two or more avatars don't fit
|
|
518
518
|
if (result === items.length - 1) {
|
|
519
519
|
result = items.length;
|
|
520
520
|
}
|
|
521
521
|
|
|
522
|
-
//
|
|
522
|
+
// Close overlay if all avatars become visible
|
|
523
523
|
if (result >= items.length && this._opened) {
|
|
524
524
|
this.$.overlay.close();
|
|
525
525
|
// FIXME: hack to avoid jump before closing
|
|
526
526
|
this.$.overlay._flushAnimation('closing');
|
|
527
527
|
}
|
|
528
528
|
|
|
529
|
-
//
|
|
529
|
+
// Reserve space for overflow avatar
|
|
530
530
|
this.__itemsInView = result;
|
|
531
531
|
}
|
|
532
532
|
|
|
@@ -538,14 +538,14 @@ class AvatarGroup extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement)
|
|
|
538
538
|
|
|
539
539
|
const avatars = this._avatars;
|
|
540
540
|
|
|
541
|
-
//
|
|
541
|
+
// Assume all the avatars have the same width
|
|
542
542
|
const avatarWidth = avatars[0].clientWidth;
|
|
543
543
|
|
|
544
|
-
//
|
|
544
|
+
// Take negative margin into account
|
|
545
545
|
const { marginLeft, marginRight } = getComputedStyle(avatars[1]);
|
|
546
546
|
|
|
547
547
|
const offset =
|
|
548
|
-
this.getAttribute('dir')
|
|
548
|
+
this.getAttribute('dir') === 'rtl'
|
|
549
549
|
? parseInt(marginRight, 0) - parseInt(marginLeft, 0)
|
|
550
550
|
: parseInt(marginLeft, 0) - parseInt(marginRight, 0);
|
|
551
551
|
|
|
@@ -564,19 +564,19 @@ class AvatarGroup extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement)
|
|
|
564
564
|
const isRtl = this.getAttribute('dir') === 'rtl';
|
|
565
565
|
|
|
566
566
|
if (isRtl) {
|
|
567
|
-
this._overlayElement.style.right = document.documentElement.clientWidth - btnRect.right
|
|
567
|
+
this._overlayElement.style.right = `${document.documentElement.clientWidth - btnRect.right}px`;
|
|
568
568
|
} else {
|
|
569
|
-
this._overlayElement.style.left = btnRect.left
|
|
569
|
+
this._overlayElement.style.left = `${btnRect.left}px`;
|
|
570
570
|
}
|
|
571
571
|
|
|
572
572
|
if (bottomAlign) {
|
|
573
573
|
this._overlayElement.setAttribute('bottom-aligned', '');
|
|
574
574
|
this._overlayElement.style.removeProperty('top');
|
|
575
|
-
this._overlayElement.style.bottom = viewportHeight - btnRect.top
|
|
575
|
+
this._overlayElement.style.bottom = `${viewportHeight - btnRect.top}px`;
|
|
576
576
|
} else {
|
|
577
577
|
this._overlayElement.removeAttribute('bottom-aligned');
|
|
578
578
|
this._overlayElement.style.removeProperty('bottom');
|
|
579
|
-
this._overlayElement.style.top = btnRect.bottom
|
|
579
|
+
this._overlayElement.style.top = `${btnRect.bottom}px`;
|
|
580
580
|
}
|
|
581
581
|
}
|
|
582
582
|
}
|
|
@@ -44,7 +44,7 @@ registerStyles(
|
|
|
44
44
|
--vaadin-avatar-size: var(--lumo-size-xs);
|
|
45
45
|
}
|
|
46
46
|
`,
|
|
47
|
-
{ moduleId: 'lumo-avatar-group' }
|
|
47
|
+
{ moduleId: 'lumo-avatar-group' },
|
|
48
48
|
);
|
|
49
49
|
|
|
50
50
|
const avatarGroupOverlay = css`
|
|
@@ -59,7 +59,7 @@ const avatarGroupOverlay = css`
|
|
|
59
59
|
`;
|
|
60
60
|
|
|
61
61
|
registerStyles('vaadin-avatar-group-overlay', [overlay, menuOverlayCore, avatarGroupOverlay], {
|
|
62
|
-
moduleId: 'lumo-avatar-group-overlay'
|
|
62
|
+
moduleId: 'lumo-avatar-group-overlay',
|
|
63
63
|
});
|
|
64
64
|
|
|
65
65
|
registerStyles(
|
|
@@ -75,7 +75,7 @@ registerStyles(
|
|
|
75
75
|
padding-left: var(--lumo-space-m);
|
|
76
76
|
}
|
|
77
77
|
`,
|
|
78
|
-
{ moduleId: 'lumo-avatar-group-list-box' }
|
|
78
|
+
{ moduleId: 'lumo-avatar-group-list-box' },
|
|
79
79
|
);
|
|
80
80
|
|
|
81
81
|
registerStyles(
|
|
@@ -99,5 +99,5 @@ registerStyles(
|
|
|
99
99
|
margin-left: var(--lumo-space-s);
|
|
100
100
|
}
|
|
101
101
|
`,
|
|
102
|
-
{ moduleId: 'lumo-avatar-group-item' }
|
|
102
|
+
{ moduleId: 'lumo-avatar-group-item' },
|
|
103
103
|
);
|
|
@@ -9,7 +9,7 @@ const avatarGroupOverlay = css`
|
|
|
9
9
|
`;
|
|
10
10
|
|
|
11
11
|
registerStyles('vaadin-avatar-group-overlay', [menuOverlay, avatarGroupOverlay], {
|
|
12
|
-
moduleId: 'material-avatar-group-overlay'
|
|
12
|
+
moduleId: 'material-avatar-group-overlay',
|
|
13
13
|
});
|
|
14
14
|
|
|
15
15
|
registerStyles(
|
|
@@ -25,7 +25,7 @@ registerStyles(
|
|
|
25
25
|
padding-left: 24px;
|
|
26
26
|
}
|
|
27
27
|
`,
|
|
28
|
-
{ moduleId: 'material-avatar-group-list-box' }
|
|
28
|
+
{ moduleId: 'material-avatar-group-list-box' },
|
|
29
29
|
);
|
|
30
30
|
|
|
31
31
|
registerStyles(
|
|
@@ -48,5 +48,5 @@ registerStyles(
|
|
|
48
48
|
margin-left: 8px;
|
|
49
49
|
}
|
|
50
50
|
`,
|
|
51
|
-
{ moduleId: 'material-avatar-group-item' }
|
|
51
|
+
{ moduleId: 'material-avatar-group-item' },
|
|
52
52
|
);
|