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

18 lines
9.2 KiB
JavaScript

import{S as ae,i as re,s as fe,w as V,D as j,x as y,y as d,a as T,z as C,g as L,t as g,c as N,b,d as I,K as me,M as O,Y as P,Q as $,E as A,q as Q,u as Y,r as B,v as F,p as ce,j as M,m as q,k as ue,l as de,n as E}from"./index-25af778d.js";import{p as pe,M as ke,T as ge,S as be}from"./collect-stories-cce06d4a.js";import{w as ee}from"./withParams-90715500.js";const te=`> 🔨 **Under construction**: We're working on this component to make it better. Pardon our mess.
Reuters Graphics headline
\`\`\`html
<script>
import { Headline } from '@reuters-graphics/graphics-components';
<\/script>
<Headline
hed="{'Reuters Graphics Interactive'}"
dek="{'The beginning of a beautiful page'}"
section="{'Global news'}"
sectionColour="{'orange'}"
/>
\`\`\`
`,ye=""+new URL("polar-03b9c9c8.jpg",import.meta.url).href,he=s=>({}),le=s=>({}),we=s=>({}),ie=s=>({}),ve=s=>({}),se=s=>({});function Ce(s){let e,i;return{c(){e=V("img"),$(e.src,i=s[5])||y(e,"src",i),y(e,"alt",s[6])},m(t,l){T(t,e,l)},p(t,l){l&32&&!$(e.src,i=t[5])&&y(e,"src",i),l&64&&y(e,"alt",t[6])},i:A,o:A,d(t){t&&I(e)}}}function Se(s){let e;const i=s[14].image,t=Q(i,s,s[13],se);return{c(){t&&t.c()},m(l,n){t&&t.m(l,n),e=!0},p(l,n){t&&t.p&&(!e||n&8192)&&Y(t,i,l,l[13],e?F(i,l[13],n,ve):B(l[13]),se)},i(l){e||(b(t,l),e=!0)},o(l){g(t,l),e=!1},d(l){t&&t.d(l)}}}function ne(s){let e;return{c(){e=V("div"),y(e,"class","overlay"),d(e,"lightest",s[7]==="lightest"),d(e,"lighter",s[7]==="lighter"),d(e,"light",s[7]==="light"),d(e,"dark",s[7]==="dark"),d(e,"darker",s[7]==="darker"),d(e,"darkest",s[7]==="darkest")},m(i,t){T(i,e,t)},p(i,t){t&128&&d(e,"lightest",i[7]==="lightest"),t&128&&d(e,"lighter",i[7]==="lighter"),t&128&&d(e,"light",i[7]==="light"),t&128&&d(e,"dark",i[7]==="dark"),t&128&&d(e,"darker",i[7]==="darker"),t&128&&d(e,"darkest",i[7]==="darkest")},d(i){i&&I(e)}}}function oe(s){let e,i,t;return{c(){e=V("p"),i=O(s[3]),y(e,"class",t=`section-title color-${s[4]} text-shadow`)},m(l,n){T(l,e,n),C(e,i)},p(l,n){n&8&&P(i,l[3]),n&16&&t!==(t=`section-title color-${l[4]} text-shadow`)&&y(e,"class",t)},d(l){l&&I(e)}}}function De(s){let e,i,t;return{c(){e=V("h2"),i=O(s[0]),y(e,"class",t=`text-shadow-darker color-${s[1]} important`)},m(l,n){T(l,e,n),C(e,i)},p(l,n){n&1&&P(i,l[0]),n&2&&t!==(t=`text-shadow-darker color-${l[1]} important`)&&y(e,"class",t)},i:A,o:A,d(l){l&&I(e)}}}function He(s){let e;const i=s[14].hed,t=Q(i,s,s[13],ie);return{c(){t&&t.c()},m(l,n){t&&t.m(l,n),e=!0},p(l,n){t&&t.p&&(!e||n&8192)&&Y(t,i,l,l[13],e?F(i,l[13],n,we):B(l[13]),ie)},i(l){e||(b(t,l),e=!0)},o(l){g(t,l),e=!1},d(l){t&&t.d(l)}}}function Ve(s){let e,i;return{c(){e=V("p"),i=O(s[2]),y(e,"class","text-shadow-darkest")},m(t,l){T(t,e,l),C(e,i)},p(t,l){l&4&&P(i,t[2])},i:A,o:A,d(t){t&&I(e)}}}function Te(s){let e;const i=s[14].dek,t=Q(i,s,s[13],le);return{c(){t&&t.c()},m(l,n){t&&t.m(l,n),e=!0},p(l,n){t&&t.p&&(!e||n&8192)&&Y(t,i,l,l[13],e?F(i,l[13],n,he):B(l[13]),le)},i(l){e||(b(t,l),e=!0)},o(l){g(t,l),e=!1},d(l){t&&t.d(l)}}}function Ie(s){let e,i,t,l,n,p,f,v,o,c,S,u,_,h;const G=[Se,Ce],w=[];function R(r,m){return r[12].image?0:1}t=R(s),l=w[t]=G[t](s);let a=s[7]&&ne(s),k=s[3]&&oe(s);const J=[He,De],D=[];function X(r,m){return r[12].hed?0:1}o=X(s),c=D[o]=J[o](s);const Z=[Te,Ve],H=[];function x(r,m){return r[12].dek?0:r[2]?1:-1}return~(u=x(s))&&(_=H[u]=Z[u](s)),{c(){e=V("section"),i=V("figure"),l.c(),n=j(),a&&a.c(),p=j(),f=V("div"),k&&k.c(),v=j(),c.c(),S=j(),_&&_.c(),y(f,"class","title color-white"),d(f,"top",s[8]),d(f,"bottom",s[9]),d(f,"left",s[10]),d(f,"right",s[11]),y(e,"class","hero-title")},m(r,m){T(r,e,m),C(e,i),w[t].m(i,null),C(i,n),a&&a.m(i,null),C(e,p),C(e,f),k&&k.m(f,null),C(f,v),D[o].m(f,null),C(f,S),~u&&H[u].m(f,null),h=!0},p(r,[m]){let W=t;t=R(r),t===W?w[t].p(r,m):(L(),g(w[W],1,1,()=>{w[W]=null}),N(),l=w[t],l?l.p(r,m):(l=w[t]=G[t](r),l.c()),b(l,1),l.m(i,n)),r[7]?a?a.p(r,m):(a=ne(r),a.c(),a.m(i,null)):a&&(a.d(1),a=null),r[3]?k?k.p(r,m):(k=oe(r),k.c(),k.m(f,v)):k&&(k.d(1),k=null);let z=o;o=X(r),o===z?D[o].p(r,m):(L(),g(D[z],1,1,()=>{D[z]=null}),N(),c=D[o],c?c.p(r,m):(c=D[o]=J[o](r),c.c()),b(c,1),c.m(f,S));let K=u;u=x(r),u===K?~u&&H[u].p(r,m):(_&&(L(),g(H[K],1,1,()=>{H[K]=null}),N()),~u?(_=H[u],_?_.p(r,m):(_=H[u]=Z[u](r),_.c()),b(_,1),_.m(f,null)):_=null),(!h||m&256)&&d(f,"top",r[8]),(!h||m&512)&&d(f,"bottom",r[9]),(!h||m&1024)&&d(f,"left",r[10]),(!h||m&2048)&&d(f,"right",r[11])},i(r){h||(b(l),b(c),b(_),h=!0)},o(r){g(l),g(c),g(_),h=!1},d(r){r&&I(e),w[t].d(),a&&a.d(),k&&k.d(),D[o].d(),~u&&H[u].d()}}}function je(s,e,i){let{$$slots:t={},$$scope:l}=e;const n=me(t);let{hed:p="Reuters Graphics Interactive"}=e,{hedColour:f="white"}=e,{dek:v=null}=e,{section:o=null}=e,{sectionColour:c="red"}=e,{imgSrc:S}=e,{imgAltText:u}=e,{overlay:_=!0}=e,{top:h=!1}=e,{bottom:G=!1}=e,{left:w=!1}=e,{right:R=!1}=e;return s.$$set=a=>{"hed"in a&&i(0,p=a.hed),"hedColour"in a&&i(1,f=a.hedColour),"dek"in a&&i(2,v=a.dek),"section"in a&&i(3,o=a.section),"sectionColour"in a&&i(4,c=a.sectionColour),"imgSrc"in a&&i(5,S=a.imgSrc),"imgAltText"in a&&i(6,u=a.imgAltText),"overlay"in a&&i(7,_=a.overlay),"top"in a&&i(8,h=a.top),"bottom"in a&&i(9,G=a.bottom),"left"in a&&i(10,w=a.left),"right"in a&&i(11,R=a.right),"$$scope"in a&&i(13,l=a.$$scope)},[p,f,v,o,c,S,u,_,h,G,w,R,n,l,t]}class U extends ae{constructor(e){super(),re(this,e,je,Ie,fe,{hed:0,hedColour:1,dek:2,section:3,sectionColour:4,imgSrc:5,imgAltText:6,overlay:7,top:8,bottom:9,left:10,right:11})}}U.__docgen={version:3,name:"Hero.svelte",data:[{keywords:[],visibility:"public",description:"Headline",name:"hed",kind:"let",static:!1,readonly:!1,type:{kind:"type",text:"string",type:"string"},defaultValue:"Reuters Graphics Interactive"},{keywords:[],visibility:"public",description:"Hedline colour",name:"hedColour",kind:"let",static:!1,readonly:!1,type:{kind:"type",text:"string",type:"string"},defaultValue:"white"},{keywords:[],visibility:"public",description:"Dek",name:"dek",kind:"let",static:!1,readonly:!1,type:{kind:"type",text:"object",type:"object"},defaultValue:null},{keywords:[],visibility:"public",description:"Section title",name:"section",kind:"let",static:!1,readonly:!1,type:{kind:"type",text:"object",type:"object"},defaultValue:null},{keywords:[],visibility:"public",description:"Section colour",name:"sectionColour",kind:"let",static:!1,readonly:!1,type:{kind:"type",text:"string",type:"string"},defaultValue:"red"},{visibility:"public",description:null,keywords:[],name:"imgSrc",kind:"let",static:!1,readonly:!1,type:{kind:"type",text:"any",type:"any"}},{visibility:"public",description:null,keywords:[],name:"imgAltText",kind:"let",static:!1,readonly:!1,type:{kind:"type",text:"any",type:"any"}},{visibility:"public",description:null,keywords:[],name:"overlay",kind:"let",static:!1,readonly:!1,type:{kind:"type",text:"boolean",type:"boolean"},defaultValue:!0},{visibility:"public",description:null,keywords:[],name:"top",kind:"let",static:!1,readonly:!1,type:{kind:"type",text:"boolean",type:"boolean"},defaultValue:!1},{visibility:"public",description:null,keywords:[],name:"bottom",kind:"let",static:!1,readonly:!1,type:{kind:"type",text:"boolean",type:"boolean"},defaultValue:!1},{visibility:"public",description:null,keywords:[],name:"left",kind:"let",static:!1,readonly:!1,type:{kind:"type",text:"boolean",type:"boolean"},defaultValue:!1},{visibility:"public",description:null,keywords:[],name:"right",kind:"let",static:!1,readonly:!1,type:{kind:"type",text:"boolean",type:"boolean"},defaultValue:!1}],computed:[],methods:[],components:[],description:null,keywords:[],events:[],slots:[{keywords:[],visibility:"public",description:"",name:"image"},{keywords:[],visibility:"public",description:"",name:"hed"},{keywords:[],visibility:"public",description:"",name:"dek"}],refs:[]};function Ae(s){let e,i;const t=[s[0]];let l={};for(let n=0;n<t.length;n+=1)l=ce(l,t[n]);return e=new U({props:l}),{c(){M(e.$$.fragment)},m(n,p){q(e,n,p),i=!0},p(n,p){const f=p&1?ue(t,[de(n[0])]):{};e.$set(f)},i(n){i||(b(e.$$.fragment,n),i=!0)},o(n){g(e.$$.fragment,n),i=!1},d(n){E(e,n)}}}function Ge(s){let e,i,t,l,n,p;const f=[{title:"Components/Hero"},{component:U},ee(te)];let v={};for(let o=0;o<f.length;o+=1)v=ce(v,f[o]);return e=new ke({props:v}),t=new ge({props:{$$slots:{default:[Ae,({args:o})=>({0:o}),({args:o})=>o?1:0]},$$scope:{ctx:s}}}),n=new be({props:{name:"Default",args:{section:"World News",hed:"Reuters Graphics interactive",imgSrc:ye}}}),{c(){M(e.$$.fragment),i=j(),M(t.$$.fragment),l=j(),M(n.$$.fragment)},m(o,c){q(e,o,c),T(o,i,c),q(t,o,c),T(o,l,c),q(n,o,c),p=!0},p(o,[c]){const S=c&0?ue(f,[f[0],c&0&&{component:U},c&0&&de(ee(te))]):{};e.$set(S);const u={};c&3&&(u.$$scope={dirty:c,ctx:o}),t.$set(u)},i(o){p||(b(e.$$.fragment,o),b(t.$$.fragment,o),b(n.$$.fragment,o),p=!0)},o(o){g(e.$$.fragment,o),g(t.$$.fragment,o),g(n.$$.fragment,o),p=!1},d(o){E(e,o),o&&I(i),E(t,o),o&&I(l),E(n,o)}}}class Re extends ae{constructor(e){super(),re(this,e,null,Ge,fe,{})}}const _e=pe(Re,{meta:{title:"Components/Hero"},stories:{"tpl:default":{storyId:"components-hero--default",name:"default",template:!0,source:"<Hero {...args} />",hasArgs:!0},Default:{storyId:"components-hero--default",name:"Default",template:!1,hasArgs:!1}},allocatedIds:["default","Meta","Template","Story","componentDocs","polarImgSrc","Hero","withComponentDocs"]}),Ue=_e.meta,We=["Default"],ze=_e.stories.Default;export{ze as Default,We as __namedExportsOrder,Ue as default};
//# sourceMappingURL=Hero.stories-e1cf2fc4.js.map