@devgateway/dvz-ui-react 1.9.14 → 1.9.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),u=require("react"),l=require("semantic-ui-react"),h=require("@devgateway/wp-react-lib"),S=require("react-intl"),A=require("react-redux"),y=require("../connected-templates/PostIntro.js"),L=require("../../lib/hooks/window-dimensions.js"),q=({posts:t,activeItem:r,setActive:i,showLabels:n})=>t?t.map(s=>e.jsx(l.Menu.Item,{onClick:()=>i(s.slug),className:s.slug===r?"active":"",children:n?e.jsx(h.PostLabel,{post:s}):e.jsx(l.Label,{children:e.jsx("span",{dangerouslySetInnerHTML:{__html:s.title.rendered}})})},s.id)):null,$=({posts:t,activeItem:r,setActive:i,showIcons:n,showLabels:s})=>{const o=t.length;return t?t.map(a=>{var m,g;return(m=a._embedded)!=null&&m["wp:featuredmedia"]&&a._embedded["wp:featuredmedia"][0].source_url,e.jsx(l.Grid.Column,{className:(a.slug===r?"active":"")+(n?" has-icon":""),children:e.jsxs(l.Button,{onClick:()=>i(a.slug),className:`nav ${o===1?"one":""}`,children:[n&&e.jsx(h.MediaProvider,{id:(g=a.meta_fields)!=null&&g.icon?a.meta_fields.icon[0]:null,children:e.jsx(h.MediaConsumer,{children:e.jsx(h.PostIcon,{className:"icon"})})}),s?e.jsx(h.PostLabel,{post:a}):e.jsx(l.Label,{children:e.jsx("span",{dangerouslySetInnerHTML:{__html:a.title.rendered}})})]})},a.id)}):null},C=({posts:t,activeItem:r})=>(u.useEffect(()=>{const i=document.querySelector(".ui.container.content-tab");i&&(i.scrollTop=0)},[r]),t?t.map(i=>{let n={};return i.slug!==r?n={position:"absolute",left:"-3000px",width:"auto",height:"0px",overflow:"hidden",visibility:"hidden"}:n={visibility:"visible",position:"relative",width:"auto"},e.jsx(y.default,{as:l.Container,fluid:!0,post:i,style:n},i.slug)}):null),k=({posts:t,activeItem:r,setActive:i})=>{const[n,s]=u.useState(t.findIndex(d=>d.slug===r)),[o,a]=u.useState(null),m=u.useRef(null);u.useEffect(()=>{if(o){const d=o.getBoundingClientRect().top+window.scrollY;window.scrollTo({top:d,behavior:"smooth"})}},[o]);const g=(d,x)=>{const{index:c}=x,j=n===c?-1:c;s(j),i(t[c].slug),j!==-1&&a(d.currentTarget)};return e.jsx(l.Accordion,{fluid:!0,styled:!0,children:t.map((d,x)=>{var j;const c=(j=d.meta_fields)!=null&&j.icon?d.meta_fields.icon[0]:null;return e.jsxs(u.Fragment,{children:[e.jsx(l.Accordion.Title,{active:n===x,index:x,onClick:g,children:e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[c&&e.jsx(h.MediaProvider,{id:c,children:e.jsx(h.MediaConsumer,{children:e.jsx(h.PostIcon,{className:"icon"})})}),e.jsx("span",{dangerouslySetInnerHTML:{__html:d.title.rendered},style:{marginLeft:c?"10px":"0"}})]}),e.jsx(l.Icon,{name:"chevron down"})]})}),e.jsx(l.Accordion.Content,{className:"accordion-post-content",active:n===x,children:e.jsx("div",{ref:m,children:e.jsx(y.default,{post:d,as:l.Container,fluid:!0})})})]},d.id)})})},R=({posts:t,showLabels:r,height:i})=>{const[n,s]=u.useState(t?t[0].slug:null);return u.useEffect(()=>{setTimeout(()=>{if(window.location.hash){const o=window.location.hash.substr(1),a=document.getElementById(o);a&&t.map(m=>m.slug).indexOf(o)>-1&&(s(o),a.scrollIntoView({behavior:"auto",block:"start"}))}},0)},[t]),e.jsxs(u.Fragment,{children:[t.map(o=>e.jsx("anchor",{id:o.slug},o.slug)),e.jsx(l.Menu,{className:"tabbed posts",text:!0,children:e.jsx(q,{showLabels:r,posts:t,setActive:s,activeItem:n})}),e.jsx(l.Container,{className:"content-tab",style:{height:`${i}px`},children:e.jsx(C,{posts:t,activeItem:n})})]})},D=({posts:t,showLabels:r,showIcons:i,height:n})=>{const[s,o]=u.useState(t?t[0].slug:null);return e.jsx(u.Fragment,{children:e.jsxs(l.Grid,{stackable:!0,className:"tabbed posts",columns:t.length,style:{height:n+"px"},children:[e.jsx($,{showIcons:i,showLabels:r,posts:t,activeItem:s,setActive:o}),e.jsx(l.Grid.Row,{style:{height:`${n}px`},children:e.jsx(l.Grid.Column,{width:16,className:"content",children:e.jsx(l.Container,{className:"content-tab",style:{height:`${n}px`},children:e.jsx(C,{className:"content-tab",posts:t,activeItem:s})})})})]})})},G=t=>{var w;let{"data-type":r,"data-taxonomy":i,"data-categories":n,"data-items":s,"data-theme":o="light","data-show-icons":a,"data-use-scrolls":m,"data-show-labels":g,"data-height":d,"data-preview-mode":x="Desktop",pageModuleProps:c,parent:j,editing:b,unique:I}=t;c!=null&&c.previewMode&&(c!=null&&c.editing)&&(x=c.previewMode,b=c.editing);const p=t.intl.locale,M=Array.isArray(n)?n.join(",").toString():n,f=m==="true",v=f?d:void 0,{width:_}=L.useWindowDimensionsAndDevice(),N=_<=1024,P=x!=="Desktop"&&b,T=N&&!b;return b&&!r?e.jsx(l.Container,{className:`viz tabbed posts ${b?"editing":""} ${f?"scrollable":""}`,fluid:!0}):e.jsx(l.Container,{className:`viz tabbed posts ${b?"editing":""} ${f?"scrollable":""}`,fluid:!0,children:e.jsx(h.PostProvider,{locale:p,type:r,taxonomy:i,categories:M,store:`tabbedposts_${j}_${I}`,page:1,perPage:s,children:e.jsx(h.PostConsumer,{children:e.jsx(h.PostConsumer,{children:T||P?e.jsx(k,{posts:s,activeItem:(w=s[0])==null?void 0:w.slug,setActive:()=>{}}):o==="light"?e.jsx(R,{height:v,showLabels:g==="true"}):e.jsx(D,{height:v,showLabels:g==="true",showIcons:a==="true"})})})})})},E=(t,r)=>{const i=t.getIn(["data","pageModuleProps"]),n={};return i&&(n.pageModuleProps=i),n},H={},z=A.connect(E,H)(S.injectIntl(G));exports.default=z;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),u=require("react"),r=require("semantic-ui-react"),h=require("@devgateway/wp-react-lib"),A=require("react-intl"),L=require("react-redux"),p=require("../connected-templates/PostIntro.js"),q=require("../../lib/hooks/window-dimensions.js"),$=({posts:t,activeItem:l,setActive:i,showLabels:n})=>t?t.map(s=>e.jsx(r.Menu.Item,{onClick:()=>i(s.slug),className:s.slug===l?"active":"",children:n?e.jsx(h.PostLabel,{post:s}):e.jsx(r.Label,{children:e.jsx("span",{dangerouslySetInnerHTML:{__html:s.title.rendered}})})},s.id)):null,k=({posts:t,activeItem:l,setActive:i,showIcons:n,showLabels:s})=>{const o=t.length;return t?t.map(a=>{var m,g;return(m=a._embedded)!=null&&m["wp:featuredmedia"]&&a._embedded["wp:featuredmedia"][0].source_url,e.jsx(r.Grid.Column,{className:(a.slug===l?"active":"")+(n?" has-icon":""),children:e.jsxs(r.Button,{onClick:()=>i(a.slug),className:`nav ${o===1?"one":""}`,children:[n&&e.jsx(h.MediaProvider,{id:(g=a.meta_fields)!=null&&g.icon?a.meta_fields.icon[0]:null,children:e.jsx(h.MediaConsumer,{children:e.jsx(h.PostIcon,{className:"icon"})})}),s?e.jsx(h.PostLabel,{post:a}):e.jsx(r.Label,{children:e.jsx("span",{dangerouslySetInnerHTML:{__html:a.title.rendered}})})]})},a.id)}):null},I=({posts:t,activeItem:l})=>(u.useEffect(()=>{const i=document.querySelector(".ui.container.content-tab");i&&(i.scrollTop=0)},[l]),t?t.map(i=>{let n={};return i.slug!==l?n={position:"absolute",left:"-3000px",width:"auto",height:"0px",overflow:"hidden",visibility:"hidden"}:n={visibility:"visible",position:"relative",width:"auto"},e.jsx(p.default,{as:r.Container,fluid:!0,post:i,style:n},i.slug)}):null),R=({posts:t,activeItem:l,setActive:i})=>{const[n,s]=u.useState(t.findIndex(d=>d.slug===l)),[o,a]=u.useState(null),m=u.useRef(null);u.useEffect(()=>{if(o){const d=o.getBoundingClientRect().top+window.scrollY;window.scrollTo({top:d,behavior:"smooth"})}},[o]);const g=(d,x)=>{const{index:c}=x,j=n===c?-1:c;s(j),i(t[c].slug),j!==-1&&a(d.currentTarget)};return e.jsx(r.Accordion,{fluid:!0,styled:!0,children:t.map((d,x)=>{var j;const c=(j=d.meta_fields)!=null&&j.icon?d.meta_fields.icon[0]:null;return e.jsxs(u.Fragment,{children:[e.jsx(r.Accordion.Title,{active:n===x,index:x,onClick:g,children:e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[c&&e.jsx(h.MediaProvider,{id:c,children:e.jsx(h.MediaConsumer,{children:e.jsx(h.PostIcon,{className:"icon"})})}),e.jsx("span",{dangerouslySetInnerHTML:{__html:d.title.rendered},style:{marginLeft:c?"10px":"0"}})]}),e.jsx(r.Icon,{name:"chevron down"})]})}),e.jsx(r.Accordion.Content,{className:"accordion-post-content",active:n===x,children:e.jsx("div",{ref:m,children:e.jsx(p.default,{post:d,as:r.Container,fluid:!0})})})]},d.id)})})},D=({posts:t,showLabels:l,height:i})=>{const[n,s]=u.useState(t?t[0].slug:null);return u.useEffect(()=>{setTimeout(()=>{if(window.location.hash){const o=window.location.hash.substr(1),a=document.getElementById(o);a&&t.map(m=>m.slug).indexOf(o)>-1&&(s(o),a.scrollIntoView({behavior:"auto",block:"start"}))}},0)},[t]),e.jsxs(u.Fragment,{children:[t.map(o=>e.jsx("anchor",{id:o.slug},o.slug)),e.jsx(r.Menu,{className:"tabbed posts",text:!0,children:e.jsx($,{showLabels:l,posts:t,setActive:s,activeItem:n})}),e.jsx(r.Container,{className:"content-tab",style:{height:`${i}px`},children:e.jsx(I,{posts:t,activeItem:n})})]})},G=({posts:t,showLabels:l,showIcons:i,height:n})=>{const[s,o]=u.useState(t?t[0].slug:null);return e.jsx(u.Fragment,{children:e.jsxs(r.Grid,{stackable:!0,className:"tabbed posts",columns:t.length,style:{height:n+"px"},children:[e.jsx(k,{showIcons:i,showLabels:l,posts:t,activeItem:s,setActive:o}),e.jsx(r.Grid.Row,{style:{height:`${n}px`},children:e.jsx(r.Grid.Column,{width:16,className:"content",children:e.jsx(r.Container,{className:"content-tab",style:{height:`${n}px`},children:e.jsx(I,{className:"content-tab",posts:t,activeItem:s})})})})]})})},E=t=>{var C;let{"data-type":l,"data-taxonomy":i,"data-categories":n,"data-items":s,"data-theme":o="light","data-show-icons":a,"data-use-scrolls":m,"data-show-labels":g,"data-height":d,"data-preview-mode":x="Desktop",pageModuleProps:c,parent:j,editing:b,unique:M}=t;c!=null&&c.previewMode&&(c!=null&&c.editing)&&(x=c.previewMode,b=c.editing);const _=t.intl.locale;let f=n;if(Array.isArray(n))f=n.join(",");else if(typeof n=="string")try{const w=JSON.parse(n);Array.isArray(w)&&(f=w.join(","))}catch{}const v=m==="true",y=v?d:void 0,{width:N}=q.useWindowDimensionsAndDevice(),P=N<=1024,T=x!=="Desktop"&&b,S=P&&!b;return b&&!l?e.jsx(r.Container,{className:`viz tabbed posts ${b?"editing":""} ${v?"scrollable":""}`,fluid:!0}):e.jsx(r.Container,{className:`viz tabbed posts ${b?"editing":""} ${v?"scrollable":""}`,fluid:!0,children:e.jsx(h.PostProvider,{locale:_,type:l,taxonomy:i,categories:f,store:`tabbedposts_${j}_${M}`,page:1,perPage:s,children:e.jsx(h.PostConsumer,{children:e.jsx(h.PostConsumer,{children:S||T?e.jsx(R,{posts:s,activeItem:(C=s[0])==null?void 0:C.slug,setActive:()=>{}}):o==="light"?e.jsx(D,{height:y,showLabels:g==="true"}):e.jsx(G,{height:y,showLabels:g==="true",showIcons:a==="true"})})})})})},H=(t,l)=>{const i=t.getIn(["data","pageModuleProps"]),n={};return i&&(n.pageModuleProps=i),n},z={},B=L.connect(H,z)(A.injectIntl(E));exports.default=B;
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("react/jsx-runtime"),s=require("react"),u=require("react-router"),m=require("semantic-ui-react"),w=require("@devgateway/wp-react-lib"),f=require("../embeddable/index.js"),P=()=>{const d=u.useParams(),[p]=u.useSearchParams(),[o]=s.useState(()=>f.getComponentByNameIgnoreCase(d.name??"")),[n,l]=s.useState(()=>Object.fromEntries(p.entries())),i=s.useRef(n);i.current=n;const a=s.useCallback(g=>{const e=g.data;if(e.messageType&&e.messageType==="component-attributes"){const c={...i.current};Object.keys(e).forEach(r=>{c["data-"+r.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()]=typeof e[r]=="object"?Array.isArray(e[r])?e[r].join(","):JSON.stringify(e[r]):e[r]}),l(c)}},[]);return s.useEffect(()=>(window.addEventListener("message",a,!1),window.parent&&window.parent.postMessage({type:"componentReady",value:!0},"*"),window.top&&window.top.postMessage({type:"componentReady",value:!0},"*"),()=>{window.removeEventListener("message",a)}),[a]),t.jsx("div",{children:t.jsx(m.Container,{fluid:!0,className:"editing",children:o?t.jsx(o,{...n,editing:!0}):t.jsx(m.Segment.Group,{color:"red",textAlign:"center",children:t.jsx("h1",{children:"Wrong Component Name"})})})})},j=()=>t.jsx(w.SettingsConsumer,{children:t.jsx(P,{})});exports.default=j;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),r=require("react"),u=require("react-router"),m=require("semantic-ui-react"),w=require("@devgateway/wp-react-lib"),f=require("../embeddable/index.js"),P=()=>{const d=u.useParams(),[p]=u.useSearchParams(),[o]=r.useState(()=>f.getComponentByNameIgnoreCase(d.name??"")),[n,l]=r.useState(()=>Object.fromEntries(p.entries())),i=r.useRef(n);i.current=n;const a=r.useCallback(g=>{const t=g.data;if(t.messageType&&t.messageType==="component-attributes"){const c={...i.current};Object.keys(t).forEach(s=>{c["data-"+s.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()]=typeof t[s]=="object"?JSON.stringify(t[s]):t[s]}),l(c)}},[]);return r.useEffect(()=>(window.addEventListener("message",a,!1),window.parent&&window.parent.postMessage({type:"componentReady",value:!0},"*"),window.top&&window.top.postMessage({type:"componentReady",value:!0},"*"),()=>{window.removeEventListener("message",a)}),[a]),e.jsx("div",{children:e.jsx(m.Container,{fluid:!0,className:"editing",children:o?e.jsx(o,{...n,editing:!0}):e.jsx(m.Segment.Group,{color:"red",textAlign:"center",children:e.jsx("h1",{children:"Wrong Component Name"})})})})},j=()=>e.jsx(w.SettingsConsumer,{children:e.jsx(P,{})});exports.default=j;
@@ -1,47 +1,47 @@
1
1
  import { jsx as e, jsxs as f } from "react/jsx-runtime";
2
- import I, { useState as w, useRef as G, useEffect as x } from "react";
3
- import { Container as b, Accordion as y, Icon as V, Menu as T, Grid as v, Label as M, Button as W } from "semantic-ui-react";
4
- import { PostProvider as q, PostConsumer as _, MediaProvider as P, MediaConsumer as A, PostIcon as S, PostLabel as $ } from "@devgateway/wp-react-lib";
5
- import { injectIntl as E } from "react-intl";
6
- import { connect as O } from "react-redux";
7
- import k from "../connected-templates/PostIntro.js";
2
+ import C, { useState as w, useRef as V, useEffect as N } from "react";
3
+ import { Container as b, Accordion as x, Icon as W, Menu as A, Grid as v, Label as P, Button as q } from "semantic-ui-react";
4
+ import { PostProvider as E, PostConsumer as M, MediaProvider as S, MediaConsumer as $, PostIcon as k, PostLabel as L } from "@devgateway/wp-react-lib";
5
+ import { injectIntl as O } from "react-intl";
6
+ import { connect as J } from "react-redux";
7
+ import j from "../connected-templates/PostIntro.js";
8
8
  import { useWindowDimensionsAndDevice as U } from "../../lib/hooks/window-dimensions.js";
9
- const Y = ({ posts: t, activeItem: o, setActive: i, showLabels: n }) => t ? t.map((l) => /* @__PURE__ */ e(
10
- T.Item,
9
+ const Y = ({ posts: t, activeItem: r, setActive: i, showLabels: n }) => t ? t.map((l) => /* @__PURE__ */ e(
10
+ A.Item,
11
11
  {
12
12
  onClick: () => i(l.slug),
13
- className: l.slug === o ? "active" : "",
14
- children: n ? /* @__PURE__ */ e($, { post: l }) : /* @__PURE__ */ e(M, { children: /* @__PURE__ */ e("span", { dangerouslySetInnerHTML: { __html: l.title.rendered } }) })
13
+ className: l.slug === r ? "active" : "",
14
+ children: n ? /* @__PURE__ */ e(L, { post: l }) : /* @__PURE__ */ e(P, { children: /* @__PURE__ */ e("span", { dangerouslySetInnerHTML: { __html: l.title.rendered } }) })
15
15
  },
16
16
  l.id
17
- )) : null, J = ({
17
+ )) : null, K = ({
18
18
  posts: t,
19
- activeItem: o,
19
+ activeItem: r,
20
20
  setActive: i,
21
21
  showIcons: n,
22
22
  showLabels: l
23
23
  }) => {
24
- const r = t.length;
24
+ const o = t.length;
25
25
  return t ? t.map((a) => {
26
26
  var d, m;
27
27
  return (d = a._embedded) != null && d["wp:featuredmedia"] && a._embedded["wp:featuredmedia"][0].source_url, /* @__PURE__ */ e(
28
28
  v.Column,
29
29
  {
30
- className: (a.slug === o ? "active" : "") + (n ? " has-icon" : ""),
30
+ className: (a.slug === r ? "active" : "") + (n ? " has-icon" : ""),
31
31
  children: /* @__PURE__ */ f(
32
- W,
32
+ q,
33
33
  {
34
34
  onClick: () => i(a.slug),
35
- className: `nav ${r === 1 ? "one" : ""}`,
35
+ className: `nav ${o === 1 ? "one" : ""}`,
36
36
  children: [
37
37
  n && /* @__PURE__ */ e(
38
- P,
38
+ S,
39
39
  {
40
40
  id: (m = a.meta_fields) != null && m.icon ? a.meta_fields.icon[0] : null,
41
- children: /* @__PURE__ */ e(A, { children: /* @__PURE__ */ e(S, { className: "icon" }) })
41
+ children: /* @__PURE__ */ e($, { children: /* @__PURE__ */ e(k, { className: "icon" }) })
42
42
  }
43
43
  ),
44
- l ? /* @__PURE__ */ e($, { post: a }) : /* @__PURE__ */ e(M, { children: /* @__PURE__ */ e(
44
+ l ? /* @__PURE__ */ e(L, { post: a }) : /* @__PURE__ */ e(P, { children: /* @__PURE__ */ e(
45
45
  "span",
46
46
  {
47
47
  dangerouslySetInnerHTML: { __html: a.title.rendered }
@@ -54,12 +54,12 @@ const Y = ({ posts: t, activeItem: o, setActive: i, showLabels: n }) => t ? t.ma
54
54
  a.id
55
55
  );
56
56
  }) : null;
57
- }, L = ({ posts: t, activeItem: o }) => (x(() => {
57
+ }, D = ({ posts: t, activeItem: r }) => (N(() => {
58
58
  const i = document.querySelector(".ui.container.content-tab");
59
59
  i && (i.scrollTop = 0);
60
- }, [o]), t ? t.map((i) => {
60
+ }, [r]), t ? t.map((i) => {
61
61
  let n = {};
62
- return i.slug !== o ? n = {
62
+ return i.slug !== r ? n = {
63
63
  position: "absolute",
64
64
  left: "-3000px",
65
65
  width: "auto",
@@ -70,30 +70,30 @@ const Y = ({ posts: t, activeItem: o, setActive: i, showLabels: n }) => t ? t.ma
70
70
  visibility: "visible",
71
71
  position: "relative",
72
72
  width: "auto"
73
- }, /* @__PURE__ */ e(k, { as: b, fluid: !0, post: i, style: n }, i.slug);
74
- }) : null), K = ({ posts: t, activeItem: o, setActive: i }) => {
73
+ }, /* @__PURE__ */ e(j, { as: b, fluid: !0, post: i, style: n }, i.slug);
74
+ }) : null), Q = ({ posts: t, activeItem: r, setActive: i }) => {
75
75
  const [n, l] = w(
76
- t.findIndex((s) => s.slug === o)
77
- ), [r, a] = w(null), d = G(null);
78
- x(() => {
79
- if (r) {
80
- const s = r.getBoundingClientRect().top + window.scrollY;
76
+ t.findIndex((s) => s.slug === r)
77
+ ), [o, a] = w(null), d = V(null);
78
+ N(() => {
79
+ if (o) {
80
+ const s = o.getBoundingClientRect().top + window.scrollY;
81
81
  window.scrollTo({
82
82
  top: s,
83
83
  behavior: "smooth"
84
84
  });
85
85
  }
86
- }, [r]);
86
+ }, [o]);
87
87
  const m = (s, u) => {
88
88
  const { index: c } = u, h = n === c ? -1 : c;
89
89
  l(h), i(t[c].slug), h !== -1 && a(s.currentTarget);
90
90
  };
91
- return /* @__PURE__ */ e(y, { fluid: !0, styled: !0, children: t.map((s, u) => {
91
+ return /* @__PURE__ */ e(x, { fluid: !0, styled: !0, children: t.map((s, u) => {
92
92
  var h;
93
93
  const c = (h = s.meta_fields) != null && h.icon ? s.meta_fields.icon[0] : null;
94
- return /* @__PURE__ */ f(I.Fragment, { children: [
94
+ return /* @__PURE__ */ f(C.Fragment, { children: [
95
95
  /* @__PURE__ */ e(
96
- y.Title,
96
+ x.Title,
97
97
  {
98
98
  active: n === u,
99
99
  index: u,
@@ -109,7 +109,7 @@ const Y = ({ posts: t, activeItem: o, setActive: i, showLabels: n }) => t ? t.ma
109
109
  },
110
110
  children: [
111
111
  /* @__PURE__ */ f("div", { style: { display: "flex", alignItems: "center" }, children: [
112
- c && /* @__PURE__ */ e(P, { id: c, children: /* @__PURE__ */ e(A, { children: /* @__PURE__ */ e(S, { className: "icon" }) }) }),
112
+ c && /* @__PURE__ */ e(S, { id: c, children: /* @__PURE__ */ e($, { children: /* @__PURE__ */ e(k, { className: "icon" }) }) }),
113
113
  /* @__PURE__ */ e(
114
114
  "span",
115
115
  {
@@ -118,50 +118,50 @@ const Y = ({ posts: t, activeItem: o, setActive: i, showLabels: n }) => t ? t.ma
118
118
  }
119
119
  )
120
120
  ] }),
121
- /* @__PURE__ */ e(V, { name: "chevron down" })
121
+ /* @__PURE__ */ e(W, { name: "chevron down" })
122
122
  ]
123
123
  }
124
124
  )
125
125
  }
126
126
  ),
127
127
  /* @__PURE__ */ e(
128
- y.Content,
128
+ x.Content,
129
129
  {
130
130
  className: "accordion-post-content",
131
131
  active: n === u,
132
- children: /* @__PURE__ */ e("div", { ref: d, children: /* @__PURE__ */ e(k, { post: s, as: b, fluid: !0 }) })
132
+ children: /* @__PURE__ */ e("div", { ref: d, children: /* @__PURE__ */ e(j, { post: s, as: b, fluid: !0 }) })
133
133
  }
134
134
  )
135
135
  ] }, s.id);
136
136
  }) });
137
- }, Q = ({ posts: t, showLabels: o, height: i }) => {
137
+ }, X = ({ posts: t, showLabels: r, height: i }) => {
138
138
  const [n, l] = w(t ? t[0].slug : null);
139
- return x(() => {
139
+ return N(() => {
140
140
  setTimeout(() => {
141
141
  if (window.location.hash) {
142
- const r = window.location.hash.substr(1), a = document.getElementById(r);
143
- a && t.map((d) => d.slug).indexOf(r) > -1 && (l(r), a.scrollIntoView({ behavior: "auto", block: "start" }));
142
+ const o = window.location.hash.substr(1), a = document.getElementById(o);
143
+ a && t.map((d) => d.slug).indexOf(o) > -1 && (l(o), a.scrollIntoView({ behavior: "auto", block: "start" }));
144
144
  }
145
145
  }, 0);
146
- }, [t]), /* @__PURE__ */ f(I.Fragment, { children: [
147
- t.map((r) => /* @__PURE__ */ e("anchor", { id: r.slug }, r.slug)),
148
- /* @__PURE__ */ e(T, { className: "tabbed posts", text: !0, children: /* @__PURE__ */ e(Y, { showLabels: o, posts: t, setActive: l, activeItem: n }) }),
149
- /* @__PURE__ */ e(b, { className: "content-tab", style: { height: `${i}px` }, children: /* @__PURE__ */ e(L, { posts: t, activeItem: n }) })
146
+ }, [t]), /* @__PURE__ */ f(C.Fragment, { children: [
147
+ t.map((o) => /* @__PURE__ */ e("anchor", { id: o.slug }, o.slug)),
148
+ /* @__PURE__ */ e(A, { className: "tabbed posts", text: !0, children: /* @__PURE__ */ e(Y, { showLabels: r, posts: t, setActive: l, activeItem: n }) }),
149
+ /* @__PURE__ */ e(b, { className: "content-tab", style: { height: `${i}px` }, children: /* @__PURE__ */ e(D, { posts: t, activeItem: n }) })
150
150
  ] });
151
- }, X = ({ posts: t, showLabels: o, showIcons: i, height: n }) => {
152
- const [l, r] = w(t ? t[0].slug : null);
153
- return /* @__PURE__ */ e(I.Fragment, { children: /* @__PURE__ */ f(v, { stackable: !0, className: "tabbed posts", columns: t.length, style: { height: n + "px" }, children: [
154
- /* @__PURE__ */ e(J, { showIcons: i, showLabels: o, posts: t, activeItem: l, setActive: r }),
155
- /* @__PURE__ */ e(v.Row, { style: { height: `${n}px` }, children: /* @__PURE__ */ e(v.Column, { width: 16, className: "content", children: /* @__PURE__ */ e(b, { className: "content-tab", style: { height: `${n}px` }, children: /* @__PURE__ */ e(L, { className: "content-tab", posts: t, activeItem: l }) }) }) })
151
+ }, Z = ({ posts: t, showLabels: r, showIcons: i, height: n }) => {
152
+ const [l, o] = w(t ? t[0].slug : null);
153
+ return /* @__PURE__ */ e(C.Fragment, { children: /* @__PURE__ */ f(v, { stackable: !0, className: "tabbed posts", columns: t.length, style: { height: n + "px" }, children: [
154
+ /* @__PURE__ */ e(K, { showIcons: i, showLabels: r, posts: t, activeItem: l, setActive: o }),
155
+ /* @__PURE__ */ e(v.Row, { style: { height: `${n}px` }, children: /* @__PURE__ */ e(v.Column, { width: 16, className: "content", children: /* @__PURE__ */ e(b, { className: "content-tab", style: { height: `${n}px` }, children: /* @__PURE__ */ e(D, { className: "content-tab", posts: t, activeItem: l }) }) }) })
156
156
  ] }) });
157
- }, Z = (t) => {
158
- var N;
157
+ }, ee = (t) => {
158
+ var T;
159
159
  let {
160
- "data-type": o,
160
+ "data-type": r,
161
161
  "data-taxonomy": i,
162
162
  "data-categories": n,
163
163
  "data-items": l,
164
- "data-theme": r = "light",
164
+ "data-theme": o = "light",
165
165
  "data-show-icons": a,
166
166
  "data-use-scrolls": d,
167
167
  "data-show-labels": m,
@@ -170,38 +170,48 @@ const Y = ({ posts: t, activeItem: o, setActive: i, showLabels: n }) => t ? t.ma
170
170
  pageModuleProps: c,
171
171
  parent: h,
172
172
  editing: g,
173
- unique: j
173
+ unique: R
174
174
  } = t;
175
175
  c != null && c.previewMode && (c != null && c.editing) && (u = c.previewMode, g = c.editing);
176
- const D = t.intl.locale, R = Array.isArray(n) ? n.join(",").toString() : n, p = d === "true", C = p ? s : void 0, { width: H } = U(), z = H <= 1024, B = u !== "Desktop" && g, F = z && !g;
177
- return g && !o ? /* @__PURE__ */ e(b, { className: `viz tabbed posts ${g ? "editing" : ""} ${p ? "scrollable" : ""}`, fluid: !0 }) : /* @__PURE__ */ e(b, { className: `viz tabbed posts ${g ? "editing" : ""} ${p ? "scrollable" : ""}`, fluid: !0, children: /* @__PURE__ */ e(
178
- q,
176
+ const H = t.intl.locale;
177
+ let p = n;
178
+ if (Array.isArray(n))
179
+ p = n.join(",");
180
+ else if (typeof n == "string")
181
+ try {
182
+ const I = JSON.parse(n);
183
+ Array.isArray(I) && (p = I.join(","));
184
+ } catch {
185
+ }
186
+ const y = d === "true", _ = y ? s : void 0, { width: z } = U(), B = z <= 1024, F = u !== "Desktop" && g, G = B && !g;
187
+ return g && !r ? /* @__PURE__ */ e(b, { className: `viz tabbed posts ${g ? "editing" : ""} ${y ? "scrollable" : ""}`, fluid: !0 }) : /* @__PURE__ */ e(b, { className: `viz tabbed posts ${g ? "editing" : ""} ${y ? "scrollable" : ""}`, fluid: !0, children: /* @__PURE__ */ e(
188
+ E,
179
189
  {
180
- locale: D,
181
- type: o,
190
+ locale: H,
191
+ type: r,
182
192
  taxonomy: i,
183
- categories: R,
184
- store: `tabbedposts_${h}_${j}`,
193
+ categories: p,
194
+ store: `tabbedposts_${h}_${R}`,
185
195
  page: 1,
186
196
  perPage: l,
187
- children: /* @__PURE__ */ e(_, { children: /* @__PURE__ */ e(_, { children: F || B ? /* @__PURE__ */ e(K, { posts: l, activeItem: (N = l[0]) == null ? void 0 : N.slug, setActive: () => {
188
- } }) : r === "light" ? /* @__PURE__ */ e(Q, { height: C, showLabels: m === "true" }) : /* @__PURE__ */ e(
189
- X,
197
+ children: /* @__PURE__ */ e(M, { children: /* @__PURE__ */ e(M, { children: G || F ? /* @__PURE__ */ e(Q, { posts: l, activeItem: (T = l[0]) == null ? void 0 : T.slug, setActive: () => {
198
+ } }) : o === "light" ? /* @__PURE__ */ e(X, { height: _, showLabels: m === "true" }) : /* @__PURE__ */ e(
199
+ Z,
190
200
  {
191
- height: C,
201
+ height: _,
192
202
  showLabels: m === "true",
193
203
  showIcons: a === "true"
194
204
  }
195
205
  ) }) })
196
206
  }
197
207
  ) });
198
- }, ee = (t, o) => {
208
+ }, te = (t, r) => {
199
209
  const i = t.getIn([
200
210
  "data",
201
211
  "pageModuleProps"
202
212
  ]), n = {};
203
213
  return i && (n.pageModuleProps = i), n;
204
- }, te = {}, de = O(ee, te)(E(Z));
214
+ }, ne = {}, ue = J(te, ne)(O(ee));
205
215
  export {
206
- de as default
216
+ ue as default
207
217
  };
@@ -1,4 +1,4 @@
1
- import { jsx as r } from "react/jsx-runtime";
1
+ import { jsx as e } from "react/jsx-runtime";
2
2
  import { useState as i, useRef as f, useCallback as g, useEffect as l } from "react";
3
3
  import { useParams as w, useSearchParams as P } from "react-router";
4
4
  import { Container as y, Segment as C } from "semantic-ui-react";
@@ -10,18 +10,18 @@ const b = () => {
10
10
  ), s = f(o);
11
11
  s.current = o;
12
12
  const n = g((u) => {
13
- const e = u.data;
14
- if (e.messageType && e.messageType === "component-attributes") {
13
+ const t = u.data;
14
+ if (t.messageType && t.messageType === "component-attributes") {
15
15
  const m = { ...s.current };
16
- Object.keys(e).forEach((t) => {
17
- m["data-" + t.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase()] = typeof e[t] == "object" ? Array.isArray(e[t]) ? e[t].join(",") : JSON.stringify(e[t]) : e[t];
16
+ Object.keys(t).forEach((r) => {
17
+ m["data-" + r.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase()] = typeof t[r] == "object" ? JSON.stringify(t[r]) : t[r];
18
18
  }), d(m);
19
19
  }
20
20
  }, []);
21
21
  return l(() => (window.addEventListener("message", n, !1), window.parent && window.parent.postMessage({ type: "componentReady", value: !0 }, "*"), window.top && window.top.postMessage({ type: "componentReady", value: !0 }, "*"), () => {
22
22
  window.removeEventListener("message", n);
23
- }), [n]), /* @__PURE__ */ r("div", { children: /* @__PURE__ */ r(y, { fluid: !0, className: "editing", children: a ? /* @__PURE__ */ r(a, { ...o, editing: !0 }) : /* @__PURE__ */ r(C.Group, { color: "red", textAlign: "center", children: /* @__PURE__ */ r("h1", { children: "Wrong Component Name" }) }) }) });
24
- }, x = () => /* @__PURE__ */ r(h, { children: /* @__PURE__ */ r(b, {}) });
23
+ }), [n]), /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(y, { fluid: !0, className: "editing", children: a ? /* @__PURE__ */ e(a, { ...o, editing: !0 }) : /* @__PURE__ */ e(C.Group, { color: "red", textAlign: "center", children: /* @__PURE__ */ e("h1", { children: "Wrong Component Name" }) }) }) });
24
+ }, L = () => /* @__PURE__ */ e(h, { children: /* @__PURE__ */ e(b, {}) });
25
25
  export {
26
- x as default
26
+ L as default
27
27
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devgateway/dvz-ui-react",
3
- "version": "1.9.14",
3
+ "version": "1.9.15",
4
4
  "main": "dist/cjs/index.js",
5
5
  "module": "dist/esm/index.js",
6
6
  "types": "dist/types/index.d.ts",