@vaadin/tabsheet 24.4.0-alpha9 → 24.4.0-dev.4b20a0c55
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/README.md +0 -1
- package/package.json +8 -8
- package/src/vaadin-tabsheet-mixin.js +39 -12
- package/theme/lumo/vaadin-tabsheet-styles.d.ts +0 -5
- package/theme/lumo/vaadin-tabsheet.d.ts +0 -4
- package/theme/material/vaadin-tabsheet-styles.d.ts +0 -2
- package/theme/material/vaadin-tabsheet.d.ts +0 -4
- package/web-types.json +0 -65
- package/web-types.lit.json +0 -48
package/README.md
CHANGED
|
@@ -5,7 +5,6 @@ A web component for organizing and grouping content into sections.
|
|
|
5
5
|
[Documentation + Live Demo ↗](https://vaadin.com/docs/latest/components/tabs/#tab-sheet)
|
|
6
6
|
|
|
7
7
|
[](https://www.npmjs.com/package/@vaadin/tabsheet)
|
|
8
|
-
[](https://discord.gg/PHmkCKC)
|
|
9
8
|
|
|
10
9
|
```html
|
|
11
10
|
<vaadin-tabsheet>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/tabsheet",
|
|
3
|
-
"version": "24.4.0-
|
|
3
|
+
"version": "24.4.0-dev.4b20a0c55",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -37,12 +37,12 @@
|
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@open-wc/dedupe-mixin": "^1.3.0",
|
|
39
39
|
"@polymer/polymer": "^3.0.0",
|
|
40
|
-
"@vaadin/component-base": "24.4.0-
|
|
41
|
-
"@vaadin/scroller": "24.4.0-
|
|
42
|
-
"@vaadin/tabs": "24.4.0-
|
|
43
|
-
"@vaadin/vaadin-lumo-styles": "24.4.0-
|
|
44
|
-
"@vaadin/vaadin-material-styles": "24.4.0-
|
|
45
|
-
"@vaadin/vaadin-themable-mixin": "24.4.0-
|
|
40
|
+
"@vaadin/component-base": "24.4.0-dev.4b20a0c55",
|
|
41
|
+
"@vaadin/scroller": "24.4.0-dev.4b20a0c55",
|
|
42
|
+
"@vaadin/tabs": "24.4.0-dev.4b20a0c55",
|
|
43
|
+
"@vaadin/vaadin-lumo-styles": "24.4.0-dev.4b20a0c55",
|
|
44
|
+
"@vaadin/vaadin-material-styles": "24.4.0-dev.4b20a0c55",
|
|
45
|
+
"@vaadin/vaadin-themable-mixin": "24.4.0-dev.4b20a0c55"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@esm-bundle/chai": "^4.3.4",
|
|
@@ -53,5 +53,5 @@
|
|
|
53
53
|
"web-types.json",
|
|
54
54
|
"web-types.lit.json"
|
|
55
55
|
],
|
|
56
|
-
"gitHead": "
|
|
56
|
+
"gitHead": "b79c81e5f6fd24684b34ee0dc434e94d943ea13e"
|
|
57
57
|
}
|
|
@@ -18,11 +18,29 @@ class TabsSlotController extends SlotController {
|
|
|
18
18
|
super(host, 'tabs');
|
|
19
19
|
this.__tabsItemsChangedListener = this.__tabsItemsChangedListener.bind(this);
|
|
20
20
|
this.__tabsSelectedChangedListener = this.__tabsSelectedChangedListener.bind(this);
|
|
21
|
+
this.__tabIdObserver = new MutationObserver((mutations) => {
|
|
22
|
+
mutations.forEach((mutation) => {
|
|
23
|
+
const tab = mutation.target;
|
|
24
|
+
|
|
25
|
+
host.__linkTabAndPanel(tab);
|
|
26
|
+
|
|
27
|
+
if (tab.selected) {
|
|
28
|
+
host.__togglePanels(tab);
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
});
|
|
21
32
|
}
|
|
22
33
|
|
|
23
34
|
/** @private */
|
|
24
35
|
__tabsItemsChangedListener() {
|
|
25
|
-
this.
|
|
36
|
+
this.__tabIdObserver.disconnect();
|
|
37
|
+
const items = this.tabs.items || [];
|
|
38
|
+
items.forEach((tab) => {
|
|
39
|
+
this.__tabIdObserver.observe(tab, {
|
|
40
|
+
attributeFilter: ['id'],
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
this.host._setItems(items);
|
|
26
44
|
}
|
|
27
45
|
|
|
28
46
|
/** @private */
|
|
@@ -142,15 +160,7 @@ export const TabSheetMixin = (superClass) =>
|
|
|
142
160
|
return;
|
|
143
161
|
}
|
|
144
162
|
items.forEach((tabItem) => {
|
|
145
|
-
|
|
146
|
-
if (panel) {
|
|
147
|
-
panel.role = 'tabpanel';
|
|
148
|
-
if (!panel.id) {
|
|
149
|
-
panel.id = `tabsheet-panel-${generateUniqueId()}`;
|
|
150
|
-
}
|
|
151
|
-
panel.setAttribute('aria-labelledby', tabItem.id);
|
|
152
|
-
tabItem.setAttribute('aria-controls', panel.id);
|
|
153
|
-
}
|
|
163
|
+
this.__linkTabAndPanel(tabItem, panels);
|
|
154
164
|
});
|
|
155
165
|
}
|
|
156
166
|
|
|
@@ -162,10 +172,14 @@ export const TabSheetMixin = (superClass) =>
|
|
|
162
172
|
if (!items || !panels || selected === undefined) {
|
|
163
173
|
return;
|
|
164
174
|
}
|
|
165
|
-
|
|
166
|
-
|
|
175
|
+
this.__togglePanels(items[selected], panels);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/** @private */
|
|
179
|
+
__togglePanels(selectedTab, panels = this.__panels) {
|
|
167
180
|
const selectedTabId = selectedTab ? selectedTab.id : '';
|
|
168
181
|
const selectedPanel = panels.find((panel) => panel.getAttribute('tab') === selectedTabId);
|
|
182
|
+
const content = this.shadowRoot.querySelector('[part="content"]');
|
|
169
183
|
|
|
170
184
|
// Mark loading state if a selected panel is not found.
|
|
171
185
|
this.toggleAttribute('loading', !selectedPanel);
|
|
@@ -183,4 +197,17 @@ export const TabSheetMixin = (superClass) =>
|
|
|
183
197
|
panel.hidden = panel !== selectedPanel;
|
|
184
198
|
});
|
|
185
199
|
}
|
|
200
|
+
|
|
201
|
+
/** @private */
|
|
202
|
+
__linkTabAndPanel(tab, panels = this.__panels) {
|
|
203
|
+
const panel = panels.find((panel) => panel.getAttribute('tab') === tab.id);
|
|
204
|
+
if (panel) {
|
|
205
|
+
panel.role = 'tabpanel';
|
|
206
|
+
if (!panel.id) {
|
|
207
|
+
panel.id = `tabsheet-panel-${generateUniqueId()}`;
|
|
208
|
+
}
|
|
209
|
+
panel.setAttribute('aria-labelledby', tab.id);
|
|
210
|
+
tab.setAttribute('aria-controls', panel.id);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
186
213
|
};
|
package/web-types.json
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://json.schemastore.org/web-types",
|
|
3
|
-
"name": "@vaadin/tabsheet",
|
|
4
|
-
"version": "24.4.0-alpha9",
|
|
5
|
-
"description-markup": "markdown",
|
|
6
|
-
"contributions": {
|
|
7
|
-
"html": {
|
|
8
|
-
"elements": [
|
|
9
|
-
{
|
|
10
|
-
"name": "vaadin-tabsheet",
|
|
11
|
-
"description": "`<vaadin-tabsheet>` is a Web Component for organizing and grouping content\ninto scrollable panels. The panels can be switched between by using tabs.\n\n```\n <vaadin-tabsheet>\n <div slot=\"prefix\">Prefix</div>\n <div slot=\"suffix\">Suffix</div>\n\n <vaadin-tabs slot=\"tabs\">\n <vaadin-tab id=\"tab-1\">Tab 1</vaadin-tab>\n <vaadin-tab id=\"tab-2\">Tab 2</vaadin-tab>\n <vaadin-tab id=\"tab-3\">Tab 3</vaadin-tab>\n </vaadin-tabs>\n\n <div tab=\"tab-1\">Panel 1</div>\n <div tab=\"tab-2\">Panel 2</div>\n <div tab=\"tab-3\">Panel 3</div>\n </vaadin-tabsheet>\n```\n\n### Styling\n\nThe following shadow DOM parts are exposed for styling:\n\nPart name | Description\n--------- | ---------------\n`tabs-container` | The container for the slotted prefix, tabs and suffix\n`content` | The container for the slotted panels\n\nThe following state attributes are available for styling:\n\nAttribute | Description\n------------------|-------------\n`loading` | Set when a tab without associated content is selected\n`overflow` | Set to `top`, `bottom`, `start`, `end`, all of them, or none.\n\nSee [Styling Components](hhttps://vaadin.com/docs/latest/components/ds-resources/customization/styling-components) documentation.",
|
|
12
|
-
"attributes": [
|
|
13
|
-
{
|
|
14
|
-
"name": "selected",
|
|
15
|
-
"description": "The index of the selected tab.",
|
|
16
|
-
"value": {
|
|
17
|
-
"type": [
|
|
18
|
-
"number",
|
|
19
|
-
"null",
|
|
20
|
-
"undefined"
|
|
21
|
-
]
|
|
22
|
-
}
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
"name": "theme",
|
|
26
|
-
"description": "The theme variants to apply to the component.",
|
|
27
|
-
"value": {
|
|
28
|
-
"type": [
|
|
29
|
-
"string",
|
|
30
|
-
"null",
|
|
31
|
-
"undefined"
|
|
32
|
-
]
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
],
|
|
36
|
-
"js": {
|
|
37
|
-
"properties": [
|
|
38
|
-
{
|
|
39
|
-
"name": "selected",
|
|
40
|
-
"description": "The index of the selected tab.",
|
|
41
|
-
"value": {
|
|
42
|
-
"type": [
|
|
43
|
-
"number",
|
|
44
|
-
"null",
|
|
45
|
-
"undefined"
|
|
46
|
-
]
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
],
|
|
50
|
-
"events": [
|
|
51
|
-
{
|
|
52
|
-
"name": "items-changed",
|
|
53
|
-
"description": "Fired when the `items` property changes."
|
|
54
|
-
},
|
|
55
|
-
{
|
|
56
|
-
"name": "selected-changed",
|
|
57
|
-
"description": "Fired when the `selected` property changes."
|
|
58
|
-
}
|
|
59
|
-
]
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
]
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}
|
package/web-types.lit.json
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://json.schemastore.org/web-types",
|
|
3
|
-
"name": "@vaadin/tabsheet",
|
|
4
|
-
"version": "24.4.0-alpha9",
|
|
5
|
-
"description-markup": "markdown",
|
|
6
|
-
"framework": "lit",
|
|
7
|
-
"framework-config": {
|
|
8
|
-
"enable-when": {
|
|
9
|
-
"node-packages": [
|
|
10
|
-
"lit"
|
|
11
|
-
]
|
|
12
|
-
}
|
|
13
|
-
},
|
|
14
|
-
"contributions": {
|
|
15
|
-
"html": {
|
|
16
|
-
"elements": [
|
|
17
|
-
{
|
|
18
|
-
"name": "vaadin-tabsheet",
|
|
19
|
-
"description": "`<vaadin-tabsheet>` is a Web Component for organizing and grouping content\ninto scrollable panels. The panels can be switched between by using tabs.\n\n```\n <vaadin-tabsheet>\n <div slot=\"prefix\">Prefix</div>\n <div slot=\"suffix\">Suffix</div>\n\n <vaadin-tabs slot=\"tabs\">\n <vaadin-tab id=\"tab-1\">Tab 1</vaadin-tab>\n <vaadin-tab id=\"tab-2\">Tab 2</vaadin-tab>\n <vaadin-tab id=\"tab-3\">Tab 3</vaadin-tab>\n </vaadin-tabs>\n\n <div tab=\"tab-1\">Panel 1</div>\n <div tab=\"tab-2\">Panel 2</div>\n <div tab=\"tab-3\">Panel 3</div>\n </vaadin-tabsheet>\n```\n\n### Styling\n\nThe following shadow DOM parts are exposed for styling:\n\nPart name | Description\n--------- | ---------------\n`tabs-container` | The container for the slotted prefix, tabs and suffix\n`content` | The container for the slotted panels\n\nThe following state attributes are available for styling:\n\nAttribute | Description\n------------------|-------------\n`loading` | Set when a tab without associated content is selected\n`overflow` | Set to `top`, `bottom`, `start`, `end`, all of them, or none.\n\nSee [Styling Components](hhttps://vaadin.com/docs/latest/components/ds-resources/customization/styling-components) documentation.",
|
|
20
|
-
"extension": true,
|
|
21
|
-
"attributes": [
|
|
22
|
-
{
|
|
23
|
-
"name": ".selected",
|
|
24
|
-
"description": "The index of the selected tab.",
|
|
25
|
-
"value": {
|
|
26
|
-
"kind": "expression"
|
|
27
|
-
}
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
"name": "@items-changed",
|
|
31
|
-
"description": "Fired when the `items` property changes.",
|
|
32
|
-
"value": {
|
|
33
|
-
"kind": "expression"
|
|
34
|
-
}
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
"name": "@selected-changed",
|
|
38
|
-
"description": "Fired when the `selected` property changes.",
|
|
39
|
-
"value": {
|
|
40
|
-
"kind": "expression"
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
]
|
|
44
|
-
}
|
|
45
|
-
]
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}
|