@devgateway/dvz-ui-react 1.8.1 → 1.8.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,5 +1,5 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("react/jsx-runtime"),w=require("react"),o=require("semantic-ui-react"),R=require("@devgateway/wp-react-lib"),C=require("./dom-to-image.js"),v=require("file-saver"),H=require("react-redux"),O=w.forwardRef((i,a)=>t.jsx("div",{ref:a,children:i.children})),Q=i=>{const a=w.useRef();let{childContent:f,"data-height":X,"data-button-label":k,"data-png-label":L,"data-jpg-label":q,"data-jpg-text":U,"data-png-text":S,"data-check-png":N="true","data-check-jpg":j="true","data-title":T,"data-default-format":A="PNG","data-use-title":x="false","data-style":E="heavy","data-section-title":J="","data-download-tooltip":D="","data-include-source-url":F="false","data-include-filters":G="false","data-source-urlmargin-left":I=70,"data-source-urlmargin-top":B=10,"data-source-urlfont-size":$=18,parent:Y,editing:s,component:Z,unique:ee,pageModuleProps:l}=i;const[p,g]=w.useState(A),c=N=="true"||N===!0,d=j=="true"||j===!0;w.useEffect(()=>{g(A)},[A]);const y=n=>{g(n.target.value)};function M(n){const r=n.attributes,b=[];if(r)for(let e=0;e<r.length;e++)b.push(r[e].nodeName);const u=b.filter(e=>e.startsWith("data-"));if(u.length>0&&u.forEach(e=>{n.setAttribute(e,"")}),n.classList){if(n.classList.contains("ignore"))return!1;if(!(G===!0||G==="true")){const h=["filter-component","data-filters-reset","data-filters-apply","filter-search"];for(const z of h)if(n.classList.contains(z))return!1}return!0}return!0}const m={filter:M,bgcolor:"#FFF",imagePlaceholder:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8Xw8AAoMBgQb9Z3kAAAAASUVORK5CYII=",cacheBust:!0},W=n=>{C.domtoimage.cloneNode(a.current).then(function(r){if([...r.getElementsByTagName("input")].forEach(e=>e.remove()),[...r.querySelectorAll(".question.circle.icon")].forEach(e=>e.remove()),F==="true"){const e=document.createElement("div");e.style.marginLeft=I+"px",e.style.marginTop=B+"px",e.style.fontSize=$+"px",e.style.fontFamily="Roboto, sans-serif",e.style.fontWeight="400",e.style.color="#66676d",e.style.opacity="0.75",e.innerHTML=window.location.href,e.style.maxWidth="90%",e.style.wordWrap="break-word",e.style.overflowWrap="break-word",r.appendChild(e)}const u=50;m.height=a.current.scrollHeight+u,m.width=a.current.scrollWidth+u*2,r.style.padding=`${u}px`,n==="PNG"&&C.domtoimage.toPng(r,m).then(function(e){if(!e)throw new Error("PNG render returned empty result");return fetch(e).then(h=>h.blob())}).then(function(e){v.saveAs(e,L)}).catch(function(e){console.error("PNG download failed:",e)}),n==="JPG"&&C.domtoimage.toJpeg(r,m).then(function(e){if(!e)throw new Error("JPEG render returned empty result");return fetch(e).then(h=>h.blob())}).then(function(e){v.saveAs(e,q)}).catch(function(e){console.error("JPG download failed:",e)})})},P=n=>{s?alert("Not allowed when editing please preview page"):W(n)};return t.jsx(o.Container,{className:`viz download ${E} ${x?"has-title":""}
2
- ${c||d?"has-formats":""}
3
- ${s||l!=null&&l.editing?"editing":""}
4
- ${c&&d?"multi-format":""}
5
- ${c&&!d||!c&&d?"single-format":""}`,fluid:!0,children:t.jsxs(O,{ref:a,children:[t.jsxs(o.Grid,{stackable:!0,reversed:"mobile",className:"download-header",children:[!s&&x==="true"&&t.jsx(o.Grid.Column,{width:12,children:t.jsx(R.PostContent,{parentUnique:i.unique,post:{content:{rendered:decodeURIComponent(J)}}})}),t.jsx(o.Grid.Column,{className:s?"editing ignore":"ignore",width:s||x!=="true"?16:4,textAlign:"right",children:t.jsxs("div",{className:"wrapper",children:[t.jsxs(o.Button,{className:"download",onClick:()=>P(p),children:[k," ",p==="PNG"?"PNG":"JPG"]}),t.jsx(o.Dropdown,{className:"download","data-tooltip":decodeURIComponent(D),trigger:d&&c?t.jsx(o.Icon,{name:"download",className:"download-icon"}):null,children:t.jsxs(o.Dropdown.Menu,{children:[T,c===!0&&t.jsxs(o.Dropdown.Item,{onClick:()=>{g("PNG"),P("PNG")},children:[t.jsx("input",{type:"radio",value:"PNG",checked:p==="PNG",onChange:y}),t.jsx("label",{children:S})]}),d===!0&&t.jsxs(o.Dropdown.Item,{onClick:()=>{g("JPG"),P("JPG")},children:[t.jsx("input",{type:"radio",value:"JPG",checked:p==="JPG",onChange:y}),t.jsx("label",{children:U})]})]})})]})})]}),!s&&t.jsx(o.Container,{fluid:!0,className:`download area ${s||l!=null&&l.editing?"editing":""}`,children:t.jsx(R.PostContent,{parentUnique:i.unique,post:{content:{rendered:f}}})})]})})},V=i=>{const a=i.getIn(["data","pageModuleProps"]),f={};return a&&(f.pageModuleProps=a),f},_={},K=H.connect(V,_)(Q);exports.default=K;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("react/jsx-runtime"),g=require("react"),o=require("semantic-ui-react"),k=require("@devgateway/wp-react-lib"),j=require("./dom-to-image.js"),R=require("file-saver"),H=require("react-redux"),Q=g.forwardRef((s,a)=>t.jsx("div",{ref:a,children:s.children})),V=s=>{const a=g.useRef();let{childContent:w,"data-height":Y,"data-button-label":v,"data-png-label":L,"data-jpg-label":q,"data-jpg-text":S,"data-png-text":U,"data-check-png":G="true","data-check-jpg":C="true","data-title":T,"data-default-format":P="PNG","data-use-title":b="false","data-style":E="heavy","data-section-title":I="","data-download-tooltip":J="","data-include-source-url":D="false","data-include-filters":y="false","data-source-urlmargin-left":F=70,"data-source-urlmargin-top":B=10,"data-source-urlfont-size":O=18,parent:Z,editing:i,component:ee,unique:te,pageModuleProps:l}=s;const[x,h]=g.useState(P),[$,c]=g.useState(!1),d=G=="true"||G===!0,u=C=="true"||C===!0;g.useEffect(()=>{h(P)},[P]);function M(n){const r=n.attributes,N=[];if(r)for(let e=0;e<r.length;e++)N.push(r[e].nodeName);const f=N.filter(e=>e.startsWith("data-"));if(f.length>0&&f.forEach(e=>{n.setAttribute(e,"")}),n.classList){if(n.classList.contains("ignore"))return!1;if(!(y===!0||y==="true")){const m=["filter-component","data-filters-reset","data-filters-apply","filter-search"];for(const z of m)if(n.classList.contains(z))return!1}return!0}return!0}const A={filter:M,bgcolor:"#FFF",imagePlaceholder:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8Xw8AAoMBgQb9Z3kAAAAASUVORK5CYII=",cacheBust:!0},W=n=>{j.domtoimage.cloneNode(a.current).then(function(r){if([...r.getElementsByTagName("input")].forEach(e=>e.remove()),[...r.querySelectorAll(".question.circle.icon")].forEach(e=>e.remove()),D==="true"){const e=document.createElement("div");e.style.marginLeft=F+"px",e.style.marginTop=B+"px",e.style.fontSize=O+"px",e.style.fontFamily="Roboto, sans-serif",e.style.fontWeight="400",e.style.color="#66676d",e.style.opacity="0.75",e.innerHTML=window.location.href,e.style.maxWidth="90%",e.style.wordWrap="break-word",e.style.overflowWrap="break-word",r.appendChild(e)}const f=50;A.height=a.current.scrollHeight+f,A.width=a.current.scrollWidth+f*2,r.style.padding=`${f}px`,n==="PNG"&&j.domtoimage.toPng(r,A).then(function(e){if(!e)throw new Error("PNG render returned empty result");return fetch(e).then(m=>m.blob())}).then(function(e){R.saveAs(e,L)}).catch(function(e){console.error("PNG download failed:",e)}),n==="JPG"&&j.domtoimage.toJpeg(r,A).then(function(e){if(!e)throw new Error("JPEG render returned empty result");return fetch(e).then(m=>m.blob())}).then(function(e){R.saveAs(e,q)}).catch(function(e){console.error("JPG download failed:",e)})})},p=n=>{i?alert("Not allowed when editing please preview page"):W(n)};return t.jsx(o.Container,{className:`viz download ${E} ${b?"has-title":""}
2
+ ${d||u?"has-formats":""}
3
+ ${i||l!=null&&l.editing?"editing":""}
4
+ ${d&&u?"multi-format":""}
5
+ ${d&&!u||!d&&u?"single-format":""}`,fluid:!0,children:t.jsxs(Q,{ref:a,children:[t.jsxs(o.Grid,{stackable:!0,reversed:"mobile",className:"download-header",children:[!i&&b==="true"&&t.jsx(o.Grid.Column,{width:12,children:t.jsx(k.PostContent,{parentUnique:s.unique,post:{content:{rendered:decodeURIComponent(I)}}})}),t.jsx(o.Grid.Column,{className:i?"editing ignore":"ignore",width:i||b!=="true"?16:4,textAlign:"right",children:t.jsxs("div",{className:"wrapper",children:[t.jsxs(o.Button,{className:"download",onClick:()=>p(x),children:[v," ",x==="PNG"?"PNG":"JPG"]}),t.jsx(o.Dropdown,{className:"download","data-tooltip":decodeURIComponent(J),open:$,onOpen:()=>c(!0),onClose:()=>c(!1),trigger:u&&d?t.jsx(o.Icon,{name:"download",className:"download-icon"}):null,children:t.jsxs(o.Dropdown.Menu,{children:[T,d===!0&&t.jsx(o.Dropdown.Item,{onClick:()=>{h("PNG"),p("PNG"),c(!1)},children:t.jsxs("div",{className:"ui radio checkbox",children:[t.jsx("input",{type:"radio",className:"hidden",readOnly:!0,tabIndex:0,checked:x==="PNG"}),t.jsx("label",{onClick:n=>{n.stopPropagation(),h("PNG"),p("PNG"),c(!1)},children:U})]})}),u===!0&&t.jsx(o.Dropdown.Item,{onClick:()=>{h("JPG"),p("JPG"),c(!1)},children:t.jsxs("div",{className:"ui radio checkbox",children:[t.jsx("input",{type:"radio",className:"hidden",readOnly:!0,tabIndex:0,checked:x==="JPG"}),t.jsx("label",{onClick:n=>{n.stopPropagation(),h("JPG"),p("JPG"),c(!1)},children:S})]})})]})})]})})]}),!i&&t.jsx(o.Container,{fluid:!0,className:`download area ${i||l!=null&&l.editing?"editing":""}`,children:t.jsx(k.PostContent,{parentUnique:s.unique,post:{content:{rendered:w}}})})]})})},_=s=>{const a=s.getIn(["data","pageModuleProps"]),w={};return a&&(w.pageModuleProps=a),w},K={},X=H.connect(_,K)(V);exports.default=X;
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("react/jsx-runtime"),m=require("react"),d=require("semantic-ui-react"),p=require("../reducers/data.js"),f=require("../../redux/hooks.js"),g=h=>{const{parent:x,editing:j=!1,unique:C,"data-label":n,"data-group":o,"data-app":a,"data-measures-groups":u}=h;let s;const c=f.useAppDispatch(),i=f.useAppSelector(e=>e.getIn(["data","measures",a,o])),l={onReset:p.cleanMeasures,onChange:p.setMeasures};if(u instanceof String||typeof u=="string"){const e=u;let t;try{t=decodeURIComponent(e)}catch{t=e}s=JSON.parse(t)}else s=u;if(m.useEffect(()=>{s&&s[a]&&s[a].forEach(e=>{e.defaultSelected&&c(l.onChange({app:a,group:o,mGroup:e}))})},[]),s&&s[a]){const e=s[a];return r.jsxs(d.Container,{className:"measures group",fluid:!0,children:[n&&r.jsx("span",{children:n}),e.map(t=>r.jsxs("div",{className:"inputs lists",onClick:q=>c(l.onChange({app:a,group:o,mGroup:t})),children:[r.jsx("input",{readOnly:!0,checked:!!(i&&i.idx==t.idx),type:"radio"}),r.jsx("span",{children:t.label})]},t.idx))]})}else return r.jsx(d.Container,{className:"measures group",fluid:!0,children:n&&r.jsx("span",{children:n})})};exports.default=g;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("react/jsx-runtime"),m=require("react"),c=require("semantic-ui-react"),p=require("../reducers/data.js"),f=require("../../redux/hooks.js"),g=h=>{const{parent:x,editing:j=!1,unique:C,"data-label":n,"data-group":u,"data-app":a,"data-measures-groups":o}=h;let s;const i=f.useAppDispatch(),d=f.useAppSelector(e=>e.getIn(["data","measures",a,u])),l={onReset:p.cleanMeasures,onChange:p.setMeasures};if(o instanceof String||typeof o=="string"){const e=o;let t;try{t=decodeURIComponent(e)}catch{t=e}s=JSON.parse(t)}else s=o;if(m.useEffect(()=>{s&&s[a]&&s[a].forEach(e=>{e.defaultSelected&&i(l.onChange({app:a,group:u,mGroup:e}))})},[]),s&&s[a]){const e=s[a];return r.jsxs(c.Container,{className:"measures group",fluid:!0,children:[n&&r.jsx("span",{children:n}),e.map(t=>r.jsxs("div",{className:"inputs lists",onClick:q=>i(l.onChange({app:a,group:u,mGroup:t})),children:[r.jsx(c.Radio,{readOnly:!0,checked:!!(d&&d.idx==t.idx),type:"radio"}),r.jsx("span",{children:t.label})]},t.idx))]})}else return r.jsx(c.Container,{className:"measures group",fluid:!0,children:n&&r.jsx("span",{children:n})})};exports.default=g;
@@ -1 +1 @@
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
+ "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"),N=require("./CustomSemanticSearch.js"),E=require("react-dom"),_=require("semantic-ui-react"),w=require("react-intl"),R=(t,r)=>{if(!t||!r)return t||"";const s=new RegExp(`(${r})`,"gi");return t.replace(s,"<strong>$1</strong>")},T=(t,r)=>{const s=String(r||"en").replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return new RegExp(`^/${s}/?$`).test(String(t||"").trim())},b=t=>Array.isArray(t)?String(t[0]||"").trim():String(t||"").trim(),I=w.injectIntl(({ID:t,title:r,slug:s,parent_title:i,parent_slug:n,parent_link:c,extract:a,type:l,link:d,terms:j,subtype:p,bread_crumbs:u=[],metadata:o,intl:{locale:g},searchTerm:S})=>{const f=o==null?void 0:o.redirect_url,x=m.utils.replaceLink(c,g),M=m.utils.replaceLink(d,g),y=b(f);let v=M;c&&!T(x,g)&&(v=x+`#${s}`),y&&(v=y+`#${s}`);const C=R(String(r),S),L=R(a,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:F=>document.location.href=v,children:[e.jsx("h5",{className:"breadcrumbs-search",dangerouslySetInnerHTML:{__html:u&&u.length>0?R(u.join(" / "),S):""}}),e.jsx("div",{className:"has-standard-14-font-size",children:e.jsx("h4",{className:"search-title",dangerouslySetInnerHTML:{__html:C}})}),e.jsx("div",{className:"search-content",dangerouslySetInnerHTML:{__html:m.utils.replaceHTMLinks(L,g)}})]})})}),P=({results:t,meta:r,perPage:s,intl:i,searchTerm:n})=>{const c=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:c<s?c:s,total:c})}),t.map(a=>e.jsx(I,{...a,searchTerm:n},a.ID))]})},$=({onSearch:t,perPage:r,loading:s,results:i,meta:n,intl:c,searchTerm:a})=>(n&&n["x-wp-total"],n&&n["x-wp-totalpages"],e.jsx("input",{placeholder:c.formatMessage({id:"search.placeholder",defaultMessage:"Search..."}),type:"text",className:"input search",name:"search",value:a,onChange:l=>{t(l.target.value)}})),q=({onSearch:t,onSetSelected:r,perPage:s,loading:i,results:n,meta:c,locale:a,intl:l,searchTerm:d,selected:j})=>{const[p,u]=h.useState(!1),o=h.useRef(null),g=()=>{u(!1)};h.useEffect(()=>{const f=document.createElement("div");f.setAttribute("id","float-input-container"),f.setAttribute("class","input container"),f.style.display="none";const x=document.getElementById("root");return x&&(x.appendChild(f),o.current=f),()=>{o.current&&o.current.parentNode&&o.current.parentNode.removeChild(o.current)}},[]),h.useEffect(()=>{o.current&&(o.current.style.display=p?"block":"none")},[p]);const S=()=>{u(!0)};return e.jsxs(e.Fragment,{children:[e.jsx("div",{id:"ui-float-search",className:`ui float-search${p?" ui-float-search-active":""}`,onMouseOver:S,children:e.jsx(_.Icon,{name:"search",size:"small"})}),o.current&&E.createPortal(p?e.jsxs("div",{onMouseLeave:g,children:[e.jsx("div",{className:"float-search-container",children:e.jsx($,{onSearch:t,perPage:s,loading:i,results:n,meta:c,intl:l,searchTerm:d})}),n&&n.length>0&&e.jsx(w.IntlProvider,{locale:a,children:e.jsx(P,{results:n,meta:c,perPage:s,intl:l,searchTerm:d})})]}):null,o.current)]})},z=({onSearch:t,perPage:r,loading:s,results:i,meta:n,intl:c})=>{const a=n?n["x-wp-total"]:0,l=n?n["x-wp-totalpages"]:0,[d,j]=h.useState("");h.useEffect(()=>{const u=setTimeout(()=>{t(d)},300);return()=>clearTimeout(u)},[d]);const p=u=>e.jsx(I,{...u,searchTerm:d});return e.jsx(N.default,{value:d,loading:s,placeholder:c.formatMessage({id:"search.placeholder",defaultMessage:"Search..."}),onResultSelect:(u,o)=>null,total:a,perPage:r,totalPages:l,onSearchChange:(u,o)=>{j(o.value)},resultRenderer:p,results:i,showNoResults:!1,intl:c,searchTerm:d})},k=w.injectIntl(t=>{const{intl:r,onSetSelected:s}=t,[i,n]=h.useState(""),[c,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(D,{...t,onSetSelected:s,setQuery:n,query:i,isSmallScreen:c,intl:r})})}),D=({onSetSelected:t,selected:r,setQuery:s,query:i,isSmallScreen:n,intl:c,...a})=>{const l=h.useContext(m.SearchContext);return a.settings.react_search_type==="floating"||n?e.jsx(q,{onSetSelected:t,selected:r,onSearch:s,perPage:5,intl:c,...a,...l,searchTerm:i}):e.jsx(z,{onSetSelected:t,onSearch:s,perPage:5,intl:c,...a,...l})};exports.default=k;
@@ -1,146 +1,150 @@
1
1
  import { jsx as t, jsxs as l } from "react/jsx-runtime";
2
- import V, { useRef as K, useState as O, useEffect as X } from "react";
3
- import { Container as x, Grid as C, Button as Y, Dropdown as A, Icon as Z } from "semantic-ui-react";
4
- import { PostContent as L } from "@devgateway/wp-react-lib";
5
- import { domtoimage as G } from "./dom-to-image.js";
6
- import { saveAs as U } from "file-saver";
7
- import { connect as _ } from "react-redux";
8
- const ee = V.forwardRef((a, r) => /* @__PURE__ */ t("div", { ref: r, children: a.children })), te = (a) => {
9
- const r = K();
2
+ import K, { useRef as X, useState as L, useEffect as Y } from "react";
3
+ import { Container as v, Grid as y, Button as Z, Dropdown as P, Icon as _ } from "semantic-ui-react";
4
+ import { PostContent as U } from "@devgateway/wp-react-lib";
5
+ import { domtoimage as C } from "./dom-to-image.js";
6
+ import { saveAs as E } from "file-saver";
7
+ import { connect as ee } from "react-redux";
8
+ const te = K.forwardRef((a, r) => /* @__PURE__ */ t("div", { ref: r, children: a.children })), ne = (a) => {
9
+ const r = X();
10
10
  let {
11
- childContent: h,
12
- "data-height": re,
13
- "data-button-label": E,
14
- "data-png-label": J,
11
+ childContent: g,
12
+ "data-height": ae,
13
+ "data-button-label": J,
14
+ "data-png-label": I,
15
15
  "data-jpg-label": T,
16
16
  "data-jpg-text": F,
17
17
  "data-png-text": S,
18
- "data-check-png": y = "true",
19
- "data-check-jpg": k = "true",
20
- "data-title": I,
21
- "data-default-format": w = "PNG",
22
- "data-use-title": P = "false",
23
- "data-style": B = "heavy",
18
+ "data-check-png": k = "true",
19
+ "data-check-jpg": x = "true",
20
+ "data-title": B,
21
+ "data-default-format": N = "PNG",
22
+ "data-use-title": b = "false",
23
+ "data-style": D = "heavy",
24
24
  "data-section-title": $ = "",
25
25
  "data-download-tooltip": j = "",
26
26
  "data-include-source-url": q = "false",
27
27
  "data-include-filters": R = "false",
28
- "data-source-urlmargin-left": D = 70,
28
+ "data-source-urlmargin-left": O = 70,
29
29
  "data-source-urlmargin-top": W = 10,
30
30
  "data-source-urlfont-size": M = 18,
31
- parent: ae,
31
+ parent: ie,
32
32
  editing: i,
33
- component: ie,
34
- unique: le,
35
- pageModuleProps: c
33
+ component: le,
34
+ unique: se,
35
+ pageModuleProps: s
36
36
  } = a;
37
- const [p, m] = O(w), s = y == "true" || y === !0, d = k == "true" || k === !0;
38
- X(() => {
39
- m(w);
40
- }, [w]);
41
- const v = (n) => {
42
- m(n.target.value);
43
- };
44
- function z(n) {
45
- const o = n.attributes, N = [];
37
+ const [w, p] = L(N), [z, c] = L(!1), d = k == "true" || k === !0, u = x == "true" || x === !0;
38
+ Y(() => {
39
+ p(N);
40
+ }, [N]);
41
+ function H(n) {
42
+ const o = n.attributes, G = [];
46
43
  if (o)
47
44
  for (let e = 0; e < o.length; e++)
48
- N.push(o[e].nodeName);
49
- const u = N.filter((e) => e.startsWith("data-"));
50
- if (u.length > 0 && u.forEach((e) => {
45
+ G.push(o[e].nodeName);
46
+ const f = G.filter((e) => e.startsWith("data-"));
47
+ if (f.length > 0 && f.forEach((e) => {
51
48
  n.setAttribute(e, "");
52
49
  }), n.classList) {
53
50
  if (n.classList.contains("ignore")) return !1;
54
51
  if (!(R === !0 || R === "true")) {
55
- const f = [
52
+ const m = [
56
53
  "filter-component",
57
54
  "data-filters-reset",
58
55
  "data-filters-apply",
59
56
  "filter-search"
60
57
  ];
61
- for (const Q of f)
62
- if (n.classList.contains(Q)) return !1;
58
+ for (const V of m)
59
+ if (n.classList.contains(V)) return !1;
63
60
  }
64
61
  return !0;
65
62
  }
66
63
  return !0;
67
64
  }
68
- const g = { filter: z, bgcolor: "#FFF", imagePlaceholder: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8Xw8AAoMBgQb9Z3kAAAAASUVORK5CYII=", cacheBust: !0 }, H = (n) => {
69
- G.cloneNode(r.current).then(function(o) {
65
+ const A = { filter: H, bgcolor: "#FFF", imagePlaceholder: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8Xw8AAoMBgQb9Z3kAAAAASUVORK5CYII=", cacheBust: !0 }, Q = (n) => {
66
+ C.cloneNode(r.current).then(function(o) {
70
67
  if ([...o.getElementsByTagName("input")].forEach((e) => e.remove()), [...o.querySelectorAll(".question.circle.icon")].forEach((e) => e.remove()), q === "true") {
71
68
  const e = document.createElement("div");
72
- e.style.marginLeft = D + "px", e.style.marginTop = W + "px", e.style.fontSize = M + "px", e.style.fontFamily = "Roboto, sans-serif", e.style.fontWeight = "400", e.style.color = "#66676d", e.style.opacity = "0.75", e.innerHTML = window.location.href, e.style.maxWidth = "90%", e.style.wordWrap = "break-word", e.style.overflowWrap = "break-word", o.appendChild(e);
69
+ e.style.marginLeft = O + "px", e.style.marginTop = W + "px", e.style.fontSize = M + "px", e.style.fontFamily = "Roboto, sans-serif", e.style.fontWeight = "400", e.style.color = "#66676d", e.style.opacity = "0.75", e.innerHTML = window.location.href, e.style.maxWidth = "90%", e.style.wordWrap = "break-word", e.style.overflowWrap = "break-word", o.appendChild(e);
73
70
  }
74
- const u = 50;
75
- g.height = r.current.scrollHeight + u, g.width = r.current.scrollWidth + u * 2, o.style.padding = `${u}px`, n === "PNG" && G.toPng(o, g).then(function(e) {
71
+ const f = 50;
72
+ A.height = r.current.scrollHeight + f, A.width = r.current.scrollWidth + f * 2, o.style.padding = `${f}px`, n === "PNG" && C.toPng(o, A).then(function(e) {
76
73
  if (!e) throw new Error("PNG render returned empty result");
77
- return fetch(e).then((f) => f.blob());
74
+ return fetch(e).then((m) => m.blob());
78
75
  }).then(function(e) {
79
- U(e, J);
76
+ E(e, I);
80
77
  }).catch(function(e) {
81
78
  console.error("PNG download failed:", e);
82
- }), n === "JPG" && G.toJpeg(o, g).then(function(e) {
79
+ }), n === "JPG" && C.toJpeg(o, A).then(function(e) {
83
80
  if (!e) throw new Error("JPEG render returned empty result");
84
- return fetch(e).then((f) => f.blob());
81
+ return fetch(e).then((m) => m.blob());
85
82
  }).then(function(e) {
86
- U(e, T);
83
+ E(e, T);
87
84
  }).catch(function(e) {
88
85
  console.error("JPG download failed:", e);
89
86
  });
90
87
  });
91
- }, b = (n) => {
92
- i ? alert("Not allowed when editing please preview page") : H(n);
88
+ }, h = (n) => {
89
+ i ? alert("Not allowed when editing please preview page") : Q(n);
93
90
  };
94
91
  return /* @__PURE__ */ t(
95
- x,
92
+ v,
96
93
  {
97
- className: `viz download ${B} ${P ? "has-title" : ""}
98
- ${s || d ? "has-formats" : ""}
99
- ${i || c != null && c.editing ? "editing" : ""}
100
- ${s && d ? "multi-format" : ""}
101
- ${s && !d || !s && d ? "single-format" : ""}`,
94
+ className: `viz download ${D} ${b ? "has-title" : ""}
95
+ ${d || u ? "has-formats" : ""}
96
+ ${i || s != null && s.editing ? "editing" : ""}
97
+ ${d && u ? "multi-format" : ""}
98
+ ${d && !u || !d && u ? "single-format" : ""}`,
102
99
  fluid: !0,
103
- children: /* @__PURE__ */ l(ee, { ref: r, children: [
104
- /* @__PURE__ */ l(C, { stackable: !0, reversed: "mobile", className: "download-header", children: [
105
- !i && P === "true" && /* @__PURE__ */ t(C.Column, { width: 12, children: /* @__PURE__ */ t(
106
- L,
100
+ children: /* @__PURE__ */ l(te, { ref: r, children: [
101
+ /* @__PURE__ */ l(y, { stackable: !0, reversed: "mobile", className: "download-header", children: [
102
+ !i && b === "true" && /* @__PURE__ */ t(y.Column, { width: 12, children: /* @__PURE__ */ t(
103
+ U,
107
104
  {
108
105
  parentUnique: a.unique,
109
106
  post: { content: { rendered: decodeURIComponent($) } }
110
107
  }
111
108
  ) }),
112
109
  /* @__PURE__ */ t(
113
- C.Column,
110
+ y.Column,
114
111
  {
115
112
  className: i ? "editing ignore" : "ignore",
116
- width: i || P !== "true" ? 16 : 4,
113
+ width: i || b !== "true" ? 16 : 4,
117
114
  textAlign: "right",
118
115
  children: /* @__PURE__ */ l("div", { className: "wrapper", children: [
119
- /* @__PURE__ */ l(Y, { className: "download", onClick: () => b(p), children: [
120
- E,
116
+ /* @__PURE__ */ l(Z, { className: "download", onClick: () => h(w), children: [
117
+ J,
121
118
  " ",
122
- p === "PNG" ? "PNG" : "JPG"
119
+ w === "PNG" ? "PNG" : "JPG"
123
120
  ] }),
124
121
  /* @__PURE__ */ t(
125
- A,
122
+ P,
126
123
  {
127
124
  className: "download",
128
125
  "data-tooltip": decodeURIComponent(j),
129
- trigger: d && s ? /* @__PURE__ */ t(Z, { name: "download", className: "download-icon" }) : null,
130
- children: /* @__PURE__ */ l(A.Menu, { children: [
131
- I,
132
- s === !0 && /* @__PURE__ */ l(A.Item, { onClick: () => {
133
- m("PNG"), b("PNG");
134
- }, children: [
135
- /* @__PURE__ */ t("input", { type: "radio", value: "PNG", checked: p === "PNG", onChange: v }),
136
- /* @__PURE__ */ t("label", { children: S })
137
- ] }),
138
- d === !0 && /* @__PURE__ */ l(A.Item, { onClick: () => {
139
- m("JPG"), b("JPG");
140
- }, children: [
141
- /* @__PURE__ */ t("input", { type: "radio", value: "JPG", checked: p === "JPG", onChange: v }),
142
- /* @__PURE__ */ t("label", { children: F })
143
- ] })
126
+ open: z,
127
+ onOpen: () => c(!0),
128
+ onClose: () => c(!1),
129
+ trigger: u && d ? /* @__PURE__ */ t(_, { name: "download", className: "download-icon" }) : null,
130
+ children: /* @__PURE__ */ l(P.Menu, { children: [
131
+ B,
132
+ d === !0 && /* @__PURE__ */ t(P.Item, { onClick: () => {
133
+ p("PNG"), h("PNG"), c(!1);
134
+ }, children: /* @__PURE__ */ l("div", { className: "ui radio checkbox", children: [
135
+ /* @__PURE__ */ t("input", { type: "radio", className: "hidden", readOnly: !0, tabIndex: 0, checked: w === "PNG" }),
136
+ /* @__PURE__ */ t("label", { onClick: (n) => {
137
+ n.stopPropagation(), p("PNG"), h("PNG"), c(!1);
138
+ }, children: S })
139
+ ] }) }),
140
+ u === !0 && /* @__PURE__ */ t(P.Item, { onClick: () => {
141
+ p("JPG"), h("JPG"), c(!1);
142
+ }, children: /* @__PURE__ */ l("div", { className: "ui radio checkbox", children: [
143
+ /* @__PURE__ */ t("input", { type: "radio", className: "hidden", readOnly: !0, tabIndex: 0, checked: w === "JPG" }),
144
+ /* @__PURE__ */ t("label", { onClick: (n) => {
145
+ n.stopPropagation(), p("JPG"), h("JPG"), c(!1);
146
+ }, children: F })
147
+ ] }) })
144
148
  ] })
145
149
  }
146
150
  )
@@ -148,20 +152,20 @@ const ee = V.forwardRef((a, r) => /* @__PURE__ */ t("div", { ref: r, children: a
148
152
  }
149
153
  )
150
154
  ] }),
151
- !i && /* @__PURE__ */ t(x, { fluid: !0, className: `download area ${i || c != null && c.editing ? "editing" : ""}`, children: /* @__PURE__ */ t(
152
- L,
155
+ !i && /* @__PURE__ */ t(v, { fluid: !0, className: `download area ${i || s != null && s.editing ? "editing" : ""}`, children: /* @__PURE__ */ t(
156
+ U,
153
157
  {
154
158
  parentUnique: a.unique,
155
- post: { content: { rendered: h } }
159
+ post: { content: { rendered: g } }
156
160
  }
157
161
  ) })
158
162
  ] })
159
163
  }
160
164
  );
161
- }, ne = (a) => {
162
- const r = a.getIn(["data", "pageModuleProps"]), h = {};
163
- return r && (h.pageModuleProps = r), h;
164
- }, oe = {}, ge = _(ne, oe)(te);
165
+ }, oe = (a) => {
166
+ const r = a.getIn(["data", "pageModuleProps"]), g = {};
167
+ return r && (g.pageModuleProps = r), g;
168
+ }, re = {}, we = ee(oe, re)(ne);
165
169
  export {
166
- ge as default
170
+ we as default
167
171
  };
@@ -1,25 +1,25 @@
1
- import { jsxs as d, jsx as r } from "react/jsx-runtime";
1
+ import { jsxs as u, jsx as t } from "react/jsx-runtime";
2
2
  import { useEffect as f } from "react";
3
- import { Container as l } from "semantic-ui-react";
4
- import { setMeasures as h, cleanMeasures as g } from "../reducers/data.js";
5
- import { useAppDispatch as x, useAppSelector as C } from "../../redux/hooks.js";
3
+ import { Container as l, Radio as h } from "semantic-ui-react";
4
+ import { setMeasures as g, cleanMeasures as x } from "../reducers/data.js";
5
+ import { useAppDispatch as C, useAppSelector as y } from "../../redux/hooks.js";
6
6
  const E = (m) => {
7
7
  const {
8
- parent: y,
9
- editing: N = !1,
10
- unique: S,
11
- "data-label": n,
8
+ parent: N,
9
+ editing: S = !1,
10
+ unique: b,
11
+ "data-label": o,
12
12
  "data-group": p,
13
- "data-app": t,
14
- "data-measures-groups": o
13
+ "data-app": r,
14
+ "data-measures-groups": n
15
15
  } = m;
16
16
  let s;
17
- const i = x(), u = C((e) => e.getIn(["data", "measures", t, p])), c = {
18
- onReset: g,
19
- onChange: h
17
+ const i = C(), c = y((e) => e.getIn(["data", "measures", r, p])), d = {
18
+ onReset: x,
19
+ onChange: g
20
20
  };
21
- if (o instanceof String || typeof o == "string") {
22
- const e = o;
21
+ if (n instanceof String || typeof n == "string") {
22
+ const e = n;
23
23
  let a;
24
24
  try {
25
25
  a = decodeURIComponent(e);
@@ -28,29 +28,29 @@ const E = (m) => {
28
28
  }
29
29
  s = JSON.parse(a);
30
30
  } else
31
- s = o;
31
+ s = n;
32
32
  if (f(() => {
33
- s && s[t] && s[t].forEach((e) => {
34
- e.defaultSelected && i(c.onChange({ app: t, group: p, mGroup: e }));
33
+ s && s[r] && s[r].forEach((e) => {
34
+ e.defaultSelected && i(d.onChange({ app: r, group: p, mGroup: e }));
35
35
  });
36
- }, []), s && s[t]) {
37
- const e = s[t];
38
- return /* @__PURE__ */ d(l, { className: "measures group", fluid: !0, children: [
39
- n && /* @__PURE__ */ r("span", { children: n }),
40
- e.map((a) => /* @__PURE__ */ d("div", { className: "inputs lists", onClick: (b) => i(c.onChange({ app: t, group: p, mGroup: a })), children: [
41
- /* @__PURE__ */ r(
42
- "input",
36
+ }, []), s && s[r]) {
37
+ const e = s[r];
38
+ return /* @__PURE__ */ u(l, { className: "measures group", fluid: !0, children: [
39
+ o && /* @__PURE__ */ t("span", { children: o }),
40
+ e.map((a) => /* @__PURE__ */ u("div", { className: "inputs lists", onClick: (G) => i(d.onChange({ app: r, group: p, mGroup: a })), children: [
41
+ /* @__PURE__ */ t(
42
+ h,
43
43
  {
44
44
  readOnly: !0,
45
- checked: !!(u && u.idx == a.idx),
45
+ checked: !!(c && c.idx == a.idx),
46
46
  type: "radio"
47
47
  }
48
48
  ),
49
- /* @__PURE__ */ r("span", { children: a.label })
49
+ /* @__PURE__ */ t("span", { children: a.label })
50
50
  ] }, a.idx))
51
51
  ] });
52
52
  } else
53
- return /* @__PURE__ */ r(l, { className: "measures group", fluid: !0, children: n && /* @__PURE__ */ r("span", { children: n }) });
53
+ return /* @__PURE__ */ t(l, { className: "measures group", fluid: !0, children: o && /* @__PURE__ */ t("span", { children: o }) });
54
54
  };
55
55
  export {
56
56
  E as default
@@ -1,38 +1,41 @@
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
- import { Icon as F } from "semantic-ui-react";
7
- import { injectIntl as I, IntlProvider as $ } from "react-intl";
8
- const C = (n, s) => {
9
- if (!n || !s) return n || "";
10
- const o = new RegExp(`(${s})`, "gi");
11
- return n.replace(o, "<strong>$1</strong>");
12
- }, N = I(
1
+ import { jsx as o, jsxs as S, Fragment as _ } from "react/jsx-runtime";
2
+ import { useState as v, useEffect as w, useContext as $, useRef as P } from "react";
3
+ import { utils as x, SearchProvider as b, SearchContext as z } from "@devgateway/wp-react-lib";
4
+ import k from "./CustomSemanticSearch.js";
5
+ import { createPortal as F } from "react-dom";
6
+ import { Icon as j } from "semantic-ui-react";
7
+ import { injectIntl as N, IntlProvider as A } from "react-intl";
8
+ const C = (e, r) => {
9
+ if (!e || !r) return e || "";
10
+ const n = new RegExp(`(${r})`, "gi");
11
+ return e.replace(n, "<strong>$1</strong>");
12
+ }, D = (e, r) => {
13
+ const n = String(r || "en").replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
14
+ return new RegExp(`^/${n}/?$`).test(String(e || "").trim());
15
+ }, H = (e) => Array.isArray(e) ? String(e[0] || "").trim() : String(e || "").trim(), L = N(
13
16
  ({
14
- ID: n,
15
- title: s,
16
- slug: o,
17
+ ID: e,
18
+ title: r,
19
+ slug: n,
17
20
  parent_title: i,
18
- parent_slug: e,
19
- parent_link: r,
21
+ parent_slug: t,
22
+ parent_link: s,
20
23
  extract: a,
21
24
  type: l,
22
25
  link: d,
23
26
  terms: y,
24
- subtype: p,
27
+ subtype: h,
25
28
  bread_crumbs: u = [],
26
29
  metadata: c,
27
- intl: { locale: m },
30
+ intl: { locale: f },
28
31
  searchTerm: g
29
32
  // Added searchTerm prop
30
33
  }) => {
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
- return /* @__PURE__ */ t(
34
+ const p = c == null ? void 0 : c.redirect_url, m = x.replaceLink(s, f), M = x.replaceLink(d, f), I = H(p);
35
+ let R = M;
36
+ s && !D(m, f) && (R = m + `#${n}`), I && (R = I + `#${n}`);
37
+ const E = C(String(r), g), T = C(a, g);
38
+ return /* @__PURE__ */ o(
36
39
  "div",
37
40
  {
38
41
  className: "search-results-wrapper searching-results",
@@ -41,9 +44,9 @@ const C = (n, s) => {
41
44
  "div",
42
45
  {
43
46
  className: "has-standard-12-font-size",
44
- onClick: (q) => document.location.href = h,
47
+ onClick: (J) => document.location.href = R,
45
48
  children: [
46
- /* @__PURE__ */ t(
49
+ /* @__PURE__ */ o(
47
50
  "h5",
48
51
  {
49
52
  className: "breadcrumbs-search",
@@ -52,21 +55,21 @@ const C = (n, s) => {
52
55
  }
53
56
  }
54
57
  ),
55
- /* @__PURE__ */ t("div", { className: "has-standard-14-font-size", children: /* @__PURE__ */ t(
58
+ /* @__PURE__ */ o("div", { className: "has-standard-14-font-size", children: /* @__PURE__ */ o(
56
59
  "h4",
57
60
  {
58
61
  className: "search-title",
59
62
  dangerouslySetInnerHTML: {
60
- __html: M
63
+ __html: E
61
64
  }
62
65
  }
63
66
  ) }),
64
- /* @__PURE__ */ t(
67
+ /* @__PURE__ */ o(
65
68
  "div",
66
69
  {
67
70
  className: "search-content",
68
71
  dangerouslySetInnerHTML: {
69
- __html: x.replaceHTMLinks(R, m)
72
+ __html: x.replaceHTMLinks(T, f)
70
73
  }
71
74
  }
72
75
  )
@@ -76,30 +79,30 @@ const C = (n, s) => {
76
79
  }
77
80
  );
78
81
  }
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
- /* @__PURE__ */ t("span", { className: "float-results-header", children: i.formatMessage(
82
+ ), q = ({ results: e, meta: r, perPage: n, intl: i, searchTerm: t }) => {
83
+ const s = r ? r["x-wp-total"] : 0;
84
+ return r && r["x-wp-totalpages"], /* @__PURE__ */ S("div", { id: "float-results-container", children: [
85
+ /* @__PURE__ */ o("span", { className: "float-results-header", children: i.formatMessage(
83
86
  {
84
87
  id: "search.results.summary",
85
88
  defaultMessage: "{count} of {total} Results"
86
89
  },
87
- { count: r < o ? r : o, total: r }
90
+ { count: s < n ? s : n, total: s }
88
91
  ) }),
89
- n.map((a) => /* @__PURE__ */ t(N, { ...a, searchTerm: e }, a.ID))
92
+ e.map((a) => /* @__PURE__ */ o(L, { ...a, searchTerm: t }, a.ID))
90
93
  ] });
91
- }, k = ({
92
- onSearch: n,
93
- perPage: s,
94
- loading: o,
94
+ }, B = ({
95
+ onSearch: e,
96
+ perPage: r,
97
+ loading: n,
95
98
  results: i,
96
- meta: e,
97
- intl: r,
99
+ meta: t,
100
+ intl: s,
98
101
  searchTerm: a
99
- }) => (e && e["x-wp-total"], e && e["x-wp-totalpages"], /* @__PURE__ */ t(
102
+ }) => (t && t["x-wp-total"], t && t["x-wp-totalpages"], /* @__PURE__ */ o(
100
103
  "input",
101
104
  {
102
- placeholder: r.formatMessage({
105
+ placeholder: s.formatMessage({
103
106
  id: "search.placeholder",
104
107
  defaultMessage: "Search..."
105
108
  }),
@@ -108,16 +111,16 @@ const C = (n, s) => {
108
111
  name: "search",
109
112
  value: a,
110
113
  onChange: (l) => {
111
- n(l.target.value);
114
+ e(l.target.value);
112
115
  }
113
116
  }
114
- )), D = ({
115
- onSearch: n,
116
- onSetSelected: s,
117
- perPage: o,
117
+ )), O = ({
118
+ onSearch: e,
119
+ onSetSelected: r,
120
+ perPage: n,
118
121
  loading: i,
119
- results: e,
120
- meta: r,
122
+ results: t,
123
+ meta: s,
121
124
  locale: a,
122
125
  intl: l,
123
126
  searchTerm: d,
@@ -125,50 +128,50 @@ const C = (n, s) => {
125
128
  selected: y
126
129
  // Added selected prop to track menu selection
127
130
  }) => {
128
- const [p, u] = v(!1), c = E(null), m = () => {
131
+ const [h, u] = v(!1), c = P(null), f = () => {
129
132
  u(!1);
130
133
  };
131
134
  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), () => {
135
+ const p = document.createElement("div");
136
+ p.setAttribute("id", "float-input-container"), p.setAttribute("class", "input container"), p.style.display = "none";
137
+ const m = document.getElementById("root");
138
+ return m && (m.appendChild(p), c.current = p), () => {
136
139
  c.current && c.current.parentNode && c.current.parentNode.removeChild(c.current);
137
140
  };
138
141
  }, []), w(() => {
139
- c.current && (c.current.style.display = p ? "block" : "none");
140
- }, [p]), /* @__PURE__ */ S(L, { children: [
141
- /* @__PURE__ */ t(
142
+ c.current && (c.current.style.display = h ? "block" : "none");
143
+ }, [h]), /* @__PURE__ */ S(_, { children: [
144
+ /* @__PURE__ */ o(
142
145
  "div",
143
146
  {
144
147
  id: "ui-float-search",
145
- className: `ui float-search${p ? " ui-float-search-active" : ""}`,
148
+ className: `ui float-search${h ? " ui-float-search-active" : ""}`,
146
149
  onMouseOver: () => {
147
150
  u(!0);
148
151
  },
149
- children: /* @__PURE__ */ t(F, { name: "search", size: "small" })
152
+ children: /* @__PURE__ */ o(j, { name: "search", size: "small" })
150
153
  }
151
154
  ),
152
- c.current && P(
153
- p ? /* @__PURE__ */ S("div", { onMouseLeave: m, children: [
154
- /* @__PURE__ */ t("div", { className: "float-search-container", children: /* @__PURE__ */ t(
155
- k,
155
+ c.current && F(
156
+ h ? /* @__PURE__ */ S("div", { onMouseLeave: f, children: [
157
+ /* @__PURE__ */ o("div", { className: "float-search-container", children: /* @__PURE__ */ o(
158
+ B,
156
159
  {
157
- onSearch: n,
158
- perPage: o,
160
+ onSearch: e,
161
+ perPage: n,
159
162
  loading: i,
160
- results: e,
161
- meta: r,
163
+ results: t,
164
+ meta: s,
162
165
  intl: l,
163
166
  searchTerm: d
164
167
  }
165
168
  ) }),
166
- e && e.length > 0 && /* @__PURE__ */ t($, { locale: a, children: /* @__PURE__ */ t(
167
- j,
169
+ t && t.length > 0 && /* @__PURE__ */ o(A, { locale: a, children: /* @__PURE__ */ o(
170
+ q,
168
171
  {
169
- results: e,
170
- meta: r,
171
- perPage: o,
172
+ results: t,
173
+ meta: s,
174
+ perPage: n,
172
175
  intl: l,
173
176
  searchTerm: d
174
177
  }
@@ -177,82 +180,82 @@ const C = (n, s) => {
177
180
  c.current
178
181
  )
179
182
  ] });
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("");
183
+ }, W = ({ onSearch: e, perPage: r, loading: n, results: i, meta: t, intl: s }) => {
184
+ const a = t ? t["x-wp-total"] : 0, l = t ? t["x-wp-totalpages"] : 0, [d, y] = v("");
182
185
  w(() => {
183
186
  const u = setTimeout(() => {
184
- n(d);
187
+ e(d);
185
188
  }, 300);
186
189
  return () => clearTimeout(u);
187
190
  }, [d]);
188
- const p = (u) => /* @__PURE__ */ t(N, { ...u, searchTerm: d });
189
- return /* @__PURE__ */ t(
190
- z,
191
+ const h = (u) => /* @__PURE__ */ o(L, { ...u, searchTerm: d });
192
+ return /* @__PURE__ */ o(
193
+ k,
191
194
  {
192
195
  value: d,
193
- loading: o,
194
- placeholder: r.formatMessage({
196
+ loading: n,
197
+ placeholder: s.formatMessage({
195
198
  id: "search.placeholder",
196
199
  defaultMessage: "Search..."
197
200
  }),
198
201
  onResultSelect: (u, c) => null,
199
202
  total: a,
200
- perPage: s,
203
+ perPage: r,
201
204
  totalPages: l,
202
205
  onSearchChange: (u, c) => {
203
206
  y(c.value);
204
207
  },
205
- resultRenderer: p,
208
+ resultRenderer: h,
206
209
  results: i,
207
210
  showNoResults: !1,
208
- intl: r,
211
+ intl: s,
209
212
  searchTerm: d
210
213
  }
211
214
  );
212
- }, U = I((n) => {
213
- const { intl: s, onSetSelected: o } = n, [i, e] = v(""), [r, a] = v(!1);
215
+ }, ee = N((e) => {
216
+ const { intl: r, onSetSelected: n } = e, [i, t] = v(""), [s, a] = v(!1);
214
217
  return w(() => {
215
218
  const l = () => {
216
219
  a(window.innerWidth <= 1365);
217
220
  };
218
221
  return l(), window.addEventListener("resize", l), () => window.removeEventListener("resize", l);
219
- }, []), /* @__PURE__ */ t(T, { search: i, perPage: 5, locale: s.locale, children: /* @__PURE__ */ t(
220
- A,
222
+ }, []), /* @__PURE__ */ o(b, { search: i, perPage: 5, locale: r.locale, children: /* @__PURE__ */ o(
223
+ G,
221
224
  {
222
- ...n,
223
- onSetSelected: o,
224
- setQuery: e,
225
+ ...e,
226
+ onSetSelected: n,
227
+ setQuery: t,
225
228
  query: i,
226
- isSmallScreen: r,
227
- intl: s
229
+ isSmallScreen: s,
230
+ intl: r
228
231
  }
229
232
  ) });
230
- }), A = ({ onSetSelected: n, selected: s, setQuery: o, query: i, isSmallScreen: e, intl: r, ...a }) => {
231
- const l = _(b);
232
- return a.settings.react_search_type === "floating" || e ? /* @__PURE__ */ t(
233
- D,
233
+ }), G = ({ onSetSelected: e, selected: r, setQuery: n, query: i, isSmallScreen: t, intl: s, ...a }) => {
234
+ const l = $(z);
235
+ return a.settings.react_search_type === "floating" || t ? /* @__PURE__ */ o(
236
+ O,
234
237
  {
235
- onSetSelected: n,
236
- selected: s,
237
- onSearch: o,
238
+ onSetSelected: e,
239
+ selected: r,
240
+ onSearch: n,
238
241
  perPage: 5,
239
- intl: r,
242
+ intl: s,
240
243
  ...a,
241
244
  ...l,
242
245
  searchTerm: i
243
246
  }
244
- ) : /* @__PURE__ */ t(
245
- H,
247
+ ) : /* @__PURE__ */ o(
248
+ W,
246
249
  {
247
- onSetSelected: n,
248
- onSearch: o,
250
+ onSetSelected: e,
251
+ onSearch: n,
249
252
  perPage: 5,
250
- intl: r,
253
+ intl: s,
251
254
  ...a,
252
255
  ...l
253
256
  }
254
257
  );
255
258
  };
256
259
  export {
257
- U as default
260
+ ee as default
258
261
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devgateway/dvz-ui-react",
3
- "version": "1.8.1",
3
+ "version": "1.8.2",
4
4
  "main": "dist/cjs/index.js",
5
5
  "module": "dist/esm/index.js",
6
6
  "types": "dist/types/index.d.ts",