@vaadin/avatar-group
Advanced tools
Comparing version 23.0.10 to 23.0.11
{ | ||
"name": "@vaadin/avatar-group", | ||
"version": "23.0.10", | ||
"version": "23.0.11", | ||
"publishConfig": { | ||
@@ -38,10 +38,10 @@ "access": "public" | ||
"@polymer/polymer": "^3.0.0", | ||
"@vaadin/avatar": "^23.0.10", | ||
"@vaadin/component-base": "^23.0.10", | ||
"@vaadin/item": "^23.0.10", | ||
"@vaadin/list-box": "^23.0.10", | ||
"@vaadin/vaadin-lumo-styles": "^23.0.10", | ||
"@vaadin/vaadin-material-styles": "^23.0.10", | ||
"@vaadin/vaadin-overlay": "^23.0.10", | ||
"@vaadin/vaadin-themable-mixin": "^23.0.10" | ||
"@vaadin/avatar": "^23.0.11", | ||
"@vaadin/component-base": "^23.0.11", | ||
"@vaadin/item": "^23.0.11", | ||
"@vaadin/list-box": "^23.0.11", | ||
"@vaadin/vaadin-lumo-styles": "^23.0.11", | ||
"@vaadin/vaadin-material-styles": "^23.0.11", | ||
"@vaadin/vaadin-overlay": "^23.0.11", | ||
"@vaadin/vaadin-themable-mixin": "^23.0.11" | ||
}, | ||
@@ -53,3 +53,3 @@ "devDependencies": { | ||
}, | ||
"gitHead": "e8402a55ce0e823ae6da5c97486998cfd931b1d3" | ||
"gitHead": "10838304fe6f5c98b838ec3a90bdcf49cbf4650b" | ||
} |
@@ -7,19 +7,4 @@ /** | ||
import { OverlayElement } from '@vaadin/vaadin-overlay/src/vaadin-overlay.js'; | ||
import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js'; | ||
import { PositionMixin } from '@vaadin/vaadin-overlay/src/vaadin-overlay-position-mixin.js'; | ||
registerStyles( | ||
'vaadin-avatar-group-overlay', | ||
css` | ||
:host { | ||
align-items: flex-start; | ||
justify-content: flex-start; | ||
} | ||
:host([bottom-aligned]) { | ||
justify-content: flex-end; | ||
} | ||
`, | ||
{ moduleId: 'vaadin-avatar-group-overlay-styles' }, | ||
); | ||
/** | ||
@@ -31,3 +16,3 @@ * An element used internally by `<vaadin-avatar-group>`. Not intended to be used separately. | ||
*/ | ||
class AvatarGroupOverlay extends OverlayElement { | ||
class AvatarGroupOverlay extends PositionMixin(OverlayElement) { | ||
static get is() { | ||
@@ -34,0 +19,0 @@ return 'vaadin-avatar-group-overlay'; |
@@ -136,3 +136,8 @@ /** | ||
</div> | ||
<vaadin-avatar-group-overlay id="overlay" opened="{{_opened}}" on-vaadin-overlay-close="_onVaadinOverlayClose"> | ||
<vaadin-avatar-group-overlay | ||
id="overlay" | ||
opened="{{_opened}}" | ||
no-vertical-overlap | ||
on-vaadin-overlay-close="_onVaadinOverlayClose" | ||
> | ||
<template> | ||
@@ -283,5 +288,4 @@ <vaadin-avatar-group-list-box on-keydown="_onListKeyDown"> | ||
this.__boundSetPosition = this.__setPosition.bind(this); | ||
this._overlayElement = this.shadowRoot.querySelector('vaadin-avatar-group-overlay'); | ||
this._overlayElement.positionTarget = this.$.overflow; | ||
@@ -294,15 +298,2 @@ afterNextRender(this, () => { | ||
/** | ||
* @param {string} name | ||
* @param {?string} oldValue | ||
* @param {?string} newValue | ||
* @protected | ||
*/ | ||
attributeChangedCallback(name, oldValue, newValue) { | ||
super.attributeChangedCallback(name, oldValue, newValue); | ||
if (name === 'dir') { | ||
this.__setPosition(); | ||
} | ||
} | ||
/** | ||
* @return {!Array<!HTMLElement>} | ||
@@ -353,3 +344,2 @@ * @protected | ||
this.__setItemsInView(); | ||
this.__setPosition(); | ||
} | ||
@@ -497,4 +487,2 @@ | ||
this._menuElement.focus(); | ||
this.__setPosition(); | ||
window.addEventListener('scroll', this.__boundSetPosition, true); | ||
} else if (wasOpened) { | ||
@@ -505,3 +493,2 @@ this.$.overflow.focus(); | ||
} | ||
window.removeEventListener('scroll', this.__boundSetPosition, true); | ||
} | ||
@@ -560,30 +547,2 @@ this.$.overflow.setAttribute('aria-expanded', opened === true); | ||
} | ||
/** @private */ | ||
__setPosition() { | ||
if (!this._opened) { | ||
return; | ||
} | ||
const btnRect = this.$.overflow.getBoundingClientRect(); | ||
const viewportHeight = Math.min(window.innerHeight, document.documentElement.clientHeight); | ||
const bottomAlign = btnRect.top > (viewportHeight - btnRect.height) / 2; | ||
const isRtl = this.getAttribute('dir') === 'rtl'; | ||
if (isRtl) { | ||
this._overlayElement.style.right = document.documentElement.clientWidth - btnRect.right + 'px'; | ||
} else { | ||
this._overlayElement.style.left = btnRect.left + 'px'; | ||
} | ||
if (bottomAlign) { | ||
this._overlayElement.setAttribute('bottom-aligned', ''); | ||
this._overlayElement.style.removeProperty('top'); | ||
this._overlayElement.style.bottom = viewportHeight - btnRect.top + 'px'; | ||
} else { | ||
this._overlayElement.removeAttribute('bottom-aligned'); | ||
this._overlayElement.style.removeProperty('bottom'); | ||
this._overlayElement.style.top = btnRect.bottom + 'px'; | ||
} | ||
} | ||
} | ||
@@ -590,0 +549,0 @@ |
import '@vaadin/avatar/theme/lumo/vaadin-avatar.js'; | ||
import '@vaadin/item/theme/lumo/vaadin-item.js'; | ||
import '@vaadin/list-box/theme/lumo/vaadin-list-box.js'; | ||
import '@vaadin/vaadin-overlay/theme/lumo/vaadin-overlay.js'; | ||
import './vaadin-avatar-group-styles.js'; | ||
import '../../src/vaadin-avatar-group.js'; |
import '@vaadin/avatar/theme/material/vaadin-avatar.js'; | ||
import '@vaadin/item/theme/material/vaadin-item.js'; | ||
import '@vaadin/list-box/theme/material/vaadin-list-box.js'; | ||
import '@vaadin/vaadin-overlay/theme/material/vaadin-overlay.js'; | ||
import './vaadin-avatar-group-styles.js'; | ||
import '../../src/vaadin-avatar-group.js'; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
42470
28008
799
10
27
1
130