hypnagaga/docs/assets/Table.stories-a137e5a5.js
2023-06-10 20:17:38 +01:00

143 lines
52 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import{S as ie,i as se,s as le,Z as oe,x as c,a as R,z as m,E as Y,d as k,w,j as z,D as T,M as q,m as H,N as Fe,Y as te,b as C,t as N,n as V,O as kt,a5 as De,a1 as wt,y as K,o as At,g as ye,c as Se,f as pe,a3 as me,a4 as be,p as Z,k as J,l as U}from"./index-25af778d.js";import{p as vt,M as Ft,T as Lt,S as X}from"./collect-stories-cce06d4a.js";import{B as Nt}from"./Block-9c89ee1a.js";import{g as We}from"./journalize-07958dc6.js";import{S as Dt}from"./SearchInput-197a58d9.js";import{a as G,w as Et}from"./withParams-90715500.js";const Wt=`Present structured data in a table. Consider making it interactive.
---
\`\`\`html
<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}" />
\`\`\`
`,Te=`Set the \`title\`, \`dek\`, \`notes\` and \`source\` options to add supporting metadata above and below the table.
\`\`\`html
<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'}" />
\`\`\`
`,Pe=`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.
\`\`\`html
<table
data="{yourData}"
truncated="{true}"
source="{'Source: Baseball Reference'}"
/>
\`\`\`
`,Be=`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.
\`\`\`html
<table
data="{yourData}"
paginated="{true}"
title="{'Press Freedom Index'}"
source="{'Reporters Without Borders'}"
/>
\`\`\`
`,Ie=`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.
\`\`\`html
<table
data="{yourData}"
searchable="{true}"
paginated="{true}"
title="{'Press Freedom Index'}"
notes="{'Source: Reporters Without Borders'}"
/>
\`\`\`
`,Me=`Allow users to filter the table by providing one of the attributes as the \`filterField\`. This works best with categorical columns.
\`\`\`html
<table
data="{yourData}"
filterField="{'Region'}"
paginated="{true}"
title="{'Press Freedom Index'}"
notes="{'Source: Reporters Without Borders'}"
/>
\`\`\`
`,ze=`Feel free to both search and filter.
\`\`\`html
<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'}"
/>
\`\`\`
`,He=`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.
\`\`\`html
<table
data="{yourData}"
sortable="{true}"
sortField="{'Score'}"
sortDirection="{'descending'}"
title="{'Press Freedom Index'}"
source="{'Source: Reporters Without Borders'}"
/>
\`\`\`
`,Ve=`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.
\`\`\`html
<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'}"
/>
\`\`\`
`,je=`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.
\`\`\`html
<table
id="{'custom-table'}"
data="{yourData}"
title="{'The Richest Women in the World'}"
source="{'Source: Forbes'}"
/>
<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 Tt(n){let e,t;return{c(){e=oe("svg"),t=oe("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,o){R(r,e,o),m(e,t)},p:Y,i:Y,o:Y,d(r){r&&k(e)}}}class ct extends ie{constructor(e){super(),se(this,e,null,Tt,le,{})}}ct.__docgen={version:3,name:"LeftArrow.svelte",data:[],computed:[],methods:[],components:[],description:null,keywords:[],events:[],slots:[],refs:[]};function Pt(n){let e,t;return{c(){e=oe("svg"),t=oe("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,o){R(r,e,o),m(e,t)},p:Y,i:Y,o:Y,d(r){r&&k(e)}}}class ft extends ie{constructor(e){super(),se(this,e,null,Pt,le,{})}}ft.__docgen={version:3,name:"RightArrow.svelte",data:[],computed:[],methods:[],components:[],description:null,keywords:[],events:[],slots:[],refs:[]};function Bt(n){let e,t,r,o,i,s,l,u,g,D,p,d,S,A,P=We(n[2])+"",L,j,I,F,E,v,B,_,f,y,b,O;return o=new ct({}),v=new ft({}),{c(){e=w("nav"),t=w("button"),r=w("div"),z(o.$$.fragment),i=T(),s=w("span"),s.textContent="Previous page",u=T(),g=w("div"),D=w("div"),p=q(n[4]),d=q("-"),S=q(n[3]),A=q(" of "),L=q(P),I=T(),F=w("button"),E=w("div"),z(v.$$.fragment),B=T(),_=w("span"),_.textContent="Next page",c(s,"class","visually-hidden svelte-g3i02z"),c(r,"class","icon-wrapper svelte-g3i02z"),t.disabled=l=n[0]===1,c(t,"class","svelte-g3i02z"),c(D,"class","records svelte-g3i02z"),c(g,"class","label svelte-g3i02z"),c(g,"aria-label",j="page "+n[0]),c(g,"aria-current","page"),c(_,"class","visually-hidden svelte-g3i02z"),c(E,"class","icon-wrapper svelte-g3i02z"),F.disabled=f=n[0]===Math.ceil(n[2]/n[1]),c(F,"class","svelte-g3i02z"),c(e,"aria-label","pagination"),c(e,"class","pagination svelte-g3i02z")},m(W,M){R(W,e,M),m(e,t),m(t,r),H(o,r,null),m(r,i),m(r,s),m(e,u),m(e,g),m(g,D),m(D,p),m(D,d),m(D,S),m(D,A),m(D,L),m(e,I),m(e,F),m(F,E),H(v,E,null),m(E,B),m(E,_),y=!0,b||(O=[Fe(t,"click",n[5]),Fe(F,"click",n[6])],b=!0)},p(W,[M]){(!y||M&1&&l!==(l=W[0]===1))&&(t.disabled=l),(!y||M&16)&&te(p,W[4]),(!y||M&8)&&te(S,W[3]),(!y||M&4)&&P!==(P=We(W[2])+"")&&te(L,P),(!y||M&1&&j!==(j="page "+W[0]))&&c(g,"aria-label",j),(!y||M&7&&f!==(f=W[0]===Math.ceil(W[2]/W[1])))&&(F.disabled=f)},i(W){y||(C(o.$$.fragment,W),C(v.$$.fragment,W),y=!0)},o(W){N(o.$$.fragment,W),N(v.$$.fragment,W),y=!1},d(W){W&&k(e),V(o),V(v),b=!1,kt(O)}}}function It(n,e,t){let r,o,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 p(){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,o=s*l-l+u),n.$$.dirty&6&&(i=Math.ceil(g/l))},[s,l,g,o,r,D,p,u]}class dt extends ie{constructor(e){super(),se(this,e,It,Bt,le,{pageNumber:0,pageSize:1,pageLength:7,n:2})}}dt.__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 Ge(n,e,t){const r=n.slice();return r[4]=e[t],r}function Oe(n){let e,t;return{c(){e=w("label"),t=q(n[0]),c(e,"for","select--input"),c(e,"class","svelte-v9pn13")},m(r,o){R(r,e,o),m(e,t)},p(r,o){o&1&&te(t,r[0])},d(r){r&&k(e)}}}function qe(n){let e,t=n[4].text+"",r,o;return{c(){e=w("option"),r=q(t),e.__value=o=n[4].value,e.value=e.__value},m(i,s){R(i,e,s),m(e,r)},p(i,s){s&2&&t!==(t=i[4].text+"")&&te(r,t),s&2&&o!==(o=i[4].value)&&(e.__value=o,e.value=e.__value)},d(i){i&&k(e)}}}function Mt(n){let e,t,r,o,i,s=n[0]&&Oe(n),l=n[1],u=[];for(let g=0;g<l.length;g+=1)u[g]=qe(Ge(n,l,g));return{c(){e=w("div"),s&&s.c(),t=T(),r=w("select");for(let g=0;g<u.length;g+=1)u[g].c();c(r,"class","select--input svelte-v9pn13"),c(r,"name","select--input"),c(r,"id","select--input"),c(e,"class","select svelte-v9pn13")},m(g,D){R(g,e,D),s&&s.m(e,null),m(e,t),m(e,r);for(let p=0;p<u.length;p+=1)u[p]&&u[p].m(r,null);o||(i=Fe(r,"input",n[2]),o=!0)},p(g,[D]){if(g[0]?s?s.p(g,D):(s=Oe(g),s.c(),s.m(e,t)):s&&(s.d(1),s=null),D&2){l=g[1];let p;for(p=0;p<l.length;p+=1){const d=Ge(g,l,p);u[p]?u[p].p(d,D):(u[p]=qe(d),u[p].c(),u[p].m(r,null))}for(;p<u.length;p+=1)u[p].d(1);u.length=l.length}},i:Y,o:Y,d(g){g&&k(e),s&&s.d(),De(u,g),o=!1,i()}}}function zt(n,e,t){let{label:r=""}=e,{options:o=[]}=e;const i=wt();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,o=l.options)},[r,o,s]}class gt extends ie{constructor(e){super(),se(this,e,zt,Mt,le,{label:0,options:1})}}gt.__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=oe("svg"),t=oe("path"),r=oe("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-1nzi017"),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-1nzi017"),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-1nzi017")},m(o,i){R(o,e,i),m(e,t),m(e,r)},p(o,[i]){i&3&&K(t,"active",o[0]==="descending"&&o[1]),i&3&&K(r,"active",o[0]==="ascending"&&o[1])},i:Y,o:Y,d(o){o&&k(e)}}}function Vt(n,e,t){let{sortDirection:r="ascending"}=e,{active:o=!1}=e;return n.$$set=i=>{"sortDirection"in i&&t(0,r=i.sortDirection),"active"in i&&t(1,o=i.active)},[r,o]}class ht extends ie{constructor(e){super(),se(this,e,Vt,Ht,le,{sortDirection:0,active:1})}}ht.__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(o=>o.searchStr.includes(e.toLowerCase()))),r&&r&&(n=n.filter(o=>o[t]===r)),n}function Gt(n,e,t){return n.slice((t-1)*e,t*e)}function Ot(n,e){return n.map(t=>t[e]).filter(qt)}function qt(n,e,t){return t.indexOf(n)===e}function Kt(n,e){const t=Ot(n,e).sort((r,o)=>r.localeCompare(o));return t.unshift("All"),t.map(r=>({text:r,value:r}))}function Ke(n,e,t){const r=n.slice();return r[42]=e[t],r[44]=t,r}function Ze(n,e,t){const r=n.slice();return r[45]=e[t],r}function Je(n,e,t){const r=n.slice();return r[45]=e[t],r}function Ue(n){let e,t,r,o,i=n[5]&&Ye(n),s=n[6]&&Qe(n),l=(n[13]||n[26])&&Xe(n);return{c(){e=w("header"),i&&i.c(),t=T(),s&&s.c(),r=T(),l&&l.c(),c(e,"class","table--header svelte-nka8pe")},m(u,g){R(u,e,g),i&&i.m(e,null),m(e,t),s&&s.m(e,null),m(e,r),l&&l.m(e,null),o=!0},p(u,g){u[5]?i?i.p(u,g):(i=Ye(u),i.c(),i.m(e,t)):i&&(i.d(1),i=null),u[6]?s?s.p(u,g):(s=Qe(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&&C(l,1)):(l=Xe(u),l.c(),C(l,1),l.m(e,null)):l&&(ye(),N(l,1,1,()=>{l=null}),Se())},i(u){o||(C(l),o=!0)},o(u){N(l),o=!1},d(u){u&&k(e),i&&i.d(),s&&s.d(),l&&l.d()}}}function Ye(n){let e;return{c(){e=w("h2"),c(e,"class","table--header--title svelte-nka8pe")},m(t,r){R(t,e,r),e.innerHTML=n[5]},p(t,r){r[0]&32&&(e.innerHTML=t[5])},d(t){t&&k(e)}}}function Qe(n){let e;return{c(){e=w("p"),c(e,"class","table--header--dek svelte-nka8pe")},m(t,r){R(t,e,r),e.innerHTML=n[6]},p(t,r){r[0]&64&&(e.innerHTML=t[6])},d(t){t&&k(e)}}}function Xe(n){let e,t,r,o=n[26]&&Zt(n),i=n[13]&&xe(n);return{c(){e=w("nav"),o&&o.c(),t=T(),i&&i.c(),c(e,"class","input svelte-nka8pe")},m(s,l){R(s,e,l),o&&o.m(e,null),m(e,t),i&&i.m(e,null),r=!0},p(s,l){s[26]&&o.p(s,l),s[13]?i?(i.p(s,l),l[0]&8192&&C(i,1)):(i=xe(s),i.c(),C(i,1),i.m(e,null)):i&&(ye(),N(i,1,1,()=>{i=null}),Se())},i(s){r||(C(o),C(i),r=!0)},o(s){N(o),N(i),r=!1},d(s){s&&k(e),o&&o.d(),i&&i.d()}}}function Zt(n){let e,t,r;return t=new gt({props:{label:n[15]||n[14],options:n[26]}}),t.$on("select",n[29]),{c(){e=w("div"),z(t.$$.fragment),c(e,"class","table--header--filter")},m(o,i){R(o,e,i),H(t,e,null),r=!0},p(o,i){const s={};i[0]&49152&&(s.label=o[15]||o[14]),t.$set(s)},i(o){r||(C(t.$$.fragment,o),r=!0)},o(o){N(t.$$.fragment,o),r=!1},d(o){o&&k(e),V(t)}}}function xe(n){let e,t,r,o;function i(l){n[35](l)}let s={};return n[3]!==void 0&&(s.searchPlaceholder=n[3]),t=new Dt({props:s}),pe.push(()=>me(t,"searchPlaceholder",i)),t.$on("search",n[28]),{c(){e=w("div"),z(t.$$.fragment),c(e,"class","table--header--search")},m(l,u){R(l,e,u),H(t,e,null),o=!0},p(l,u){const g={};!r&&u[0]&8&&(r=!0,g.searchPlaceholder=l[3],be(()=>r=!1)),t.$set(g)},i(l){o||(C(t.$$.fragment,l),o=!0)},o(l){N(t.$$.fragment,l),o=!1},d(l){l&&k(e),V(t)}}}function $e(n){let e,t,r,o;function i(l){n[36](l)}let s={active:n[1]===n[45]};return n[2]!==void 0&&(s.sortDirection=n[2]),t=new ht({props:s}),pe.push(()=>me(t,"sortDirection",i)),{c(){e=w("div"),z(t.$$.fragment),c(e,"class","table--thead--sortarrow avoid-clicks svelte-nka8pe")},m(l,u){R(l,e,u),H(t,e,null),o=!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],be(()=>r=!1)),t.$set(g)},i(l){o||(C(t.$$.fragment,l),o=!0)},o(l){N(t.$$.fragment,l),o=!1},d(l){l&&k(e),V(t)}}}function et(n){let e,t=n[45]+"",r,o,i=n[16]&&n[17].includes(n[45]),s,l,u,g,D,p=i&&$e(n);return{c(){e=w("th"),r=q(t),o=T(),p&&p.c(),s=T(),c(e,"scope","col"),c(e,"class","table--thead--th svelte-nka8pe"),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,S){R(d,e,S),m(e,r),m(e,o),p&&p.m(e,null),m(e,s),u=!0,g||(D=Fe(e,"click",n[30]),g=!0)},p(d,S){(!u||S[0]&512)&&t!==(t=d[45]+"")&&te(r,t),S[0]&197120&&(i=d[16]&&d[17].includes(d[45])),i?p?(p.p(d,S),S[0]&197120&&C(p,1)):(p=$e(d),p.c(),C(p,1),p.m(e,s)):p&&(ye(),N(p,1,1,()=>{p=null}),Se()),(!u||S[0]&512&&l!==(l=d[45]))&&c(e,"data-field",l),(!u||S[0]&197120)&&K(e,"sortable",d[16]&&d[17].includes(d[45])),(!u||S[0]&66054)&&K(e,"sort-ascending",d[16]&&d[1]===d[45]&&d[2]==="ascending"),(!u||S[0]&66054)&&K(e,"sort-descending",d[16]&&d[1]===d[45]&&d[2]==="descending")},i(d){u||(C(p),u=!0)},o(d){N(p),u=!1},d(d){d&&k(e),p&&p.d(),g=!1,D()}}}function tt(n){let e,t=n[31](n[42],n[45])+"",r,o;return{c(){e=w("td"),c(e,"data-row-index",n[44]),c(e,"data-field",r=n[45]),c(e,"data-value",o=n[42][n[45]]),c(e,"class","svelte-nka8pe")},m(i,s){R(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&&o!==(o=i[42][i[45]])&&c(e,"data-value",o)},d(i){i&&k(e)}}}function nt(n){let e,t=n[9],r=[];for(let o=0;o<t.length;o+=1)r[o]=tt(Ze(n,t,o));return{c(){e=w("tr");for(let o=0;o<r.length;o+=1)r[o].c();c(e,"data-row-index",n[44]),c(e,"class","svelte-nka8pe")},m(o,i){R(o,e,i);for(let s=0;s<r.length;s+=1)r[s]&&r[s].m(e,null)},p(o,i){if(i[0]&33554944|i[1]&1){t=o[9];let s;for(s=0;s<t.length;s+=1){const l=Ze(o,t,s);r[s]?r[s].p(l,i):(r[s]=tt(l),r[s].c(),r[s].m(e,null))}for(;s<r.length;s+=1)r[s].d(1);r.length=t.length}},d(o){o&&k(e),De(r,o)}}}function rt(n){let e,t,r,o,i,s;return{c(){e=w("tr"),t=w("td"),r=q('No results found for "'),o=q(n[23]),i=q('"'),c(t,"class","no-results svelte-nka8pe"),c(t,"colspan",s=n[9].length),c(e,"class","svelte-nka8pe")},m(l,u){R(l,e,u),m(e,t),m(t,r),m(t,o),m(t,i)},p(l,u){u[0]&8388608&&te(o,l[23]),u[0]&512&&s!==(s=l[9].length)&&c(t,"colspan",s)},d(l){l&&k(e)}}}function at(n){let e,t,r=n[7]&&ot(n),o=n[8]&&it(n);return{c(){e=w("tfoot"),r&&r.c(),t=T(),o&&o.c(),c(e,"class","table--tfoot svelte-nka8pe")},m(i,s){R(i,e,s),r&&r.m(e,null),m(e,t),o&&o.m(e,null)},p(i,s){i[7]?r?r.p(i,s):(r=ot(i),r.c(),r.m(e,t)):r&&(r.d(1),r=null),i[8]?o?o.p(i,s):(o=it(i),o.c(),o.m(e,null)):o&&(o.d(1),o=null)},d(i){i&&k(e),r&&r.d(),o&&o.d()}}}function ot(n){let e,t,r;return{c(){e=w("tr"),t=w("td"),c(t,"colspan",r=n[9].length),c(t,"class","svelte-nka8pe"),c(e,"class","svelte-nka8pe")},m(o,i){R(o,e,i),m(e,t),t.innerHTML=n[7]},p(o,i){i[0]&128&&(t.innerHTML=o[7]),i[0]&512&&r!==(r=o[9].length)&&c(t,"colspan",r)},d(o){o&&k(e)}}}function it(n){let e,t,r;return{c(){e=w("tr"),t=w("td"),c(t,"colspan",r=n[9].length),c(t,"class","svelte-nka8pe"),c(e,"class","svelte-nka8pe")},m(o,i){R(o,e,i),m(e,t),t.innerHTML=n[8]},p(o,i){i[0]&256&&(t.innerHTML=o[8]),i[0]&512&&r!==(r=o[9].length)&&c(t,"colspan",r)},d(o){o&&k(e)}}}function st(n){let e,t,r,o;function i(u,g){return u[21]?Ut:Jt}let s=i(n),l=s(n);return{c(){e=w("nav"),t=w("button"),l.c(),c(t,"class","svelte-nka8pe"),c(e,"aria-label","Show all button"),c(e,"class","show-all svelte-nka8pe")},m(u,g){R(u,e,g),m(e,t),l.m(t,null),r||(o=Fe(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&&k(e),l.d(),r=!1,o()}}}function Jt(n){let e,t=n[4].length-n[11]+"",r,o;return{c(){e=q("Show "),r=q(t),o=q(" more rows")},m(i,s){R(i,e,s),R(i,r,s),R(i,o,s)},p(i,s){s[0]&2064&&t!==(t=i[4].length-i[11]+"")&&te(r,t)},d(i){i&&k(e),i&&k(r),i&&k(o)}}}function Ut(n){let e;return{c(){e=q("Show fewer rows")},m(t,r){R(t,e,r)},p:Y,d(t){t&&k(e)}}}function lt(n){let e,t,r,o,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 p={};return n[22]!==void 0&&(p.pageNumber=n[22]),n[0]!==void 0&&(p.pageSize=n[0]),n[25].length!==void 0&&(p.pageLength=n[25].length),n[24].length!==void 0&&(p.n=n[24].length),e=new dt({props:p}),pe.push(()=>me(e,"pageNumber",l)),pe.push(()=>me(e,"pageSize",u)),pe.push(()=>me(e,"pageLength",g)),pe.push(()=>me(e,"n",D)),{c(){z(e.$$.fragment)},m(d,S){H(e,d,S),s=!0},p(d,S){const A={};!t&&S[0]&4194304&&(t=!0,A.pageNumber=d[22],be(()=>t=!1)),!r&&S[0]&1&&(r=!0,A.pageSize=d[0],be(()=>r=!1)),!o&&S[0]&33554432&&(o=!0,A.pageLength=d[25].length,be(()=>o=!1)),!i&&S[0]&16777216&&(i=!0,A.n=d[24].length,be(()=>i=!1)),e.$set(A)},i(d){s||(C(e.$$.fragment,d),s=!0)},o(d){N(e.$$.fragment,d),s=!1},d(d){V(e,d)}}}function Yt(n){let e,t,r,o,i,s,l,u,g,D,p,d,S,A=(n[5]||n[6]||n[13]||n[26])&&Ue(n),P=n[9],L=[];for(let f=0;f<P.length;f+=1)L[f]=et(Je(n,P,f));const j=f=>N(L[f],1,1,()=>{L[f]=null});let I=n[25],F=[];for(let f=0;f<I.length;f+=1)F[f]=nt(Ke(n,I,f));let E=n[13]&&n[23]&&n[25].length===0&&rt(n),v=(n[7]||n[8])&&at(n),B=n[10]&&n[4].length>n[11]&&st(n),_=n[12]&&lt(n);return{c(){e=w("article"),A&&A.c(),t=T(),r=w("section"),o=w("table"),i=w("thead"),s=w("tr");for(let f=0;f<L.length;f+=1)L[f].c();l=T(),u=w("tbody");for(let f=0;f<F.length;f+=1)F[f].c();g=T(),E&&E.c(),D=T(),v&&v.c(),p=T(),B&&B.c(),d=T(),_&&_.c(),c(s,"class","svelte-nka8pe"),c(i,"class","table--thead"),c(u,"class","table--tbody"),c(o,"class","svelte-nka8pe"),K(o,"paginated",n[12]),K(o,"truncated",n[10]&&!n[21]&&n[4].length>n[11]),c(r,"class","table svelte-nka8pe"),c(e,"class","table-wrapper svelte-nka8pe")},m(f,y){R(f,e,y),A&&A.m(e,null),m(e,t),m(e,r),m(r,o),m(o,i),m(i,s);for(let b=0;b<L.length;b+=1)L[b]&&L[b].m(s,null);m(o,l),m(o,u);for(let b=0;b<F.length;b+=1)F[b]&&F[b].m(u,null);m(u,g),E&&E.m(u,null),m(o,D),v&&v.m(o,null),m(e,p),B&&B.m(e,null),m(e,d),_&&_.m(e,null),S=!0},p(f,y){if(f[5]||f[6]||f[13]||f[26]?A?(A.p(f,y),y[0]&8288&&C(A,1)):(A=Ue(f),A.c(),C(A,1),A.m(e,t)):A&&(ye(),N(A,1,1,()=>{A=null}),Se()),y[0]&1073938950){P=f[9];let b;for(b=0;b<P.length;b+=1){const O=Je(f,P,b);L[b]?(L[b].p(O,y),C(L[b],1)):(L[b]=et(O),L[b].c(),C(L[b],1),L[b].m(s,null))}for(ye(),b=P.length;b<L.length;b+=1)j(b);Se()}if(y[0]&33554944|y[1]&1){I=f[25];let b;for(b=0;b<I.length;b+=1){const O=Ke(f,I,b);F[b]?F[b].p(O,y):(F[b]=nt(O),F[b].c(),F[b].m(u,g))}for(;b<F.length;b+=1)F[b].d(1);F.length=I.length}f[13]&&f[23]&&f[25].length===0?E?E.p(f,y):(E=rt(f),E.c(),E.m(u,null)):E&&(E.d(1),E=null),f[7]||f[8]?v?v.p(f,y):(v=at(f),v.c(),v.m(o,null)):v&&(v.d(1),v=null),(!S||y[0]&4096)&&K(o,"paginated",f[12]),(!S||y[0]&2100240)&&K(o,"truncated",f[10]&&!f[21]&&f[4].length>f[11]),f[10]&&f[4].length>f[11]?B?B.p(f,y):(B=st(f),B.c(),B.m(e,d)):B&&(B.d(1),B=null),f[12]?_?(_.p(f,y),y[0]&4096&&C(_,1)):(_=lt(f),_.c(),C(_,1),_.m(e,null)):_&&(ye(),N(_,1,1,()=>{_=null}),Se())},i(f){if(!S){C(A);for(let y=0;y<P.length;y+=1)C(L[y]);C(_),S=!0}},o(f){N(A),L=L.filter(Boolean);for(let y=0;y<L.length;y+=1)N(L[y]);N(_),S=!1},d(f){f&&k(e),A&&A.d(),De(L,f),De(F,f),E&&E.d(),v&&v.d(),B&&B.d(),_&&_.d()}}}function Qt(n){let e,t;return e=new Nt({props:{width:n[18],id:n[19],cls:n[20],$$slots:{default:[Yt]},$$scope:{ctx:n}}}),{c(){z(e.$$.fragment)},m(r,o){H(e,r,o),t=!0},p(r,o){const i={};o[0]&262144&&(i.width=r[18]),o[0]&524288&&(i.id=r[19]),o[0]&1048576&&(i.cls=r[20]),o[0]&65273855|o[1]&524288&&(i.$$scope={dirty:o,ctx:r}),e.$set(i)},i(r){t||(C(e.$$.fragment,r),t=!0)},o(r){N(e.$$.fragment,r),t=!1},d(r){V(e,r)}}}function Xt(n,e,t){let r,o,i,{data:s}=e,{title:l=null}=e,{dek:u=null}=e,{notes:g=null}=e,{source:D=null}=e,{includedFields:p=Object.keys(s[0]).filter(a=>a!=="searchStr")}=e,{truncated:d=!1}=e,{truncateLength:S=5}=e,{paginated:A=!1}=e,{pageSize:P=25}=e,{searchable:L=!1}=e,{searchPlaceholder:j="Search in table"}=e,{filterField:I}=e,{filterLabel:F}=e,{sortable:E=!1}=e,{sortField:v=Object.keys(s[0])[0]}=e,{sortableFields:B=Object.keys(s[0]).filter(a=>a!=="searchStr")}=e,{sortDirection:_="ascending"}=e,{fieldFormatters:f={}}=e,{width:y="normal"}=e,{id:b=""}=e,{cls:O=""}=e,W=!1,M=1,$="";const ue=I?Kt(s,I):void 0;let ee="";function ce(a){t(21,W=!W)}function _e(a){t(23,$=a.detail.value),t(22,M=1)}function fe(a){const h=a.detail.value;t(33,ee=h==="All"?"":h),t(22,M=1)}function Ce(a){E&&(t(1,v=a.target.getAttribute("data-field")),t(2,_=_==="ascending"?"descending":"ascending"))}function de(a,h,re){return E?a.sort((ae,Le)=>ae[h]<Le[h]?re==="ascending"?-1:1:ae[h]>Le[h]?re==="ascending"?1:-1:0):a}function Re(a,h){const re=a[h];if(h in f){const ae=f[h];return ae(re)}else return re}At(()=>{s.forEach(a=>{a.searchStr=p.map(h=>a[h]).join(" ").toLowerCase()})});function ge(a){j=a,t(3,j)}function ke(a){_=a,t(2,_)}function he(a){M=a,t(22,M)}function we(a){P=a,t(0,P)}function ne(a){n.$$.not_equal(i.length,a)&&(i.length=a,t(25,i),t(10,d),t(21,W),t(24,o),t(11,S),t(12,A),t(0,P),t(22,M),t(34,r),t(1,v),t(2,_),t(4,s),t(23,$),t(14,I),t(33,ee))}function Ae(a){n.$$.not_equal(o.length,a)&&(o.length=a,t(24,o),t(34,r),t(1,v),t(2,_),t(4,s),t(23,$),t(14,I),t(33,ee))}return n.$$set=a=>{"data"in a&&t(4,s=a.data),"title"in a&&t(5,l=a.title),"dek"in a&&t(6,u=a.dek),"notes"in a&&t(7,g=a.notes),"source"in a&&t(8,D=a.source),"includedFields"in a&&t(9,p=a.includedFields),"truncated"in a&&t(10,d=a.truncated),"truncateLength"in a&&t(11,S=a.truncateLength),"paginated"in a&&t(12,A=a.paginated),"pageSize"in a&&t(0,P=a.pageSize),"searchable"in a&&t(13,L=a.searchable),"searchPlaceholder"in a&&t(3,j=a.searchPlaceholder),"filterField"in a&&t(14,I=a.filterField),"filterLabel"in a&&t(15,F=a.filterLabel),"sortable"in a&&t(16,E=a.sortable),"sortField"in a&&t(1,v=a.sortField),"sortableFields"in a&&t(17,B=a.sortableFields),"sortDirection"in a&&t(2,_=a.sortDirection),"fieldFormatters"in a&&t(32,f=a.fieldFormatters),"width"in a&&t(18,y=a.width),"id"in a&&t(19,b=a.id),"cls"in a&&t(20,O=a.cls)},n.$$.update=()=>{n.$$.dirty[0]&8405008|n.$$.dirty[1]&4&&t(34,r=jt(s,$,I,ee)),n.$$.dirty[0]&6|n.$$.dirty[1]&8&&t(24,o=de(r,v,_)),n.$$.dirty[0]&23075841&&t(25,i=d?W?o:o.slice(0,S+1):A?Gt(o,P,M):o)},[P,v,_,j,s,l,u,g,D,p,d,S,A,L,I,F,E,B,y,b,O,W,M,$,o,i,ue,ce,_e,fe,Ce,Re,f,ee,r,ge,ke,he,we,ne,Ae]}class Ee extends ie{constructor(e){super(),se(this,e,Xt,Qt,le,{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,cls:20},null,[-1,-1])}}Ee.__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:""},{keywords:[],visibility:"public",description:"Add a class to target with SCSS.",name:"cls",kind:"let",static:!1,readonly:!1,type:{kind:"type",text:"string",type:"string"},defaultValue:""}],computed:[],methods:[],components:[],description:null,keywords:[],events:[],slots:[],refs:[]};const x=[{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}],ve=[{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}],Ne=[{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 xt(n){let e,t;const r=[n[1]];let o={};for(let i=0;i<r.length;i+=1)o=Z(o,r[i]);return e=new Ee({props:o}),{c(){z(e.$$.fragment)},m(i,s){H(e,i,s),t=!0},p(i,s){const l=s&2?J(r,[U(i[1])]):{};e.$set(l)},i(i){t||(C(e.$$.fragment,i),t=!0)},o(i){N(e.$$.fragment,i),t=!1},d(i){V(e,i)}}}function $t(n){let e,t,r,o,i,s,l,u,g,D,p,d,S,A,P,L,j,I,F,E,v,B,_,f;const y=[{title:"Components/Table"},{component:Ee},n[0]];let b={};for(let a=0;a<y.length;a+=1)b=Z(b,y[a]);e=new Ft({props:b}),r=new Lt({props:{$$slots:{default:[xt,({args:a})=>({1:a}),({args:a})=>a?2:0]},$$scope:{ctx:n}}}),i=new X({props:{name:"Default",args:{width:"normal",data:ve}}});const O=[{name:"Metadata"},G(Te),{args:{width:"normal",data:ve,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 W={};for(let a=0;a<O.length;a+=1)W=Z(W,O[a]);l=new X({props:W});const M=[{name:"Truncate"},G(Pe),{args:{data:ve,truncated:!0,source:"Source: Baseball Reference"}}];let $={};for(let a=0;a<M.length;a+=1)$=Z($,M[a]);g=new X({props:$});const ue=[{name:"Paginate"},G(Be),{args:{data:x,title:"Press Freedom Index",paginated:!0,source:"Source: Reporters Without Borders"}}];let ee={};for(let a=0;a<ue.length;a+=1)ee=Z(ee,ue[a]);p=new X({props:ee});const ce=[{name:"Search"},G(Ie),{args:{data:x,searchable:!0,paginated:!0,title:"Press Freedom Index",source:"Source: Reporters Without Borders"}}];let _e={};for(let a=0;a<ce.length;a+=1)_e=Z(_e,ce[a]);S=new X({props:_e});const fe=[{name:"Filter"},G(Me),{args:{data:x,paginated:!0,filterField:"Region",title:"Press Freedom Index",notes:"Source: Reporters Without Borders"}}];let Ce={};for(let a=0;a<fe.length;a+=1)Ce=Z(Ce,fe[a]);P=new X({props:Ce});const de=[{name:"Search and filter"},G(ze),{args:{data:x,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 Re={};for(let a=0;a<de.length;a+=1)Re=Z(Re,de[a]);j=new X({props:Re});const ge=[{name:"Sort"},G(He),{args:{data:x,sortable:!0,sortField:"Score",sortDirection:"descending",paginated:!0,title:"Press Freedom Index",source:"Source: Reporters Without Borders"}}];let ke={};for(let a=0;a<ge.length;a+=1)ke=Z(ke,ge[a]);F=new X({props:ke});const he=[{name:"Format"},G(Ve),{args:{data:Ne,title:"The Richest Women in the World",source:"Source: Forbes",sortable:!0,sortField:"Net worth (in billions)",sortDirection:"descending",fieldFormatters:{"Net worth (in billions)":ut}}}];let we={};for(let a=0;a<he.length;a+=1)we=Z(we,he[a]);v=new X({props:we});const ne=[{name:"Style"},G(je),{args:{id:"custom-table",data:Ne,title:"The Richest Women in the World",source:"Source: Forbes"}},{",":!0}];let Ae={};for(let a=0;a<ne.length;a+=1)Ae=Z(Ae,ne[a]);return _=new X({props:Ae}),{c(){z(e.$$.fragment),t=T(),z(r.$$.fragment),o=T(),z(i.$$.fragment),s=T(),z(l.$$.fragment),u=T(),z(g.$$.fragment),D=T(),z(p.$$.fragment),d=T(),z(S.$$.fragment),A=T(),z(P.$$.fragment),L=T(),z(j.$$.fragment),I=T(),z(F.$$.fragment),E=T(),z(v.$$.fragment),B=T(),z(_.$$.fragment)},m(a,h){H(e,a,h),R(a,t,h),H(r,a,h),R(a,o,h),H(i,a,h),R(a,s,h),H(l,a,h),R(a,u,h),H(g,a,h),R(a,D,h),H(p,a,h),R(a,d,h),H(S,a,h),R(a,A,h),H(P,a,h),R(a,L,h),H(j,a,h),R(a,I,h),H(F,a,h),R(a,E,h),H(v,a,h),R(a,B,h),H(_,a,h),f=!0},p(a,[h]){const re=h&1?J(y,[y[0],h&0&&{component:Ee},h&1&&U(a[0])]):{};e.$set(re);const ae={};h&6&&(ae.$$scope={dirty:h,ctx:a}),r.$set(ae);const Le=h&0?J(O,[O[0],h&0&&U(G(Te)),h&0&&{args:{width:"normal",data:ve,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"}}]):{};l.$set(Le);const pt=h&0?J(M,[M[0],h&0&&U(G(Pe)),h&0&&{args:{data:ve,truncated:!0,source:"Source: Baseball Reference"}}]):{};g.$set(pt);const mt=h&0?J(ue,[ue[0],h&0&&U(G(Be)),h&0&&{args:{data:x,title:"Press Freedom Index",paginated:!0,source:"Source: Reporters Without Borders"}}]):{};p.$set(mt);const bt=h&0?J(ce,[ce[0],h&0&&U(G(Ie)),h&0&&{args:{data:x,searchable:!0,paginated:!0,title:"Press Freedom Index",source:"Source: Reporters Without Borders"}}]):{};S.$set(bt);const yt=h&0?J(fe,[fe[0],h&0&&U(G(Me)),h&0&&{args:{data:x,paginated:!0,filterField:"Region",title:"Press Freedom Index",notes:"Source: Reporters Without Borders"}}]):{};P.$set(yt);const St=h&0?J(de,[de[0],h&0&&U(G(ze)),h&0&&{args:{data:x,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"}}]):{};j.$set(St);const _t=h&0?J(ge,[ge[0],h&0&&U(G(He)),h&0&&{args:{data:x,sortable:!0,sortField:"Score",sortDirection:"descending",paginated:!0,title:"Press Freedom Index",source:"Source: Reporters Without Borders"}}]):{};F.$set(_t);const Ct=h&0?J(he,[he[0],h&0&&U(G(Ve)),h&0&&{args:{data:Ne,title:"The Richest Women in the World",source:"Source: Forbes",sortable:!0,sortField:"Net worth (in billions)",sortDirection:"descending",fieldFormatters:{"Net worth (in billions)":ut}}}]):{};v.$set(Ct);const Rt=h&0?J(ne,[ne[0],h&0&&U(G(je)),h&0&&{args:{id:"custom-table",data:Ne,title:"The Richest Women in the World",source:"Source: Forbes"}},ne[3]]):{};_.$set(Rt)},i(a){f||(C(e.$$.fragment,a),C(r.$$.fragment,a),C(i.$$.fragment,a),C(l.$$.fragment,a),C(g.$$.fragment,a),C(p.$$.fragment,a),C(S.$$.fragment,a),C(P.$$.fragment,a),C(j.$$.fragment,a),C(F.$$.fragment,a),C(v.$$.fragment,a),C(_.$$.fragment,a),f=!0)},o(a){N(e.$$.fragment,a),N(r.$$.fragment,a),N(i.$$.fragment,a),N(l.$$.fragment,a),N(g.$$.fragment,a),N(p.$$.fragment,a),N(S.$$.fragment,a),N(P.$$.fragment,a),N(j.$$.fragment,a),N(F.$$.fragment,a),N(v.$$.fragment,a),N(_.$$.fragment,a),f=!1},d(a){V(e,a),a&&k(t),V(r,a),a&&k(o),V(i,a),a&&k(s),V(l,a),a&&k(u),V(g,a),a&&k(D),V(p,a),a&&k(d),V(S,a),a&&k(A),V(P,a),a&&k(L),V(j,a),a&&k(I),V(F,a),a&&k(E),V(v,a),a&&k(B),V(_,a)}}}const ut=n=>"$"+n.toFixed(1);function en(n){return[{...Et(Wt),argTypes:{width:{control:"select",options:["normal","wide","wider","widest","fluid"]}}}]}class tn extends ie{constructor(e){super(),se(this,e,en,$t,le,{})}}const Q=vt(tn,{meta:{title:"Components/Table"},stories:{"tpl:default":{storyId:"components-table--default",name:"default",template:!0,source:"<Table {...args} />",hasArgs:!0},Default:{storyId:"components-table--default",name:"Default",template:!1,hasArgs:!1},Metadata:{storyId:"components-table--metadata",name:"Metadata",template:!1,hasArgs:!1},Truncate:{storyId:"components-table--truncate",name:"Truncate",template:!1,hasArgs:!1},Paginate:{storyId:"components-table--paginate",name:"Paginate",template:!1,hasArgs:!1},Search:{storyId:"components-table--search",name:"Search",template:!1,hasArgs:!1},Filter:{storyId:"components-table--filter",name:"Filter",template:!1,hasArgs:!1},SearchAndFilter:{storyId:"components-table--search-and-filter",name:"Search and filter",template:!1,hasArgs:!1},Sort:{storyId:"components-table--sort",name:"Sort",template:!1,hasArgs:!1},Format:{storyId:"components-table--format",name:"Format",template:!1,hasArgs:!1},Style:{storyId:"components-table--style",name:"Style",template:!1,hasArgs:!1}},allocatedIds:["default","Meta","Template","Story","componentDocs","metadataDocs","truncateDocs","paginateDocs","searchDocs","filterDocs","bothDocs","sortDocs","formatDocs","styleDocs","Table","withComponentDocs","withStoryDocs","pressFreedom","homeRuns","richestWomen"]}),un=Q.meta,cn=["Default","Metadata","Truncate","Paginate","Search","Filter","SearchAndFilter","Sort","Format","Style"],fn=Q.stories.Default,dn=Q.stories.Metadata,gn=Q.stories.Truncate,hn=Q.stories.Paginate,pn=Q.stories.Search,mn=Q.stories.Filter,bn=Q.stories.SearchAndFilter,yn=Q.stories.Sort,Sn=Q.stories.Format,_n=Q.stories.Style;export{fn as Default,mn as Filter,Sn as Format,dn as Metadata,hn as Paginate,pn as Search,bn as SearchAndFilter,yn as Sort,_n as Style,gn as Truncate,cn as __namedExportsOrder,un as default};
//# sourceMappingURL=Table.stories-a137e5a5.js.map