@devgateway/dvz-ui-react 1.8.2 → 1.8.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("react/jsx-runtime"),g=require("react"),o=require("semantic-ui-react"),k=require("@devgateway/wp-react-lib"),j=require("./dom-to-image.js"),R=require("file-saver"),H=require("react-redux"),Q=g.forwardRef((s,a)=>t.jsx("div",{ref:a,children:s.children})),V=s=>{const a=g.useRef();let{childContent:w,"data-height":Y,"data-button-label":v,"data-png-label":L,"data-jpg-label":q,"data-jpg-text":S,"data-png-text":U,"data-check-png":G="true","data-check-jpg":C="true","data-title":T,"data-default-format":P="PNG","data-use-title":b="false","data-style":E="heavy","data-section-title":I="","data-download-tooltip":J="","data-include-source-url":D="false","data-include-filters":y="false","data-source-urlmargin-left":F=70,"data-source-urlmargin-top":B=10,"data-source-urlfont-size":O=18,parent:Z,editing:i,component:ee,unique:te,pageModuleProps:l}=s;const[x,h]=g.useState(P),[$,c]=g.useState(!1),d=G=="true"||G===!0,u=C=="true"||C===!0;g.useEffect(()=>{h(P)},[P]);function M(n){const r=n.attributes,N=[];if(r)for(let e=0;e<r.length;e++)N.push(r[e].nodeName);const f=N.filter(e=>e.startsWith("data-"));if(f.length>0&&f.forEach(e=>{n.setAttribute(e,"")}),n.classList){if(n.classList.contains("ignore"))return!1;if(!(y===!0||y==="true")){const m=["filter-component","data-filters-reset","data-filters-apply","filter-search"];for(const z of m)if(n.classList.contains(z))return!1}return!0}return!0}const A={filter:M,bgcolor:"#FFF",imagePlaceholder:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8Xw8AAoMBgQb9Z3kAAAAASUVORK5CYII=",cacheBust:!0},W=n=>{j.domtoimage.cloneNode(a.current).then(function(r){if([...r.getElementsByTagName("input")].forEach(e=>e.remove()),[...r.querySelectorAll(".question.circle.icon")].forEach(e=>e.remove()),D==="true"){const e=document.createElement("div");e.style.marginLeft=F+"px",e.style.marginTop=B+"px",e.style.fontSize=O+"px",e.style.fontFamily="Roboto, sans-serif",e.style.fontWeight="400",e.style.color="#66676d",e.style.opacity="0.75",e.innerHTML=window.location.href,e.style.maxWidth="90%",e.style.wordWrap="break-word",e.style.overflowWrap="break-word",r.appendChild(e)}const f=50;A.height=a.current.scrollHeight+f,A.width=a.current.scrollWidth+f*2,r.style.padding=`${f}px`,n==="PNG"&&j.domtoimage.toPng(r,A).then(function(e){if(!e)throw new Error("PNG render returned empty result");return fetch(e).then(m=>m.blob())}).then(function(e){R.saveAs(e,L)}).catch(function(e){console.error("PNG download failed:",e)}),n==="JPG"&&j.domtoimage.toJpeg(r,A).then(function(e){if(!e)throw new Error("JPEG render returned empty result");return fetch(e).then(m=>m.blob())}).then(function(e){R.saveAs(e,q)}).catch(function(e){console.error("JPG download failed:",e)})})},p=n=>{i?alert("Not allowed when editing please preview page"):W(n)};return t.jsx(o.Container,{className:`viz download ${E} ${b?"has-title":""}
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("react/jsx-runtime"),w=require("react"),o=require("semantic-ui-react"),q=require("@devgateway/wp-react-lib"),j=require("./dom-to-image.js"),I=require("file-saver"),H=require("react-redux"),Q=w.forwardRef((s,a)=>t.jsx("div",{ref:a,children:s.children})),V=s=>{const a=w.useRef();let{childContent:b,"data-height":Y,"data-button-label":L,"data-png-label":S,"data-jpg-label":U,"data-jpg-text":E,"data-png-text":J,"data-check-png":C="true","data-check-jpg":G="true","data-title":T,"data-default-format":P="PNG","data-use-title":N="false","data-style":D="heavy","data-section-title":F="","data-download-tooltip":B="","data-include-source-url":y="false","data-include-filters":k="false","data-source-urlmargin-left":O=70,"data-source-urlmargin-top":R=10,"data-source-urlfont-size":v=18,parent:Z,editing:i,component:ee,unique:te,pageModuleProps:l}=s;const[A,h]=w.useState(P),[$,c]=w.useState(!1),d=C=="true"||C===!0,u=G=="true"||G===!0;w.useEffect(()=>{h(P)},[P]);function M(n){const r=n.attributes,g=[];if(r)for(let e=0;e<r.length;e++)g.push(r[e].nodeName);const f=g.filter(e=>e.startsWith("data-"));if(f.length>0&&f.forEach(e=>{n.setAttribute(e,"")}),n.classList){if(n.classList.contains("ignore"))return!1;if(!(k===!0||k==="true")){const x=["filter-component","data-filters-reset","data-filters-apply","filter-search"];for(const z of x)if(n.classList.contains(z))return!1}return!0}return!0}const p={filter:M,bgcolor:"#FFF",imagePlaceholder:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8Xw8AAoMBgQb9Z3kAAAAASUVORK5CYII=",cacheBust:!0},W=n=>{j.domtoimage.cloneNode(a.current).then(function(r){[...r.getElementsByTagName("input")].forEach(e=>e.remove()),[...r.querySelectorAll(".question.circle.icon")].forEach(e=>e.remove());const g=y==="true"||y===!0;if(g){const e=document.createElement("div");e.style.marginLeft=O+"px",e.style.marginTop=R+"px",e.style.fontSize=v+"px",e.style.fontFamily="Roboto, sans-serif",e.style.fontWeight="400",e.style.color="#66676d",e.style.opacity="0.75",e.textContent=window.location.href,e.style.maxWidth="90%",e.style.wordWrap="break-word",e.style.overflowWrap="break-word",r.appendChild(e)}const f=50;p.height=a.current.scrollHeight+f*2,g&&(p.height+=(Number.parseInt(R,10)||0)+(Number.parseInt(v,10)||0)*2),p.width=a.current.scrollWidth+f*2,r.style.padding=`${f}px`,n==="PNG"&&j.domtoimage.toPng(r,p).then(function(e){if(!e)throw new Error("PNG render returned empty result");return fetch(e).then(x=>x.blob())}).then(function(e){I.saveAs(e,S)}).catch(function(e){console.error("PNG download failed:",e)}),n==="JPG"&&j.domtoimage.toJpeg(r,p).then(function(e){if(!e)throw new Error("JPEG render returned empty result");return fetch(e).then(x=>x.blob())}).then(function(e){I.saveAs(e,U)}).catch(function(e){console.error("JPG download failed:",e)})})},m=n=>{i?alert("Not allowed when editing please preview page"):W(n)};return t.jsx(o.Container,{className:`viz download ${D} ${N?"has-title":""}
2
2
  ${d||u?"has-formats":""}
3
3
  ${i||l!=null&&l.editing?"editing":""}
4
4
  ${d&&u?"multi-format":""}
5
- ${d&&!u||!d&&u?"single-format":""}`,fluid:!0,children:t.jsxs(Q,{ref:a,children:[t.jsxs(o.Grid,{stackable:!0,reversed:"mobile",className:"download-header",children:[!i&&b==="true"&&t.jsx(o.Grid.Column,{width:12,children:t.jsx(k.PostContent,{parentUnique:s.unique,post:{content:{rendered:decodeURIComponent(I)}}})}),t.jsx(o.Grid.Column,{className:i?"editing ignore":"ignore",width:i||b!=="true"?16:4,textAlign:"right",children:t.jsxs("div",{className:"wrapper",children:[t.jsxs(o.Button,{className:"download",onClick:()=>p(x),children:[v," ",x==="PNG"?"PNG":"JPG"]}),t.jsx(o.Dropdown,{className:"download","data-tooltip":decodeURIComponent(J),open:$,onOpen:()=>c(!0),onClose:()=>c(!1),trigger:u&&d?t.jsx(o.Icon,{name:"download",className:"download-icon"}):null,children:t.jsxs(o.Dropdown.Menu,{children:[T,d===!0&&t.jsx(o.Dropdown.Item,{onClick:()=>{h("PNG"),p("PNG"),c(!1)},children:t.jsxs("div",{className:"ui radio checkbox",children:[t.jsx("input",{type:"radio",className:"hidden",readOnly:!0,tabIndex:0,checked:x==="PNG"}),t.jsx("label",{onClick:n=>{n.stopPropagation(),h("PNG"),p("PNG"),c(!1)},children:U})]})}),u===!0&&t.jsx(o.Dropdown.Item,{onClick:()=>{h("JPG"),p("JPG"),c(!1)},children:t.jsxs("div",{className:"ui radio checkbox",children:[t.jsx("input",{type:"radio",className:"hidden",readOnly:!0,tabIndex:0,checked:x==="JPG"}),t.jsx("label",{onClick:n=>{n.stopPropagation(),h("JPG"),p("JPG"),c(!1)},children:S})]})})]})})]})})]}),!i&&t.jsx(o.Container,{fluid:!0,className:`download area ${i||l!=null&&l.editing?"editing":""}`,children:t.jsx(k.PostContent,{parentUnique:s.unique,post:{content:{rendered:w}}})})]})})},_=s=>{const a=s.getIn(["data","pageModuleProps"]),w={};return a&&(w.pageModuleProps=a),w},K={},X=H.connect(_,K)(V);exports.default=X;
5
+ ${d&&!u||!d&&u?"single-format":""}`,fluid:!0,children:t.jsxs(Q,{ref:a,children:[t.jsxs(o.Grid,{stackable:!0,reversed:"mobile",className:"download-header",children:[!i&&N==="true"&&t.jsx(o.Grid.Column,{width:12,children:t.jsx(q.PostContent,{parentUnique:s.unique,post:{content:{rendered:decodeURIComponent(F)}}})}),t.jsx(o.Grid.Column,{className:i?"editing ignore":"ignore",width:i||N!=="true"?16:4,textAlign:"right",children:t.jsxs("div",{className:"wrapper",children:[t.jsxs(o.Button,{className:"download",onClick:()=>m(A),children:[L," ",A==="PNG"?"PNG":"JPG"]}),t.jsx(o.Dropdown,{className:"download","data-tooltip":decodeURIComponent(B),open:$,onOpen:()=>c(!0),onClose:()=>c(!1),trigger:u&&d?t.jsx(o.Icon,{name:"download",className:"download-icon"}):null,children:t.jsxs(o.Dropdown.Menu,{children:[T,d===!0&&t.jsx(o.Dropdown.Item,{onClick:()=>{h("PNG"),m("PNG"),c(!1)},children:t.jsxs("div",{className:"ui radio checkbox",children:[t.jsx("input",{type:"radio",className:"hidden",readOnly:!0,tabIndex:0,checked:A==="PNG"}),t.jsx("label",{onClick:n=>{n.stopPropagation(),h("PNG"),m("PNG"),c(!1)},children:J})]})}),u===!0&&t.jsx(o.Dropdown.Item,{onClick:()=>{h("JPG"),m("JPG"),c(!1)},children:t.jsxs("div",{className:"ui radio checkbox",children:[t.jsx("input",{type:"radio",className:"hidden",readOnly:!0,tabIndex:0,checked:A==="JPG"}),t.jsx("label",{onClick:n=>{n.stopPropagation(),h("JPG"),m("JPG"),c(!1)},children:E})]})})]})})]})})]}),!i&&t.jsx(o.Container,{fluid:!0,className:`download area ${i||l!=null&&l.editing?"editing":""}`,children:t.jsx(q.PostContent,{parentUnique:s.unique,post:{content:{rendered:b}}})})]})})},_=s=>{const a=s.getIn(["data","pageModuleProps"]),b={};return a&&(b.pageModuleProps=a),b},K={},X=H.connect(_,K)(V);exports.default=X;
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("react/jsx-runtime"),x=require("react"),o=require("semantic-ui-react"),l=require("@devgateway/wp-react-lib"),L=require("../connected-templates/PostIntro.js"),k=require("react-router"),T=require("../connected-templates/PostContent.js"),I=f=>{const{posts:d,showIcons:j,showContentToggle:a,contentToggleHPosition:w,locale:C,readMoreLabel:u,readLessLabel:b}=f,[s,P]=x.useState({}),i=x.createRef(),c=(e,n="Read More")=>e&&e.trim()!==""?e:n;x.useEffect(()=>{window.setTimeout(()=>{if(window.location.hash){const e=document.getElementById(window.location.hash.substr(1));e&&e.scrollIntoView({behavior:"auto",block:"start"})}},0)},[d]);const h=e=>{const n=e.content?e.content.rendered.split("<!--more-->"):[];return n.length>1?n[1]:n[0]},g=e=>{const n=s[e]||!1,r=n?c(b,"Read less"):c(u,"Read more");return t.jsx("div",{children:t.jsx("div",{style:{display:"flex",justifyContent:w<33?"flex-start":w<66?"center":"flex-end"},children:t.jsx("a",{className:"link",onClick:()=>{i.current&&n&&(i.current.scrollIntoView({behavior:"smooth",block:"start"}),i.current.scrollTop=0),P({...s,[e]:!n})},children:r})})})},m=e=>{const n=e.content?e.content.rendered.split("<!--more-->"):[],r=n.length>1?n[0]:null;return r?r.trim():null},y=e=>{const n=e.content?e.content.rendered.split("<!--more-->"):[];return n.length>1&&n[1].trim().length>0};return t.jsx(o.Container,{fluid:!0,className:"inline list",children:d&&d.map(e=>t.jsxs(o.Grid,{children:[j&&t.jsxs(o.Grid.Column,{textAlign:"center",width:1,children:[t.jsx("a",{id:e.slug}),t.jsx(l.MediaProvider,{id:e.meta_fields&&e.meta_fields.icon?e.meta_fields.icon[0]:null,children:t.jsx(l.MediaConsumer,{children:t.jsx(l.PostIcon,{as:o.Label})})})]}),t.jsxs(o.Grid.Column,{width:j?15:16,children:[m(e)&&t.jsx(L.default,{as:o.Container,fluid:!0,post:e,ref:i}),!m(e)&&t.jsx(T.default,{post:{content:{rendered:h(e)}},style:{clear:"both",display:"block"}}),y(e)&&t.jsxs(o.Container,{children:[a&&t.jsxs(t.Fragment,{children:[!s[e.slug]&&g(e.slug),t.jsx(T.default,{post:{content:{rendered:h(e)}},style:{clear:"both",display:s[e.slug]?"block":"none"}}),s[e.slug]&&g(e.slug)]}),!a&&t.jsx("a",{href:l.utils.replaceLink(e.link,C),className:"link",children:c(u)})]})]})]}))})},p=f=>{const[d,j]=x.useState(Math.random()*99998+1),{locale:a}=k.useParams(),{"data-width":w,"data-height":C,"data-type":u,"data-taxonomy":b,"data-categories":s,"data-items":P,"data-color":i,"data-show-post-icons":c,"data-show-content-toggle":h,"data-content-toggle-h-position":g,"data-read-more-label":m,"data-read-less-label":y,parent:e,editing:n,component:r,unique:R}=f;return t.jsx(o.Container,{fluid:!0,children:t.jsx(l.PostProvider,{type:u,locale:a,taxonomy:b,categories:s,store:"inline_list_"+e+"_"+R,page:1,perPage:P,children:t.jsx(l.PostConsumer,{children:t.jsx(I,{locale:a??"en",showIcons:c==="true",showContentToggle:h==="true",contentToggleHPosition:parseInt(g||"50",10),readMoreLabel:m,readLessLabel:y})})})})};exports.default=p;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("react/jsx-runtime"),d=require("react"),o=require("semantic-ui-react"),l=require("@devgateway/wp-react-lib"),R=require("../connected-templates/PostIntro.js"),T=require("../connected-templates/PostContent.js"),I=require("react-intl"),k=f=>{const{posts:u,showIcons:j,showContentToggle:a,contentToggleHPosition:w,locale:C,readMoreLabel:h,readLessLabel:b}=f,[s,P]=d.useState({}),i=d.createRef(),c=(e,n="Read More")=>e&&e.trim()!==""?e:n;d.useEffect(()=>{window.setTimeout(()=>{if(window.location.hash){const e=document.getElementById(window.location.hash.substr(1));e&&e.scrollIntoView({behavior:"auto",block:"start"})}},0)},[u]);const g=e=>{const n=e.content?e.content.rendered.split("<!--more-->"):[];return n.length>1?n[1]:n[0]},m=e=>{const n=s[e]||!1,r=n?c(b,"Read less"):c(h,"Read more");return t.jsx("div",{children:t.jsx("div",{style:{display:"flex",justifyContent:w<33?"flex-start":w<66?"center":"flex-end"},children:t.jsx("a",{className:"link",onClick:()=>{i.current&&n&&(i.current.scrollIntoView({behavior:"smooth",block:"start"}),i.current.scrollTop=0),P({...s,[e]:!n})},children:r})})})},x=e=>{const n=e.content?e.content.rendered.split("<!--more-->"):[],r=n.length>1?n[0]:null;return r?r.trim():null},y=e=>{const n=e.content?e.content.rendered.split("<!--more-->"):[];return n.length>1&&n[1].trim().length>0};return t.jsx(o.Container,{fluid:!0,className:"inline list",children:u&&u.map(e=>t.jsxs(o.Grid,{children:[j&&t.jsxs(o.Grid.Column,{textAlign:"center",width:1,children:[t.jsx("a",{id:e.slug}),t.jsx(l.MediaProvider,{id:e.meta_fields&&e.meta_fields.icon?e.meta_fields.icon[0]:null,children:t.jsx(l.MediaConsumer,{children:t.jsx(l.PostIcon,{as:o.Label})})})]}),t.jsxs(o.Grid.Column,{width:j?15:16,children:[x(e)&&t.jsx(R.default,{as:o.Container,fluid:!0,post:e,ref:i}),!x(e)&&t.jsx(T.default,{post:{content:{rendered:g(e)}},style:{clear:"both",display:"block"}}),y(e)&&t.jsxs(o.Container,{children:[a&&t.jsxs(t.Fragment,{children:[!s[e.slug]&&m(e.slug),t.jsx(T.default,{post:{content:{rendered:g(e)}},style:{clear:"both",display:s[e.slug]?"block":"none"}}),s[e.slug]&&m(e.slug)]}),!a&&t.jsx("a",{href:l.utils.replaceLink(e.link,C),className:"link",children:c(h)})]})]})]}))})},p=f=>{const[u,j]=d.useState(Math.random()*99998+1),{locale:a}=I.useIntl(),{"data-width":w,"data-height":C,"data-type":h,"data-taxonomy":b,"data-categories":s,"data-items":P,"data-color":i,"data-show-post-icons":c,"data-show-content-toggle":g,"data-content-toggle-h-position":m,"data-read-more-label":x,"data-read-less-label":y,parent:e,editing:n,component:r,unique:L}=f;return t.jsx(o.Container,{fluid:!0,children:t.jsx(l.PostProvider,{type:h,locale:a,taxonomy:b,categories:s,store:"inline_list_"+e+"_"+L,page:1,perPage:P,children:t.jsx(l.PostConsumer,{children:t.jsx(k,{locale:a??"en",showIcons:c==="true",showContentToggle:g==="true",contentToggleHPosition:parseInt(m||"50",10),readMoreLabel:x,readLessLabel:y})})})})},q=I.injectIntl(d.memo(p));exports.default=q;
@@ -1,149 +1,151 @@
1
1
  import { jsx as t, jsxs as l } from "react/jsx-runtime";
2
- import K, { useRef as X, useState as L, useEffect as Y } from "react";
3
- import { Container as v, Grid as y, Button as Z, Dropdown as P, Icon as _ } from "semantic-ui-react";
2
+ import K, { useRef as X, useState as E, useEffect as Y } from "react";
3
+ import { Container as J, Grid as G, Button as Z, Dropdown as b, Icon as _ } from "semantic-ui-react";
4
4
  import { PostContent as U } from "@devgateway/wp-react-lib";
5
- import { domtoimage as C } from "./dom-to-image.js";
6
- import { saveAs as E } from "file-saver";
5
+ import { domtoimage as y } from "./dom-to-image.js";
6
+ import { saveAs as F } from "file-saver";
7
7
  import { connect as ee } from "react-redux";
8
8
  const te = K.forwardRef((a, r) => /* @__PURE__ */ t("div", { ref: r, children: a.children })), ne = (a) => {
9
9
  const r = X();
10
10
  let {
11
- childContent: g,
11
+ childContent: A,
12
12
  "data-height": ae,
13
- "data-button-label": J,
14
- "data-png-label": I,
15
- "data-jpg-label": T,
16
- "data-jpg-text": F,
17
- "data-png-text": S,
13
+ "data-button-label": T,
14
+ "data-png-label": S,
15
+ "data-jpg-label": B,
16
+ "data-jpg-text": D,
17
+ "data-png-text": $,
18
18
  "data-check-png": k = "true",
19
19
  "data-check-jpg": x = "true",
20
- "data-title": B,
21
- "data-default-format": N = "PNG",
22
- "data-use-title": b = "false",
23
- "data-style": D = "heavy",
24
- "data-section-title": $ = "",
25
- "data-download-tooltip": j = "",
26
- "data-include-source-url": q = "false",
27
- "data-include-filters": R = "false",
28
- "data-source-urlmargin-left": O = 70,
29
- "data-source-urlmargin-top": W = 10,
30
- "data-source-urlfont-size": M = 18,
20
+ "data-title": j,
21
+ "data-default-format": P = "PNG",
22
+ "data-use-title": C = "false",
23
+ "data-style": q = "heavy",
24
+ "data-section-title": O = "",
25
+ "data-download-tooltip": W = "",
26
+ "data-include-source-url": R = "false",
27
+ "data-include-filters": v = "false",
28
+ "data-source-urlmargin-left": z = 70,
29
+ "data-source-urlmargin-top": I = 10,
30
+ "data-source-urlfont-size": L = 18,
31
31
  parent: ie,
32
32
  editing: i,
33
33
  component: le,
34
34
  unique: se,
35
35
  pageModuleProps: s
36
36
  } = a;
37
- const [w, p] = L(N), [z, c] = L(!1), d = k == "true" || k === !0, u = x == "true" || x === !0;
37
+ const [N, p] = E(P), [M, c] = E(!1), d = k == "true" || k === !0, u = x == "true" || x === !0;
38
38
  Y(() => {
39
- p(N);
40
- }, [N]);
39
+ p(P);
40
+ }, [P]);
41
41
  function H(n) {
42
- const o = n.attributes, G = [];
42
+ const o = n.attributes, g = [];
43
43
  if (o)
44
44
  for (let e = 0; e < o.length; e++)
45
- G.push(o[e].nodeName);
46
- const f = G.filter((e) => e.startsWith("data-"));
45
+ g.push(o[e].nodeName);
46
+ const f = g.filter((e) => e.startsWith("data-"));
47
47
  if (f.length > 0 && f.forEach((e) => {
48
48
  n.setAttribute(e, "");
49
49
  }), n.classList) {
50
50
  if (n.classList.contains("ignore")) return !1;
51
- if (!(R === !0 || R === "true")) {
52
- const m = [
51
+ if (!(v === !0 || v === "true")) {
52
+ const w = [
53
53
  "filter-component",
54
54
  "data-filters-reset",
55
55
  "data-filters-apply",
56
56
  "filter-search"
57
57
  ];
58
- for (const V of m)
58
+ for (const V of w)
59
59
  if (n.classList.contains(V)) return !1;
60
60
  }
61
61
  return !0;
62
62
  }
63
63
  return !0;
64
64
  }
65
- const A = { filter: H, bgcolor: "#FFF", imagePlaceholder: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8Xw8AAoMBgQb9Z3kAAAAASUVORK5CYII=", cacheBust: !0 }, Q = (n) => {
66
- C.cloneNode(r.current).then(function(o) {
67
- if ([...o.getElementsByTagName("input")].forEach((e) => e.remove()), [...o.querySelectorAll(".question.circle.icon")].forEach((e) => e.remove()), q === "true") {
65
+ const h = { filter: H, bgcolor: "#FFF", imagePlaceholder: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8Xw8AAoMBgQb9Z3kAAAAASUVORK5CYII=", cacheBust: !0 }, Q = (n) => {
66
+ y.cloneNode(r.current).then(function(o) {
67
+ [...o.getElementsByTagName("input")].forEach((e) => e.remove()), [...o.querySelectorAll(".question.circle.icon")].forEach((e) => e.remove());
68
+ const g = R === "true" || R === !0;
69
+ if (g) {
68
70
  const e = document.createElement("div");
69
- e.style.marginLeft = O + "px", e.style.marginTop = W + "px", e.style.fontSize = M + "px", e.style.fontFamily = "Roboto, sans-serif", e.style.fontWeight = "400", e.style.color = "#66676d", e.style.opacity = "0.75", e.innerHTML = window.location.href, e.style.maxWidth = "90%", e.style.wordWrap = "break-word", e.style.overflowWrap = "break-word", o.appendChild(e);
71
+ e.style.marginLeft = z + "px", e.style.marginTop = I + "px", e.style.fontSize = L + "px", e.style.fontFamily = "Roboto, sans-serif", e.style.fontWeight = "400", e.style.color = "#66676d", e.style.opacity = "0.75", e.textContent = window.location.href, e.style.maxWidth = "90%", e.style.wordWrap = "break-word", e.style.overflowWrap = "break-word", o.appendChild(e);
70
72
  }
71
73
  const f = 50;
72
- A.height = r.current.scrollHeight + f, A.width = r.current.scrollWidth + f * 2, o.style.padding = `${f}px`, n === "PNG" && C.toPng(o, A).then(function(e) {
74
+ h.height = r.current.scrollHeight + f * 2, g && (h.height += (Number.parseInt(I, 10) || 0) + (Number.parseInt(L, 10) || 0) * 2), h.width = r.current.scrollWidth + f * 2, o.style.padding = `${f}px`, n === "PNG" && y.toPng(o, h).then(function(e) {
73
75
  if (!e) throw new Error("PNG render returned empty result");
74
- return fetch(e).then((m) => m.blob());
76
+ return fetch(e).then((w) => w.blob());
75
77
  }).then(function(e) {
76
- E(e, I);
78
+ F(e, S);
77
79
  }).catch(function(e) {
78
80
  console.error("PNG download failed:", e);
79
- }), n === "JPG" && C.toJpeg(o, A).then(function(e) {
81
+ }), n === "JPG" && y.toJpeg(o, h).then(function(e) {
80
82
  if (!e) throw new Error("JPEG render returned empty result");
81
- return fetch(e).then((m) => m.blob());
83
+ return fetch(e).then((w) => w.blob());
82
84
  }).then(function(e) {
83
- E(e, T);
85
+ F(e, B);
84
86
  }).catch(function(e) {
85
87
  console.error("JPG download failed:", e);
86
88
  });
87
89
  });
88
- }, h = (n) => {
90
+ }, m = (n) => {
89
91
  i ? alert("Not allowed when editing please preview page") : Q(n);
90
92
  };
91
93
  return /* @__PURE__ */ t(
92
- v,
94
+ J,
93
95
  {
94
- className: `viz download ${D} ${b ? "has-title" : ""}
96
+ className: `viz download ${q} ${C ? "has-title" : ""}
95
97
  ${d || u ? "has-formats" : ""}
96
98
  ${i || s != null && s.editing ? "editing" : ""}
97
99
  ${d && u ? "multi-format" : ""}
98
100
  ${d && !u || !d && u ? "single-format" : ""}`,
99
101
  fluid: !0,
100
102
  children: /* @__PURE__ */ l(te, { ref: r, children: [
101
- /* @__PURE__ */ l(y, { stackable: !0, reversed: "mobile", className: "download-header", children: [
102
- !i && b === "true" && /* @__PURE__ */ t(y.Column, { width: 12, children: /* @__PURE__ */ t(
103
+ /* @__PURE__ */ l(G, { stackable: !0, reversed: "mobile", className: "download-header", children: [
104
+ !i && C === "true" && /* @__PURE__ */ t(G.Column, { width: 12, children: /* @__PURE__ */ t(
103
105
  U,
104
106
  {
105
107
  parentUnique: a.unique,
106
- post: { content: { rendered: decodeURIComponent($) } }
108
+ post: { content: { rendered: decodeURIComponent(O) } }
107
109
  }
108
110
  ) }),
109
111
  /* @__PURE__ */ t(
110
- y.Column,
112
+ G.Column,
111
113
  {
112
114
  className: i ? "editing ignore" : "ignore",
113
- width: i || b !== "true" ? 16 : 4,
115
+ width: i || C !== "true" ? 16 : 4,
114
116
  textAlign: "right",
115
117
  children: /* @__PURE__ */ l("div", { className: "wrapper", children: [
116
- /* @__PURE__ */ l(Z, { className: "download", onClick: () => h(w), children: [
117
- J,
118
+ /* @__PURE__ */ l(Z, { className: "download", onClick: () => m(N), children: [
119
+ T,
118
120
  " ",
119
- w === "PNG" ? "PNG" : "JPG"
121
+ N === "PNG" ? "PNG" : "JPG"
120
122
  ] }),
121
123
  /* @__PURE__ */ t(
122
- P,
124
+ b,
123
125
  {
124
126
  className: "download",
125
- "data-tooltip": decodeURIComponent(j),
126
- open: z,
127
+ "data-tooltip": decodeURIComponent(W),
128
+ open: M,
127
129
  onOpen: () => c(!0),
128
130
  onClose: () => c(!1),
129
131
  trigger: u && d ? /* @__PURE__ */ t(_, { name: "download", className: "download-icon" }) : null,
130
- children: /* @__PURE__ */ l(P.Menu, { children: [
131
- B,
132
- d === !0 && /* @__PURE__ */ t(P.Item, { onClick: () => {
133
- p("PNG"), h("PNG"), c(!1);
132
+ children: /* @__PURE__ */ l(b.Menu, { children: [
133
+ j,
134
+ d === !0 && /* @__PURE__ */ t(b.Item, { onClick: () => {
135
+ p("PNG"), m("PNG"), c(!1);
134
136
  }, children: /* @__PURE__ */ l("div", { className: "ui radio checkbox", children: [
135
- /* @__PURE__ */ t("input", { type: "radio", className: "hidden", readOnly: !0, tabIndex: 0, checked: w === "PNG" }),
137
+ /* @__PURE__ */ t("input", { type: "radio", className: "hidden", readOnly: !0, tabIndex: 0, checked: N === "PNG" }),
136
138
  /* @__PURE__ */ t("label", { onClick: (n) => {
137
- n.stopPropagation(), p("PNG"), h("PNG"), c(!1);
138
- }, children: S })
139
+ n.stopPropagation(), p("PNG"), m("PNG"), c(!1);
140
+ }, children: $ })
139
141
  ] }) }),
140
- u === !0 && /* @__PURE__ */ t(P.Item, { onClick: () => {
141
- p("JPG"), h("JPG"), c(!1);
142
+ u === !0 && /* @__PURE__ */ t(b.Item, { onClick: () => {
143
+ p("JPG"), m("JPG"), c(!1);
142
144
  }, children: /* @__PURE__ */ l("div", { className: "ui radio checkbox", children: [
143
- /* @__PURE__ */ t("input", { type: "radio", className: "hidden", readOnly: !0, tabIndex: 0, checked: w === "JPG" }),
145
+ /* @__PURE__ */ t("input", { type: "radio", className: "hidden", readOnly: !0, tabIndex: 0, checked: N === "JPG" }),
144
146
  /* @__PURE__ */ t("label", { onClick: (n) => {
145
- n.stopPropagation(), p("JPG"), h("JPG"), c(!1);
146
- }, children: F })
147
+ n.stopPropagation(), p("JPG"), m("JPG"), c(!1);
148
+ }, children: D })
147
149
  ] }) })
148
150
  ] })
149
151
  }
@@ -152,19 +154,19 @@ const te = K.forwardRef((a, r) => /* @__PURE__ */ t("div", { ref: r, children: a
152
154
  }
153
155
  )
154
156
  ] }),
155
- !i && /* @__PURE__ */ t(v, { fluid: !0, className: `download area ${i || s != null && s.editing ? "editing" : ""}`, children: /* @__PURE__ */ t(
157
+ !i && /* @__PURE__ */ t(J, { fluid: !0, className: `download area ${i || s != null && s.editing ? "editing" : ""}`, children: /* @__PURE__ */ t(
156
158
  U,
157
159
  {
158
160
  parentUnique: a.unique,
159
- post: { content: { rendered: g } }
161
+ post: { content: { rendered: A } }
160
162
  }
161
163
  ) })
162
164
  ] })
163
165
  }
164
166
  );
165
167
  }, oe = (a) => {
166
- const r = a.getIn(["data", "pageModuleProps"]), g = {};
167
- return r && (g.pageModuleProps = r), g;
168
+ const r = a.getIn(["data", "pageModuleProps"]), A = {};
169
+ return r && (A.pageModuleProps = r), A;
168
170
  }, re = {}, we = ee(oe, re)(ne);
169
171
  export {
170
172
  we as default
@@ -1,12 +1,12 @@
1
- import { jsx as o, jsxs as i, Fragment as L } from "react/jsx-runtime";
2
- import R, { useState as x, useEffect as v } from "react";
1
+ import { jsx as o, jsxs as i, Fragment as R } from "react/jsx-runtime";
2
+ import x, { useState as k, useEffect as v } from "react";
3
3
  import { Container as u, Grid as T, Label as M } from "semantic-ui-react";
4
- import { PostProvider as _, PostConsumer as S, MediaProvider as j, MediaConsumer as B, PostIcon as H, utils as N } from "@devgateway/wp-react-lib";
4
+ import { PostProvider as _, PostConsumer as j, MediaProvider as S, MediaConsumer as B, PostIcon as H, utils as N } from "@devgateway/wp-react-lib";
5
5
  import E from "../connected-templates/PostIntro.js";
6
- import { useParams as V } from "react-router";
7
- import k from "../connected-templates/PostContent.js";
8
- const q = (f) => {
9
- const { posts: c, showIcons: w, showContentToggle: s, contentToggleHPosition: P, locale: C, readMoreLabel: d, readLessLabel: b } = f, [n, p] = x({}), l = R.createRef(), a = (t, e = "Read More") => t && t.trim() !== "" ? t : e;
6
+ import I from "../connected-templates/PostContent.js";
7
+ import { injectIntl as V, useIntl as q } from "react-intl";
8
+ const A = (f) => {
9
+ const { posts: c, showIcons: w, showContentToggle: s, contentToggleHPosition: b, locale: C, readMoreLabel: d, readLessLabel: P } = f, [n, p] = k({}), l = x.createRef(), a = (t, e = "Read More") => t && t.trim() !== "" ? t : e;
10
10
  v(() => {
11
11
  window.setTimeout(
12
12
  () => {
@@ -22,10 +22,10 @@ const q = (f) => {
22
22
  const e = t.content ? t.content.rendered.split("<!--more-->") : [];
23
23
  return e.length > 1 ? e[1] : e[0];
24
24
  }, m = (t) => {
25
- const e = n[t] || !1, r = e ? a(b, "Read less") : a(d, "Read more");
25
+ const e = n[t] || !1, r = e ? a(P, "Read less") : a(d, "Read more");
26
26
  return /* @__PURE__ */ o("div", { children: /* @__PURE__ */ o("div", { style: {
27
27
  display: "flex",
28
- justifyContent: P < 33 ? "flex-start" : P < 66 ? "center" : "flex-end"
28
+ justifyContent: b < 33 ? "flex-start" : b < 66 ? "center" : "flex-end"
29
29
  }, children: /* @__PURE__ */ o("a", { className: "link", onClick: () => {
30
30
  l.current && e && (l.current.scrollIntoView({ behavior: "smooth", block: "start" }), l.current.scrollTop = 0), p({ ...n, [t]: !e });
31
31
  }, children: r }) }) });
@@ -40,7 +40,7 @@ const q = (f) => {
40
40
  w && /* @__PURE__ */ i(T.Column, { textAlign: "center", width: 1, children: [
41
41
  /* @__PURE__ */ o("a", { id: t.slug }),
42
42
  /* @__PURE__ */ o(
43
- j,
43
+ S,
44
44
  {
45
45
  id: t.meta_fields && t.meta_fields.icon ? t.meta_fields.icon[0] : null,
46
46
  children: /* @__PURE__ */ o(B, { children: /* @__PURE__ */ o(H, { as: M }) })
@@ -50,17 +50,17 @@ const q = (f) => {
50
50
  /* @__PURE__ */ i(T.Column, { width: w ? 15 : 16, children: [
51
51
  g(t) && /* @__PURE__ */ o(E, { as: u, fluid: !0, post: t, ref: l }),
52
52
  !g(t) && /* @__PURE__ */ o(
53
- k,
53
+ I,
54
54
  {
55
55
  post: { content: { rendered: h(t) } },
56
56
  style: { clear: "both", display: "block" }
57
57
  }
58
58
  ),
59
59
  y(t) && /* @__PURE__ */ i(u, { children: [
60
- s && /* @__PURE__ */ i(L, { children: [
60
+ s && /* @__PURE__ */ i(R, { children: [
61
61
  !n[t.slug] && m(t.slug),
62
62
  /* @__PURE__ */ o(
63
- k,
63
+ I,
64
64
  {
65
65
  post: { content: { rendered: h(t) } },
66
66
  style: {
@@ -75,12 +75,12 @@ const q = (f) => {
75
75
  ] })
76
76
  ] })
77
77
  ] })) });
78
- }, K = (f) => {
79
- const [c, w] = x(Math.random() * 99998 + 1), { locale: s } = V(), {
80
- "data-width": P,
78
+ }, F = (f) => {
79
+ const [c, w] = k(Math.random() * 99998 + 1), { locale: s } = q(), {
80
+ "data-width": b,
81
81
  "data-height": C,
82
82
  "data-type": d,
83
- "data-taxonomy": b,
83
+ "data-taxonomy": P,
84
84
  "data-categories": n,
85
85
  "data-items": p,
86
86
  "data-color": l,
@@ -93,20 +93,20 @@ const q = (f) => {
93
93
  parent: t,
94
94
  editing: e,
95
95
  component: r,
96
- unique: I
96
+ unique: L
97
97
  } = f;
98
98
  return /* @__PURE__ */ o(u, { fluid: !0, children: /* @__PURE__ */ o(
99
99
  _,
100
100
  {
101
101
  type: d,
102
102
  locale: s,
103
- taxonomy: b,
103
+ taxonomy: P,
104
104
  categories: n,
105
- store: "inline_list_" + t + "_" + I,
105
+ store: "inline_list_" + t + "_" + L,
106
106
  page: 1,
107
107
  perPage: p,
108
- children: /* @__PURE__ */ o(S, { children: /* @__PURE__ */ o(
109
- q,
108
+ children: /* @__PURE__ */ o(j, { children: /* @__PURE__ */ o(
109
+ A,
110
110
  {
111
111
  locale: s ?? "en",
112
112
  showIcons: a === "true",
@@ -118,7 +118,7 @@ const q = (f) => {
118
118
  ) })
119
119
  }
120
120
  ) });
121
- };
121
+ }, U = V(x.memo(F));
122
122
  export {
123
- K as default
123
+ U as default
124
124
  };
@@ -1,5 +1,6 @@
1
1
  import { default as React } from 'react';
2
- interface InlineListProps {
2
+ import { WrappedComponentProps } from 'react-intl';
3
+ interface InlineListProps extends WrappedComponentProps {
3
4
  "data-width"?: string;
4
5
  "data-height"?: string;
5
6
  "data-type"?: string;
@@ -17,5 +18,7 @@ interface InlineListProps {
17
18
  component?: string;
18
19
  unique?: string;
19
20
  }
20
- declare const Root: React.FC<InlineListProps>;
21
- export default Root;
21
+ declare const _default: React.FC<import('react-intl').WithIntlProps<InlineListProps>> & {
22
+ WrappedComponent: React.ComponentType<InlineListProps>;
23
+ };
24
+ export default _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devgateway/dvz-ui-react",
3
- "version": "1.8.2",
3
+ "version": "1.8.4",
4
4
  "main": "dist/cjs/index.js",
5
5
  "module": "dist/esm/index.js",
6
6
  "types": "dist/types/index.d.ts",