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