New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@vaadin/vaadin-menu-bar

Package Overview
Dependencies
Maintainers
18
Versions
255
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vaadin/vaadin-menu-bar - npm Package Compare versions

Comparing version 1.2.1 to 1.2.2

2

package.json

@@ -13,3 +13,3 @@ {

"name": "@vaadin/vaadin-menu-bar",
"version": "1.2.1",
"version": "1.2.2",
"main": "vaadin-menu-bar.js",

@@ -16,0 +16,0 @@ "author": "Vaadin Ltd",

@@ -86,5 +86,24 @@ /**

const overflow = buttons.pop();
const containerWidth = container.offsetWidth;
const isRTL = this.getAttribute('dir') === 'rtl';
// optional chaining is not supported in IE
const previouslyOverflowingButtons = (overflow.item && overflow.item.children && overflow.item.children.length) || 0;
// reset all buttons in the menu bar and the overflow button
for (let i = 0; i < buttons.length; i++) {
const btn = buttons[i];
btn.disabled = btn.item.disabled;
btn.style.visibility = '';
btn.style.position = '';
// teleport item component back from "overflow" sub-menu
const item = btn.item && btn.item.component;
if (item instanceof HTMLElement && item.classList.contains('vaadin-menu-item')) {
btn.appendChild(item);
item.classList.remove('vaadin-menu-item');
}
}
overflow.item = {children: []};
this._hasOverflow = false;
// hide any overflowing buttons and put them in the 'overflow' button
if (container.offsetWidth < container.scrollWidth) {

@@ -97,9 +116,7 @@ this._hasOverflow = true;

const btnStyle = getComputedStyle(btn);
if (btnStyle.visibility === 'hidden') {
continue;
}
const btnWidth = btn.offsetWidth;
// if this button isn't overflowing, then the rest aren't either
if (
(!isRTL && (btn.offsetLeft + btnWidth) < (containerWidth - overflow.offsetWidth)) ||
(!isRTL && (btn.offsetLeft + btnWidth) < (container.offsetWidth - overflow.offsetWidth)) ||
(isRTL && btn.offsetLeft >= overflow.offsetWidth)

@@ -119,44 +136,8 @@ ) {

};
} else if (this._hasOverflow) {
if (this._subMenu.opened) {
this._subMenu.close();
}
for (let i = 0; i < buttons.length; i++) {
const btn = buttons[i];
const btnWidth = btn.getBoundingClientRect().width;
if (getComputedStyle(btn).visibility !== 'hidden') {
continue;
}
if (
(!isRTL && (overflow.offsetLeft + overflow.offsetWidth + btnWidth) < containerWidth) ||
(isRTL && (btnWidth < overflow.offsetLeft))
) {
btn.disabled = btn.item.disabled;
btn.style.visibility = '';
btn.style.position = '';
btn.style.width = '';
// teleport item component back from "overflow" sub-menu
const item = btn.item && btn.item.component;
if (item instanceof HTMLElement && item.classList.contains('vaadin-menu-item')) {
btn.appendChild(item);
item.classList.remove('vaadin-menu-item');
}
overflow.item = {
children: buttons.filter((b, idx) => idx >= i + 1).map(b => b.item)
};
if (btn === buttons[buttons.length - 1]) {
this._hasOverflow = false;
overflow.item = {children: []};
}
} else {
break;
}
}
}
// optional chaining is not supported in IE
const currentlyOverflowingItems = (overflow.item && overflow.item.children && overflow.item.children.length) || 0;
if (previouslyOverflowingButtons !== currentlyOverflowingItems && this._subMenu.opened) {
this._subMenu.close();
}
}

@@ -163,0 +144,0 @@

@@ -106,3 +106,3 @@ /**

static get version() {
return '1.2.1';
return '1.2.2';
}

@@ -109,0 +109,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc