@devgateway/dvz-ui-react 1.6.9 → 1.6.11

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,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,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"),d=require("react"),m=require("@devgateway/wp-react-lib"),M=require("./CustomSemanticSearch.js"),C=require("react-dom"),N=require("semantic-ui-react"),v=require("react-intl"),j=(c,n)=>{if(!c||!n)return c||"";const a=new RegExp(`(${n})`,"gi");return c.replace(a,"<strong>$1</strong>")},y=v.injectIntl(({ID:c,title:n,slug:a,parent_title:l,parent_slug:t,parent_link:s,extract:o,type:i,link:u,terms:f,subtype:S,bread_crumbs:r=[],metadata:p,intl:{locale:g},searchTerm:h})=>{let x=s?m.utils.replaceLink(s,g)+`#${a}`:m.utils.replaceLink(u,g);const w=p==null?void 0:p.redirect_url;x=w?w+`#${a}`:x;const R=j(String(n),h),I=j(o,h);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=x,children:[e.jsx("h5",{className:"breadcrumbs-search",dangerouslySetInnerHTML:{__html:r&&r.length>0?j(r.join(" / "),h):""}}),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:m.utils.replaceHTMLinks(I,g)}})]})})}),E=({results:c,meta:n,perPage:a,intl:l,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:l.formatMessage({id:"search.results.summary",defaultMessage:"{count} of {total} Results"},{count:s<a?s:a,total:s})}),c.map(o=>e.jsx(y,{...o,searchTerm:t},o.ID))]})},_=({onSearch:c,perPage:n,loading:a,results:l,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=>{c(o.target.value)}})),L=({onSearch:c,onSetSelected:n,perPage:a,loading:l,results:t,meta:s,locale:o,intl:i,searchTerm:u})=>{const[f,S]=d.useState(!1),r=d.useRef(null);d.useEffect(()=>{const h=document.createElement("div");h.setAttribute("id","float-input-container"),h.setAttribute("class","input container"),h.style.display="none";const x=document.getElementById("root");return x&&(x.appendChild(h),r.current=h),()=>{r.current&&r.current.parentNode&&r.current.parentNode.removeChild(r.current)}},[]),d.useEffect(()=>{r.current&&(r.current.style.display=f?"block":"none")},[f]);const p=()=>{n(null),S(!0)},g=()=>{S(!1)};return e.jsxs(e.Fragment,{children:[e.jsx("div",{id:"ui-float-search",className:"ui float-search",onMouseOver:p,children:e.jsx(N.Icon,{name:"search",size:"small"})}),r.current&&C.createPortal(f?e.jsxs("div",{onMouseLeave:g,children:[e.jsx("div",{className:"float-search-container",children:e.jsx(_,{onSearch:c,perPage:a,loading:l,results:t,meta:s,intl:i,searchTerm:u})}),t&&t.length>0&&e.jsx(v.IntlProvider,{locale:o,children:e.jsx(E,{results:t,meta:s,perPage:a,intl:i,searchTerm:u})})]}):null,r.current)]})},b=({onSearch:c,perPage:n,loading:a,results:l,meta:t,intl:s})=>{const o=t?t["x-wp-total"]:0,i=t?t["x-wp-totalpages"]:0,[u,f]=d.useState("");d.useEffect(()=>{const r=setTimeout(()=>{c(u)},300);return()=>clearTimeout(r)},[u]);const S=r=>e.jsx(y,{...r,searchTerm:u});return e.jsx(M.default,{value:u,loading:a,placeholder:s.formatMessage({id:"search.placeholder",defaultMessage:"Search..."}),onResultSelect:(r,p)=>null,total:o,perPage:n,totalPages:i,onSearchChange:(r,p)=>{f(p.value)},resultRenderer:S,results:l,showNoResults:!1,intl:s,searchTerm:u})},q=v.injectIntl(c=>{const{intl:n,onSetSelected:a}=c,[l,t]=d.useState(""),[s,o]=d.useState(!1);return d.useEffect(()=>{const i=()=>{o(window.innerWidth<=1365)};return i(),window.addEventListener("resize",i),()=>window.removeEventListener("resize",i)},[]),e.jsx(m.SearchProvider,{search:l,perPage:5,locale:n.locale,children:e.jsx(T,{...c,onSetSelected:a,setQuery:t,query:l,isSmallScreen:s,intl:n})})}),T=({onSetSelected:c,setQuery:n,query:a,isSmallScreen:l,intl:t,...s})=>{const o=d.useContext(m.SearchContext);return s.settings.react_search_type==="floating"||l?e.jsx(L,{onSetSelected:c,onSearch:n,perPage:5,intl:t,...s,...o,searchTerm:a}):e.jsx(b,{onSetSelected:c,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,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,20 +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
228
  settings: s
229
229
  }
230
- ) }),
230
+ ) }) }),
231
231
  /* @__PURE__ */ u(
232
232
  "div",
233
233
  {
@@ -253,7 +253,7 @@ const W = (r, s) => {
253
253
  }
254
254
  ) }) })
255
255
  ] }, "header-container"),
256
- /* @__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, {}) }) })
257
257
  ] }) });
258
258
  }, se = R(G);
259
259
  export {
@@ -1,72 +1,72 @@
1
- import { jsx as n, jsxs as S, Fragment as L } from "react/jsx-runtime";
2
- import { useState as v, useEffect as w, useContext as _, useRef as E } from "react";
3
- import { utils as y, 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 x = (o, t) => {
9
- if (!o || !t) return o || "";
10
- const a = new RegExp(`(${t})`, "gi");
11
- return o.replace(a, "<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: o,
15
- title: t,
16
- slug: a,
17
- parent_title: l,
14
+ ID: r,
15
+ title: s,
16
+ slug: o,
17
+ parent_title: i,
18
18
  parent_slug: e,
19
- parent_link: r,
20
- extract: c,
21
- type: i,
22
- link: u,
23
- terms: p,
24
- subtype: f,
25
- bread_crumbs: s = [],
26
- metadata: h,
27
- intl: { locale: g },
28
- searchTerm: d
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
+ intl: { locale: f },
28
+ searchTerm: g
29
29
  // Added searchTerm prop
30
30
  }) => {
31
- let m = r ? y.replaceLink(r, g) + `#${a}` : y.replaceLink(u, g);
32
- const C = h == null ? void 0 : h.redirect_url;
33
- m = C ? C + `#${a}` : m;
34
- const M = x(String(t), d), R = x(c, d);
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__ */ S(
40
+ children: /* @__PURE__ */ y(
41
41
  "div",
42
42
  {
43
43
  className: "has-standard-12-font-size",
44
- onClick: (q) => document.location.href = m,
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: s && s.length > 0 ? x(s.join(" / "), d) : ""
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: y.replaceHTMLinks(R, g)
69
+ __html: x.replaceHTMLinks(u, f)
70
70
  }
71
71
  }
72
72
  )
@@ -76,180 +76,193 @@ const x = (o, t) => {
76
76
  }
77
77
  );
78
78
  }
79
- ), k = ({ results: o, meta: t, perPage: a, intl: l, searchTerm: e }) => {
80
- const r = t ? t["x-wp-total"] : 0;
81
- return t && t["x-wp-totalpages"], /* @__PURE__ */ S("div", { id: "float-results-container", children: [
82
- /* @__PURE__ */ n("span", { className: "float-results-header", children: l.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 < a ? r : a, total: r }
87
+ { count: n < o ? n : o, total: n }
88
88
  ) }),
89
- o.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: o,
93
- perPage: t,
94
- loading: a,
95
- results: l,
92
+ onSearch: r,
93
+ perPage: s,
94
+ loading: o,
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
- o(c.target.value);
108
+ onChange: (a) => {
109
+ r(a.target.value);
110
110
  }
111
111
  }
112
- )), H = ({
113
- onSearch: o,
114
- onSetSelected: t,
115
- perPage: a,
116
- loading: l,
112
+ )), $ = ({
113
+ onSearch: r,
114
+ onSetSelected: s,
115
+ perPage: o,
116
+ loading: i,
117
117
  results: e,
118
- meta: r,
119
- locale: c,
120
- intl: i,
121
- searchTerm: u
118
+ meta: n,
119
+ locale: a,
120
+ intl: d,
121
+ searchTerm: m,
122
122
  // Added search from SearchConsumer
123
+ selected: C
124
+ // Added selected prop to track menu selection
123
125
  }) => {
124
- const [p, f] = v(!1), s = E(null);
125
- w(() => {
126
- const d = document.createElement("div");
127
- d.setAttribute("id", "float-input-container"), d.setAttribute("class", "input container"), d.style.display = "none";
128
- const m = document.getElementById("root");
129
- return m && (m.appendChild(d), s.current = d), () => {
130
- s.current && s.current.parentNode && s.current.parentNode.removeChild(s.current);
131
- };
132
- }, []), w(() => {
133
- s.current && (s.current.style.display = p ? "block" : "none");
134
- }, [p]);
135
- const h = () => {
136
- t(null), f(!0);
126
+ const [p, h] = w(!1), l = b(null), f = () => {
127
+ h(!1);
137
128
  }, g = () => {
138
- f(!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
+ }
139
140
  };
140
- return /* @__PURE__ */ S(L, { children: [
141
- /* @__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(
142
152
  "div",
143
153
  {
144
154
  id: "ui-float-search",
145
155
  className: "ui float-search",
146
- onMouseOver: h,
147
- children: /* @__PURE__ */ n(F, { name: "search", size: "small" })
156
+ onMouseOver: () => {
157
+ h(!0);
158
+ },
159
+ children: /* @__PURE__ */ t(F, { name: "search", size: "small" })
148
160
  }
149
161
  ),
150
- s.current && P(
151
- p ? /* @__PURE__ */ S("div", { onMouseLeave: g, children: [
152
- /* @__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(
153
165
  D,
154
166
  {
155
- onSearch: o,
156
- perPage: a,
157
- loading: l,
167
+ onSearch: r,
168
+ perPage: o,
169
+ loading: i,
158
170
  results: e,
159
- meta: r,
160
- intl: i,
161
- searchTerm: u
171
+ meta: n,
172
+ intl: d,
173
+ searchTerm: m
162
174
  }
163
175
  ) }),
164
- 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(
165
177
  k,
166
178
  {
167
179
  results: e,
168
- meta: r,
169
- perPage: a,
170
- intl: i,
171
- searchTerm: u
180
+ meta: n,
181
+ perPage: o,
182
+ intl: d,
183
+ searchTerm: m
172
184
  }
173
185
  ) })
174
186
  ] }) : null,
175
- s.current
187
+ l.current
176
188
  )
177
189
  ] });
178
- }, $ = ({ onSearch: o, perPage: t, loading: a, results: l, meta: e, intl: r }) => {
179
- const c = e ? e["x-wp-total"] : 0, i = e ? e["x-wp-totalpages"] : 0, [u, p] = v("");
180
- w(() => {
181
- const s = setTimeout(() => {
182
- o(u);
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);
183
195
  }, 300);
184
- return () => clearTimeout(s);
185
- }, [u]);
186
- const f = (s) => /* @__PURE__ */ n(N, { ...s, searchTerm: u });
187
- return /* @__PURE__ */ n(
188
- z,
196
+ return () => clearTimeout(h);
197
+ }, [m]);
198
+ const p = (h) => /* @__PURE__ */ t(R, { ...h, searchTerm: m });
199
+ return /* @__PURE__ */ t(
200
+ P,
189
201
  {
190
- value: u,
191
- loading: a,
192
- placeholder: r.formatMessage({
202
+ value: m,
203
+ loading: o,
204
+ placeholder: n.formatMessage({
193
205
  id: "search.placeholder",
194
206
  defaultMessage: "Search..."
195
207
  }),
196
- onResultSelect: (s, h) => null,
197
- total: c,
198
- perPage: t,
199
- totalPages: i,
200
- onSearchChange: (s, h) => {
201
- p(h.value);
208
+ onResultSelect: (h, l) => null,
209
+ total: a,
210
+ perPage: s,
211
+ totalPages: d,
212
+ onSearchChange: (h, l) => {
213
+ C(l.value);
202
214
  },
203
- resultRenderer: f,
204
- results: l,
215
+ resultRenderer: p,
216
+ results: i,
205
217
  showNoResults: !1,
206
- intl: r,
207
- searchTerm: u
218
+ intl: n,
219
+ searchTerm: m
208
220
  }
209
221
  );
210
- }, U = I((o) => {
211
- const { intl: t, onSetSelected: a } = o, [l, e] = v(""), [r, c] = v(!1);
212
- return w(() => {
213
- const i = () => {
214
- 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);
215
227
  };
216
- return i(), window.addEventListener("resize", i), () => window.removeEventListener("resize", i);
217
- }, []), /* @__PURE__ */ n(T, { search: l, 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(
218
230
  A,
219
231
  {
220
- ...o,
221
- onSetSelected: a,
232
+ ...r,
233
+ onSetSelected: o,
222
234
  setQuery: e,
223
- query: l,
224
- isSmallScreen: r,
225
- intl: t
235
+ query: i,
236
+ isSmallScreen: n,
237
+ intl: s
226
238
  }
227
239
  ) });
228
- }), A = ({ onSetSelected: o, setQuery: t, query: a, isSmallScreen: l, intl: e, ...r }) => {
229
- const c = _(b);
230
- return r.settings.react_search_type === "floating" || l ? /* @__PURE__ */ n(
231
- 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
+ $,
232
244
  {
233
- onSetSelected: o,
234
- onSearch: t,
245
+ onSetSelected: r,
246
+ selected: s,
247
+ onSearch: o,
235
248
  perPage: 5,
236
- intl: e,
237
- ...r,
238
- ...c,
239
- searchTerm: a
249
+ intl: n,
250
+ ...a,
251
+ ...d,
252
+ searchTerm: i
240
253
  }
241
- ) : /* @__PURE__ */ n(
242
- $,
254
+ ) : /* @__PURE__ */ t(
255
+ W,
243
256
  {
244
- onSetSelected: o,
245
- onSearch: t,
257
+ onSetSelected: r,
258
+ onSearch: o,
246
259
  perPage: 5,
247
- intl: e,
248
- ...r,
249
- ...c
260
+ intl: n,
261
+ ...a,
262
+ ...d
250
263
  }
251
264
  );
252
265
  };
253
266
  export {
254
- U as default
267
+ V as default
255
268
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devgateway/dvz-ui-react",
3
- "version": "1.6.9",
3
+ "version": "1.6.11",
4
4
  "main": "dist/cjs/index.js",
5
5
  "module": "dist/esm/index.js",
6
6
  "types": "dist/types/index.d.ts",
@@ -1,2 +0,0 @@
1
- export default useDynamicFavicon;
2
- declare function useDynamicFavicon(siteUrl: any): void;