@vaadin/tabs 22.0.2 → 23.0.0-alpha4
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 +9 -9
- package/src/vaadin-tab.d.ts +1 -1
- package/src/vaadin-tab.js +1 -1
- package/src/vaadin-tabs.d.ts +3 -2
- package/src/vaadin-tabs.js +34 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/tabs",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "23.0.0-alpha4",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
},
|
|
19
19
|
"main": "vaadin-tabs.js",
|
|
20
20
|
"module": "vaadin-tabs.js",
|
|
21
|
+
"type": "module",
|
|
21
22
|
"files": [
|
|
22
23
|
"src",
|
|
23
24
|
"theme",
|
|
@@ -32,19 +33,18 @@
|
|
|
32
33
|
"polymer"
|
|
33
34
|
],
|
|
34
35
|
"dependencies": {
|
|
35
|
-
"@polymer/iron-resizable-behavior": "^3.0.0",
|
|
36
36
|
"@polymer/polymer": "^3.0.0",
|
|
37
|
-
"@vaadin/component-base": "
|
|
38
|
-
"@vaadin/item": "
|
|
39
|
-
"@vaadin/vaadin-list-mixin": "
|
|
40
|
-
"@vaadin/vaadin-lumo-styles": "
|
|
41
|
-
"@vaadin/vaadin-material-styles": "
|
|
42
|
-
"@vaadin/vaadin-themable-mixin": "
|
|
37
|
+
"@vaadin/component-base": "23.0.0-alpha4",
|
|
38
|
+
"@vaadin/item": "23.0.0-alpha4",
|
|
39
|
+
"@vaadin/vaadin-list-mixin": "23.0.0-alpha4",
|
|
40
|
+
"@vaadin/vaadin-lumo-styles": "23.0.0-alpha4",
|
|
41
|
+
"@vaadin/vaadin-material-styles": "23.0.0-alpha4",
|
|
42
|
+
"@vaadin/vaadin-themable-mixin": "23.0.0-alpha4"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@esm-bundle/chai": "^4.3.4",
|
|
46
46
|
"@vaadin/testing-helpers": "^0.3.2",
|
|
47
47
|
"sinon": "^9.2.1"
|
|
48
48
|
},
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "81e2deee5147bb7c1f4884760f4598613306f1fb"
|
|
50
50
|
}
|
package/src/vaadin-tab.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c)
|
|
3
|
+
* Copyright (c) 2017 - 2022 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
|
package/src/vaadin-tab.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c)
|
|
3
|
+
* Copyright (c) 2017 - 2022 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
|
package/src/vaadin-tabs.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c)
|
|
3
|
+
* Copyright (c) 2017 - 2022 Vaadin Ltd.
|
|
4
4
|
* This program is available under Apache License Version 2.0, available at https://vaadin.com/license/
|
|
5
5
|
*/
|
|
6
6
|
import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
|
|
7
|
+
import { ResizeMixin } from '@vaadin/component-base/src/resize-mixin.js';
|
|
7
8
|
import { ListMixin } from '@vaadin/vaadin-list-mixin/vaadin-list-mixin.js';
|
|
8
9
|
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
9
10
|
|
|
@@ -61,7 +62,7 @@ export interface TabsEventMap extends HTMLElementEventMap, TabsCustomEventMap {}
|
|
|
61
62
|
* @fires {CustomEvent} items-changed - Fired when the `items` property changes.
|
|
62
63
|
* @fires {CustomEvent} selected-changed - Fired when the `selected` property changes.
|
|
63
64
|
*/
|
|
64
|
-
declare class Tabs extends ElementMixin(ListMixin(ThemableMixin(HTMLElement))) {
|
|
65
|
+
declare class Tabs extends ResizeMixin(ElementMixin(ListMixin(ThemableMixin(HTMLElement)))) {
|
|
65
66
|
/**
|
|
66
67
|
* The index of the selected tab.
|
|
67
68
|
*/
|
package/src/vaadin-tabs.js
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright (c)
|
|
3
|
+
* Copyright (c) 2017 - 2022 Vaadin Ltd.
|
|
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';
|
|
10
|
+
import { ResizeMixin } from '@vaadin/component-base/src/resize-mixin.js';
|
|
12
11
|
import { ListMixin } from '@vaadin/vaadin-list-mixin/vaadin-list-mixin.js';
|
|
13
12
|
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
14
13
|
|
|
@@ -50,8 +49,9 @@ import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mix
|
|
|
50
49
|
* @mixes ElementMixin
|
|
51
50
|
* @mixes ListMixin
|
|
52
51
|
* @mixes ThemableMixin
|
|
52
|
+
* @mixes ResizeMixin
|
|
53
53
|
*/
|
|
54
|
-
class Tabs extends ElementMixin(ListMixin(ThemableMixin(
|
|
54
|
+
class Tabs extends ResizeMixin(ElementMixin(ListMixin(ThemableMixin(PolymerElement)))) {
|
|
55
55
|
static get template() {
|
|
56
56
|
return html`
|
|
57
57
|
<style>
|
|
@@ -167,12 +167,19 @@ class Tabs extends ElementMixin(ListMixin(ThemableMixin(mixinBehaviors([IronResi
|
|
|
167
167
|
}
|
|
168
168
|
|
|
169
169
|
static get observers() {
|
|
170
|
-
return ['
|
|
170
|
+
return ['__tabsItemsChanged(items, items.*)'];
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
constructor() {
|
|
174
|
+
super();
|
|
175
|
+
|
|
176
|
+
this.__itemsResizeObserver = new ResizeObserver(() => {
|
|
177
|
+
setTimeout(() => this._updateOverflow());
|
|
178
|
+
});
|
|
171
179
|
}
|
|
172
180
|
|
|
173
181
|
ready() {
|
|
174
182
|
super.ready();
|
|
175
|
-
this.addEventListener('iron-resize', () => this._updateOverflow());
|
|
176
183
|
this._scrollerElement.addEventListener('scroll', () => this._updateOverflow());
|
|
177
184
|
this.setAttribute('role', 'tablist');
|
|
178
185
|
|
|
@@ -182,6 +189,27 @@ class Tabs extends ElementMixin(ListMixin(ThemableMixin(mixinBehaviors([IronResi
|
|
|
182
189
|
});
|
|
183
190
|
}
|
|
184
191
|
|
|
192
|
+
/**
|
|
193
|
+
* @protected
|
|
194
|
+
* @override
|
|
195
|
+
*/
|
|
196
|
+
_onResize() {
|
|
197
|
+
this._updateOverflow();
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/** @private */
|
|
201
|
+
__tabsItemsChanged(items) {
|
|
202
|
+
// Disconnected to unobserve any removed items
|
|
203
|
+
this.__itemsResizeObserver.disconnect();
|
|
204
|
+
|
|
205
|
+
// Observe current items
|
|
206
|
+
(items || []).forEach((item) => {
|
|
207
|
+
this.__itemsResizeObserver.observe(item);
|
|
208
|
+
});
|
|
209
|
+
|
|
210
|
+
this._updateOverflow();
|
|
211
|
+
}
|
|
212
|
+
|
|
185
213
|
/** @private */
|
|
186
214
|
_scrollForward() {
|
|
187
215
|
this._scroll(-this.__direction * this._scrollOffset);
|