@devgateway/dvz-ui-react 1.6.10 → 1.6.12

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"),u=require("@devgateway/wp-react-lib"),p=require("semantic-ui-react"),r=require("pure-react-carousel"),x=s=>{let o=0;const{posts:t,height:i,interval:l,autoSwitch:a}=s;return e.jsxs(r.CarouselProvider,{interval:l,isPlaying:a,totalSlides:t.length,naturalSlideHeight:i,children:[e.jsx(r.Slider,{style:{height:`${i}px`},trayTag:"ul",children:t.map(n=>e.jsx(r.Slide,{index:o++,tag:"li",children:e.jsx(u.PostIntro,{post:n,fluid:!0})}))}),e.jsx(r.DotGroup,{})]})},j=s=>{const{"data-type":o,"data-taxonomy":t,"data-categories":i,"data-items":l,"data-height":a,"data-auto-switch":n="false","data-interval":c=1e4,editing:d,parent:h,unique:g}=s;return e.jsx(p.Container,{style:{height:`${a}px`},className:`viz post carousel ${d?"editing":""}`,fluid:!0,children:e.jsx(u.PostProvider,{type:o,taxonomy:t,categories:i,store:"carousel_"+h+"_"+g,page:1,perPage:l,children:e.jsx(u.PostConsumer,{children:e.jsx(x,{height:a,interval:c,autoSwitch:n=="true"})})})})};exports.default=j;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),u=require("@devgateway/wp-react-lib"),p=require("semantic-ui-react"),i=require("pure-react-carousel"),x=r=>{let s=0;const{posts:t,height:o,interval:l,autoSwitch:a}=r;return e.jsxs(i.CarouselProvider,{interval:l,isPlaying:a,totalSlides:t.length,naturalSlideHeight:o,children:[e.jsx(i.Slider,{trayTag:"ul",children:t.map(n=>e.jsx(i.Slide,{index:s++,tag:"li",children:e.jsx(u.PostIntro,{post:n,fluid:!0})}))}),e.jsx(i.DotGroup,{})]})},j=r=>{const{"data-type":s,"data-taxonomy":t,"data-categories":o,"data-items":l,"data-height":a,"data-auto-switch":n="false","data-interval":c=1e4,editing:d,parent:h,unique:g}=r;return e.jsx(p.Container,{style:{height:`${a}px`},className:`viz post carousel ${d?"editing":""}`,fluid:!0,children:e.jsx(u.PostProvider,{type:s,taxonomy:t,categories:o,store:"carousel_"+h+"_"+g,page:1,perPage:l,children:e.jsx(u.PostConsumer,{children:e.jsx(x,{height:a,interval:c,autoSwitch:n=="true"})})})})};exports.default=j;
@@ -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"),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":""}
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"),h=require("@devgateway/wp-react-lib"),C=require("react-intl"),L=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=C.injectIntl(({menu:n,intl:r})=>{const c=L.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:h.utils.replaceLink(a.url,r.locale),children:[" ",a.post_title]}))})}),N=C.injectIntl(({settings:n,withIcons:r,active:c,menu:l,onSetSelected:a,selected:d,intl:{locale:j},isSmallScreen:S})=>{const w=L.useParams();i.useEffect(s=>{const t=k(l,w).filter(x=>x.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=[],f=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 x=n.menu_settings[t];if(x.type=="nav_menu_item"){const b=/(-)?[0-9]+/g.exec(t),M=parseInt(b[0]);f.find(o=>o.ID==M)||f.push(x.value)}}),_({...l,items:f.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,f)=>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: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,selected:c,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}=L.useParams(),s=i.useRef(null),f=i.useRef(null),t=()=>{p(!_),d(!a)};i.useEffect(()=>{const o=m=>{(s.current&&!s.current.contains(m.target)&&!f.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[x,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(h.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&&!x&&e.jsx(h.MediaProvider,{id:r.site_logo,children:e.jsx(h.MediaConsumer,{children:e.jsx(b,{},"logo")})}),r.site_logo===0&&!x&&e.jsx("img",{className:"brand logo",size:"large",src:"/logo_full.png"}),x&&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(h.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(h.MenuConsumer,{children:e.jsx(N,{settings:r,active:v,selected:c,onSetSelected:l},"items")})})),e.jsx(u.Menu.Item,{children:e.jsx(h.MenuConsumer,{children:e.jsx($.default,{locale:n.locale},"lang")})}),e.jsx(u.Menu.Item,{fitted:!0,children:e.jsx(h.MenuConsumer,{children:e.jsx(T.default,{onSetSelected:l,settings:r})})}),e.jsxs("div",{ref:f,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(h.MenuConsumer,{children:e.jsx(O,{})})})]})})},y=C.injectIntl(q);exports.default=y;
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),u=require("react"),j=require("@devgateway/wp-react-lib"),M=require("./CustomSemanticSearch.js"),C=require("react-dom"),N=require("semantic-ui-react"),w=require("react-intl"),v=(r,n)=>{if(!r||!n)return r||"";const c=new RegExp(`(${n})`,"gi");return r.replace(c,"<strong>$1</strong>")},y=w.injectIntl(({ID:r,title:n,slug:c,parent_title:i,parent_slug:t,parent_link:s,extract:o,type:d,link:h,terms:p,subtype:x,bread_crumbs:l=[],metadata:a,intl:{locale:S},searchTerm:g})=>{let f=s?j.utils.replaceLink(s,S)+`#${c}`:j.utils.replaceLink(h,S);const m=a==null?void 0:a.redirect_url;f=m?m+`#${c}`:f;const R=v(String(n),g),I=v(o,g);return e.jsx("div",{className:"search-results-wrapper searching-results",style:{display:"flex",flexDirection:"column"},children:e.jsxs("div",{className:"has-standard-12-font-size",onClick:P=>document.location.href=f,children:[e.jsx("h5",{className:"breadcrumbs-search",dangerouslySetInnerHTML:{__html:l&&l.length>0?v(l.join(" / "),g):""}}),e.jsx("div",{className:"has-standard-14-font-size",children:e.jsx("h4",{className:"search-title",dangerouslySetInnerHTML:{__html:R}})}),e.jsx("div",{className:"search-content",dangerouslySetInnerHTML:{__html:j.utils.replaceHTMLinks(I,S)}})]})})}),E=({results:r,meta:n,perPage:c,intl:i,searchTerm:t})=>{const s=n?n["x-wp-total"]:0;return n&&n["x-wp-totalpages"],e.jsxs("div",{id:"float-results-container",children:[e.jsx("span",{className:"float-results-header",children:i.formatMessage({id:"search.results.summary",defaultMessage:"{count} of {total} Results"},{count:s<c?s:c,total:s})}),r.map(o=>e.jsx(y,{...o,searchTerm:t},o.ID))]})},_=({onSearch:r,perPage:n,loading:c,results:i,meta:t,intl:s})=>(t&&t["x-wp-total"],t&&t["x-wp-totalpages"],e.jsx("input",{placeholder:s.formatMessage({id:"search.placeholder",defaultMessage:"Search..."}),type:"text",className:"input search",name:"search",onChange:o=>{r(o.target.value)}})),L=({onSearch:r,onSetSelected:n,perPage:c,loading:i,results:t,meta:s,locale:o,intl:d,searchTerm:h,selected:p})=>{const[x,l]=u.useState(!1),a=u.useRef(null);u.useEffect(()=>{const f=document.createElement("div");f.setAttribute("id","float-input-container"),f.setAttribute("class","input container"),f.style.display="none";const m=document.getElementById("root");return m&&(m.appendChild(f),a.current=f),()=>{a.current&&a.current.parentNode&&a.current.parentNode.removeChild(a.current)}},[]),u.useEffect(()=>{a.current&&(a.current.style.display=x?"block":"none")},[x]),u.useEffect(()=>{p&&p.child_items&&l(!1)},[p]);const S=()=>{n(null),l(!0)},g=()=>{l(!1)};return e.jsxs(e.Fragment,{children:[e.jsx("div",{id:"ui-float-search",className:"ui float-search",onMouseOver:S,children:e.jsx(N.Icon,{name:"search",size:"small"})}),a.current&&C.createPortal(x?e.jsxs("div",{onMouseLeave:g,children:[e.jsx("div",{className:"float-search-container",children:e.jsx(_,{onSearch:r,perPage:c,loading:i,results:t,meta:s,intl:d,searchTerm:h})}),t&&t.length>0&&e.jsx(w.IntlProvider,{locale:o,children:e.jsx(E,{results:t,meta:s,perPage:c,intl:d,searchTerm:h})})]}):null,a.current)]})},b=({onSearch:r,perPage:n,loading:c,results:i,meta:t,intl:s})=>{const o=t?t["x-wp-total"]:0,d=t?t["x-wp-totalpages"]:0,[h,p]=u.useState("");u.useEffect(()=>{const l=setTimeout(()=>{r(h)},300);return()=>clearTimeout(l)},[h]);const x=l=>e.jsx(y,{...l,searchTerm:h});return e.jsx(M.default,{value:h,loading:c,placeholder:s.formatMessage({id:"search.placeholder",defaultMessage:"Search..."}),onResultSelect:(l,a)=>null,total:o,perPage:n,totalPages:d,onSearchChange:(l,a)=>{p(a.value)},resultRenderer:x,results:i,showNoResults:!1,intl:s,searchTerm:h})},q=w.injectIntl(r=>{const{intl:n,onSetSelected:c}=r,[i,t]=u.useState(""),[s,o]=u.useState(!1);return u.useEffect(()=>{const d=()=>{o(window.innerWidth<=1365)};return d(),window.addEventListener("resize",d),()=>window.removeEventListener("resize",d)},[]),e.jsx(j.SearchProvider,{search:i,perPage:5,locale:n.locale,children:e.jsx(T,{...r,onSetSelected:c,setQuery:t,query:i,isSmallScreen:s,intl:n})})}),T=({onSetSelected:r,setQuery:n,query:c,isSmallScreen:i,intl:t,...s})=>{const o=u.useContext(j.SearchContext);return s.settings.react_search_type==="floating"||i?e.jsx(L,{onSetSelected:r,onSearch:n,perPage:5,intl:t,...s,...o,searchTerm:c}):e.jsx(b,{onSetSelected:r,onSearch:n,perPage:5,intl:t,...s,...o})};exports.default=q;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),p=require("react"),v=require("@devgateway/wp-react-lib"),I=require("./CustomSemanticSearch.js"),M=require("react-dom"),L=require("semantic-ui-react"),C=require("react-intl"),w=(s,r)=>{if(!s||!r)return s||"";const a=new RegExp(`(${r})`,"gi");return s.replace(a,"<strong>$1</strong>")},R=C.injectIntl(({ID:s,title:r,slug:a,parent_title:i,parent_slug:t,parent_link:n,extract:c,type:u,link:m,terms:y,subtype:g,bread_crumbs:d=[],metadata:o,intl:{locale:f},searchTerm:S})=>{let x=n?v.utils.replaceLink(n,f)+`#${a}`:v.utils.replaceLink(m,f);const E=o==null?void 0:o.redirect_url;x=E?E+`#${a}`:x;const l=w(String(r),S),h=w(c,S);return e.jsx("div",{className:"search-results-wrapper searching-results",style:{display:"flex",flexDirection:"column"},children:e.jsxs("div",{className:"has-standard-12-font-size",onClick:N=>document.location.href=x,children:[e.jsx("h5",{className:"breadcrumbs-search",dangerouslySetInnerHTML:{__html:d&&d.length>0?w(d.join(" / "),S):""}}),e.jsx("div",{className:"has-standard-14-font-size",children:e.jsx("h4",{className:"search-title",dangerouslySetInnerHTML:{__html:l}})}),e.jsx("div",{className:"search-content",dangerouslySetInnerHTML:{__html:v.utils.replaceHTMLinks(h,f)}})]})})}),T=({results:s,meta:r,perPage:a,intl:i,searchTerm:t})=>{const n=r?r["x-wp-total"]:0;return r&&r["x-wp-totalpages"],e.jsxs("div",{id:"float-results-container",children:[e.jsx("span",{className:"float-results-header",children:i.formatMessage({id:"search.results.summary",defaultMessage:"{count} of {total} Results"},{count:n<a?n:a,total:n})}),s.map(c=>e.jsx(R,{...c,searchTerm:t},c.ID))]})},_=({onSearch:s,perPage:r,loading:a,results:i,meta:t,intl:n})=>(t&&t["x-wp-total"],t&&t["x-wp-totalpages"],e.jsx("input",{placeholder:n.formatMessage({id:"search.placeholder",defaultMessage:"Search..."}),type:"text",className:"input search",name:"search",onChange:c=>{s(c.target.value)}})),b=({onSearch:s,onSetSelected:r,perPage:a,loading:i,results:t,meta:n,locale:c,intl:u,searchTerm:m,selected:y})=>{const[g,d]=p.useState(!1),o=p.useRef(null),f=()=>{d(!1)},S=()=>{const l=document.getElementsByClassName("has-child-items");for(let h=0;h<l.length;h++){const j=l[h].getElementsByTagName("span");j.length>0&&j[0].addEventListener("mouseover",f)}},x=()=>{const l=document.getElementsByClassName("has-child-items");for(let h=0;h<l.length;h++){const j=l[h].getElementsByTagName("span");j.length>0&&j[0].removeEventListener("mouseover",f)}};p.useEffect(()=>{const l=document.createElement("div");l.setAttribute("id","float-input-container"),l.setAttribute("class","input container"),l.style.display="none";const h=document.getElementById("root");return h&&(h.appendChild(l),o.current=l),()=>{o.current&&o.current.parentNode&&o.current.parentNode.removeChild(o.current)}},[]),p.useEffect(()=>{o.current&&(o.current.style.display=g?"block":"none"),g?S():x()},[g]);const E=()=>{d(!0)};return e.jsxs(e.Fragment,{children:[e.jsx("div",{id:"ui-float-search",className:"ui float-search",onMouseOver:E,children:e.jsx(L.Icon,{name:"search",size:"small"})}),o.current&&M.createPortal(g?e.jsxs("div",{onMouseLeave:f,children:[e.jsx("div",{className:"float-search-container",children:e.jsx(_,{onSearch:s,perPage:a,loading:i,results:t,meta:n,intl:u,searchTerm:m})}),t&&t.length>0&&e.jsx(C.IntlProvider,{locale:c,children:e.jsx(T,{results:t,meta:n,perPage:a,intl:u,searchTerm:m})})]}):null,o.current)]})},q=({onSearch:s,perPage:r,loading:a,results:i,meta:t,intl:n})=>{const c=t?t["x-wp-total"]:0,u=t?t["x-wp-totalpages"]:0,[m,y]=p.useState("");p.useEffect(()=>{const d=setTimeout(()=>{s(m)},300);return()=>clearTimeout(d)},[m]);const g=d=>e.jsx(R,{...d,searchTerm:m});return e.jsx(I.default,{value:m,loading:a,placeholder:n.formatMessage({id:"search.placeholder",defaultMessage:"Search..."}),onResultSelect:(d,o)=>null,total:c,perPage:r,totalPages:u,onSearchChange:(d,o)=>{y(o.value)},resultRenderer:g,results:i,showNoResults:!1,intl:n,searchTerm:m})},P=C.injectIntl(s=>{const{intl:r,onSetSelected:a}=s,[i,t]=p.useState(""),[n,c]=p.useState(!1);return p.useEffect(()=>{const u=()=>{c(window.innerWidth<=1365)};return u(),window.addEventListener("resize",u),()=>window.removeEventListener("resize",u)},[]),e.jsx(v.SearchProvider,{search:i,perPage:5,locale:r.locale,children:e.jsx(z,{...s,onSetSelected:a,setQuery:t,query:i,isSmallScreen:n,intl:r})})}),z=({onSetSelected:s,selected:r,setQuery:a,query:i,isSmallScreen:t,intl:n,...c})=>{const u=p.useContext(v.SearchContext);return c.settings.react_search_type==="floating"||t?e.jsx(b,{onSetSelected:s,selected:r,onSearch:a,perPage:5,intl:n,...c,...u,searchTerm:i}):e.jsx(q,{onSetSelected:s,onSearch:a,perPage:5,intl:n,...c,...u})};exports.default=P;
@@ -1,52 +1,52 @@
1
1
  import { jsx as t, jsxs as c } from "react/jsx-runtime";
2
2
  import { PostProvider as p, PostConsumer as g, PostIntro as m } from "@devgateway/wp-react-lib";
3
3
  import { Container as f } from "semantic-ui-react";
4
- import { CarouselProvider as x, Slider as y, Slide as P, DotGroup as S } from "pure-react-carousel";
5
- const v = (r) => {
6
- let o = 0;
7
- const { posts: e, height: a, interval: s, autoSwitch: i } = r;
4
+ import { CarouselProvider as P, Slider as x, Slide as y, DotGroup as S } from "pure-react-carousel";
5
+ const v = (i) => {
6
+ let r = 0;
7
+ const { posts: e, height: o, interval: s, autoSwitch: a } = i;
8
8
  return (
9
9
  // @ts-ignore
10
10
  /* @__PURE__ */ c(
11
- x,
11
+ P,
12
12
  {
13
13
  interval: s,
14
- isPlaying: i,
14
+ isPlaying: a,
15
15
  totalSlides: e.length,
16
- naturalSlideHeight: a,
16
+ naturalSlideHeight: o,
17
17
  children: [
18
- /* @__PURE__ */ t(y, { style: { height: `${a}px` }, trayTag: "ul", children: e.map((l) => /* @__PURE__ */ t(P, { index: o++, tag: "li", children: /* @__PURE__ */ t(m, { post: l, fluid: !0 }) })) }),
18
+ /* @__PURE__ */ t(x, { trayTag: "ul", children: e.map((l) => /* @__PURE__ */ t(y, { index: r++, tag: "li", children: /* @__PURE__ */ t(m, { post: l, fluid: !0 }) })) }),
19
19
  /* @__PURE__ */ t(S, {})
20
20
  ]
21
21
  }
22
22
  )
23
23
  );
24
- }, _ = (r) => {
24
+ }, $ = (i) => {
25
25
  const {
26
- "data-type": o,
26
+ "data-type": r,
27
27
  "data-taxonomy": e,
28
- "data-categories": a,
28
+ "data-categories": o,
29
29
  "data-items": s,
30
- "data-height": i,
30
+ "data-height": a,
31
31
  "data-auto-switch": l = "false",
32
32
  "data-interval": n = 1e4,
33
33
  editing: d,
34
34
  parent: u,
35
35
  unique: h
36
- } = r;
37
- return /* @__PURE__ */ t(f, { style: { height: `${i}px` }, className: `viz post carousel ${d ? "editing" : ""}`, fluid: !0, children: /* @__PURE__ */ t(
36
+ } = i;
37
+ return /* @__PURE__ */ t(f, { style: { height: `${a}px` }, className: `viz post carousel ${d ? "editing" : ""}`, fluid: !0, children: /* @__PURE__ */ t(
38
38
  p,
39
39
  {
40
- type: o,
40
+ type: r,
41
41
  taxonomy: e,
42
- categories: a,
42
+ categories: o,
43
43
  store: "carousel_" + u + "_" + h,
44
44
  page: 1,
45
45
  perPage: s,
46
- children: /* @__PURE__ */ t(g, { children: /* @__PURE__ */ t(v, { height: i, interval: n, autoSwitch: l == "true" }) })
46
+ children: /* @__PURE__ */ t(g, { children: /* @__PURE__ */ t(v, { height: a, interval: n, autoSwitch: l == "true" }) })
47
47
  }
48
48
  ) });
49
49
  };
50
50
  export {
51
- _ as default
51
+ $ as default
52
52
  };
@@ -1,7 +1,7 @@
1
1
  import { jsx as e, jsxs as u } from "react/jsx-runtime";
2
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";
3
+ import L, { 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 E } 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";
@@ -25,7 +25,7 @@ const W = (r, s) => {
25
25
  return "";
26
26
  }, q = R(({ menu: r, intl: s }) => {
27
27
  const t = $(), i = W(r, t);
28
- return /* @__PURE__ */ e(E.Fragment, { children: i.filter((a) => a.url != "#wpm-languages").map(
28
+ return /* @__PURE__ */ e(L.Fragment, { children: i.filter((a) => a.url != "#wpm-languages").map(
29
29
  (a) => a.child_items ? /* @__PURE__ */ u("span", { children: [
30
30
  a.post_title,
31
31
  " "
@@ -52,13 +52,13 @@ const W = (r, s) => {
52
52
  intl: { locale: g },
53
53
  isSmallScreen: D
54
54
  }) => {
55
- const L = $();
55
+ const z = $();
56
56
  _(
57
57
  (n) => {
58
- const l = W(i, L).filter((f) => f.menu_item_parent == 0);
58
+ const l = W(i, z).filter((f) => f.menu_item_parent == 0);
59
59
  l && l.length > 0 ? a(l[0]) : a(null);
60
60
  },
61
- [i, a, L.slug]
61
+ [i, a, z.slug]
62
62
  );
63
63
  const [v, I] = p(null);
64
64
  _(() => {
@@ -72,8 +72,8 @@ const W = (r, s) => {
72
72
  Object.keys(r.menu_settings).map((l) => {
73
73
  const f = r.menu_settings[l];
74
74
  if (f.type == "nav_menu_item") {
75
- const S = /(-)?[0-9]+/g.exec(l), z = parseInt(S[0]);
76
- h.find((c) => c.ID == z) || h.push(f.value);
75
+ const S = /(-)?[0-9]+/g.exec(l), k = parseInt(S[0]);
76
+ h.find((c) => c.ID == k) || h.push(f.value);
77
77
  }
78
78
  }), I({
79
79
  ...i,
@@ -87,7 +87,7 @@ const W = (r, s) => {
87
87
  M(window.innerWidth <= 1200);
88
88
  };
89
89
  return n(), window.addEventListener("resize", n), () => window.removeEventListener("resize", n);
90
- }, []), v && /* @__PURE__ */ e(E.Fragment, { children: v.items.filter((n) => n.url !== "#wpm-languages").map((n, h) => /* @__PURE__ */ u(E.Fragment, { children: [
90
+ }, []), v && /* @__PURE__ */ e(L.Fragment, { children: v.items.filter((n) => n.url !== "#wpm-languages").map((n, h) => /* @__PURE__ */ u(L.Fragment, { children: [
91
91
  /* @__PURE__ */ u(
92
92
  d.Item,
93
93
  {
@@ -121,7 +121,7 @@ const W = (r, s) => {
121
121
  ]
122
122
  }
123
123
  ),
124
- w && o && o.ID === n.ID && o.child_items && /* @__PURE__ */ e(E.Fragment, { children: o.child_items.map((l) => /* @__PURE__ */ u(
124
+ w && o && o.ID === n.ID && o.child_items && /* @__PURE__ */ e(L.Fragment, { children: o.child_items.map((l) => /* @__PURE__ */ u(
125
125
  d.Item,
126
126
  {
127
127
  className: `divided child-item ${t === l.slug ? "active" : ""}`,
@@ -135,7 +135,7 @@ const W = (r, s) => {
135
135
  ] }, n.ID)) });
136
136
  }
137
137
  ), G = ({ intl: r, settings: s }) => {
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 = () => {
138
+ const [t, i] = p(), [a, o] = p(!1), [g, D] = p(!1), [z, v] = p(!1), [I, w] = p(!1), { slug: M } = $(), n = y(null), h = y(null), l = () => {
139
139
  w(!I), o(!a);
140
140
  };
141
141
  _(() => {
@@ -166,11 +166,11 @@ const W = (r, s) => {
166
166
  };
167
167
  return c(), window.addEventListener("resize", c), () => window.removeEventListener("resize", c);
168
168
  }, []);
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: [
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" }), k = (s == null ? void 0 : s.landing_page_url) && s.landing_page_url !== !1 && s.landing_page_url !== void 0 && s.landing_page_url !== "", O = k ? s.landing_page_url : `/${r.locale}`;
170
+ return /* @__PURE__ */ e(L.Fragment, { children: /* @__PURE__ */ u(H, { slug: "main", locale: r.locale, children: [
171
171
  /* @__PURE__ */ u(b, { fluid: !0, className: "header", children: [
172
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: [
173
+ /* @__PURE__ */ e(d.Item, { children: /* @__PURE__ */ u("a", { href: `${O}`, target: k ? "_blank" : "_self", rel: "noopener noreferrer", id: "site_url", children: [
174
174
  s.site_logo !== 0 && !f && /* @__PURE__ */ e(A, { id: s.site_logo, children: /* @__PURE__ */ e(V, { children: /* @__PURE__ */ e(S, {}, "logo") }) }),
175
175
  s.site_logo === 0 && !f && /* @__PURE__ */ e(
176
176
  "img",
@@ -194,7 +194,7 @@ const W = (r, s) => {
194
194
  /* @__PURE__ */ e(P, { name: "za" }),
195
195
  /* @__PURE__ */ e("div", { className: "site name", children: s.name })
196
196
  ] }),
197
- !L && (g ? /* @__PURE__ */ e(d, { className: `pages ${a ? "show" : ""}`, children: /* @__PURE__ */ e(b, { fluid: !0, children: /* @__PURE__ */ e(k, { children: /* @__PURE__ */ e(
197
+ !z && (g ? /* @__PURE__ */ e(d, { className: `pages ${a ? "show" : ""}`, children: /* @__PURE__ */ e(b, { fluid: !0, children: /* @__PURE__ */ e(E, { children: /* @__PURE__ */ e(
198
198
  C,
199
199
  {
200
200
  settings: s,
@@ -204,7 +204,7 @@ const W = (r, s) => {
204
204
  isSmallScreen: g
205
205
  },
206
206
  "items"
207
- ) }) }) }) : /* @__PURE__ */ e(d.Menu, { className: "pages", children: /* @__PURE__ */ e(k, { children: /* @__PURE__ */ e(
207
+ ) }) }) }) : /* @__PURE__ */ e(d.Menu, { className: "pages", children: /* @__PURE__ */ e(E, { children: /* @__PURE__ */ e(
208
208
  C,
209
209
  {
210
210
  settings: s,
@@ -214,21 +214,20 @@ const W = (r, s) => {
214
214
  },
215
215
  "items"
216
216
  ) }) })),
217
- /* @__PURE__ */ e(d.Item, { children: /* @__PURE__ */ e(k, { children: /* @__PURE__ */ e(
217
+ /* @__PURE__ */ e(d.Item, { children: /* @__PURE__ */ e(E, { children: /* @__PURE__ */ e(
218
218
  K,
219
219
  {
220
220
  locale: r.locale
221
221
  },
222
222
  "lang"
223
223
  ) }) }),
224
- /* @__PURE__ */ e(d.Item, { fitted: !0, children: /* @__PURE__ */ e(
224
+ /* @__PURE__ */ e(d.Item, { fitted: !0, children: /* @__PURE__ */ e(E, { children: /* @__PURE__ */ e(
225
225
  B,
226
226
  {
227
227
  onSetSelected: i,
228
- selected: t,
229
228
  settings: s
230
229
  }
231
- ) }),
230
+ ) }) }),
232
231
  /* @__PURE__ */ u(
233
232
  "div",
234
233
  {
@@ -254,7 +253,7 @@ const W = (r, s) => {
254
253
  }
255
254
  ) }) })
256
255
  ] }, "header-container"),
257
- /* @__PURE__ */ e(b, { className: "url breadcrumbs", children: /* @__PURE__ */ e(k, { children: /* @__PURE__ */ e(q, {}) }) })
256
+ /* @__PURE__ */ e(b, { className: "url breadcrumbs", children: /* @__PURE__ */ e(E, { children: /* @__PURE__ */ e(q, {}) }) })
258
257
  ] }) });
259
258
  }, se = R(G);
260
259
  export {
@@ -1,72 +1,72 @@
1
- import { jsx as n, jsxs as w, Fragment as _ } from "react/jsx-runtime";
2
- import { useState as y, useEffect as v, useContext as L, useRef as E } from "react";
3
- import { utils as x, SearchProvider as T, SearchContext as b } from "@devgateway/wp-react-lib";
4
- import z from "./CustomSemanticSearch.js";
5
- import { createPortal as P } from "react-dom";
1
+ import { jsx as t, jsxs as y, Fragment as T } from "react/jsx-runtime";
2
+ import { useState as w, useEffect as E, useContext as _, useRef as b } from "react";
3
+ import { utils as x, SearchProvider as z, SearchContext as H } from "@devgateway/wp-react-lib";
4
+ import P from "./CustomSemanticSearch.js";
5
+ import { createPortal as B } from "react-dom";
6
6
  import { Icon as F } from "semantic-ui-react";
7
- import { injectIntl as I, IntlProvider as j } from "react-intl";
8
- const C = (s, t) => {
9
- if (!s || !t) return s || "";
10
- const o = new RegExp(`(${t})`, "gi");
11
- return s.replace(o, "<strong>$1</strong>");
12
- }, N = I(
7
+ import { injectIntl as M, IntlProvider as j } from "react-intl";
8
+ const I = (r, s) => {
9
+ if (!r || !s) return r || "";
10
+ const o = new RegExp(`(${s})`, "gi");
11
+ return r.replace(o, "<strong>$1</strong>");
12
+ }, R = M(
13
13
  ({
14
- ID: s,
15
- title: t,
14
+ ID: r,
15
+ title: s,
16
16
  slug: o,
17
17
  parent_title: i,
18
18
  parent_slug: e,
19
- parent_link: r,
20
- extract: c,
21
- type: u,
22
- link: d,
23
- terms: p,
24
- subtype: m,
25
- bread_crumbs: l = [],
26
- metadata: a,
19
+ parent_link: n,
20
+ extract: a,
21
+ type: d,
22
+ link: m,
23
+ terms: C,
24
+ subtype: p,
25
+ bread_crumbs: h = [],
26
+ metadata: l,
27
27
  intl: { locale: f },
28
28
  searchTerm: g
29
29
  // Added searchTerm prop
30
30
  }) => {
31
- let h = r ? x.replaceLink(r, f) + `#${o}` : x.replaceLink(d, f);
32
- const S = a == null ? void 0 : a.redirect_url;
33
- h = S ? S + `#${o}` : h;
34
- const M = C(String(t), g), R = C(c, g);
35
- return /* @__PURE__ */ n(
31
+ let S = n ? x.replaceLink(n, f) + `#${o}` : x.replaceLink(m, f);
32
+ const N = l == null ? void 0 : l.redirect_url;
33
+ S = N ? N + `#${o}` : S;
34
+ const c = I(String(s), g), u = I(a, g);
35
+ return /* @__PURE__ */ t(
36
36
  "div",
37
37
  {
38
38
  className: "search-results-wrapper searching-results",
39
39
  style: { display: "flex", flexDirection: "column" },
40
- children: /* @__PURE__ */ w(
40
+ children: /* @__PURE__ */ y(
41
41
  "div",
42
42
  {
43
43
  className: "has-standard-12-font-size",
44
- onClick: (q) => document.location.href = h,
44
+ onClick: (L) => document.location.href = S,
45
45
  children: [
46
- /* @__PURE__ */ n(
46
+ /* @__PURE__ */ t(
47
47
  "h5",
48
48
  {
49
49
  className: "breadcrumbs-search",
50
50
  dangerouslySetInnerHTML: {
51
- __html: l && l.length > 0 ? C(l.join(" / "), g) : ""
51
+ __html: h && h.length > 0 ? I(h.join(" / "), g) : ""
52
52
  }
53
53
  }
54
54
  ),
55
- /* @__PURE__ */ n("div", { className: "has-standard-14-font-size", children: /* @__PURE__ */ n(
55
+ /* @__PURE__ */ t("div", { className: "has-standard-14-font-size", children: /* @__PURE__ */ t(
56
56
  "h4",
57
57
  {
58
58
  className: "search-title",
59
59
  dangerouslySetInnerHTML: {
60
- __html: M
60
+ __html: c
61
61
  }
62
62
  }
63
63
  ) }),
64
- /* @__PURE__ */ n(
64
+ /* @__PURE__ */ t(
65
65
  "div",
66
66
  {
67
67
  className: "search-content",
68
68
  dangerouslySetInnerHTML: {
69
- __html: x.replaceHTMLinks(R, f)
69
+ __html: x.replaceHTMLinks(u, f)
70
70
  }
71
71
  }
72
72
  )
@@ -76,184 +76,193 @@ const C = (s, t) => {
76
76
  }
77
77
  );
78
78
  }
79
- ), k = ({ results: s, meta: t, perPage: o, intl: i, searchTerm: e }) => {
80
- const r = t ? t["x-wp-total"] : 0;
81
- return t && t["x-wp-totalpages"], /* @__PURE__ */ w("div", { id: "float-results-container", children: [
82
- /* @__PURE__ */ n("span", { className: "float-results-header", children: i.formatMessage(
79
+ ), k = ({ results: r, meta: s, perPage: o, intl: i, searchTerm: e }) => {
80
+ const n = s ? s["x-wp-total"] : 0;
81
+ return s && s["x-wp-totalpages"], /* @__PURE__ */ y("div", { id: "float-results-container", children: [
82
+ /* @__PURE__ */ t("span", { className: "float-results-header", children: i.formatMessage(
83
83
  {
84
84
  id: "search.results.summary",
85
85
  defaultMessage: "{count} of {total} Results"
86
86
  },
87
- { count: r < o ? r : o, total: r }
87
+ { count: n < o ? n : o, total: n }
88
88
  ) }),
89
- s.map((c) => /* @__PURE__ */ n(N, { ...c, searchTerm: e }, c.ID))
89
+ r.map((a) => /* @__PURE__ */ t(R, { ...a, searchTerm: e }, a.ID))
90
90
  ] });
91
91
  }, D = ({
92
- onSearch: s,
93
- perPage: t,
92
+ onSearch: r,
93
+ perPage: s,
94
94
  loading: o,
95
95
  results: i,
96
96
  meta: e,
97
- intl: r
98
- }) => (e && e["x-wp-total"], e && e["x-wp-totalpages"], /* @__PURE__ */ n(
97
+ intl: n
98
+ }) => (e && e["x-wp-total"], e && e["x-wp-totalpages"], /* @__PURE__ */ t(
99
99
  "input",
100
100
  {
101
- placeholder: r.formatMessage({
101
+ placeholder: n.formatMessage({
102
102
  id: "search.placeholder",
103
103
  defaultMessage: "Search..."
104
104
  }),
105
105
  type: "text",
106
106
  className: "input search",
107
107
  name: "search",
108
- onChange: (c) => {
109
- s(c.target.value);
108
+ onChange: (a) => {
109
+ r(a.target.value);
110
110
  }
111
111
  }
112
- )), H = ({
113
- onSearch: s,
114
- onSetSelected: t,
112
+ )), $ = ({
113
+ onSearch: r,
114
+ onSetSelected: s,
115
115
  perPage: o,
116
116
  loading: i,
117
117
  results: e,
118
- meta: r,
119
- locale: c,
120
- intl: u,
121
- searchTerm: d,
118
+ meta: n,
119
+ locale: a,
120
+ intl: d,
121
+ searchTerm: m,
122
122
  // Added search from SearchConsumer
123
- selected: p
123
+ selected: C
124
124
  // Added selected prop to track menu selection
125
125
  }) => {
126
- const [m, l] = y(!1), a = E(null);
127
- v(() => {
128
- const h = document.createElement("div");
129
- h.setAttribute("id", "float-input-container"), h.setAttribute("class", "input container"), h.style.display = "none";
130
- const S = document.getElementById("root");
131
- return S && (S.appendChild(h), a.current = h), () => {
132
- a.current && a.current.parentNode && a.current.parentNode.removeChild(a.current);
133
- };
134
- }, []), v(() => {
135
- a.current && (a.current.style.display = m ? "block" : "none");
136
- }, [m]), v(() => {
137
- p && p.child_items && l(!1);
138
- }, [p]);
139
- const f = () => {
140
- t(null), l(!0);
126
+ const [p, h] = w(!1), l = b(null), f = () => {
127
+ h(!1);
141
128
  }, g = () => {
142
- l(!1);
129
+ const c = document.getElementsByClassName("has-child-items");
130
+ for (let u = 0; u < c.length; u++) {
131
+ const v = c[u].getElementsByTagName("span");
132
+ v.length > 0 && v[0].addEventListener("mouseover", f);
133
+ }
134
+ }, S = () => {
135
+ const c = document.getElementsByClassName("has-child-items");
136
+ for (let u = 0; u < c.length; u++) {
137
+ const v = c[u].getElementsByTagName("span");
138
+ v.length > 0 && v[0].removeEventListener("mouseover", f);
139
+ }
143
140
  };
144
- return /* @__PURE__ */ w(_, { children: [
145
- /* @__PURE__ */ n(
141
+ return E(() => {
142
+ const c = document.createElement("div");
143
+ c.setAttribute("id", "float-input-container"), c.setAttribute("class", "input container"), c.style.display = "none";
144
+ const u = document.getElementById("root");
145
+ return u && (u.appendChild(c), l.current = c), () => {
146
+ l.current && l.current.parentNode && l.current.parentNode.removeChild(l.current);
147
+ };
148
+ }, []), E(() => {
149
+ l.current && (l.current.style.display = p ? "block" : "none"), p ? g() : S();
150
+ }, [p]), /* @__PURE__ */ y(T, { children: [
151
+ /* @__PURE__ */ t(
146
152
  "div",
147
153
  {
148
154
  id: "ui-float-search",
149
155
  className: "ui float-search",
150
- onMouseOver: f,
151
- children: /* @__PURE__ */ n(F, { name: "search", size: "small" })
156
+ onMouseOver: () => {
157
+ h(!0);
158
+ },
159
+ children: /* @__PURE__ */ t(F, { name: "search", size: "small" })
152
160
  }
153
161
  ),
154
- a.current && P(
155
- m ? /* @__PURE__ */ w("div", { onMouseLeave: g, children: [
156
- /* @__PURE__ */ n("div", { className: "float-search-container", children: /* @__PURE__ */ n(
162
+ l.current && B(
163
+ p ? /* @__PURE__ */ y("div", { onMouseLeave: f, children: [
164
+ /* @__PURE__ */ t("div", { className: "float-search-container", children: /* @__PURE__ */ t(
157
165
  D,
158
166
  {
159
- onSearch: s,
167
+ onSearch: r,
160
168
  perPage: o,
161
169
  loading: i,
162
170
  results: e,
163
- meta: r,
164
- intl: u,
165
- searchTerm: d
171
+ meta: n,
172
+ intl: d,
173
+ searchTerm: m
166
174
  }
167
175
  ) }),
168
- e && e.length > 0 && /* @__PURE__ */ n(j, { locale: c, children: /* @__PURE__ */ n(
176
+ e && e.length > 0 && /* @__PURE__ */ t(j, { locale: a, children: /* @__PURE__ */ t(
169
177
  k,
170
178
  {
171
179
  results: e,
172
- meta: r,
180
+ meta: n,
173
181
  perPage: o,
174
- intl: u,
175
- searchTerm: d
182
+ intl: d,
183
+ searchTerm: m
176
184
  }
177
185
  ) })
178
186
  ] }) : null,
179
- a.current
187
+ l.current
180
188
  )
181
189
  ] });
182
- }, $ = ({ onSearch: s, perPage: t, loading: o, results: i, meta: e, intl: r }) => {
183
- const c = e ? e["x-wp-total"] : 0, u = e ? e["x-wp-totalpages"] : 0, [d, p] = y("");
184
- v(() => {
185
- const l = setTimeout(() => {
186
- s(d);
190
+ }, W = ({ onSearch: r, perPage: s, loading: o, results: i, meta: e, intl: n }) => {
191
+ const a = e ? e["x-wp-total"] : 0, d = e ? e["x-wp-totalpages"] : 0, [m, C] = w("");
192
+ E(() => {
193
+ const h = setTimeout(() => {
194
+ r(m);
187
195
  }, 300);
188
- return () => clearTimeout(l);
189
- }, [d]);
190
- const m = (l) => /* @__PURE__ */ n(N, { ...l, searchTerm: d });
191
- return /* @__PURE__ */ n(
192
- z,
196
+ return () => clearTimeout(h);
197
+ }, [m]);
198
+ const p = (h) => /* @__PURE__ */ t(R, { ...h, searchTerm: m });
199
+ return /* @__PURE__ */ t(
200
+ P,
193
201
  {
194
- value: d,
202
+ value: m,
195
203
  loading: o,
196
- placeholder: r.formatMessage({
204
+ placeholder: n.formatMessage({
197
205
  id: "search.placeholder",
198
206
  defaultMessage: "Search..."
199
207
  }),
200
- onResultSelect: (l, a) => null,
201
- total: c,
202
- perPage: t,
203
- totalPages: u,
204
- onSearchChange: (l, a) => {
205
- p(a.value);
208
+ onResultSelect: (h, l) => null,
209
+ total: a,
210
+ perPage: s,
211
+ totalPages: d,
212
+ onSearchChange: (h, l) => {
213
+ C(l.value);
206
214
  },
207
- resultRenderer: m,
215
+ resultRenderer: p,
208
216
  results: i,
209
217
  showNoResults: !1,
210
- intl: r,
211
- searchTerm: d
218
+ intl: n,
219
+ searchTerm: m
212
220
  }
213
221
  );
214
- }, U = I((s) => {
215
- const { intl: t, onSetSelected: o } = s, [i, e] = y(""), [r, c] = y(!1);
216
- return v(() => {
217
- const u = () => {
218
- c(window.innerWidth <= 1365);
222
+ }, V = M((r) => {
223
+ const { intl: s, onSetSelected: o } = r, [i, e] = w(""), [n, a] = w(!1);
224
+ return E(() => {
225
+ const d = () => {
226
+ a(window.innerWidth <= 1365);
219
227
  };
220
- return u(), window.addEventListener("resize", u), () => window.removeEventListener("resize", u);
221
- }, []), /* @__PURE__ */ n(T, { search: i, perPage: 5, locale: t.locale, children: /* @__PURE__ */ n(
228
+ return d(), window.addEventListener("resize", d), () => window.removeEventListener("resize", d);
229
+ }, []), /* @__PURE__ */ t(z, { search: i, perPage: 5, locale: s.locale, children: /* @__PURE__ */ t(
222
230
  A,
223
231
  {
224
- ...s,
232
+ ...r,
225
233
  onSetSelected: o,
226
234
  setQuery: e,
227
235
  query: i,
228
- isSmallScreen: r,
229
- intl: t
236
+ isSmallScreen: n,
237
+ intl: s
230
238
  }
231
239
  ) });
232
- }), A = ({ onSetSelected: s, setQuery: t, query: o, isSmallScreen: i, intl: e, ...r }) => {
233
- const c = L(b);
234
- return r.settings.react_search_type === "floating" || i ? /* @__PURE__ */ n(
235
- H,
240
+ }), A = ({ onSetSelected: r, selected: s, setQuery: o, query: i, isSmallScreen: e, intl: n, ...a }) => {
241
+ const d = _(H);
242
+ return a.settings.react_search_type === "floating" || e ? /* @__PURE__ */ t(
243
+ $,
236
244
  {
237
- onSetSelected: s,
238
- onSearch: t,
245
+ onSetSelected: r,
246
+ selected: s,
247
+ onSearch: o,
239
248
  perPage: 5,
240
- intl: e,
241
- ...r,
242
- ...c,
243
- searchTerm: o
249
+ intl: n,
250
+ ...a,
251
+ ...d,
252
+ searchTerm: i
244
253
  }
245
- ) : /* @__PURE__ */ n(
246
- $,
254
+ ) : /* @__PURE__ */ t(
255
+ W,
247
256
  {
248
- onSetSelected: s,
249
- onSearch: t,
257
+ onSetSelected: r,
258
+ onSearch: o,
250
259
  perPage: 5,
251
- intl: e,
252
- ...r,
253
- ...c
260
+ intl: n,
261
+ ...a,
262
+ ...d
254
263
  }
255
264
  );
256
265
  };
257
266
  export {
258
- U as default
267
+ V as default
259
268
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devgateway/dvz-ui-react",
3
- "version": "1.6.10",
3
+ "version": "1.6.12",
4
4
  "main": "dist/cjs/index.js",
5
5
  "module": "dist/esm/index.js",
6
6
  "types": "dist/types/index.d.ts",