@devgateway/dvz-ui-react 1.6.7 → 1.6.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),d=require("react"),o=require("semantic-ui-react"),m=require("@devgateway/wp-react-lib"),S=require("../connected-templates/PostIntro.js"),_=require("../../lib/hooks/window-dimensions.js"),M=require("react-redux"),T=({post:n,onClick:x,active:a,moreLabel:l})=>{const f=n._embedded?n._embedded["wp:featuredmedia"]:null;return e.jsxs("div",{className:"cover",style:{backgroundImage:`url(${f?f[0].source_url:""})`},children:[e.jsx(S.default,{post:n}),a?e.jsxs(o.Label,{onClick:x,children:[e.jsx(o.Icon,{name:"arrow alternate circle left outline",size:"large"})," Back "]}):e.jsxs(o.Label,{onClick:x,children:[e.jsx(o.Icon,{name:"search",size:"large"})," ",l]})]})},L=({post:n})=>{const l=new DOMParser().parseFromString(n.content.rendered,"text/html").querySelector("figure");return l?e.jsx("div",{style:{flex:"0 0 40px"},dangerouslySetInnerHTML:{__html:l.outerHTML}}):null},A=({posts:n,width:x,height:a,color:l,moreLabel:f,closeLabel:j})=>{const[s,h]=d.useState(null),[y,b]=d.useState(!1),[p,v]=d.useState([0,0]),c=l.split(","),g=i=>{y?(b(!1),h(i)):(h(i),b(!0))};return d.useEffect(()=>{s&&v([window.scrollX,window.scrollY]),s==null&&window.scrollTo(p[0],p[1])},[s]),d.useEffect(()=>{window.setTimeout(()=>{if(window.location.hash){const i=window.location.hash.substr(1),t=document.getElementById(i);t&&n&&n.map(r=>r.slug).indexOf(i)>-1&&(h(i),t.scrollIntoView({behavior:"auto",block:"start"}))}},0)},[n]),e.jsx(o.Container,{fluid:!0,className:"featured tabs",style:{minHeight:`${a}px`},children:e.jsx(o.Grid,{stackable:!0,columns:s!=null?1:n==null?void 0:n.length,className:"desktop",children:n==null?void 0:n.map((i,t)=>{var r;return e.jsxs(d.Fragment,{children:[e.jsxs(o.Grid.Column,{style:s==null?{display:"block",visibility:"visible",backgroundColor:c[t]}:{display:"none",visibility:"hidden"},children:[e.jsx("a",{id:i.slug}),e.jsx(T,{post:i,moreLabel:f,onClick:()=>g(i.slug)})]}),e.jsxs(o.Grid.Column,{className:"expanded",style:s!=i.slug?{display:"none",visibility:"hidden"}:{display:"block",visibility:"visible"},children:[e.jsxs(o.Segment,{style:{backgroundColor:c[t]},children:[((r=i.meta_fields)==null?void 0:r.icon)&&e.jsx(m.MediaProvider,{id:i.meta_fields?i.meta_fields.icon[0]:null,children:e.jsx(m.MediaConsumer,{children:e.jsx(m.PostIcon,{})})}),e.jsx(m.PostTitle,{as:"h2",post:i,className:"has-standard-36-font-size has-white-color"}),e.jsx(o.Label,{className:"closeIcon",onClick:()=>h(null),children:e.jsx(o.Icon,{name:"times circle outline",size:"large"})})]}),e.jsx(m.PostContent,{as:"div",fluid:!0,post:i,style:{maxHeight:`calc(${a}px - 150px)`}}),e.jsxs(o.Label,{className:"closeIconText",style:{backgroundColor:`${c[t]}`},onClick:()=>h(null),children:[e.jsx(o.Icon,{name:"times circle outline",size:"large"})," ",j||"Close"," "]})]})]},i.slug)})})})},q=({posts:n,activeItem:x,setActive:a,color:l})=>{const[f,j]=d.useState(n.findIndex(t=>t.slug===x)),[s,h]=d.useState(null),y=l.split(","),b=()=>{var t;return((t=window.screen.orientation)==null?void 0:t.type)||(window.innerWidth>window.innerHeight?"landscape-primary":"portrait-primary")},[p,v]=d.useState(b()),c=()=>{setTimeout(()=>{v(b())},100)},g=(t,r,u)=>{document.querySelectorAll(t).forEach(C=>{C.querySelector(r)&&C.classList.add(u)})};d.useEffect(()=>{if(s){const t=s.getBoundingClientRect().top+window.scrollY;window.scrollTo({top:t,behavior:"smooth"})}g(".ui.fluid.container.viz.featured.tabs",".accordion .accordion-post-ft-title","has-accordion-title"),g(".ui.fluid.container.viz.featured.tabs",".accordion .accordion-post-vft-content","has-accordion-content"),g(".ui.fluid.container.viz.featured.tabs","blockquote","has-blockquote"),g(".ui.fluid.container.viz.featured.tabs",".vt-accordion-post-intro figure","has-vt-accordion-figure"),g(".ui.fluid.container.viz.featured.tabs",".content.active.accordion-post-content .wp-block-columns","has-wp-block-columns")},[s]),d.useEffect(()=>(window.screen.orientation&&window.screen.orientation.addEventListener("change",c),window.addEventListener("resize",c),()=>{window.removeEventListener("resize",c),window.screen.orientation&&window.screen.orientation.removeEventListener("change",c)}),[]);const i=(t,r)=>{const{index:u}=r,w=f===u?-1:u;j(w),a(n[u].slug),w!==-1&&h(t.currentTarget)};return e.jsx(o.Accordion,{fluid:!0,styled:!0,children:n.map((t,r)=>{var w;const u=(w=t.meta_fields)!=null&&w.icon?t.meta_fields.icon[0]:null;return e.jsxs(d.Fragment,{children:[e.jsx(o.Accordion.Title,{active:f===r,index:r,onClick:i,style:{backgroundColor:y[r]},children:e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[u&&e.jsx(m.MediaProvider,{id:u,children:e.jsx(m.MediaConsumer,{children:e.jsx(m.PostIcon,{className:"icon"})})}),!u&&e.jsx(L,{post:t}),e.jsx("p",{className:"accordion-post-ft-title",dangerouslySetInnerHTML:{__html:t.title.rendered},style:{marginLeft:"10px"}})]}),e.jsx(o.Icon,{name:"chevron down"})]})}),e.jsx(o.Accordion.Content,{className:"accordion-post-ft-content",active:f===r,children:e.jsx(m.PostContent,{post:t})})]},t.id)})})},z=n=>{var I;let{"data-width":x,"data-height":a,"data-type":l,"data-taxonomy":f,"data-categories":j,"data-items":s,"data-color":h,"data-use-scrolls":y,"data-read-more-label":b="READ More","data-close-label":p="Close","data-preview-mode":v="Desktop",editing:c,parent:g,unique:i,pageModuleProps:t}=n;const r=n.intl.locale;t!=null&&t.editing&&(t!=null&&t.previewMode)&&(c=t.editing,v=t.previewMode);const u=y=="true",{width:w}=_.useWindowDimensionsAndDevice(),C=w<=1250,k=v!=="Desktop"&&c,P=C&&!c;return e.jsx(o.Container,{className:`viz featured tabs ${c?"editing":""} ${u?"scrollable":""}`,fluid:!0,children:e.jsx(m.PostProvider,{locale:r,type:l,taxonomy:f,categories:j,store:`tabbedposts_${g}_${i}`,page:1,perPage:s,children:e.jsx(m.PostConsumer,{children:k||P?e.jsx(q,{posts:s,activeItem:(I=s==null?void 0:s[0])==null?void 0:I.slug,color:h,setActive:()=>{}}):e.jsx(A,{moreLabel:b,closeLabel:p,color:h,width:x,height:a})})})})},E=(n,x)=>{const a=n.getIn(["data","pageModuleProps"]),l={};return a&&(l.pageModuleProps=a),l},N={},D=M.connect(E,N)(z);exports.default=D;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),m=require("react"),s=require("semantic-ui-react"),d=require("@devgateway/wp-react-lib"),S=require("../connected-templates/PostIntro.js"),_=require("../../lib/hooks/window-dimensions.js"),M=require("react-redux"),T=({post:n,onClick:x,active:u,moreLabel:l,mediaData:f})=>{const g=n._embedded?n._embedded["wp:featuredmedia"]:null,o=f?f.source_url:g&&g.length>0?g[0].source_url:null;return e.jsxs("div",{className:"cover",style:{backgroundImage:`url(${o||""})`},children:[e.jsx(S.default,{post:n}),u?e.jsxs(s.Label,{onClick:x,children:[e.jsx(s.Icon,{name:"arrow alternate circle left outline",size:"large"})," Back "]}):e.jsxs(s.Label,{onClick:x,children:[e.jsx(s.Icon,{name:"search",size:"large"})," ",l]})]})},L=({post:n})=>{const l=new DOMParser().parseFromString(n.content.rendered,"text/html").querySelector("figure");return l?e.jsx("div",{style:{flex:"0 0 40px"},dangerouslySetInnerHTML:{__html:l.outerHTML}}):null},A=({posts:n,width:x,height:u,color:l,moreLabel:f,closeLabel:g})=>{const[o,h]=m.useState(null),[y,b]=m.useState(!1),[p,j]=m.useState([0,0]),c=l.split(","),w=i=>{y?(b(!1),h(i)):(h(i),b(!0))};return m.useEffect(()=>{o&&j([window.scrollX,window.scrollY]),o==null&&window.scrollTo(p[0],p[1])},[o]),m.useEffect(()=>{window.setTimeout(()=>{if(window.location.hash){const i=window.location.hash.substr(1),t=document.getElementById(i);t&&n&&n.map(r=>r.slug).indexOf(i)>-1&&(h(i),t.scrollIntoView({behavior:"auto",block:"start"}))}},0)},[n]),e.jsx(s.Container,{fluid:!0,className:"featured tabs",style:{minHeight:`${u}px`},children:e.jsx(s.Grid,{stackable:!0,columns:o!=null?1:n==null?void 0:n.length,className:"desktop",children:n==null?void 0:n.map((i,t)=>{var r;return e.jsxs(m.Fragment,{children:[e.jsxs(s.Grid.Column,{style:o==null?{display:"block",visibility:"visible",backgroundColor:c[t]}:{display:"none",visibility:"hidden"},children:[e.jsx("a",{id:i.slug}),e.jsx(d.MediaProvider,{id:i.featured_media,children:e.jsx(d.MediaContext.Consumer,{children:({media:a})=>e.jsx(T,{post:i,mediaData:a,moreLabel:f,onClick:()=>w(i.slug)})})})]}),e.jsxs(s.Grid.Column,{className:"expanded",style:o!=i.slug?{display:"none",visibility:"hidden"}:{display:"block",visibility:"visible"},children:[e.jsxs(s.Segment,{style:{backgroundColor:c[t]},children:[((r=i.meta_fields)==null?void 0:r.icon)&&e.jsx(d.MediaProvider,{id:i.meta_fields?i.meta_fields.icon[0]:null,children:e.jsx(d.MediaConsumer,{children:e.jsx(d.PostIcon,{})})}),e.jsx(d.PostTitle,{as:"h2",post:i,className:"has-standard-36-font-size has-white-color"}),e.jsx(s.Label,{className:"closeIcon",onClick:()=>h(null),children:e.jsx(s.Icon,{name:"times circle outline",size:"large"})})]}),e.jsx(d.PostContent,{as:"div",fluid:!0,post:i,style:{maxHeight:`calc(${u}px - 150px)`}}),e.jsxs(s.Label,{className:"closeIconText",style:{backgroundColor:`${c[t]}`},onClick:()=>h(null),children:[e.jsx(s.Icon,{name:"times circle outline",size:"large"})," ",g||"Close"," "]})]})]},i.slug)})})})},q=({posts:n,activeItem:x,setActive:u,color:l})=>{const[f,g]=m.useState(n.findIndex(t=>t.slug===x)),[o,h]=m.useState(null),y=l.split(","),b=()=>{var t;return((t=window.screen.orientation)==null?void 0:t.type)||(window.innerWidth>window.innerHeight?"landscape-primary":"portrait-primary")},[p,j]=m.useState(b()),c=()=>{setTimeout(()=>{j(b())},100)},w=(t,r,a)=>{document.querySelectorAll(t).forEach(C=>{C.querySelector(r)&&C.classList.add(a)})};m.useEffect(()=>{if(o){const t=o.getBoundingClientRect().top+window.scrollY;window.scrollTo({top:t,behavior:"smooth"})}w(".ui.fluid.container.viz.featured.tabs",".accordion .accordion-post-ft-title","has-accordion-title"),w(".ui.fluid.container.viz.featured.tabs",".accordion .accordion-post-vft-content","has-accordion-content"),w(".ui.fluid.container.viz.featured.tabs","blockquote","has-blockquote"),w(".ui.fluid.container.viz.featured.tabs",".vt-accordion-post-intro figure","has-vt-accordion-figure"),w(".ui.fluid.container.viz.featured.tabs",".content.active.accordion-post-content .wp-block-columns","has-wp-block-columns")},[o]),m.useEffect(()=>(window.screen.orientation&&window.screen.orientation.addEventListener("change",c),window.addEventListener("resize",c),()=>{window.removeEventListener("resize",c),window.screen.orientation&&window.screen.orientation.removeEventListener("change",c)}),[]);const i=(t,r)=>{const{index:a}=r,v=f===a?-1:a;g(v),u(n[a].slug),v!==-1&&h(t.currentTarget)};return e.jsx(s.Accordion,{fluid:!0,styled:!0,children:n.map((t,r)=>{var v;const a=(v=t.meta_fields)!=null&&v.icon?t.meta_fields.icon[0]:null;return e.jsxs(m.Fragment,{children:[e.jsx(s.Accordion.Title,{active:f===r,index:r,onClick:i,style:{backgroundColor:y[r]},children:e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[a&&e.jsx(d.MediaProvider,{id:a,children:e.jsx(d.MediaConsumer,{children:e.jsx(d.PostIcon,{className:"icon"})})}),!a&&e.jsx(L,{post:t}),e.jsx("p",{className:"accordion-post-ft-title",dangerouslySetInnerHTML:{__html:t.title.rendered},style:{marginLeft:"10px"}})]}),e.jsx(s.Icon,{name:"chevron down"})]})}),e.jsx(s.Accordion.Content,{className:"accordion-post-ft-content",active:f===r,children:e.jsx(d.PostContent,{post:t})})]},t.id)})})},z=n=>{var I;let{"data-width":x,"data-height":u,"data-type":l,"data-taxonomy":f,"data-categories":g,"data-items":o,"data-color":h,"data-use-scrolls":y,"data-read-more-label":b="READ More","data-close-label":p="Close","data-preview-mode":j="Desktop",editing:c,parent:w,unique:i,pageModuleProps:t}=n;const r=n.intl.locale;t!=null&&t.editing&&(t!=null&&t.previewMode)&&(c=t.editing,j=t.previewMode);const a=y=="true",{width:v}=_.useWindowDimensionsAndDevice(),C=v<=1250,P=j!=="Desktop"&&c,k=C&&!c;return e.jsx(s.Container,{className:`viz featured tabs ${c?"editing":""} ${a?"scrollable":""}`,fluid:!0,children:e.jsx(d.PostProvider,{locale:r,type:l,taxonomy:f,categories:g,store:`tabbedposts_${w}_${i}`,page:1,perPage:o,children:e.jsx(d.PostConsumer,{children:P||k?e.jsx(q,{posts:o,activeItem:(I=o==null?void 0:o[0])==null?void 0:I.slug,color:h,setActive:()=>{}}):e.jsx(A,{moreLabel:b,closeLabel:p,color:h,width:x,height:u})})})})},E=(n,x)=>{const u=n.getIn(["data","pageModuleProps"]),l={};return u&&(l.pageModuleProps=u),l},N={},D=M.connect(E,N)(z);exports.default=D;
@@ -1,3 +1,3 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),u=require("semantic-ui-react"),i=require("react"),x=require("@devgateway/wp-react-lib"),L=require("react-intl"),C=require("react-router"),T=require("./SearchControl.js"),$=require("./LangSwitcher.js"),D=(n,r)=>{const c=[];return n.items.forEach(l=>{l.child_items?l.child_items.forEach(a=>{a.slug==r.slug&&(c.push(l),c.push(a))}):l.slug==r.slug&&l.url!="/"&&c.push(l)}),c},M=(n,r)=>{if(n){const c=n.indexOf("/wp");if(c!==-1){const l=n.substr(c+3);return l.startsWith("/"+r)?l:"/"+r+l}else return n.startsWith("/"+r)?n:"/"+r+n}return""},O=L.injectIntl(({menu:n,intl:r})=>{const c=C.useParams(),l=D(n,c);return e.jsx(i.Fragment,{children:l.filter(a=>a.url!="#wpm-languages").map(a=>a.child_items?e.jsxs("span",{children:[a.post_title," "]}):e.jsxs("a",{className:a.slug==c.slug?"active":"",href:x.utils.replaceLink(a.url,r.locale),children:[" ",a.post_title]}))})}),N=L.injectIntl(({settings:n,withIcons:r,active:c,menu:l,onSetSelected:a,selected:d,intl:{locale:j},isSmallScreen:S})=>{const b=C.useParams();i.useEffect(s=>{if(!d){const t=D(l,b).filter(f=>f.menu_item_parent==0);t&&a(t[0])}},[l,a,d]);const[g,_]=i.useState(null);i.useEffect(()=>{_(l)},[l]),i.useEffect(()=>{if(n&&n.menu_settings&&g){const s=[],h=l.items.map(t=>(n.menu_settings&&n.menu_settings["nav_menu_item["+t.ID+"]"]===!1&&s.push(t.ID),n.menu_settings&&n.menu_settings["nav_menu_item["+t.ID+"]"]?(n.menu_settings["nav_menu_item["+t.ID+"]"],{...t,...n.menu_settings["nav_menu_item["+t.ID+"]"]}):t));Object.keys(n.menu_settings).map(t=>{const f=n.menu_settings[t];if(f.type=="nav_menu_item"){const E=/(-)?[0-9]+/g.exec(t),w=parseInt(E[0]);h.find(o=>o.ID==w)||h.push(f.value)}}),_({...l,items:h.filter(t=>s.indexOf(t.ID)===-1)})}},[n]);const[p,v]=i.useState(!1);return i.useEffect(()=>{const s=()=>{v(window.innerWidth<=1200)};return s(),window.addEventListener("resize",s),()=>window.removeEventListener("resize",s)},[]),g&&e.jsx(i.Fragment,{children:g.items.filter(s=>s.url!=="#wpm-languages").map((s,h)=>e.jsxs(i.Fragment,{children:[e.jsxs(u.Menu.Item,{className:`divided ${s.child_items?"has-child-items":""}
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),u=require("semantic-ui-react"),i=require("react"),x=require("@devgateway/wp-react-lib"),L=require("react-intl"),C=require("react-router"),T=require("./SearchControl.js"),$=require("./LangSwitcher.js"),k=(n,r)=>{const c=[];return n.items.forEach(l=>{l.child_items?l.child_items.forEach(a=>{a.slug==r.slug&&(c.push(l),c.push(a))}):l.slug==r.slug&&l.url!="/"&&c.push(l)}),c},E=(n,r)=>{if(n){const c=n.indexOf("/wp");if(c!==-1){const l=n.substr(c+3);return l.startsWith("/"+r)?l:"/"+r+l}else return n.startsWith("/"+r)?n:"/"+r+n}return""},O=L.injectIntl(({menu:n,intl:r})=>{const c=C.useParams(),l=k(n,c);return e.jsx(i.Fragment,{children:l.filter(a=>a.url!="#wpm-languages").map(a=>a.child_items?e.jsxs("span",{children:[a.post_title," "]}):e.jsxs("a",{className:a.slug==c.slug?"active":"",href:x.utils.replaceLink(a.url,r.locale),children:[" ",a.post_title]}))})}),N=L.injectIntl(({settings:n,withIcons:r,active:c,menu:l,onSetSelected:a,selected:d,intl:{locale:j},isSmallScreen:S})=>{const w=C.useParams();i.useEffect(s=>{const t=k(l,w).filter(f=>f.menu_item_parent==0);t&&t.length>0?a(t[0]):a(null)},[l,a,w.slug]);const[g,_]=i.useState(null);i.useEffect(()=>{_(l)},[l]),i.useEffect(()=>{if(n&&n.menu_settings&&g){const s=[],h=l.items.map(t=>(n.menu_settings&&n.menu_settings["nav_menu_item["+t.ID+"]"]===!1&&s.push(t.ID),n.menu_settings&&n.menu_settings["nav_menu_item["+t.ID+"]"]?(n.menu_settings["nav_menu_item["+t.ID+"]"],{...t,...n.menu_settings["nav_menu_item["+t.ID+"]"]}):t));Object.keys(n.menu_settings).map(t=>{const f=n.menu_settings[t];if(f.type=="nav_menu_item"){const b=/(-)?[0-9]+/g.exec(t),M=parseInt(b[0]);h.find(o=>o.ID==M)||h.push(f.value)}}),_({...l,items:h.filter(t=>s.indexOf(t.ID)===-1)})}},[n]);const[p,v]=i.useState(!1);return i.useEffect(()=>{const s=()=>{v(window.innerWidth<=1200)};return s(),window.addEventListener("resize",s),()=>window.removeEventListener("resize",s)},[]),g&&e.jsx(i.Fragment,{children:g.items.filter(s=>s.url!=="#wpm-languages").map((s,h)=>e.jsxs(i.Fragment,{children:[e.jsxs(u.Menu.Item,{className:`divided ${s.child_items?"has-child-items":""}
2
2
  ${d&&d.ID===s.ID?"selected":""}
3
- ${c===s.slug?"active":""}`,children:[r&&e.jsx("a",{href:M(s.url,j),children:e.jsx("div",{className:"mark",children:e.jsx("span",{className:"sr-only",children:s.title})})}),S?s.child_items?e.jsx("span",{onClick:()=>a(d===s?null:s),children:s.title}):e.jsx("a",{href:M(s.url,j),children:s.title}):s.child_items?e.jsx("span",{onMouseOver:t=>a(s),children:s.title}):e.jsx("a",{onMouseOut:t=>a(null),onMouseOver:t=>a(s),href:M(s.url,j),children:s.title})]}),p&&d&&d.ID===s.ID&&d.child_items&&e.jsx(i.Fragment,{children:d.child_items.map(t=>e.jsxs(u.Menu.Item,{className:`divided child-item ${c===t.slug?"active":""}`,children:[e.jsx("div",{className:"mark"}),e.jsx("a",{href:M(t.url,j),children:t.title})]},t.ID))})]},s.ID))})}),q=({intl:n,settings:r})=>{const[c,l]=i.useState(),[a,d]=i.useState(!1),[j,S]=i.useState(!1),[b,g]=i.useState(!1),[_,p]=i.useState(!1),{slug:v}=C.useParams(),s=i.useRef(null),h=i.useRef(null),t=()=>{p(!_),d(!a)};i.useEffect(()=>{const o=m=>{(s.current&&!s.current.contains(m.target)&&!h.current.contains(m.target)||m.target.closest(".desktop")||m.target.closest(".breadcrumbs"))&&(d(!1),p(!1))},I=m=>{m.key==="Escape"&&(d(!1),p(!1))};return document.addEventListener("mousedown",o),document.addEventListener("keydown",I),()=>{document.removeEventListener("mousedown",o),document.removeEventListener("keydown",I)}},[]),i.useEffect(()=>{let o;const I=()=>{const k=window.innerWidth<=1200;S(k),g(!1)},m=()=>{g(!0),clearTimeout(o),o=setTimeout(I,300)};return I(),window.addEventListener("resize",m),()=>{clearTimeout(o),window.removeEventListener("resize",m)}},[]);const[f,z]=i.useState(!1);i.useEffect(()=>{const o=()=>{z(window.innerWidth<=1364)};return o(),window.addEventListener("resize",o),()=>window.removeEventListener("resize",o)},[]);const E=({media:o})=>o?e.jsx(u.Image,{src:o.guid.rendered}):e.jsx("img",{className:"brand logo",size:"large",src:"/logo_full.png"}),w=(r==null?void 0:r.landing_page_url)&&r.landing_page_url!==!1&&r.landing_page_url!==void 0&&r.landing_page_url!=="",R=w?r.landing_page_url:`/${n.locale}`;return console.log("isMenuVisible",a),e.jsx(i.Fragment,{children:e.jsxs(x.MenuProvider,{slug:"main",locale:n.locale,children:[e.jsxs(u.Container,{fluid:!0,className:"header",children:[e.jsx(u.Container,{fluid:!0,className:"background",ref:s,children:e.jsxs(u.Menu,{className:"branding",text:!0,children:[e.jsx(u.Menu.Item,{children:e.jsxs("a",{href:`${R}`,target:w?"_blank":"_self",rel:"noopener noreferrer",id:"site_url",children:[r.site_logo!==0&&!f&&e.jsx(x.MediaProvider,{id:r.site_logo,children:e.jsx(x.MediaConsumer,{children:e.jsx(E,{},"logo")})}),r.site_logo===0&&!f&&e.jsx("img",{className:"brand logo",size:"large",src:"/logo_full.png"}),f&&e.jsx("img",{className:"brand logo small",size:"small",src:"/wp-media/TCDI-Icon-small_02.png"})]})}),e.jsx(u.Menu.Item,{className:"divider",children:e.jsx("div",{})}),e.jsxs(u.Menu.Item,{fitted:!0,href:"/",children:[e.jsx(u.Flag,{name:"za"}),e.jsx("div",{className:"site name",children:r.name})]}),!b&&(j?e.jsx(u.Menu,{className:`pages ${a?"show":""}`,children:e.jsx(u.Container,{fluid:!0,children:e.jsx(x.MenuConsumer,{children:e.jsx(N,{settings:r,active:v,selected:c,onSetSelected:l,isSmallScreen:j},"items")})})}):e.jsx(u.Menu.Menu,{className:"pages",children:e.jsx(x.MenuConsumer,{children:e.jsx(N,{settings:r,active:v,selected:c,onSetSelected:l},"items")})})),e.jsx(u.Menu.Item,{children:e.jsx(x.MenuConsumer,{children:e.jsx($.default,{locale:n.locale},"lang")})}),e.jsx(u.Menu.Item,{fitted:!0,children:e.jsx(T.default,{onSetSelected:l,settings:r})}),e.jsxs("div",{ref:h,className:`hamburger-menu ${_?"animate":""} ${a?"open":"close"}`,onClick:t,children:[e.jsx("div",{}),e.jsx("div",{className:"middle-line"}),e.jsx("div",{})]})]})}),e.jsx(u.Container,{fluid:!0,className:"child",children:c&&c.child_items&&e.jsx(u.Menu,{fluid:!0,text:!0,children:e.jsx(N,{active:v,locale:n.locale,withIcons:!0,onSetSelected:o=>null,menu:{items:c.child_items}})})})]},"header-container"),e.jsx(u.Container,{className:"url breadcrumbs",children:e.jsx(x.MenuConsumer,{children:e.jsx(O,{})})})]})})},y=L.injectIntl(q);exports.default=y;
3
+ ${c===s.slug?"active":""}`,children:[r&&e.jsx("a",{href:E(s.url,j),children:e.jsx("div",{className:"mark",children:e.jsx("span",{className:"sr-only",children:s.title})})}),S?s.child_items?e.jsx("span",{onClick:()=>a(d===s?null:s),children:s.title}):e.jsx("a",{href:E(s.url,j),children:s.title}):s.child_items?e.jsx("span",{onMouseOver:t=>a(s),onClick:()=>a(d===s?null:s),children:s.title}):e.jsx("a",{onMouseOut:t=>a(null),onMouseOver:t=>a(s),href:E(s.url,j),children:s.title})]}),p&&d&&d.ID===s.ID&&d.child_items&&e.jsx(i.Fragment,{children:d.child_items.map(t=>e.jsxs(u.Menu.Item,{className:`divided child-item ${c===t.slug?"active":""}`,children:[e.jsx("div",{className:"mark"}),e.jsx("a",{href:E(t.url,j),children:t.title})]},t.ID))})]},s.ID))})}),q=({intl:n,settings:r})=>{const[c,l]=i.useState(),[a,d]=i.useState(!1),[j,S]=i.useState(!1),[w,g]=i.useState(!1),[_,p]=i.useState(!1),{slug:v}=C.useParams(),s=i.useRef(null),h=i.useRef(null),t=()=>{p(!_),d(!a)};i.useEffect(()=>{const o=m=>{(s.current&&!s.current.contains(m.target)&&!h.current.contains(m.target)||m.target.closest(".desktop")||m.target.closest(".breadcrumbs"))&&(d(!1),p(!1))},I=m=>{m.key==="Escape"&&(d(!1),p(!1))};return document.addEventListener("mousedown",o),document.addEventListener("keydown",I),()=>{document.removeEventListener("mousedown",o),document.removeEventListener("keydown",I)}},[]),i.useEffect(()=>{let o;const I=()=>{const D=window.innerWidth<=1200;S(D),g(!1)},m=()=>{g(!0),clearTimeout(o),o=setTimeout(I,300)};return I(),window.addEventListener("resize",m),()=>{clearTimeout(o),window.removeEventListener("resize",m)}},[]);const[f,z]=i.useState(!1);i.useEffect(()=>{const o=()=>{z(window.innerWidth<=1364)};return o(),window.addEventListener("resize",o),()=>window.removeEventListener("resize",o)},[]);const b=({media:o})=>o?e.jsx(u.Image,{src:o.guid.rendered}):e.jsx("img",{className:"brand logo",size:"large",src:"/logo_full.png"}),M=(r==null?void 0:r.landing_page_url)&&r.landing_page_url!==!1&&r.landing_page_url!==void 0&&r.landing_page_url!=="",R=M?r.landing_page_url:`/${n.locale}`;return e.jsx(i.Fragment,{children:e.jsxs(x.MenuProvider,{slug:"main",locale:n.locale,children:[e.jsxs(u.Container,{fluid:!0,className:"header",children:[e.jsx(u.Container,{fluid:!0,className:"background",ref:s,children:e.jsxs(u.Menu,{className:"branding",text:!0,children:[e.jsx(u.Menu.Item,{children:e.jsxs("a",{href:`${R}`,target:M?"_blank":"_self",rel:"noopener noreferrer",id:"site_url",children:[r.site_logo!==0&&!f&&e.jsx(x.MediaProvider,{id:r.site_logo,children:e.jsx(x.MediaConsumer,{children:e.jsx(b,{},"logo")})}),r.site_logo===0&&!f&&e.jsx("img",{className:"brand logo",size:"large",src:"/logo_full.png"}),f&&e.jsx("img",{className:"brand logo small",size:"small",src:"/wp-media/TCDI-Icon-small_02.png"})]})}),e.jsx(u.Menu.Item,{className:"divider",children:e.jsx("div",{})}),e.jsxs(u.Menu.Item,{fitted:!0,href:"/",children:[e.jsx(u.Flag,{name:"za"}),e.jsx("div",{className:"site name",children:r.name})]}),!w&&(j?e.jsx(u.Menu,{className:`pages ${a?"show":""}`,children:e.jsx(u.Container,{fluid:!0,children:e.jsx(x.MenuConsumer,{children:e.jsx(N,{settings:r,active:v,selected:c,onSetSelected:l,isSmallScreen:j},"items")})})}):e.jsx(u.Menu.Menu,{className:"pages",children:e.jsx(x.MenuConsumer,{children:e.jsx(N,{settings:r,active:v,selected:c,onSetSelected:l},"items")})})),e.jsx(u.Menu.Item,{children:e.jsx(x.MenuConsumer,{children:e.jsx($.default,{locale:n.locale},"lang")})}),e.jsx(u.Menu.Item,{fitted:!0,children:e.jsx(T.default,{onSetSelected:l,settings:r})}),e.jsxs("div",{ref:h,className:`hamburger-menu ${_?"animate":""} ${a?"open":"close"}`,onClick:t,children:[e.jsx("div",{}),e.jsx("div",{className:"middle-line"}),e.jsx("div",{})]})]})}),e.jsx(u.Container,{fluid:!0,className:"child",children:c&&c.child_items&&e.jsx(u.Menu,{fluid:!0,text:!0,children:e.jsx(N,{active:v,locale:n.locale,withIcons:!0,onSetSelected:o=>null,menu:{items:c.child_items}})})})]},"header-container"),e.jsx(u.Container,{className:"url breadcrumbs",children:e.jsx(x.MenuConsumer,{children:e.jsx(O,{})})})]})})},y=L.injectIntl(q);exports.default=y;
@@ -1,34 +1,34 @@
1
1
  import { jsx as t, jsxs as d } from "react/jsx-runtime";
2
- import z, { useState as b, useEffect as I } from "react";
3
- import { Container as M, Accordion as T, Icon as k, Grid as _, Segment as F, Label as P } from "semantic-ui-react";
4
- import { PostProvider as q, PostConsumer as H, MediaProvider as A, MediaConsumer as L, PostIcon as N, PostContent as E, PostTitle as O } from "@devgateway/wp-react-lib";
5
- import R from "../connected-templates/PostIntro.js";
6
- import { useWindowDimensionsAndDevice as W } from "../../lib/hooks/window-dimensions.js";
7
- import { connect as j } from "react-redux";
8
- const B = ({ post: n, onClick: f, active: c, moreLabel: l }) => {
9
- const u = n._embedded ? n._embedded["wp:featuredmedia"] : null;
10
- return /* @__PURE__ */ d("div", { className: "cover", style: { backgroundImage: `url(${u ? u[0].source_url : ""})` }, children: [
11
- /* @__PURE__ */ t(R, { post: n }),
12
- c ? /* @__PURE__ */ d(P, { onClick: f, children: [
13
- /* @__PURE__ */ t(k, { name: "arrow alternate circle left outline", size: "large" }),
2
+ import z, { useState as y, useEffect as I } from "react";
3
+ import { Container as A, Accordion as P, Icon as x, Grid as T, Segment as F, Label as _ } from "semantic-ui-react";
4
+ import { PostProvider as q, PostConsumer as H, MediaProvider as M, MediaConsumer as L, PostIcon as N, PostContent as E, MediaContext as O, PostTitle as R } from "@devgateway/wp-react-lib";
5
+ import W from "../connected-templates/PostIntro.js";
6
+ import { useWindowDimensionsAndDevice as j } from "../../lib/hooks/window-dimensions.js";
7
+ import { connect as B } from "react-redux";
8
+ const G = ({ post: n, onClick: f, active: s, moreLabel: l, mediaData: u }) => {
9
+ const h = n._embedded ? n._embedded["wp:featuredmedia"] : null, o = u ? u.source_url : h && h.length > 0 ? h[0].source_url : null;
10
+ return /* @__PURE__ */ d("div", { className: "cover", style: { backgroundImage: `url(${o || ""})` }, children: [
11
+ /* @__PURE__ */ t(W, { post: n }),
12
+ s ? /* @__PURE__ */ d(_, { onClick: f, children: [
13
+ /* @__PURE__ */ t(x, { name: "arrow alternate circle left outline", size: "large" }),
14
14
  " Back "
15
- ] }) : /* @__PURE__ */ d(P, { onClick: f, children: [
16
- /* @__PURE__ */ t(k, { name: "search", size: "large" }),
15
+ ] }) : /* @__PURE__ */ d(_, { onClick: f, children: [
16
+ /* @__PURE__ */ t(x, { name: "search", size: "large" }),
17
17
  " ",
18
18
  l
19
19
  ] })
20
20
  ] });
21
- }, G = ({ post: n }) => {
21
+ }, U = ({ post: n }) => {
22
22
  const l = new DOMParser().parseFromString(n.content.rendered, "text/html").querySelector("figure");
23
23
  return l ? /* @__PURE__ */ t("div", { style: {
24
24
  flex: "0 0 40px"
25
25
  }, dangerouslySetInnerHTML: { __html: l.outerHTML } }) : null;
26
- }, V = ({ posts: n, width: f, height: c, color: l, moreLabel: u, closeLabel: y }) => {
27
- const [o, m] = b(null), [p, w] = b(!1), [C, v] = b([0, 0]), a = l.split(","), h = (i) => {
28
- p ? (w(!1), m(i)) : (m(i), w(!0));
26
+ }, V = ({ posts: n, width: f, height: s, color: l, moreLabel: u, closeLabel: h }) => {
27
+ const [o, m] = y(null), [p, v] = y(!1), [C, b] = y([0, 0]), a = l.split(","), g = (i) => {
28
+ p ? (v(!1), m(i)) : (m(i), v(!0));
29
29
  };
30
30
  return I(() => {
31
- o && v([window.scrollX, window.scrollY]), o == null && window.scrollTo(C[0], C[1]);
31
+ o && b([window.scrollX, window.scrollY]), o == null && window.scrollTo(C[0], C[1]);
32
32
  }, [o]), I(() => {
33
33
  window.setTimeout(() => {
34
34
  if (window.location.hash) {
@@ -36,29 +36,29 @@ const B = ({ post: n, onClick: f, active: c, moreLabel: l }) => {
36
36
  e && n && n.map((r) => r.slug).indexOf(i) > -1 && (m(i), e.scrollIntoView({ behavior: "auto", block: "start" }));
37
37
  }
38
38
  }, 0);
39
- }, [n]), /* @__PURE__ */ t(M, { fluid: !0, className: "featured tabs", style: { minHeight: `${c}px` }, children: /* @__PURE__ */ t(_, { stackable: !0, columns: o != null ? 1 : n == null ? void 0 : n.length, className: "desktop", children: n == null ? void 0 : n.map((i, e) => {
39
+ }, [n]), /* @__PURE__ */ t(A, { fluid: !0, className: "featured tabs", style: { minHeight: `${s}px` }, children: /* @__PURE__ */ t(T, { stackable: !0, columns: o != null ? 1 : n == null ? void 0 : n.length, className: "desktop", children: n == null ? void 0 : n.map((i, e) => {
40
40
  var r;
41
41
  return /* @__PURE__ */ d(z.Fragment, { children: [
42
42
  /* @__PURE__ */ d(
43
- _.Column,
43
+ T.Column,
44
44
  {
45
45
  style: o == null ? { display: "block", visibility: "visible", backgroundColor: a[e] } : { display: "none", visibility: "hidden" },
46
46
  children: [
47
47
  /* @__PURE__ */ t("a", { id: i.slug }),
48
- /* @__PURE__ */ t(B, { post: i, moreLabel: u, onClick: () => h(i.slug) })
48
+ /* @__PURE__ */ t(M, { id: i.featured_media, children: /* @__PURE__ */ t(O.Consumer, { children: ({ media: c }) => /* @__PURE__ */ t(G, { post: i, mediaData: c, moreLabel: u, onClick: () => g(i.slug) }) }) })
49
49
  ]
50
50
  }
51
51
  ),
52
52
  /* @__PURE__ */ d(
53
- _.Column,
53
+ T.Column,
54
54
  {
55
55
  className: "expanded",
56
56
  style: o != i.slug ? { display: "none", visibility: "hidden" } : { display: "block", visibility: "visible" },
57
57
  children: [
58
58
  /* @__PURE__ */ d(F, { style: { backgroundColor: a[e] }, children: [
59
- ((r = i.meta_fields) == null ? void 0 : r.icon) && /* @__PURE__ */ t(A, { id: i.meta_fields ? i.meta_fields.icon[0] : null, children: /* @__PURE__ */ t(L, { children: /* @__PURE__ */ t(N, {}) }) }),
60
- /* @__PURE__ */ t(O, { as: "h2", post: i, className: "has-standard-36-font-size has-white-color" }),
61
- /* @__PURE__ */ t(P, { className: "closeIcon", onClick: () => m(null), children: /* @__PURE__ */ t(k, { name: "times circle outline", size: "large" }) })
59
+ ((r = i.meta_fields) == null ? void 0 : r.icon) && /* @__PURE__ */ t(M, { id: i.meta_fields ? i.meta_fields.icon[0] : null, children: /* @__PURE__ */ t(L, { children: /* @__PURE__ */ t(N, {}) }) }),
60
+ /* @__PURE__ */ t(R, { as: "h2", post: i, className: "has-standard-36-font-size has-white-color" }),
61
+ /* @__PURE__ */ t(_, { className: "closeIcon", onClick: () => m(null), children: /* @__PURE__ */ t(x, { name: "times circle outline", size: "large" }) })
62
62
  ] }),
63
63
  /* @__PURE__ */ t(
64
64
  E,
@@ -66,13 +66,13 @@ const B = ({ post: n, onClick: f, active: c, moreLabel: l }) => {
66
66
  as: "div",
67
67
  fluid: !0,
68
68
  post: i,
69
- style: { maxHeight: `calc(${c}px - 150px)` }
69
+ style: { maxHeight: `calc(${s}px - 150px)` }
70
70
  }
71
71
  ),
72
- /* @__PURE__ */ d(P, { className: "closeIconText", style: { backgroundColor: `${a[e]}` }, onClick: () => m(null), children: [
73
- /* @__PURE__ */ t(k, { name: "times circle outline", size: "large" }),
72
+ /* @__PURE__ */ d(_, { className: "closeIconText", style: { backgroundColor: `${a[e]}` }, onClick: () => m(null), children: [
73
+ /* @__PURE__ */ t(x, { name: "times circle outline", size: "large" }),
74
74
  " ",
75
- y || "Close",
75
+ h || "Close",
76
76
  " "
77
77
  ] })
78
78
  ]
@@ -80,17 +80,17 @@ const B = ({ post: n, onClick: f, active: c, moreLabel: l }) => {
80
80
  )
81
81
  ] }, i.slug);
82
82
  }) }) });
83
- }, Y = ({ posts: n, activeItem: f, setActive: c, color: l }) => {
84
- const [u, y] = b(n.findIndex((e) => e.slug === f)), [o, m] = b(null), p = l.split(","), w = () => {
83
+ }, Y = ({ posts: n, activeItem: f, setActive: s, color: l }) => {
84
+ const [u, h] = y(n.findIndex((e) => e.slug === f)), [o, m] = y(null), p = l.split(","), v = () => {
85
85
  var e;
86
86
  return ((e = window.screen.orientation) == null ? void 0 : e.type) || (window.innerWidth > window.innerHeight ? "landscape-primary" : "portrait-primary");
87
- }, [C, v] = b(w()), a = () => {
87
+ }, [C, b] = y(v()), a = () => {
88
88
  setTimeout(() => {
89
- v(w());
89
+ b(v());
90
90
  }, 100);
91
- }, h = (e, r, s) => {
92
- document.querySelectorAll(e).forEach((x) => {
93
- x.querySelector(r) && x.classList.add(s);
91
+ }, g = (e, r, c) => {
92
+ document.querySelectorAll(e).forEach((k) => {
93
+ k.querySelector(r) && k.classList.add(c);
94
94
  });
95
95
  };
96
96
  I(() => {
@@ -101,7 +101,7 @@ const B = ({ post: n, onClick: f, active: c, moreLabel: l }) => {
101
101
  behavior: "smooth"
102
102
  });
103
103
  }
104
- h(".ui.fluid.container.viz.featured.tabs", ".accordion .accordion-post-ft-title", "has-accordion-title"), h(".ui.fluid.container.viz.featured.tabs", ".accordion .accordion-post-vft-content", "has-accordion-content"), h(".ui.fluid.container.viz.featured.tabs", "blockquote", "has-blockquote"), h(".ui.fluid.container.viz.featured.tabs", ".vt-accordion-post-intro figure", "has-vt-accordion-figure"), h(".ui.fluid.container.viz.featured.tabs", ".content.active.accordion-post-content .wp-block-columns", "has-wp-block-columns");
104
+ g(".ui.fluid.container.viz.featured.tabs", ".accordion .accordion-post-ft-title", "has-accordion-title"), g(".ui.fluid.container.viz.featured.tabs", ".accordion .accordion-post-vft-content", "has-accordion-content"), g(".ui.fluid.container.viz.featured.tabs", "blockquote", "has-blockquote"), g(".ui.fluid.container.viz.featured.tabs", ".vt-accordion-post-intro figure", "has-vt-accordion-figure"), g(".ui.fluid.container.viz.featured.tabs", ".content.active.accordion-post-content .wp-block-columns", "has-wp-block-columns");
105
105
  }, [o]), I(() => (window.screen.orientation && window.screen.orientation.addEventListener(
106
106
  "change",
107
107
  a
@@ -112,15 +112,15 @@ const B = ({ post: n, onClick: f, active: c, moreLabel: l }) => {
112
112
  );
113
113
  }), []);
114
114
  const i = (e, r) => {
115
- const { index: s } = r, g = u === s ? -1 : s;
116
- y(g), c(n[s].slug), g !== -1 && m(e.currentTarget);
115
+ const { index: c } = r, w = u === c ? -1 : c;
116
+ h(w), s(n[c].slug), w !== -1 && m(e.currentTarget);
117
117
  };
118
- return /* @__PURE__ */ t(T, { fluid: !0, styled: !0, children: n.map((e, r) => {
119
- var g;
120
- const s = (g = e.meta_fields) != null && g.icon ? e.meta_fields.icon[0] : null;
118
+ return /* @__PURE__ */ t(P, { fluid: !0, styled: !0, children: n.map((e, r) => {
119
+ var w;
120
+ const c = (w = e.meta_fields) != null && w.icon ? e.meta_fields.icon[0] : null;
121
121
  return /* @__PURE__ */ d(z.Fragment, { children: [
122
122
  /* @__PURE__ */ t(
123
- T.Title,
123
+ P.Title,
124
124
  {
125
125
  active: u === r,
126
126
  index: r,
@@ -128,43 +128,43 @@ const B = ({ post: n, onClick: f, active: c, moreLabel: l }) => {
128
128
  style: { backgroundColor: p[r] },
129
129
  children: /* @__PURE__ */ d("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", width: "100%" }, children: [
130
130
  /* @__PURE__ */ d("div", { style: { display: "flex", alignItems: "center" }, children: [
131
- s && /* @__PURE__ */ t(A, { id: s, children: /* @__PURE__ */ t(L, { children: /* @__PURE__ */ t(N, { className: "icon" }) }) }),
132
- !s && /* @__PURE__ */ t(G, { post: e }),
131
+ c && /* @__PURE__ */ t(M, { id: c, children: /* @__PURE__ */ t(L, { children: /* @__PURE__ */ t(N, { className: "icon" }) }) }),
132
+ !c && /* @__PURE__ */ t(U, { post: e }),
133
133
  /* @__PURE__ */ t("p", { className: "accordion-post-ft-title", dangerouslySetInnerHTML: { __html: e.title.rendered }, style: { marginLeft: "10px" } })
134
134
  ] }),
135
- /* @__PURE__ */ t(k, { name: "chevron down" })
135
+ /* @__PURE__ */ t(x, { name: "chevron down" })
136
136
  ] })
137
137
  }
138
138
  ),
139
- /* @__PURE__ */ t(T.Content, { className: "accordion-post-ft-content", active: u === r, children: /* @__PURE__ */ t(E, { post: e }) })
139
+ /* @__PURE__ */ t(P.Content, { className: "accordion-post-ft-content", active: u === r, children: /* @__PURE__ */ t(E, { post: e }) })
140
140
  ] }, e.id);
141
141
  }) });
142
- }, U = (n) => {
142
+ }, X = (n) => {
143
143
  var S;
144
144
  let {
145
145
  "data-width": f,
146
- "data-height": c,
146
+ "data-height": s,
147
147
  "data-type": l,
148
148
  "data-taxonomy": u,
149
- "data-categories": y,
149
+ "data-categories": h,
150
150
  "data-items": o,
151
151
  "data-color": m,
152
152
  "data-use-scrolls": p,
153
- "data-read-more-label": w = "READ More",
153
+ "data-read-more-label": v = "READ More",
154
154
  "data-close-label": C = "Close",
155
- "data-preview-mode": v = "Desktop",
155
+ "data-preview-mode": b = "Desktop",
156
156
  editing: a,
157
- parent: h,
157
+ parent: g,
158
158
  unique: i,
159
159
  pageModuleProps: e
160
160
  } = n;
161
161
  const r = n.intl.locale;
162
- e != null && e.editing && (e != null && e.previewMode) && (a = e.editing, v = e.previewMode);
163
- const s = p == "true", { width: g } = W(), x = g <= 1250, $ = v !== "Desktop" && a, D = x && !a;
162
+ e != null && e.editing && (e != null && e.previewMode) && (a = e.editing, b = e.previewMode);
163
+ const c = p == "true", { width: w } = j(), k = w <= 1250, $ = b !== "Desktop" && a, D = k && !a;
164
164
  return /* @__PURE__ */ t(
165
- M,
165
+ A,
166
166
  {
167
- className: `viz featured tabs ${a ? "editing" : ""} ${s ? "scrollable" : ""}`,
167
+ className: `viz featured tabs ${a ? "editing" : ""} ${c ? "scrollable" : ""}`,
168
168
  fluid: !0,
169
169
  children: /* @__PURE__ */ t(
170
170
  q,
@@ -172,8 +172,8 @@ const B = ({ post: n, onClick: f, active: c, moreLabel: l }) => {
172
172
  locale: r,
173
173
  type: l,
174
174
  taxonomy: u,
175
- categories: y,
176
- store: `tabbedposts_${h}_${i}`,
175
+ categories: h,
176
+ store: `tabbedposts_${g}_${i}`,
177
177
  page: 1,
178
178
  perPage: o,
179
179
  children: /* @__PURE__ */ t(H, { children: $ || D ? /* @__PURE__ */ t(
@@ -188,24 +188,24 @@ const B = ({ post: n, onClick: f, active: c, moreLabel: l }) => {
188
188
  ) : /* @__PURE__ */ t(
189
189
  V,
190
190
  {
191
- moreLabel: w,
191
+ moreLabel: v,
192
192
  closeLabel: C,
193
193
  color: m,
194
194
  width: f,
195
- height: c
195
+ height: s
196
196
  }
197
197
  ) })
198
198
  }
199
199
  )
200
200
  }
201
201
  );
202
- }, X = (n, f) => {
203
- const c = n.getIn([
202
+ }, J = (n, f) => {
203
+ const s = n.getIn([
204
204
  "data",
205
205
  "pageModuleProps"
206
206
  ]), l = {};
207
- return c && (l.pageModuleProps = c), l;
208
- }, J = {}, oe = j(X, J)(U);
207
+ return s && (l.pageModuleProps = s), l;
208
+ }, K = {}, re = B(J, K)(X);
209
209
  export {
210
- oe as default
210
+ re as default
211
211
  };
@@ -1,42 +1,42 @@
1
1
  import { jsx as e, jsxs as u } from "react/jsx-runtime";
2
- import { Menu as d, Container as N, Flag as P, Image as U } from "semantic-ui-react";
3
- import S, { useEffect as _, useState as p, useRef as y } from "react";
4
- import { utils as j, MenuProvider as H, MediaProvider as V, MediaConsumer as A, MenuConsumer as L } from "@devgateway/wp-react-lib";
2
+ import { Menu as d, Container as b, Flag as P, Image as U } from "semantic-ui-react";
3
+ import E, { useEffect as _, useState as p, useRef as y } from "react";
4
+ import { utils as j, MenuProvider as H, MediaProvider as A, MediaConsumer as V, MenuConsumer as k } from "@devgateway/wp-react-lib";
5
5
  import { injectIntl as R } from "react-intl";
6
6
  import { useParams as $ } from "react-router";
7
7
  import B from "./SearchControl.js";
8
8
  import K from "./LangSwitcher.js";
9
9
  const W = (r, s) => {
10
- const a = [];
10
+ const t = [];
11
11
  return r.items.forEach((i) => {
12
- i.child_items ? i.child_items.forEach((t) => {
13
- t.slug == s.slug && (a.push(i), a.push(t));
14
- }) : i.slug == s.slug && i.url != "/" && a.push(i);
15
- }), a;
16
- }, z = (r, s) => {
12
+ i.child_items ? i.child_items.forEach((a) => {
13
+ a.slug == s.slug && (t.push(i), t.push(a));
14
+ }) : i.slug == s.slug && i.url != "/" && t.push(i);
15
+ }), t;
16
+ }, x = (r, s) => {
17
17
  if (r) {
18
- const a = r.indexOf("/wp");
19
- if (a !== -1) {
20
- const i = r.substr(a + 3);
18
+ const t = r.indexOf("/wp");
19
+ if (t !== -1) {
20
+ const i = r.substr(t + 3);
21
21
  return i.startsWith("/" + s) ? i : "/" + s + i;
22
22
  } else
23
23
  return r.startsWith("/" + s) ? r : "/" + s + r;
24
24
  }
25
25
  return "";
26
26
  }, q = R(({ menu: r, intl: s }) => {
27
- const a = $(), i = W(r, a);
28
- return /* @__PURE__ */ e(S.Fragment, { children: i.filter((t) => t.url != "#wpm-languages").map(
29
- (t) => t.child_items ? /* @__PURE__ */ u("span", { children: [
30
- t.post_title,
27
+ const t = $(), i = W(r, t);
28
+ return /* @__PURE__ */ e(E.Fragment, { children: i.filter((a) => a.url != "#wpm-languages").map(
29
+ (a) => a.child_items ? /* @__PURE__ */ u("span", { children: [
30
+ a.post_title,
31
31
  " "
32
32
  ] }) : /* @__PURE__ */ u(
33
33
  "a",
34
34
  {
35
- className: t.slug == a.slug ? "active" : "",
36
- href: j.replaceLink(t.url, s.locale),
35
+ className: a.slug == t.slug ? "active" : "",
36
+ href: j.replaceLink(a.url, s.locale),
37
37
  children: [
38
38
  " ",
39
- t.post_title
39
+ a.post_title
40
40
  ]
41
41
  }
42
42
  )
@@ -45,22 +45,20 @@ const W = (r, s) => {
45
45
  ({
46
46
  settings: r,
47
47
  withIcons: s,
48
- active: a,
48
+ active: t,
49
49
  menu: i,
50
- onSetSelected: t,
50
+ onSetSelected: a,
51
51
  selected: o,
52
52
  intl: { locale: g },
53
- isSmallScreen: x
53
+ isSmallScreen: D
54
54
  }) => {
55
- const D = $();
55
+ const L = $();
56
56
  _(
57
57
  (n) => {
58
- if (!o) {
59
- const l = W(i, D).filter((f) => f.menu_item_parent == 0);
60
- l && t(l[0]);
61
- }
58
+ const l = W(i, L).filter((f) => f.menu_item_parent == 0);
59
+ l && l.length > 0 ? a(l[0]) : a(null);
62
60
  },
63
- [i, t, o]
61
+ [i, a, L.slug]
64
62
  );
65
63
  const [v, I] = p(null);
66
64
  _(() => {
@@ -74,8 +72,8 @@ const W = (r, s) => {
74
72
  Object.keys(r.menu_settings).map((l) => {
75
73
  const f = r.menu_settings[l];
76
74
  if (f.type == "nav_menu_item") {
77
- const k = /(-)?[0-9]+/g.exec(l), E = parseInt(k[0]);
78
- h.find((c) => c.ID == E) || h.push(f.value);
75
+ const S = /(-)?[0-9]+/g.exec(l), z = parseInt(S[0]);
76
+ h.find((c) => c.ID == z) || h.push(f.value);
79
77
  }
80
78
  }), I({
81
79
  ...i,
@@ -89,40 +87,47 @@ const W = (r, s) => {
89
87
  M(window.innerWidth <= 1200);
90
88
  };
91
89
  return n(), window.addEventListener("resize", n), () => window.removeEventListener("resize", n);
92
- }, []), v && /* @__PURE__ */ e(S.Fragment, { children: v.items.filter((n) => n.url !== "#wpm-languages").map((n, h) => /* @__PURE__ */ u(S.Fragment, { children: [
90
+ }, []), v && /* @__PURE__ */ e(E.Fragment, { children: v.items.filter((n) => n.url !== "#wpm-languages").map((n, h) => /* @__PURE__ */ u(E.Fragment, { children: [
93
91
  /* @__PURE__ */ u(
94
92
  d.Item,
95
93
  {
96
94
  className: `divided ${n.child_items ? "has-child-items" : ""}
97
95
  ${o && o.ID === n.ID ? "selected" : ""}
98
- ${a === n.slug ? "active" : ""}`,
96
+ ${t === n.slug ? "active" : ""}`,
99
97
  children: [
100
- s && /* @__PURE__ */ e("a", { href: z(n.url, g), children: /* @__PURE__ */ e("div", { className: "mark", children: /* @__PURE__ */ e("span", { className: "sr-only", children: n.title }) }) }),
101
- x ? n.child_items ? /* @__PURE__ */ e(
98
+ s && /* @__PURE__ */ e("a", { href: x(n.url, g), children: /* @__PURE__ */ e("div", { className: "mark", children: /* @__PURE__ */ e("span", { className: "sr-only", children: n.title }) }) }),
99
+ D ? n.child_items ? /* @__PURE__ */ e(
100
+ "span",
101
+ {
102
+ onClick: () => a(o === n ? null : n),
103
+ children: n.title
104
+ }
105
+ ) : /* @__PURE__ */ e("a", { href: x(n.url, g), children: n.title }) : n.child_items ? /* @__PURE__ */ e(
102
106
  "span",
103
107
  {
104
- onClick: () => t(o === n ? null : n),
108
+ onMouseOver: (l) => a(n),
109
+ onClick: () => a(o === n ? null : n),
105
110
  children: n.title
106
111
  }
107
- ) : /* @__PURE__ */ e("a", { href: z(n.url, g), children: n.title }) : n.child_items ? /* @__PURE__ */ e("span", { onMouseOver: (l) => t(n), children: n.title }) : /* @__PURE__ */ e(
112
+ ) : /* @__PURE__ */ e(
108
113
  "a",
109
114
  {
110
- onMouseOut: (l) => t(null),
111
- onMouseOver: (l) => t(n),
112
- href: z(n.url, g),
115
+ onMouseOut: (l) => a(null),
116
+ onMouseOver: (l) => a(n),
117
+ href: x(n.url, g),
113
118
  children: n.title
114
119
  }
115
120
  )
116
121
  ]
117
122
  }
118
123
  ),
119
- w && o && o.ID === n.ID && o.child_items && /* @__PURE__ */ e(S.Fragment, { children: o.child_items.map((l) => /* @__PURE__ */ u(
124
+ w && o && o.ID === n.ID && o.child_items && /* @__PURE__ */ e(E.Fragment, { children: o.child_items.map((l) => /* @__PURE__ */ u(
120
125
  d.Item,
121
126
  {
122
- className: `divided child-item ${a === l.slug ? "active" : ""}`,
127
+ className: `divided child-item ${t === l.slug ? "active" : ""}`,
123
128
  children: [
124
129
  /* @__PURE__ */ e("div", { className: "mark" }),
125
- /* @__PURE__ */ e("a", { href: z(l.url, g), children: l.title })
130
+ /* @__PURE__ */ e("a", { href: x(l.url, g), children: l.title })
126
131
  ]
127
132
  },
128
133
  l.ID
@@ -130,27 +135,27 @@ const W = (r, s) => {
130
135
  ] }, n.ID)) });
131
136
  }
132
137
  ), G = ({ intl: r, settings: s }) => {
133
- const [a, i] = p(), [t, o] = p(!1), [g, x] = p(!1), [D, v] = p(!1), [I, w] = p(!1), { slug: M } = $(), n = y(null), h = y(null), l = () => {
134
- w(!I), o(!t);
138
+ const [t, i] = p(), [a, o] = p(!1), [g, D] = p(!1), [L, v] = p(!1), [I, w] = p(!1), { slug: M } = $(), n = y(null), h = y(null), l = () => {
139
+ w(!I), o(!a);
135
140
  };
136
141
  _(() => {
137
142
  const c = (m) => {
138
143
  (n.current && !n.current.contains(m.target) && !h.current.contains(m.target) || m.target.closest(".desktop") || m.target.closest(".breadcrumbs")) && (o(!1), w(!1));
139
- }, b = (m) => {
144
+ }, N = (m) => {
140
145
  m.key === "Escape" && (o(!1), w(!1));
141
146
  };
142
- return document.addEventListener("mousedown", c), document.addEventListener("keydown", b), () => {
143
- document.removeEventListener("mousedown", c), document.removeEventListener("keydown", b);
147
+ return document.addEventListener("mousedown", c), document.addEventListener("keydown", N), () => {
148
+ document.removeEventListener("mousedown", c), document.removeEventListener("keydown", N);
144
149
  };
145
150
  }, []), _(() => {
146
151
  let c;
147
- const b = () => {
152
+ const N = () => {
148
153
  const F = window.innerWidth <= 1200;
149
- x(F), v(!1);
154
+ D(F), v(!1);
150
155
  }, m = () => {
151
- v(!0), clearTimeout(c), c = setTimeout(b, 300);
156
+ v(!0), clearTimeout(c), c = setTimeout(N, 300);
152
157
  };
153
- return b(), window.addEventListener("resize", m), () => {
158
+ return N(), window.addEventListener("resize", m), () => {
154
159
  clearTimeout(c), window.removeEventListener("resize", m);
155
160
  };
156
161
  }, []);
@@ -161,12 +166,12 @@ const W = (r, s) => {
161
166
  };
162
167
  return c(), window.addEventListener("resize", c), () => window.removeEventListener("resize", c);
163
168
  }, []);
164
- const k = ({ media: c }) => c ? /* @__PURE__ */ e(U, { src: c.guid.rendered }) : /* @__PURE__ */ e("img", { className: "brand logo", size: "large", src: "/logo_full.png" }), E = (s == null ? void 0 : s.landing_page_url) && s.landing_page_url !== !1 && s.landing_page_url !== void 0 && s.landing_page_url !== "", O = E ? s.landing_page_url : `/${r.locale}`;
165
- return console.log("isMenuVisible", t), /* @__PURE__ */ e(S.Fragment, { children: /* @__PURE__ */ u(H, { slug: "main", locale: r.locale, children: [
166
- /* @__PURE__ */ u(N, { fluid: !0, className: "header", children: [
167
- /* @__PURE__ */ e(N, { fluid: !0, className: "background", ref: n, children: /* @__PURE__ */ u(d, { className: "branding", text: !0, children: [
168
- /* @__PURE__ */ e(d.Item, { children: /* @__PURE__ */ u("a", { href: `${O}`, target: E ? "_blank" : "_self", rel: "noopener noreferrer", id: "site_url", children: [
169
- s.site_logo !== 0 && !f && /* @__PURE__ */ e(V, { id: s.site_logo, children: /* @__PURE__ */ e(A, { children: /* @__PURE__ */ e(k, {}, "logo") }) }),
169
+ const S = ({ media: c }) => c ? /* @__PURE__ */ e(U, { src: c.guid.rendered }) : /* @__PURE__ */ e("img", { className: "brand logo", size: "large", src: "/logo_full.png" }), z = (s == null ? void 0 : s.landing_page_url) && s.landing_page_url !== !1 && s.landing_page_url !== void 0 && s.landing_page_url !== "", O = z ? s.landing_page_url : `/${r.locale}`;
170
+ return /* @__PURE__ */ e(E.Fragment, { children: /* @__PURE__ */ u(H, { slug: "main", locale: r.locale, children: [
171
+ /* @__PURE__ */ u(b, { fluid: !0, className: "header", children: [
172
+ /* @__PURE__ */ e(b, { fluid: !0, className: "background", ref: n, children: /* @__PURE__ */ u(d, { className: "branding", text: !0, children: [
173
+ /* @__PURE__ */ e(d.Item, { children: /* @__PURE__ */ u("a", { href: `${O}`, target: z ? "_blank" : "_self", rel: "noopener noreferrer", id: "site_url", children: [
174
+ s.site_logo !== 0 && !f && /* @__PURE__ */ e(A, { id: s.site_logo, children: /* @__PURE__ */ e(V, { children: /* @__PURE__ */ e(S, {}, "logo") }) }),
170
175
  s.site_logo === 0 && !f && /* @__PURE__ */ e(
171
176
  "img",
172
177
  {
@@ -189,27 +194,27 @@ const W = (r, s) => {
189
194
  /* @__PURE__ */ e(P, { name: "za" }),
190
195
  /* @__PURE__ */ e("div", { className: "site name", children: s.name })
191
196
  ] }),
192
- !D && (g ? /* @__PURE__ */ e(d, { className: `pages ${t ? "show" : ""}`, children: /* @__PURE__ */ e(N, { fluid: !0, children: /* @__PURE__ */ e(L, { children: /* @__PURE__ */ e(
197
+ !L && (g ? /* @__PURE__ */ e(d, { className: `pages ${a ? "show" : ""}`, children: /* @__PURE__ */ e(b, { fluid: !0, children: /* @__PURE__ */ e(k, { children: /* @__PURE__ */ e(
193
198
  C,
194
199
  {
195
200
  settings: s,
196
201
  active: M,
197
- selected: a,
202
+ selected: t,
198
203
  onSetSelected: i,
199
204
  isSmallScreen: g
200
205
  },
201
206
  "items"
202
- ) }) }) }) : /* @__PURE__ */ e(d.Menu, { className: "pages", children: /* @__PURE__ */ e(L, { children: /* @__PURE__ */ e(
207
+ ) }) }) }) : /* @__PURE__ */ e(d.Menu, { className: "pages", children: /* @__PURE__ */ e(k, { children: /* @__PURE__ */ e(
203
208
  C,
204
209
  {
205
210
  settings: s,
206
211
  active: M,
207
- selected: a,
212
+ selected: t,
208
213
  onSetSelected: i
209
214
  },
210
215
  "items"
211
216
  ) }) })),
212
- /* @__PURE__ */ e(d.Item, { children: /* @__PURE__ */ e(L, { children: /* @__PURE__ */ e(
217
+ /* @__PURE__ */ e(d.Item, { children: /* @__PURE__ */ e(k, { children: /* @__PURE__ */ e(
213
218
  K,
214
219
  {
215
220
  locale: r.locale
@@ -227,7 +232,7 @@ const W = (r, s) => {
227
232
  "div",
228
233
  {
229
234
  ref: h,
230
- className: `hamburger-menu ${I ? "animate" : ""} ${t ? "open" : "close"}`,
235
+ className: `hamburger-menu ${I ? "animate" : ""} ${a ? "open" : "close"}`,
231
236
  onClick: l,
232
237
  children: [
233
238
  /* @__PURE__ */ e("div", {}),
@@ -237,18 +242,18 @@ const W = (r, s) => {
237
242
  }
238
243
  )
239
244
  ] }) }),
240
- /* @__PURE__ */ e(N, { fluid: !0, className: "child", children: a && a.child_items && /* @__PURE__ */ e(d, { fluid: !0, text: !0, children: /* @__PURE__ */ e(
245
+ /* @__PURE__ */ e(b, { fluid: !0, className: "child", children: t && t.child_items && /* @__PURE__ */ e(d, { fluid: !0, text: !0, children: /* @__PURE__ */ e(
241
246
  C,
242
247
  {
243
248
  active: M,
244
249
  locale: r.locale,
245
250
  withIcons: !0,
246
251
  onSetSelected: (c) => null,
247
- menu: { items: a.child_items }
252
+ menu: { items: t.child_items }
248
253
  }
249
254
  ) }) })
250
255
  ] }, "header-container"),
251
- /* @__PURE__ */ e(N, { className: "url breadcrumbs", children: /* @__PURE__ */ e(L, { children: /* @__PURE__ */ e(q, {}) }) })
256
+ /* @__PURE__ */ e(b, { className: "url breadcrumbs", children: /* @__PURE__ */ e(k, { children: /* @__PURE__ */ e(q, {}) }) })
252
257
  ] }) });
253
258
  }, se = R(G);
254
259
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devgateway/dvz-ui-react",
3
- "version": "1.6.7",
3
+ "version": "1.6.9",
4
4
  "main": "dist/cjs/index.js",
5
5
  "module": "dist/esm/index.js",
6
6
  "types": "dist/types/index.d.ts",
@@ -122,7 +122,7 @@
122
122
  "vite-plugin-env-compatible": "^2.0.1",
123
123
  "vite-plugin-eslint": "^1.8.1",
124
124
  "vite-tsconfig-paths": "^5.1.4",
125
- "@devgateway/wp-react-lib": "0.5.1"
125
+ "@devgateway/wp-react-lib": "0.6.1"
126
126
  },
127
127
  "peerDependencies": {
128
128
  "react": "^18.3.1",