@devgateway/dvz-ui-react 1.7.0 → 1.7.2

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 V=require("react/jsx-runtime"),C=require("react"),u=require("./Utils.js"),J=t=>{const{data:e,measures:l,swap:v,dimensions:f,locale:h,customLabels:d}=t;let i={};const S=f.filter(y=>y!=""),A=new Set;if(S.length==0&&e){const y=u.measuresMap(e),O=new Set,M=new Set;let E=[],R;if(e.metadata&&e.metadata.measures){const r=e.metadata.measures.filter(n=>l.includes(n.value)).sort((n,c)=>n.position!=null&&c.position!=null&&n.position!=c.position?n.position-c.position:0);E=[],R="measure",O.add("measure");const b={};Object.keys(e).forEach(n=>{b[n]=e[n]}),r.forEach(n=>{const c={},L=d[n.value]||u.getTranslatedValue(y[n.value],h);c.type="measure",c.measureFieldName=n.value,c.measure=L,c[L]=e[n.value],c.variables=b,E.push(c),M.add(L),A.add(y[n.value])}),i={categories:O,indexBy:R,keys:Array.from(M),measuresMetadata:A,data:E}}}return i},K=t=>{const{data:e,measures:l,dimensions:v,overallLabel:f}=t;if(v.length==1&&e.children){if(!(e.children.filter(d=>d.value==f).length>0)){const d={};d.type=v[0],d.value=f,d.label=f,Object.keys(e).forEach(i=>{["children","metadata","type","value"].includes(i)||(d[i]=e[i])}),e.children=[d,...e.children]}}else v.length==2&&e.children&&e.children.forEach(h=>{if(!(h.children.filter(i=>i.value==f).length>0)){const i={};i.type=v[1],i.value=f,i.label=f,Object.keys(h).forEach(S=>{["children","metadata","type","value"].includes(S)||(i[S]=h[S])}),h.children=[i,...h.children]}});return e},_=t=>{var M,E,R;let e={};const{data:l,measures:v,swap:f,dimensions:h,includeOverall:d,locale:i,customLabels:S,colorBy:A,hiddenBars:y}=t,O=h.filter(r=>r!="");if(l.metadata.measures.filter(r=>v.includes(r.value)).sort((r,b)=>r.position!=null&&b.position!=null&&r.position!=b.position?r.position-b.position:0),d&&v.length==1&&K(t),O.length==0&&l)e=J(t);else if(l&&l.children&&l.children.length>0&&O.length>0){const r=u.measuresMap(l),b=u.typesMap(l),n=new Set,c=new Set,L=new Set,N=new Set,w=[],B=l.children[0].type,x=((R=(E=(M=l==null?void 0:l.metadata)==null?void 0:M.types)==null?void 0:E.find(o=>o.dimension==O[0]))==null?void 0:R.items)||[];t.sort=="alphabetically"?x.sort((o,g)=>u.alphaSort(t.sortReverse,i,o.value,g.value)):t.sort=="values"?x.sort((o,g)=>u.numericSort(t.sortReverse,o.value,g.value)):t.sort=="date"&&x.sort((o,g)=>u.dateSort(t.sortReverse,o.value,g.value)),v.forEach(o=>{const g={variables:{}};g.id=u.getTranslatedValue(r[o],i),g.label=u.getTranslatedValue(r[o],i);const T=[];x.forEach(s=>{const a=l.children.find(m=>m.value===s.value);if(a){const m={};Object.keys(a).forEach(q=>{m[q]=a[q]}),m.value=a[o],m[a.type]=a.value.toString(),c.add(b[a.type]),T.push({x:a.value,y:a[o],variables:m}),g.data=T}}),w.push(g)});const k=Array.from(N);let F=(y==null?void 0:y.length)>0&&(w==null?void 0:w.length)>0?w.filter(o=>y.indexOf(o[B])==-1):w;e={metadata:l.metadata,indexBy:B,categories:n,dimensionsMetadata:c,measuresMetadata:L,keys:k,data:F}}return C.Children.map(t.children,r=>C.cloneElement(r,{options:e}))},P=t=>{var y,O,M,E,R,r,b;const{data:e,measures:l,includeOverall:v,dimensions:f,hiddenBars:h,colorBy:d,locale:i}=t,S=f.filter(n=>n!="");let A={};if(v&&K(t),S.length==0&&e)A=J(t);else if(e&&e.children&&e.children.length>0&&S.length>0){const n=u.measuresMap(e),c=u.typesMap(e),L=l[0],N=new Set,w=new Set,B=[],x=[],k=(y=e.children[0])==null?void 0:y.type,F=((E=(M=(O=e==null?void 0:e.metadata)==null?void 0:O.types)==null?void 0:M.find(s=>s.dimension==S[0]))==null?void 0:E.items)||[],o=((b=(r=(R=e==null?void 0:e.metadata)==null?void 0:R.types)==null?void 0:r.find(s=>s.dimension==S[1]))==null?void 0:b.items)||[];t.sortSecondDimension=="alphabetically"?o.sort((s,a)=>u.alphaSort(t.sortReverseSecondDimension,i,s.value,a.value)):t.sortSecondDimension=="date"&&o.sort((s,a)=>u.dateSort(t.sortReverseSecondDimension,s.value,a.value)),w.add(n[L]),o.forEach(s=>{const a={variables:{}};a.id=s.value,a.label=s.value;const m=[];F.forEach(q=>{const p=e.children.find(j=>j.value===q.value);N.add(c[p==null?void 0:p.type]);const D=p==null?void 0:p.children.find(j=>j.value===s.value);if(D){N.add(c[D==null?void 0:D.type]);const j={};Object.keys(D).forEach(I=>{j[I]=D[I]}),j.value=D[l[0]],j[p.type]=p.value.toString(),j[D.type]=D.value.toString(),m.push({x:p.value,y:D[l[0]],variables:j}),B.indexOf(p.value)==-1&&B.push(p.value)}}),a.data=m,x.push(a)}),x.forEach(s=>{B.forEach(a=>{s.data.find(m=>m.x==a)||s.data.push({x:a,y:null,variables:{}})})}),x.forEach(s=>{s.data.sort((a,m)=>t.sort=="alphabetically"?u.alphaSort(t.sortReverse,i,a.x,m.x):t.sort=="date"?u.dateSort(t.sortReverse,a.x,m.x):0)});const g=d=="id"?x:x.filter(s=>h.indexOf(s[k])==-1),T=[...B];A={metadata:e.metadata,dimensionsMetadata:N,measuresMetadata:w,indexBy:k,keys:d=="index"?T:T.filter(s=>h.indexOf(s)==-1),data:g}}return V.jsx(V.Fragment,{children:C.Children.map(t.children,n=>C.cloneElement(n,{options:A}))})},U=t=>{const{data:e,measures:l,dimensions:v}=t,f=JSON.parse(JSON.stringify(e));return v.length===1?V.jsx(_,{...t,data:f}):V.jsx(P,{...t,data:f})};exports.default=U;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const V=require("react/jsx-runtime"),C=require("react"),u=require("./Utils.js"),J=t=>{const{data:e,measures:l,swap:h,dimensions:f,locale:m,customLabels:d}=t;let i={};const y=f.filter(g=>g!=""),A=new Set;if(y.length==0&&e){const g=u.measuresMap(e),O=new Set,M=new Set;let E=[],R;if(e.metadata&&e.metadata.measures){const r=e.metadata.measures.filter(n=>l.includes(n.value)).sort((n,c)=>n.position!=null&&c.position!=null&&n.position!=c.position?n.position-c.position:0);E=[],R="measure",O.add("measure");const b={};Object.keys(e).forEach(n=>{b[n]=e[n]}),r.forEach(n=>{const c={},L=d[n.value]||u.getTranslatedValue(g[n.value],m);debugger;c.type="measure",c.measureFieldName=n.value,c.measure=L,c[L]=e[n.value],c.variables=b,E.push(c),M.add(L),A.add(g[n.value])}),i={categories:O,indexBy:R,keys:Array.from(M),measuresMetadata:A,data:E}}}return i},K=t=>{const{data:e,measures:l,dimensions:h,overallLabel:f}=t;if(h.length==1&&e.children){if(!(e.children.filter(d=>d.value==f).length>0)){const d={};d.type=h[0],d.value=f,d.label=f,Object.keys(e).forEach(i=>{["children","metadata","type","value"].includes(i)||(d[i]=e[i])}),e.children=[d,...e.children]}}else h.length==2&&e.children&&e.children.forEach(m=>{if(!(m.children.filter(i=>i.value==f).length>0)){const i={};i.type=h[1],i.value=f,i.label=f,Object.keys(m).forEach(y=>{["children","metadata","type","value"].includes(y)||(i[y]=m[y])}),m.children=[i,...m.children]}});return e},_=t=>{var M,E,R;let e={};const{data:l,measures:h,swap:f,dimensions:m,includeOverall:d,locale:i,customLabels:y,colorBy:A,hiddenBars:g}=t,O=m.filter(r=>r!="");if(l.metadata.measures.filter(r=>h.includes(r.value)).sort((r,b)=>r.position!=null&&b.position!=null&&r.position!=b.position?r.position-b.position:0),d&&h.length==1&&K(t),O.length==0&&l)e=J(t);else if(l&&l.children&&l.children.length>0&&O.length>0){const r=u.measuresMap(l),b=u.typesMap(l),n=new Set,c=new Set,L=new Set,N=new Set,w=[],B=l.children[0].type,x=((R=(E=(M=l==null?void 0:l.metadata)==null?void 0:M.types)==null?void 0:E.find(o=>o.dimension==O[0]))==null?void 0:R.items)||[];t.sort=="alphabetically"?x.sort((o,S)=>u.alphaSort(t.sortReverse,i,o.value,S.value)):t.sort=="values"?x.sort((o,S)=>u.numericSort(t.sortReverse,o.value,S.value)):t.sort=="date"&&x.sort((o,S)=>u.dateSort(t.sortReverse,o.value,S.value)),h.forEach(o=>{const S={variables:{}};S.id=u.getTranslatedValue(r[o],i);debugger;S.label=y[o]||u.getTranslatedValue(r[o],i);const T=[];x.forEach(s=>{const a=l.children.find(v=>v.value===s.value);if(a){const v={};Object.keys(a).forEach(q=>{v[q]=a[q]}),v.value=a[o],v[a.type]=a.value.toString(),c.add(b[a.type]),T.push({x:a.value,y:a[o],variables:v}),S.data=T}}),w.push(S)});const k=Array.from(N);let F=(g==null?void 0:g.length)>0&&(w==null?void 0:w.length)>0?w.filter(o=>g.indexOf(o[B])==-1):w;e={metadata:l.metadata,indexBy:B,categories:n,dimensionsMetadata:c,measuresMetadata:L,keys:k,data:F}}return C.Children.map(t.children,r=>C.cloneElement(r,{options:e}))},P=t=>{var g,O,M,E,R,r,b;const{data:e,measures:l,includeOverall:h,dimensions:f,hiddenBars:m,colorBy:d,locale:i}=t,y=f.filter(n=>n!="");let A={};if(h&&K(t),y.length==0&&e)A=J(t);else if(e&&e.children&&e.children.length>0&&y.length>0){const n=u.measuresMap(e),c=u.typesMap(e),L=l[0],N=new Set,w=new Set,B=[],x=[],k=(g=e.children[0])==null?void 0:g.type,F=((E=(M=(O=e==null?void 0:e.metadata)==null?void 0:O.types)==null?void 0:M.find(s=>s.dimension==y[0]))==null?void 0:E.items)||[],o=((b=(r=(R=e==null?void 0:e.metadata)==null?void 0:R.types)==null?void 0:r.find(s=>s.dimension==y[1]))==null?void 0:b.items)||[];t.sortSecondDimension=="alphabetically"?o.sort((s,a)=>u.alphaSort(t.sortReverseSecondDimension,i,s.value,a.value)):t.sortSecondDimension=="date"&&o.sort((s,a)=>u.dateSort(t.sortReverseSecondDimension,s.value,a.value)),w.add(n[L]),o.forEach(s=>{const a={variables:{}};a.id=s.value,a.label=s.value;const v=[];F.forEach(q=>{const p=e.children.find(j=>j.value===q.value);N.add(c[p==null?void 0:p.type]);const D=p==null?void 0:p.children.find(j=>j.value===s.value);if(D){N.add(c[D==null?void 0:D.type]);const j={};Object.keys(D).forEach(I=>{j[I]=D[I]}),j.value=D[l[0]],j[p.type]=p.value.toString(),j[D.type]=D.value.toString(),v.push({x:p.value,y:D[l[0]],variables:j}),B.indexOf(p.value)==-1&&B.push(p.value)}}),a.data=v,x.push(a)}),x.forEach(s=>{B.forEach(a=>{s.data.find(v=>v.x==a)||s.data.push({x:a,y:null,variables:{}})})}),x.forEach(s=>{s.data.sort((a,v)=>t.sort=="alphabetically"?u.alphaSort(t.sortReverse,i,a.x,v.x):t.sort=="date"?u.dateSort(t.sortReverse,a.x,v.x):0)});const S=d=="id"?x:x.filter(s=>m.indexOf(s[k])==-1),T=[...B];A={metadata:e.metadata,dimensionsMetadata:N,measuresMetadata:w,indexBy:k,keys:d=="index"?T:T.filter(s=>m.indexOf(s)==-1),data:S}}return V.jsx(V.Fragment,{children:C.Children.map(t.children,n=>C.cloneElement(n,{options:A}))})},U=t=>{const{data:e,measures:l,dimensions:h}=t,f=JSON.parse(JSON.stringify(e));return h.length===1?V.jsx(_,{...t,data:f}):V.jsx(P,{...t,data:f})};exports.default=U;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=e=>e==null?void 0:e.map(t=>{const r=t.group.label;return t.label.includes(r)?t:{...t,label:`${r} - ${t.label}`}}),l=e=>{const{metadata:a}=e||{},t={},r=u((a==null?void 0:a.measures)||[]);return a&&r.forEach(n=>{t[n.value]=n}),t},c=e=>{const{metadata:a}=e||{},t={};return a&&a.types.forEach(r=>{t[r.dimension]={dimension:r.dimension,category:r.category,items:r.items}}),t},p=(e,a)=>e?e.labels&&e.labels[a.toUpperCase()]?e.labels[a.toUpperCase()]:e.label?e.label:e.value:null,i=(e,a,t,r)=>new Intl.Collator(a,{caseFirst:"upper",numeric:!0,sensitivity:"variant"}).compare(e?r:t,e?t:r),m=(e,a,t)=>!isNaN(a)&&!isNaN(t)?e?Number(t)-Number(a):Number(a)-Number(t):0,o=e=>{const[a,t]=e.split(" "),n=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"].indexOf(a),s=parseInt(t,10);return(n===-1||isNaN(s))&&console.error(`Invalid month/year format: ${e}`),new Date(s,n,1)},N=(e,a,t)=>{let r=Date.parse(a),n=Date.parse(t);return isNaN(r)&&(r=o(a)),isNaN(n)&&(n=o(t)),!isNaN(r)&&!isNaN(n)?e?n-r:r-n:0};exports.alphaSort=i;exports.dateSort=N;exports.getTranslatedValue=p;exports.measuresMap=l;exports.numericSort=m;exports.typesMap=c;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=e=>e==null?void 0:e.map(t=>{const a=t.group.label;debugger;return t.label.includes(a)?t:{...t,label:`${t.label}`}}),l=e=>{const{metadata:r}=e||{},t={},a=u((r==null?void 0:r.measures)||[]);return r&&a.forEach(n=>{t[n.value]=n}),t},c=e=>{const{metadata:r}=e||{},t={};return r&&r.types.forEach(a=>{t[a.dimension]={dimension:a.dimension,category:a.category,items:a.items}}),t},p=(e,r)=>e?e.labels&&e.labels[r.toUpperCase()]?e.labels[r.toUpperCase()]:e.label?e.label:e.value:null,i=(e,r,t,a)=>new Intl.Collator(r,{caseFirst:"upper",numeric:!0,sensitivity:"variant"}).compare(e?a:t,e?t:a),m=(e,r,t)=>!isNaN(r)&&!isNaN(t)?e?Number(t)-Number(r):Number(r)-Number(t):0,o=e=>{const[r,t]=e.split(" "),n=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"].indexOf(r),s=parseInt(t,10);return(n===-1||isNaN(s))&&console.error(`Invalid month/year format: ${e}`),new Date(s,n,1)},N=(e,r,t)=>{let a=Date.parse(r),n=Date.parse(t);return isNaN(a)&&(a=o(r)),isNaN(n)&&(n=o(t)),!isNaN(a)&&!isNaN(n)?e?n-a:a-n:0};exports.alphaSort=i;exports.dateSort=N;exports.getTranslatedValue=p;exports.measuresMap=l;exports.numericSort=m;exports.typesMap=c;
@@ -1 +1 @@
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
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),h=require("react"),m=require("@devgateway/wp-react-lib"),M=require("./CustomSemanticSearch.js"),C=require("react-dom"),N=require("semantic-ui-react"),w=require("react-intl"),v=(s,r)=>{if(!s||!r)return s||"";const c=new RegExp(`(${r})`,"gi");return s.replace(c,"<strong>$1</strong>")},y=w.injectIntl(({ID:s,title:r,slug:c,parent_title:i,parent_slug:t,parent_link:n,extract:a,type:l,link:d,terms:j,subtype:f,bread_crumbs:u=[],metadata:o,intl:{locale:S},searchTerm:x})=>{let p=n?m.utils.replaceLink(n,S)+`#${c}`:m.utils.replaceLink(d,S);const g=o==null?void 0:o.redirect_url;p=g?g+`#${c}`:p;const R=v(String(r),x),I=v(a,x);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=p,children:[e.jsx("h5",{className:"breadcrumbs-search",dangerouslySetInnerHTML:{__html:u&&u.length>0?v(u.join(" / "),x):""}}),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,S)}})]})})}),E=({results:s,meta:r,perPage:c,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<c?n:c,total:n})}),s.map(a=>e.jsx(y,{...a,searchTerm:t},a.ID))]})},_=({onSearch:s,perPage:r,loading:c,results:i,meta:t,intl:n,searchTerm:a})=>(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",value:a,onChange:l=>{s(l.target.value)}})),L=({onSearch:s,onSetSelected:r,perPage:c,loading:i,results:t,meta:n,locale:a,intl:l,searchTerm:d,selected:j})=>{const[f,u]=h.useState(!1),o=h.useRef(null),S=()=>{u(!1)};h.useEffect(()=>{const p=document.createElement("div");p.setAttribute("id","float-input-container"),p.setAttribute("class","input container"),p.style.display="none";const g=document.getElementById("root");return g&&(g.appendChild(p),o.current=p),()=>{o.current&&o.current.parentNode&&o.current.parentNode.removeChild(o.current)}},[]),h.useEffect(()=>{o.current&&(o.current.style.display=f?"block":"none")},[f]);const x=()=>{u(!0)};return e.jsxs(e.Fragment,{children:[e.jsx("div",{id:"ui-float-search",className:`ui float-search${f?" ui-float-search-active":""}`,onMouseOver:x,children:e.jsx(N.Icon,{name:"search",size:"small"})}),o.current&&C.createPortal(f?e.jsxs("div",{onMouseLeave:S,children:[e.jsx("div",{className:"float-search-container",children:e.jsx(_,{onSearch:s,perPage:c,loading:i,results:t,meta:n,intl:l,searchTerm:d})}),t&&t.length>0&&e.jsx(w.IntlProvider,{locale:a,children:e.jsx(E,{results:t,meta:n,perPage:c,intl:l,searchTerm:d})})]}):null,o.current)]})},b=({onSearch:s,perPage:r,loading:c,results:i,meta:t,intl:n})=>{const a=t?t["x-wp-total"]:0,l=t?t["x-wp-totalpages"]:0,[d,j]=h.useState("");h.useEffect(()=>{const u=setTimeout(()=>{s(d)},300);return()=>clearTimeout(u)},[d]);const f=u=>e.jsx(y,{...u,searchTerm:d});return e.jsx(M.default,{value:d,loading:c,placeholder:n.formatMessage({id:"search.placeholder",defaultMessage:"Search..."}),onResultSelect:(u,o)=>null,total:a,perPage:r,totalPages:l,onSearchChange:(u,o)=>{j(o.value)},resultRenderer:f,results:i,showNoResults:!1,intl:n,searchTerm:d})},q=w.injectIntl(s=>{const{intl:r,onSetSelected:c}=s,[i,t]=h.useState(""),[n,a]=h.useState(!1);return h.useEffect(()=>{const l=()=>{a(window.innerWidth<=1365)};return l(),window.addEventListener("resize",l),()=>window.removeEventListener("resize",l)},[]),e.jsx(m.SearchProvider,{search:i,perPage:5,locale:r.locale,children:e.jsx(T,{...s,onSetSelected:c,setQuery:t,query:i,isSmallScreen:n,intl:r})})}),T=({onSetSelected:s,selected:r,setQuery:c,query:i,isSmallScreen:t,intl:n,...a})=>{const l=h.useContext(m.SearchContext);return a.settings.react_search_type==="floating"||t?e.jsx(L,{onSetSelected:s,selected:r,onSearch:c,perPage:5,intl:n,...a,...l,searchTerm:i}):e.jsx(b,{onSetSelected:s,onSearch:c,perPage:5,intl:n,...a,...l})};exports.default=q;
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),j=require("react-router"),l=require("../ResponsiveContainer.js"),r=require("@devgateway/wp-react-lib"),g=({header:o,footer:s,posts:t}={})=>{const{lan:u,slug:n,parent:i,year:a,month:c,day:d}=j.useParams();if(t){const P=typeof t=="object"?[t]:t;return e.jsx(l.default,{header:o,footer:s,children:e.jsx(r.Post,{posts:P})})}return console.log("SlugPostContainer falling back to PostProvider"),e.jsx(r.PostProvider,{type:i,slug:n,store:n,locale:u,type:i,year:a,month:c,day:d,children:e.jsx(l.default,{header:o,footer:s,children:e.jsx(r.PostConsumer,{children:e.jsx(r.Post,{})})})})};exports.default=g;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),j=require("react-router"),i=require("../ResponsiveContainer.js"),r=require("@devgateway/wp-react-lib"),g=({header:o,footer:s,posts:t}={})=>{const{lan:l,slug:n,parent:u,year:a,month:c,day:d}=j.useParams();if(t){const P=typeof t=="object"?[t]:t;return e.jsx(i.default,{header:o,footer:s,children:e.jsx(r.Post,{posts:P})})}return console.log("SlugPostContainer falling back to PostProvider"),e.jsx(r.PostProvider,{type:u,slug:n,store:n,locale:l,year:a,month:c,day:d,children:e.jsx(i.default,{header:o,footer:s,children:e.jsx(r.PostConsumer,{children:e.jsx(r.Post,{})})})})};exports.default=g;
@@ -4,9 +4,9 @@ import { measuresMap as q, typesMap as G, alphaSort as K, numericSort as U, date
4
4
  const H = (t) => {
5
5
  const { data: e, measures: l, swap: m, dimensions: u, locale: v, customLabels: d } = t;
6
6
  let i = {};
7
- const g = u.filter((h) => h != ""), A = /* @__PURE__ */ new Set();
8
- if (g.length == 0 && e) {
9
- const h = q(e), D = /* @__PURE__ */ new Set(), R = /* @__PURE__ */ new Set();
7
+ const h = u.filter((y) => y != ""), A = /* @__PURE__ */ new Set();
8
+ if (h.length == 0 && e) {
9
+ const y = q(e), D = /* @__PURE__ */ new Set(), R = /* @__PURE__ */ new Set();
10
10
  let E = [], j;
11
11
  if (e.metadata && e.metadata.measures) {
12
12
  const r = e.metadata.measures.filter((a) => l.includes(a.value)).sort((a, c) => a.position != null && c.position != null && a.position != c.position ? a.position - c.position : 0);
@@ -15,8 +15,9 @@ const H = (t) => {
15
15
  Object.keys(e).forEach((a) => {
16
16
  S[a] = e[a];
17
17
  }), r.forEach((a) => {
18
- const c = {}, L = d[a.value] || V(h[a.value], v);
19
- c.type = "measure", c.measureFieldName = a.value, c.measure = L, c[L] = e[a.value], c.variables = S, E.push(c), R.add(L), A.add(h[a.value]);
18
+ const c = {}, L = d[a.value] || V(y[a.value], v);
19
+ debugger;
20
+ c.type = "measure", c.measureFieldName = a.value, c.measure = L, c[L] = e[a.value], c.variables = S, E.push(c), R.add(L), A.add(y[a.value]);
20
21
  }), i = {
21
22
  categories: D,
22
23
  indexBy: j,
@@ -39,8 +40,8 @@ const H = (t) => {
39
40
  } else m.length == 2 && e.children && e.children.forEach((v) => {
40
41
  if (!(v.children.filter((i) => i.value == u).length > 0)) {
41
42
  const i = {};
42
- i.type = m[1], i.value = u, i.label = u, Object.keys(v).forEach((g) => {
43
- ["children", "metadata", "type", "value"].includes(g) || (i[g] = v[g]);
43
+ i.type = m[1], i.value = u, i.label = u, Object.keys(v).forEach((h) => {
44
+ ["children", "metadata", "type", "value"].includes(h) || (i[h] = v[h]);
44
45
  }), v.children = [i, ...v.children];
45
46
  }
46
47
  });
@@ -55,23 +56,25 @@ const H = (t) => {
55
56
  dimensions: v,
56
57
  includeOverall: d,
57
58
  locale: i,
58
- customLabels: g,
59
+ customLabels: h,
59
60
  colorBy: A,
60
- hiddenBars: h
61
+ hiddenBars: y
61
62
  } = t, D = v.filter((r) => r != "");
62
63
  if (l.metadata.measures.filter((r) => m.includes(r.value)).sort((r, S) => r.position != null && S.position != null && r.position != S.position ? r.position - S.position : 0), d && m.length == 1 && P(t), D.length == 0 && l)
63
64
  e = H(t);
64
65
  else if (l && l.children && l.children.length > 0 && D.length > 0) {
65
66
  const r = q(l), S = G(l), a = /* @__PURE__ */ new Set(), c = /* @__PURE__ */ new Set(), L = /* @__PURE__ */ new Set(), M = /* @__PURE__ */ new Set(), O = [], B = l.children[0].type, x = ((j = (E = (R = l == null ? void 0 : l.metadata) == null ? void 0 : R.types) == null ? void 0 : E.find((o) => o.dimension == D[0])) == null ? void 0 : j.items) || [];
66
67
  t.sort == "alphabetically" ? x.sort(
67
- (o, y) => K(t.sortReverse, i, o.value, y.value)
68
+ (o, g) => K(t.sortReverse, i, o.value, g.value)
68
69
  ) : t.sort == "values" ? x.sort(
69
- (o, y) => U(t.sortReverse, o.value, y.value)
70
+ (o, g) => U(t.sortReverse, o.value, g.value)
70
71
  ) : t.sort == "date" && x.sort(
71
- (o, y) => T(t.sortReverse, o.value, y.value)
72
+ (o, g) => T(t.sortReverse, o.value, g.value)
72
73
  ), m.forEach((o) => {
73
- const y = { variables: {} };
74
- y.id = V(r[o], i), y.label = V(r[o], i);
74
+ const g = { variables: {} };
75
+ g.id = V(r[o], i);
76
+ debugger;
77
+ g.label = h[o] || V(r[o], i);
75
78
  const N = [];
76
79
  x.forEach((s) => {
77
80
  const n = l.children.find((f) => f.value === s.value);
@@ -79,12 +82,12 @@ const H = (t) => {
79
82
  const f = {};
80
83
  Object.keys(n).forEach((C) => {
81
84
  f[C] = n[C];
82
- }), f.value = n[o], f[n.type] = n.value.toString(), c.add(S[n.type]), N.push({ x: n.value, y: n[o], variables: f }), y.data = N;
85
+ }), f.value = n[o], f[n.type] = n.value.toString(), c.add(S[n.type]), N.push({ x: n.value, y: n[o], variables: f }), g.data = N;
83
86
  }
84
- }), O.push(y);
87
+ }), O.push(g);
85
88
  });
86
89
  const k = Array.from(M);
87
- let I = (h == null ? void 0 : h.length) > 0 && (O == null ? void 0 : O.length) > 0 ? O.filter((o) => h.indexOf(o[B]) == -1) : O;
90
+ let I = (y == null ? void 0 : y.length) > 0 && (O == null ? void 0 : O.length) > 0 ? O.filter((o) => y.indexOf(o[B]) == -1) : O;
88
91
  e = {
89
92
  metadata: l.metadata,
90
93
  indexBy: B,
@@ -100,7 +103,7 @@ const H = (t) => {
100
103
  (r) => F.cloneElement(r, { options: e })
101
104
  );
102
105
  }, X = (t) => {
103
- var h, D, R, E, j, r, S;
106
+ var y, D, R, E, j, r, S;
104
107
  const {
105
108
  data: e,
106
109
  measures: l,
@@ -109,12 +112,12 @@ const H = (t) => {
109
112
  hiddenBars: v,
110
113
  colorBy: d,
111
114
  locale: i
112
- } = t, g = u.filter((a) => a != "");
115
+ } = t, h = u.filter((a) => a != "");
113
116
  let A = {};
114
- if (m && P(t), g.length == 0 && e)
117
+ if (m && P(t), h.length == 0 && e)
115
118
  A = H(t);
116
- else if (e && e.children && e.children.length > 0 && g.length > 0) {
117
- const a = q(e), c = G(e), L = l[0], M = /* @__PURE__ */ new Set(), O = /* @__PURE__ */ new Set(), B = [], x = [], k = (h = e.children[0]) == null ? void 0 : h.type, I = ((E = (R = (D = e == null ? void 0 : e.metadata) == null ? void 0 : D.types) == null ? void 0 : R.find((s) => s.dimension == g[0])) == null ? void 0 : E.items) || [], o = ((S = (r = (j = e == null ? void 0 : e.metadata) == null ? void 0 : j.types) == null ? void 0 : r.find((s) => s.dimension == g[1])) == null ? void 0 : S.items) || [];
119
+ else if (e && e.children && e.children.length > 0 && h.length > 0) {
120
+ const a = q(e), c = G(e), L = l[0], M = /* @__PURE__ */ new Set(), O = /* @__PURE__ */ new Set(), B = [], x = [], k = (y = e.children[0]) == null ? void 0 : y.type, I = ((E = (R = (D = e == null ? void 0 : e.metadata) == null ? void 0 : D.types) == null ? void 0 : R.find((s) => s.dimension == h[0])) == null ? void 0 : E.items) || [], o = ((S = (r = (j = e == null ? void 0 : e.metadata) == null ? void 0 : j.types) == null ? void 0 : r.find((s) => s.dimension == h[1])) == null ? void 0 : S.items) || [];
118
121
  t.sortSecondDimension == "alphabetically" ? o.sort(
119
122
  (s, n) => K(t.sortReverseSecondDimension, i, s.value, n.value)
120
123
  ) : t.sortSecondDimension == "date" && o.sort(
@@ -142,14 +145,14 @@ const H = (t) => {
142
145
  }), x.forEach((s) => {
143
146
  s.data.sort((n, f) => t.sort == "alphabetically" ? K(t.sortReverse, i, n.x, f.x) : t.sort == "date" ? T(t.sortReverse, n.x, f.x) : 0);
144
147
  });
145
- const y = d == "id" ? x : x.filter((s) => v.indexOf(s[k]) == -1), N = [...B];
148
+ const g = d == "id" ? x : x.filter((s) => v.indexOf(s[k]) == -1), N = [...B];
146
149
  A = {
147
150
  metadata: e.metadata,
148
151
  dimensionsMetadata: M,
149
152
  measuresMetadata: O,
150
153
  indexBy: k,
151
154
  keys: d == "index" ? N : N.filter((s) => v.indexOf(s) == -1),
152
- data: y
155
+ data: g
153
156
  };
154
157
  }
155
158
  return /* @__PURE__ */ J(Q, { children: F.Children.map(
@@ -1,8 +1,10 @@
1
1
  const u = (e) => e == null ? void 0 : e.map((t) => {
2
2
  const a = t.group.label;
3
+ debugger;
3
4
  return t.label.includes(a) ? t : {
4
5
  ...t,
5
- label: `${a} - ${t.label}`
6
+ //label: `${groupName} - ${item.label}`,
7
+ label: `${t.label}`
6
8
  };
7
9
  }), l = (e) => {
8
10
  const { metadata: r } = e || {}, t = {}, a = u((r == null ? void 0 : r.measures) || []);
@@ -1,54 +1,54 @@
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";
1
+ import { jsx as t, 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 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";
6
6
  import { Icon as F } from "semantic-ui-react";
7
- import { injectIntl as M, IntlProvider as j } from "react-intl";
8
- const I = (r, s) => {
9
- if (!r || !s) return r || "";
7
+ import { injectIntl as I, IntlProvider as $ } from "react-intl";
8
+ const C = (n, s) => {
9
+ if (!n || !s) return n || "";
10
10
  const o = new RegExp(`(${s})`, "gi");
11
- return r.replace(o, "<strong>$1</strong>");
12
- }, R = M(
11
+ return n.replace(o, "<strong>$1</strong>");
12
+ }, N = I(
13
13
  ({
14
- ID: r,
14
+ ID: n,
15
15
  title: s,
16
16
  slug: o,
17
17
  parent_title: i,
18
18
  parent_slug: e,
19
- parent_link: n,
19
+ parent_link: r,
20
20
  extract: a,
21
- type: d,
22
- link: m,
23
- terms: C,
21
+ type: l,
22
+ link: d,
23
+ terms: y,
24
24
  subtype: p,
25
- bread_crumbs: h = [],
26
- metadata: l,
27
- intl: { locale: f },
25
+ bread_crumbs: u = [],
26
+ metadata: c,
27
+ intl: { locale: m },
28
28
  searchTerm: g
29
29
  // Added searchTerm prop
30
30
  }) => {
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);
31
+ let h = r ? x.replaceLink(r, m) + `#${o}` : x.replaceLink(d, m);
32
+ const f = c == null ? void 0 : c.redirect_url;
33
+ h = f ? f + `#${o}` : h;
34
+ const M = C(String(s), g), R = C(a, g);
35
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__ */ y(
40
+ children: /* @__PURE__ */ S(
41
41
  "div",
42
42
  {
43
43
  className: "has-standard-12-font-size",
44
- onClick: (L) => document.location.href = S,
44
+ onClick: (q) => document.location.href = h,
45
45
  children: [
46
46
  /* @__PURE__ */ t(
47
47
  "h5",
48
48
  {
49
49
  className: "breadcrumbs-search",
50
50
  dangerouslySetInnerHTML: {
51
- __html: h && h.length > 0 ? I(h.join(" / "), g) : ""
51
+ __html: u && u.length > 0 ? C(u.join(" / "), g) : ""
52
52
  }
53
53
  }
54
54
  ),
@@ -57,7 +57,7 @@ const I = (r, s) => {
57
57
  {
58
58
  className: "search-title",
59
59
  dangerouslySetInnerHTML: {
60
- __html: c
60
+ __html: M
61
61
  }
62
62
  }
63
63
  ) }),
@@ -66,7 +66,7 @@ const I = (r, s) => {
66
66
  {
67
67
  className: "search-content",
68
68
  dangerouslySetInnerHTML: {
69
- __html: x.replaceHTMLinks(u, f)
69
+ __html: x.replaceHTMLinks(R, m)
70
70
  }
71
71
  }
72
72
  )
@@ -76,193 +76,183 @@ const I = (r, s) => {
76
76
  }
77
77
  );
78
78
  }
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: [
79
+ ), j = ({ results: n, meta: s, perPage: o, intl: i, searchTerm: e }) => {
80
+ const r = s ? s["x-wp-total"] : 0;
81
+ return s && s["x-wp-totalpages"], /* @__PURE__ */ S("div", { id: "float-results-container", children: [
82
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: n < o ? n : o, total: n }
87
+ { count: r < o ? r : o, total: r }
88
88
  ) }),
89
- r.map((a) => /* @__PURE__ */ t(R, { ...a, searchTerm: e }, a.ID))
89
+ n.map((a) => /* @__PURE__ */ t(N, { ...a, searchTerm: e }, a.ID))
90
90
  ] });
91
- }, D = ({
92
- onSearch: r,
91
+ }, k = ({
92
+ onSearch: n,
93
93
  perPage: s,
94
94
  loading: o,
95
95
  results: i,
96
96
  meta: e,
97
- intl: n
97
+ intl: r,
98
+ searchTerm: a
98
99
  }) => (e && e["x-wp-total"], e && e["x-wp-totalpages"], /* @__PURE__ */ t(
99
100
  "input",
100
101
  {
101
- placeholder: n.formatMessage({
102
+ placeholder: r.formatMessage({
102
103
  id: "search.placeholder",
103
104
  defaultMessage: "Search..."
104
105
  }),
105
106
  type: "text",
106
107
  className: "input search",
107
108
  name: "search",
108
- onChange: (a) => {
109
- r(a.target.value);
109
+ value: a,
110
+ onChange: (l) => {
111
+ n(l.target.value);
110
112
  }
111
113
  }
112
- )), $ = ({
113
- onSearch: r,
114
+ )), D = ({
115
+ onSearch: n,
114
116
  onSetSelected: s,
115
117
  perPage: o,
116
118
  loading: i,
117
119
  results: e,
118
- meta: n,
120
+ meta: r,
119
121
  locale: a,
120
- intl: d,
121
- searchTerm: m,
122
+ intl: l,
123
+ searchTerm: d,
122
124
  // Added search from SearchConsumer
123
- selected: C
125
+ selected: y
124
126
  // Added selected prop to track menu selection
125
127
  }) => {
126
- const [p, h] = w(!1), l = b(null), f = () => {
127
- h(!1);
128
- }, g = () => {
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
- }
128
+ const [p, u] = v(!1), c = E(null), m = () => {
129
+ u(!1);
140
130
  };
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);
131
+ return w(() => {
132
+ const h = document.createElement("div");
133
+ h.setAttribute("id", "float-input-container"), h.setAttribute("class", "input container"), h.style.display = "none";
134
+ const f = document.getElementById("root");
135
+ return f && (f.appendChild(h), c.current = h), () => {
136
+ c.current && c.current.parentNode && c.current.parentNode.removeChild(c.current);
147
137
  };
148
- }, []), E(() => {
149
- l.current && (l.current.style.display = p ? "block" : "none"), p ? g() : S();
150
- }, [p]), /* @__PURE__ */ y(T, { children: [
138
+ }, []), w(() => {
139
+ c.current && (c.current.style.display = p ? "block" : "none");
140
+ }, [p]), /* @__PURE__ */ S(L, { children: [
151
141
  /* @__PURE__ */ t(
152
142
  "div",
153
143
  {
154
144
  id: "ui-float-search",
155
- className: "ui float-search",
145
+ className: `ui float-search${p ? " ui-float-search-active" : ""}`,
156
146
  onMouseOver: () => {
157
- h(!0);
147
+ u(!0);
158
148
  },
159
149
  children: /* @__PURE__ */ t(F, { name: "search", size: "small" })
160
150
  }
161
151
  ),
162
- l.current && B(
163
- p ? /* @__PURE__ */ y("div", { onMouseLeave: f, children: [
152
+ c.current && P(
153
+ p ? /* @__PURE__ */ S("div", { onMouseLeave: m, children: [
164
154
  /* @__PURE__ */ t("div", { className: "float-search-container", children: /* @__PURE__ */ t(
165
- D,
155
+ k,
166
156
  {
167
- onSearch: r,
157
+ onSearch: n,
168
158
  perPage: o,
169
159
  loading: i,
170
160
  results: e,
171
- meta: n,
172
- intl: d,
173
- searchTerm: m
161
+ meta: r,
162
+ intl: l,
163
+ searchTerm: d
174
164
  }
175
165
  ) }),
176
- e && e.length > 0 && /* @__PURE__ */ t(j, { locale: a, children: /* @__PURE__ */ t(
177
- k,
166
+ e && e.length > 0 && /* @__PURE__ */ t($, { locale: a, children: /* @__PURE__ */ t(
167
+ j,
178
168
  {
179
169
  results: e,
180
- meta: n,
170
+ meta: r,
181
171
  perPage: o,
182
- intl: d,
183
- searchTerm: m
172
+ intl: l,
173
+ searchTerm: d
184
174
  }
185
175
  ) })
186
176
  ] }) : null,
187
- l.current
177
+ c.current
188
178
  )
189
179
  ] });
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);
180
+ }, H = ({ onSearch: n, perPage: s, loading: o, results: i, meta: e, intl: r }) => {
181
+ const a = e ? e["x-wp-total"] : 0, l = e ? e["x-wp-totalpages"] : 0, [d, y] = v("");
182
+ w(() => {
183
+ const u = setTimeout(() => {
184
+ n(d);
195
185
  }, 300);
196
- return () => clearTimeout(h);
197
- }, [m]);
198
- const p = (h) => /* @__PURE__ */ t(R, { ...h, searchTerm: m });
186
+ return () => clearTimeout(u);
187
+ }, [d]);
188
+ const p = (u) => /* @__PURE__ */ t(N, { ...u, searchTerm: d });
199
189
  return /* @__PURE__ */ t(
200
- P,
190
+ z,
201
191
  {
202
- value: m,
192
+ value: d,
203
193
  loading: o,
204
- placeholder: n.formatMessage({
194
+ placeholder: r.formatMessage({
205
195
  id: "search.placeholder",
206
196
  defaultMessage: "Search..."
207
197
  }),
208
- onResultSelect: (h, l) => null,
198
+ onResultSelect: (u, c) => null,
209
199
  total: a,
210
200
  perPage: s,
211
- totalPages: d,
212
- onSearchChange: (h, l) => {
213
- C(l.value);
201
+ totalPages: l,
202
+ onSearchChange: (u, c) => {
203
+ y(c.value);
214
204
  },
215
205
  resultRenderer: p,
216
206
  results: i,
217
207
  showNoResults: !1,
218
- intl: n,
219
- searchTerm: m
208
+ intl: r,
209
+ searchTerm: d
220
210
  }
221
211
  );
222
- }, V = M((r) => {
223
- const { intl: s, onSetSelected: o } = r, [i, e] = w(""), [n, a] = w(!1);
224
- return E(() => {
225
- const d = () => {
212
+ }, U = I((n) => {
213
+ const { intl: s, onSetSelected: o } = n, [i, e] = v(""), [r, a] = v(!1);
214
+ return w(() => {
215
+ const l = () => {
226
216
  a(window.innerWidth <= 1365);
227
217
  };
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
+ return l(), window.addEventListener("resize", l), () => window.removeEventListener("resize", l);
219
+ }, []), /* @__PURE__ */ t(T, { search: i, perPage: 5, locale: s.locale, children: /* @__PURE__ */ t(
230
220
  A,
231
221
  {
232
- ...r,
222
+ ...n,
233
223
  onSetSelected: o,
234
224
  setQuery: e,
235
225
  query: i,
236
- isSmallScreen: n,
226
+ isSmallScreen: r,
237
227
  intl: s
238
228
  }
239
229
  ) });
240
- }), A = ({ onSetSelected: r, selected: s, setQuery: o, query: i, isSmallScreen: e, intl: n, ...a }) => {
241
- const d = _(H);
230
+ }), A = ({ onSetSelected: n, selected: s, setQuery: o, query: i, isSmallScreen: e, intl: r, ...a }) => {
231
+ const l = _(b);
242
232
  return a.settings.react_search_type === "floating" || e ? /* @__PURE__ */ t(
243
- $,
233
+ D,
244
234
  {
245
- onSetSelected: r,
235
+ onSetSelected: n,
246
236
  selected: s,
247
237
  onSearch: o,
248
238
  perPage: 5,
249
- intl: n,
239
+ intl: r,
250
240
  ...a,
251
- ...d,
241
+ ...l,
252
242
  searchTerm: i
253
243
  }
254
244
  ) : /* @__PURE__ */ t(
255
- W,
245
+ H,
256
246
  {
257
- onSetSelected: r,
247
+ onSetSelected: n,
258
248
  onSearch: o,
259
249
  perPage: 5,
260
- intl: n,
250
+ intl: r,
261
251
  ...a,
262
- ...d
252
+ ...l
263
253
  }
264
254
  );
265
255
  };
266
256
  export {
267
- V as default
257
+ U as default
268
258
  };
@@ -1,21 +1,20 @@
1
1
  import { jsx as o } from "react/jsx-runtime";
2
2
  import { useParams as P } from "react-router";
3
- import i from "../ResponsiveContainer.js";
4
- import { Post as l, PostProvider as p, PostConsumer as u } from "@devgateway/wp-react-lib";
3
+ import s from "../ResponsiveContainer.js";
4
+ import { Post as i, PostProvider as u, PostConsumer as f } from "@devgateway/wp-react-lib";
5
5
  const v = ({ header: e, footer: t, posts: r } = {}) => {
6
- const { lan: a, slug: n, parent: s, year: c, month: d, day: m } = P();
7
- return r ? /* @__PURE__ */ o(i, { header: e, footer: t, children: /* @__PURE__ */ o(l, { posts: typeof r == "object" ? [r] : r }) }) : (console.log("SlugPostContainer falling back to PostProvider"), /* @__PURE__ */ o(
8
- p,
6
+ const { lan: l, slug: n, parent: a, year: c, month: d, day: m } = P();
7
+ return r ? /* @__PURE__ */ o(s, { header: e, footer: t, children: /* @__PURE__ */ o(i, { posts: typeof r == "object" ? [r] : r }) }) : (console.log("SlugPostContainer falling back to PostProvider"), /* @__PURE__ */ o(
8
+ u,
9
9
  {
10
- type: s,
10
+ type: a,
11
11
  slug: n,
12
12
  store: n,
13
- locale: a,
14
- type: s,
13
+ locale: l,
15
14
  year: c,
16
15
  month: d,
17
16
  day: m,
18
- children: /* @__PURE__ */ o(i, { header: e, footer: t, children: /* @__PURE__ */ o(u, { children: /* @__PURE__ */ o(l, {}) }) })
17
+ children: /* @__PURE__ */ o(s, { header: e, footer: t, children: /* @__PURE__ */ o(f, { children: /* @__PURE__ */ o(i, {}) }) })
19
18
  }
20
19
  ));
21
20
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devgateway/dvz-ui-react",
3
- "version": "1.7.0",
3
+ "version": "1.7.2",
4
4
  "main": "dist/cjs/index.js",
5
5
  "module": "dist/esm/index.js",
6
6
  "types": "dist/types/index.d.ts",