@devgateway/dvz-ui-react 1.6.6 → 1.6.8

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.
@@ -2,4 +2,4 @@
2
2
  ${d||u?"has-formats":""}
3
3
  ${s||c!=null&&c.editing?"editing":""}
4
4
  ${d&&u?"multi-format":""}
5
- ${d&&!u||!d&&u?"single-format":""}`,fluid:!0,children:t.jsxs(z,{ref:r,children:[t.jsxs(o.Grid,{stackable:!0,reversed:"mobile",className:"download-header",children:[!s&&w==="true"&&t.jsx(o.Grid.Column,{width:12,children:t.jsx(G.PostContent,{parentUnique:i.unique,post:{content:{rendered:decodeURIComponent(J)}}})}),t.jsx(o.Grid.Column,{className:s?"editing ignore":"ignore",width:s||w!=="true"?16:4,textAlign:"right",children:t.jsxs("div",{className:"wrapper",children:[t.jsxs(o.Button,{className:"download",onClick:()=>j(p),children:[R," ",p==="PNG"?"PNG":"JPG"]}),t.jsx(o.Dropdown,{className:"download","data-tooltip":decodeURIComponent(A),trigger:u||d?t.jsx(o.Icon,{name:"download",className:"download-icon"}):null,children:t.jsxs(o.Dropdown.Menu,{children:[S,d===!0&&t.jsxs(o.Dropdown.Item,{onClick:()=>{g("PNG"),j("PNG")},children:[t.jsx("input",{type:"radio",value:"PNG",checked:p==="PNG",onChange:C}),t.jsx("label",{children:T})]}),u===!0&&t.jsxs(o.Dropdown.Item,{onClick:()=>{g("JPG"),j("JPG")},children:[t.jsx("input",{type:"radio",value:"JPG",checked:p==="JPG",onChange:C}),t.jsx("label",{children:q})]})]})})]})})]}),!s&&t.jsx(o.Container,{fluid:!0,className:`download area ${s||c!=null&&c.editing?"editing":""}`,children:t.jsx(G.PostContent,{parentUnique:i.unique,post:{content:{rendered:h}}})})]})})},_=i=>{const r=i.getIn(["data","pageModuleProps"]),h={};return r&&(h.pageModuleProps=r),h},B={},O=W.connect(_,B)(H);exports.default=O;
5
+ ${d&&!u||!d&&u?"single-format":""}`,fluid:!0,children:t.jsxs(z,{ref:r,children:[t.jsxs(o.Grid,{stackable:!0,reversed:"mobile",className:"download-header",children:[!s&&w==="true"&&t.jsx(o.Grid.Column,{width:12,children:t.jsx(G.PostContent,{parentUnique:i.unique,post:{content:{rendered:decodeURIComponent(J)}}})}),t.jsx(o.Grid.Column,{className:s?"editing ignore":"ignore",width:s||w!=="true"?16:4,textAlign:"right",children:t.jsxs("div",{className:"wrapper",children:[t.jsxs(o.Button,{className:"download",onClick:()=>j(p),children:[R," ",p==="PNG"?"PNG":"JPG"]}),t.jsx(o.Dropdown,{className:"download","data-tooltip":decodeURIComponent(A),trigger:u&&d?t.jsx(o.Icon,{name:"download",className:"download-icon"}):null,children:t.jsxs(o.Dropdown.Menu,{children:[S,d===!0&&t.jsxs(o.Dropdown.Item,{onClick:()=>{g("PNG"),j("PNG")},children:[t.jsx("input",{type:"radio",value:"PNG",checked:p==="PNG",onChange:C}),t.jsx("label",{children:T})]}),u===!0&&t.jsxs(o.Dropdown.Item,{onClick:()=>{g("JPG"),j("JPG")},children:[t.jsx("input",{type:"radio",value:"JPG",checked:p==="JPG",onChange:C}),t.jsx("label",{children:q})]})]})})]})})]}),!s&&t.jsx(o.Container,{fluid:!0,className:`download area ${s||c!=null&&c.editing?"editing":""}`,children:t.jsx(G.PostContent,{parentUnique:i.unique,post:{content:{rendered:h}}})})]})})},_=i=>{const r=i.getIn(["data","pageModuleProps"]),h={};return r&&(h.pageModuleProps=r),h},B={},O=W.connect(_,B)(H);exports.default=O;
package/dist/cjs/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./embeddable/index.js"),o=require("./conf/index.js"),n=require("./layout/ResponsiveContainer.js"),i=require("./layout/ScrollTop.js"),a=require("./layout/containers/PreviewPageContainer.js"),u=require("./layout/containers/PreviewTypeContainer.js"),s=require("./layout/containers/SlugContainer.js"),c=require("./layout/containers/SlugPostContainer.js"),l=require("./layout/Customizer.js"),d=require("./layout/Layout.js"),q=require("./layout/PreviewComponent.js"),p=require("./layout/Favicon.js"),C=require("./layout/SSRFavicon.js"),f=require("./layout/Loading.js"),S=require("./layout/CustomSemanticSearch.js"),g=require("./layout/Header.js"),m=require("./layout/SearchControl.js"),P=require("./layout/LangSwitcher.js"),T=require("./layout/Footer.js"),v=require("./layout/ClassicHeader.js"),h=require("./layout/FlexWrapDetector.js"),w=require("./layout/FloatingMenuHeader.js"),R=require("./tracker/withGoogleAnalytics.js"),F=require("./redux/store.js"),t=require("./redux/hooks.js"),r=require("./lib/react-intl-redux/index.js"),y=require("./lib/redux-immutable/index.js"),I=require("./translations/en.json.js"),A=require("./translations/fr.json.js"),O=require("./translations/af.json.js"),x=require("./translations/am.json.js"),D=require("./countries.js"),H=require("./lib/react-intl-redux/providers/Provider.js"),L=require("./lib/react-intl-redux/providers/IntlProvider.js");exports.components=e.components;exports.customizer=e.customizer;exports.getComponentByNameIgnoreCase=e.getComponentByNameIgnoreCase;exports.reducers=e.reducers;exports.Config=o.Config;exports.ResponsiveContainer=n.default;exports.ScrollToTop=i.default;exports.PreviewPageContainer=a.default;exports.PreviewTypeContainer=u.default;exports.SlugContainer=s.default;exports.SlugPostContainer=c.default;exports.CustomizerWrapper=l.CustomizerWrapper;exports.RootLayout=d.default;exports.PreviewComponent=q.default;exports.Favicon=p.default;exports.SSRFavicon=C.default;exports.Loading=f.default;exports.CustomSemanticSearch=S.default;exports.Header=g.default;exports.SearchControl=m.default;exports.LangSwitcher=P.default;exports.Footer=T.default;exports.ClassicHeader=v.default;exports.FlexWrapDetector=h.default;exports.FloatingMenuHeader=w.default;exports.withTracker=R.withTracker;exports.store=F.store;exports.useAppDispatch=t.useAppDispatch;exports.useAppSelector=t.useAppSelector;exports.UPDATE=r.UPDATE;exports.initialState=r.initialState;exports.intlReducer=r.intlReducer;exports.updateIntl=r.updateIntl;exports.combineReducers=y.combineReducers;exports.englishTranslations=I;exports.frenchTranslations=A;exports.afrikaansTranslations=O;exports.amharicTranslations=x;exports.COUNTRY_OPTIONS=D.COUNTRY_OPTIONS;exports.Provider=H.default;exports.IntlProvider=L.default;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./embeddable/index.js"),a=require("./conf/index.js"),s=require("./layout/ResponsiveContainer.js"),u=require("./layout/ScrollTop.js"),c=require("./layout/containers/PreviewPageContainer.js"),l=require("./layout/containers/PreviewTypeContainer.js"),d=require("./layout/containers/SlugContainer.js"),p=require("./layout/containers/SlugPostContainer.js"),m=require("./layout/Customizer.js"),q=require("./layout/Layout.js"),C=require("./layout/PreviewComponent.js"),g=require("./layout/Favicon.js"),S=require("./layout/SSRFavicon.js"),T=require("./layout/Loading.js"),P=require("./layout/CustomSemanticSearch.js"),f=require("./layout/Header.js"),h=require("./layout/SearchControl.js"),v=require("./layout/LangSwitcher.js"),y=require("./layout/Footer.js"),A=require("./layout/ClassicHeader.js"),I=require("./layout/FlexWrapDetector.js"),H=require("./layout/FloatingMenuHeader.js"),w=require("./tracker/withGoogleAnalytics.js"),R=require("./redux/store.js"),i=require("./redux/hooks.js"),o=require("./lib/react-intl-redux/index.js"),x=require("./lib/redux-immutable/index.js"),F=require("./translations/en.json.js"),M=require("./translations/fr.json.js"),O=require("./translations/af.json.js"),E=require("./translations/am.json.js"),L=require("./countries.js"),t=require("./utils/data.js"),n=require("./utils/AppMedia.js"),e=require("./utils/semanticUtils.js"),N=require("./lib/react-intl-redux/providers/Provider.js"),U=require("./lib/react-intl-redux/providers/IntlProvider.js");exports.components=r.components;exports.customizer=r.customizer;exports.getComponentByNameIgnoreCase=r.getComponentByNameIgnoreCase;exports.reducers=r.reducers;exports.Config=a.Config;exports.ResponsiveContainer=s.default;exports.ScrollToTop=u.default;exports.PreviewPageContainer=c.default;exports.PreviewTypeContainer=l.default;exports.SlugContainer=d.default;exports.SlugPostContainer=p.default;exports.CustomizerWrapper=m.CustomizerWrapper;exports.RootLayout=q.default;exports.PreviewComponent=C.default;exports.Favicon=g.default;exports.SSRFavicon=S.default;exports.Loading=T.default;exports.CustomSemanticSearch=P.default;exports.Header=f.default;exports.SearchControl=h.default;exports.LangSwitcher=v.default;exports.Footer=y.default;exports.ClassicHeader=A.default;exports.FlexWrapDetector=I.default;exports.FloatingMenuHeader=H.default;exports.withTracker=w.withTracker;exports.store=R.store;exports.useAppDispatch=i.useAppDispatch;exports.useAppSelector=i.useAppSelector;exports.UPDATE=o.UPDATE;exports.initialState=o.initialState;exports.intlReducer=o.intlReducer;exports.updateIntl=o.updateIntl;exports.combineReducers=x.combineReducers;exports.englishTranslations=F;exports.frenchTranslations=M;exports.afrikaansTranslations=O;exports.amharicTranslations=E;exports.COUNTRY_OPTIONS=L.COUNTRY_OPTIONS;exports.decodeHtmlEntitiesToHtml=t.decodeHtmlEntitiesToHtml;exports.decodeHtmlEntitiesToText=t.decodeHtmlEntitiesToText;exports.stringToArray=t.stringToArray;exports.toBoolean=t.toBoolean;exports.toNumber=t.toNumber;exports.uriStringToArray=t.uriStringToArray;exports.Media=n.Media;exports.MediaContextProvider=n.MediaContextProvider;exports.mediaStyle=n.mediaStyle;exports.getUnhandledProps=e.getUnhandledProps;exports.htmlImageProps=e.htmlImageProps;exports.htmlInputAttrs=e.htmlInputAttrs;exports.htmlInputEvents=e.htmlInputEvents;exports.htmlInputProps=e.htmlInputProps;exports.partitionHTMLProps=e.partitionHTMLProps;exports.useKeyOnly=e.useKeyOnly;exports.useValueAndKey=e.useValueAndKey;exports.Provider=N.default;exports.IntlProvider=U.default;
@@ -1,3 +1,3 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),u=require("semantic-ui-react"),i=require("react"),x=require("@devgateway/wp-react-lib"),L=require("react-intl"),C=require("react-router"),T=require("./SearchControl.js"),$=require("./LangSwitcher.js"),D=(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},M=(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=D(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 b=C.useParams();i.useEffect(s=>{if(!d){const t=D(l,b).filter(f=>f.menu_item_parent==0);t&&a(t[0])}},[l,a,d]);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 E=/(-)?[0-9]+/g.exec(t),w=parseInt(E[0]);h.find(o=>o.ID==w)||h.push(f.value)}}),_({...l,items:h.filter(t=>s.indexOf(t.ID)===-1)})}},[n]);const[p,v]=i.useState(!1);return i.useEffect(()=>{const s=()=>{v(window.innerWidth<=1200)};return s(),window.addEventListener("resize",s),()=>window.removeEventListener("resize",s)},[]),g&&e.jsx(i.Fragment,{children:g.items.filter(s=>s.url!=="#wpm-languages").map((s,h)=>e.jsxs(i.Fragment,{children:[e.jsxs(u.Menu.Item,{className:`divided ${s.child_items?"has-child-items":""}
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),u=require("semantic-ui-react"),i=require("react"),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:M(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:M(s.url,j),children:s.title}):s.child_items?e.jsx("span",{onMouseOver:t=>a(s),children:s.title}):e.jsx("a",{onMouseOut:t=>a(null),onMouseOver:t=>a(s),href:M(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:M(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),[b,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 k=window.innerWidth<=1200;S(k),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 E=({media:o})=>o?e.jsx(u.Image,{src:o.guid.rendered}):e.jsx("img",{className:"brand logo",size:"large",src:"/logo_full.png"}),w=(r==null?void 0:r.landing_page_url)&&r.landing_page_url!==!1&&r.landing_page_url!==void 0&&r.landing_page_url!=="",R=w?r.landing_page_url:`/${n.locale}`;return console.log("isMenuVisible",a),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:w?"_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(E,{},"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})]}),!b&&(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,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.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("@artsy/fresnel"),e=t.createMedia({breakpoints:{mobile:320,tablet:768,computer:992,largeScreen:1200,widescreen:1920}});e.createMediaStyle();const{Media:r,MediaContextProvider:i}=e;exports.Media=r;exports.MediaContextProvider=i;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("@artsy/fresnel"),e=t.createMedia({breakpoints:{mobile:320,tablet:768,computer:992,largeScreen:1200,widescreen:1920}}),i=e.createMediaStyle(),{Media:r,MediaContextProvider:a}=e;exports.Media=r;exports.MediaContextProvider=a;exports.mediaStyle=i;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("dompurify");const r=t=>typeof t=="boolean"?t:typeof t=="string"?t==="true":!1,e=t=>typeof t=="number"?t:typeof t=="string"&&parseInt(t)||0;exports.toBoolean=r;exports.toNumber=e;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("html-entities"),i=t=>typeof t=="boolean"?t:typeof t=="string"?t==="true":!1,s=t=>typeof t=="number"?t:typeof t=="string"&&parseInt(t)||0,d=t=>{if(Array.isArray(t))return t;if(typeof t=="string"){const r=decodeURIComponent(t);if(r&&r!=="undefined")return JSON.parse(r)}return[]},c=t=>t?o.decode(t):"",u=t=>t?o.decode(t):"";function f(t){return t.replace(/^\[|\]$/g,"").split(",").map(r=>{const e=r.trim(),n=Number(e);return isNaN(n)?e:n})}exports.decodeHtmlEntitiesToHtml=u;exports.decodeHtmlEntitiesToText=c;exports.stringToArray=f;exports.toBoolean=i;exports.toNumber=s;exports.uriStringToArray=d;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./data.js"),r=require("./AppMedia.js"),t=require("./semanticUtils.js");exports.decodeHtmlEntitiesToHtml=e.decodeHtmlEntitiesToHtml;exports.decodeHtmlEntitiesToText=e.decodeHtmlEntitiesToText;exports.stringToArray=e.stringToArray;exports.toBoolean=e.toBoolean;exports.toNumber=e.toNumber;exports.uriStringToArray=e.uriStringToArray;exports.Media=r.Media;exports.MediaContextProvider=r.MediaContextProvider;exports.mediaStyle=r.mediaStyle;exports.getUnhandledProps=t.getUnhandledProps;exports.htmlImageProps=t.htmlImageProps;exports.htmlInputAttrs=t.htmlInputAttrs;exports.htmlInputEvents=t.htmlInputEvents;exports.htmlInputProps=t.htmlInputProps;exports.partitionHTMLProps=t.partitionHTMLProps;exports.useKeyOnly=t.useKeyOnly;exports.useValueAndKey=t.useValueAndKey;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("lodash"),l=["selected","defaultValue","defaultChecked","accept","autoCapitalize","autoComplete","autoCorrect","autoFocus","checked","disabled","enterKeyHint","form","id","inputMode","lang","list","max","maxLength","min","minLength","multiple","name","pattern","placeholder","readOnly","required","step","title","type","value"],c=["onKeyDown","onKeyPress","onKeyUp","onFocus","onBlur","onChange","onInput","onClick","onContextMenu","onDrag","onDragEnd","onDragEnter","onDragExit","onDragLeave","onDragOver","onDragStart","onDrop","onMouseDown","onMouseEnter","onMouseLeave","onMouseMove","onMouseOut","onMouseOver","onMouseUp","onSelect","onTouchCancel","onTouchEnd","onTouchMove","onTouchStart"],i=[...l,...c],g=(e,n={})=>{const{htmlProps:u=i,includeAria:o=!0}=n,t={},s={};return a.forEach(e,(d,r)=>{const h=o&&(/^aria-.*$/.test(r)||r==="role"),p=a.includes(u,r)||h?t:s;p[r]=d}),[t,s]},m=(e,n)=>e&&n,y=(e,n)=>e&&e!==!0&&`${e} ${n}`,M=(e,n)=>{const{handledProps:u=[]}=e;return Object.keys(n).reduce((o,t)=>(t==="childKey"||t==="innerRef"||u.indexOf(t)===-1&&(o[t]=n[t]),o),{})};exports.getUnhandledProps=M;exports.htmlInputAttrs=l;exports.htmlInputEvents=c;exports.htmlInputProps=i;exports.partitionHTMLProps=g;exports.useKeyOnly=m;exports.useValueAndKey=y;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("lodash"),l=["selected","defaultValue","defaultChecked","accept","autoCapitalize","autoComplete","autoCorrect","autoFocus","checked","disabled","enterKeyHint","form","id","inputMode","lang","list","max","maxLength","min","minLength","multiple","name","pattern","placeholder","readOnly","required","step","title","type","value"],c=["onKeyDown","onKeyPress","onKeyUp","onFocus","onBlur","onChange","onInput","onClick","onContextMenu","onDrag","onDragEnd","onDragEnter","onDragExit","onDragLeave","onDragOver","onDragStart","onDrop","onMouseDown","onMouseEnter","onMouseLeave","onMouseMove","onMouseOut","onMouseOver","onMouseUp","onSelect","onTouchCancel","onTouchEnd","onTouchMove","onTouchStart"],i=[...l,...c],m=["alt","height","src","srcSet","width","loading"],p=(e,t={})=>{const{htmlProps:s=i,includeAria:o=!0}=t,n={},u={};return a.forEach(e,(d,r)=>{const h=o&&(/^aria-.*$/.test(r)||r==="role"),g=a.includes(s,r)||h?n:u;g[r]=d}),[n,u]},y=(e,t)=>e&&t,M=(e,t)=>e&&e!==!0&&`${e} ${t}`,P=(e,t)=>{const{handledProps:s=[]}=e;return Object.keys(t).reduce((o,n)=>(n==="childKey"||n==="innerRef"||s.indexOf(n)===-1&&(o[n]=t[n]),o),{})};exports.getUnhandledProps=P;exports.htmlImageProps=m;exports.htmlInputAttrs=l;exports.htmlInputEvents=c;exports.htmlInputProps=i;exports.partitionHTMLProps=p;exports.useKeyOnly=y;exports.useValueAndKey=M;
@@ -100,7 +100,7 @@ const X = H.forwardRef((r, a) => /* @__PURE__ */ t("div", { ref: a, children: r.
100
100
  {
101
101
  className: "download",
102
102
  "data-tooltip": decodeURIComponent(A),
103
- trigger: u || d ? /* @__PURE__ */ t(Q, { name: "download", className: "download-icon" }) : null,
103
+ trigger: u && d ? /* @__PURE__ */ t(Q, { name: "download", className: "download-icon" }) : null,
104
104
  children: /* @__PURE__ */ c(g.Menu, { children: [
105
105
  q,
106
106
  d === !0 && /* @__PURE__ */ c(g.Item, { onClick: () => {
package/dist/esm/index.js CHANGED
@@ -1,77 +1,97 @@
1
- import { components as s, customizer as p, getComponentByNameIgnoreCase as m, reducers as n } from "./embeddable/index.js";
1
+ import { components as p, customizer as f, getComponentByNameIgnoreCase as m, reducers as n } from "./embeddable/index.js";
2
2
  import { Config as l } from "./conf/index.js";
3
3
  import { default as u } from "./layout/ResponsiveContainer.js";
4
4
  import { default as c } from "./layout/ScrollTop.js";
5
- import { default as S } from "./layout/containers/PreviewPageContainer.js";
6
- import { default as g } from "./layout/containers/PreviewTypeContainer.js";
5
+ import { default as C } from "./layout/containers/PreviewPageContainer.js";
6
+ import { default as P } from "./layout/containers/PreviewTypeContainer.js";
7
7
  import { default as h } from "./layout/containers/SlugContainer.js";
8
- import { default as R } from "./layout/containers/SlugPostContainer.js";
9
- import { CustomizerWrapper as F } from "./layout/Customizer.js";
10
- import { default as y } from "./layout/Layout.js";
11
- import { default as D } from "./layout/PreviewComponent.js";
8
+ import { default as y } from "./layout/containers/SlugPostContainer.js";
9
+ import { CustomizerWrapper as A } from "./layout/Customizer.js";
10
+ import { default as R } from "./layout/Layout.js";
11
+ import { default as F } from "./layout/PreviewComponent.js";
12
12
  import { default as L } from "./layout/Favicon.js";
13
- import { default as O } from "./layout/SSRFavicon.js";
14
- import { default as z } from "./layout/Loading.js";
15
- import { default as W } from "./layout/CustomSemanticSearch.js";
16
- import { default as B } from "./layout/Header.js";
17
- import { default as M } from "./layout/SearchControl.js";
18
- import { default as _ } from "./layout/LangSwitcher.js";
19
- import { default as q } from "./layout/Footer.js";
20
- import { default as J } from "./layout/ClassicHeader.js";
21
- import { default as Q } from "./layout/FlexWrapDetector.js";
13
+ import { default as N } from "./layout/SSRFavicon.js";
14
+ import { default as D } from "./layout/Loading.js";
15
+ import { default as b } from "./layout/CustomSemanticSearch.js";
16
+ import { default as z } from "./layout/Header.js";
17
+ import { default as K } from "./layout/SearchControl.js";
18
+ import { default as V } from "./layout/LangSwitcher.js";
19
+ import { default as _ } from "./layout/Footer.js";
20
+ import { default as q } from "./layout/ClassicHeader.js";
21
+ import { default as J } from "./layout/FlexWrapDetector.js";
22
22
  import { default as X } from "./layout/FloatingMenuHeader.js";
23
23
  import { withTracker as $ } from "./tracker/withGoogleAnalytics.js";
24
- import { store as er } from "./redux/store.js";
25
- import { useAppDispatch as tr, useAppSelector as ar } from "./redux/hooks.js";
26
- import { UPDATE as sr, initialState as pr, intlReducer as mr, updateIntl as nr } from "./lib/react-intl-redux/index.js";
27
- import { combineReducers as lr } from "./lib/redux-immutable/index.js";
28
- import * as r from "./translations/en.json.js";
29
- import * as e from "./translations/fr.json.js";
24
+ import { store as re } from "./redux/store.js";
25
+ import { useAppDispatch as te, useAppSelector as ae } from "./redux/hooks.js";
26
+ import { UPDATE as pe, initialState as fe, intlReducer as me, updateIntl as ne } from "./lib/react-intl-redux/index.js";
27
+ import { combineReducers as le } from "./lib/redux-immutable/index.js";
28
+ import * as e from "./translations/en.json.js";
29
+ import * as r from "./translations/fr.json.js";
30
30
  import * as o from "./translations/af.json.js";
31
31
  import * as t from "./translations/am.json.js";
32
- import { COUNTRY_OPTIONS as ur } from "./countries.js";
33
- import { default as cr } from "./lib/react-intl-redux/providers/Provider.js";
34
- import { default as Sr } from "./lib/react-intl-redux/providers/IntlProvider.js";
32
+ import { COUNTRY_OPTIONS as ue } from "./countries.js";
33
+ import { decodeHtmlEntitiesToHtml as ce, decodeHtmlEntitiesToText as Te, stringToArray as Ce, toBoolean as ge, toNumber as Pe, uriStringToArray as Se } from "./utils/data.js";
34
+ import { Media as ve, MediaContextProvider as ye, mediaStyle as Ie } from "./utils/AppMedia.js";
35
+ import { getUnhandledProps as He, htmlImageProps as Re, htmlInputAttrs as we, htmlInputEvents as Fe, htmlInputProps as Ee, partitionHTMLProps as Le, useKeyOnly as Me, useValueAndKey as Ne } from "./utils/semanticUtils.js";
36
+ import { default as De } from "./lib/react-intl-redux/providers/Provider.js";
37
+ import { default as be } from "./lib/react-intl-redux/providers/IntlProvider.js";
35
38
  export {
36
- ur as COUNTRY_OPTIONS,
37
- J as ClassicHeader,
39
+ ue as COUNTRY_OPTIONS,
40
+ q as ClassicHeader,
38
41
  l as Config,
39
- W as CustomSemanticSearch,
40
- F as CustomizerWrapper,
42
+ b as CustomSemanticSearch,
43
+ A as CustomizerWrapper,
41
44
  L as Favicon,
42
- Q as FlexWrapDetector,
45
+ J as FlexWrapDetector,
43
46
  X as FloatingMenuHeader,
44
- q as Footer,
45
- B as Header,
46
- Sr as IntlProvider,
47
- _ as LangSwitcher,
48
- z as Loading,
49
- D as PreviewComponent,
50
- S as PreviewPageContainer,
51
- g as PreviewTypeContainer,
52
- cr as Provider,
47
+ _ as Footer,
48
+ z as Header,
49
+ be as IntlProvider,
50
+ V as LangSwitcher,
51
+ D as Loading,
52
+ ve as Media,
53
+ ye as MediaContextProvider,
54
+ F as PreviewComponent,
55
+ C as PreviewPageContainer,
56
+ P as PreviewTypeContainer,
57
+ De as Provider,
53
58
  u as ResponsiveContainer,
54
- y as RootLayout,
55
- O as SSRFavicon,
59
+ R as RootLayout,
60
+ N as SSRFavicon,
56
61
  c as ScrollToTop,
57
- M as SearchControl,
62
+ K as SearchControl,
58
63
  h as SlugContainer,
59
- R as SlugPostContainer,
60
- sr as UPDATE,
64
+ y as SlugPostContainer,
65
+ pe as UPDATE,
61
66
  o as afrikaansTranslations,
62
67
  t as amharicTranslations,
63
- lr as combineReducers,
64
- s as components,
65
- p as customizer,
66
- r as englishTranslations,
67
- e as frenchTranslations,
68
+ le as combineReducers,
69
+ p as components,
70
+ f as customizer,
71
+ ce as decodeHtmlEntitiesToHtml,
72
+ Te as decodeHtmlEntitiesToText,
73
+ e as englishTranslations,
74
+ r as frenchTranslations,
68
75
  m as getComponentByNameIgnoreCase,
69
- pr as initialState,
70
- mr as intlReducer,
76
+ He as getUnhandledProps,
77
+ Re as htmlImageProps,
78
+ we as htmlInputAttrs,
79
+ Fe as htmlInputEvents,
80
+ Ee as htmlInputProps,
81
+ fe as initialState,
82
+ me as intlReducer,
83
+ Ie as mediaStyle,
84
+ Le as partitionHTMLProps,
71
85
  n as reducers,
72
- er as store,
73
- nr as updateIntl,
74
- tr as useAppDispatch,
75
- ar as useAppSelector,
86
+ re as store,
87
+ Ce as stringToArray,
88
+ ge as toBoolean,
89
+ Pe as toNumber,
90
+ ne as updateIntl,
91
+ Se as uriStringToArray,
92
+ te as useAppDispatch,
93
+ ae as useAppSelector,
94
+ Me as useKeyOnly,
95
+ Ne as useValueAndKey,
76
96
  $ as withTracker
77
97
  };
@@ -1,42 +1,42 @@
1
1
  import { jsx as e, jsxs as u } from "react/jsx-runtime";
2
- import { Menu as d, Container as N, Flag as P, Image as U } from "semantic-ui-react";
3
- import S, { useEffect as _, useState as p, useRef as y } from "react";
4
- import { utils as j, MenuProvider as H, MediaProvider as V, MediaConsumer as A, MenuConsumer as L } from "@devgateway/wp-react-lib";
2
+ import { Menu as d, Container as b, Flag as P, Image as U } from "semantic-ui-react";
3
+ import E, { useEffect as _, useState as p, useRef as y } from "react";
4
+ import { utils as j, MenuProvider as H, MediaProvider as A, MediaConsumer as V, MenuConsumer as k } from "@devgateway/wp-react-lib";
5
5
  import { injectIntl as R } from "react-intl";
6
6
  import { useParams as $ } from "react-router";
7
7
  import B from "./SearchControl.js";
8
8
  import K from "./LangSwitcher.js";
9
9
  const W = (r, s) => {
10
- const a = [];
10
+ const t = [];
11
11
  return r.items.forEach((i) => {
12
- i.child_items ? i.child_items.forEach((t) => {
13
- t.slug == s.slug && (a.push(i), a.push(t));
14
- }) : i.slug == s.slug && i.url != "/" && a.push(i);
15
- }), a;
16
- }, z = (r, s) => {
12
+ i.child_items ? i.child_items.forEach((a) => {
13
+ a.slug == s.slug && (t.push(i), t.push(a));
14
+ }) : i.slug == s.slug && i.url != "/" && t.push(i);
15
+ }), t;
16
+ }, x = (r, s) => {
17
17
  if (r) {
18
- const a = r.indexOf("/wp");
19
- if (a !== -1) {
20
- const i = r.substr(a + 3);
18
+ const t = r.indexOf("/wp");
19
+ if (t !== -1) {
20
+ const i = r.substr(t + 3);
21
21
  return i.startsWith("/" + s) ? i : "/" + s + i;
22
22
  } else
23
23
  return r.startsWith("/" + s) ? r : "/" + s + r;
24
24
  }
25
25
  return "";
26
26
  }, q = R(({ menu: r, intl: s }) => {
27
- const a = $(), i = W(r, a);
28
- return /* @__PURE__ */ e(S.Fragment, { children: i.filter((t) => t.url != "#wpm-languages").map(
29
- (t) => t.child_items ? /* @__PURE__ */ u("span", { children: [
30
- t.post_title,
27
+ const t = $(), i = W(r, t);
28
+ return /* @__PURE__ */ e(E.Fragment, { children: i.filter((a) => a.url != "#wpm-languages").map(
29
+ (a) => a.child_items ? /* @__PURE__ */ u("span", { children: [
30
+ a.post_title,
31
31
  " "
32
32
  ] }) : /* @__PURE__ */ u(
33
33
  "a",
34
34
  {
35
- className: t.slug == a.slug ? "active" : "",
36
- href: j.replaceLink(t.url, s.locale),
35
+ className: a.slug == t.slug ? "active" : "",
36
+ href: j.replaceLink(a.url, s.locale),
37
37
  children: [
38
38
  " ",
39
- t.post_title
39
+ a.post_title
40
40
  ]
41
41
  }
42
42
  )
@@ -45,22 +45,20 @@ const W = (r, s) => {
45
45
  ({
46
46
  settings: r,
47
47
  withIcons: s,
48
- active: a,
48
+ active: t,
49
49
  menu: i,
50
- onSetSelected: t,
50
+ onSetSelected: a,
51
51
  selected: o,
52
52
  intl: { locale: g },
53
- isSmallScreen: x
53
+ isSmallScreen: D
54
54
  }) => {
55
- const D = $();
55
+ const L = $();
56
56
  _(
57
57
  (n) => {
58
- if (!o) {
59
- const l = W(i, D).filter((f) => f.menu_item_parent == 0);
60
- l && t(l[0]);
61
- }
58
+ const l = W(i, L).filter((f) => f.menu_item_parent == 0);
59
+ l && l.length > 0 ? a(l[0]) : a(null);
62
60
  },
63
- [i, t, o]
61
+ [i, a, L.slug]
64
62
  );
65
63
  const [v, I] = p(null);
66
64
  _(() => {
@@ -74,8 +72,8 @@ const W = (r, s) => {
74
72
  Object.keys(r.menu_settings).map((l) => {
75
73
  const f = r.menu_settings[l];
76
74
  if (f.type == "nav_menu_item") {
77
- const k = /(-)?[0-9]+/g.exec(l), E = parseInt(k[0]);
78
- h.find((c) => c.ID == E) || h.push(f.value);
75
+ const S = /(-)?[0-9]+/g.exec(l), z = parseInt(S[0]);
76
+ h.find((c) => c.ID == z) || h.push(f.value);
79
77
  }
80
78
  }), I({
81
79
  ...i,
@@ -89,40 +87,47 @@ const W = (r, s) => {
89
87
  M(window.innerWidth <= 1200);
90
88
  };
91
89
  return n(), window.addEventListener("resize", n), () => window.removeEventListener("resize", n);
92
- }, []), v && /* @__PURE__ */ e(S.Fragment, { children: v.items.filter((n) => n.url !== "#wpm-languages").map((n, h) => /* @__PURE__ */ u(S.Fragment, { children: [
90
+ }, []), v && /* @__PURE__ */ e(E.Fragment, { children: v.items.filter((n) => n.url !== "#wpm-languages").map((n, h) => /* @__PURE__ */ u(E.Fragment, { children: [
93
91
  /* @__PURE__ */ u(
94
92
  d.Item,
95
93
  {
96
94
  className: `divided ${n.child_items ? "has-child-items" : ""}
97
95
  ${o && o.ID === n.ID ? "selected" : ""}
98
- ${a === n.slug ? "active" : ""}`,
96
+ ${t === n.slug ? "active" : ""}`,
99
97
  children: [
100
- s && /* @__PURE__ */ e("a", { href: z(n.url, g), children: /* @__PURE__ */ e("div", { className: "mark", children: /* @__PURE__ */ e("span", { className: "sr-only", children: n.title }) }) }),
101
- x ? n.child_items ? /* @__PURE__ */ e(
98
+ s && /* @__PURE__ */ e("a", { href: x(n.url, g), children: /* @__PURE__ */ e("div", { className: "mark", children: /* @__PURE__ */ e("span", { className: "sr-only", children: n.title }) }) }),
99
+ D ? n.child_items ? /* @__PURE__ */ e(
100
+ "span",
101
+ {
102
+ onClick: () => a(o === n ? null : n),
103
+ children: n.title
104
+ }
105
+ ) : /* @__PURE__ */ e("a", { href: x(n.url, g), children: n.title }) : n.child_items ? /* @__PURE__ */ e(
102
106
  "span",
103
107
  {
104
- onClick: () => t(o === n ? null : n),
108
+ onMouseOver: (l) => a(n),
109
+ onClick: () => a(o === n ? null : n),
105
110
  children: n.title
106
111
  }
107
- ) : /* @__PURE__ */ e("a", { href: z(n.url, g), children: n.title }) : n.child_items ? /* @__PURE__ */ e("span", { onMouseOver: (l) => t(n), children: n.title }) : /* @__PURE__ */ e(
112
+ ) : /* @__PURE__ */ e(
108
113
  "a",
109
114
  {
110
- onMouseOut: (l) => t(null),
111
- onMouseOver: (l) => t(n),
112
- href: z(n.url, g),
115
+ onMouseOut: (l) => a(null),
116
+ onMouseOver: (l) => a(n),
117
+ href: x(n.url, g),
113
118
  children: n.title
114
119
  }
115
120
  )
116
121
  ]
117
122
  }
118
123
  ),
119
- w && o && o.ID === n.ID && o.child_items && /* @__PURE__ */ e(S.Fragment, { children: o.child_items.map((l) => /* @__PURE__ */ u(
124
+ w && o && o.ID === n.ID && o.child_items && /* @__PURE__ */ e(E.Fragment, { children: o.child_items.map((l) => /* @__PURE__ */ u(
120
125
  d.Item,
121
126
  {
122
- className: `divided child-item ${a === l.slug ? "active" : ""}`,
127
+ className: `divided child-item ${t === l.slug ? "active" : ""}`,
123
128
  children: [
124
129
  /* @__PURE__ */ e("div", { className: "mark" }),
125
- /* @__PURE__ */ e("a", { href: z(l.url, g), children: l.title })
130
+ /* @__PURE__ */ e("a", { href: x(l.url, g), children: l.title })
126
131
  ]
127
132
  },
128
133
  l.ID
@@ -130,27 +135,27 @@ const W = (r, s) => {
130
135
  ] }, n.ID)) });
131
136
  }
132
137
  ), G = ({ intl: r, settings: s }) => {
133
- const [a, i] = p(), [t, o] = p(!1), [g, x] = p(!1), [D, v] = p(!1), [I, w] = p(!1), { slug: M } = $(), n = y(null), h = y(null), l = () => {
134
- w(!I), o(!t);
138
+ const [t, i] = p(), [a, o] = p(!1), [g, D] = p(!1), [L, v] = p(!1), [I, w] = p(!1), { slug: M } = $(), n = y(null), h = y(null), l = () => {
139
+ w(!I), o(!a);
135
140
  };
136
141
  _(() => {
137
142
  const c = (m) => {
138
143
  (n.current && !n.current.contains(m.target) && !h.current.contains(m.target) || m.target.closest(".desktop") || m.target.closest(".breadcrumbs")) && (o(!1), w(!1));
139
- }, b = (m) => {
144
+ }, N = (m) => {
140
145
  m.key === "Escape" && (o(!1), w(!1));
141
146
  };
142
- return document.addEventListener("mousedown", c), document.addEventListener("keydown", b), () => {
143
- document.removeEventListener("mousedown", c), document.removeEventListener("keydown", b);
147
+ return document.addEventListener("mousedown", c), document.addEventListener("keydown", N), () => {
148
+ document.removeEventListener("mousedown", c), document.removeEventListener("keydown", N);
144
149
  };
145
150
  }, []), _(() => {
146
151
  let c;
147
- const b = () => {
152
+ const N = () => {
148
153
  const F = window.innerWidth <= 1200;
149
- x(F), v(!1);
154
+ D(F), v(!1);
150
155
  }, m = () => {
151
- v(!0), clearTimeout(c), c = setTimeout(b, 300);
156
+ v(!0), clearTimeout(c), c = setTimeout(N, 300);
152
157
  };
153
- return b(), window.addEventListener("resize", m), () => {
158
+ return N(), window.addEventListener("resize", m), () => {
154
159
  clearTimeout(c), window.removeEventListener("resize", m);
155
160
  };
156
161
  }, []);
@@ -161,12 +166,12 @@ const W = (r, s) => {
161
166
  };
162
167
  return c(), window.addEventListener("resize", c), () => window.removeEventListener("resize", c);
163
168
  }, []);
164
- const k = ({ media: c }) => c ? /* @__PURE__ */ e(U, { src: c.guid.rendered }) : /* @__PURE__ */ e("img", { className: "brand logo", size: "large", src: "/logo_full.png" }), E = (s == null ? void 0 : s.landing_page_url) && s.landing_page_url !== !1 && s.landing_page_url !== void 0 && s.landing_page_url !== "", O = E ? s.landing_page_url : `/${r.locale}`;
165
- return console.log("isMenuVisible", t), /* @__PURE__ */ e(S.Fragment, { children: /* @__PURE__ */ u(H, { slug: "main", locale: r.locale, children: [
166
- /* @__PURE__ */ u(N, { fluid: !0, className: "header", children: [
167
- /* @__PURE__ */ e(N, { fluid: !0, className: "background", ref: n, children: /* @__PURE__ */ u(d, { className: "branding", text: !0, children: [
168
- /* @__PURE__ */ e(d.Item, { children: /* @__PURE__ */ u("a", { href: `${O}`, target: E ? "_blank" : "_self", rel: "noopener noreferrer", id: "site_url", children: [
169
- s.site_logo !== 0 && !f && /* @__PURE__ */ e(V, { id: s.site_logo, children: /* @__PURE__ */ e(A, { children: /* @__PURE__ */ e(k, {}, "logo") }) }),
169
+ const S = ({ media: c }) => c ? /* @__PURE__ */ e(U, { src: c.guid.rendered }) : /* @__PURE__ */ e("img", { className: "brand logo", size: "large", src: "/logo_full.png" }), z = (s == null ? void 0 : s.landing_page_url) && s.landing_page_url !== !1 && s.landing_page_url !== void 0 && s.landing_page_url !== "", O = z ? s.landing_page_url : `/${r.locale}`;
170
+ return /* @__PURE__ */ e(E.Fragment, { children: /* @__PURE__ */ u(H, { slug: "main", locale: r.locale, children: [
171
+ /* @__PURE__ */ u(b, { fluid: !0, className: "header", children: [
172
+ /* @__PURE__ */ e(b, { fluid: !0, className: "background", ref: n, children: /* @__PURE__ */ u(d, { className: "branding", text: !0, children: [
173
+ /* @__PURE__ */ e(d.Item, { children: /* @__PURE__ */ u("a", { href: `${O}`, target: z ? "_blank" : "_self", rel: "noopener noreferrer", id: "site_url", children: [
174
+ s.site_logo !== 0 && !f && /* @__PURE__ */ e(A, { id: s.site_logo, children: /* @__PURE__ */ e(V, { children: /* @__PURE__ */ e(S, {}, "logo") }) }),
170
175
  s.site_logo === 0 && !f && /* @__PURE__ */ e(
171
176
  "img",
172
177
  {
@@ -189,27 +194,27 @@ const W = (r, s) => {
189
194
  /* @__PURE__ */ e(P, { name: "za" }),
190
195
  /* @__PURE__ */ e("div", { className: "site name", children: s.name })
191
196
  ] }),
192
- !D && (g ? /* @__PURE__ */ e(d, { className: `pages ${t ? "show" : ""}`, children: /* @__PURE__ */ e(N, { fluid: !0, children: /* @__PURE__ */ e(L, { children: /* @__PURE__ */ e(
197
+ !L && (g ? /* @__PURE__ */ e(d, { className: `pages ${a ? "show" : ""}`, children: /* @__PURE__ */ e(b, { fluid: !0, children: /* @__PURE__ */ e(k, { children: /* @__PURE__ */ e(
193
198
  C,
194
199
  {
195
200
  settings: s,
196
201
  active: M,
197
- selected: a,
202
+ selected: t,
198
203
  onSetSelected: i,
199
204
  isSmallScreen: g
200
205
  },
201
206
  "items"
202
- ) }) }) }) : /* @__PURE__ */ e(d.Menu, { className: "pages", children: /* @__PURE__ */ e(L, { children: /* @__PURE__ */ e(
207
+ ) }) }) }) : /* @__PURE__ */ e(d.Menu, { className: "pages", children: /* @__PURE__ */ e(k, { children: /* @__PURE__ */ e(
203
208
  C,
204
209
  {
205
210
  settings: s,
206
211
  active: M,
207
- selected: a,
212
+ selected: t,
208
213
  onSetSelected: i
209
214
  },
210
215
  "items"
211
216
  ) }) })),
212
- /* @__PURE__ */ e(d.Item, { children: /* @__PURE__ */ e(L, { children: /* @__PURE__ */ e(
217
+ /* @__PURE__ */ e(d.Item, { children: /* @__PURE__ */ e(k, { children: /* @__PURE__ */ e(
213
218
  K,
214
219
  {
215
220
  locale: r.locale
@@ -227,7 +232,7 @@ const W = (r, s) => {
227
232
  "div",
228
233
  {
229
234
  ref: h,
230
- className: `hamburger-menu ${I ? "animate" : ""} ${t ? "open" : "close"}`,
235
+ className: `hamburger-menu ${I ? "animate" : ""} ${a ? "open" : "close"}`,
231
236
  onClick: l,
232
237
  children: [
233
238
  /* @__PURE__ */ e("div", {}),
@@ -237,18 +242,18 @@ const W = (r, s) => {
237
242
  }
238
243
  )
239
244
  ] }) }),
240
- /* @__PURE__ */ e(N, { fluid: !0, className: "child", children: a && a.child_items && /* @__PURE__ */ e(d, { fluid: !0, text: !0, children: /* @__PURE__ */ e(
245
+ /* @__PURE__ */ e(b, { fluid: !0, className: "child", children: t && t.child_items && /* @__PURE__ */ e(d, { fluid: !0, text: !0, children: /* @__PURE__ */ e(
241
246
  C,
242
247
  {
243
248
  active: M,
244
249
  locale: r.locale,
245
250
  withIcons: !0,
246
251
  onSetSelected: (c) => null,
247
- menu: { items: a.child_items }
252
+ menu: { items: t.child_items }
248
253
  }
249
254
  ) }) })
250
255
  ] }, "header-container"),
251
- /* @__PURE__ */ e(N, { className: "url breadcrumbs", children: /* @__PURE__ */ e(L, { children: /* @__PURE__ */ e(q, {}) }) })
256
+ /* @__PURE__ */ e(b, { className: "url breadcrumbs", children: /* @__PURE__ */ e(k, { children: /* @__PURE__ */ e(q, {}) }) })
252
257
  ] }) });
253
258
  }, se = R(G);
254
259
  export {
@@ -7,10 +7,9 @@ const e = t({
7
7
  largeScreen: 1200,
8
8
  widescreen: 1920
9
9
  }
10
- });
11
- e.createMediaStyle();
12
- const { Media: a, MediaContextProvider: i } = e;
10
+ }), a = e.createMediaStyle(), { Media: i, MediaContextProvider: o } = e;
13
11
  export {
14
- a as Media,
15
- i as MediaContextProvider
12
+ i as Media,
13
+ o as MediaContextProvider,
14
+ a as mediaStyle
16
15
  };
@@ -1,6 +1,24 @@
1
- import "dompurify";
2
- const n = (r) => typeof r == "boolean" ? r : typeof r == "string" ? r === "true" : !1, o = (r) => typeof r == "number" ? r : typeof r == "string" && parseInt(r) || 0;
1
+ import { decode as o } from "html-entities";
2
+ const s = (r) => typeof r == "boolean" ? r : typeof r == "string" ? r === "true" : !1, f = (r) => typeof r == "number" ? r : typeof r == "string" && parseInt(r) || 0, c = (r) => {
3
+ if (Array.isArray(r)) return r;
4
+ if (typeof r == "string") {
5
+ const t = decodeURIComponent(r);
6
+ if (t && t !== "undefined")
7
+ return JSON.parse(t);
8
+ }
9
+ return [];
10
+ }, d = (r) => r ? o(r) : "", u = (r) => r ? o(r) : "";
11
+ function p(r) {
12
+ return r.replace(/^\[|\]$/g, "").split(",").map((t) => {
13
+ const n = t.trim(), e = Number(n);
14
+ return isNaN(e) ? n : e;
15
+ });
16
+ }
3
17
  export {
4
- n as toBoolean,
5
- o as toNumber
18
+ u as decodeHtmlEntitiesToHtml,
19
+ d as decodeHtmlEntitiesToText,
20
+ p as stringToArray,
21
+ s as toBoolean,
22
+ f as toNumber,
23
+ c as uriStringToArray
6
24
  };
@@ -0,0 +1,22 @@
1
+ import { decodeHtmlEntitiesToHtml as o, decodeHtmlEntitiesToText as r, stringToArray as n, toBoolean as i, toNumber as m, uriStringToArray as l } from "./data.js";
2
+ import { Media as p, MediaContextProvider as s, mediaStyle as a } from "./AppMedia.js";
3
+ import { getUnhandledProps as y, htmlImageProps as T, htmlInputAttrs as h, htmlInputEvents as x, htmlInputProps as P, partitionHTMLProps as g, useKeyOnly as A, useValueAndKey as H } from "./semanticUtils.js";
4
+ export {
5
+ p as Media,
6
+ s as MediaContextProvider,
7
+ o as decodeHtmlEntitiesToHtml,
8
+ r as decodeHtmlEntitiesToText,
9
+ y as getUnhandledProps,
10
+ T as htmlImageProps,
11
+ h as htmlInputAttrs,
12
+ x as htmlInputEvents,
13
+ P as htmlInputProps,
14
+ a as mediaStyle,
15
+ g as partitionHTMLProps,
16
+ n as stringToArray,
17
+ i as toBoolean,
18
+ m as toNumber,
19
+ l as uriStringToArray,
20
+ A as useKeyOnly,
21
+ H as useValueAndKey
22
+ };
@@ -69,22 +69,23 @@ const d = [
69
69
  "onTouchEnd",
70
70
  "onTouchMove",
71
71
  "onTouchStart"
72
- ], m = [...d, ...h], M = (e, n = {}) => {
73
- const { htmlProps: u = m, includeAria: o = !0 } = n, t = {}, s = {};
72
+ ], g = [...d, ...h], p = ["alt", "height", "src", "srcSet", "width", "loading"], M = (e, n = {}) => {
73
+ const { htmlProps: s = g, includeAria: o = !0 } = n, t = {}, u = {};
74
74
  return a.forEach(e, (c, r) => {
75
- const l = o && (/^aria-.*$/.test(r) || r === "role"), i = a.includes(u, r) || l ? t : s;
75
+ const l = o && (/^aria-.*$/.test(r) || r === "role"), i = a.includes(s, r) || l ? t : u;
76
76
  i[r] = c;
77
- }), [t, s];
78
- }, p = (e, n) => e && n, y = (e, n) => e && e !== !0 && `${e} ${n}`, D = (e, n) => {
79
- const { handledProps: u = [] } = e;
80
- return Object.keys(n).reduce((o, t) => (t === "childKey" || t === "innerRef" || u.indexOf(t) === -1 && (o[t] = n[t]), o), {});
77
+ }), [t, u];
78
+ }, y = (e, n) => e && n, D = (e, n) => e && e !== !0 && `${e} ${n}`, f = (e, n) => {
79
+ const { handledProps: s = [] } = e;
80
+ return Object.keys(n).reduce((o, t) => (t === "childKey" || t === "innerRef" || s.indexOf(t) === -1 && (o[t] = n[t]), o), {});
81
81
  };
82
82
  export {
83
- D as getUnhandledProps,
83
+ f as getUnhandledProps,
84
+ p as htmlImageProps,
84
85
  d as htmlInputAttrs,
85
86
  h as htmlInputEvents,
86
- m as htmlInputProps,
87
+ g as htmlInputProps,
87
88
  M as partitionHTMLProps,
88
- p as useKeyOnly,
89
- y as useValueAndKey
89
+ y as useKeyOnly,
90
+ D as useValueAndKey
90
91
  };
@@ -6,3 +6,4 @@ export * from './redux';
6
6
  export * from './lib';
7
7
  export * from './translations';
8
8
  export * from './countries';
9
+ export * from './utils';
@@ -3,5 +3,4 @@ export declare const toNumber: (value: any) => number;
3
3
  export declare const uriStringToArray: (value: string | string[]) => any[];
4
4
  export declare const decodeHtmlEntitiesToText: (html: string) => string;
5
5
  export declare const decodeHtmlEntitiesToHtml: (html: string) => string;
6
- export declare const toTitleCase: (str: string) => string;
7
6
  export declare function stringToArray(str: string): (string | number)[];
@@ -0,0 +1,4 @@
1
+ export * from './data';
2
+ export * from './AppMedia';
3
+ export * from './deviceType';
4
+ export * from './semanticUtils';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devgateway/dvz-ui-react",
3
- "version": "1.6.6",
3
+ "version": "1.6.8",
4
4
  "main": "dist/cjs/index.js",
5
5
  "module": "dist/esm/index.js",
6
6
  "types": "dist/types/index.d.ts",
@@ -57,6 +57,7 @@
57
57
  "file-saver": "^2.0.5",
58
58
  "geostats": "^2.1.0",
59
59
  "history": "^5.3.0",
60
+ "html-entities": "^2.6.0",
60
61
  "html-react-parser": "^5.2.6",
61
62
  "immutable": "^5.1.3",
62
63
  "lodash": "^4.17.21",
@@ -157,6 +158,11 @@
157
158
  "types": "./dist/types/layout/index.d.ts",
158
159
  "require": "./dist/cjs/layout/index.js",
159
160
  "import": "./dist/esm/layout/index.js"
161
+ },
162
+ "./utils": {
163
+ "types": "./dist/types/utils/index.d.ts",
164
+ "require": "./dist/cjs/utils/index.js",
165
+ "import": "./dist/esm/utils/index.js"
160
166
  }
161
167
  },
162
168
  "scripts": {