@proximus/lavender 1.0.0-alpha.6 → 1.0.0-alpha.7
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/dist/lavender.cjs.js +1 -1
- package/dist/lavender.es.js +23 -16
- package/dist/lavender.umd.js +1 -1
- package/package.json +2 -2
package/dist/lavender.es.js
CHANGED
|
@@ -2400,14 +2400,19 @@ class Tabs extends HTMLElement {
|
|
|
2400
2400
|
class Tab extends HTMLElement {
|
|
2401
2401
|
constructor(semanticStyleSheet) {
|
|
2402
2402
|
super();
|
|
2403
|
-
this.template = (
|
|
2404
|
-
<button role="tab" aria-selected="
|
|
2405
|
-
<span><slot
|
|
2403
|
+
this.template = () => `
|
|
2404
|
+
<button role="tab" aria-selected="false" type="button" tabindex="-1">
|
|
2405
|
+
<span><slot></slot></span>
|
|
2406
2406
|
</button>
|
|
2407
2407
|
`;
|
|
2408
2408
|
this.attachShadow({ mode: "open" });
|
|
2409
|
-
this.shadowRoot.innerHTML = this.template(
|
|
2409
|
+
this.shadowRoot.innerHTML = this.template();
|
|
2410
2410
|
this.shadowRoot.adoptedStyleSheets = [semanticStyleSheet, styleSheet$4];
|
|
2411
|
+
}
|
|
2412
|
+
static get observedAttributes() {
|
|
2413
|
+
return ["selected", "for", "name"];
|
|
2414
|
+
}
|
|
2415
|
+
connectedCallback() {
|
|
2411
2416
|
if (!this.name) {
|
|
2412
2417
|
console.error("Tab needs a name attribute");
|
|
2413
2418
|
}
|
|
@@ -2415,11 +2420,6 @@ class Tab extends HTMLElement {
|
|
|
2415
2420
|
console.error("Tab needs a for attribute");
|
|
2416
2421
|
}
|
|
2417
2422
|
this.slot = "tabs";
|
|
2418
|
-
}
|
|
2419
|
-
static get observedAttributes() {
|
|
2420
|
-
return ["selected", "for", "name"];
|
|
2421
|
-
}
|
|
2422
|
-
connectedCallback() {
|
|
2423
2423
|
if (this.parentElement.inverted) {
|
|
2424
2424
|
this.setAttribute("inverted", "");
|
|
2425
2425
|
this.$button.setAttribute("inverted", "");
|
|
@@ -2480,10 +2480,6 @@ class TabPanel extends HTMLElement {
|
|
|
2480
2480
|
this.attachShadow({ mode: "open" });
|
|
2481
2481
|
this.shadowRoot.innerHTML = this.template();
|
|
2482
2482
|
this.shadowRoot.adoptedStyleSheets = [semanticStyleSheet, styleSheet$4];
|
|
2483
|
-
if (!this.name) {
|
|
2484
|
-
console.error("TabPanel needs a name attribute");
|
|
2485
|
-
}
|
|
2486
|
-
this.slot = "tabpanels";
|
|
2487
2483
|
}
|
|
2488
2484
|
static get observedAttributes() {
|
|
2489
2485
|
return ["name"];
|
|
@@ -2494,13 +2490,24 @@ class TabPanel extends HTMLElement {
|
|
|
2494
2490
|
}
|
|
2495
2491
|
}
|
|
2496
2492
|
connectedCallback() {
|
|
2497
|
-
|
|
2493
|
+
if (!this.name) {
|
|
2494
|
+
console.error("TabPanel needs a name attribute");
|
|
2495
|
+
}
|
|
2496
|
+
this.slot = "tabpanels";
|
|
2497
|
+
const labelledBy = this.parentElement.querySelector(
|
|
2498
|
+
`[for="${this.getAttribute("name")}"]`
|
|
2499
|
+
);
|
|
2498
2500
|
if (labelledBy) {
|
|
2499
|
-
this.$panel.setAttribute(
|
|
2501
|
+
this.$panel.setAttribute(
|
|
2502
|
+
"aria-labelledby",
|
|
2503
|
+
labelledBy.getAttribute("name")
|
|
2504
|
+
);
|
|
2500
2505
|
} else {
|
|
2501
2506
|
console.error("No tab found for this panel");
|
|
2502
2507
|
}
|
|
2503
|
-
const selectedTab = this.parentElement.querySelector(
|
|
2508
|
+
const selectedTab = this.parentElement.querySelector(
|
|
2509
|
+
`[for="${this.name}"]`
|
|
2510
|
+
);
|
|
2504
2511
|
if (!isFalsy(selectedTab.selected)) {
|
|
2505
2512
|
this.selected = true;
|
|
2506
2513
|
} else {
|