hypnagaga/packages/graphics-components/docs/assets/Table.stories-BA5xu8FV.js

2 lines
34 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{g as ce,a as u,n as ue,p as g,f as v,t as Re}from"./props-b4vEeO_8.js";import{B as ae,I as o,F as y,N as F,J as W,k as t,G as re,a4 as X,a3 as j,C as Je,D as P}from"./runtime-C3rQLW--.js";import{i as Ze}from"./lifecycle-F2p_Qkk3.js";import{c as Ue,d as Qe}from"./create-runtime-stories-7AWWVphH.js";import{s as Q,i as _}from"./svelte-component-C8Ginrj8.js";import{e as $,i as ee}from"./each-CVpBMMjG.js";import{h as Z}from"./html-CPeakWmR.js";import{s as M,a as te}from"./attributes-Cg6aLqN3.js";import{B as Ye}from"./Block-D3Ui8rd-.js";import{g as Xe}from"./journalize-K6hK94UL.js";import{S as $e}from"./SearchInput-CsfDnQ1p.js";var et=ce('<svg class="icon svelte-10fxahy" aria-hidden="true" focusable="false" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 6 11"><path 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"></path></svg>');function Ae(r){var e=et();u(r,e)}Ae.__docgen={version:3,name:"PrevArrow.svelte",data:[],computed:[],methods:[],components:[],description:null,keywords:[],events:[],slots:[],refs:[]};var tt=ce('<svg class="icon svelte-10fxahy" aria-hidden="true" focusable="false" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 7 11"><path 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"></path></svg>');function ke(r){var e=tt();u(r,e)}ke.__docgen={version:3,name:"NextArrow.svelte",data:[],computed:[],methods:[],components:[],description:null,keywords:[],events:[],slots:[],refs:[]};function at(r,e){e()>1&&e(e()-1)}function rt(r,e,a){e()<t(a)&&e(e()+1)}var nt=v('<nav aria-label="pagination" class="pagination fmt-4 svelte-1grv2sx"><button class="svelte-1grv2sx"><div class="icon-wrapper svelte-1grv2sx"><!> <span class="visually-hidden svelte-1grv2sx">Previous page</span></div></button> <div class="label fmx-2 svelte-1grv2sx" aria-current="page"><div class="records body-caption mt-1.5"> </div></div> <button class="svelte-1grv2sx"><div class="icon-wrapper svelte-1grv2sx"><!> <span class="visually-hidden svelte-1grv2sx">Next page</span></div></button></nav>');function we(r,e){ae(e,!0);let a=g(e,"pageNumber",15,1),n=g(e,"pageSize",11,25),s=g(e,"pageLength",3,1),f=g(e,"n",3,1),m=F(()=>a()*n()-n()+1),C=F(()=>a()*n()-n()+s()),R=F(()=>Math.ceil(f()/n()));var A=nt(),p=o(A);p.__click=[at,a];var N=o(p),I=o(N);Ae(I);var i=y(p,2),ne=o(i),oe=o(ne),K=y(i,2);K.__click=[rt,a,R];var G=o(K),D=o(G);ke(D),W((H,O)=>{p.disabled=a()===1,M(i,"aria-label",`page ${a()??""}`),Q(oe,`${t(m)??""}-${t(C)??""} of ${H??""}`),K.disabled=O},[()=>Xe(f()),()=>a()===Math.ceil(f()/n())]),u(r,A),re()}ue(["click"]);we.__docgen={data:[{name:"pageNumber",visibility:"public",description:"The current page number.",keywords:[],kind:"let",type:{kind:"type",type:"number",text:"number"},static:!1,readonly:!1,defaultValue:"..."},{name:"pageSize",visibility:"public",description:"The default page size.",keywords:[],kind:"let",type:{kind:"type",type:"number",text:"number"},static:!1,readonly:!1,defaultValue:"..."},{name:"pageLength",visibility:"public",description:"The number of records in the current page.",keywords:[],kind:"let",type:{kind:"type",type:"number",text:"number"},static:!1,readonly:!1,defaultValue:"1"},{name:"n",visibility:"public",description:"The total number of records in the data set.",keywords:[],kind:"let",type:{kind:"type",type:"number",text:"number"},static:!1,readonly:!1,defaultValue:"1"}],name:"Pagination.svelte"};function ot(r,e){const a=r.target.value;e.onselect&&e.onselect(a)}var it=v("<option> </option>"),st=v('<div class="select relative inline-flex svelte-1gqnism"><select class="select--input body-caption fpx-2 svelte-1gqnism" name="select--input" id="select--input"></select> <div class="arrow absolute svelte-1gqnism"><svg width="15" height="9" viewBox="0 0 15 9" xmlns="http://www.w3.org/2000/svg"><path d="M6.76474 8.30466L0.236082 1.54523C-0.0786943 1.21934 -0.0786943 0.69069 0.236082 0.364804C0.550521 0.0392666 1.19794 0.0403099 1.51305 0.364804L7.33483 6.49522L12.9249 0.475171C13.3549 0.0451683 14.1195 0.0396141 14.4339 0.365152C14.7487 0.691037 14.7487 1.21969 14.4339 1.54557L7.90492 8.30466C7.59015 8.63054 7.07952 8.63054 6.76474 8.30466Z" fill="var(--theme-colour-brand-rules)"></path></svg></div></div>');function _e(r,e){ae(e,!0);let a=g(e,"label",3,""),n=g(e,"options",19,()=>[]);var s=st(),f=o(s);f.__input=[ot,e],$(f,21,n,ee,(m,C)=>{var R=it(),A=o(R),p={};W(N=>{Q(A,`${t(C).text??""} ${N??""}`),p!==(p=t(C).value)&&(R.value=(R.__value=t(C).value)??"")},[()=>a().toLowerCase()]),u(m,R)}),u(r,s),re()}ue(["input"]);_e.__docgen={data:[{name:"label",visibility:"public",description:"The label that appears above the select input.",keywords:[],kind:"let",type:{kind:"type",type:"string",text:"string"},static:!1,readonly:!1,defaultValue:'""'},{name:"options",visibility:"public",description:"The label that appears above the select input.",keywords:[],kind:"let",type:{kind:"type",type:"array",text:"Option[]"},static:!1,readonly:!1,defaultValue:"[]"},{name:"onselect",visibility:"public",description:"Optional function that runs when the selected value changes.",keywords:[],kind:"let",type:{kind:"function",text:"(newValue: string) => void"},static:!1,readonly:!1}],name:"Select.svelte"};var lt=ce('<svg width="15" height="21" viewBox="0 0 15 21" fill="none" xmlns="http://www.w3.org/2000/svg" class="avoid-clicks svelte-1vec2lc"><path 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"></path><path 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"></path></svg>');function xe(r,e){let a=g(e,"sortDirection",3,"ascending"),n=g(e,"active",3,!1);var s=lt(),f=o(s);let m;var C=y(f);let R;W((A,p)=>{m=te(f,0,"svelte-1vec2lc",null,m,A),R=te(C,0,"svelte-1vec2lc",null,R,p)},[()=>({active:a()==="descending"&&n()}),()=>({active:a()==="ascending"&&n()})]),u(r,s)}xe.__docgen={data:[{name:"sortDirection",visibility:"public",keywords:[],kind:"let",type:{kind:"union",type:[{kind:"const",type:"string",value:"ascending",text:'"ascending"'},{kind:"const",type:"string",value:"descending",text:'"descending"'}],text:'"ascending" | "descending"'},static:!1,readonly:!1,defaultValue:'"ascending"'},{name:"active",visibility:"public",description:"Whether or not this arrow is currently sorting. It is false by default.",keywords:[],kind:"let",type:{kind:"type",type:"boolean",text:"boolean"},static:!1,readonly:!1,defaultValue:"false"}],name:"SortArrow.svelte"};function ct(r,e,a,n){return e&&(r=r.filter(s=>s.searchStr.includes(e.toLowerCase()))),n&&(r=r.filter(s=>a?s[a]===n:!0)),r}function ut(r,e,a){return r.slice((a-1)*e,a*e)}function dt(r,e){return r.map(a=>a[e]).filter(gt)}function gt(r,e,a){return a.indexOf(r)===e}function yt(r,e){const a=dt(r,e).sort((n,s)=>{if(typeof n!="string"||typeof s!="string")throw new Error(`Expected string, got ${typeof n} and ${typeof s}`);return n.localeCompare(s)});return a.unshift("All"),a.map(n=>({text:n,value:n}))}function St(r,e,a,n){return n?[...r].sort((f,m)=>f[e]<m[e]?a==="ascending"?-1:1:f[e]>m[e]?a==="ascending"?1:-1:0):r}function ht(r,e,a){const n=r[e];if(a&&e in a&&a[e]){const s=a[e];return s(n)}else return n}function bt(r,e){j(e,!t(e))}function vt(r,e,a,n){e()&&(a(r.target.getAttribute("data-field")||""),n(n()==="ascending"?"descending":"ascending"))}var ft=v('<h3 class="table--header--title"><!></h3>'),pt=v('<p class="table--header--dek body-note"><!></p>'),mt=v('<div class="table--header--filter"><!></div>'),Ct=v('<div class="table--header--search"><!></div>'),Rt=v('<nav class="input fmx-0 fmy-2 svelte-ke3g5p"><!> <!></nav>'),At=v('<div class="table--header w-full"><!> <!> <!></div>'),kt=v('<div class="table--thead--sortarrow fml-1 avoid-clicks svelte-ke3g5p"><!></div>'),wt=v('<th scope="col"> <!></th>'),_t=v('<td class="body-note pl-0 py-2 pr-2 svelte-ke3g5p"><!></td>'),xt=v('<tr class="svelte-ke3g5p"></tr>'),Nt=v('<tr class="svelte-ke3g5p"><td class="no-results svelte-ke3g5p"> </td></tr>'),Et=v('<tr class="svelte-ke3g5p"><td class="svelte-ke3g5p"><div class="fmt-2"><!></div></td></tr>'),Lt=v('<tr class="svelte-ke3g5p"><td class="svelte-ke3g5p"><div class="fmt-1"><!></div></td></tr>'),Tt=v('<tfoot class="table--tfoot svelte-ke3g5p"><!><!></tfoot>'),Ft=v('<nav aria-label="Show all button" class="show-all flex items-center justify-center fmt-2 svelte-ke3g5p"><button class="body-caption svelte-ke3g5p"><!></button></nav>'),Wt=v('<div class="table-wrapper"><!> <div class="table w-full svelte-ke3g5p"><table><thead class="table--thead svelte-ke3g5p"><tr class="svelte-ke3g5p"></tr></thead><tbody class="table--tbody svelte-ke3g5p"><!><!></tbody><!></table></div> <!> <!></div>');function Ne(r,e){ae(e,!0);let a=g(e,"includedFields",19,()=>Object.keys(e.data[0]).filter(x=>x!=="searchStr")),n=g(e,"truncated",3,!1),s=g(e,"truncateLength",3,5),f=g(e,"paginated",3,!1),m=g(e,"pageSize",7,25),C=g(e,"searchable",3,!1),R=g(e,"searchPlaceholder",3,"Search in table"),A=g(e,"filterField",3,""),p=g(e,"sortable",3,!1),N=g(e,"sortField",23,()=>Object.keys(e.data[0])[0]),I=g(e,"sortableFields",19,()=>Object.keys(e.data[0]).filter(x=>x!=="searchStr")),i=g(e,"sortDirection",15,"ascending"),ne=g(e,"width",3,"normal"),oe=g(e,"id",3,""),K=g(e,"class",3,""),G=X(!1),D=X(1),H=X(""),O=F(()=>A()?yt(e.data,A()):void 0),de=X("");function Te(x){j(H,x,!0),j(D,1)}function Fe(x){j(de,x==="All"?"":x,!0),j(D,1)}let Y=F(()=>e.data.map(x=>({...x,searchStr:a().map(ge=>x[ge]).join(" ").toLowerCase()}))),We=F(()=>ct(t(Y),t(H),A(),t(de))),q=F(()=>St(t(We),N(),i(),p())),ie=F(()=>n()?t(G)?t(q):t(q).slice(0,s()+1):f()?ut(t(q),m(),t(D)):t(q));Ye(r,{get width(){return ne()},get id(){return oe()},get class(){return`fmy-6 ${K()??""}`},children:(x,ge)=>{var ye=Wt(),Se=o(ye);{var Pe=c=>{var l=At(),S=o(l);{var k=b=>{var w=ft(),E=o(w);Z(E,()=>e.title),u(b,w)};_(S,b=>{e.title&&b(k)})}var L=y(S,2);{var T=b=>{var w=pt(),E=o(w);Z(E,()=>e.dek),u(b,w)};_(L,b=>{e.dek&&b(T)})}var d=y(L,2);{var h=b=>{var w=Rt(),E=o(w);{var Oe=z=>{var J=mt(),se=o(J);{let qe=F(()=>e.filterLabel||A());_e(se,{get label(){return t(qe)},get options(){return t(O)},onselect:Fe})}u(z,J)};_(E,z=>{t(O)&&z(Oe)})}var je=y(E,2);{var Ke=z=>{var J=Ct(),se=o(J);$e(se,{get searchPlaceholder(){return R()},onsearch:Te}),u(z,J)};_(je,z=>{C()&&z(Ke)})}u(b,w)};_(d,b=>{(C()||t(O))&&b(h)})}u(c,l)};_(Se,c=>{(e.title||e.dek||C()||t(O))&&c(Pe)})}var he=y(Se,2),be=o(he);let ve;var fe=o(be),Be=o(fe);$(Be,21,a,ee,(c,l)=>{var S=wt();let k;S.__click=[vt,p,N,i];var L=o(S),T=y(L);{var d=h=>{var b=kt(),w=o(b);{let E=F(()=>N()===t(l));xe(w,{get sortDirection(){return i()},get active(){return t(E)}})}u(h,b)};_(T,h=>{p()&&I().includes(t(l))&&h(d)})}W(h=>{k=te(S,1,"table--thead--th h4 pl-0 py-2 pr-2 svelte-ke3g5p",null,k,h),M(S,"data-field",t(l)),Q(L,`${t(l)??""} `)},[()=>({sortable:p()&&I().includes(t(l)),"sort-ascending":p()&&N()===t(l)&&i()==="ascending","sort-descending":p()&&N()===t(l)&&i()==="descending"})]),u(c,S)});var pe=y(fe),me=o(pe);$(me,17,()=>t(ie),ee,(c,l,S)=>{var k=xt();M(k,"data-row-index",S),$(k,21,a,ee,(L,T)=>{var d=_t();M(d,"data-row-index",S);var h=o(d);Z(h,()=>ht(t(l),t(T),e.fieldFormatters)),W(()=>{M(d,"data-field",t(T)),M(d,"data-value",t(l)[t(T)])}),u(L,d)}),u(c,k)});var Me=y(me);{var Ve=c=>{var l=Nt(),S=o(l),k=o(S);W(()=>{M(S,"colspan",a().length),Q(k,`No results found for "${t(H)??""}"`)}),u(c,l)};_(Me,c=>{C()&&t(H)&&t(ie).length===0&&c(Ve)})}var De=y(pe);{var ze=c=>{var l=Tt(),S=o(l);{var k=d=>{var h=Et(),b=o(h),w=o(b),E=o(w);Z(E,()=>e.notes),W(()=>M(b,"colspan",a().length)),u(d,h)};_(S,d=>{e.notes&&d(k)})}var L=y(S);{var T=d=>{var h=Lt(),b=o(h),w=o(b),E=o(w);Z(E,()=>e.source),W(()=>M(b,"colspan",a().length)),u(d,h)};_(L,d=>{e.source&&d(T)})}u(c,l)};_(De,c=>{(e.notes||e.source)&&c(ze)})}var Ce=y(he,2);{var Ie=c=>{var l=Ft(),S=o(l);S.__click=[bt,G];var k=o(S);{var L=d=>{var h=Re("Show fewer rows");u(d,h)},T=d=>{var h=Re();W(()=>Q(h,`Show ${t(Y).length-s()}
more rows`)),u(d,h)};_(k,d=>{t(G)?d(L):d(T,!1)})}u(c,l)};_(Ce,c=>{n()&&t(Y).length>s()&&c(Ie)})}var Ge=y(Ce,2);{var He=c=>{we(c,{get pageLength(){return t(ie).length},get n(){return t(q).length},get pageNumber(){return t(D)},set pageNumber(l){j(D,l,!0)},get pageSize(){return m()},set pageSize(l){m(l)}})};_(Ge,c=>{f()&&c(He)})}W(c=>ve=te(be,1,"w-full svelte-ke3g5p",null,ve,c),[()=>({paginated:f(),truncated:n()&&!t(G)&&t(Y).length>s()})]),u(x,ye)},$$slots:{default:!0}}),re()}ue(["click"]);Ne.__docgen={data:[{name:"data",visibility:"public",description:"Data for the table as an array.",keywords:[{name:"required",description:""}],kind:"let",type:{kind:"type",type:"array",text:"Record<string, unknown>[]"},static:!1,readonly:!1},{name:"title",visibility:"public",description:"A title that runs above the table.",keywords:[],kind:"let",type:{kind:"type",type:"string",text:"string"},static:!1,readonly:!1},{name:"dek",visibility:"public",description:"A block of text that runs above the table.",keywords:[],kind:"let",type:{kind:"type",type:"string",text:"string"},static:!1,readonly:!1},{name:"notes",visibility:"public",description:"A footnote that runs below the table.",keywords:[],kind:"let",type:{kind:"type",type:"string",text:"string"},static:!1,readonly:!1},{name:"source",visibility:"public",description:"A source line that runs below the table.",keywords:[],kind:"let",type:{kind:"type",type:"string",text:"string"},static:!1,readonly:!1},{name:"includedFields",visibility:"public",description:"List of the fields to include in the table. By default everything goes.",keywords:[],kind:"let",type:{kind:"type",type:"array",text:"string[]"},static:!1,readonly:!1,defaultValue:"..."},{name:"truncated",visibility:"public",description:"Whether or not the table is cutoff after a set number of rows.",keywords:[],kind:"let",type:{kind:"type",type:"boolean",text:"boolean"},static:!1,readonly:!1,defaultValue:"false"},{name:"truncateLength",visibility:"public",description:"If the table is truncated, how many rows to allow before the cutoff.",keywords:[],kind:"let",type:{kind:"type",type:"number",text:"number"},static:!1,readonly:!1,defaultValue:"5"},{name:"paginated",visibility:"public",description:"Whether or not the table is paginated after a set number of rows.",keywords:[],kind:"let",type:{kind:"type",type:"boolean",text:"boolean"},static:!1,readonly:!1,defaultValue:"false"},{name:"pageSize",visibility:"public",description:"The default page size.",keywords:[],kind:"let",type:{kind:"type",type:"number",text:"number"},static:!1,readonly:!1,defaultValue:"25"},{name:"searchable",visibility:"public",description:"Whether or not searches are allowed.",keywords:[],kind:"let",type:{kind:"type",type:"boolean",text:"boolean"},static:!1,readonly:!1,defaultValue:"false"},{name:"searchPlaceholder",visibility:"public",description:"The placeholder text that appears in the search box.",keywords:[],kind:"let",type:{kind:"type",type:"string",text:"string"},static:!1,readonly:!1,defaultValue:'"Search in table"'},{name:"filterField",visibility:"public",description:"A field to offer uses as an interactive filter.",keywords:[],kind:"let",type:{kind:"type",type:"string",text:"string"},static:!1,readonly:!1,defaultValue:'""'},{name:"filterLabel",visibility:"public",description:"The label to place above the filter box.",keywords:[],kind:"let",type:{kind:"type",type:"string",text:"string"},static:!1,readonly:!1},{name:"sortable",visibility:"public",description:"Whether or not sorts are allowed.",keywords:[],kind:"let",type:{kind:"type",type:"boolean",text:"boolean"},static:!1,readonly:!1,defaultValue:"false"},{name:"sortField",visibility:"public",description:"The column to sort by. By default it's the first header.",keywords:[],kind:"let",type:{kind:"type",type:"string",text:"string"},static:!1,readonly:!1,defaultValue:"..."},{name:"sortableFields",visibility:"public",description:"The columns that are allowed to sort. It's all of them by default.",keywords:[],kind:"let",type:{kind:"type",type:"array",text:"string[]"},static:!1,readonly:!1,defaultValue:"..."},{name:"sortDirection",visibility:"public",description:"The direction of the sort. By default it's ascending.",keywords:[],kind:"let",type:{kind:"union",type:[{kind:"const",type:"string",value:"ascending",text:'"ascending"'},{kind:"const",type:"string",value:"descending",text:'"descending"'}],text:'"ascending" | "descending"'},static:!1,readonly:!1,defaultValue:"..."},{name:"fieldFormatters",visibility:"public",description:"Custom field formatting functions. Should be keyed to the name of the field.",keywords:[],kind:"let",type:{kind:"type",type:"object",text:"FieldFormatters<Record<string, unknown>>"},static:!1,readonly:!1},{name:"width",visibility:"public",description:"Width of the component within the text well.",keywords:[],kind:"let",type:{kind:"union",type:[{kind:"const",type:"string",value:"normal",text:'"normal"'},{kind:"const",type:"string",value:"wide",text:'"wide"'},{kind:"const",type:"string",value:"wider",text:'"wider"'},{kind:"const",type:"string",value:"widest",text:'"widest"'},{kind:"const",type:"string",value:"fluid",text:'"fluid"'}],text:'"normal" | "wide" | "wider" | "widest" | "fluid"'},static:!1,readonly:!1,defaultValue:'"normal"'},{name:"id",visibility:"public",description:"Add an ID to target with SCSS.",keywords:[],kind:"let",type:{kind:"type",type:"string",text:"string"},static:!1,readonly:!1,defaultValue:'""'},{name:"class",visibility:"public",description:"Add a class to target with SCSS.",keywords:[],kind:"let",type:{kind:"type",type:"string",text:"string"},static:!1,readonly:!1}],name:"Table.svelte"};const U=JSON.parse(`[{"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}]`),le=[{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}],Pt=[{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}],Ee={title:"Components/Graphics/Table",component:Ne,argTypes:{width:{control:"select",options:["normal","wide","wider","widest","fluid"]}}},{Story:B}=Qe();var Bt=v("<!> <!> <!> <!> <!> <!> <!> <!> <!>",1);function Le(r,e){ae(e,!1);const a=i=>"$"+i.toFixed(1);Ze();var n=Bt(),s=Je(n);{let i=P(()=>({width:"normal",data:le}));B(s,{name:"Demo",get args(){return t(i)},parameters:{__svelteCsf:{rawCode:"<Table {...args} />"}}})}var f=y(s,2);{let i=P(()=>({data:le,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"}));B(f,{name:"Text elements",exportName:"Text",get args(){return t(i)},parameters:{__svelteCsf:{rawCode:"<Table {...args} />"}}})}var m=y(f,2);{let i=P(()=>({data:le,truncated:!0,source:"Source: Baseball Reference"}));B(m,{name:"Truncated",get args(){return t(i)},parameters:{__svelteCsf:{rawCode:"<Table {...args} />"}}})}var C=y(m,2);{let i=P(()=>({data:U,paginated:!0,title:"Press Freedom Index",source:"Source: Reporters Without Borders"}));B(C,{name:"Paginated",get args(){return t(i)},parameters:{__svelteCsf:{rawCode:"<Table {...args} />"}}})}var R=y(C,2);{let i=P(()=>({data:U,searchable:!0,paginated:!0,searchPlaceholder:"Search press freedom data",title:"Press Freedom Index",source:"Source: Reporters Without Borders"}));B(R,{name:"Search bar",exportName:"Search",get args(){return t(i)},parameters:{__svelteCsf:{rawCode:"<Table {...args} />"}}})}var A=y(R,2);{let i=P(()=>({data:U,paginated:!0,filterField:"Region",filterLabel:"regions",title:"Press Freedom Index",notes:"Source: Reporters Without Borders"}));B(A,{name:"Filter",get args(){return t(i)},parameters:{__svelteCsf:{rawCode:"<Table {...args} />"}}})}var p=y(A,2);{let i=P(()=>({data:U,searchable:!0,paginated:!0,filterField:"Region",filterLabel:"regions",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"}));B(p,{name:"Search and filter",exportName:"SearchAndFilter",get args(){return t(i)},parameters:{__svelteCsf:{rawCode:"<Table {...args} />"}}})}var N=y(p,2);{let i=P(()=>({data:U,sortable:!0,paginated:!0,sortField:"Score",sortDirection:"descending",title:"Press Freedom Index",notes:"Note: data as of 2018",source:"Source: Reporters Without Borders"}));B(N,{name:"Sort",get args(){return t(i)},parameters:{__svelteCsf:{rawCode:"<Table {...args} />"}}})}var I=y(N,2);{let i=P(()=>({data:Pt,fieldFormatters:{"Net worth (in billions)":a},sortable:!0,sortField:"Net worth (in billions)",sortDirection:"descending",title:"The Richest Women in the World",source:"Source: Forbes"}));B(I,{name:"Format",get args(){return t(i)},parameters:{__svelteCsf:{rawCode:"<Table {...args} />"}}})}u(r,n),re()}Le.__docgen={version:3,name:"Table.stories.svelte",data:[],computed:[],methods:[],components:[],description:null,keywords:[],events:[],slots:[],refs:[]};const V=Ue(Le,Ee),Mt=["Demo","Text","Truncated","Paginated","Search","Filter","SearchAndFilter","Sort","Format"],Vt=V.Demo,Dt=V.Text,zt=V.Truncated,It=V.Paginated,Gt=V.Search,Ht=V.Filter,Ot=V.SearchAndFilter,jt=V.Sort,Kt=V.Format,ra=Object.freeze(Object.defineProperty({__proto__:null,Demo:Vt,Filter:Ht,Format:Kt,Paginated:It,Search:Gt,SearchAndFilter:Ot,Sort:jt,Text:Dt,Truncated:zt,__namedExportsOrder:Mt,default:Ee},Symbol.toStringTag,{value:"Module"}));export{Vt as D,Ht as F,It as P,Gt as S,ra as T,Dt as a,zt as b,Ot as c,jt as d,Kt as e};