@vaadin/tabs 23.0.0-alpha1 → 23.0.0-alpha2

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.
Files changed (2) hide show
  1. package/package.json +8 -9
  2. package/src/vaadin-tabs.js +24 -5
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vaadin/tabs",
3
- "version": "23.0.0-alpha1",
3
+ "version": "23.0.0-alpha2",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -32,19 +32,18 @@
32
32
  "polymer"
33
33
  ],
34
34
  "dependencies": {
35
- "@polymer/iron-resizable-behavior": "^3.0.0",
36
35
  "@polymer/polymer": "^3.0.0",
37
- "@vaadin/component-base": "23.0.0-alpha1",
38
- "@vaadin/item": "23.0.0-alpha1",
39
- "@vaadin/vaadin-list-mixin": "23.0.0-alpha1",
40
- "@vaadin/vaadin-lumo-styles": "23.0.0-alpha1",
41
- "@vaadin/vaadin-material-styles": "23.0.0-alpha1",
42
- "@vaadin/vaadin-themable-mixin": "23.0.0-alpha1"
36
+ "@vaadin/component-base": "23.0.0-alpha2",
37
+ "@vaadin/item": "23.0.0-alpha2",
38
+ "@vaadin/vaadin-list-mixin": "23.0.0-alpha2",
39
+ "@vaadin/vaadin-lumo-styles": "23.0.0-alpha2",
40
+ "@vaadin/vaadin-material-styles": "23.0.0-alpha2",
41
+ "@vaadin/vaadin-themable-mixin": "23.0.0-alpha2"
43
42
  },
44
43
  "devDependencies": {
45
44
  "@esm-bundle/chai": "^4.3.4",
46
45
  "@vaadin/testing-helpers": "^0.3.2",
47
46
  "sinon": "^9.2.1"
48
47
  },
49
- "gitHead": "fbcb07328fdf88260e3b461088d207426b21c710"
48
+ "gitHead": "070f586dead02ca41b66717820c647f48bf1665f"
50
49
  }
@@ -4,8 +4,6 @@
4
4
  * This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
5
5
  */
6
6
  import './vaadin-tab.js';
7
- import { IronResizableBehavior } from '@polymer/iron-resizable-behavior/iron-resizable-behavior.js';
8
- import { mixinBehaviors } from '@polymer/polymer/lib/legacy/class.js';
9
7
  import { afterNextRender } from '@polymer/polymer/lib/utils/render-status.js';
10
8
  import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
11
9
  import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
@@ -51,7 +49,7 @@ import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mix
51
49
  * @mixes ListMixin
52
50
  * @mixes ThemableMixin
53
51
  */
54
- class Tabs extends ElementMixin(ListMixin(ThemableMixin(mixinBehaviors([IronResizableBehavior], PolymerElement)))) {
52
+ class Tabs extends ElementMixin(ListMixin(ThemableMixin(PolymerElement))) {
55
53
  static get template() {
56
54
  return html`
57
55
  <style>
@@ -167,12 +165,19 @@ class Tabs extends ElementMixin(ListMixin(ThemableMixin(mixinBehaviors([IronResi
167
165
  }
168
166
 
169
167
  static get observers() {
170
- return ['_updateOverflow(items.*)'];
168
+ return ['__tabsItemsChanged(items, items.*)'];
169
+ }
170
+
171
+ constructor() {
172
+ super();
173
+
174
+ this.__resizeObserver = new ResizeObserver(() => {
175
+ requestAnimationFrame(() => this._updateOverflow());
176
+ });
171
177
  }
172
178
 
173
179
  ready() {
174
180
  super.ready();
175
- this.addEventListener('iron-resize', () => this._updateOverflow());
176
181
  this._scrollerElement.addEventListener('scroll', () => this._updateOverflow());
177
182
  this.setAttribute('role', 'tablist');
178
183
 
@@ -182,6 +187,20 @@ class Tabs extends ElementMixin(ListMixin(ThemableMixin(mixinBehaviors([IronResi
182
187
  });
183
188
  }
184
189
 
190
+ /** @private */
191
+ __tabsItemsChanged(items) {
192
+ // Disconnected to unobserve any removed items
193
+ this.__resizeObserver.disconnect();
194
+ this.__resizeObserver.observe(this);
195
+
196
+ // Observe current items
197
+ (items || []).forEach((item) => {
198
+ this.__resizeObserver.observe(item);
199
+ });
200
+
201
+ this._updateOverflow();
202
+ }
203
+
185
204
  /** @private */
186
205
  _scrollForward() {
187
206
  this._scroll(-this.__direction * this._scrollOffset);