scb-wc 0.1.50 → 0.1.52
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-header/scb-header.js +3 -2
- package/mvc/components/scb-segmented-button/scb-segmented-button.js +2 -2
- package/mvc/components/scb-segmented-button/scb-segmented-item.js +2 -2
- package/mvc/components/scb-table/scb-table.js +1 -1
- package/mvc/components/scb-viz/scb-viz.js +41 -155
- package/mvc/scb-logo.svg +20 -20
- package/mvc/scb.svg +13 -13
- package/package.json +2 -2
- package/scb-components/scb-viz/scb-viz.d.ts +1 -0
- package/scb-header/scb-header.js +3 -4
- package/scb-segmented-button/scb-segmented-button.js +9 -4
- package/scb-segmented-button/scb-segmented-item.js +2 -2
- package/scb-table/scb-table.js +4 -8
- package/scb-viz/scb-viz.js +19 -127
- package/scb-wc.bundle.js +15 -128
package/icons.json
CHANGED
|
@@ -1,178 +1,178 @@
|
|
|
1
|
-
[
|
|
2
|
-
"add",
|
|
3
|
-
"remove",
|
|
4
|
-
"add_circle",
|
|
5
|
-
"remove_circle",
|
|
6
|
-
"expand_more",
|
|
7
|
-
"expand_less",
|
|
8
|
-
"chevron_right",
|
|
9
|
-
"chevron_left",
|
|
10
|
-
"unfold_more",
|
|
11
|
-
"unfold_less",
|
|
12
|
-
"info",
|
|
13
|
-
"warning",
|
|
14
|
-
"menu",
|
|
15
|
-
"code",
|
|
16
|
-
"more_horiz",
|
|
17
|
-
"more_vert",
|
|
18
|
-
"check_circle",
|
|
19
|
-
"check",
|
|
20
|
-
"check_small",
|
|
21
|
-
"close",
|
|
22
|
-
"border_color",
|
|
23
|
-
"error",
|
|
24
|
-
"edit",
|
|
25
|
-
"edit_square",
|
|
26
|
-
"refresh",
|
|
27
|
-
"print",
|
|
28
|
-
"group",
|
|
29
|
-
"person_add",
|
|
30
|
-
"person",
|
|
31
|
-
"download",
|
|
32
|
-
"mobile_arrow_down",
|
|
33
|
-
"upload",
|
|
34
|
-
"mail",
|
|
35
|
-
"calendar_month",
|
|
36
|
-
"calendar_today",
|
|
37
|
-
"volume_up",
|
|
38
|
-
"description",
|
|
39
|
-
"folder",
|
|
40
|
-
"play_arrow",
|
|
41
|
-
"grain",
|
|
42
|
-
"check_box",
|
|
43
|
-
"help",
|
|
44
|
-
"check_box_outline_blank",
|
|
45
|
-
"indeterminate_check_box",
|
|
46
|
-
"radio_button_checked",
|
|
47
|
-
"radio_button_unchecked",
|
|
48
|
-
"face",
|
|
49
|
-
"male",
|
|
50
|
-
"female",
|
|
51
|
-
"grid_on",
|
|
52
|
-
"label",
|
|
53
|
-
"delete",
|
|
54
|
-
"pin",
|
|
55
|
-
"location_on",
|
|
56
|
-
"straighten",
|
|
57
|
-
"compare_arrows",
|
|
58
|
-
"swap_horiz",
|
|
59
|
-
"filter_vintage",
|
|
60
|
-
"deceased",
|
|
61
|
-
"apartment",
|
|
62
|
-
"eco",
|
|
63
|
-
"texture",
|
|
64
|
-
"table_chart",
|
|
65
|
-
"bar_chart",
|
|
66
|
-
"bid_landscape",
|
|
67
|
-
"show_chart",
|
|
68
|
-
"ssid_chart",
|
|
69
|
-
"bubble_chart",
|
|
70
|
-
"touch_app",
|
|
71
|
-
"near_me",
|
|
72
|
-
"toggle_off",
|
|
73
|
-
"toggle_on",
|
|
74
|
-
"cancel",
|
|
75
|
-
"book",
|
|
76
|
-
"public",
|
|
77
|
-
"style",
|
|
78
|
-
"restore",
|
|
79
|
-
"payment",
|
|
80
|
-
"shopping_cart",
|
|
81
|
-
"list",
|
|
82
|
-
"ballot",
|
|
83
|
-
"list_alt",
|
|
84
|
-
"view_list",
|
|
85
|
-
"format_list_bulleted",
|
|
86
|
-
"database",
|
|
87
|
-
"database_search",
|
|
88
|
-
"data_table",
|
|
89
|
-
"share",
|
|
90
|
-
"home",
|
|
91
|
-
"arrow_back",
|
|
92
|
-
"arrow_forward",
|
|
93
|
-
"arrow_upward",
|
|
94
|
-
"arrow_downward",
|
|
95
|
-
"arrow_outward",
|
|
96
|
-
"call_made",
|
|
97
|
-
"arrow_back_ios",
|
|
98
|
-
"arrow_forward_ios",
|
|
99
|
-
"favorite",
|
|
100
|
-
"filter_list",
|
|
101
|
-
"sort",
|
|
102
|
-
"view_module",
|
|
103
|
-
"hearing",
|
|
104
|
-
"event_note",
|
|
105
|
-
"image",
|
|
106
|
-
"language",
|
|
107
|
-
"repeat",
|
|
108
|
-
"insert_chart",
|
|
109
|
-
"insert_chart_filled",
|
|
110
|
-
"leaderboard",
|
|
111
|
-
"article",
|
|
112
|
-
"reorder",
|
|
113
|
-
"subject",
|
|
114
|
-
"visibility",
|
|
115
|
-
"visibility_off",
|
|
116
|
-
"arrow_right",
|
|
117
|
-
"arrow_drop_down",
|
|
118
|
-
"tune",
|
|
119
|
-
"settings",
|
|
120
|
-
"manufacturing",
|
|
121
|
-
"preview",
|
|
122
|
-
"mic",
|
|
123
|
-
"laptop_windows",
|
|
124
|
-
"mobile",
|
|
125
|
-
"tablet",
|
|
126
|
-
"table",
|
|
127
|
-
"sell",
|
|
128
|
-
"shoppingmode",
|
|
129
|
-
"lightbulb",
|
|
130
|
-
"content_copy",
|
|
131
|
-
"colors",
|
|
132
|
-
"link",
|
|
133
|
-
"format_bold",
|
|
134
|
-
"format_color_text",
|
|
135
|
-
"format_align_left",
|
|
136
|
-
"fiber_manual_record",
|
|
137
|
-
"breaking_news",
|
|
138
|
-
"release_alert",
|
|
139
|
-
"person_play",
|
|
140
|
-
"comment",
|
|
141
|
-
"mode_comment",
|
|
142
|
-
"fullscreen",
|
|
143
|
-
"fullscreen_exit",
|
|
144
|
-
"filter_alt",
|
|
145
|
-
"open_in_new",
|
|
146
|
-
"search",
|
|
147
|
-
"support",
|
|
148
|
-
"location_searching",
|
|
149
|
-
"explore",
|
|
150
|
-
"assistant_direction",
|
|
151
|
-
"mouse",
|
|
152
|
-
"thumb_up",
|
|
153
|
-
"checklist",
|
|
154
|
-
"progress_activity",
|
|
155
|
-
"reply",
|
|
156
|
-
"percent",
|
|
157
|
-
"space_bar",
|
|
158
|
-
"graph_7",
|
|
159
|
-
"verified",
|
|
160
|
-
"deployed_code",
|
|
161
|
-
"build",
|
|
162
|
-
"code_blocks",
|
|
163
|
-
"inventory",
|
|
164
|
-
"save",
|
|
165
|
-
"data_info_alert",
|
|
166
|
-
"auto_stories",
|
|
167
|
-
"menu_book",
|
|
168
|
-
"book_2",
|
|
169
|
-
"import_contacts",
|
|
170
|
-
"nature",
|
|
171
|
-
"spa",
|
|
172
|
-
"contact_support",
|
|
173
|
-
"work",
|
|
174
|
-
"person_4",
|
|
175
|
-
"price_change",
|
|
176
|
-
"keyboard_arrow_down",
|
|
177
|
-
"keyboard_arrow_up"
|
|
178
|
-
]
|
|
1
|
+
[
|
|
2
|
+
"add",
|
|
3
|
+
"remove",
|
|
4
|
+
"add_circle",
|
|
5
|
+
"remove_circle",
|
|
6
|
+
"expand_more",
|
|
7
|
+
"expand_less",
|
|
8
|
+
"chevron_right",
|
|
9
|
+
"chevron_left",
|
|
10
|
+
"unfold_more",
|
|
11
|
+
"unfold_less",
|
|
12
|
+
"info",
|
|
13
|
+
"warning",
|
|
14
|
+
"menu",
|
|
15
|
+
"code",
|
|
16
|
+
"more_horiz",
|
|
17
|
+
"more_vert",
|
|
18
|
+
"check_circle",
|
|
19
|
+
"check",
|
|
20
|
+
"check_small",
|
|
21
|
+
"close",
|
|
22
|
+
"border_color",
|
|
23
|
+
"error",
|
|
24
|
+
"edit",
|
|
25
|
+
"edit_square",
|
|
26
|
+
"refresh",
|
|
27
|
+
"print",
|
|
28
|
+
"group",
|
|
29
|
+
"person_add",
|
|
30
|
+
"person",
|
|
31
|
+
"download",
|
|
32
|
+
"mobile_arrow_down",
|
|
33
|
+
"upload",
|
|
34
|
+
"mail",
|
|
35
|
+
"calendar_month",
|
|
36
|
+
"calendar_today",
|
|
37
|
+
"volume_up",
|
|
38
|
+
"description",
|
|
39
|
+
"folder",
|
|
40
|
+
"play_arrow",
|
|
41
|
+
"grain",
|
|
42
|
+
"check_box",
|
|
43
|
+
"help",
|
|
44
|
+
"check_box_outline_blank",
|
|
45
|
+
"indeterminate_check_box",
|
|
46
|
+
"radio_button_checked",
|
|
47
|
+
"radio_button_unchecked",
|
|
48
|
+
"face",
|
|
49
|
+
"male",
|
|
50
|
+
"female",
|
|
51
|
+
"grid_on",
|
|
52
|
+
"label",
|
|
53
|
+
"delete",
|
|
54
|
+
"pin",
|
|
55
|
+
"location_on",
|
|
56
|
+
"straighten",
|
|
57
|
+
"compare_arrows",
|
|
58
|
+
"swap_horiz",
|
|
59
|
+
"filter_vintage",
|
|
60
|
+
"deceased",
|
|
61
|
+
"apartment",
|
|
62
|
+
"eco",
|
|
63
|
+
"texture",
|
|
64
|
+
"table_chart",
|
|
65
|
+
"bar_chart",
|
|
66
|
+
"bid_landscape",
|
|
67
|
+
"show_chart",
|
|
68
|
+
"ssid_chart",
|
|
69
|
+
"bubble_chart",
|
|
70
|
+
"touch_app",
|
|
71
|
+
"near_me",
|
|
72
|
+
"toggle_off",
|
|
73
|
+
"toggle_on",
|
|
74
|
+
"cancel",
|
|
75
|
+
"book",
|
|
76
|
+
"public",
|
|
77
|
+
"style",
|
|
78
|
+
"restore",
|
|
79
|
+
"payment",
|
|
80
|
+
"shopping_cart",
|
|
81
|
+
"list",
|
|
82
|
+
"ballot",
|
|
83
|
+
"list_alt",
|
|
84
|
+
"view_list",
|
|
85
|
+
"format_list_bulleted",
|
|
86
|
+
"database",
|
|
87
|
+
"database_search",
|
|
88
|
+
"data_table",
|
|
89
|
+
"share",
|
|
90
|
+
"home",
|
|
91
|
+
"arrow_back",
|
|
92
|
+
"arrow_forward",
|
|
93
|
+
"arrow_upward",
|
|
94
|
+
"arrow_downward",
|
|
95
|
+
"arrow_outward",
|
|
96
|
+
"call_made",
|
|
97
|
+
"arrow_back_ios",
|
|
98
|
+
"arrow_forward_ios",
|
|
99
|
+
"favorite",
|
|
100
|
+
"filter_list",
|
|
101
|
+
"sort",
|
|
102
|
+
"view_module",
|
|
103
|
+
"hearing",
|
|
104
|
+
"event_note",
|
|
105
|
+
"image",
|
|
106
|
+
"language",
|
|
107
|
+
"repeat",
|
|
108
|
+
"insert_chart",
|
|
109
|
+
"insert_chart_filled",
|
|
110
|
+
"leaderboard",
|
|
111
|
+
"article",
|
|
112
|
+
"reorder",
|
|
113
|
+
"subject",
|
|
114
|
+
"visibility",
|
|
115
|
+
"visibility_off",
|
|
116
|
+
"arrow_right",
|
|
117
|
+
"arrow_drop_down",
|
|
118
|
+
"tune",
|
|
119
|
+
"settings",
|
|
120
|
+
"manufacturing",
|
|
121
|
+
"preview",
|
|
122
|
+
"mic",
|
|
123
|
+
"laptop_windows",
|
|
124
|
+
"mobile",
|
|
125
|
+
"tablet",
|
|
126
|
+
"table",
|
|
127
|
+
"sell",
|
|
128
|
+
"shoppingmode",
|
|
129
|
+
"lightbulb",
|
|
130
|
+
"content_copy",
|
|
131
|
+
"colors",
|
|
132
|
+
"link",
|
|
133
|
+
"format_bold",
|
|
134
|
+
"format_color_text",
|
|
135
|
+
"format_align_left",
|
|
136
|
+
"fiber_manual_record",
|
|
137
|
+
"breaking_news",
|
|
138
|
+
"release_alert",
|
|
139
|
+
"person_play",
|
|
140
|
+
"comment",
|
|
141
|
+
"mode_comment",
|
|
142
|
+
"fullscreen",
|
|
143
|
+
"fullscreen_exit",
|
|
144
|
+
"filter_alt",
|
|
145
|
+
"open_in_new",
|
|
146
|
+
"search",
|
|
147
|
+
"support",
|
|
148
|
+
"location_searching",
|
|
149
|
+
"explore",
|
|
150
|
+
"assistant_direction",
|
|
151
|
+
"mouse",
|
|
152
|
+
"thumb_up",
|
|
153
|
+
"checklist",
|
|
154
|
+
"progress_activity",
|
|
155
|
+
"reply",
|
|
156
|
+
"percent",
|
|
157
|
+
"space_bar",
|
|
158
|
+
"graph_7",
|
|
159
|
+
"verified",
|
|
160
|
+
"deployed_code",
|
|
161
|
+
"build",
|
|
162
|
+
"code_blocks",
|
|
163
|
+
"inventory",
|
|
164
|
+
"save",
|
|
165
|
+
"data_info_alert",
|
|
166
|
+
"auto_stories",
|
|
167
|
+
"menu_book",
|
|
168
|
+
"book_2",
|
|
169
|
+
"import_contacts",
|
|
170
|
+
"nature",
|
|
171
|
+
"spa",
|
|
172
|
+
"contact_support",
|
|
173
|
+
"work",
|
|
174
|
+
"person_4",
|
|
175
|
+
"price_change",
|
|
176
|
+
"keyboard_arrow_down",
|
|
177
|
+
"keyboard_arrow_up"
|
|
178
|
+
]
|
|
@@ -50,7 +50,7 @@ import"../../vendor/vendor-material.js";import{_ as M,b as E,g as P,h as c,m as
|
|
|
50
50
|
);
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
|
-
`,document.head.appendChild(b);const e=l=>{const u=String(l??"").trim();if(u)return/^\d+$/.test(u)?`var(--spacing-${Math.max(0,Math.min(14,parseInt(u,10)))})`:u},t=l=>{const u=String(l??"").trim();if(!u)return!1;try{const p=JSON.parse(u);return Array.isArray(p)&&p.length>0}catch{return!1}},s=l=>l!=null&&!/^(false|0|off|no)$/i.test(l.trim()),r=l=>{for(const u of Array.from(l.children)){const p=u.tagName.toLowerCase();if(p==="scb-header-tab"||p==="scb-dropdown")return!0}return!1},i=l=>{r(l)||t(l.getAttribute("tabs"))||s(l.getAttribute("reserve-tabs"))||s(l.getAttribute("layout-pending"))?l.setAttribute("data-pre-has-tabs",""):l.removeAttribute("data-pre-has-tabs");const u=e(l.getAttribute("spacing")),p=e(l.getAttribute("spacing-top"))??u,y=e(l.getAttribute("spacing-bottom"))??u;p?l.style.setProperty("--scb-header-spacing-block-start",p):l.style.removeProperty("--scb-header-spacing-block-start"),y?l.style.setProperty("--scb-header-spacing-block-end",y):l.style.removeProperty("--scb-header-spacing-block-end");const h=(l.getAttribute("logo-width")??"").trim();h?l.style.setProperty("--scb-header-pre-logo-w",h):l.style.removeProperty("--scb-header-pre-logo-w");const _=(l.getAttribute("logo-height")??"").trim();_?l.style.setProperty("--scb-header-pre-logo-img-h",_):l.style.removeProperty("--scb-header-pre-logo-img-h");const g=(l.getAttribute("search-height")??"").trim();g?l.style.setProperty("--scb-header-pre-control-size",g):l.style.removeProperty("--scb-header-pre-control-size")};document.querySelectorAll("scb-header").forEach(i);const d=new MutationObserver(l=>{for(const u of l){if(u.type==="attributes"){const p=u.target;p instanceof HTMLElement&&p.tagName.toLowerCase()==="scb-header"&&i(p);continue}if(u.type==="childList"){const p=[...Array.from(u.addedNodes),...Array.from(u.removedNodes)];for(const y of p){if(!(y instanceof HTMLElement))continue;if(y.tagName.toLowerCase()==="scb-header"){i(y);continue}const h=y.closest?.("scb-header");h&&i(h)}}}});d.observe(document.documentElement,{subtree:!0,childList:!0,attributes:!0,attributeFilter:["tabs","spacing","spacing-top","spacing-bottom","logo-width","logo-height","logo-aspect-ratio","logo-alt","logotype-text","search-height","reserve-tabs","layout-pending"]}),customElements.whenDefined("scb-header").then(()=>{d.disconnect()})};N();var T={fromAttribute:b=>b==null?!0:!/^(false|0|off|no)$/i.test(b),toAttribute:b=>String(!!b)},A={fromAttribute:b=>b==null?!1:!/^(false|0|off|no)$/i.test(b),toAttribute:b=>b?"":null},z={fromAttribute:b=>b==="small"||b==="large"?b:"medium",toAttribute:b=>{const e=String(b??"");return e==="small"||e==="large"?e:null}},o=(S=class extends M{constructor(){super(),this.maxWidth="1440px",this.spacing=void 0,this.spacingTop=void 0,this.spacingBottom=void 0,this.size="medium",this.logoText="",this.logotypeText="",this.logoAlt="",this.logoHref="/",this.logoSrc="",this.logoWidth="",this.logoHeight="",this.logoAspectRatio="",this.logoInvertDm=!1,this.banner=!1,this.tabs=[],this.activeTab=null,this.reserveTabs=!1,this.layoutPending=!1,this.utilityItems=[],this.searchButtonLabel="Sök",this.menuButtonLabel="Meny",this.deferDrawer=!1,this.showDrawer=!0,this.alwaysShowMenuButton=!1,this.showSearch=!0,this.includeUtilityInMenu=!1,this.drawerOverlay=!0,this.searchText="",this._drawerId="main-drawer",this._menuExpanded=!1,this._searchId="header-search",this._drawerReady=!1,this._initialUpgradeComplete=!1,this._slotNavItems=[],this._slotUtils=[],this._slotMenu=[],this._measureScheduled=!1,this._scheduleMeasure=()=>{this.layoutPending||this._measureScheduled||(this._measureScheduled=!0,requestAnimationFrame(()=>{this._measureScheduled=!1,this._measure()}))},this._onWindowResize=()=>{this._scheduleMeasure()},this._onMenuSelect=t=>{const s=t.detail;this.dispatchEvent(new CustomEvent("scb-menu-select",{detail:s,bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("scbmenuselect",{detail:s,bubbles:!0,composed:!0}));const r=s?.item,i=typeof s?.href=="string"?s.href:typeof s?.itemHref=="string"?s.itemHref:typeof s?.item_href=="string"?s.item_href:"",a=r?r.getAttribute("item-href")??r.getAttribute("href")??"":"";String(i||a||"").trim()&&this._closeDrawerNow()},this._collapsed=!1,this._unlockAtWidth=0,this._hideLogoText=!1,this._logoTextUnlockAt=0,this._slotWatchers=[],this._harvestPending=!1,this._harvest=(t={})=>{const s=Array.from(this.children),r=[],i=[],a=[];let d=-1;const l=h=>({label:h.getAttribute("label")??"",href:h.getAttribute("href")??void 0,icon:h.getAttribute("icon")??void 0});for(const h of s){const _=h.tagName.toLowerCase();if(_==="scb-header-tab"){const g=h.getAttribute("label")??"",w=h.getAttribute("href"),v=w&&w.trim()!==""?w:void 0;(h.hasAttribute("selected")||h.getAttribute("selected")==="true"||h.getAttribute("active")==="true"||h.getAttribute("aria-current")==="page")&&d===-1&&(d=r.length),r.push({kind:"tab",label:g,href:v});continue}if(_==="scb-badge"){const g=h.querySelector("scb-dropdown");if(g){const w=g.getAttribute("label")??"";(g.hasAttribute("selected")||g.getAttribute("selected")==="true"||g.getAttribute("active")==="true"||g.getAttribute("aria-current")==="page")&&d===-1&&(d=r.length);const v=`scb-header-tab-${r.length}`;h.getAttribute("slot")!==v&&h.setAttribute("slot",v),g.hasAttribute("slot")&&g.removeAttribute("slot"),g.hasAttribute("as-tab")||g.setAttribute("as-tab",""),r.push({kind:"dropdown",slotName:v,label:w});continue}}if(_==="scb-dropdown"){const g=h.getAttribute("label")??"";(h.hasAttribute("selected")||h.getAttribute("selected")==="true"||h.getAttribute("active")==="true"||h.getAttribute("aria-current")==="page")&&d===-1&&(d=r.length);const w=`scb-header-tab-${r.length}`;h.getAttribute("slot")!==w&&h.setAttribute("slot",w),h.hasAttribute("as-tab")||h.setAttribute("as-tab",""),r.push({kind:"dropdown",slotName:w,label:g});continue}if(_==="scb-header-utility"){i.push({label:h.getAttribute("label")??"",href:h.getAttribute("href")??"#",target:h.getAttribute("target")??void 0});continue}if(_==="scb-header-menu-group"){const g={label:h.getAttribute("label")??"",icon:h.getAttribute("icon")??void 0,children:[]};h.querySelectorAll("scb-header-menu-item").forEach(w=>g.children.push(l(w))),a.push(g);continue}_==="scb-header-menu-item"&&a.push(l(h))}const u=!this._sameNavItems(this._slotNavItems,r),p=!this._sameUtilityItems(this._slotUtils,i),y=!this._sameMenuNodes(this._slotMenu,a);u&&(this._slotNavItems=r),p&&(this._slotUtils=i),y&&(this._slotMenu=a),!this.hasAttribute("active-tab")&&d>=0&&this.activeTab!==d&&(this.activeTab=d),(t.scheduleMeasure??!0)&&queueMicrotask(()=>{this.updateComplete.then(()=>{this._scheduleMeasure()})})},this._measure=()=>{if(this.layoutPending)return;const t=this._top,s=this._logoGroup;if(!t||!s)return;const r=window.innerWidth,i=t.clientWidth,a=this._overflows(this._util),d=this._tabsOverflows(),l=r<this.BP_MD||a||d;this._collapsed?!l&&i>=this._unlockAtWidth&&this._setCollapsed(!1):l&&(this._unlockAtWidth=i+this._HYST,this._setCollapsed(!0));let u=!1;if(this.showSearch&&r>=this.BP_SM&&r<this.BP_MD&&this._searchWrap){const y=getComputedStyle(this._searchWrap),h=Math.max(this._num(y.minWidth,this._tokenPx("--scb-header-search-min",250)),this._tokenPx("--scb-header-search-min",250)),_=this._num(getComputedStyle(t).gap,this._tokenPx("--spacing-7",24)),g=this.showDrawer&&(this.alwaysShowMenuButton||r<this.BP_MD||this._collapsed)?this._menuBtn?.getBoundingClientRect().width||this._tokenPx("--icon-size-extra-extra-large",48):0;u=s.getBoundingClientRect().width+_+h+_+g+8>i+.5}this._setHideSearch(u);let p=!1;if(this.showDrawer&&(this.alwaysShowMenuButton||r<this.BP_MD||this._collapsed)&&!this._visible(this._util)&&!this._visible(this._searchWrap)){const y=this._num(getComputedStyle(t).gap,this._tokenPx("--spacing-7",24)),h=this._menuBtn?.getBoundingClientRect().width||this._tokenPx("--icon-size-extra-extra-large",48),_=(this._logoGroup?.getBoundingClientRect().width||0)+y+h;this._hideLogoText?p=!(i>=this._logoTextUnlockAt):_>i+.5&&(p=!0,this._logoTextUnlockAt=i+this._HYST)}else p=!1,this._logoTextUnlockAt=0;this._setHideLogoText(p)},this._onDrawerOpened=()=>{this._menuExpanded=!0,this._syncMenuBtnAria(),this.dispatchEvent(new CustomEvent("drawer-open",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("draweropen",{bubbles:!0,composed:!0}))},this._onDrawerClosed=()=>{this._menuExpanded=!1,this._syncMenuBtnAria(),this.dispatchEvent(new CustomEvent("drawer-close",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("drawerclose",{bubbles:!0,composed:!0}))},this._onMenuClick=async t=>{this.showDrawer&&(this.dispatchEvent(new CustomEvent("menu-click",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("menuclick",{bubbles:!0,composed:!0})),!this._drawerReady&&(t.stopPropagation(),await this._ensureDrawerReady(),await this.updateComplete,this._openDrawerNow()))},this._onSearchClick=t=>{const s=this._searchEl;if(s?.submit&&typeof s.submit=="function"){s.submit();return}const r=s?.value??"";this.searchText=r,this.dispatchEvent(new CustomEvent("search-click",{detail:{value:r},bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("searchclick",{detail:{value:r},bubbles:!0,composed:!0})),s?.focus?.()},this._onTabClick=t=>{const s=t.currentTarget;if(!s)return;const r=s.tagName.toLowerCase()==="a";if(r&&(t.defaultPrevented||t.button!==0||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey))return;const i=s.getAttribute("data-index"),a=i!=null?Number(i):0,d=this._getNavItems()[a];if(d?.kind==="dropdown")return;this.activeTab=a;const l=d?.kind==="tab"?d.href??"":"",u=new CustomEvent("tab-change",{detail:{index:a,href:l},bubbles:!0,composed:!0,cancelable:!0}),p=new CustomEvent("tabchange",{detail:{index:a,href:l},bubbles:!0,composed:!0,cancelable:!0});!(this.dispatchEvent(u)&&this.dispatchEvent(p))&&r&&t.preventDefault()},this._onDropdownTabActivate=t=>{const s=t.detail?.dataIndex,r=typeof s=="number"?s:typeof s=="string"?Number(s):this._readTabIndexFromEvent(t);if(r==null||!Number.isFinite(r))return;const i=this._getNavItems();r<0||r>=i.length||i[r]?.kind==="dropdown"&&(this.activeTab=r,this.dispatchEvent(new CustomEvent("tab-change",{detail:{index:r,href:""},bubbles:!0,composed:!0,cancelable:!0})),this.dispatchEvent(new CustomEvent("tabchange",{detail:{index:r,href:""},bubbles:!0,composed:!0,cancelable:!0})))},this._onTabsKeydown=t=>{const s=t.key;if(s!=="ArrowLeft"&&s!=="ArrowRight"&&s!=="Home"&&s!=="End")return;const r=this._getNavItems();if(!r.length)return;const i=this._readTabIndexFromEvent(t);if(i==null)return;let a=Math.max(0,Math.min(r.length-1,i));s==="ArrowRight"?a=(a+1)%r.length:s==="ArrowLeft"?a=(a-1+r.length)%r.length:s==="Home"?a=0:s==="End"&&(a=r.length-1),t.preventDefault(),this._focusTabAtIndex(a)},this._onSearchInput=t=>{this.searchText=t.detail?.value??"",this.dispatchEvent(new CustomEvent("search-input",{detail:{value:this.searchText},bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("searchinput",{detail:{value:this.searchText},bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("search-text-change",{detail:{value:this.searchText},bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("searchtextchange",{detail:{value:this.searchText},bubbles:!0,composed:!0}))},this._onSearchSubmit=t=>{this.searchText=t.detail?.value??"",this.dispatchEvent(new CustomEvent("search-change",{detail:{value:this.searchText,active:t.detail?.active},bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("searchchange",{detail:{value:this.searchText,active:t.detail?.active},bubbles:!0,composed:!0}))},this._onSearchClear=()=>{this.searchText="",this.dispatchEvent(new CustomEvent("search-text-change",{detail:{value:""},bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("searchtextchange",{detail:{value:""},bubbles:!0,composed:!0}))};const e=++I;this._drawerId=`scb-header-drawer-${e}`,this._searchId=`scb-header-search-${e}`}requestLayout(){this.layoutPending||(this.setAttribute("data-layout-settling",""),this.updateComplete.then(()=>{requestAnimationFrame(()=>{this.isConnected&&(this._measure(),this.removeAttribute("data-layout-settling"))})}))}get _HYST(){return this._tokenPx("--spacing-11",64)}get BP_SM(){return this._tokenPx("--bp-sm",C.BP_SM_DEFAULT)}get BP_MD(){return this._tokenPx("--bp-md",C.BP_MD_DEFAULT)}_scheduleHarvest(){this._harvestPending||(this._harvestPending=!0,queueMicrotask(()=>{this._harvestPending=!1,this._harvest()}))}get _top(){return this.renderRoot.querySelector(".top-row")}get _util(){return this.renderRoot.querySelector(".utility")}get _logoGroup(){return this.renderRoot.querySelector(".logo-wrap")||this.renderRoot.querySelector(".logo-group")}get _searchWrap(){return this.renderRoot.querySelector(".search")}get _menuBtn(){return this.renderRoot.querySelector(".menu-trigger")}get _searchEl(){return this.renderRoot.querySelector(`#${this._searchId}`)}get _tabsNav(){return this.renderRoot.querySelector(".tabs-nav")}_attachSlotObservers(){this._slotMo?.disconnect(),this._slotWatchers.forEach(i=>i.disconnect()),this._slotWatchers=[];const e=["label","href","icon","target","selected","aria-current","active"],t=i=>{const a=new MutationObserver(d=>{this._scheduleHarvest()});this._slotWatchers.push(a),a.observe(i,{attributes:!0,attributeFilter:e})},s=()=>{this._slotWatchers.forEach(a=>a.disconnect()),this._slotWatchers=[];const i=Array.from(this.children);for(const a of i){const d=a.tagName.toLowerCase();if((d==="scb-header-tab"||d==="scb-dropdown"||d==="scb-header-utility"||d==="scb-header-menu-item"||d==="scb-header-menu-group"||d==="scb-badge")&&t(a),d==="scb-badge"){const l=a,u=new MutationObserver(y=>{s(),this._scheduleHarvest()});this._slotWatchers.push(u),u.observe(l,{childList:!0});const p=l.querySelector("scb-dropdown");p&&t(p);continue}if(d==="scb-header-menu-group"){const l=a,u=new MutationObserver(p=>{s(),this._scheduleHarvest()});this._slotWatchers.push(u),u.observe(l,{childList:!0,subtree:!0}),l.querySelectorAll("scb-header-menu-item").forEach(p=>t(p))}}},r=new MutationObserver(i=>{let a=!1;for(const d of i)if(d.type==="childList"){a=!0;break}a&&s(),this._scheduleHarvest()});this._slotMo=r,r.observe(this,{childList:!0}),s()}_sameNavItems(e,t){if(e.length!==t.length)return!1;for(let s=0;s<e.length;s+=1){const r=e[s],i=t[s];if(!r||!i||r.kind!==i.kind||r.label!==i.label)return!1;if(r.kind==="tab"&&i.kind==="tab"){if((r.href??"")!==(i.href??""))return!1}else if(r.kind==="dropdown"&&i.kind==="dropdown"&&r.slotName!==i.slotName)return!1}return!0}_sameUtilityItems(e,t){if(e.length!==t.length)return!1;for(let s=0;s<e.length;s+=1){const r=e[s],i=t[s];if(!r||!i||r.label!==i.label||r.href!==i.href||(r.target??"")!==(i.target??""))return!1}return!0}_sameMenuNodes(e,t){if(e.length!==t.length)return!1;for(let s=0;s<e.length;s+=1){const r=e[s],i=t[s];if(!r||!i||r.label!==i.label||(r.href??"")!==(i.href??"")||(r.icon??"")!==(i.icon??"")||!this._sameMenuNodes(r.children??[],i.children??[]))return!1}return!0}_setCollapsed(e){this._collapsed!==e&&(this._collapsed=e,e?this.setAttribute("data-collapsed",""):this.removeAttribute("data-collapsed"))}_setHideSearch(e){e?this.setAttribute("data-hide-search",""):this.removeAttribute("data-hide-search")}_setHideLogoText(e){this._hideLogoText!==e&&(this._hideLogoText=e,e?this.setAttribute("data-hide-logo-text",""):this.removeAttribute("data-hide-logo-text"))}_num(e,t){const s=Number.parseFloat(String(e??"").trim());return Number.isFinite(s)?s:t}_tokenPx(e,t){const s=getComputedStyle(this);return this._num(s.getPropertyValue(e),t)}_visible(e){return e?getComputedStyle(e).display!=="none":!1}_overflows(e){return!e||!this._visible(e)?!1:e.scrollWidth>e.clientWidth+1}_tabsOverflows(){const e=this._tabsNav;if(!e||!this._visible(e))return!1;const t=Array.from(e.querySelectorAll(".tab-wrap"));if(t.length===0)return!1;const s=e.getBoundingClientRect();let r=s.left;for(const i of t){const a=i.getBoundingClientRect();a.width<=0||a.right>r&&(r=a.right)}return r-s.left>s.width+1}connectedCallback(){super.connectedCallback(),this._initialUpgradeComplete||this.setAttribute("data-upgrading",""),this._harvest({scheduleMeasure:!1}),this._attachSlotObservers()}_finishInitialUpgrade(){this._initialUpgradeComplete||(this._initialUpgradeComplete=!0,requestAnimationFrame(()=>{this.isConnected&&(this._measure(),this.removeAttribute("data-upgrading"))}))}firstUpdated(){this.showDrawer&&!this.deferDrawer&&this._ensureDrawerReady(),this.updateComplete.then(()=>{this._harvest({scheduleMeasure:!1}),this._attachSlotObservers(),this._syncDropdownTabs(),this._finishInitialUpgrade()});const e=this._top;e&&(this._ro=new ResizeObserver(()=>this._scheduleMeasure()),this._ro.observe(e)),window.addEventListener("resize",this._onWindowResize,{passive:!0})}updated(e){e.has("searchMax")&&this.style.setProperty("--scb-header-search-max",this.searchMax??"380px"),e.has("searchMin")&&this.style.setProperty("--scb-header-search-min",this.searchMin??"250px"),e.has("searchHeight")&&(this.searchHeight&&this.searchHeight.trim()?this.style.setProperty("--scb-search-height",this.searchHeight.trim()):this.style.removeProperty("--scb-search-height")),(e.has("logoWidth")||e.has("logoHeight")||e.has("logoAspectRatio"))&&this._applyLogoSizing(),(e.has("spacing")||e.has("spacingTop")||e.has("spacingBottom"))&&this._applySpacing(),(e.has("utilityItems")||e.has("tabs")||e.has("logoText")||e.has("logotypeText")||e.has("logoSrc")||e.has("logoWidth")||e.has("logoHeight")||e.has("logoAspectRatio")||e.has("activeTab")||e.has("_slotNavItems")||e.has("_slotUtils")||e.has("_slotMenu")||e.has("showDrawer")||e.has("alwaysShowMenuButton")||e.has("showSearch")||e.has("layoutPending")||e.has("searchMax")||e.has("searchMin")||e.has("size"))&&this.updateComplete.then(()=>{this._scheduleMeasure()}),(e.has("showDrawer")||e.has("deferDrawer"))&&this.showDrawer&&!this.deferDrawer&&this._ensureDrawerReady(),e.has("layoutPending")&&!this.layoutPending&&this.requestLayout(),(e.has("activeTab")||e.has("_slotNavItems")||e.has("tabs")||e.has("size"))&&this.updateComplete.then(()=>{this._syncDropdownTabs()})}disconnectedCallback(){this._ro?.disconnect(),this._slotMo?.disconnect(),this._slotWatchers.forEach(e=>e.disconnect()),this._slotWatchers=[],window.removeEventListener("resize",this._onWindowResize),super.disconnectedCallback()}_mapSpacingToken(e){if(!e)return;const t=String(e).trim();if(t)return/^\d+$/.test(t)?`var(--spacing-${Math.max(0,Math.min(14,parseInt(t,10)))})`:t}_applySpacing(){const e=this._mapSpacingToken(this.spacing),t=this._mapSpacingToken(this.spacingTop)??e,s=this._mapSpacingToken(this.spacingBottom)??e;t?this.style.setProperty("--scb-header-spacing-block-start",t):this.style.removeProperty("--scb-header-spacing-block-start"),s?this.style.setProperty("--scb-header-spacing-block-end",s):this.style.removeProperty("--scb-header-spacing-block-end")}_applyLogoSizing(){const e=(this.logoWidth??"").trim(),t=(this.logoHeight??"").trim(),s=(this.logoAspectRatio??"").trim();e?this.style.setProperty("--scb-header-logo-img-w",e):this.style.removeProperty("--scb-header-logo-img-w"),t?this.style.setProperty("--scb-header-logo-img-h",t):e?this.style.setProperty("--scb-header-logo-img-h","auto"):this.style.removeProperty("--scb-header-logo-img-h"),s?this.style.setProperty("--scb-header-logo-img-aspect-ratio",s):this.style.removeProperty("--scb-header-logo-img-aspect-ratio")}_closeDrawerNow(){const e=this.renderRoot.querySelector(`#${this._drawerId}`);e&&(e.open=!1)}_openDrawerNow(){const e=this.renderRoot.querySelector(`#${this._drawerId}`);e&&(e.open=!0)}async _ensureDrawerReady(){this._drawerReady||(this._drawerImportPromise??(this._drawerImportPromise=Promise.all([$(()=>import("../scb-drawer/scb-drawer.js"),__vite__mapDeps([0,1,2,3,4,5]),import.meta.url),$(()=>import("../scb-menu/scb-menu.js"),__vite__mapDeps([6,5,1,2,3,4,7,8,9,10,11]),import.meta.url)]).then(()=>{})),await this._drawerImportPromise,this._drawerReady=!0)}_syncMenuBtnAria(){this.renderRoot.querySelectorAll(".menu-trigger").forEach(e=>{e.setAttribute("aria-expanded",String(this._menuExpanded))})}_getNavItems(){return this._slotNavItems.length?this._slotNavItems:(this.tabs??[]).map(e=>({kind:"tab",...e}))}_getDropdownForSlot(e){const t=this.querySelector(`[slot="${e}"]`);return t?t.tagName.toLowerCase()==="scb-dropdown"?t:t.querySelector("scb-dropdown"):null}_syncDropdownTabs(){this._getNavItems().forEach((e,t)=>{if(e.kind!=="dropdown")return;const s=this._getDropdownForSlot(e.slotName);if(!s)return;const r=String(t);s.getAttribute("data-index")!==r&&s.setAttribute("data-index",r),s.hasAttribute("as-tab")||s.setAttribute("as-tab","");const i=this.size,a=s;a?.size!==i&&(a.size=i),t===this.activeTab?s.getAttribute("aria-current")!=="page"&&s.setAttribute("aria-current","page"):s.hasAttribute("aria-current")&&s.removeAttribute("aria-current")})}_readTabIndexFromEvent(e){const t=e.composedPath?e.composedPath():[];for(const s of t){if(!(s instanceof HTMLElement))continue;const r=s.getAttribute("data-index");if(r==null)continue;const i=Number(r);if(Number.isFinite(i))return i}return null}_focusTabAtIndex(e){const t=this._getNavItems()[e];if(t){if(t.kind==="dropdown"){this._getDropdownForSlot(t.slotName)?.focus?.();return}this.renderRoot.querySelector(`.tab-link[data-index="${e}"]`)?.focus?.()}}_renderMenuNodes(e){return!e||e.length===0?m``:m`${e.map(t=>this._renderMenuNode(t))}`}_renderMenuNode(e){const t=Array.isArray(e.children)&&e.children.length>0,s=(e.href??"").trim(),r=(e.icon??"").trim();return m`
|
|
53
|
+
`,document.head.appendChild(b);const e=l=>{const u=String(l??"").trim();if(u)return/^\d+$/.test(u)?`var(--spacing-${Math.max(0,Math.min(14,parseInt(u,10)))})`:u},t=l=>{const u=String(l??"").trim();if(!u)return!1;try{const p=JSON.parse(u);return Array.isArray(p)&&p.length>0}catch{return!1}},s=l=>l!=null&&!/^(false|0|off|no)$/i.test(l.trim()),r=l=>{for(const u of Array.from(l.children)){const p=u.tagName.toLowerCase();if(p==="scb-header-tab"||p==="scb-dropdown")return!0}return!1},i=l=>{r(l)||t(l.getAttribute("tabs"))||s(l.getAttribute("reserve-tabs"))||s(l.getAttribute("layout-pending"))?l.setAttribute("data-pre-has-tabs",""):l.removeAttribute("data-pre-has-tabs");const u=e(l.getAttribute("spacing")),p=e(l.getAttribute("spacing-top"))??u,y=e(l.getAttribute("spacing-bottom"))??u;p?l.style.setProperty("--scb-header-spacing-block-start",p):l.style.removeProperty("--scb-header-spacing-block-start"),y?l.style.setProperty("--scb-header-spacing-block-end",y):l.style.removeProperty("--scb-header-spacing-block-end");const h=(l.getAttribute("logo-width")??"").trim();h?l.style.setProperty("--scb-header-pre-logo-w",h):l.style.removeProperty("--scb-header-pre-logo-w");const _=(l.getAttribute("logo-height")??"").trim();_?l.style.setProperty("--scb-header-pre-logo-img-h",_):l.style.removeProperty("--scb-header-pre-logo-img-h");const g=(l.getAttribute("search-height")??"").trim();g?l.style.setProperty("--scb-header-pre-control-size",g):l.style.removeProperty("--scb-header-pre-control-size")};document.querySelectorAll("scb-header").forEach(i);const d=new MutationObserver(l=>{for(const u of l){if(u.type==="attributes"){const p=u.target;p instanceof HTMLElement&&p.tagName.toLowerCase()==="scb-header"&&i(p);continue}if(u.type==="childList"){const p=[...Array.from(u.addedNodes),...Array.from(u.removedNodes)];for(const y of p){if(!(y instanceof HTMLElement))continue;if(y.tagName.toLowerCase()==="scb-header"){i(y);continue}const h=y.closest?.("scb-header");h&&i(h)}}}});d.observe(document.documentElement,{subtree:!0,childList:!0,attributes:!0,attributeFilter:["tabs","spacing","spacing-top","spacing-bottom","logo-width","logo-height","logo-aspect-ratio","logo-alt","logotype-text","search-height","reserve-tabs","layout-pending"]}),customElements.whenDefined("scb-header").then(()=>{d.disconnect()})};N();var T={fromAttribute:b=>b==null?!0:!/^(false|0|off|no)$/i.test(b),toAttribute:b=>String(!!b)},A={fromAttribute:b=>b==null?!1:!/^(false|0|off|no)$/i.test(b),toAttribute:b=>b?"":null},z={fromAttribute:b=>b==="small"||b==="large"?b:"medium",toAttribute:b=>{const e=String(b??"");return e==="small"||e==="large"?e:null}},o=(S=class extends M{constructor(){super(),this.maxWidth="1440px",this.spacing=void 0,this.spacingTop=void 0,this.spacingBottom=void 0,this.size="medium",this.logoText="",this.logotypeText="",this.logoAlt="",this.logoHref="/",this.logoSrc="",this.logoWidth="",this.logoHeight="",this.logoAspectRatio="",this.logoInvertDm=!1,this.banner=!1,this.tabs=[],this.activeTab=null,this.reserveTabs=!1,this.layoutPending=!1,this.utilityItems=[],this.searchButtonLabel="Sök",this.menuButtonLabel="Meny",this.deferDrawer=!1,this.showDrawer=!0,this.alwaysShowMenuButton=!1,this.showSearch=!0,this.includeUtilityInMenu=!1,this.drawerOverlay=!0,this.searchText="",this._drawerId="main-drawer",this._menuExpanded=!1,this._searchId="header-search",this._drawerReady=!1,this._initialUpgradeComplete=!1,this._slotNavItems=[],this._slotUtils=[],this._slotMenu=[],this._measureScheduled=!1,this._scheduleMeasure=()=>{this.layoutPending||this._measureScheduled||(this._measureScheduled=!0,requestAnimationFrame(()=>{this._measureScheduled=!1,this._measure()}))},this._onWindowResize=()=>{this._scheduleMeasure()},this._onMenuSelect=t=>{const s=t.detail;this.dispatchEvent(new CustomEvent("scb-menu-select",{detail:s,bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("scbmenuselect",{detail:s,bubbles:!0,composed:!0}));const r=s?.item,i=typeof s?.href=="string"?s.href:typeof s?.itemHref=="string"?s.itemHref:typeof s?.item_href=="string"?s.item_href:"",a=r?r.getAttribute("item-href")??r.getAttribute("href")??"":"";String(i||a||"").trim()&&this._closeDrawerNow()},this._collapsed=!1,this._unlockAtWidth=0,this._hideLogoText=!1,this._logoTextUnlockAt=0,this._slotWatchers=[],this._harvestPending=!1,this._harvest=(t={})=>{const s=Array.from(this.children),r=[],i=[],a=[];let d=-1;const l=h=>({label:h.getAttribute("label")??"",href:h.getAttribute("href")??void 0,icon:h.getAttribute("icon")??void 0});for(const h of s){const _=h.tagName.toLowerCase();if(_==="scb-header-tab"){const g=h.getAttribute("label")??"",w=h.getAttribute("href"),v=w&&w.trim()!==""?w:void 0;(h.hasAttribute("selected")||h.getAttribute("selected")==="true"||h.getAttribute("active")==="true"||h.getAttribute("aria-current")==="page")&&d===-1&&(d=r.length),r.push({kind:"tab",label:g,href:v});continue}if(_==="scb-badge"){const g=h.querySelector("scb-dropdown");if(g){const w=g.getAttribute("label")??"";(g.hasAttribute("selected")||g.getAttribute("selected")==="true"||g.getAttribute("active")==="true"||g.getAttribute("aria-current")==="page")&&d===-1&&(d=r.length);const v=`scb-header-tab-${r.length}`;h.getAttribute("slot")!==v&&h.setAttribute("slot",v),g.hasAttribute("slot")&&g.removeAttribute("slot"),g.hasAttribute("as-tab")||g.setAttribute("as-tab",""),r.push({kind:"dropdown",slotName:v,label:w});continue}}if(_==="scb-dropdown"){const g=h.getAttribute("label")??"";(h.hasAttribute("selected")||h.getAttribute("selected")==="true"||h.getAttribute("active")==="true"||h.getAttribute("aria-current")==="page")&&d===-1&&(d=r.length);const w=`scb-header-tab-${r.length}`;h.getAttribute("slot")!==w&&h.setAttribute("slot",w),h.hasAttribute("as-tab")||h.setAttribute("as-tab",""),r.push({kind:"dropdown",slotName:w,label:g});continue}if(_==="scb-header-utility"){i.push({label:h.getAttribute("label")??"",href:h.getAttribute("href")??"#",target:h.getAttribute("target")??void 0});continue}if(_==="scb-header-menu-group"){const g={label:h.getAttribute("label")??"",icon:h.getAttribute("icon")??void 0,children:[]};h.querySelectorAll("scb-header-menu-item").forEach(w=>g.children.push(l(w))),a.push(g);continue}_==="scb-header-menu-item"&&a.push(l(h))}const u=!this._sameNavItems(this._slotNavItems,r),p=!this._sameUtilityItems(this._slotUtils,i),y=!this._sameMenuNodes(this._slotMenu,a);u&&(this._slotNavItems=r),p&&(this._slotUtils=i),y&&(this._slotMenu=a),!this.hasAttribute("active-tab")&&d>=0&&this.activeTab!==d&&(this.activeTab=d),(t.scheduleMeasure??!0)&&queueMicrotask(()=>{this.updateComplete.then(()=>{this._scheduleMeasure()})})},this._measure=()=>{if(this.layoutPending)return;const t=this._top,s=this._logoGroup;if(!t||!s)return;const r=window.innerWidth,i=t.clientWidth,a=this._overflows(this._util),d=this._tabsOverflows(),l=r<this.BP_MD||a||d;this._collapsed?!l&&i>=this._unlockAtWidth&&this._setCollapsed(!1):l&&(this._unlockAtWidth=i+this._HYST,this._setCollapsed(!0));let u=!1;if(this.showSearch&&r>=this.BP_SM&&r<this.BP_MD&&this._searchWrap){const y=getComputedStyle(this._searchWrap),h=Math.max(this._num(y.minWidth,this._tokenPx("--scb-header-search-min",250)),this._tokenPx("--scb-header-search-min",250)),_=this._num(getComputedStyle(t).gap,this._tokenPx("--spacing-7",24)),g=this.showDrawer&&(this.alwaysShowMenuButton||r<this.BP_MD||this._collapsed)?this._menuBtn?.getBoundingClientRect().width||this._tokenPx("--icon-size-extra-extra-large",48):0;u=s.getBoundingClientRect().width+_+h+_+g+8>i+.5}this._setHideSearch(u);let p=!1;if(this.showDrawer&&(this.alwaysShowMenuButton||r<this.BP_MD||this._collapsed)&&!this._visible(this._util)&&!this._visible(this._searchWrap)){const y=this._num(getComputedStyle(t).gap,this._tokenPx("--spacing-7",24)),h=this._menuBtn?.getBoundingClientRect().width||this._tokenPx("--icon-size-extra-extra-large",48),_=(this._logoGroup?.getBoundingClientRect().width||0)+y+h;this._hideLogoText?p=!(i>=this._logoTextUnlockAt):_>i+.5&&(p=!0,this._logoTextUnlockAt=i+this._HYST)}else p=!1,this._logoTextUnlockAt=0;this._setHideLogoText(p)},this._onDrawerOpened=()=>{this._menuExpanded=!0,this._syncMenuBtnAria(),this.dispatchEvent(new CustomEvent("drawer-open",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("draweropen",{bubbles:!0,composed:!0}))},this._onDrawerClosed=()=>{this._menuExpanded=!1,this._syncMenuBtnAria(),this.dispatchEvent(new CustomEvent("drawer-close",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("drawerclose",{bubbles:!0,composed:!0}))},this._onMenuClick=async t=>{this.showDrawer&&(this.dispatchEvent(new CustomEvent("menu-click",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("menuclick",{bubbles:!0,composed:!0})),!this._drawerReady&&(t.stopPropagation(),await this._ensureDrawerReady(),await this.updateComplete,this._openDrawerNow()))},this._onSearchClick=t=>{const s=this._searchEl;if(s?.submit&&typeof s.submit=="function"){s.submit();return}const r=s?.value??"";this.searchText=r,this.dispatchEvent(new CustomEvent("search-click",{detail:{value:r},bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("searchclick",{detail:{value:r},bubbles:!0,composed:!0})),s?.focus?.()},this._onTabClick=t=>{const s=t.currentTarget;if(!s)return;const r=s.tagName.toLowerCase()==="a";if(r&&(t.defaultPrevented||t.button!==0||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey))return;const i=s.getAttribute("data-index"),a=i!=null?Number(i):0,d=this._getNavItems()[a];if(d?.kind==="dropdown")return;this.activeTab=a;const l=d?.kind==="tab"?d.href??"":"",u=new CustomEvent("tab-change",{detail:{index:a,href:l},bubbles:!0,composed:!0,cancelable:!0}),p=new CustomEvent("tabchange",{detail:{index:a,href:l},bubbles:!0,composed:!0,cancelable:!0});!(this.dispatchEvent(u)&&this.dispatchEvent(p))&&r&&t.preventDefault()},this._onDropdownTabActivate=t=>{const s=t.detail?.dataIndex,r=typeof s=="number"?s:typeof s=="string"?Number(s):this._readTabIndexFromEvent(t);if(r==null||!Number.isFinite(r))return;const i=this._getNavItems();r<0||r>=i.length||i[r]?.kind==="dropdown"&&(this.activeTab=r,this.dispatchEvent(new CustomEvent("tab-change",{detail:{index:r,href:""},bubbles:!0,composed:!0,cancelable:!0})),this.dispatchEvent(new CustomEvent("tabchange",{detail:{index:r,href:""},bubbles:!0,composed:!0,cancelable:!0})))},this._onTabsKeydown=t=>{const s=t.key;if(s!=="ArrowLeft"&&s!=="ArrowRight"&&s!=="Home"&&s!=="End")return;const r=this._getNavItems();if(!r.length)return;const i=this._readTabIndexFromEvent(t);if(i==null)return;let a=Math.max(0,Math.min(r.length-1,i));s==="ArrowRight"?a=(a+1)%r.length:s==="ArrowLeft"?a=(a-1+r.length)%r.length:s==="Home"?a=0:s==="End"&&(a=r.length-1),t.preventDefault(),this._focusTabAtIndex(a)},this._onSearchInput=t=>{this.searchText=t.detail?.value??"",this.dispatchEvent(new CustomEvent("search-input",{detail:{value:this.searchText},bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("searchinput",{detail:{value:this.searchText},bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("search-text-change",{detail:{value:this.searchText},bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("searchtextchange",{detail:{value:this.searchText},bubbles:!0,composed:!0}))},this._onSearchSubmit=t=>{this.searchText=t.detail?.value??"",this.dispatchEvent(new CustomEvent("search-change",{detail:{value:this.searchText,active:t.detail?.active},bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("searchchange",{detail:{value:this.searchText,active:t.detail?.active},bubbles:!0,composed:!0}))},this._onSearchClear=()=>{this.searchText="",this.dispatchEvent(new CustomEvent("search-text-change",{detail:{value:""},bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("searchtextchange",{detail:{value:""},bubbles:!0,composed:!0}))};const e=++I;this._drawerId=`scb-header-drawer-${e}`,this._searchId=`scb-header-search-${e}`}requestLayout(){this.layoutPending||(this.setAttribute("data-layout-settling",""),this.updateComplete.then(()=>{this.isConnected&&(this._measure(),this.removeAttribute("data-layout-settling"))}))}get _HYST(){return this._tokenPx("--spacing-11",64)}get BP_SM(){return this._tokenPx("--bp-sm",C.BP_SM_DEFAULT)}get BP_MD(){return this._tokenPx("--bp-md",C.BP_MD_DEFAULT)}_scheduleHarvest(){this._harvestPending||(this._harvestPending=!0,queueMicrotask(()=>{this._harvestPending=!1,this._harvest()}))}get _top(){return this.renderRoot.querySelector(".top-row")}get _util(){return this.renderRoot.querySelector(".utility")}get _logoGroup(){return this.renderRoot.querySelector(".logo-wrap")||this.renderRoot.querySelector(".logo-group")}get _searchWrap(){return this.renderRoot.querySelector(".search")}get _menuBtn(){return this.renderRoot.querySelector(".menu-trigger")}get _searchEl(){return this.renderRoot.querySelector(`#${this._searchId}`)}get _tabsNav(){return this.renderRoot.querySelector(".tabs-nav")}_attachSlotObservers(){this._slotMo?.disconnect(),this._slotWatchers.forEach(i=>i.disconnect()),this._slotWatchers=[];const e=["label","href","icon","target","selected","aria-current","active"],t=i=>{const a=new MutationObserver(d=>{this._scheduleHarvest()});this._slotWatchers.push(a),a.observe(i,{attributes:!0,attributeFilter:e})},s=()=>{this._slotWatchers.forEach(a=>a.disconnect()),this._slotWatchers=[];const i=Array.from(this.children);for(const a of i){const d=a.tagName.toLowerCase();if((d==="scb-header-tab"||d==="scb-dropdown"||d==="scb-header-utility"||d==="scb-header-menu-item"||d==="scb-header-menu-group"||d==="scb-badge")&&t(a),d==="scb-badge"){const l=a,u=new MutationObserver(y=>{s(),this._scheduleHarvest()});this._slotWatchers.push(u),u.observe(l,{childList:!0});const p=l.querySelector("scb-dropdown");p&&t(p);continue}if(d==="scb-header-menu-group"){const l=a,u=new MutationObserver(p=>{s(),this._scheduleHarvest()});this._slotWatchers.push(u),u.observe(l,{childList:!0,subtree:!0}),l.querySelectorAll("scb-header-menu-item").forEach(p=>t(p))}}},r=new MutationObserver(i=>{let a=!1;for(const d of i)if(d.type==="childList"){a=!0;break}a&&s(),this._scheduleHarvest()});this._slotMo=r,r.observe(this,{childList:!0}),s()}_sameNavItems(e,t){if(e.length!==t.length)return!1;for(let s=0;s<e.length;s+=1){const r=e[s],i=t[s];if(!r||!i||r.kind!==i.kind||r.label!==i.label)return!1;if(r.kind==="tab"&&i.kind==="tab"){if((r.href??"")!==(i.href??""))return!1}else if(r.kind==="dropdown"&&i.kind==="dropdown"&&r.slotName!==i.slotName)return!1}return!0}_sameUtilityItems(e,t){if(e.length!==t.length)return!1;for(let s=0;s<e.length;s+=1){const r=e[s],i=t[s];if(!r||!i||r.label!==i.label||r.href!==i.href||(r.target??"")!==(i.target??""))return!1}return!0}_sameMenuNodes(e,t){if(e.length!==t.length)return!1;for(let s=0;s<e.length;s+=1){const r=e[s],i=t[s];if(!r||!i||r.label!==i.label||(r.href??"")!==(i.href??"")||(r.icon??"")!==(i.icon??"")||!this._sameMenuNodes(r.children??[],i.children??[]))return!1}return!0}_setCollapsed(e){this._collapsed!==e&&(this._collapsed=e,e?this.setAttribute("data-collapsed",""):this.removeAttribute("data-collapsed"))}_setHideSearch(e){e?this.setAttribute("data-hide-search",""):this.removeAttribute("data-hide-search")}_setHideLogoText(e){this._hideLogoText!==e&&(this._hideLogoText=e,e?this.setAttribute("data-hide-logo-text",""):this.removeAttribute("data-hide-logo-text"))}_num(e,t){const s=Number.parseFloat(String(e??"").trim());return Number.isFinite(s)?s:t}_tokenPx(e,t){const s=getComputedStyle(this);return this._num(s.getPropertyValue(e),t)}_visible(e){return e?getComputedStyle(e).display!=="none":!1}_overflows(e){return!e||!this._visible(e)?!1:e.scrollWidth>e.clientWidth+1}_tabsOverflows(){const e=this._tabsNav;if(!e||!this._visible(e))return!1;const t=Array.from(e.querySelectorAll(".tab-wrap"));if(t.length===0)return!1;const s=e.getBoundingClientRect();let r=s.left;for(const i of t){const a=i.getBoundingClientRect();a.width<=0||a.right>r&&(r=a.right)}return r-s.left>s.width+1}connectedCallback(){super.connectedCallback(),this._initialUpgradeComplete||this.setAttribute("data-upgrading",""),this._harvest({scheduleMeasure:!1}),this._attachSlotObservers()}_finishInitialUpgrade(){this._initialUpgradeComplete||(this._initialUpgradeComplete=!0,requestAnimationFrame(()=>{this.isConnected&&(this._measure(),this.removeAttribute("data-upgrading"))}))}firstUpdated(){this.showDrawer&&!this.deferDrawer&&this._ensureDrawerReady(),this.updateComplete.then(()=>{this._harvest({scheduleMeasure:!1}),this._attachSlotObservers(),this._syncDropdownTabs(),this._finishInitialUpgrade()});const e=this._top;e&&(this._ro=new ResizeObserver(()=>this._scheduleMeasure()),this._ro.observe(e)),window.addEventListener("resize",this._onWindowResize,{passive:!0})}updated(e){e.has("searchMax")&&this.style.setProperty("--scb-header-search-max",this.searchMax??"380px"),e.has("searchMin")&&this.style.setProperty("--scb-header-search-min",this.searchMin??"250px"),e.has("searchHeight")&&(this.searchHeight&&this.searchHeight.trim()?this.style.setProperty("--scb-search-height",this.searchHeight.trim()):this.style.removeProperty("--scb-search-height")),(e.has("logoWidth")||e.has("logoHeight")||e.has("logoAspectRatio"))&&this._applyLogoSizing(),(e.has("spacing")||e.has("spacingTop")||e.has("spacingBottom"))&&this._applySpacing(),(e.has("utilityItems")||e.has("tabs")||e.has("logoText")||e.has("logotypeText")||e.has("logoSrc")||e.has("logoWidth")||e.has("logoHeight")||e.has("logoAspectRatio")||e.has("activeTab")||e.has("_slotNavItems")||e.has("_slotUtils")||e.has("_slotMenu")||e.has("showDrawer")||e.has("alwaysShowMenuButton")||e.has("showSearch")||e.has("layoutPending")||e.has("searchMax")||e.has("searchMin")||e.has("size"))&&this.updateComplete.then(()=>{this._scheduleMeasure()}),(e.has("showDrawer")||e.has("deferDrawer"))&&this.showDrawer&&!this.deferDrawer&&this._ensureDrawerReady(),e.has("layoutPending")&&!this.layoutPending&&this.requestLayout(),(e.has("activeTab")||e.has("_slotNavItems")||e.has("tabs")||e.has("size"))&&this.updateComplete.then(()=>{this._syncDropdownTabs()})}disconnectedCallback(){this._ro?.disconnect(),this._slotMo?.disconnect(),this._slotWatchers.forEach(e=>e.disconnect()),this._slotWatchers=[],window.removeEventListener("resize",this._onWindowResize),super.disconnectedCallback()}_mapSpacingToken(e){if(!e)return;const t=String(e).trim();if(t)return/^\d+$/.test(t)?`var(--spacing-${Math.max(0,Math.min(14,parseInt(t,10)))})`:t}_applySpacing(){const e=this._mapSpacingToken(this.spacing),t=this._mapSpacingToken(this.spacingTop)??e,s=this._mapSpacingToken(this.spacingBottom)??e;t?this.style.setProperty("--scb-header-spacing-block-start",t):this.style.removeProperty("--scb-header-spacing-block-start"),s?this.style.setProperty("--scb-header-spacing-block-end",s):this.style.removeProperty("--scb-header-spacing-block-end")}_applyLogoSizing(){const e=(this.logoWidth??"").trim(),t=(this.logoHeight??"").trim(),s=(this.logoAspectRatio??"").trim();e?this.style.setProperty("--scb-header-logo-img-w",e):this.style.removeProperty("--scb-header-logo-img-w"),t?this.style.setProperty("--scb-header-logo-img-h",t):e?this.style.setProperty("--scb-header-logo-img-h","auto"):this.style.removeProperty("--scb-header-logo-img-h"),s?this.style.setProperty("--scb-header-logo-img-aspect-ratio",s):this.style.removeProperty("--scb-header-logo-img-aspect-ratio")}_closeDrawerNow(){const e=this.renderRoot.querySelector(`#${this._drawerId}`);e&&(e.open=!1)}_openDrawerNow(){const e=this.renderRoot.querySelector(`#${this._drawerId}`);e&&(e.open=!0)}async _ensureDrawerReady(){this._drawerReady||(this._drawerImportPromise??(this._drawerImportPromise=Promise.all([$(()=>import("../scb-drawer/scb-drawer.js"),__vite__mapDeps([0,1,2,3,4,5]),import.meta.url),$(()=>import("../scb-menu/scb-menu.js"),__vite__mapDeps([6,5,1,2,3,4,7,8,9,10,11]),import.meta.url)]).then(()=>{})),await this._drawerImportPromise,this._drawerReady=!0)}_syncMenuBtnAria(){this.renderRoot.querySelectorAll(".menu-trigger").forEach(e=>{e.setAttribute("aria-expanded",String(this._menuExpanded))})}_getNavItems(){return this._slotNavItems.length?this._slotNavItems:(this.tabs??[]).map(e=>({kind:"tab",...e}))}_getDropdownForSlot(e){const t=this.querySelector(`[slot="${e}"]`);return t?t.tagName.toLowerCase()==="scb-dropdown"?t:t.querySelector("scb-dropdown"):null}_syncDropdownTabs(){this._getNavItems().forEach((e,t)=>{if(e.kind!=="dropdown")return;const s=this._getDropdownForSlot(e.slotName);if(!s)return;const r=String(t);s.getAttribute("data-index")!==r&&s.setAttribute("data-index",r),s.hasAttribute("as-tab")||s.setAttribute("as-tab","");const i=this.size,a=s;a?.size!==i&&(a.size=i),t===this.activeTab?s.getAttribute("aria-current")!=="page"&&s.setAttribute("aria-current","page"):s.hasAttribute("aria-current")&&s.removeAttribute("aria-current")})}_readTabIndexFromEvent(e){const t=e.composedPath?e.composedPath():[];for(const s of t){if(!(s instanceof HTMLElement))continue;const r=s.getAttribute("data-index");if(r==null)continue;const i=Number(r);if(Number.isFinite(i))return i}return null}_focusTabAtIndex(e){const t=this._getNavItems()[e];if(t){if(t.kind==="dropdown"){this._getDropdownForSlot(t.slotName)?.focus?.();return}this.renderRoot.querySelector(`.tab-link[data-index="${e}"]`)?.focus?.()}}_renderMenuNodes(e){return!e||e.length===0?m``:m`${e.map(t=>this._renderMenuNode(t))}`}_renderMenuNode(e){const t=Array.isArray(e.children)&&e.children.length>0,s=(e.href??"").trim(),r=(e.icon??"").trim();return m`
|
|
54
54
|
<scb-menu-item
|
|
55
55
|
label=${e.label}
|
|
56
56
|
?selected=${!1}
|
|
@@ -598,7 +598,8 @@ import"../../vendor/vendor-material.js";import{_ as M,b as E,g as P,h as c,m as
|
|
|
598
598
|
}
|
|
599
599
|
}
|
|
600
600
|
|
|
601
|
-
:host([data-no-utility]) .actions
|
|
601
|
+
:host([data-no-utility]) .actions,
|
|
602
|
+
:host([data-collapsed]) .actions {
|
|
602
603
|
gap: var(--spacing-5, 16px);
|
|
603
604
|
}
|
|
604
605
|
:host([data-no-utility]) .search {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{_ as p,b as g,g as b,h as r,y as f}from"../../vendor/vendor.js";import"../../vendor/vendor-lit.js";import{t as n}from"../../vendor/decorate.js";import{n as v,t as
|
|
1
|
+
import{_ as p,b as g,g as b,h as r,y as f}from"../../vendor/vendor.js";import"../../vendor/vendor-lit.js";import{t as n}from"../../vendor/decorate.js";import{n as v,t as c}from"../../vendor/assertClassBrand.js";import"./scb-segmented-item.js";(function(){try{var l=typeof globalThis<"u"?globalThis:window;if(!l.__scb_ce_guard_installed__){l.__scb_ce_guard_installed__=!0;var t=customElements.define.bind(customElements);customElements.define=function(e,i,s){try{customElements.get(e)||t(e,i,s)}catch(h){var d=String(h||"");if(d.indexOf("already been used")===-1&&d.indexOf("NotSupportedError")===-1)throw h}}}}catch{}})();var o,u,a=(o=new WeakSet,u=class extends p{constructor(){super(),v(this,o),this._internals=null,this.variant="single-select",this.value="",this.values=[],this.disabled=!1,this.required=!1,this.name="",this.spacing=void 0,this.spacingTop=void 0,this.spacingBottom=void 0,this.spacingLeft=void 0,this.spacingRight=void 0,this._form=null,this._formResetHandler=null,this._initialValue="",this._initialValues=[],this._customValidationMessage="","attachInternals"in this&&(this._internals=this.attachInternals())}connectedCallback(){super.connectedCallback(),this._form=this.closest("form"),this._form&&(this._formResetHandler=()=>{this.value=this._initialValue,this.values=Array.isArray(this._initialValues)?[...this._initialValues]:[],this.updateSegments(),this._syncFormValue()},this._form.addEventListener("reset",this._formResetHandler,!0))}disconnectedCallback(){this._form&&this._formResetHandler&&this._form.removeEventListener("reset",this._formResetHandler,!0),super.disconnectedCallback()}firstUpdated(){this._initialValue=this.value,this._initialValues=Array.isArray(this.values)?[...this.values]:[],this.updateSegments();const t=this.shadowRoot?.querySelector("slot");t&&(t.addEventListener("slotchange",()=>{this.updateSegments()}),t.addEventListener("click",e=>this.onSlotClick(e)),t.addEventListener("focus",()=>{this.dispatchEvent(new CustomEvent("focus",{detail:{},bubbles:!0,composed:!0}))},!0),t.addEventListener("blur",()=>{this.dispatchEvent(new CustomEvent("blur",{detail:{},bubbles:!0,composed:!0}))},!0),t.addEventListener("keydown",e=>{if(e.code==="Space"||e.code==="Enter"||e.code==="NumpadEnter"){const i=e.target;if(i&&i.closest){const s=i.closest("scb-segmented-item");s&&!s.hasAttribute("disabled")&&!this.disabled&&(this.onSlotClick(e),e.preventDefault())}}})),this._syncFormValue(),this._syncValidity(),c(o,this,m).call(this)}updated(t){super.updated(t),this.updateSegments(),(t.has("value")||t.has("values")||t.has("disabled")||t.has("variant")||t.has("name"))&&(this._syncFormValue(),this._syncValidity()),(t.has("spacing")||t.has("spacingTop")||t.has("spacingBottom")||t.has("spacingLeft")||t.has("spacingRight"))&&c(o,this,m).call(this)}onSlotClick(t){let e=t.target;if(!e||!e.closest)return;const i=e.closest("scb-segmented-item");if(!i||this.disabled||i.hasAttribute("disabled"))return;const s=i.getAttribute("value")||"";s&&(this.variant==="multi-select"?(this.values.indexOf(s)===-1?this.values=[...this.values,s]:this.values=this.values.filter(d=>d!==s),this.dispatchEvent(new CustomEvent("change",{detail:{values:this.values},bubbles:!0,composed:!0})),this.updateSegments()):s!==this.value&&(this.value=s,this.dispatchEvent(new CustomEvent("change",{detail:{value:s},bubbles:!0,composed:!0})),this.updateSegments()),c(o,this,y).call(this,t,i))}updateSegments(){const t=this.shadowRoot?.querySelector("slot");t&&t.assignedElements().forEach(e=>{if(e.tagName==="SCB-SEGMENTED-ITEM"){const i=e.getAttribute("value")||"";if(i){let s=!1;this.variant==="multi-select"?s=!!this.values&&this.values.includes(i):s=i===this.value,e.setAttribute("aria-pressed",s?"true":"false"),s?e.setAttribute("selected","true"):e.removeAttribute("selected")}this.disabled&&e.setAttribute("disabled","true")}})}formDisabledCallback(t){this.disabled=t}_getValidationMessage(){return this._customValidationMessage?this._customValidationMessage:this.required?this.variant==="multi-select"?this.values.length===0?"Välj minst ett alternativ.":"":this.value?"":"Välj ett alternativ.":""}_syncValidity(){if(!this._internals)return;const t=this.disabled?"":this._getValidationMessage();t?(this._internals.setValidity({valueMissing:!0},t),this.setAttribute("aria-invalid","true")):(this._internals.setValidity({}),this.removeAttribute("aria-invalid"))}checkValidity(){return!this._getValidationMessage()}reportValidity(){return this._syncValidity(),this._internals?this._internals.reportValidity():this.checkValidity()}setCustomValidity(t){this._customValidationMessage=t,this._syncValidity()}get validity(){return this._internals?.validity}get validationMessage(){return this._internals?.validationMessage??this._getValidationMessage()}get willValidate(){return this._internals?.willValidate??!0}_syncFormValue(){if(this._internals){if(this.disabled||!this.name){this._internals.setFormValue(null);return}if(this.variant==="multi-select"){if(!this.values||this.values.length===0){this._internals.setFormValue(null);return}const t=new FormData;for(const e of this.values)t.append(this.name,e);this._internals.setFormValue(t)}else{if(!this.value){this._internals.setFormValue(null);return}this._internals.setFormValue(this.value)}}}mapSpacingToken(t){if(!t)return;const e=String(t).trim();if(e)return/^\d+$/.test(e)?`var(--spacing-${Math.max(0,Math.min(14,parseInt(e,10)))})`:e}render(){return f`<slot></slot>`}},u.formAssociated=!0,u.styles=g`
|
|
2
2
|
:host {
|
|
3
3
|
--scb-segmented-button-width: 100%;
|
|
4
4
|
--scb-segmented-button-height: 48px;
|
|
@@ -29,4 +29,4 @@ import{_ as p,b as g,g as b,h as r,y as f}from"../../vendor/vendor.js";import"..
|
|
|
29
29
|
::slotted([role='button']:first-child .segmented-item) {
|
|
30
30
|
border-left: 1px solid var(--md-sys-color-outline);
|
|
31
31
|
}
|
|
32
|
-
`,u);function m(){const l=this.mapSpacingToken(this.spacing),t=this.mapSpacingToken(this.spacingTop)??l,e=this.mapSpacingToken(this.spacingBottom)??l,i=this.mapSpacingToken(this.spacingLeft),s=this.mapSpacingToken(this.spacingRight);t?this.style.setProperty("--scb-segmented-button-spacing-block-start",t):this.style.removeProperty("--scb-segmented-button-spacing-block-start"),e?this.style.setProperty("--scb-segmented-button-spacing-block-end",e):this.style.removeProperty("--scb-segmented-button-spacing-block-end"),i?this.style.setProperty("--scb-segmented-button-spacing-inline-start",i):this.style.removeProperty("--scb-segmented-button-spacing-inline-start"),s?this.style.setProperty("--scb-segmented-button-spacing-inline-end",s):this.style.removeProperty("--scb-segmented-button-spacing-inline-end")}n([r({type:String,reflect:!0})],a.prototype,"variant",void 0);n([r({type:String,reflect:!0})],a.prototype,"value",void 0);n([r({type:Array})],a.prototype,"values",void 0);n([r({type:Boolean,reflect:!0})],a.prototype,"disabled",void 0);n([r({type:Boolean,reflect:!0})],a.prototype,"required",void 0);n([r({type:String,reflect:!0})],a.prototype,"name",void 0);n([r({type:String,reflect:!0})],a.prototype,"spacing",void 0);n([r({type:String,attribute:"spacing-top",reflect:!0})],a.prototype,"spacingTop",void 0);n([r({type:String,attribute:"spacing-bottom",reflect:!0})],a.prototype,"spacingBottom",void 0);n([r({type:String,attribute:"spacing-left",reflect:!0})],a.prototype,"spacingLeft",void 0);n([r({type:String,attribute:"spacing-right",reflect:!0})],a.prototype,"spacingRight",void 0);a=n([b("scb-segmented-button")],a);
|
|
32
|
+
`,u);function y(l,t){!(l instanceof MouseEvent)||l.detail===0||queueMicrotask(()=>{document.activeElement===t&&t.blur()})}function m(){const l=this.mapSpacingToken(this.spacing),t=this.mapSpacingToken(this.spacingTop)??l,e=this.mapSpacingToken(this.spacingBottom)??l,i=this.mapSpacingToken(this.spacingLeft),s=this.mapSpacingToken(this.spacingRight);t?this.style.setProperty("--scb-segmented-button-spacing-block-start",t):this.style.removeProperty("--scb-segmented-button-spacing-block-start"),e?this.style.setProperty("--scb-segmented-button-spacing-block-end",e):this.style.removeProperty("--scb-segmented-button-spacing-block-end"),i?this.style.setProperty("--scb-segmented-button-spacing-inline-start",i):this.style.removeProperty("--scb-segmented-button-spacing-inline-start"),s?this.style.setProperty("--scb-segmented-button-spacing-inline-end",s):this.style.removeProperty("--scb-segmented-button-spacing-inline-end")}n([r({type:String,reflect:!0})],a.prototype,"variant",void 0);n([r({type:String,reflect:!0})],a.prototype,"value",void 0);n([r({type:Array})],a.prototype,"values",void 0);n([r({type:Boolean,reflect:!0})],a.prototype,"disabled",void 0);n([r({type:Boolean,reflect:!0})],a.prototype,"required",void 0);n([r({type:String,reflect:!0})],a.prototype,"name",void 0);n([r({type:String,reflect:!0})],a.prototype,"spacing",void 0);n([r({type:String,attribute:"spacing-top",reflect:!0})],a.prototype,"spacingTop",void 0);n([r({type:String,attribute:"spacing-bottom",reflect:!0})],a.prototype,"spacingBottom",void 0);n([r({type:String,attribute:"spacing-left",reflect:!0})],a.prototype,"spacingLeft",void 0);n([r({type:String,attribute:"spacing-right",reflect:!0})],a.prototype,"spacingRight",void 0);a=n([b("scb-segmented-button")],a);
|
|
@@ -54,11 +54,11 @@ import"../../vendor/vendor-material.js";import{_ as u,b as m,g as p,h as n,y as
|
|
|
54
54
|
display: none;
|
|
55
55
|
border-radius: inherit;
|
|
56
56
|
}
|
|
57
|
-
:host(:focus) md-focus-ring,
|
|
57
|
+
:host(:focus-visible) md-focus-ring,
|
|
58
58
|
md-focus-ring[data-show="true"] {
|
|
59
59
|
display: block;
|
|
60
60
|
}
|
|
61
|
-
:host([disabled]):host(:focus) md-focus-ring,
|
|
61
|
+
:host([disabled]):host(:focus-visible) md-focus-ring,
|
|
62
62
|
:host([disabled]) md-focus-ring[data-show="true"] {
|
|
63
63
|
display: none;
|
|
64
64
|
}
|
|
@@ -2,7 +2,7 @@ import{_ as g,b as _,g as v,h as f,y as C}from"../../vendor/vendor.js";import"..
|
|
|
2
2
|
<div class="scb-table-scroll-wrapper">
|
|
3
3
|
<slot @slotchange=${this._onSlotChange}></slot>
|
|
4
4
|
</div>
|
|
5
|
-
`}firstUpdated(){const t=this.shadowRoot?.querySelector("slot");t&&(t.addEventListener("slotchange",()=>this._attachThListeners()),this._attachThListeners())}updated(t){t.has("dataSorting")&&(this.dataSorting||(this._sortedColumn=null,this._sortDirection="asc"),this._attachThListeners()),t.has("columnWidthMode")&&this._queueColumnWidthUpdate()}disconnectedCallback(){super.disconnectedCallback(),this._columnWidthFrame!==null&&(cancelAnimationFrame(this._columnWidthFrame),this._columnWidthFrame=null)}_getTbody(){const t=this.shadowRoot?.querySelector("slot");if(!t)return null;const r=t.assignedNodes({flatten:!0});for(const s of r)if(s.nodeType===Node.ELEMENT_NODE){const o=s,l=o.tagName.toLowerCase()==="tbody"?o:o.querySelector("tbody");if(l)return l}return null}_getTables(){const t=this.shadowRoot?.querySelector("slot");if(!t)return[];const r=t.assignedNodes({flatten:!0}),s=[];return r.forEach(o=>{if(o.nodeType===Node.ELEMENT_NODE){const l=o;l.tagName.toLowerCase()==="table"&&s.push(l),s.push(...Array.from(l.querySelectorAll("table")))}}),s}_attachThListeners(){const t=this.shadowRoot?.querySelector("slot");if(!t)return;const r=t.assignedNodes({flatten:!0}),s=[],o=[],l=[],a=[];r.forEach(e=>{e.nodeType===Node.ELEMENT_NODE&&(s.push(...e.querySelectorAll("thead")),o.push(...e.querySelectorAll("th")),l.push(...e.querySelectorAll("td")),a.push(...e.querySelectorAll("tr")))}),s.forEach(e=>{e.style.borderTop="1px solid var(--md-sys-color-on-surface)"}),o.forEach((e,d)=>{e.style.textAlign="left",e.style.padding="12px",e.style.position="relative",e.style.backgroundColor="var(--md-sys-color-surface)",e.style.fontFamily="var(--md-sys-typescale-label-medium-font)",e.style.fontSize="var(--md-sys-typescale-label-medium-size)",e.style.lineHeight="var(--md-sys-typescale-label-medium-line-height)",e.style.fontWeight=" var(--weight-bold)",e.style.letterSpacing="var(--md-sys-typescale-label-medium-tracking)",e.style.verticalAlign="bottom",e.style.borderRight="1px solid var(--md-sys-color-on-surface)",e.style.borderBottom="1px solid var(--md-sys-color-on-surface)";const
|
|
5
|
+
`}firstUpdated(){const t=this.shadowRoot?.querySelector("slot");t&&(t.addEventListener("slotchange",()=>this._attachThListeners()),this._attachThListeners())}updated(t){t.has("dataSorting")&&(this.dataSorting||(this._sortedColumn=null,this._sortDirection="asc"),this._attachThListeners()),t.has("columnWidthMode")&&this._queueColumnWidthUpdate()}disconnectedCallback(){super.disconnectedCallback(),this._columnWidthFrame!==null&&(cancelAnimationFrame(this._columnWidthFrame),this._columnWidthFrame=null)}_getTbody(){const t=this.shadowRoot?.querySelector("slot");if(!t)return null;const r=t.assignedNodes({flatten:!0});for(const s of r)if(s.nodeType===Node.ELEMENT_NODE){const o=s,l=o.tagName.toLowerCase()==="tbody"?o:o.querySelector("tbody");if(l)return l}return null}_getTables(){const t=this.shadowRoot?.querySelector("slot");if(!t)return[];const r=t.assignedNodes({flatten:!0}),s=[];return r.forEach(o=>{if(o.nodeType===Node.ELEMENT_NODE){const l=o;l.tagName.toLowerCase()==="table"&&s.push(l),s.push(...Array.from(l.querySelectorAll("table")))}}),s}_attachThListeners(){const t=this.shadowRoot?.querySelector("slot");if(!t)return;const r=t.assignedNodes({flatten:!0}),s=[],o=[],l=[],a=[];r.forEach(e=>{e.nodeType===Node.ELEMENT_NODE&&(s.push(...e.querySelectorAll("thead")),o.push(...e.querySelectorAll("th")),l.push(...e.querySelectorAll("td")),a.push(...e.querySelectorAll("tr")))}),s.forEach(e=>{e.style.borderTop="1px solid var(--md-sys-color-on-surface)"}),o.forEach((e,d)=>{e.style.textAlign="left",e.style.padding="12px",e.style.position="relative",e.style.backgroundColor="var(--md-sys-color-surface)",e.style.fontFamily="var(--md-sys-typescale-label-medium-font)",e.style.fontSize="var(--md-sys-typescale-label-medium-size)",e.style.lineHeight="var(--md-sys-typescale-label-medium-line-height)",e.style.fontWeight=" var(--weight-bold)",e.style.letterSpacing="var(--md-sys-typescale-label-medium-tracking)",e.style.verticalAlign="bottom",e.style.borderRight="1px solid var(--md-sys-color-on-surface)",e.style.borderBottom="1px solid var(--md-sys-color-on-surface)";const h=(e.textContent??"").replace(/\s+/g," ").trim();for(;e.firstChild;)e.removeChild(e.firstChild);const c=document.createElement("p");if(c.textContent=h,c.style.margin="0",this.dataSorting){const n=document.createElement("scb-icon-button");n.className="scb-sort-icon",n.onclick=()=>this._onThClick(d),n.setAttribute("variant","standard"),n.setAttribute("size","small"),n.style.alignSelf="end",this._sortedColumn===d?(n.setAttribute("variant","filled-tonal"),n.setAttribute("icon",this._sortDirection==="asc"?"arrow_downward":"arrow_upward")):(n.setAttribute("icon","swap_horiz"),n.style.transform+=" rotate(90deg)");const u=document.createElement("div");u.style.display="flex",u.style.gap="8px",u.style.flexWrap="nowrap",u.style.alignItems="center",u.appendChild(c),u.appendChild(n),e.appendChild(u)}else e.appendChild(c)}),l.forEach(e=>{e.style.padding="12px",e.style.textAlign="left",e.style.borderTop="1px solid var(--md-sys-color-outline-variant)",e.style.verticalAlign="text-top",e.style.backgroundColor="var(--md-sys-color-surface)",e.style.fontFamily="var(--md-sys-typescale-body-medium-font)",e.style.fontSize="var(--md-sys-typescale-body-medium-size)",e.style.lineHeight="var(--md-sys-typescale-body-medium-line-height)",e.style.fontWeight="var(--md-sys-typescale-body-medium-weight)",e.style.letterSpacing="var(--md-sys-typescale-body-medium-tracking)",e.style.borderRight="1px solid var(--md-sys-color-on-surface)",e.style.borderBottom="1px solid var(--md-sys-color-on-surface)"}),a.forEach(e=>{const d=Array.from(e.cells);d.forEach((h,c)=>{h.style.borderRight=c===d.length-1?"none":"1px solid var(--md-sys-color-on-surface)"})});const i=this._getTbody();i&&Array.from(i.querySelectorAll("tr")).forEach((e,d)=>{const h=d%2===0?"var(--md-sys-color-surface-container)":"var(--md-sys-color-surface)";Array.from(e.cells).forEach(c=>{c.style.backgroundColor=h})}),this._queueColumnWidthUpdate()}_queueColumnWidthUpdate(){this._columnWidthFrame!==null&&cancelAnimationFrame(this._columnWidthFrame),this._columnWidthFrame=requestAnimationFrame(()=>{this._columnWidthFrame=null,this._applyColumnWidthMode()})}_applyColumnWidthMode(){this._getTables().forEach(t=>{if(this._removeGeneratedColGroup(t),t.style.tableLayout="",t.style.width="",t.style.minWidth="",t.style.maxWidth="",this.columnWidthMode!=="header")return;const r=Array.from(t.querySelectorAll("thead tr")),s=r[r.length-1];if(!s)return;const o=Array.from(s.cells).map(a=>`${Math.ceil(this._measureCellContentWidth(a))}px`),l=o.reduce((a,i)=>a+parseFloat(i),0);this._applyGeneratedColGroup(t,o),t.style.tableLayout="fixed",t.style.width=`${Math.ceil(l)}px`,t.style.minWidth=`${Math.ceil(l)}px`,t.style.maxWidth="none"})}_applyGeneratedColGroup(t,r){const s=document.createElement("colgroup");s.setAttribute("data-scb-generated-column-widths","true"),r.forEach(o=>{const l=document.createElement("col");l.style.width=o,l.style.minWidth=o,s.appendChild(l)}),t.insertBefore(s,t.firstChild)}_removeGeneratedColGroup(t){t.querySelector('colgroup[data-scb-generated-column-widths="true"]')?.remove()}_measureCellContentWidth(t){const r=t.firstElementChild?.cloneNode(!0)??document.createElement("span");t.firstElementChild||(r.textContent=t.textContent??"");const s=window.getComputedStyle(t),o=document.createElement("div");o.style.position="absolute",o.style.left="-99999px",o.style.top="0",o.style.visibility="hidden",o.style.pointerEvents="none",o.style.width="max-content",o.style.maxWidth="none",o.style.whiteSpace="nowrap",o.style.fontFamily=s.fontFamily,o.style.fontSize=s.fontSize,o.style.fontWeight=s.fontWeight,o.style.lineHeight=s.lineHeight,o.style.letterSpacing=s.letterSpacing,r instanceof HTMLElement&&(r.style.width="max-content",r.style.maxWidth="none",r.style.whiteSpace="nowrap"),o.appendChild(r),document.body.appendChild(o);const l=parseFloat(s.paddingLeft||"0"),a=parseFloat(s.paddingRight||"0"),i=o.getBoundingClientRect().width+l+a;return document.body.removeChild(o),i}_onThClick(t){this.dataSorting&&(this._sortedColumn===t?this._sortDirection=this._sortDirection==="asc"?"desc":"asc":(this._sortedColumn=t,this._sortDirection="asc"),this._sortTable(t,this._sortDirection),this._attachThListeners(),this.dispatchEvent(new CustomEvent("tablesortchange",{detail:{sortedColumn:this._sortedColumn,sortDirection:this._sortDirection},bubbles:!0,composed:!0})))}_sortTable(t,r){const s=this._getTbody();if(!s)return;const o=Array.from(s.querySelectorAll("tr"));o.sort((l,a)=>{const i=this._getCellSortableValue(l.children[t]),e=this._getCellSortableValue(a.children[t]);return this._compareCellValues(i,e,r)}),o.forEach(l=>s.appendChild(l))}_getCellSortableValue(t){if(!t)return"";const r=t,s=this._getSortableAttributeValue(r);if(s)return s;const o=[],l=r.textContent?.replace(/\s+/g," ").trim();return l&&o.push(l),r.querySelectorAll("[data-sort-value], [data-sort], [aria-label], [label], [value], [title]").forEach(a=>{const i=this._getSortableAttributeValue(a);i&&!o.includes(i)&&o.push(i)}),o.join(" ").trim()}_getSortableAttributeValue(t){return(t.getAttribute("data-sort-value")??t.getAttribute("data-sort")??t.getAttribute("aria-label")??t.getAttribute("label")??t.getAttribute("value")??t.getAttribute("title")??"").replace(/\s+/g," ").trim()}_compareCellValues(t,r,s){const o=this._parseSortableNumber(t),l=this._parseSortableNumber(r);if(o!==null&&l!==null)return s==="asc"?o-l:l-o;const a=Date.parse(t.replace(/\s+/g," ")),i=Date.parse(r.replace(/\s+/g," "));if(!isNaN(a)&&!isNaN(i))return s==="asc"?a-i:i-a;const e=t.localeCompare(r,"sv");return s==="asc"?e:-e}_parseSortableNumber(t){const r=t.trim();if(!/^[+-]?(?:\d+|\d{1,3}(?:[\s\u00a0\u202f]\d{3})+)(?:[,.]\d+)?$/.test(r))return null;const s=Number(r.replace(/[\s\u00a0\u202f]/g,"").replace(",","."));return Number.isNaN(s)?null:s}},p.styles=_`
|
|
6
6
|
:host {
|
|
7
7
|
display: block;
|
|
8
8
|
color: var(--md-sys-color-on-surface);
|