@vaadin/avatar-group 23.0.10 → 23.0.11

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.0.10",
3
+ "version": "23.0.11",
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.0.10",
39
- "@vaadin/component-base": "^23.0.10",
40
- "@vaadin/item": "^23.0.10",
41
- "@vaadin/list-box": "^23.0.10",
42
- "@vaadin/vaadin-lumo-styles": "^23.0.10",
43
- "@vaadin/vaadin-material-styles": "^23.0.10",
44
- "@vaadin/vaadin-overlay": "^23.0.10",
45
- "@vaadin/vaadin-themable-mixin": "^23.0.10"
38
+ "@vaadin/avatar": "^23.0.11",
39
+ "@vaadin/component-base": "^23.0.11",
40
+ "@vaadin/item": "^23.0.11",
41
+ "@vaadin/list-box": "^23.0.11",
42
+ "@vaadin/vaadin-lumo-styles": "^23.0.11",
43
+ "@vaadin/vaadin-material-styles": "^23.0.11",
44
+ "@vaadin/vaadin-overlay": "^23.0.11",
45
+ "@vaadin/vaadin-themable-mixin": "^23.0.11"
46
46
  },
47
47
  "devDependencies": {
48
48
  "@esm-bundle/chai": "^4.3.4",
49
49
  "@vaadin/testing-helpers": "^0.3.2",
50
50
  "sinon": "^9.2.1"
51
51
  },
52
- "gitHead": "e8402a55ce0e823ae6da5c97486998cfd931b1d3"
52
+ "gitHead": "10838304fe6f5c98b838ec3a90bdcf49cbf4650b"
53
53
  }
@@ -4,22 +4,7 @@
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import { OverlayElement } from '@vaadin/vaadin-overlay/src/vaadin-overlay.js';
7
- import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
8
-
9
- registerStyles(
10
- 'vaadin-avatar-group-overlay',
11
- css`
12
- :host {
13
- align-items: flex-start;
14
- justify-content: flex-start;
15
- }
16
-
17
- :host([bottom-aligned]) {
18
- justify-content: flex-end;
19
- }
20
- `,
21
- { moduleId: 'vaadin-avatar-group-overlay-styles' },
22
- );
7
+ import { PositionMixin } from '@vaadin/vaadin-overlay/src/vaadin-overlay-position-mixin.js';
23
8
 
24
9
  /**
25
10
  * An element used internally by `<vaadin-avatar-group>`. Not intended to be used separately.
@@ -27,7 +12,7 @@ registerStyles(
27
12
  * @extends OverlayElement
28
13
  * @private
29
14
  */
30
- class AvatarGroupOverlay extends OverlayElement {
15
+ class AvatarGroupOverlay extends PositionMixin(OverlayElement) {
31
16
  static get is() {
32
17
  return 'vaadin-avatar-group-overlay';
33
18
  }
@@ -133,7 +133,12 @@ class AvatarGroup extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement)
133
133
  aria-haspopup="listbox"
134
134
  ></vaadin-avatar>
135
135
  </div>
136
- <vaadin-avatar-group-overlay id="overlay" opened="{{_opened}}" on-vaadin-overlay-close="_onVaadinOverlayClose">
136
+ <vaadin-avatar-group-overlay
137
+ id="overlay"
138
+ opened="{{_opened}}"
139
+ no-vertical-overlap
140
+ on-vaadin-overlay-close="_onVaadinOverlayClose"
141
+ >
137
142
  <template>
138
143
  <vaadin-avatar-group-list-box on-keydown="_onListKeyDown">
139
144
  <template is="dom-repeat" items="[[__computeExtraItems(items.*, __itemsInView, maxItemsVisible)]]">
@@ -279,28 +284,14 @@ class AvatarGroup extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement)
279
284
  ready() {
280
285
  super.ready();
281
286
 
282
- this.__boundSetPosition = this.__setPosition.bind(this);
283
-
284
287
  this._overlayElement = this.shadowRoot.querySelector('vaadin-avatar-group-overlay');
288
+ this._overlayElement.positionTarget = this.$.overflow;
285
289
 
286
290
  afterNextRender(this, () => {
287
291
  this.__setItemsInView();
288
292
  });
289
293
  }
290
294
 
291
- /**
292
- * @param {string} name
293
- * @param {?string} oldValue
294
- * @param {?string} newValue
295
- * @protected
296
- */
297
- attributeChangedCallback(name, oldValue, newValue) {
298
- super.attributeChangedCallback(name, oldValue, newValue);
299
- if (name === 'dir') {
300
- this.__setPosition();
301
- }
302
- }
303
-
304
295
  /**
305
296
  * @return {!Array<!HTMLElement>}
306
297
  * @protected
@@ -347,7 +338,6 @@ class AvatarGroup extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement)
347
338
  */
348
339
  _onResize() {
349
340
  this.__setItemsInView();
350
- this.__setPosition();
351
341
  }
352
342
 
353
343
  /** @private */
@@ -490,14 +480,11 @@ class AvatarGroup extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement)
490
480
  avatars.forEach((avatar) => avatar.removeAttribute('title'));
491
481
 
492
482
  this._menuElement.focus();
493
- this.__setPosition();
494
- window.addEventListener('scroll', this.__boundSetPosition, true);
495
483
  } else if (wasOpened) {
496
484
  this.$.overflow.focus();
497
485
  if (this._openedWithFocusRing) {
498
486
  this.$.overflow.setAttribute('focus-ring', '');
499
487
  }
500
- window.removeEventListener('scroll', this.__boundSetPosition, true);
501
488
  }
502
489
  this.$.overflow.setAttribute('aria-expanded', opened === true);
503
490
  }
@@ -551,34 +538,6 @@ class AvatarGroup extends ResizeMixin(ElementMixin(ThemableMixin(PolymerElement)
551
538
 
552
539
  return Math.floor((this.$.container.offsetWidth - avatarWidth) / (avatarWidth + offset));
553
540
  }
554
-
555
- /** @private */
556
- __setPosition() {
557
- if (!this._opened) {
558
- return;
559
- }
560
- const btnRect = this.$.overflow.getBoundingClientRect();
561
- const viewportHeight = Math.min(window.innerHeight, document.documentElement.clientHeight);
562
- const bottomAlign = btnRect.top > (viewportHeight - btnRect.height) / 2;
563
-
564
- const isRtl = this.getAttribute('dir') === 'rtl';
565
-
566
- if (isRtl) {
567
- this._overlayElement.style.right = document.documentElement.clientWidth - btnRect.right + 'px';
568
- } else {
569
- this._overlayElement.style.left = btnRect.left + 'px';
570
- }
571
-
572
- if (bottomAlign) {
573
- this._overlayElement.setAttribute('bottom-aligned', '');
574
- this._overlayElement.style.removeProperty('top');
575
- this._overlayElement.style.bottom = viewportHeight - btnRect.top + 'px';
576
- } else {
577
- this._overlayElement.removeAttribute('bottom-aligned');
578
- this._overlayElement.style.removeProperty('bottom');
579
- this._overlayElement.style.top = btnRect.bottom + 'px';
580
- }
581
- }
582
541
  }
583
542
 
584
543
  customElements.define(AvatarGroup.is, AvatarGroup);
@@ -1,5 +1,6 @@
1
1
  import '@vaadin/avatar/theme/lumo/vaadin-avatar.js';
2
2
  import '@vaadin/item/theme/lumo/vaadin-item.js';
3
3
  import '@vaadin/list-box/theme/lumo/vaadin-list-box.js';
4
+ import '@vaadin/vaadin-overlay/theme/lumo/vaadin-overlay.js';
4
5
  import './vaadin-avatar-group-styles.js';
5
6
  import '../../src/vaadin-avatar-group.js';
@@ -1,5 +1,6 @@
1
1
  import '@vaadin/avatar/theme/material/vaadin-avatar.js';
2
2
  import '@vaadin/item/theme/material/vaadin-item.js';
3
3
  import '@vaadin/list-box/theme/material/vaadin-list-box.js';
4
+ import '@vaadin/vaadin-overlay/theme/material/vaadin-overlay.js';
4
5
  import './vaadin-avatar-group-styles.js';
5
6
  import '../../src/vaadin-avatar-group.js';