143 lines
51 KiB
JavaScript
143 lines
51 KiB
JavaScript
import{S as re,i as ae,s as oe,a as ne,b as c,d as w,e as p,n as J,f as A,o as C,g as I,y as W,z as j,m as z,N as ye,A as $,t as R,h as N,j as q,O as pt,V as Le,K as mt,X as De,r as K,D as bt,v as ue,w as ce,E as ie,R as se,T as le,C as O}from"./index-8e2228d6.js";import{g as et,a as tt}from"./spread-8a54911c.js";import{p as yt,M as St,T as _t,S as U}from"./collect-stories-f2899c5f.js";import{e as x}from"./each-e59479a4.js";import{B as Ct}from"./Block-9ace8085.js";import{g as Ee}from"./journalize-07958dc6.js";import{S as Rt}from"./SearchInput-f2bd68b2.js";import{b as X,w as wt}from"./withParams-47e2ab71.js";const At=`Present structured data in a table. Consider making it interactive.
|
||
|
||
---
|
||
|
||
\`\`\`svelte
|
||
<script>
|
||
import { Table } from '@reuters-graphics/graphics-components';
|
||
|
||
// Import your data as JSON, or otherwise structure it
|
||
import yourData from './stories/homeRuns.json';
|
||
<\/script>
|
||
|
||
<table data="{yourData}"></table>
|
||
\`\`\`
|
||
`,kt=`Set the \`title\`, \`dek\`, \`notes\` and \`source\` options to add supporting metadata above and below the table.
|
||
|
||
\`\`\`svelte
|
||
<Table data="{yourData}" title="{'Career home run leaders'}" dek="{'In baseball,
|
||
a home run (also known as a "dinger" or "tater") occurs when a batter hits the
|
||
ball over the outfield fence. When a home run is hit, the batter and any runners
|
||
on base are able to score.'}" notes="{'Note: As of Opening Day 2023'}"
|
||
source="{'Source: Baseball Reference'}" />
|
||
\`\`\`
|
||
`,vt=`When your table has 10 or more rows, consider clipping it by setting the \`truncated\` option. When it is enabled, the table is clipped and readers must request to see all rows by clicking a button below the table. By default this configuration will limit the table to five records. You can change the cutoff point by adjusting the \`truncateLength\` option.
|
||
|
||
This is a good option for simple tables with row counts between 10 and 30. It works best when the table doesn't require interactivity.
|
||
|
||
\`\`\`svelte
|
||
<table
|
||
data="{yourData}"
|
||
truncated="{true}"
|
||
source="{'Source: Baseball Reference'}"
|
||
></table>
|
||
\`\`\`
|
||
`,Lt=`When your table has lots of rows you should consider breaking it up into pages. This can be done by setting the \`paginated\` option.
|
||
|
||
When it is enabled, readers can leaf through the data using a set of buttons below the table. By default there are 25 records per page. You can change the number by adjusting the \`pageSize\` option.
|
||
|
||
This is a good option when publishing large tables for readers to explore. It works well with interactive features like searching and filters.
|
||
|
||
\`\`\`svelte
|
||
<table
|
||
data="{yourData}"
|
||
paginated="{true}"
|
||
title="{'Press Freedom Index'}"
|
||
source="{'Reporters Without Borders'}"
|
||
></table>
|
||
\`\`\`
|
||
`,Ft=`Allow users to search the table by setting the optional \`searchable\` variable. Modify the default text that appears in the box by supplying the \`searchPlaceholder\` option.
|
||
|
||
\`\`\`svelte
|
||
<table
|
||
data="{yourData}"
|
||
searchable="{true}"
|
||
paginated="{true}"
|
||
title="{'Press Freedom Index'}"
|
||
notes="{'Source: Reporters Without Borders'}"
|
||
></table>
|
||
\`\`\`
|
||
`,Nt=`Allow users to filter the table by providing one of the attributes as the \`filterField\`. This works best with categorical columns.
|
||
|
||
\`\`\`svelte
|
||
<table
|
||
data="{yourData}"
|
||
filterField="{'Region'}"
|
||
paginated="{true}"
|
||
title="{'Press Freedom Index'}"
|
||
notes="{'Source: Reporters Without Borders'}"
|
||
></table>
|
||
\`\`\`
|
||
`,Dt=`Feel free to both search and filter.
|
||
|
||
\`\`\`svelte
|
||
<table
|
||
data="{yourData}"
|
||
searchable="{true}"
|
||
filterField="{'Region'}"
|
||
paginated="{true}"
|
||
title="{'Press Freedom Index'}"
|
||
dek="{'Reporters Without Borders ranks countries based on their level of press freedom using criteria such as the degree of media pluralism and violence against journalists.'}"
|
||
source="{'Source: Reporters Without Borders'}"
|
||
></table>
|
||
\`\`\`
|
||
`,Et=`Allow users to sort the table by setting the \`sortable\` input. Specify the starting order by setting \`sortField\` to a column name and \`sortDirection\` to \`ascending\` or \`descending\`.
|
||
|
||
By default, all fields are sortable. If you'd like to limit the columns where sorting is allowed, provide a list to the \`sortableFields\` option.
|
||
|
||
\`\`\`svelte
|
||
<table
|
||
data="{yourData}"
|
||
sortable="{true}"
|
||
sortField="{'Score'}"
|
||
sortDirection="{'descending'}"
|
||
title="{'Press Freedom Index'}"
|
||
source="{'Source: Reporters Without Borders'}"
|
||
></table>
|
||
\`\`\`
|
||
`,Tt=`Format column values by supplying functions keyed to field names with the \`fieldFormatters\` option. Columns are still sorted using the raw, underlying values.
|
||
|
||
Among other things, this feature can be used to provide a unit of measurement with numeric fields.
|
||
|
||
\`\`\`svelte
|
||
<script lang="ts">
|
||
const fieldFormatters = {
|
||
'Net worth (in billions)': (v) => '$' + v.toFixed(1),
|
||
};
|
||
<\/script>
|
||
|
||
<table
|
||
data="{yourData}"
|
||
fieldFormatters="{fieldFormatters}"
|
||
sortable="{true}"
|
||
sortField="{'Score'}"
|
||
sortDirection="{'descending'}"
|
||
title="{'The Richest Women in the World'}"
|
||
source="{'Source: Forbes'}"
|
||
></table>
|
||
\`\`\`
|
||
`,Wt=`You can tailor the table's appearance by crafting CSS that targets specific elements.
|
||
|
||
Like other components, you can apply labels by providing the \`id\` of \`cls\` options, which allow you to make broad changes that remain limited to your element.
|
||
|
||
Each column has a \`data-field\` attribute that contains the field's name. Use it to apply different styles to different fields. One common use is setting different text alignments on different columns.
|
||
|
||
\`\`\`svelte
|
||
<table
|
||
id="{'custom-table'}"
|
||
data="{yourData}"
|
||
title="{'The Richest Women in the World'}"
|
||
source="{'Source: Forbes'}"
|
||
></table>
|
||
|
||
<style lang="scss">
|
||
/* Here we right align the table's numeric column. */
|
||
#custom-table {
|
||
[data-field='Net worth (in billions)'] {
|
||
text-align: right;
|
||
}
|
||
}
|
||
</style>
|
||
\`\`\`
|
||
`;function Pt(n){let e,t;return{c(){e=ne("svg"),t=ne("path"),c(t,"d","m1.76 5.134 3.887-3.887a.71.71 0 0 0 0-1.027.709.709 0 0 0-1.027 0l-4.4 4.4a.71.71 0 0 0 0 1.027l4.4 4.4c.147.147.367.22.513.22a.79.79 0 0 0 .513-.22.71.71 0 0 0 0-1.027L1.76 5.133Z"),c(e,"class","icon svelte-n96ejf"),c(e,"aria-hidden","true"),c(e,"focusable","false"),c(e,"xmlns","http://www.w3.org/2000/svg"),c(e,"viewBox","0 0 6 11")},m(r,a){w(r,e,a),p(e,t)},p:J,i:J,o:J,d(r){r&&A(e)}}}class nt extends re{constructor(e){super(),ae(this,e,null,Pt,oe,{})}}nt.__docgen={version:3,name:"LeftArrow.svelte",data:[],computed:[],methods:[],components:[],description:null,keywords:[],events:[],slots:[],refs:[]};function Mt(n){let e,t;return{c(){e=ne("svg"),t=ne("path"),c(t,"d","m6.013 4.987-4.4-4.4a.71.71 0 0 0-1.027 0 .709.709 0 0 0 0 1.027L4.473 5.5.586 9.387a.71.71 0 0 0 0 1.027c.147.147.293.22.513.22.22 0 .367-.073.514-.22l4.4-4.4a.71.71 0 0 0 0-1.027Z"),c(e,"class","icon svelte-n96ejf"),c(e,"aria-hidden","true"),c(e,"focusable","false"),c(e,"xmlns","http://www.w3.org/2000/svg"),c(e,"viewBox","0 0 7 11")},m(r,a){w(r,e,a),p(e,t)},p:J,i:J,o:J,d(r){r&&A(e)}}}class rt extends re{constructor(e){super(),ae(this,e,null,Mt,oe,{})}}rt.__docgen={version:3,name:"RightArrow.svelte",data:[],computed:[],methods:[],components:[],description:null,keywords:[],events:[],slots:[],refs:[]};function Bt(n){let e,t,r,a,i,s,l,u,g,D,h,d,y,k,P=Ee(n[2])+"",F,H,B,L,E,v,M,S,f,b,m,G;return a=new nt({}),v=new rt({}),{c(){e=C("nav"),t=C("button"),r=C("div"),I(a.$$.fragment),i=W(),s=C("span"),s.textContent="Previous page",u=W(),g=C("div"),D=C("div"),h=j(n[4]),d=j("-"),y=j(n[3]),k=j(" of "),F=j(P),B=W(),L=C("button"),E=C("div"),I(v.$$.fragment),M=W(),S=C("span"),S.textContent="Next page",c(s,"class","visually-hidden svelte-1ip5dla"),c(r,"class","icon-wrapper svelte-1ip5dla"),t.disabled=l=n[0]===1,c(t,"class","svelte-1ip5dla"),c(D,"class","records body-caption mt-1.5"),c(g,"class","label fmx-2 svelte-1ip5dla"),c(g,"aria-label",H="page "+n[0]),c(g,"aria-current","page"),c(S,"class","visually-hidden svelte-1ip5dla"),c(E,"class","icon-wrapper svelte-1ip5dla"),L.disabled=f=n[0]===Math.ceil(n[2]/n[1]),c(L,"class","svelte-1ip5dla"),c(e,"aria-label","pagination"),c(e,"class","pagination fmt-4 svelte-1ip5dla")},m(T,V){w(T,e,V),p(e,t),p(t,r),z(a,r,null),p(r,i),p(r,s),p(e,u),p(e,g),p(g,D),p(D,h),p(D,d),p(D,y),p(D,k),p(D,F),p(e,B),p(e,L),p(L,E),z(v,E,null),p(E,M),p(E,S),b=!0,m||(G=[ye(t,"click",n[5]),ye(L,"click",n[6])],m=!0)},p(T,[V]){(!b||V&1&&l!==(l=T[0]===1))&&(t.disabled=l),(!b||V&16)&&$(h,T[4]),(!b||V&8)&&$(y,T[3]),(!b||V&4)&&P!==(P=Ee(T[2])+"")&&$(F,P),(!b||V&1&&H!==(H="page "+T[0]))&&c(g,"aria-label",H),(!b||V&7&&f!==(f=T[0]===Math.ceil(T[2]/T[1])))&&(L.disabled=f)},i(T){b||(R(a.$$.fragment,T),R(v.$$.fragment,T),b=!0)},o(T){N(a.$$.fragment,T),N(v.$$.fragment,T),b=!1},d(T){T&&A(e),q(a),q(v),m=!1,pt(G)}}}function It(n,e,t){let r,a,i,{pageNumber:s=1}=e,{pageSize:l=25}=e,{pageLength:u=null}=e,{n:g=null}=e;function D(){s>1&&t(0,s-=1)}function h(){s<i&&t(0,s+=1)}return n.$$set=d=>{"pageNumber"in d&&t(0,s=d.pageNumber),"pageSize"in d&&t(1,l=d.pageSize),"pageLength"in d&&t(7,u=d.pageLength),"n"in d&&t(2,g=d.n)},n.$$.update=()=>{n.$$.dirty&3&&t(4,r=s*l-l+1),n.$$.dirty&131&&t(3,a=s*l-l+u),n.$$.dirty&6&&(i=Math.ceil(g/l))},[s,l,g,a,r,D,h,u]}class at extends re{constructor(e){super(),ae(this,e,It,Bt,oe,{pageNumber:0,pageSize:1,pageLength:7,n:2})}}at.__docgen={version:3,name:"Pagination.svelte",data:[{keywords:[{name:"type",description:"{number}"}],visibility:"public",description:"The current page number.",name:"pageNumber",kind:"let",static:!1,readonly:!1,type:{kind:"type",text:"number",type:"number"},defaultValue:1},{keywords:[{name:"type",description:"{number}"}],visibility:"public",description:"The default page size.",name:"pageSize",kind:"let",static:!1,readonly:!1,type:{kind:"type",text:"number",type:"number"},defaultValue:25},{keywords:[{name:"type",description:"{number}"}],visibility:"public",description:"The number of records in the current page.",name:"pageLength",kind:"let",static:!1,readonly:!1,type:{kind:"type",text:"number",type:"number"},defaultValue:null},{keywords:[{name:"type",description:"{number}"}],visibility:"public",description:"The total number of records in the data set.",name:"n",kind:"let",static:!1,readonly:!1,type:{kind:"type",text:"number",type:"number"},defaultValue:null}],computed:[],methods:[],components:[],description:null,keywords:[],events:[],slots:[],refs:[]};function Te(n,e,t){const r=n.slice();return r[4]=e[t],r}function We(n){let e,t;return{c(){e=C("label"),t=j(n[0]),c(e,"class","body-caption block"),c(e,"for","select--input")},m(r,a){w(r,e,a),p(e,t)},p(r,a){a&1&&$(t,r[0])},d(r){r&&A(e)}}}function Pe(n){let e,t=n[4].text+"",r,a;return{c(){e=C("option"),r=j(t),e.__value=a=n[4].value,De(e,e.__value)},m(i,s){w(i,e,s),p(e,r)},p(i,s){s&2&&t!==(t=i[4].text+"")&&$(r,t),s&2&&a!==(a=i[4].value)&&(e.__value=a,De(e,e.__value))},d(i){i&&A(e)}}}function zt(n){let e,t,r,a,i,s=n[0]&&We(n),l=x(n[1]),u=[];for(let g=0;g<l.length;g+=1)u[g]=Pe(Te(n,l,g));return{c(){e=C("div"),s&&s.c(),t=W(),r=C("select");for(let g=0;g<u.length;g+=1)u[g].c();c(r,"class","select--input body-caption fpx-2 svelte-hf0fh8"),c(r,"name","select--input"),c(r,"id","select--input"),c(e,"class","select svelte-hf0fh8")},m(g,D){w(g,e,D),s&&s.m(e,null),p(e,t),p(e,r);for(let h=0;h<u.length;h+=1)u[h]&&u[h].m(r,null);a||(i=ye(r,"input",n[2]),a=!0)},p(g,[D]){if(g[0]?s?s.p(g,D):(s=We(g),s.c(),s.m(e,t)):s&&(s.d(1),s=null),D&2){l=x(g[1]);let h;for(h=0;h<l.length;h+=1){const d=Te(g,l,h);u[h]?u[h].p(d,D):(u[h]=Pe(d),u[h].c(),u[h].m(r,null))}for(;h<u.length;h+=1)u[h].d(1);u.length=l.length}},i:J,o:J,d(g){g&&A(e),s&&s.d(),Le(u,g),a=!1,i()}}}function qt(n,e,t){let{label:r=""}=e,{options:a=[]}=e;const i=mt();function s(l){const u=l.target.value;i("select",{value:u})}return n.$$set=l=>{"label"in l&&t(0,r=l.label),"options"in l&&t(1,a=l.options)},[r,a,s]}class ot extends re{constructor(e){super(),ae(this,e,qt,zt,oe,{label:0,options:1})}}ot.__docgen={version:3,name:"Select.svelte",data:[{keywords:[{name:"type",description:"{string}"}],visibility:"public",description:"The label that appears above the select input.",name:"label",kind:"let",static:!1,readonly:!1,type:{kind:"type",text:"string",type:"string"},defaultValue:""},{keywords:[{name:"type",description:"{Array}"}],visibility:"public",description:"The label that appears above the select input.",name:"options",kind:"let",static:!1,readonly:!1,type:{kind:"type",text:"Array",type:"Array"}}],computed:[],methods:[],components:[],description:null,keywords:[],events:[{visibility:"public",description:null,keywords:[],name:"select"}],slots:[],refs:[]};function Ht(n){let e,t,r;return{c(){e=ne("svg"),t=ne("path"),r=ne("path"),c(t,"d","M6.76474 20.2244L0.236082 13.4649C-0.0786943 13.139 -0.0786943 12.6104 0.236082 12.2845C0.550521 11.959 1.19794 11.96 1.51305 12.2845L7.33483 12.2845L13 12.2845C13.43 11.8545 14.1195 11.9593 14.4339 12.2849C14.7487 12.6107 14.7487 13.1394 14.4339 13.4653L7.90492 20.2244C7.59015 20.5503 7.07952 20.5503 6.76474 20.2244Z"),c(t,"class","svelte-1vec2lc"),K(t,"active",n[0]==="descending"&&n[1]),c(r,"d","M7.90518 0.244414L14.4338 7.00385C14.7486 7.32973 14.7486 7.85838 14.4338 8.18427C14.1194 8.50981 13.472 8.50876 13.1569 8.18427L7.33509 8.18427L1.66992 8.18427C1.23992 8.61427 0.550443 8.50946 0.236003 8.18392C-0.0787725 7.85803 -0.0787725 7.32938 0.236003 7.0035L6.765 0.244414C7.07978 -0.0814713 7.5904 -0.0814713 7.90518 0.244414Z"),c(r,"class","svelte-1vec2lc"),K(r,"active",n[0]==="ascending"&&n[1]),c(e,"width","15"),c(e,"height","21"),c(e,"viewBox","0 0 15 21"),c(e,"fill","none"),c(e,"xmlns","http://www.w3.org/2000/svg"),c(e,"class","avoid-clicks svelte-1vec2lc")},m(a,i){w(a,e,i),p(e,t),p(e,r)},p(a,[i]){i&3&&K(t,"active",a[0]==="descending"&&a[1]),i&3&&K(r,"active",a[0]==="ascending"&&a[1])},i:J,o:J,d(a){a&&A(e)}}}function Vt(n,e,t){let{sortDirection:r="ascending"}=e,{active:a=!1}=e;return n.$$set=i=>{"sortDirection"in i&&t(0,r=i.sortDirection),"active"in i&&t(1,a=i.active)},[r,a]}class it extends re{constructor(e){super(),ae(this,e,Vt,Ht,oe,{sortDirection:0,active:1})}}it.__docgen={version:3,name:"SortArrow.svelte",data:[{visibility:"public",description:null,keywords:[],name:"sortDirection",kind:"let",static:!1,readonly:!1,type:{kind:"type",text:"string",type:"string"},defaultValue:"ascending"},{keywords:[{name:"type",description:"{boolean}"}],visibility:"public",description:"Whether or not this arrow is currently sorting. It is false by default.",name:"active",kind:"let",static:!1,readonly:!1,type:{kind:"type",text:"boolean",type:"boolean"},defaultValue:!1}],computed:[],methods:[],components:[],description:null,keywords:[],events:[],slots:[],refs:[]};function jt(n,e,t,r){return e&&(n=n.filter(a=>a.searchStr.includes(e.toLowerCase()))),r&&r&&(n=n.filter(a=>a[t]===r)),n}function Gt(n,e,t){return n.slice((t-1)*e,t*e)}function Kt(n,e){return n.map(t=>t[e]).filter(Ot)}function Ot(n,e,t){return t.indexOf(n)===e}function Jt(n,e){const t=Kt(n,e).sort((r,a)=>r.localeCompare(a));return t.unshift("All"),t.map(r=>({text:r,value:r}))}function Me(n,e,t){const r=n.slice();return r[42]=e[t],r[44]=t,r}function Be(n,e,t){const r=n.slice();return r[45]=e[t],r}function Ie(n,e,t){const r=n.slice();return r[45]=e[t],r}function ze(n){let e,t,r,a,i=n[5]&&qe(n),s=n[6]&&He(n),l=(n[13]||n[26])&&Ve(n);return{c(){e=C("header"),i&&i.c(),t=W(),s&&s.c(),r=W(),l&&l.c(),c(e,"class","table--header w-full")},m(u,g){w(u,e,g),i&&i.m(e,null),p(e,t),s&&s.m(e,null),p(e,r),l&&l.m(e,null),a=!0},p(u,g){u[5]?i?i.p(u,g):(i=qe(u),i.c(),i.m(e,t)):i&&(i.d(1),i=null),u[6]?s?s.p(u,g):(s=He(u),s.c(),s.m(e,r)):s&&(s.d(1),s=null),u[13]||u[26]?l?(l.p(u,g),g[0]&8192&&R(l,1)):(l=Ve(u),l.c(),R(l,1),l.m(e,null)):l&&(ue(),N(l,1,1,()=>{l=null}),ce())},i(u){a||(R(l),a=!0)},o(u){N(l),a=!1},d(u){u&&A(e),i&&i.d(),s&&s.d(),l&&l.d()}}}function qe(n){let e;return{c(){e=C("h3"),c(e,"class","table--header--title")},m(t,r){w(t,e,r),e.innerHTML=n[5]},p(t,r){r[0]&32&&(e.innerHTML=t[5])},d(t){t&&A(e)}}}function He(n){let e;return{c(){e=C("p"),c(e,"class","table--header--dek body-note")},m(t,r){w(t,e,r),e.innerHTML=n[6]},p(t,r){r[0]&64&&(e.innerHTML=t[6])},d(t){t&&A(e)}}}function Ve(n){let e,t,r,a=n[26]&&Zt(n),i=n[13]&&je(n);return{c(){e=C("nav"),a&&a.c(),t=W(),i&&i.c(),c(e,"class","input fmx-0 fmy-2 svelte-6q2npc")},m(s,l){w(s,e,l),a&&a.m(e,null),p(e,t),i&&i.m(e,null),r=!0},p(s,l){s[26]&&a.p(s,l),s[13]?i?(i.p(s,l),l[0]&8192&&R(i,1)):(i=je(s),i.c(),R(i,1),i.m(e,null)):i&&(ue(),N(i,1,1,()=>{i=null}),ce())},i(s){r||(R(a),R(i),r=!0)},o(s){N(a),N(i),r=!1},d(s){s&&A(e),a&&a.d(),i&&i.d()}}}function Zt(n){let e,t,r;return t=new ot({props:{label:n[15]||n[14],options:n[26]}}),t.$on("select",n[29]),{c(){e=C("div"),I(t.$$.fragment),c(e,"class","table--header--filter")},m(a,i){w(a,e,i),z(t,e,null),r=!0},p(a,i){const s={};i[0]&49152&&(s.label=a[15]||a[14]),t.$set(s)},i(a){r||(R(t.$$.fragment,a),r=!0)},o(a){N(t.$$.fragment,a),r=!1},d(a){a&&A(e),q(t)}}}function je(n){let e,t,r,a;function i(l){n[35](l)}let s={};return n[3]!==void 0&&(s.searchPlaceholder=n[3]),t=new Rt({props:s}),ie.push(()=>se(t,"searchPlaceholder",i)),t.$on("search",n[28]),{c(){e=C("div"),I(t.$$.fragment),c(e,"class","table--header--search")},m(l,u){w(l,e,u),z(t,e,null),a=!0},p(l,u){const g={};!r&&u[0]&8&&(r=!0,g.searchPlaceholder=l[3],le(()=>r=!1)),t.$set(g)},i(l){a||(R(t.$$.fragment,l),a=!0)},o(l){N(t.$$.fragment,l),a=!1},d(l){l&&A(e),q(t)}}}function Ge(n){let e,t,r,a;function i(l){n[36](l)}let s={active:n[1]===n[45]};return n[2]!==void 0&&(s.sortDirection=n[2]),t=new it({props:s}),ie.push(()=>se(t,"sortDirection",i)),{c(){e=C("div"),I(t.$$.fragment),c(e,"class","table--thead--sortarrow fml-1 avoid-clicks svelte-6q2npc")},m(l,u){w(l,e,u),z(t,e,null),a=!0},p(l,u){const g={};u[0]&514&&(g.active=l[1]===l[45]),!r&&u[0]&4&&(r=!0,g.sortDirection=l[2],le(()=>r=!1)),t.$set(g)},i(l){a||(R(t.$$.fragment,l),a=!0)},o(l){N(t.$$.fragment,l),a=!1},d(l){l&&A(e),q(t)}}}function Ke(n){let e,t=n[45]+"",r,a,i=n[16]&&n[17].includes(n[45]),s,l,u,g,D,h=i&&Ge(n);return{c(){e=C("th"),r=j(t),a=W(),h&&h.c(),s=W(),c(e,"scope","col"),c(e,"class","table--thead--th h4 pl-0 py-2 pr-2 svelte-6q2npc"),c(e,"data-field",l=n[45]),K(e,"sortable",n[16]&&n[17].includes(n[45])),K(e,"sort-ascending",n[16]&&n[1]===n[45]&&n[2]==="ascending"),K(e,"sort-descending",n[16]&&n[1]===n[45]&&n[2]==="descending")},m(d,y){w(d,e,y),p(e,r),p(e,a),h&&h.m(e,null),p(e,s),u=!0,g||(D=ye(e,"click",n[30]),g=!0)},p(d,y){(!u||y[0]&512)&&t!==(t=d[45]+"")&&$(r,t),y[0]&197120&&(i=d[16]&&d[17].includes(d[45])),i?h?(h.p(d,y),y[0]&197120&&R(h,1)):(h=Ge(d),h.c(),R(h,1),h.m(e,s)):h&&(ue(),N(h,1,1,()=>{h=null}),ce()),(!u||y[0]&512&&l!==(l=d[45]))&&c(e,"data-field",l),(!u||y[0]&197120)&&K(e,"sortable",d[16]&&d[17].includes(d[45])),(!u||y[0]&66054)&&K(e,"sort-ascending",d[16]&&d[1]===d[45]&&d[2]==="ascending"),(!u||y[0]&66054)&&K(e,"sort-descending",d[16]&&d[1]===d[45]&&d[2]==="descending")},i(d){u||(R(h),u=!0)},o(d){N(h),u=!1},d(d){d&&A(e),h&&h.d(),g=!1,D()}}}function Oe(n){let e,t=n[31](n[42],n[45])+"",r,a;return{c(){e=C("td"),c(e,"class","body-note pl-0 py-2 pr-2 svelte-6q2npc"),c(e,"data-row-index",n[44]),c(e,"data-field",r=n[45]),c(e,"data-value",a=n[42][n[45]])},m(i,s){w(i,e,s),e.innerHTML=t},p(i,s){s[0]&33554944&&t!==(t=i[31](i[42],i[45])+"")&&(e.innerHTML=t),s[0]&512&&r!==(r=i[45])&&c(e,"data-field",r),s[0]&33554944&&a!==(a=i[42][i[45]])&&c(e,"data-value",a)},d(i){i&&A(e)}}}function Je(n){let e,t=x(n[9]),r=[];for(let a=0;a<t.length;a+=1)r[a]=Oe(Be(n,t,a));return{c(){e=C("tr");for(let a=0;a<r.length;a+=1)r[a].c();c(e,"data-row-index",n[44]),c(e,"class","svelte-6q2npc")},m(a,i){w(a,e,i);for(let s=0;s<r.length;s+=1)r[s]&&r[s].m(e,null)},p(a,i){if(i[0]&33554944|i[1]&1){t=x(a[9]);let s;for(s=0;s<t.length;s+=1){const l=Be(a,t,s);r[s]?r[s].p(l,i):(r[s]=Oe(l),r[s].c(),r[s].m(e,null))}for(;s<r.length;s+=1)r[s].d(1);r.length=t.length}},d(a){a&&A(e),Le(r,a)}}}function Ze(n){let e,t,r,a,i,s;return{c(){e=C("tr"),t=C("td"),r=j('No results found for "'),a=j(n[23]),i=j('"'),c(t,"class","no-results svelte-6q2npc"),c(t,"colspan",s=n[9].length),c(e,"class","svelte-6q2npc")},m(l,u){w(l,e,u),p(e,t),p(t,r),p(t,a),p(t,i)},p(l,u){u[0]&8388608&&$(a,l[23]),u[0]&512&&s!==(s=l[9].length)&&c(t,"colspan",s)},d(l){l&&A(e)}}}function Ue(n){let e,t,r=n[7]&&Ye(n),a=n[8]&&Qe(n);return{c(){e=C("tfoot"),r&&r.c(),t=W(),a&&a.c(),c(e,"class","table--tfoot")},m(i,s){w(i,e,s),r&&r.m(e,null),p(e,t),a&&a.m(e,null)},p(i,s){i[7]?r?r.p(i,s):(r=Ye(i),r.c(),r.m(e,t)):r&&(r.d(1),r=null),i[8]?a?a.p(i,s):(a=Qe(i),a.c(),a.m(e,null)):a&&(a.d(1),a=null)},d(i){i&&A(e),r&&r.d(),a&&a.d()}}}function Ye(n){let e,t,r,a;return{c(){e=C("tr"),t=C("td"),r=C("div"),c(r,"class","fmt-2"),c(t,"class"," svelte-6q2npc"),c(t,"colspan",a=n[9].length),c(e,"class","svelte-6q2npc")},m(i,s){w(i,e,s),p(e,t),p(t,r),r.innerHTML=n[7]},p(i,s){s[0]&128&&(r.innerHTML=i[7]),s[0]&512&&a!==(a=i[9].length)&&c(t,"colspan",a)},d(i){i&&A(e)}}}function Qe(n){let e,t,r,a;return{c(){e=C("tr"),t=C("td"),r=C("div"),c(r,"class","fmt-1"),c(t,"class"," svelte-6q2npc"),c(t,"colspan",a=n[9].length),c(e,"class","svelte-6q2npc")},m(i,s){w(i,e,s),p(e,t),p(t,r),r.innerHTML=n[8]},p(i,s){s[0]&256&&(r.innerHTML=i[8]),s[0]&512&&a!==(a=i[9].length)&&c(t,"colspan",a)},d(i){i&&A(e)}}}function Xe(n){let e,t,r,a;function i(u,g){return u[21]?Yt:Ut}let s=i(n),l=s(n);return{c(){e=C("nav"),t=C("button"),l.c(),c(t,"class","body-caption svelte-6q2npc"),c(e,"aria-label","Show all button"),c(e,"class","show-all flex items-center justify-center fmt-2 svelte-6q2npc")},m(u,g){w(u,e,g),p(e,t),l.m(t,null),r||(a=ye(t,"click",n[27]),r=!0)},p(u,g){s===(s=i(u))&&l?l.p(u,g):(l.d(1),l=s(u),l&&(l.c(),l.m(t,null)))},d(u){u&&A(e),l.d(),r=!1,a()}}}function Ut(n){let e,t=n[4].length-n[11]+"",r,a;return{c(){e=j("Show "),r=j(t),a=j(" more rows")},m(i,s){w(i,e,s),w(i,r,s),w(i,a,s)},p(i,s){s[0]&2064&&t!==(t=i[4].length-i[11]+"")&&$(r,t)},d(i){i&&(A(e),A(r),A(a))}}}function Yt(n){let e;return{c(){e=j("Show fewer rows")},m(t,r){w(t,e,r)},p:J,d(t){t&&A(e)}}}function xe(n){let e,t,r,a,i,s;function l(d){n[37](d)}function u(d){n[38](d)}function g(d){n[39](d)}function D(d){n[40](d)}let h={};return n[22]!==void 0&&(h.pageNumber=n[22]),n[0]!==void 0&&(h.pageSize=n[0]),n[25].length!==void 0&&(h.pageLength=n[25].length),n[24].length!==void 0&&(h.n=n[24].length),e=new at({props:h}),ie.push(()=>se(e,"pageNumber",l)),ie.push(()=>se(e,"pageSize",u)),ie.push(()=>se(e,"pageLength",g)),ie.push(()=>se(e,"n",D)),{c(){I(e.$$.fragment)},m(d,y){z(e,d,y),s=!0},p(d,y){const k={};!t&&y[0]&4194304&&(t=!0,k.pageNumber=d[22],le(()=>t=!1)),!r&&y[0]&1&&(r=!0,k.pageSize=d[0],le(()=>r=!1)),!a&&y[0]&33554432&&(a=!0,k.pageLength=d[25].length,le(()=>a=!1)),!i&&y[0]&16777216&&(i=!0,k.n=d[24].length,le(()=>i=!1)),e.$set(k)},i(d){s||(R(e.$$.fragment,d),s=!0)},o(d){N(e.$$.fragment,d),s=!1},d(d){q(e,d)}}}function Qt(n){let e,t,r,a,i,s,l,u,g,D,h,d,y,k=(n[5]||n[6]||n[13]||n[26])&&ze(n),P=x(n[9]),F=[];for(let f=0;f<P.length;f+=1)F[f]=Ke(Ie(n,P,f));const H=f=>N(F[f],1,1,()=>{F[f]=null});let B=x(n[25]),L=[];for(let f=0;f<B.length;f+=1)L[f]=Je(Me(n,B,f));let E=n[13]&&n[23]&&n[25].length===0&&Ze(n),v=(n[7]||n[8])&&Ue(n),M=n[10]&&n[4].length>n[11]&&Xe(n),S=n[12]&&xe(n);return{c(){e=C("article"),k&&k.c(),t=W(),r=C("section"),a=C("table"),i=C("thead"),s=C("tr");for(let f=0;f<F.length;f+=1)F[f].c();l=W(),u=C("tbody");for(let f=0;f<L.length;f+=1)L[f].c();g=W(),E&&E.c(),D=W(),v&&v.c(),h=W(),M&&M.c(),d=W(),S&&S.c(),c(s,"class","svelte-6q2npc"),c(i,"class","table--thead"),c(u,"class","table--tbody"),c(a,"class","w-full svelte-6q2npc"),K(a,"paginated",n[12]),K(a,"truncated",n[10]&&!n[21]&&n[4].length>n[11]),c(r,"class","table w-full svelte-6q2npc"),c(e,"class","table-wrapper")},m(f,b){w(f,e,b),k&&k.m(e,null),p(e,t),p(e,r),p(r,a),p(a,i),p(i,s);for(let m=0;m<F.length;m+=1)F[m]&&F[m].m(s,null);p(a,l),p(a,u);for(let m=0;m<L.length;m+=1)L[m]&&L[m].m(u,null);p(u,g),E&&E.m(u,null),p(a,D),v&&v.m(a,null),p(e,h),M&&M.m(e,null),p(e,d),S&&S.m(e,null),y=!0},p(f,b){if(f[5]||f[6]||f[13]||f[26]?k?(k.p(f,b),b[0]&8288&&R(k,1)):(k=ze(f),k.c(),R(k,1),k.m(e,t)):k&&(ue(),N(k,1,1,()=>{k=null}),ce()),b[0]&1073938950){P=x(f[9]);let m;for(m=0;m<P.length;m+=1){const G=Ie(f,P,m);F[m]?(F[m].p(G,b),R(F[m],1)):(F[m]=Ke(G),F[m].c(),R(F[m],1),F[m].m(s,null))}for(ue(),m=P.length;m<F.length;m+=1)H(m);ce()}if(b[0]&33554944|b[1]&1){B=x(f[25]);let m;for(m=0;m<B.length;m+=1){const G=Me(f,B,m);L[m]?L[m].p(G,b):(L[m]=Je(G),L[m].c(),L[m].m(u,g))}for(;m<L.length;m+=1)L[m].d(1);L.length=B.length}f[13]&&f[23]&&f[25].length===0?E?E.p(f,b):(E=Ze(f),E.c(),E.m(u,null)):E&&(E.d(1),E=null),f[7]||f[8]?v?v.p(f,b):(v=Ue(f),v.c(),v.m(a,null)):v&&(v.d(1),v=null),(!y||b[0]&4096)&&K(a,"paginated",f[12]),(!y||b[0]&2100240)&&K(a,"truncated",f[10]&&!f[21]&&f[4].length>f[11]),f[10]&&f[4].length>f[11]?M?M.p(f,b):(M=Xe(f),M.c(),M.m(e,d)):M&&(M.d(1),M=null),f[12]?S?(S.p(f,b),b[0]&4096&&R(S,1)):(S=xe(f),S.c(),R(S,1),S.m(e,null)):S&&(ue(),N(S,1,1,()=>{S=null}),ce())},i(f){if(!y){R(k);for(let b=0;b<P.length;b+=1)R(F[b]);R(S),y=!0}},o(f){N(k),F=F.filter(Boolean);for(let b=0;b<F.length;b+=1)N(F[b]);N(S),y=!1},d(f){f&&A(e),k&&k.d(),Le(F,f),Le(L,f),E&&E.d(),v&&v.d(),M&&M.d(),S&&S.d()}}}function Xt(n){let e,t;return e=new Ct({props:{width:n[18],id:n[19],class:"fmy-6 "+n[20],$$slots:{default:[Qt]},$$scope:{ctx:n}}}),{c(){I(e.$$.fragment)},m(r,a){z(e,r,a),t=!0},p(r,a){const i={};a[0]&262144&&(i.width=r[18]),a[0]&524288&&(i.id=r[19]),a[0]&1048576&&(i.class="fmy-6 "+r[20]),a[0]&65273855|a[1]&524288&&(i.$$scope={dirty:a,ctx:r}),e.$set(i)},i(r){t||(R(e.$$.fragment,r),t=!0)},o(r){N(e.$$.fragment,r),t=!1},d(r){q(e,r)}}}function xt(n,e,t){let r,a,i,{data:s}=e,{title:l=null}=e,{dek:u=null}=e,{notes:g=null}=e,{source:D=null}=e,{includedFields:h=Object.keys(s[0]).filter(o=>o!=="searchStr")}=e,{truncated:d=!1}=e,{truncateLength:y=5}=e,{paginated:k=!1}=e,{pageSize:P=25}=e,{searchable:F=!1}=e,{searchPlaceholder:H="Search in table"}=e,{filterField:B}=e,{filterLabel:L}=e,{sortable:E=!1}=e,{sortField:v=Object.keys(s[0])[0]}=e,{sortableFields:M=Object.keys(s[0]).filter(o=>o!=="searchStr")}=e,{sortDirection:S="ascending"}=e,{fieldFormatters:f={}}=e,{width:b="normal"}=e,{id:m=""}=e,{class:G=""}=e,T=!1,V=1,Y="";const Se=B?Jt(s,B):void 0;let Q="";function _e(o){t(21,T=!T)}function fe(o){t(23,Y=o.detail.value),t(22,V=1)}function Ce(o){const _=o.detail.value;t(33,Q=_==="All"?"":_),t(22,V=1)}function de(o){E&&(t(1,v=o.target.getAttribute("data-field")),t(2,S=S==="ascending"?"descending":"ascending"))}function Re(o,_,ee){return E?o.sort((te,ve)=>te[_]<ve[_]?ee==="ascending"?-1:1:te[_]>ve[_]?ee==="ascending"?1:-1:0):o}function ge(o,_){const ee=o[_];if(_ in f){const te=f[_];return te(ee)}else return ee}bt(()=>{s.forEach(o=>{o.searchStr=h.map(_=>o[_]).join(" ").toLowerCase()})});function we(o){H=o,t(3,H)}function he(o){S=o,t(2,S)}function Ae(o){V=o,t(22,V)}function pe(o){P=o,t(0,P)}function ke(o){n.$$.not_equal(i.length,o)&&(i.length=o,t(25,i),t(10,d),t(21,T),t(24,a),t(11,y),t(12,k),t(0,P),t(22,V),t(34,r),t(1,v),t(2,S),t(4,s),t(23,Y),t(14,B),t(33,Q))}function me(o){n.$$.not_equal(a.length,o)&&(a.length=o,t(24,a),t(34,r),t(1,v),t(2,S),t(4,s),t(23,Y),t(14,B),t(33,Q))}return n.$$set=o=>{"data"in o&&t(4,s=o.data),"title"in o&&t(5,l=o.title),"dek"in o&&t(6,u=o.dek),"notes"in o&&t(7,g=o.notes),"source"in o&&t(8,D=o.source),"includedFields"in o&&t(9,h=o.includedFields),"truncated"in o&&t(10,d=o.truncated),"truncateLength"in o&&t(11,y=o.truncateLength),"paginated"in o&&t(12,k=o.paginated),"pageSize"in o&&t(0,P=o.pageSize),"searchable"in o&&t(13,F=o.searchable),"searchPlaceholder"in o&&t(3,H=o.searchPlaceholder),"filterField"in o&&t(14,B=o.filterField),"filterLabel"in o&&t(15,L=o.filterLabel),"sortable"in o&&t(16,E=o.sortable),"sortField"in o&&t(1,v=o.sortField),"sortableFields"in o&&t(17,M=o.sortableFields),"sortDirection"in o&&t(2,S=o.sortDirection),"fieldFormatters"in o&&t(32,f=o.fieldFormatters),"width"in o&&t(18,b=o.width),"id"in o&&t(19,m=o.id),"class"in o&&t(20,G=o.class)},n.$$.update=()=>{n.$$.dirty[0]&8405008|n.$$.dirty[1]&4&&t(34,r=jt(s,Y,B,Q)),n.$$.dirty[0]&6|n.$$.dirty[1]&8&&t(24,a=Re(r,v,S)),n.$$.dirty[0]&23075841&&t(25,i=d?T?a:a.slice(0,y+1):k?Gt(a,P,V):a)},[P,v,S,H,s,l,u,g,D,h,d,y,k,F,B,L,E,M,b,m,G,T,V,Y,a,i,Se,_e,fe,Ce,de,ge,f,Q,r,we,he,Ae,pe,ke,me]}class Ne extends re{constructor(e){super(),ae(this,e,xt,Xt,oe,{data:4,title:5,dek:6,notes:7,source:8,includedFields:9,truncated:10,truncateLength:11,paginated:12,pageSize:0,searchable:13,searchPlaceholder:3,filterField:14,filterLabel:15,sortable:16,sortField:1,sortableFields:17,sortDirection:2,fieldFormatters:32,width:18,id:19,class:20},null,[-1,-1])}}Ne.__docgen={version:3,name:"Table.svelte",data:[{keywords:[{name:"type",description:"[]"},{name:"required",description:""}],visibility:"public",description:"A source for the data.",name:"data",kind:"let",static:!1,readonly:!1,type:{kind:"type",text:"any",type:"any"}},{keywords:[{name:"type",description:"{string}"}],visibility:"public",description:"A title that runs above the table.",name:"title",kind:"let",static:!1,readonly:!1,type:{kind:"type",text:"string",type:"string"},defaultValue:null},{keywords:[{name:"type",description:"{string}"}],visibility:"public",description:"A block of text that runs above the table.",name:"dek",kind:"let",static:!1,readonly:!1,type:{kind:"type",text:"string",type:"string"},defaultValue:null},{keywords:[{name:"type",description:"{string}"}],visibility:"public",description:"A footnote that runs below the table.",name:"notes",kind:"let",static:!1,readonly:!1,type:{kind:"type",text:"string",type:"string"},defaultValue:null},{keywords:[{name:"type",description:"{string}"}],visibility:"public",description:"A source line that runs below the table.",name:"source",kind:"let",static:!1,readonly:!1,type:{kind:"type",text:"string",type:"string"},defaultValue:null},{keywords:[{name:"type",description:"[]"}],visibility:"public",description:"list of the fields to include in the table. By default everything goes.",name:"includedFields",kind:"let",static:!1,readonly:!1,type:{kind:"type",text:"any",type:"any"}},{keywords:[{name:"type",description:"{boolean}"}],visibility:"public",description:"Whether or not the table is cutoff after a set number of rows.",name:"truncated",kind:"let",static:!1,readonly:!1,type:{kind:"type",text:"boolean",type:"boolean"},defaultValue:!1},{keywords:[{name:"type",description:"{number}"}],visibility:"public",description:"If the table is truncated, how many rows to allow before the cutoff.",name:"truncateLength",kind:"let",static:!1,readonly:!1,type:{kind:"type",text:"number",type:"number"},defaultValue:5},{keywords:[{name:"type",description:"{boolean}"}],visibility:"public",description:"Whether or not the table is paginated after a set number of rows.",name:"paginated",kind:"let",static:!1,readonly:!1,type:{kind:"type",text:"boolean",type:"boolean"},defaultValue:!1},{keywords:[{name:"type",description:"{number}"}],visibility:"public",description:"The default page size.",name:"pageSize",kind:"let",static:!1,readonly:!1,type:{kind:"type",text:"number",type:"number"},defaultValue:25},{keywords:[{name:"type",description:"{boolean}"}],visibility:"public",description:"Whether or not searches are allowed.",name:"searchable",kind:"let",static:!1,readonly:!1,type:{kind:"type",text:"boolean",type:"boolean"},defaultValue:!1},{keywords:[{name:"type",description:"{string}"}],visibility:"public",description:"The placeholder text that appears in the search box.",name:"searchPlaceholder",kind:"let",static:!1,readonly:!1,type:{kind:"type",text:"string",type:"string"},defaultValue:"Search in table"},{keywords:[{name:"type",description:"{string}"}],visibility:"public",description:"A field to offer uses as an interactive filter.",name:"filterField",kind:"let",static:!1,readonly:!1,type:{kind:"type",text:"string",type:"string"}},{keywords:[{name:"type",description:"{string}"}],visibility:"public",description:"The label to place above the filter box",name:"filterLabel",kind:"let",static:!1,readonly:!1,type:{kind:"type",text:"string",type:"string"}},{keywords:[{name:"type",description:"{boolean}"}],visibility:"public",description:"Whether or not sorts are allowed.",name:"sortable",kind:"let",static:!1,readonly:!1,type:{kind:"type",text:"boolean",type:"boolean"},defaultValue:!1},{keywords:[{name:"type",description:"{string}"}],visibility:"public",description:"The column to sort by. By default it's the first header.",name:"sortField",kind:"let",static:!1,readonly:!1,type:{kind:"type",text:"string",type:"string"}},{keywords:[{name:"type",description:"{string}"}],visibility:"public",description:"The columns that are allowed to sort. It's all of them by default.",name:"sortableFields",kind:"let",static:!1,readonly:!1,type:{kind:"type",text:"string",type:"string"}},{visibility:"public",description:null,keywords:[],name:"sortDirection",kind:"let",static:!1,readonly:!1,type:{kind:"type",text:"string",type:"string"},defaultValue:"ascending"},{keywords:[{name:"type",description:"{object}"}],visibility:"public",description:"Custom field formatting functions. Should be keyed to the name of the field.",name:"fieldFormatters",kind:"let",static:!1,readonly:!1,type:{kind:"type",text:"object",type:"object"}},{visibility:"public",description:null,keywords:[],name:"width",kind:"let",static:!1,readonly:!1,type:{kind:"type",text:"string",type:"string"},defaultValue:"normal"},{keywords:[],visibility:"public",description:"Add an ID to target with SCSS.",name:"id",kind:"let",static:!1,readonly:!1,type:{kind:"type",text:"string",type:"string"},defaultValue:""},{visibility:"public",description:"Add a class to target with SCSS.",keywords:[],name:"class",kind:"const",static:!1,readonly:!0,type:{kind:"type",text:"string",type:"string"},localName:"cls",defaultValue:""}],computed:[],methods:[],components:[],description:null,keywords:[],events:[],slots:[],refs:[]};const be=[{Country:"Afghanistan",Region:"Southern Asia",Score:40.19},{Country:"Albania",Region:"Southern Europe",Score:30.59},{Country:"Algeria",Region:"Northern Africa",Score:47.26},{Country:"Andorra",Region:"Southern Europe",Score:23.32},{Country:"Angola",Region:"Sub-Saharan Africa",Score:34.06},{Country:"Argentina",Region:"Latin America and the Caribbean",Score:28.99},{Country:"Armenia",Region:"Western Asia",Score:28.83},{Country:"Australia",Region:"Australia and New Zealand",Score:19.79},{Country:"Austria",Region:"Western Europe",Score:16.34},{Country:"Azerbaijan",Region:"Western Asia",Score:58.77},{Country:"Bahrain",Region:"Western Asia",Score:61.1},{Country:"Bangladesh",Region:"Southern Asia",Score:49.71},{Country:"Belarus",Region:"Eastern Europe",Score:50.82},{Country:"Belgium",Region:"Western Europe",Score:11.69},{Country:"Belize",Region:"Latin America and the Caribbean",Score:27.61},{Country:"Benin",Region:"Sub-Saharan Africa",Score:38.18},{Country:"Bhutan",Region:"Southern Asia",Score:28.86},{Country:"Bolivia",Region:"Latin America and the Caribbean",Score:35.47},{Country:"Bosnia and Herzegovina",Region:"Southern Europe",Score:28.34},{Country:"Botswana",Region:"Sub-Saharan Africa",Score:23.25},{Country:"Brazil",Region:"Latin America and the Caribbean",Score:36.25},{Country:"Brunei",Region:"South-eastern Asia",Score:49.91},{Country:"Bulgaria",Region:"Eastern Europe",Score:37.29},{Country:"Burkina Faso",Region:"Sub-Saharan Africa",Score:23.17},{Country:"Burundi",Region:"Sub-Saharan Africa",Score:47.57},{Country:"Cambodia",Region:"South-eastern Asia",Score:46.84},{Country:"Cameroon",Region:"Sub-Saharan Africa",Score:43.78},{Country:"Canada",Region:"Northern America",Score:15.25},{Country:"Cape Verde",Region:"Sub-Saharan Africa",Score:20.09},{Country:"Central African Republic",Region:"Sub-Saharan Africa",Score:41.92},{Country:"Chad",Region:"Sub-Saharan Africa",Score:40.2},{Country:"Chile",Region:"Latin America and the Caribbean",Score:27.89},{Country:"China",Region:"Eastern Asia",Score:78.72},{Country:"Colombia",Region:"Latin America and the Caribbean",Score:43.74},{Country:"Comoros",Region:"Sub-Saharan Africa",Score:30.65},{Country:"Congo",Region:"Sub-Saharan Africa",Score:38.83},{Country:"Costa Rica",Region:"Latin America and the Caribbean",Score:8.76},{Country:"Cote d'Ivoire",Region:"Sub-Saharan Africa",Score:28.87},{Country:"Croatia",Region:"Southern Europe",Score:27.95},{Country:"Cuba",Region:"Latin America and the Caribbean",Score:63.94},{Country:"Cyprus",Region:"Western Asia",Score:19.85},{Country:"Czechia",Region:"Eastern Europe",Score:23.38},{Country:"Democratic Republic of Congo",Region:"Sub-Saharan Africa",Score:48.59},{Country:"Denmark",Region:"Northern Europe",Score:8.57},{Country:"Djibouti",Region:"Sub-Saharan Africa",Score:78.62},{Country:"Dominican Republic",Region:"Latin America and the Caribbean",Score:25.6},{Country:"Ecuador",Region:"Latin America and the Caribbean",Score:32.83},{Country:"Egypt",Region:"Northern Africa",Score:56.17},{Country:"El Salvador",Region:"Latin America and the Caribbean",Score:30.49},{Country:"Equatorial Guinea",Region:"Sub-Saharan Africa",Score:55.67},{Country:"Eritrea",Region:"Sub-Saharan Africa",Score:81.45},{Country:"Estonia",Region:"Northern Europe",Score:15.25},{Country:"Eswatini",Region:"Sub-Saharan Africa",Score:46.34},{Country:"Ethiopia",Region:"Sub-Saharan Africa",Score:33.63},{Country:"Fiji",Region:"Melanesia",Score:27.92},{Country:"Finland",Region:"Northern Europe",Score:6.99},{Country:"France",Region:"Western Europe",Score:22.6},{Country:"Gabon",Region:"Sub-Saharan Africa",Score:38.6},{Country:"Gambia",Region:"Sub-Saharan Africa",Score:30.76},{Country:"Georgia",Region:"Western Asia",Score:28.64},{Country:"Germany",Region:"Western Europe",Score:15.24},{Country:"Ghana",Region:"Sub-Saharan Africa",Score:21.33},{Country:"Greece",Region:"Southern Europe",Score:29.01},{Country:"Guatemala",Region:"Latin America and the Caribbean",Score:38.45},{Country:"Guinea",Region:"Sub-Saharan Africa",Score:35.42},{Country:"Guinea-Bissau",Region:"Sub-Saharan Africa",Score:32.68},{Country:"Guyana",Region:"Latin America and the Caribbean",Score:25.61},{Country:"Haiti",Region:"Latin America and the Caribbean",Score:31.12},{Country:"Honduras",Region:"Latin America and the Caribbean",Score:49.35},{Country:"Hong Kong",Region:"Eastern Asia",Score:30.44},{Country:"Hungary",Region:"Eastern Europe",Score:31.76},{Country:"Iceland",Region:"Northern Europe",Score:15.37},{Country:"India",Region:"Southern Asia",Score:46.56},{Country:"Indonesia",Region:"South-eastern Asia",Score:37.4},{Country:"Iran",Region:"Southern Asia",Score:72.7},{Country:"Iraq",Region:"Western Asia",Score:55.57},{Country:"Ireland",Region:"Northern Europe",Score:11.91},{Country:"Israel",Region:"Western Asia",Score:30.9},{Country:"Italy",Region:"Southern Europe",Score:23.39},{Country:"Jamaica",Region:"Latin America and the Caribbean",Score:9.96},{Country:"Japan",Region:"Eastern Asia",Score:28.88},{Country:"Jordan",Region:"Western Asia",Score:42.89},{Country:"Kazakhstan",Region:"Central Asia",Score:50.28},{Country:"Kenya",Region:"Sub-Saharan Africa",Score:33.65},{Country:"Kuwait",Region:"Western Asia",Score:34.36},{Country:"Kyrgyzstan",Region:"Central Asia",Score:30.37},{Country:"Laos",Region:"South-eastern Asia",Score:70.56},{Country:"Latvia",Region:"Northern Europe",Score:19.26},{Country:"Lebanon",Region:"Western Asia",Score:34.93},{Country:"Lesotho",Region:"Sub-Saharan Africa",Score:31.61},{Country:"Liberia",Region:"Sub-Saharan Africa",Score:33.36},{Country:"Libya",Region:"Northern Africa",Score:55.73},{Country:"Liechtenstein",Region:"Western Europe",Score:19.49},{Country:"Lithuania",Region:"Northern Europe",Score:20.15},{Country:"Luxembourg",Region:"Western Europe",Score:17.56},{Country:"Madagascar",Region:"Sub-Saharan Africa",Score:28.24},{Country:"Malawi",Region:"Sub-Saharan Africa",Score:28.8},{Country:"Malaysia",Region:"South-eastern Asia",Score:39.47},{Country:"Maldives",Region:"Southern Asia",Score:29.13},{Country:"Mali",Region:"Sub-Saharan Africa",Score:33.5},{Country:"Malta",Region:"Southern Europe",Score:30.46},{Country:"Mauritania",Region:"Sub-Saharan Africa",Score:32.25},{Country:"Mauritius",Region:"Sub-Saharan Africa",Score:28.74},{Country:"Mexico",Region:"Latin America and the Caribbean",Score:46.71},{Country:"Moldova",Region:"Eastern Europe",Score:31.61},{Country:"Mongolia",Region:"Eastern Asia",Score:28.97},{Country:"Montenegro",Region:"Southern Europe",Score:34.33},{Country:"Morocco",Region:"Northern Africa",Score:43.94},{Country:"Mozambique",Region:"Sub-Saharan Africa",Score:35.39},{Country:"Myanmar",Region:"South-eastern Asia",Score:46.14},{Country:"Namibia",Region:"Sub-Saharan Africa",Score:19.72},{Country:"Nepal",Region:"Southern Asia",Score:34.62},{Country:"Netherlands",Region:"Western Europe",Score:9.67},{Country:"New Zealand",Region:"Australia and New Zealand",Score:10.04},{Country:"Nicaragua",Region:"Latin America and the Caribbean",Score:39.98},{Country:"Niger",Region:"Sub-Saharan Africa",Score:28.44},{Country:"Nigeria",Region:"Sub-Saharan Africa",Score:39.69},{Country:"North Korea",Region:"Eastern Asia",Score:81.28},{Country:"North Macedonia",Region:"Southern Europe",Score:31.67},{Country:"Norway",Region:"Northern Europe",Score:6.72},{Country:"Oman",Region:"Western Asia",Score:43.37},{Country:"Pakistan",Region:"Southern Asia",Score:46.86},{Country:"Palestine",Region:"Western Asia",Score:43.18},{Country:"Panama",Region:"Latin America and the Caribbean",Score:29.94},{Country:"Papua New Guinea",Region:"Melanesia",Score:24.88},{Country:"Paraguay",Region:"Latin America and the Caribbean",Score:33.52},{Country:"Peru",Region:"Latin America and the Caribbean",Score:31.71},{Country:"Philippines",Region:"South-eastern Asia",Score:45.64},{Country:"Poland",Region:"Eastern Europe",Score:28.84},{Country:"Portugal",Region:"Southern Europe",Score:10.11},{Country:"Qatar",Region:"Western Asia",Score:42.6},{Country:"Romania",Region:"Eastern Europe",Score:24.91},{Country:"Russia",Region:"Eastern Europe",Score:48.71},{Country:"Rwanda",Region:"Sub-Saharan Africa",Score:50.66},{Country:"Samoa",Region:"Polynesia",Score:19.24},{Country:"Saudi Arabia",Region:"Western Asia",Score:62.73},{Country:"Senegal",Region:"Sub-Saharan Africa",Score:25.22},{Country:"Serbia",Region:"Southern Europe",Score:32.03},{Country:"Seychelles",Region:"Sub-Saharan Africa",Score:25.66},{Country:"Sierra Leone",Region:"Sub-Saharan Africa",Score:29.61},{Country:"Singapore",Region:"South-eastern Asia",Score:55.2},{Country:"Slovakia",Region:"Eastern Europe",Score:23.02},{Country:"Slovenia",Region:"Southern Europe",Score:23.1},{Country:"Somalia",Region:"Sub-Saharan Africa",Score:55.47},{Country:"South Africa",Region:"Sub-Saharan Africa",Score:21.59},{Country:"South Korea",Region:"Eastern Asia",Score:23.43},{Country:"South Sudan",Region:"Sub-Saharan Africa",Score:45.78},{Country:"Spain",Region:"Southern Europe",Score:20.44},{Country:"Sri Lanka",Region:"Southern Asia",Score:42.2},{Country:"Sudan",Region:"Northern Africa",Score:52.93},{Country:"Suriname",Region:"Latin America and the Caribbean",Score:16.95},{Country:"Sweden",Region:"Northern Europe",Score:7.24},{Country:"Switzerland",Region:"Western Europe",Score:10.55},{Country:"Syria",Region:"Western Asia",Score:70.63},{Country:"Taiwan",Region:"Eastern Asia",Score:23.86},{Country:"Tajikistan",Region:"Central Asia",Score:55.52},{Country:"Tanzania",Region:"Sub-Saharan Africa",Score:40.69},{Country:"Thailand",Region:"South-eastern Asia",Score:45.22},{Country:"Timor",Region:"South-eastern Asia",Score:29.11},{Country:"Togo",Region:"Sub-Saharan Africa",Score:29.59},{Country:"Tonga",Region:"Polynesia",Score:24.59},{Country:"Trinidad and Tobago",Region:"Latin America and the Caribbean",Score:21.55},{Country:"Tunisia",Region:"Northern Africa",Score:29.53},{Country:"Turkey",Region:"Western Asia",Score:49.79},{Country:"Turkmenistan",Region:"Central Asia",Score:80.03},{Country:"Uganda",Region:"Sub-Saharan Africa",Score:41.19},{Country:"Ukraine",Region:"Eastern Europe",Score:32.96},{Country:"United Arab Emirates",Region:"Western Asia",Score:43.13},{Country:"United Kingdom",Region:"Northern Europe",Score:21.59},{Country:"United States",Region:"Northern America",Score:23.93},{Country:"Uruguay",Region:"Latin America and the Caribbean",Score:16.38},{Country:"Uzbekistan",Region:"Central Asia",Score:50.74},{Country:"Venezuela",Region:"Latin America and the Caribbean",Score:47.6},{Country:"Vietnam",Region:"South-eastern Asia",Score:78.46},{Country:"Yemen",Region:"Western Asia",Score:62.35},{Country:"Zambia",Region:"Sub-Saharan Africa",Score:38.21},{Country:"Zimbabwe",Region:"Sub-Saharan Africa",Score:43.12}],Fe=[{Name:"Barry Bonds","Home runs":762},{Name:"Hank Aaron","Home runs":755},{Name:"Babe Ruth","Home runs":714},{Name:"Albert Pujols","Home runs":703},{Name:"Alex Rodriguez","Home runs":696},{Name:"Willie Mays","Home runs":660},{Name:"Ken Griffey Jr.","Home runs":630},{Name:"Jim Thome","Home runs":612},{Name:"Sammy Sosa","Home runs":609},{Name:"Frank Robinson","Home runs":586}],$e=[{Name:"Francoise Bettencourt Meyers","Net worth (in billions)":74.8},{Name:"Alice Walton","Net worth (in billions)":65.3},{Name:"Julia Koch","Net worth (in billions)":60},{Name:"MacKenzie Scott","Net worth (in billions)":43.6},{Name:"Jacqueline Mars","Net worth (in billions)":31.7},{Name:"Gina Rinehart","Net worth (in billions)":30.2},{Name:"Miriam Adelson","Net worth (in billions)":27.5},{Name:"Susanne Klatten","Net worth (in billions)":24.3},{Name:"Iris Fontbona","Net worth (in billions)":22.8},{Name:"Abigail Johnson","Net worth (in billions)":21.2}];function $t(n){let e,t;const r=[n[1]];let a={};for(let i=0;i<r.length;i+=1)a=O(a,r[i]);return e=new Ne({props:a}),{c(){I(e.$$.fragment)},m(i,s){z(e,i,s),t=!0},p(i,s){const l=s&2?et(r,[tt(i[1])]):{};e.$set(l)},i(i){t||(R(e.$$.fragment,i),t=!0)},o(i){N(e.$$.fragment,i),t=!1},d(i){q(e,i)}}}function en(n){let e,t,r,a,i,s,l,u,g,D,h,d,y,k,P,F,H,B,L,E,v,M,S,f;const b=[{title:"Components/Table"},{component:Ne},n[0]];let m={};for(let o=0;o<b.length;o+=1)m=O(m,b[o]);e=new St({props:m}),r=new _t({props:{$$slots:{default:[$t,({args:o})=>({1:o}),({args:o})=>o?2:0]},$$scope:{ctx:n}}}),i=new U({props:{name:"Default",args:{width:"normal",data:Fe}}});const G=[{name:"Metadata"},X(kt),{args:{width:"normal",data:Fe,title:"Career home run leaders",dek:'In baseball, a home run (also known as a "dinger" or "tater") occurs when a batter hits the ball over the outfield fence. When a home run is hit, the batter and any runners on base are able to score.',notes:"Note: As of Opening Day 2023",source:"Source: Baseball Reference"}}];let T={};for(let o=0;o<G.length;o+=1)T=O(T,G[o]);l=new U({props:T});const V=[{name:"Truncate"},X(vt),{args:{data:Fe,truncated:!0,source:"Source: Baseball Reference"}}];let Y={};for(let o=0;o<V.length;o+=1)Y=O(Y,V[o]);g=new U({props:Y});const Se=[{name:"Paginate"},X(Lt),{args:{data:be,title:"Press Freedom Index",paginated:!0,source:"Source: Reporters Without Borders"}}];let Q={};for(let o=0;o<Se.length;o+=1)Q=O(Q,Se[o]);h=new U({props:Q});const _e=[{name:"Search"},X(Ft),{args:{data:be,searchable:!0,paginated:!0,title:"Press Freedom Index",source:"Source: Reporters Without Borders"}}];let fe={};for(let o=0;o<_e.length;o+=1)fe=O(fe,_e[o]);y=new U({props:fe});const Ce=[{name:"Filter"},X(Nt),{args:{data:be,paginated:!0,filterField:"Region",title:"Press Freedom Index",notes:"Source: Reporters Without Borders"}}];let de={};for(let o=0;o<Ce.length;o+=1)de=O(de,Ce[o]);P=new U({props:de});const Re=[{name:"Search and filter"},X(Dt),{args:{data:be,searchable:!0,filterField:"Region",paginated:!0,title:"Press Freedom Index",dek:"Reporters Without Borders ranks countries based on their level of press freedom using criteria such as the degree of media pluralism and violence against journalists.",source:"Source: Reporters Without Borders"}}];let ge={};for(let o=0;o<Re.length;o+=1)ge=O(ge,Re[o]);H=new U({props:ge});const we=[{name:"Sort"},X(Et),{args:{data:be,sortable:!0,sortField:"Score",sortDirection:"descending",paginated:!0,title:"Press Freedom Index",notes:"Note: data as of 2018",source:"Source: Reporters Without Borders"}}];let he={};for(let o=0;o<we.length;o+=1)he=O(he,we[o]);L=new U({props:he});const Ae=[{name:"Format"},X(Tt),{args:{data:$e,title:"The Richest Women in the World",source:"Source: Forbes",sortable:!0,sortField:"Net worth (in billions)",sortDirection:"descending",fieldFormatters:{"Net worth (in billions)":tn}}}];let pe={};for(let o=0;o<Ae.length;o+=1)pe=O(pe,Ae[o]);v=new U({props:pe});const ke=[{name:"Style"},X(Wt),{args:{id:"custom-table",data:$e,title:"The Richest Women in the World",source:"Source: Forbes"}},{",":!0}];let me={};for(let o=0;o<ke.length;o+=1)me=O(me,ke[o]);return S=new U({props:me}),{c(){I(e.$$.fragment),t=W(),I(r.$$.fragment),a=W(),I(i.$$.fragment),s=W(),I(l.$$.fragment),u=W(),I(g.$$.fragment),D=W(),I(h.$$.fragment),d=W(),I(y.$$.fragment),k=W(),I(P.$$.fragment),F=W(),I(H.$$.fragment),B=W(),I(L.$$.fragment),E=W(),I(v.$$.fragment),M=W(),I(S.$$.fragment)},m(o,_){z(e,o,_),w(o,t,_),z(r,o,_),w(o,a,_),z(i,o,_),w(o,s,_),z(l,o,_),w(o,u,_),z(g,o,_),w(o,D,_),z(h,o,_),w(o,d,_),z(y,o,_),w(o,k,_),z(P,o,_),w(o,F,_),z(H,o,_),w(o,B,_),z(L,o,_),w(o,E,_),z(v,o,_),w(o,M,_),z(S,o,_),f=!0},p(o,[_]){const ee=_&1?et(b,[b[0],b[1],tt(o[0])]):{};e.$set(ee);const te={};_&6&&(te.$$scope={dirty:_,ctx:o}),r.$set(te);const ve={};l.$set(ve);const st={};g.$set(st);const lt={};h.$set(lt);const ut={};y.$set(ut);const ct={};P.$set(ct);const ft={};H.$set(ft);const dt={};L.$set(dt);const gt={};v.$set(gt);const ht={};S.$set(ht)},i(o){f||(R(e.$$.fragment,o),R(r.$$.fragment,o),R(i.$$.fragment,o),R(l.$$.fragment,o),R(g.$$.fragment,o),R(h.$$.fragment,o),R(y.$$.fragment,o),R(P.$$.fragment,o),R(H.$$.fragment,o),R(L.$$.fragment,o),R(v.$$.fragment,o),R(S.$$.fragment,o),f=!0)},o(o){N(e.$$.fragment,o),N(r.$$.fragment,o),N(i.$$.fragment,o),N(l.$$.fragment,o),N(g.$$.fragment,o),N(h.$$.fragment,o),N(y.$$.fragment,o),N(P.$$.fragment,o),N(H.$$.fragment,o),N(L.$$.fragment,o),N(v.$$.fragment,o),N(S.$$.fragment,o),f=!1},d(o){o&&(A(t),A(a),A(s),A(u),A(D),A(d),A(k),A(F),A(B),A(E),A(M)),q(e,o),q(r,o),q(i,o),q(l,o),q(g,o),q(h,o),q(y,o),q(P,o),q(H,o),q(L,o),q(v,o),q(S,o)}}}const tn=n=>"$"+n.toFixed(1);function nn(n){return[{...wt(At),argTypes:{width:{control:"select",options:["normal","wide","wider","widest","fluid"]}}}]}class rn extends re{constructor(e){super(),ae(this,e,nn,en,oe,{})}}const Z=yt(rn,{meta:{title:"Components/Table"},stories:{"tpl:default":{name:"default",template:!0,source:"<Table {...args} />",hasArgs:!0},Default:{name:"Default",template:!1,source:"",hasArgs:!1},Metadata:{name:"Metadata",template:!1,source:"",hasArgs:!1},Truncate:{name:"Truncate",template:!1,source:"",hasArgs:!1},Paginate:{name:"Paginate",template:!1,source:"",hasArgs:!1},Search:{name:"Search",template:!1,source:"",hasArgs:!1},Filter:{name:"Filter",template:!1,source:"",hasArgs:!1},SearchAndFilter:{name:"Search and filter",template:!1,source:"",hasArgs:!1},Sort:{name:"Sort",template:!1,source:"",hasArgs:!1},Format:{name:"Format",template:!1,source:"",hasArgs:!1},Style:{name:"Style",template:!1,source:"",hasArgs:!1}},allocatedIds:["default","Meta","Template","Story","componentDocs","metadataDocs","truncateDocs","paginateDocs","searchDocs","filterDocs","bothDocs","sortDocs","formatDocs","styleDocs","Table","withComponentDocs","withStoryDocs","pressFreedom","homeRuns","richestWomen"]}),gn=Z.meta,hn=["Default","Metadata","Truncate","Paginate","Search","Filter","SearchAndFilter","Sort","Format","Style"],pn=Z.stories.Default,mn=Z.stories.Metadata,bn=Z.stories.Truncate,yn=Z.stories.Paginate,Sn=Z.stories.Search,_n=Z.stories.Filter,Cn=Z.stories.SearchAndFilter,Rn=Z.stories.Sort,wn=Z.stories.Format,An=Z.stories.Style;export{pn as Default,_n as Filter,wn as Format,mn as Metadata,yn as Paginate,Sn as Search,Cn as SearchAndFilter,Rn as Sort,An as Style,bn as Truncate,hn as __namedExportsOrder,gn as default};
|
||
//# sourceMappingURL=Table.stories-40ab3ea5.js.map
|