@devgateway/dvz-ui-react 1.6.7 → 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.
@@ -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,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 {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devgateway/dvz-ui-react",
3
- "version": "1.6.7",
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",