scb-wc 0.1.77 → 0.1.78
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/icons.json +178 -178
- package/mvc/components/scb-button/scb-button.js +1 -1
- package/mvc/components/scb-grid/scb-grid-item.js +1 -1
- package/mvc/components/scb-grid/scb-grid.js +1 -1
- package/mvc/components/scb-header/scb-header.js +88 -62
- package/mvc/components/scb-icon-button/scb-icon-button.js +1 -1
- package/mvc/components/scb-skeleton/scb-skeleton.js +1 -1
- package/mvc/scb-logo.svg +20 -20
- package/mvc/scb.svg +13 -13
- package/package.json +2 -2
- package/scb-components/scb-header/scb-header.d.ts +5 -0
- package/scb-header/scb-header.js +82 -20
- package/scb-wc.bundle.js +221 -195
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "scb-wc",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.78",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "index.js",
|
|
@@ -460,5 +460,5 @@
|
|
|
460
460
|
},
|
|
461
461
|
"./mvc/*": "./mvc/*"
|
|
462
462
|
},
|
|
463
|
-
"buildHash": "
|
|
463
|
+
"buildHash": "F086CA2665651E256C046BB33A18698C9DD9A440DDAFCD908BBB95AE85900050"
|
|
464
464
|
}
|
|
@@ -101,6 +101,9 @@ export declare class ScbHeader extends LitElement {
|
|
|
101
101
|
private _sameNavItems;
|
|
102
102
|
private _sameUtilityItems;
|
|
103
103
|
private _sameMenuNodes;
|
|
104
|
+
private _isDrawerCloseNode;
|
|
105
|
+
private _syncDrawerCloseNode;
|
|
106
|
+
private _syncDrawerCloseNodes;
|
|
104
107
|
private _harvest;
|
|
105
108
|
private _setCollapsed;
|
|
106
109
|
private _setHideSearch;
|
|
@@ -128,6 +131,8 @@ export declare class ScbHeader extends LitElement {
|
|
|
128
131
|
private _onGlobalFocusRingPointerDown;
|
|
129
132
|
private _onLocalFocusIn;
|
|
130
133
|
private _ensureDrawerReady;
|
|
134
|
+
private _drawerSlotContains;
|
|
135
|
+
private _ensureDrawerSlotComponentsReady;
|
|
131
136
|
private _ensureDropdownReady;
|
|
132
137
|
private _onDrawerOpened;
|
|
133
138
|
private _onDrawerClosed;
|
package/scb-header/scb-header.js
CHANGED
|
@@ -122,11 +122,16 @@ var u = {
|
|
|
122
122
|
href: e.getAttribute("href") ?? void 0,
|
|
123
123
|
icon: e.getAttribute("icon") ?? void 0
|
|
124
124
|
}), c = (e) => {
|
|
125
|
-
e.hasAttribute("role") && e.removeAttribute("role"), e.getAttribute("aria-hidden") !== "true" && e.setAttribute("aria-hidden", "true");
|
|
125
|
+
e.hasAttribute("role") && e.removeAttribute("role"), e.hasAttribute("hidden") || e.setAttribute("hidden", ""), e.getAttribute("aria-hidden") !== "true" && e.setAttribute("aria-hidden", "true");
|
|
126
126
|
};
|
|
127
127
|
for (let e of t) {
|
|
128
128
|
let t = e.tagName.toLowerCase();
|
|
129
|
+
if (this._isDrawerCloseNode(e)) {
|
|
130
|
+
this._syncDrawerCloseNode(e);
|
|
131
|
+
continue;
|
|
132
|
+
}
|
|
129
133
|
if (t === "scb-header-tab") {
|
|
134
|
+
c(e);
|
|
130
135
|
let t = e.getAttribute("label") ?? "", r = e.getAttribute("href"), i = r && r.trim() !== "" ? r : void 0;
|
|
131
136
|
(e.hasAttribute("selected") || e.getAttribute("selected") === "true" || e.getAttribute("active") === "true" || e.getAttribute("aria-current") === "page") && a === -1 && (a = n.length), n.push({
|
|
132
137
|
kind: "tab",
|
|
@@ -171,6 +176,7 @@ var u = {
|
|
|
171
176
|
continue;
|
|
172
177
|
}
|
|
173
178
|
if (t === "scb-header-menu-group") {
|
|
179
|
+
c(e);
|
|
174
180
|
let t = {
|
|
175
181
|
label: e.getAttribute("label") ?? "",
|
|
176
182
|
icon: e.getAttribute("icon") ?? void 0,
|
|
@@ -179,7 +185,11 @@ var u = {
|
|
|
179
185
|
e.querySelectorAll("scb-header-menu-item").forEach((e) => t.children.push(s(e))), i.push(t);
|
|
180
186
|
continue;
|
|
181
187
|
}
|
|
182
|
-
t === "scb-header-menu-item"
|
|
188
|
+
if (t === "scb-header-menu-item") {
|
|
189
|
+
c(e), i.push(s(e));
|
|
190
|
+
continue;
|
|
191
|
+
}
|
|
192
|
+
e.hasAttribute("slot") || c(e);
|
|
183
193
|
}
|
|
184
194
|
let l = !this._sameNavItems(this._slotNavItems, n), u = !this._sameUtilityItems(this._slotUtils, r), d = !this._sameMenuNodes(this._slotMenu, i);
|
|
185
195
|
l && (this._slotNavItems = n), u && (this._slotUtils = r), d && (this._slotMenu = i), o && this._ensureDropdownReady(), !this.hasAttribute("active-tab") && a >= 0 && this.activeTab !== a && (this.activeTab = a), (e.scheduleMeasure ?? !0) && queueMicrotask(() => {
|
|
@@ -1155,6 +1165,23 @@ var u = {
|
|
|
1155
1165
|
border: 0;
|
|
1156
1166
|
}
|
|
1157
1167
|
|
|
1168
|
+
.drawer-close {
|
|
1169
|
+
box-sizing: border-box;
|
|
1170
|
+
display: flex;
|
|
1171
|
+
justify-content: flex-end;
|
|
1172
|
+
padding-block-start: var(--spacing-4, 12px);
|
|
1173
|
+
padding-inline: var(--spacing-4, 12px);
|
|
1174
|
+
background: var(--md-sys-color-surface-container-lowest);
|
|
1175
|
+
}
|
|
1176
|
+
|
|
1177
|
+
.drawer-close[hidden] {
|
|
1178
|
+
display: none;
|
|
1179
|
+
}
|
|
1180
|
+
|
|
1181
|
+
.drawer-close ::slotted(*) {
|
|
1182
|
+
flex: 0 0 auto;
|
|
1183
|
+
}
|
|
1184
|
+
|
|
1158
1185
|
.divider {
|
|
1159
1186
|
border-bottom: var(--stroke-border, 1px) solid
|
|
1160
1187
|
var(--md-sys-color-outline-variant, #e0e0e0);
|
|
@@ -1265,6 +1292,19 @@ var u = {
|
|
|
1265
1292
|
}
|
|
1266
1293
|
return !0;
|
|
1267
1294
|
}
|
|
1295
|
+
_isDrawerCloseNode(e) {
|
|
1296
|
+
let t = e.tagName.toLowerCase(), n = e.getAttribute("slot");
|
|
1297
|
+
if (n === "drawer-close") return !0;
|
|
1298
|
+
if (n || t !== "scb-icon-button") return !1;
|
|
1299
|
+
let r = (e.getAttribute("icon") ?? "").trim().toLowerCase(), i = (e.getAttribute("aria-label") ?? "").trim().toLowerCase();
|
|
1300
|
+
return r === "close" || i.includes("stäng") || i.includes("close");
|
|
1301
|
+
}
|
|
1302
|
+
_syncDrawerCloseNode(e) {
|
|
1303
|
+
e.getAttribute("slot") !== "drawer-close" && e.setAttribute("slot", "drawer-close"), e.setAttribute("data-drawer-close", this._drawerId), e.setAttribute("aria-controls", this._drawerId), this._drawerReady ? (e.removeAttribute("hidden"), e.removeAttribute("aria-hidden")) : (e.hasAttribute("hidden") || e.setAttribute("hidden", ""), e.getAttribute("aria-hidden") !== "true" && e.setAttribute("aria-hidden", "true"));
|
|
1304
|
+
}
|
|
1305
|
+
_syncDrawerCloseNodes() {
|
|
1306
|
+
for (let e of Array.from(this.children)) this._isDrawerCloseNode(e) && this._syncDrawerCloseNode(e);
|
|
1307
|
+
}
|
|
1268
1308
|
_setCollapsed(e) {
|
|
1269
1309
|
this._collapsed !== e && (this._collapsed = e, e ? this.setAttribute("data-collapsed", "") : this.removeAttribute("data-collapsed"));
|
|
1270
1310
|
}
|
|
@@ -1364,11 +1404,24 @@ var u = {
|
|
|
1364
1404
|
customElements.get("md-focus-ring") || (this._focusRingImportPromise ??= import("@material/web/focus/md-focus-ring.js").then(() => void 0), this._focusRingImportPromise);
|
|
1365
1405
|
}
|
|
1366
1406
|
async _ensureDrawerReady() {
|
|
1367
|
-
this._drawerReady
|
|
1407
|
+
this._drawerReady || (this._drawerImportPromise ??= Promise.all([
|
|
1368
1408
|
import("../scb-drawer/scb-drawer.js"),
|
|
1369
1409
|
import("../scb-menu/scb-menu.js"),
|
|
1370
|
-
import("../scb-search/scb-search.js")
|
|
1371
|
-
|
|
1410
|
+
import("../scb-search/scb-search.js"),
|
|
1411
|
+
this._ensureDrawerSlotComponentsReady()
|
|
1412
|
+
]).then(() => void 0), await this._drawerImportPromise, this._drawerReady = !0, this._syncDrawerCloseNodes());
|
|
1413
|
+
}
|
|
1414
|
+
_drawerSlotContains(e) {
|
|
1415
|
+
return [...this.querySelectorAll("[slot=\"drawer-menu\"], [slot=\"drawer-close\"]")].some((t) => t.matches(e) || !!t.querySelector(e));
|
|
1416
|
+
}
|
|
1417
|
+
async _ensureDrawerSlotComponentsReady() {
|
|
1418
|
+
this.querySelector("[slot=\"drawer-menu\"], [slot=\"drawer-close\"]") && await Promise.all([
|
|
1419
|
+
this._drawerSlotContains("scb-button") ? import("../scb-button/scb-button.js") : Promise.resolve(),
|
|
1420
|
+
this._drawerSlotContains("scb-icon-button") ? import("../scb-icon-button/scb-icon-button.js") : Promise.resolve(),
|
|
1421
|
+
this._drawerSlotContains("scb-skeleton") ? import("../scb-skeleton/scb-skeleton.js") : Promise.resolve(),
|
|
1422
|
+
this._drawerSlotContains("scb-grid") ? import("../scb-grid/scb-grid.js") : Promise.resolve(),
|
|
1423
|
+
this._drawerSlotContains("scb-grid-item") ? import("../scb-grid/scb-grid-item.js") : Promise.resolve()
|
|
1424
|
+
]);
|
|
1372
1425
|
}
|
|
1373
1426
|
async _ensureDropdownReady() {
|
|
1374
1427
|
customElements.get("scb-dropdown") || (this._dropdownImportPromise ??= import("../scb-dropdown/scb-dropdown.js").then(() => void 0), await this._dropdownImportPromise);
|
|
@@ -1557,9 +1610,9 @@ var u = {
|
|
|
1557
1610
|
`;
|
|
1558
1611
|
}
|
|
1559
1612
|
render() {
|
|
1560
|
-
let e = this._getNavItems(), t = this._slotUtils.length ? this._slotUtils : this.utilityItems, n = this._slotMenu.length ? this._slotMenu : this.menuData ?? [], a = this.logoText || this.logotypeText, o = this.logoAlt || a || "Gå till startsidan", s = this.querySelector("[slot=\"drawer-menu\"]") !== null;
|
|
1613
|
+
let e = this._getNavItems(), t = this._slotUtils.length ? this._slotUtils : this.utilityItems, n = this._slotMenu.length ? this._slotMenu : this.menuData ?? [], a = this.logoText || this.logotypeText, o = this.logoAlt || a || "Gå till startsidan", s = this.querySelector("[slot=\"drawer-menu\"]") !== null, c = this.querySelector("[slot=\"drawer-close\"]") !== null;
|
|
1561
1614
|
this._syncFlags(t.length === 0, !this.showSearch);
|
|
1562
|
-
let
|
|
1615
|
+
let l = this.searchHeight && this.searchHeight.trim() ? `--scb-search-height:${this.searchHeight.trim()}` : "", u = e.length > 0 || this.reserveTabs || this.layoutPending, d = (this.reserveTabs || this.layoutPending) && (this.layoutPending || e.length === 0), f = this.showDrawer && (!this.deferDrawer || this._drawerReady), p = typeof window < "u" && window.innerWidth >= this.BP_MD, m = this.showDrawer && (p ? this.alwaysShowMenuButton || this._collapsed : !0), h = m && !p, g = m && p, _ = (this.searchButtonLabel ?? "").trim() || "Sök", v = this.showSearch && !this._mobileSearchOpen;
|
|
1563
1616
|
return r`
|
|
1564
1617
|
<slot
|
|
1565
1618
|
id="data-slot"
|
|
@@ -1604,28 +1657,28 @@ var u = {
|
|
|
1604
1657
|
</nav>
|
|
1605
1658
|
|
|
1606
1659
|
${this.showSearch ? r`
|
|
1607
|
-
<div class="search" style=${
|
|
1608
|
-
${this._renderSearchForm(
|
|
1660
|
+
<div class="search" style=${l}>
|
|
1661
|
+
${this._renderSearchForm(_, l)}
|
|
1609
1662
|
</div>
|
|
1610
1663
|
` : i}
|
|
1611
|
-
${
|
|
1664
|
+
${v ? r`
|
|
1612
1665
|
<button
|
|
1613
1666
|
type="button"
|
|
1614
1667
|
class="mobile-search-trigger header-icon-button"
|
|
1615
|
-
aria-label=${
|
|
1616
|
-
title=${
|
|
1668
|
+
aria-label=${_}
|
|
1669
|
+
title=${_}
|
|
1617
1670
|
@click=${this._onMobileSearchToggle}
|
|
1618
1671
|
>
|
|
1619
1672
|
<span class="header-symbol" aria-hidden="true">search</span>
|
|
1620
1673
|
<md-focus-ring aria-hidden="true"></md-focus-ring>
|
|
1621
1674
|
</button>
|
|
1622
1675
|
` : i}
|
|
1623
|
-
${
|
|
1676
|
+
${h ? this._renderMenuButton("", !0) : i}
|
|
1624
1677
|
</div>
|
|
1625
1678
|
|
|
1626
1679
|
${this.showSearch && this._mobileSearchOpen ? r`
|
|
1627
|
-
<div class="mobile-search-panel" style=${
|
|
1628
|
-
${this._renderSearchForm(
|
|
1680
|
+
<div class="mobile-search-panel" style=${l}>
|
|
1681
|
+
${this._renderSearchForm(_, l, !1, !0)}
|
|
1629
1682
|
<button
|
|
1630
1683
|
type="button"
|
|
1631
1684
|
class="mobile-search-close header-icon-button"
|
|
@@ -1643,8 +1696,8 @@ var u = {
|
|
|
1643
1696
|
</div>
|
|
1644
1697
|
|
|
1645
1698
|
<div class="header-grid-item">
|
|
1646
|
-
<div class=${
|
|
1647
|
-
${
|
|
1699
|
+
<div class=${u || g ? "tabs-row" : "tabs-row tabs-row--empty"}>
|
|
1700
|
+
${u ? d ? r`
|
|
1648
1701
|
<div class="tabs-inset">
|
|
1649
1702
|
<div class="tabs-nav tabs-nav--skeleton" aria-hidden="true">
|
|
1650
1703
|
${this._renderTabSkeletons()}
|
|
@@ -1693,14 +1746,14 @@ var u = {
|
|
|
1693
1746
|
</div>
|
|
1694
1747
|
` : i : i}
|
|
1695
1748
|
|
|
1696
|
-
${
|
|
1749
|
+
${g ? this._renderMenuButton("menu-trigger--tabs-right") : i}
|
|
1697
1750
|
</div>
|
|
1698
1751
|
</div>
|
|
1699
1752
|
</div>
|
|
1700
1753
|
<div class="divider" role="presentation"></div>
|
|
1701
1754
|
</div>
|
|
1702
1755
|
|
|
1703
|
-
${
|
|
1756
|
+
${f ? r`
|
|
1704
1757
|
<scb-drawer
|
|
1705
1758
|
id=${this._drawerId}
|
|
1706
1759
|
floating
|
|
@@ -1713,7 +1766,16 @@ var u = {
|
|
|
1713
1766
|
@scb-drawer-closed=${this._onDrawerClosed}
|
|
1714
1767
|
@scb-menu-select=${this._onMenuSelect}
|
|
1715
1768
|
>
|
|
1716
|
-
|
|
1769
|
+
${c ? r`
|
|
1770
|
+
<div class="drawer-close">
|
|
1771
|
+
<slot
|
|
1772
|
+
name="drawer-close"
|
|
1773
|
+
@slotchange=${this._ensureDrawerSlotComponentsReady}
|
|
1774
|
+
></slot>
|
|
1775
|
+
</div>
|
|
1776
|
+
` : i}
|
|
1777
|
+
|
|
1778
|
+
<slot name="drawer-menu" @slotchange=${this._ensureDrawerSlotComponentsReady}></slot>
|
|
1717
1779
|
|
|
1718
1780
|
${s ? i : r`
|
|
1719
1781
|
<scb-menu
|