38 lines
12 KiB
JavaScript
38 lines
12 KiB
JavaScript
import{S as Q,i as X,s as Y,o as T,g as w,b as B,d as _,m as k,t as c,h as m,f as h,j as $,x as oe,y as I,k as ne,v as R,w as V,n as x,l as H,u as W,q,r as E,C as Z}from"./index-4f5e5369.js";import{g as ee,a as te}from"./spread-8a54911c.js";import{p as se,M as re,T as ie,S as z}from"./collect-stories-6e37d46b.js";import{B as ae}from"./Block-67c7bec3.js";import{m as C}from"./marked.esm-76161808.js";import{B as G}from"./BodyText-780d8761.js";import{w as le}from"./withParams-47e2ab71.js";const fe=`InfoBox is used to provide additional information that needs to be visually set aside from the main content flow. e.g. Methodology, Detailed notes about data, Extra context as text stories.
|
||
|
||
Use the slots to customize the content as needed, e.g. adding icons and thumbnail images etc.
|
||
|
||
\`\`\`svelte
|
||
<script>
|
||
import { InfoBox } from '@reuters-graphics/graphics-components';
|
||
<\/script>
|
||
|
||
<InfoBox
|
||
title="About this data"
|
||
text="{'Reuters is collecting daily COVID-19 infections and deaths data for 240 countries and territories around the world, updated regularly throughout each day. \\n\\n Every country reports those figures a little differently and, inevitably, misses undiagnosed infections and deaths. With this project we are focusing on the trends within countries as they try to contain the virus’ spread, whether they are approaching or past peak infection rates, or if they are seeing a resurgence of infections or deaths.'}"
|
||
notes="{'[Read more about our methodology](https://www.reuters.com/world-coronavirus-tracker-and-maps/en/methodology/)'}"
|
||
/>
|
||
\`\`\`
|
||
`;const de=r=>({}),P=r=>({}),ue=r=>({}),J=r=>({}),ce=r=>({}),K=r=>({});function me(r){let e,n=C(r[0])+"";return{c(){e=T("div"),B(e,"class","header fmb-2")},m(s,o){_(s,e,o),e.innerHTML=n},p(s,o){o&1&&n!==(n=C(s[0])+"")&&(e.innerHTML=n)},i:x,o:x,d(s){s&&h(e)}}}function pe(r){let e,n;const s=r[7].header,o=H(s,r,r[8],K);return{c(){e=T("div"),o&&o.c(),B(e,"class","header fmb-2")},m(t,a){_(t,e,a),o&&o.m(e,null),n=!0},p(t,a){o&&o.p&&(!n||a&256)&&W(o,s,t,t[8],n?E(s,t[8],a,ce):q(t[8]),K)},i(t){n||(c(o,t),n=!0)},o(t){m(o,t),n=!1},d(t){t&&h(e),o&&o.d(t)}}}function _e(r){let e,n=C(r[1])+"";return{c(){e=T("div"),B(e,"class","body")},m(s,o){_(s,e,o),e.innerHTML=n},p(s,o){o&2&&n!==(n=C(s[1])+"")&&(e.innerHTML=n)},i:x,o:x,d(s){s&&h(e)}}}function he(r){let e,n;const s=r[7].body,o=H(s,r,r[8],J);return{c(){e=T("div"),o&&o.c(),B(e,"class","body")},m(t,a){_(t,e,a),o&&o.m(e,null),n=!0},p(t,a){o&&o.p&&(!n||a&256)&&W(o,s,t,t[8],n?E(s,t[8],a,ue):q(t[8]),J)},i(t){n||(c(o,t),n=!0)},o(t){m(o,t),n=!1},d(t){t&&h(e),o&&o.d(t)}}}function ye(r){let e,n=C(r[2])+"";return{c(){e=T("div"),B(e,"class","footer fmt-2")},m(s,o){_(s,e,o),e.innerHTML=n},p(s,o){o&4&&n!==(n=C(s[2])+"")&&(e.innerHTML=n)},i:x,o:x,d(s){s&&h(e)}}}function ge(r){let e,n;const s=r[7].footer,o=H(s,r,r[8],P);return{c(){e=T("div"),o&&o.c(),B(e,"class","footer fmt-2")},m(t,a){_(t,e,a),o&&o.m(e,null),n=!0},p(t,a){o&&o.p&&(!n||a&256)&&W(o,s,t,t[8],n?E(s,t[8],a,de):q(t[8]),P)},i(t){n||(c(o,t),n=!0)},o(t){m(o,t),n=!1},d(t){t&&h(e),o&&o.d(t)}}}function be(r){let e,n,s,o,t,a,i,u,y,g;const l=[pe,me],f=[];function S(d,p){return d[6].header?0:d[0]?1:-1}~(e=S(r))&&(n=f[e]=l[e](r));const D=[he,_e],b=[];function j(d,p){return d[6].body?0:1}o=j(r),t=b[o]=D[o](r);const F=[ge,ye],v=[];function O(d,p){return d[6].footer?0:d[2]?1:-1}return~(i=O(r))&&(u=v[i]=F[i](r)),{c(){n&&n.c(),s=I(),t.c(),a=I(),u&&u.c(),y=ne()},m(d,p){~e&&f[e].m(d,p),_(d,s,p),b[o].m(d,p),_(d,a,p),~i&&v[i].m(d,p),_(d,y,p),g=!0},p(d,p){let L=e;e=S(d),e===L?~e&&f[e].p(d,p):(n&&(R(),m(f[L],1,1,()=>{f[L]=null}),V()),~e?(n=f[e],n?n.p(d,p):(n=f[e]=l[e](d),n.c()),c(n,1),n.m(s.parentNode,s)):n=null);let M=o;o=j(d),o===M?b[o].p(d,p):(R(),m(b[M],1,1,()=>{b[M]=null}),V(),t=b[o],t?t.p(d,p):(t=b[o]=D[o](d),t.c()),c(t,1),t.m(a.parentNode,a));let N=i;i=O(d),i===N?~i&&v[i].p(d,p):(u&&(R(),m(v[N],1,1,()=>{v[N]=null}),V()),~i?(u=v[i],u?u.p(d,p):(u=v[i]=F[i](d),u.c()),c(u,1),u.m(y.parentNode,y)):u=null)},i(d){g||(c(n),c(t),c(u),g=!0)},o(d){m(n),m(t),m(u),g=!1},d(d){d&&(h(s),h(a),h(y)),~e&&f[e].d(d),b[o].d(d),~i&&v[i].d(d)}}}function we(r){let e,n,s;return n=new ae({props:{width:r[3],id:r[5],class:r[4]+" fmy-6 fpx-6 fpy-5 border border-solid rounded",$$slots:{default:[be]},$$scope:{ctx:r}}}),{c(){e=T("aside"),w(n.$$.fragment),B(e,"class","infobox svelte-1rkfeqc")},m(o,t){_(o,e,t),k(n,e,null),s=!0},p(o,[t]){const a={};t&8&&(a.width=o[3]),t&32&&(a.id=o[5]),t&16&&(a.class=o[4]+" fmy-6 fpx-6 fpy-5 border border-solid rounded"),t&327&&(a.$$scope={dirty:t,ctx:o}),n.$set(a)},i(o){s||(c(n.$$.fragment,o),s=!0)},o(o){m(n.$$.fragment,o),s=!1},d(o){o&&h(e),$(n)}}}function ke(r,e,n){let{$$slots:s={},$$scope:o}=e;const t=oe(s);let{title:a=null}=e,{text:i=""}=e,{notes:u=null}=e,{width:y="normal"}=e,{class:g=""}=e,{id:l=""}=e;return r.$$set=f=>{"title"in f&&n(0,a=f.title),"text"in f&&n(1,i=f.text),"notes"in f&&n(2,u=f.notes),"width"in f&&n(3,y=f.width),"class"in f&&n(4,g=f.class),"id"in f&&n(5,l=f.id),"$$scope"in f&&n(8,o=f.$$scope)},[a,i,u,y,g,l,t,s,o]}class A extends Q{constructor(e){super(),X(this,e,ke,we,Y,{title:0,text:1,notes:2,width:3,class:4,id:5})}}A.__docgen={version:3,name:"InfoBox.svelte",data:[{keywords:[],visibility:"public",description:"Title of the box",name:"title",kind:"let",static:!1,readonly:!1,type:{kind:"type",text:"object",type:"object"},defaultValue:null},{keywords:[],visibility:"public",description:"Contents of the note as a markdown string",name:"text",kind:"let",static:!1,readonly:!1,type:{kind:"type",text:"string",type:"string"},defaultValue:""},{keywords:[],visibility:"public",description:"Additional footnotes",name:"notes",kind:"let",static:!1,readonly:!1,type:{kind:"type",text:"object",type:"object"},defaultValue:null},{keywords:[{name:"type",description:"{string}"}],visibility:"public",description:"Width of the component within the text well.",name:"width",kind:"let",static:!1,readonly:!1,type:{kind:"type",text:"string",type:"string"},defaultValue:"normal"},{visibility:"public",description:"Add extra classes to the block tag to target it with custom CSS.",keywords:[{name:"type",description:"{string}"}],name:"class",kind:"const",static:!1,readonly:!0,type:{kind:"type",text:"string",type:"string"},localName:"cls",defaultValue:""},{keywords:[{name:"type",description:"{string}"}],visibility:"public",description:"Add an id to the block tag to target it with custom CSS.",name:"id",kind:"let",static:!1,readonly:!1,type:{kind:"type",text:"string",type:"string"},defaultValue:""}],computed:[],methods:[],components:[],description:null,keywords:[],events:[],slots:[{keywords:[],visibility:"public",description:"Custom title content",name:"header"},{keywords:[],visibility:"public",description:"Custom content",name:"body"},{keywords:[],visibility:"public",description:"Custom footer content",name:"footer"}],refs:[]};function $e(r){let e,n;const s=[r[1]];let o={};for(let t=0;t<s.length;t+=1)o=Z(o,s[t]);return e=new A({props:o}),{c(){w(e.$$.fragment)},m(t,a){k(e,t,a),n=!0},p(t,a){const i=a&2?ee(s,[te(t[1])]):{};e.$set(i)},i(t){n||(c(e.$$.fragment,t),n=!0)},o(t){m(e.$$.fragment,t),n=!1},d(t){$(e,t)}}}function ve(r){let e,n,s,o,t,a;return e=new G({props:{text:"If you haven't seen Game of Thrones, go watch it right now. If you have then you'll totally get why this Hodor themed lorem ipsum generator is just brilliant."}}),s=new A({props:{title:"About this data",text:`Reuters is collecting daily COVID-19 infections and deaths data for 240 countries and territories around the world, updated regularly throughout each day.
|
||
|
||
Every country reports those figures a little differently and, inevitably, misses undiagnosed infections and deaths. With this project we are focusing on the trends within countries as they try to contain the virus’ spread, whether they are approaching or past peak infection rates, or if they are seeing a resurgence of infections or deaths.`,notes:"[Read more about our methodology](https://www.reuters.com/world-coronavirus-tracker-and-maps/en/methodology/)"}}),t=new G({props:{text:"In case you don't read Twitter, the news, or just can't get enough of The Apprentice host's legendary oration, try this Trump lorem ipsum generator on for size."}}),{c(){w(e.$$.fragment),n=I(),w(s.$$.fragment),o=I(),w(t.$$.fragment)},m(i,u){k(e,i,u),_(i,n,u),k(s,i,u),_(i,o,u),k(t,i,u),a=!0},p:x,i(i){a||(c(e.$$.fragment,i),c(s.$$.fragment,i),c(t.$$.fragment,i),a=!0)},o(i){m(e.$$.fragment,i),m(s.$$.fragment,i),m(t.$$.fragment,i),a=!1},d(i){i&&(h(n),h(o)),$(e,i),$(s,i),$(t,i)}}}function xe(r){let e,n;return e=new A({props:{title:"What you need to know about the war",text:`- **Food crisis**: [Russia's invasion of Ukraine](#) in late February dramatically worsened the outlook for already inflated global food prices.
|
||
- **Under fire**: Civillian homes destroyed in the conflict and Russia accused of war crimes.
|
||
- **Nordstream sabotage**: A series of clandestine bombings and subsequent underwater gas leaks occurred on the Nord Stream 1 and Nord Stream 2 natural gas pipelines. `}}),{c(){w(e.$$.fragment)},m(s,o){k(e,s,o),n=!0},p:x,i(s){n||(c(e.$$.fragment,s),n=!0)},o(s){m(e.$$.fragment,s),n=!1},d(s){$(e,s)}}}function Ie(r){let e,n,s,o,t,a,i,u;const y=[{title:"Components/InfoBox"},{component:A},r[0]];let g={};for(let l=0;l<y.length;l+=1)g=Z(g,y[l]);return e=new re({props:g}),s=new ie({props:{$$slots:{default:[$e,({args:l})=>({1:l}),({args:l})=>l?2:0]},$$scope:{ctx:r}}}),t=new z({props:{name:"Default",$$slots:{default:[ve]},$$scope:{ctx:r}}}),i=new z({props:{name:"List",$$slots:{default:[xe]},$$scope:{ctx:r}}}),{c(){w(e.$$.fragment),n=I(),w(s.$$.fragment),o=I(),w(t.$$.fragment),a=I(),w(i.$$.fragment)},m(l,f){k(e,l,f),_(l,n,f),k(s,l,f),_(l,o,f),k(t,l,f),_(l,a,f),k(i,l,f),u=!0},p(l,[f]){const S=f&1?ee(y,[y[0],y[1],te(l[0])]):{};e.$set(S);const D={};f&6&&(D.$$scope={dirty:f,ctx:l}),s.$set(D);const b={};f&4&&(b.$$scope={dirty:f,ctx:l}),t.$set(b);const j={};f&4&&(j.$$scope={dirty:f,ctx:l}),i.$set(j)},i(l){u||(c(e.$$.fragment,l),c(s.$$.fragment,l),c(t.$$.fragment,l),c(i.$$.fragment,l),u=!0)},o(l){m(e.$$.fragment,l),m(s.$$.fragment,l),m(t.$$.fragment,l),m(i.$$.fragment,l),u=!1},d(l){l&&(h(n),h(o),h(a)),$(e,l),$(s,l),$(t,l),$(i,l)}}}function Te(r){return[{...le(fe),argTypes:{width:{control:"select",options:["normal","wide","wider","widest","fluid"]}}}]}class Be extends Q{constructor(e){super(),X(this,e,Te,Ie,Y,{})}}const U=se(Be,{meta:{title:"Components/InfoBox"},stories:{"tpl:default":{name:"default",template:!0,source:"<InfoBox {...args} />",hasArgs:!0},Default:{name:"Default",template:!1,source:`<BodyText
|
||
text="If you haven't seen Game of Thrones, go watch it right now. If you have then you'll totally get why this Hodor themed lorem ipsum generator is just brilliant."
|
||
/>
|
||
<InfoBox
|
||
title="About this data"
|
||
text="{'Reuters is collecting daily COVID-19 infections and deaths data for 240 countries and territories around the world, updated regularly throughout each day.
|
||
|
||
Every country reports those figures a little differently and, inevitably, misses undiagnosed infections and deaths. With this project we are focusing on the trends within countries as they try to contain the virus’ spread, whether they are approaching or past peak infection rates, or if they are seeing a resurgence of infections or deaths.'}"
|
||
notes="{'[Read more about our methodology](https://www.reuters.com/world-coronavirus-tracker-and-maps/en/methodology/)'}"
|
||
/>
|
||
<BodyText
|
||
text="In case you don't read Twitter, the news, or just can't get enough of The Apprentice host's legendary oration, try this Trump lorem ipsum generator on for size."
|
||
/>`,hasArgs:!1},List:{name:"List",template:!1,source:`<InfoBox
|
||
title="What you need to know about the war"
|
||
text="{"- **Food crisis**: [Russia's invasion of Ukraine](#) in late February dramatically worsened the outlook for already inflated global food prices.
|
||
- **Under fire**: Civillian homes destroyed in the conflict and Russia accused of war crimes.
|
||
- **Nordstream sabotage**: A series of clandestine bombings and subsequent underwater gas leaks occurred on the Nord Stream 1 and Nord Stream 2 natural gas pipelines. "}"
|
||
/>`,hasArgs:!1}},allocatedIds:["default","Meta","Template","Story","componentDocs","InfoBox","BodyText","withComponentDocs"]}),Ne=U.meta,Re=["Default","List"],Ve=U.stories.Default,He=U.stories.List;export{Ve as Default,He as List,Re as __namedExportsOrder,Ne as default};
|
||
//# sourceMappingURL=InfoBox.stories-895b141a.js.map
|