scb-wc-test 0.1.267 → 0.1.269
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/mvc/components/scb-viz/scb-viz.js +137 -97
- package/package.json +2 -2
- package/scb-viz/scb-viz.d.ts +6 -0
- package/scb-viz/scb-viz.js +313 -208
- package/scb-wc-test.bundle.js +529 -489
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as
|
|
1
|
+
import{a as W,n as d,r as F,i as O,k as A,x as s,l as M,t as q}from"../../vendor/vendor.js";import"../scb-chip/scb-chip.js";import"../scb-segmented-button/scb-segmented-button.js";import"../scb-segmented-button/scb-segmented-item.js";import"../scb-accordion/scb-accordion.js";import"../scb-divider/scb-divider.js";import"../scb-horizontal-scroller/scb-horizontal-scroller.js";import"../../vendor/preload-helper.js";import"../../vendor/vendor-material.js";import"../scb-accordion/scb-accordion-item.js";import"../scb-button/scb-button.js";import"../scb-icon-button/scb-icon-button.js";(function(){try{var t=typeof globalThis<"u"?globalThis:window;if(!t.__scb_ce_guard_installed__){t.__scb_ce_guard_installed__=!0;var e=customElements.define.bind(customElements);customElements.define=function(a,n,i){try{customElements.get(a)||e(a,n,i)}catch(r){var v=String(r||"");if(v.indexOf("already been used")===-1&&v.indexOf("NotSupportedError")===-1)throw r}}}}catch{}})();var G=Object.defineProperty,B=Object.getOwnPropertyDescriptor,I=t=>{throw TypeError(t)},h=(t,e,a,n)=>{for(var i=n>1?void 0:n?B(e,a):e,v=t.length-1,r;v>=0;v--)(r=t[v])&&(i=(n?r(e,a,i):r(i))||i);return n&&i&&G(e,a,i),i},N=(t,e,a)=>e.has(t)||I("Cannot "+a),K=(t,e,a)=>e.has(t)?I("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,a),l=(t,e,a)=>(N(t,e,"access private method"),a),c,k,H,V,x,R,P,E,S,T,y,D;const L=`<svg version="1.1" id="Lager_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
|
2
2
|
viewBox="0 0 727.3 87.3" style="enable-background:new 0 0 727.3 87.3;" xml:space="preserve" fill="currentColor">
|
|
3
3
|
<style type="text/css">
|
|
4
4
|
.st0{clip-path:url(#SVGID_00000118375311472882578510000008414848687067442345_);}
|
|
@@ -113,28 +113,28 @@ import{a as V,n as h,r as R,i as D,k as T,x as i,l as z,t as A}from"../../vendor
|
|
|
113
113
|
<path d="M688.2,24.4h5.8v6h-5.8V24.4z M688.2,36.6h5.8v30.1h-5.8V36.6z"/>
|
|
114
114
|
<path d="M701.8,24.4h5.8v26.3h0.1l11.2-14.1h7l-10,11.7l11.4,18.3H720l-7.7-14l-4.6,5.4v8.7h-5.8V24.4H701.8z"/>
|
|
115
115
|
</svg>
|
|
116
|
-
`;let
|
|
116
|
+
`;let o=class extends O{constructor(){super(...arguments),K(this,c),this.variant="Standard",this.selectedChip="Diagram",this.title="",this.subtitle="",this.description="",this.comment="",this.source="",this.footnote="",this.lang="sv",this.imageHref="",this.officialStatistics=!1,this.disableToggle=!1,this.contentMaxWidth="",this.containerMaxWidth="",this.contentHeight="",this._diagramReflowFrame=0,this.spacing=void 0,this.spacingTop=void 0,this.spacingBottom=void 0,this.spacingLeft=void 0,this.spacingRight=void 0}get descriptionLabel(){return this.lang==="en"?"Description of the chart":"Beskrivning av diagrammet"}get moreAboutStatsLabel(){return this.lang==="en"?"More about the statistics":"Mer om statistiken"}get commentLabel(){return this.lang==="en"?"Comments":"Kommentar"}get sourceLabel(){return this.lang==="en"?"Source":"Källa"}get footnoteLabel(){return this.lang==="en"?"Footnotes":"Fotnot"}get officialStatisticsLabel(){return this.lang==="en"?"Official statistics of Sweden":"Sveriges officiella statistik"}get officialStatisticsTitle(){return this.lang==="en"?"Part of Official statistics of Sweden":"Tillhör Sveriges officiella statistik"}get officialStatisticsAlt(){return this.lang==="en"?"Read more about Official statistics of Sweden":"Läs mer om Sveriges officiella statistik"}firstUpdated(t){this._readTableDataFromSlot(),l(this,c,T).call(this),l(this,c,D).call(this),l(this,c,S).call(this),this._syncChipClass(),l(this,c,k).call(this),l(this,c,x).call(this)}updated(t){super.updated(t),(t.has("selectedChip")||t.has("variant"))&&this._syncChipClass(),t.has("selectedChip")&&this._dispatchSelectedChipChanged(),(t.has("spacing")||t.has("spacingTop")||t.has("spacingBottom")||t.has("spacingLeft")||t.has("spacingRight"))&&l(this,c,T).call(this),t.has("containerMaxWidth")&&l(this,c,D).call(this),t.has("variant")&&l(this,c,k).call(this),(t.has("contentMaxWidth")||t.has("contentHeight")||t.has("variant"))&&l(this,c,S).call(this),(t.has("selectedChip")||t.has("variant")||t.has("contentMaxWidth")||t.has("contentHeight"))&&l(this,c,x).call(this)}disconnectedCallback(){super.disconnectedCallback(),l(this,c,H).call(this),l(this,c,V).call(this)}_onTableSlotChange(t){const e=t.target;e&&this._readTableDataFromSlot(e)}_onDiagramSlotChange(){l(this,c,S).call(this),l(this,c,x).call(this)}_normalizeRenderableCell(t){return t&&typeof t=="object"&&"html"in t&&"text"in t?{html:typeof t.html=="string"?t.html:"",text:typeof t.text=="string"?t.text:""}:{html:"",text:t==null?"":String(t)}}_readTableDataFromSlot(t){const e=t||this.shadowRoot?.querySelector('slot[name="table"]');if(!e)return;const a=e.assignedElements({flatten:!0}),n=[];a.forEach(g=>{if(g.tagName==="TABLE"){n.push(g);return}g.querySelectorAll("table").forEach(b=>n.push(b))});const i=n[0];if(!i){this._slottedTableData=void 0;return}const v=[],r=[],p=[],m=g=>g?(g.textContent??"").replace(/\s+/g," ").trim():"",f=g=>g?{html:(g.innerHTML??"").trim(),text:m(g)}:{html:"",text:""},u=i.querySelector("thead tr");u&&Array.from(u.querySelectorAll("th, td")).forEach(b=>v.push(f(b)));const z=Array.from(i.querySelectorAll("tbody tr")),w=z.length>0?z:Array.from(i.querySelectorAll("tr")).filter(g=>g.closest("thead")===null);if(w.forEach(g=>{const b=Array.from(g.querySelectorAll("th, td"));if(b.length===0)return;const _=b[0].tagName==="TH"&&g.closest("thead")===null&&g.closest("tfoot")===null;p.push(_);const $=[];b.forEach(C=>$.push(f(C))),r.push($)}),!u&&r.length>0){const g=r[0],b=w[0],_=Array.from(b?.querySelectorAll("th, td")??[]);_.length>0&&_.every(C=>C.tagName==="TH")&&b?.closest("tbody")===null&&(v.splice(0,v.length,...g),r.shift(),p.shift())}this._slottedTableData={headers:v.length>0?v:void 0,rows:r,rowHeaderRows:p.length>0?p:void 0}}_inferTableAlignments(t){const e=Math.max(t.headers?.length??0,...t.rows.map(i=>i.length)),a=i=>{if(i==null)return!1;if(typeof i=="number")return!0;const v=String(i).replace(/[\u00A0\u202F\s]+/g,"").trim();return v?/^-?\d+(?:[.,]\d+)?$/.test(v):!1},n=[];for(let i=0;i<e;i+=1){if(i===0){n.push("left");continue}const v=t.rows.map(p=>this._normalizeRenderableCell(p[i]).text).filter(p=>p!==""&&p!==null&&p!==void 0),r=v.length>0&&v.every(a);n.push(r?"right":"left")}return n}_getResolvedContentMaxWidth(){return this.contentMaxWidth?.trim()||""}_getResolvedDiagramHeight(){return this.contentHeight?.trim()||""}_renderTable(){const t=this.tableData??this._slottedTableData;if(!t||!t.rows||t.rows.length===0)return null;const e=this._inferTableAlignments(t),a=Math.max(t.headers?.length??0,...t.rows.map(r=>r.length)),n=(t.headers??[]).map(r=>this._normalizeRenderableCell(r)),i=t.rows.map(r=>{const p=r.map(m=>this._normalizeRenderableCell(m));for(;p.length<a;)p.push({html:"",text:""});return p}),v=t.rowHeaderRows??[];return s`
|
|
117
117
|
<table class="scb-viz-table" part="table">
|
|
118
|
-
${
|
|
118
|
+
${n.length>0?s`
|
|
119
119
|
<thead>
|
|
120
120
|
<tr>
|
|
121
|
-
${
|
|
121
|
+
${n.map((r,p)=>{const m=e[p]==="right"?"align-right":"align-left";return s`<th scope="col" class=${m}>${r.html?A(r.html):r.text}</th>`})}
|
|
122
122
|
</tr>
|
|
123
123
|
</thead>
|
|
124
124
|
`:""}
|
|
125
125
|
<tbody>
|
|
126
|
-
${
|
|
126
|
+
${i.map((r,p)=>{const m=v[p]===!0;return s`
|
|
127
127
|
<tr>
|
|
128
|
-
${
|
|
128
|
+
${r.map((f,u)=>{const z=e[u]==="right"?"align-right":"align-left",w=f.html?A(f.html):f.text;return u===0&&m?s`<th scope="row" class=${z}>${w}</th>`:s`<td class=${z}>${w}</td>`})}
|
|
129
129
|
</tr>
|
|
130
130
|
`})}
|
|
131
131
|
</tbody>
|
|
132
132
|
</table>
|
|
133
|
-
`}render(){switch(this.variant){case"Table":return
|
|
133
|
+
`}render(){switch(this.variant){case"Table":return s`
|
|
134
134
|
<div part="container">
|
|
135
135
|
<div class="header">
|
|
136
|
-
${this.title?
|
|
137
|
-
${this.subtitle?
|
|
136
|
+
${this.title?s` <div class="label">${this.title}</div> `:""}
|
|
137
|
+
${this.subtitle?s` <div class="sub-label">${this.subtitle}</div> `:""}
|
|
138
138
|
</div>
|
|
139
139
|
<div class="content">
|
|
140
140
|
<scb-horizontal-scroller
|
|
@@ -147,36 +147,36 @@ import{a as V,n as h,r as R,i as D,k as T,x as i,l as z,t as A}from"../../vendor
|
|
|
147
147
|
</scb-horizontal-scroller>
|
|
148
148
|
</div>
|
|
149
149
|
<div class="footer">
|
|
150
|
-
${this.description?
|
|
150
|
+
${this.description?s`
|
|
151
151
|
<div class="description section">
|
|
152
152
|
<div class="secondary-label">${this.descriptionLabel}</div>
|
|
153
|
-
<div>${this.description}</div>
|
|
153
|
+
<div class="body-text">${this.description}</div>
|
|
154
154
|
</div>
|
|
155
155
|
`:""}
|
|
156
|
-
${this.comment||this.source||this.footnote||this.officialStatistics?
|
|
156
|
+
${this.comment||this.source||this.footnote||this.officialStatistics?s`
|
|
157
157
|
<scb-divider></scb-divider>
|
|
158
158
|
<scb-accordion>
|
|
159
159
|
<scb-accordion-item title="${this.moreAboutStatsLabel}">
|
|
160
160
|
<div class="more-about-stats-content">
|
|
161
|
-
${this.comment?
|
|
161
|
+
${this.comment?s`
|
|
162
162
|
<div class="section">
|
|
163
163
|
<div class="secondary-label">${this.commentLabel}</div>
|
|
164
|
-
<div>${this.comment}</div>
|
|
164
|
+
<div class="body-text">${this.comment}</div>
|
|
165
165
|
</div>
|
|
166
166
|
`:""}
|
|
167
|
-
${this.source?
|
|
167
|
+
${this.source?s`
|
|
168
168
|
<div class="section">
|
|
169
169
|
<div class="secondary-label">${this.sourceLabel}</div>
|
|
170
|
-
<div>${this.source}</div>
|
|
170
|
+
<div class="body-text">${this.source}</div>
|
|
171
171
|
</div>
|
|
172
172
|
`:""}
|
|
173
|
-
${this.footnote?
|
|
173
|
+
${this.footnote?s`
|
|
174
174
|
<div class="section">
|
|
175
175
|
<div class="secondary-label">${this.footnoteLabel}</div>
|
|
176
|
-
<div>${this.footnote}</div>
|
|
176
|
+
<div class="body-text">${this.footnote}</div>
|
|
177
177
|
</div>
|
|
178
178
|
`:""}
|
|
179
|
-
${this.officialStatistics?
|
|
179
|
+
${this.officialStatistics?s`
|
|
180
180
|
<a
|
|
181
181
|
class="sos-logotype-link"
|
|
182
182
|
href="https://www.scb.se/sos"
|
|
@@ -186,7 +186,7 @@ import{a as V,n as h,r as R,i as D,k as T,x as i,l as z,t as A}from"../../vendor
|
|
|
186
186
|
aria-label="${this.officialStatisticsAlt}"
|
|
187
187
|
>
|
|
188
188
|
<span class="sos-logotype-small" aria-hidden="true">
|
|
189
|
-
${
|
|
189
|
+
${M(L)}
|
|
190
190
|
</span>
|
|
191
191
|
</a>
|
|
192
192
|
`:""}
|
|
@@ -202,11 +202,11 @@ import{a as V,n as h,r as R,i as D,k as T,x as i,l as z,t as A}from"../../vendor
|
|
|
202
202
|
></slot>
|
|
203
203
|
<slot></slot>
|
|
204
204
|
</div>
|
|
205
|
-
`;case"Image":return
|
|
205
|
+
`;case"Image":return s`
|
|
206
206
|
<div part="container">
|
|
207
207
|
<div class="header">
|
|
208
|
-
${this.title?
|
|
209
|
-
${this.subtitle?
|
|
208
|
+
${this.title?s` <div class="label">${this.title}</div> `:""}
|
|
209
|
+
${this.subtitle?s` <div class="sub-label">${this.subtitle}</div> `:""}
|
|
210
210
|
</div>
|
|
211
211
|
<div
|
|
212
212
|
class="content image-content"
|
|
@@ -215,36 +215,36 @@ import{a as V,n as h,r as R,i as D,k as T,x as i,l as z,t as A}from"../../vendor
|
|
|
215
215
|
<img src="${this.imageHref}" alt="Image figure" />
|
|
216
216
|
</div>
|
|
217
217
|
<div class="footer">
|
|
218
|
-
${this.description?
|
|
218
|
+
${this.description?s`
|
|
219
219
|
<div class="description section">
|
|
220
220
|
<div class="secondary-label">${this.descriptionLabel}</div>
|
|
221
|
-
<div>${this.description}</div>
|
|
221
|
+
<div class="body-text">${this.description}</div>
|
|
222
222
|
</div>
|
|
223
223
|
`:""}
|
|
224
|
-
${this.comment||this.source||this.footnote||this.officialStatistics?
|
|
224
|
+
${this.comment||this.source||this.footnote||this.officialStatistics?s`
|
|
225
225
|
<scb-divider></scb-divider>
|
|
226
226
|
<scb-accordion>
|
|
227
227
|
<scb-accordion-item title="${this.moreAboutStatsLabel}">
|
|
228
228
|
<div class="more-about-stats-content">
|
|
229
|
-
${this.comment?
|
|
229
|
+
${this.comment?s`
|
|
230
230
|
<div class="section">
|
|
231
231
|
<div class="secondary-label">${this.commentLabel}</div>
|
|
232
|
-
<div>${this.comment}</div>
|
|
232
|
+
<div class="body-text">${this.comment}</div>
|
|
233
233
|
</div>
|
|
234
234
|
`:""}
|
|
235
|
-
${this.source?
|
|
235
|
+
${this.source?s`
|
|
236
236
|
<div class="section">
|
|
237
237
|
<div class="secondary-label">${this.sourceLabel}</div>
|
|
238
|
-
<div>${this.source}</div>
|
|
238
|
+
<div class="body-text">${this.source}</div>
|
|
239
239
|
</div>
|
|
240
240
|
`:""}
|
|
241
|
-
${this.footnote?
|
|
241
|
+
${this.footnote?s`
|
|
242
242
|
<div class="section">
|
|
243
243
|
<div class="secondary-label">${this.footnoteLabel}</div>
|
|
244
|
-
<div>${this.footnote}</div>
|
|
244
|
+
<div class="body-text">${this.footnote}</div>
|
|
245
245
|
</div>
|
|
246
246
|
`:""}
|
|
247
|
-
${this.officialStatistics?
|
|
247
|
+
${this.officialStatistics?s`
|
|
248
248
|
<a
|
|
249
249
|
class="sos-logotype-link"
|
|
250
250
|
href="https://www.scb.se/sos"
|
|
@@ -254,7 +254,7 @@ import{a as V,n as h,r as R,i as D,k as T,x as i,l as z,t as A}from"../../vendor
|
|
|
254
254
|
aria-label="${this.officialStatisticsAlt}"
|
|
255
255
|
>
|
|
256
256
|
<span class="sos-logotype-small" aria-hidden="true">
|
|
257
|
-
${
|
|
257
|
+
${M(L)}
|
|
258
258
|
</span>
|
|
259
259
|
</a>
|
|
260
260
|
`:""}
|
|
@@ -270,13 +270,13 @@ import{a as V,n as h,r as R,i as D,k as T,x as i,l as z,t as A}from"../../vendor
|
|
|
270
270
|
></slot>
|
|
271
271
|
<slot></slot>
|
|
272
272
|
</div>
|
|
273
|
-
`;default:return
|
|
273
|
+
`;default:return s`
|
|
274
274
|
<div part="container">
|
|
275
275
|
<div class="header">
|
|
276
|
-
${this.title?
|
|
277
|
-
${this.subtitle?
|
|
276
|
+
${this.title?s` <div class="label">${this.title}</div> `:""}
|
|
277
|
+
${this.subtitle?s` <div class="sub-label">${this.subtitle}</div> `:""}
|
|
278
278
|
</div>
|
|
279
|
-
${this.variant==="Standard"&&!this.disableToggle?
|
|
279
|
+
${this.variant==="Standard"&&!this.disableToggle?s`
|
|
280
280
|
<div class="flipp-wrapper">
|
|
281
281
|
<scb-segmented-button
|
|
282
282
|
.value=${this.selectedChip||""}
|
|
@@ -303,10 +303,10 @@ import{a as V,n as h,r as R,i as D,k as T,x as i,l as z,t as A}from"../../vendor
|
|
|
303
303
|
show-scrollbar
|
|
304
304
|
>
|
|
305
305
|
<div
|
|
306
|
-
class
|
|
307
|
-
style=${this._getResolvedContentMaxWidth()?`--scb-viz-content-max-width: ${this._getResolvedContentMaxWidth()}
|
|
306
|
+
class="diagram-content"
|
|
307
|
+
style=${this._getResolvedContentMaxWidth()?`--scb-viz-content-max-width: ${this._getResolvedContentMaxWidth()};`:""}
|
|
308
308
|
>
|
|
309
|
-
<slot name="diagram"></slot>
|
|
309
|
+
<slot name="diagram" @slotchange=${this._onDiagramSlotChange}></slot>
|
|
310
310
|
</div>
|
|
311
311
|
</scb-horizontal-scroller>
|
|
312
312
|
<scb-horizontal-scroller
|
|
@@ -319,36 +319,36 @@ import{a as V,n as h,r as R,i as D,k as T,x as i,l as z,t as A}from"../../vendor
|
|
|
319
319
|
</scb-horizontal-scroller>
|
|
320
320
|
</div>
|
|
321
321
|
<div class="footer">
|
|
322
|
-
${this.description?
|
|
322
|
+
${this.description?s`
|
|
323
323
|
<div class="description section">
|
|
324
324
|
<div class="secondary-label">${this.descriptionLabel}</div>
|
|
325
|
-
<div>${this.description}</div>
|
|
325
|
+
<div class="body-text">${this.description}</div>
|
|
326
326
|
</div>
|
|
327
327
|
`:""}
|
|
328
|
-
${this.comment||this.source||this.footnote||this.officialStatistics?
|
|
328
|
+
${this.comment||this.source||this.footnote||this.officialStatistics?s`
|
|
329
329
|
<scb-divider></scb-divider>
|
|
330
330
|
<scb-accordion>
|
|
331
331
|
<scb-accordion-item title="${this.moreAboutStatsLabel}">
|
|
332
332
|
<div class="more-about-stats-content">
|
|
333
|
-
${this.comment?
|
|
333
|
+
${this.comment?s`
|
|
334
334
|
<div class="section">
|
|
335
335
|
<div class="secondary-label">${this.commentLabel}</div>
|
|
336
|
-
<div>${this.comment}</div>
|
|
336
|
+
<div class="body-text">${this.comment}</div>
|
|
337
337
|
</div>
|
|
338
338
|
`:""}
|
|
339
|
-
${this.source?
|
|
339
|
+
${this.source?s`
|
|
340
340
|
<div class="section">
|
|
341
341
|
<div class="secondary-label">${this.sourceLabel}</div>
|
|
342
|
-
<div>${this.source}</div>
|
|
342
|
+
<div class="body-text">${this.source}</div>
|
|
343
343
|
</div>
|
|
344
344
|
`:""}
|
|
345
|
-
${this.footnote?
|
|
345
|
+
${this.footnote?s`
|
|
346
346
|
<div class="section">
|
|
347
347
|
<div class="secondary-label">${this.footnoteLabel}</div>
|
|
348
|
-
<div>${this.footnote}</div>
|
|
348
|
+
<div class="body-text">${this.footnote}</div>
|
|
349
349
|
</div>
|
|
350
350
|
`:""}
|
|
351
|
-
${this.officialStatistics?
|
|
351
|
+
${this.officialStatistics?s`
|
|
352
352
|
<a
|
|
353
353
|
class="sos-logotype-link"
|
|
354
354
|
href="https://www.scb.se/sos"
|
|
@@ -358,7 +358,7 @@ import{a as V,n as h,r as R,i as D,k as T,x as i,l as z,t as A}from"../../vendor
|
|
|
358
358
|
aria-label="${this.officialStatisticsAlt}"
|
|
359
359
|
>
|
|
360
360
|
<span class="sos-logotype-small" aria-hidden="true">
|
|
361
|
-
${
|
|
361
|
+
${M(L)}
|
|
362
362
|
</span>
|
|
363
363
|
</a>
|
|
364
364
|
`:""}
|
|
@@ -374,16 +374,23 @@ import{a as V,n as h,r as R,i as D,k as T,x as i,l as z,t as A}from"../../vendor
|
|
|
374
374
|
></slot>
|
|
375
375
|
<slot></slot>
|
|
376
376
|
</div>
|
|
377
|
-
`}}_syncChipClass(){const t=this.variant==="Standard";this.classList.toggle("chip-diagram",t&&this.selectedChip==="Diagram"),this.classList.toggle("chip-table",t&&this.selectedChip==="Table")}_dispatchSelectedChipChanged(){const t={selectedChip:this.selectedChip};this.dispatchEvent(new CustomEvent("selected-chip-changed",{detail:t,bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("selectedchipchanged",{detail:t,bubbles:!0,composed:!0}))}_onSegmentedChange(t){const e=t.detail?.value;this.selectedChip===e?this.selectedChip=null:this.selectedChip=e}};
|
|
377
|
+
`}}_syncChipClass(){const t=this.variant==="Standard";this.classList.toggle("chip-diagram",t&&this.selectedChip==="Diagram"),this.classList.toggle("chip-table",t&&this.selectedChip==="Table")}_dispatchSelectedChipChanged(){const t={selectedChip:this.selectedChip};this.dispatchEvent(new CustomEvent("selected-chip-changed",{detail:t,bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("selectedchipchanged",{detail:t,bubbles:!0,composed:!0}))}_onSegmentedChange(t){const e=t.detail?.value;this.selectedChip===e?this.selectedChip=null:this.selectedChip=e}};c=new WeakSet;k=function(){if(l(this,c,H).call(this),typeof ResizeObserver>"u")return;const t=this.shadowRoot?.querySelector(".diagram-content");t&&(this._diagramResizeObserver=new ResizeObserver(()=>{l(this,c,x).call(this)}),this._diagramResizeObserver.observe(this),this._diagramResizeObserver.observe(t))};H=function(){this._diagramResizeObserver?.disconnect(),this._diagramResizeObserver=void 0};V=function(){this._diagramReflowFrame&&(cancelAnimationFrame(this._diagramReflowFrame),this._diagramReflowFrame=0)};x=function(){this.variant!=="Standard"||this.selectedChip!=="Diagram"||(l(this,c,V).call(this),this._diagramReflowFrame=requestAnimationFrame(()=>{this._diagramReflowFrame=requestAnimationFrame(()=>{this._diagramReflowFrame=0,l(this,c,E).call(this)})}))};R=function(t){const e=t?.getAttribute("data-highcharts-chart");if(!e)return;const a=Number.parseInt(e,10);return Number.isNaN(a)?void 0:a};P=function(t){for(const e of t){const a=l(this,c,R).call(this,e);if(a!==void 0)return a;const n=e.querySelector("[data-highcharts-chart]"),i=l(this,c,R).call(this,n);if(i!==void 0)return i}};E=function(){if(this.variant!=="Standard"||this.selectedChip!=="Diagram")return;const t=this.shadowRoot?.querySelector('slot[name="diagram"]');if(!t)return;const e=t.assignedElements({flatten:!0});if(e.length===0)return;const a=l(this,c,P).call(this,e);if(a===void 0)return;const i=window.Highcharts?.charts?.[a];i&&(i.setSize?.(null,null,!1),i.reflow?.())};S=function(){const t=this.variant==="Standard"?this._getResolvedDiagramHeight():"";this.variant==="Standard"?this.style.setProperty("--scb-viz-diagram-min-height",t||"420px"):this.style.removeProperty("--scb-viz-diagram-min-height"),t?(this.style.setProperty("--scb-viz-diagram-height",t),this.style.setProperty("--scb-viz-diagram-overflow","hidden")):(this.style.removeProperty("--scb-viz-diagram-height"),this.style.removeProperty("--scb-viz-diagram-overflow"))};T=function(){const t=l(this,c,y).call(this,this.spacing),e=l(this,c,y).call(this,this.spacingTop)??t,a=l(this,c,y).call(this,this.spacingBottom)??t,n=l(this,c,y).call(this,this.spacingLeft),i=l(this,c,y).call(this,this.spacingRight);e?this.style.setProperty("--scb-viz-spacing-block-start",e):this.style.removeProperty("--scb-viz-spacing-block-start"),a?this.style.setProperty("--scb-viz-spacing-block-end",a):this.style.removeProperty("--scb-viz-spacing-block-end"),n?this.style.setProperty("--scb-viz-spacing-inline-start",n):this.style.removeProperty("--scb-viz-spacing-inline-start"),i?this.style.setProperty("--scb-viz-spacing-inline-end",i):this.style.removeProperty("--scb-viz-spacing-inline-end")};y=function(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};D=function(){const t=this.containerMaxWidth?.trim();t?this.style.setProperty("--scb-viz-container-max-width",t):this.style.removeProperty("--scb-viz-container-max-width")};o.styles=W`
|
|
378
378
|
:host {
|
|
379
379
|
display: block;
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
380
|
+
box-sizing: border-box;
|
|
381
|
+
font-family: var(--scb-viz-font-family, var(--brand-font, Inter, 'Segoe UI', Arial, sans-serif));
|
|
382
|
+
font-size: var(--scb-viz-body-font-size, var(--md-sys-typescale-body-large-size, 1rem));
|
|
383
|
+
font-weight: var(--scb-viz-body-font-weight, var(--weight-regular, 400));
|
|
384
|
+
line-height: var(--scb-viz-body-line-height, var(--md-sys-typescale-body-large-line-height, 1.5));
|
|
385
|
+
letter-spacing: var(--scb-viz-body-letter-spacing, var(--md-sys-typescale-body-large-tracking, normal));
|
|
386
|
+
font-style: normal;
|
|
387
|
+
text-align: start;
|
|
388
|
+
color: var(--scb-viz-text-color, var(--md-sys-color-on-surface, #1f1f1f));
|
|
389
|
+
background: var(--scb-viz-surface-color, var(--md-sys-color-surface, #fff));
|
|
390
|
+
padding: var(--scb-viz-padding, var(--spacing-7, 24px));
|
|
384
391
|
max-width: var(--scb-viz-container-max-width, 100%);
|
|
385
|
-
border-radius: var(--spacing-04, 16px);
|
|
386
|
-
border: 1px solid var(--md-sys-color-outline-variant);
|
|
392
|
+
border-radius: var(--scb-viz-border-radius, var(--spacing-04, 16px));
|
|
393
|
+
border: 1px solid var(--scb-viz-outline-color, var(--md-sys-color-outline-variant, #c5c7d0));
|
|
387
394
|
/* Avstånd till omgivande innehåll styrs av spacing-attributen via CSS-variabler */
|
|
388
395
|
margin-block-start: var(--scb-viz-spacing-block-start, 0);
|
|
389
396
|
margin-block-end: var(--scb-viz-spacing-block-end, 0);
|
|
@@ -391,56 +398,79 @@ import{a as V,n as h,r as R,i as D,k as T,x as i,l as z,t as A}from"../../vendor
|
|
|
391
398
|
margin-inline-end: var(--scb-viz-spacing-inline-end, 0);
|
|
392
399
|
}
|
|
393
400
|
|
|
401
|
+
:host *,
|
|
402
|
+
:host *::before,
|
|
403
|
+
:host *::after {
|
|
404
|
+
box-sizing: border-box;
|
|
405
|
+
}
|
|
406
|
+
|
|
394
407
|
scb-segmented-button {
|
|
395
|
-
--scb-segmented-button-height: var(--icon-size-small);
|
|
408
|
+
--scb-segmented-button-height: var(--icon-size-small, 32px);
|
|
396
409
|
}
|
|
397
410
|
|
|
398
411
|
.label {
|
|
399
|
-
font-size: var(--md-sys-typescale-title-large-size);
|
|
400
|
-
font-weight: var(--weight-semibold);
|
|
401
|
-
line-height: var(--md-sys-typescale-title-large-line-height);
|
|
402
|
-
letter-spacing: var(--md-sys-typescale-title-large-tracking);
|
|
412
|
+
font-size: var(--scb-viz-title-size, var(--md-sys-typescale-title-large-size, 1.75rem));
|
|
413
|
+
font-weight: var(--scb-viz-title-weight, var(--weight-semibold, 600));
|
|
414
|
+
line-height: var(--scb-viz-title-line-height, var(--md-sys-typescale-title-large-line-height, 1.25));
|
|
415
|
+
letter-spacing: var(--scb-viz-title-tracking, var(--md-sys-typescale-title-large-tracking, normal));
|
|
416
|
+
text-align: start;
|
|
403
417
|
}
|
|
404
418
|
|
|
405
419
|
.sub-label {
|
|
406
|
-
font-size: var(--md-sys-typescale-body-large-size);
|
|
407
|
-
|
|
408
|
-
|
|
420
|
+
font-size: var(--scb-viz-subtitle-size, var(--md-sys-typescale-body-large-size, 1rem));
|
|
421
|
+
font-weight: var(--scb-viz-subtitle-weight, var(--weight-regular, 400));
|
|
422
|
+
line-height: var(--scb-viz-subtitle-line-height, var(--md-sys-typescale-body-large-line-height, 1.5));
|
|
423
|
+
letter-spacing: var(--scb-viz-subtitle-tracking, var(--md-sys-typescale-body-large-tracking, normal));
|
|
424
|
+
text-align: start;
|
|
409
425
|
}
|
|
410
426
|
|
|
411
427
|
.secondary-label {
|
|
412
|
-
font-size: var(--md-sys-typescale-title-medium-size);
|
|
413
|
-
font-weight: var(--weight-semibold);
|
|
414
|
-
line-height: var(--md-sys-typescale-title-medium-line-height);
|
|
415
|
-
letter-spacing: var(--md-sys-typescale-title-medium-tracking);
|
|
428
|
+
font-size: var(--scb-viz-section-title-size, var(--md-sys-typescale-title-medium-size, 1rem));
|
|
429
|
+
font-weight: var(--scb-viz-section-title-weight, var(--weight-semibold, 600));
|
|
430
|
+
line-height: var(--scb-viz-section-title-line-height, var(--md-sys-typescale-title-medium-line-height, 1.5));
|
|
431
|
+
letter-spacing: var(--scb-viz-section-title-tracking, var(--md-sys-typescale-title-medium-tracking, normal));
|
|
432
|
+
text-align: start;
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
.body-text {
|
|
436
|
+
font-size: var(--scb-viz-body-font-size, var(--md-sys-typescale-body-large-size, 1rem));
|
|
437
|
+
font-weight: var(--scb-viz-body-font-weight, var(--weight-regular, 400));
|
|
438
|
+
line-height: var(--scb-viz-body-line-height, var(--md-sys-typescale-body-large-line-height, 1.5));
|
|
439
|
+
letter-spacing: var(--scb-viz-body-letter-spacing, var(--md-sys-typescale-body-large-tracking, normal));
|
|
440
|
+
font-style: normal;
|
|
441
|
+
text-align: start;
|
|
416
442
|
}
|
|
417
443
|
|
|
418
444
|
.section {
|
|
419
445
|
display: flex;
|
|
420
446
|
flex-direction: column;
|
|
421
|
-
gap: var(--spacing-2);
|
|
447
|
+
gap: var(--spacing-2, 8px);
|
|
448
|
+
text-align: start;
|
|
422
449
|
}
|
|
423
450
|
|
|
424
451
|
.more-about-stats-content {
|
|
425
452
|
display: flex;
|
|
426
453
|
flex-direction: column;
|
|
427
|
-
gap: var(--spacing-7);
|
|
454
|
+
gap: var(--spacing-7, 24px);
|
|
428
455
|
max-width: 600px;
|
|
456
|
+
text-align: start;
|
|
429
457
|
}
|
|
458
|
+
|
|
430
459
|
.sos-logotype-link {
|
|
431
460
|
display: inline-flex;
|
|
432
461
|
border: 0;
|
|
433
|
-
color: var(--md-sys-color-on-surface);
|
|
462
|
+
color: var(--scb-viz-text-color, var(--md-sys-color-on-surface, #1f1f1f));
|
|
434
463
|
line-height: 0;
|
|
435
464
|
text-decoration: none;
|
|
436
465
|
width: fit-content;
|
|
437
466
|
}
|
|
438
467
|
|
|
439
468
|
.sos-logotype-link:focus-visible {
|
|
440
|
-
outline: var(--stroke-focus-ring) solid var(--md-focus-ring-color);
|
|
441
|
-
outline-offset: var(--spacing-1);
|
|
442
|
-
border-radius: var(--radius-xs);
|
|
469
|
+
outline: var(--stroke-focus-ring, 2px) solid var(--md-focus-ring-color, currentColor);
|
|
470
|
+
outline-offset: var(--spacing-1, 4px);
|
|
471
|
+
border-radius: var(--radius-xs, 4px);
|
|
443
472
|
}
|
|
473
|
+
|
|
444
474
|
.sos-logotype-small {
|
|
445
475
|
height: 26px;
|
|
446
476
|
width: auto;
|
|
@@ -458,23 +488,30 @@ import{a as V,n as h,r as R,i as D,k as T,x as i,l as z,t as A}from"../../vendor
|
|
|
458
488
|
height: 24px;
|
|
459
489
|
}
|
|
460
490
|
}
|
|
461
|
-
|
|
491
|
+
|
|
462
492
|
.header {
|
|
463
|
-
margin-bottom: var(--spacing-7);
|
|
493
|
+
margin-bottom: var(--spacing-7, 24px);
|
|
464
494
|
max-width: 600px;
|
|
495
|
+
text-align: start;
|
|
465
496
|
}
|
|
466
497
|
|
|
467
498
|
.flipp-wrapper {
|
|
468
|
-
margin-bottom: var(--spacing-9);
|
|
499
|
+
margin-bottom: var(--spacing-9, 40px);
|
|
469
500
|
max-width: 234px;
|
|
470
501
|
}
|
|
471
502
|
|
|
503
|
+
.content,
|
|
504
|
+
.description,
|
|
505
|
+
.footer {
|
|
506
|
+
text-align: start;
|
|
507
|
+
}
|
|
508
|
+
|
|
472
509
|
.description {
|
|
473
|
-
margin-bottom: var(--spacing-8);
|
|
510
|
+
margin-bottom: var(--spacing-8, 32px);
|
|
474
511
|
}
|
|
475
512
|
|
|
476
513
|
.footer {
|
|
477
|
-
margin-top: var(--spacing-7);
|
|
514
|
+
margin-top: var(--spacing-7, 24px);
|
|
478
515
|
}
|
|
479
516
|
|
|
480
517
|
.description.section {
|
|
@@ -494,13 +531,9 @@ import{a as V,n as h,r as R,i as D,k as T,x as i,l as z,t as A}from"../../vendor
|
|
|
494
531
|
.diagram-content {
|
|
495
532
|
width: 100%;
|
|
496
533
|
max-width: var(--scb-viz-content-max-width, 100%);
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
.diagram-content--constrained {
|
|
501
|
-
width: min(100%, var(--scb-viz-content-max-width, 100%));
|
|
502
|
-
aspect-ratio: var(--scb-viz-diagram-aspect-ratio, 3 / 2);
|
|
503
|
-
max-height: var(--scb-viz-diagram-max-height, 600px);
|
|
534
|
+
min-height: var(--scb-viz-diagram-min-height, 420px);
|
|
535
|
+
height: var(--scb-viz-diagram-height, auto);
|
|
536
|
+
overflow: var(--scb-viz-diagram-overflow, visible);
|
|
504
537
|
}
|
|
505
538
|
|
|
506
539
|
::slotted([slot='diagram']) {
|
|
@@ -508,8 +541,9 @@ import{a as V,n as h,r as R,i as D,k as T,x as i,l as z,t as A}from"../../vendor
|
|
|
508
541
|
width: 100%;
|
|
509
542
|
max-width: 100%;
|
|
510
543
|
min-width: 0;
|
|
511
|
-
height:
|
|
512
|
-
|
|
544
|
+
min-height: var(--scb-viz-diagram-min-height, 420px);
|
|
545
|
+
height: var(--scb-viz-diagram-height, auto);
|
|
546
|
+
overflow: var(--scb-viz-diagram-overflow, visible);
|
|
513
547
|
}
|
|
514
548
|
|
|
515
549
|
:host([variant='Table']) .table-scroller {
|
|
@@ -536,6 +570,7 @@ import{a as V,n as h,r as R,i as D,k as T,x as i,l as z,t as A}from"../../vendor
|
|
|
536
570
|
:host([variant='Standard'].chip-diagram) .diagram-scroller {
|
|
537
571
|
display: flex;
|
|
538
572
|
}
|
|
573
|
+
|
|
539
574
|
:host([variant='Standard'].chip-table) .table-scroller {
|
|
540
575
|
display: flex;
|
|
541
576
|
}
|
|
@@ -548,30 +583,35 @@ import{a as V,n as h,r as R,i as D,k as T,x as i,l as z,t as A}from"../../vendor
|
|
|
548
583
|
border-collapse: collapse;
|
|
549
584
|
width: max-content;
|
|
550
585
|
max-width: none;
|
|
586
|
+
font-size: var(--scb-viz-body-font-size, var(--md-sys-typescale-body-large-size, 1rem));
|
|
587
|
+
font-weight: var(--scb-viz-body-font-weight, var(--weight-regular, 400));
|
|
588
|
+
line-height: var(--scb-viz-body-line-height, var(--md-sys-typescale-body-large-line-height, 1.5));
|
|
589
|
+
letter-spacing: var(--scb-viz-body-letter-spacing, var(--md-sys-typescale-body-large-tracking, normal));
|
|
551
590
|
}
|
|
552
591
|
|
|
553
592
|
.scb-viz-table th,
|
|
554
593
|
.scb-viz-table td {
|
|
555
|
-
border: 1px solid var(--md-sys-color-outline-variant);
|
|
594
|
+
border: 1px solid var(--scb-viz-outline-color, var(--md-sys-color-outline-variant, #c5c7d0));
|
|
556
595
|
padding-block: var(--spacing-2, 8px);
|
|
557
596
|
padding-inline: var(--spacing-3, 12px);
|
|
558
597
|
background-color: inherit;
|
|
598
|
+
text-align: start;
|
|
559
599
|
}
|
|
560
600
|
|
|
561
601
|
.scb-viz-table thead th {
|
|
562
|
-
font-weight: var(--weight-bold);
|
|
602
|
+
font-weight: var(--weight-bold, 700);
|
|
563
603
|
}
|
|
564
604
|
|
|
565
605
|
.scb-viz-table tbody th {
|
|
566
|
-
font-weight: var(--weight-regular);
|
|
606
|
+
font-weight: var(--weight-regular, 400);
|
|
567
607
|
}
|
|
568
608
|
|
|
569
609
|
.scb-viz-table tbody tr:nth-child(odd) {
|
|
570
|
-
background: var(--md-sys-color-surface-container);
|
|
610
|
+
background: var(--md-sys-color-surface-container, #f5f5f5);
|
|
571
611
|
}
|
|
572
612
|
|
|
573
613
|
.scb-viz-table tbody tr:nth-child(even) {
|
|
574
|
-
background: var(--md-sys-color-surface);
|
|
614
|
+
background: var(--md-sys-color-surface, #fff);
|
|
575
615
|
}
|
|
576
616
|
|
|
577
617
|
.scb-viz-table .align-left {
|
|
@@ -582,4 +622,4 @@ import{a as V,n as h,r as R,i as D,k as T,x as i,l as z,t as A}from"../../vendor
|
|
|
582
622
|
text-align: right;
|
|
583
623
|
white-space: nowrap;
|
|
584
624
|
}
|
|
585
|
-
`;
|
|
625
|
+
`;h([d({type:String,reflect:!0})],o.prototype,"variant",2);h([d({type:String,reflect:!0,attribute:"selected-chip"})],o.prototype,"selectedChip",2);h([d({type:String,reflect:!0})],o.prototype,"title",2);h([d({type:String,reflect:!0})],o.prototype,"subtitle",2);h([d({type:String,reflect:!0})],o.prototype,"description",2);h([d({type:String,reflect:!0})],o.prototype,"comment",2);h([d({type:String,reflect:!0})],o.prototype,"source",2);h([d({type:String,reflect:!0})],o.prototype,"footnote",2);h([d({type:String,reflect:!0,attribute:"lang"})],o.prototype,"lang",2);h([d({type:String,reflect:!0,attribute:"image-href"})],o.prototype,"imageHref",2);h([d({type:Boolean,reflect:!0,attribute:"official-statistics"})],o.prototype,"officialStatistics",2);h([d({type:Boolean,reflect:!0,attribute:"disable-toggle"})],o.prototype,"disableToggle",2);h([d({type:String,attribute:"content-max-width"})],o.prototype,"contentMaxWidth",2);h([d({type:String,attribute:"container-max-width"})],o.prototype,"containerMaxWidth",2);h([d({type:String,attribute:"content-height"})],o.prototype,"contentHeight",2);h([d({attribute:!1})],o.prototype,"tableData",2);h([F()],o.prototype,"_slottedTableData",2);h([d({type:String,reflect:!0})],o.prototype,"spacing",2);h([d({type:String,attribute:"spacing-top",reflect:!0})],o.prototype,"spacingTop",2);h([d({type:String,attribute:"spacing-bottom",reflect:!0})],o.prototype,"spacingBottom",2);h([d({type:String,attribute:"spacing-left",reflect:!0})],o.prototype,"spacingLeft",2);h([d({type:String,attribute:"spacing-right",reflect:!0})],o.prototype,"spacingRight",2);o=h([q("scb-viz")],o);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "scb-wc-test",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.269",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "index.js",
|
|
@@ -386,5 +386,5 @@
|
|
|
386
386
|
},
|
|
387
387
|
"./mvc/*": "./mvc/*"
|
|
388
388
|
},
|
|
389
|
-
"buildHash": "
|
|
389
|
+
"buildHash": "EF76F99B5F6232BA1FE986924E7CE60FB577B8C5F062D747BA7A8E8D8081DE9F"
|
|
390
390
|
}
|
package/scb-viz/scb-viz.d.ts
CHANGED
|
@@ -26,8 +26,11 @@ export declare class ScbViz extends LitElement {
|
|
|
26
26
|
disableToggle: boolean;
|
|
27
27
|
contentMaxWidth: string;
|
|
28
28
|
containerMaxWidth: string;
|
|
29
|
+
contentHeight: string;
|
|
29
30
|
tableData: ScbVizTableData | undefined;
|
|
30
31
|
private _slottedTableData;
|
|
32
|
+
private _diagramResizeObserver?;
|
|
33
|
+
private _diagramReflowFrame;
|
|
31
34
|
/** Vertikalt avstånd ovanför/under komponenten. 0–14 mappar till spacing-tokens, annars CSS-värde. */
|
|
32
35
|
spacing: undefined;
|
|
33
36
|
/** Överkantens avstånd. Om satt går före spacing. 0–14 mappar till spacing-tokens, annars CSS-värde. */
|
|
@@ -49,11 +52,14 @@ export declare class ScbViz extends LitElement {
|
|
|
49
52
|
static styles: import('lit').CSSResult;
|
|
50
53
|
protected firstUpdated(_changed: PropertyValues): void;
|
|
51
54
|
protected updated(changed: PropertyValues): void;
|
|
55
|
+
disconnectedCallback(): void;
|
|
52
56
|
private _onTableSlotChange;
|
|
57
|
+
private _onDiagramSlotChange;
|
|
53
58
|
private _normalizeRenderableCell;
|
|
54
59
|
private _readTableDataFromSlot;
|
|
55
60
|
private _inferTableAlignments;
|
|
56
61
|
private _getResolvedContentMaxWidth;
|
|
62
|
+
private _getResolvedDiagramHeight;
|
|
57
63
|
private _renderTable;
|
|
58
64
|
render(): import('lit-html').TemplateResult<1>;
|
|
59
65
|
private _syncChipClass;
|