@devgateway/dvz-ui-react 1.8.4 → 1.8.5

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 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
+ "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"),I=require("../connected-templates/PostContent.js"),L=require("react-intl"),k=j=>{const{posts:u,showIcons:w,showContentToggle:i,contentToggleHPosition:b,locale:T,readMoreLabel:h,readLessLabel:P}=j,[s,y]=d.useState({}),a=d.useRef({}),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(P,"Read less"):c(h,"Read more");return t.jsx("div",{children:t.jsx("div",{style:{display:"flex",justifyContent:b<33?"flex-start":b<66?"center":"flex-end"},children:t.jsx("a",{className:"link",onClick:()=>{var f;n&&a.current[e]&&((f=a.current[e])==null||f.scrollIntoView({behavior:"smooth",block:"start"}),a.current[e].scrollTop=0),y({...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},C=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:[w&&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.jsx(o.Grid.Column,{width:w?15:16,children:t.jsxs("div",{ref:n=>{a.current[e.slug]=n},children:[x(e)&&t.jsx(R.default,{as:o.Container,fluid:!0,post:e}),!x(e)&&t.jsx(I.default,{post:{content:{rendered:g(e)}},style:{clear:"both",display:"block"}}),C(e)&&t.jsxs(o.Container,{children:[i&&t.jsxs(t.Fragment,{children:[!s[e.slug]&&m(e.slug),t.jsx(I.default,{post:{content:{rendered:g(e)}},style:{clear:"both",display:s[e.slug]?"block":"none"}}),s[e.slug]&&m(e.slug)]}),!i&&t.jsx("a",{href:l.utils.replaceLink(e.link,T),className:"link",children:c(h)})]})]})})]}))})},v=j=>{const[u,w]=d.useState(Math.random()*99998+1),{locale:i}=L.useIntl(),{"data-width":b,"data-height":T,"data-type":h,"data-taxonomy":P,"data-categories":s,"data-items":y,"data-color":a,"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":C,parent:e,editing:n,component:r,unique:f}=j;return t.jsx(o.Container,{fluid:!0,children:t.jsx(l.PostProvider,{type:h,locale:i,taxonomy:P,categories:s,store:"inline_list_"+e+"_"+f,page:1,perPage:y,children:t.jsx(l.PostConsumer,{children:t.jsx(k,{locale:i??"en",showIcons:c==="true",showContentToggle:g==="true",contentToggleHPosition:parseInt(m||"50",10),readMoreLabel:x,readLessLabel:C})})})})},q=L.injectIntl(d.memo(v));exports.default=q;
@@ -1,13 +1,13 @@
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
- import { Container as u, Grid as T, Label as M } from "semantic-ui-react";
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
- import E from "../connected-templates/PostIntro.js";
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
- v(() => {
1
+ import { jsx as o, jsxs as a, Fragment as L } from "react/jsx-runtime";
2
+ import R, { useState as k, useRef as v, useEffect as M } from "react";
3
+ import { Container as f, Grid as C, Label as _ } from "semantic-ui-react";
4
+ import { PostProvider as j, PostConsumer as S, MediaProvider as B, MediaConsumer as H, PostIcon as N, utils as E } from "@devgateway/wp-react-lib";
5
+ import V from "../connected-templates/PostIntro.js";
6
+ import x from "../connected-templates/PostContent.js";
7
+ import { injectIntl as q, useIntl as A } from "react-intl";
8
+ const F = (w) => {
9
+ const { posts: c, showIcons: b, showContentToggle: s, contentToggleHPosition: P, locale: I, readMoreLabel: d, readLessLabel: y } = w, [n, p] = k({}), l = v({}), i = (t, e = "Read More") => t && t.trim() !== "" ? t : e;
10
+ M(() => {
11
11
  window.setTimeout(
12
12
  () => {
13
13
  if (window.location.hash) {
@@ -22,45 +22,48 @@ const A = (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(P, "Read less") : a(d, "Read more");
25
+ const e = n[t] || !1, r = e ? i(y, "Read less") : i(d, "Read more");
26
26
  return /* @__PURE__ */ o("div", { children: /* @__PURE__ */ o("div", { style: {
27
27
  display: "flex",
28
- justifyContent: b < 33 ? "flex-start" : b < 66 ? "center" : "flex-end"
28
+ justifyContent: P < 33 ? "flex-start" : P < 66 ? "center" : "flex-end"
29
29
  }, children: /* @__PURE__ */ o("a", { className: "link", onClick: () => {
30
- l.current && e && (l.current.scrollIntoView({ behavior: "smooth", block: "start" }), l.current.scrollTop = 0), p({ ...n, [t]: !e });
30
+ var u;
31
+ e && l.current[t] && ((u = l.current[t]) == null || u.scrollIntoView({ behavior: "smooth", block: "start" }), l.current[t].scrollTop = 0), p({ ...n, [t]: !e });
31
32
  }, children: r }) }) });
32
33
  }, g = (t) => {
33
34
  const e = t.content ? t.content.rendered.split("<!--more-->") : [], r = e.length > 1 ? e[0] : null;
34
35
  return r ? r.trim() : null;
35
- }, y = (t) => {
36
+ }, T = (t) => {
36
37
  const e = t.content ? t.content.rendered.split("<!--more-->") : [];
37
38
  return e.length > 1 && e[1].trim().length > 0;
38
39
  };
39
- return /* @__PURE__ */ o(u, { fluid: !0, className: "inline list", children: c && c.map((t) => /* @__PURE__ */ i(T, { children: [
40
- w && /* @__PURE__ */ i(T.Column, { textAlign: "center", width: 1, children: [
40
+ return /* @__PURE__ */ o(f, { fluid: !0, className: "inline list", children: c && c.map((t) => /* @__PURE__ */ a(C, { children: [
41
+ b && /* @__PURE__ */ a(C.Column, { textAlign: "center", width: 1, children: [
41
42
  /* @__PURE__ */ o("a", { id: t.slug }),
42
43
  /* @__PURE__ */ o(
43
- S,
44
+ B,
44
45
  {
45
46
  id: t.meta_fields && t.meta_fields.icon ? t.meta_fields.icon[0] : null,
46
- children: /* @__PURE__ */ o(B, { children: /* @__PURE__ */ o(H, { as: M }) })
47
+ children: /* @__PURE__ */ o(H, { children: /* @__PURE__ */ o(N, { as: _ }) })
47
48
  }
48
49
  )
49
50
  ] }),
50
- /* @__PURE__ */ i(T.Column, { width: w ? 15 : 16, children: [
51
- g(t) && /* @__PURE__ */ o(E, { as: u, fluid: !0, post: t, ref: l }),
51
+ /* @__PURE__ */ o(C.Column, { width: b ? 15 : 16, children: /* @__PURE__ */ a("div", { ref: (e) => {
52
+ l.current[t.slug] = e;
53
+ }, children: [
54
+ g(t) && /* @__PURE__ */ o(V, { as: f, fluid: !0, post: t }),
52
55
  !g(t) && /* @__PURE__ */ o(
53
- I,
56
+ x,
54
57
  {
55
58
  post: { content: { rendered: h(t) } },
56
59
  style: { clear: "both", display: "block" }
57
60
  }
58
61
  ),
59
- y(t) && /* @__PURE__ */ i(u, { children: [
60
- s && /* @__PURE__ */ i(R, { children: [
62
+ T(t) && /* @__PURE__ */ a(f, { children: [
63
+ s && /* @__PURE__ */ a(L, { children: [
61
64
  !n[t.slug] && m(t.slug),
62
65
  /* @__PURE__ */ o(
63
- I,
66
+ x,
64
67
  {
65
68
  post: { content: { rendered: h(t) } },
66
69
  style: {
@@ -71,54 +74,54 @@ const A = (f) => {
71
74
  ),
72
75
  n[t.slug] && m(t.slug)
73
76
  ] }),
74
- !s && /* @__PURE__ */ o("a", { href: N.replaceLink(t.link, C), className: "link", children: a(d) })
77
+ !s && /* @__PURE__ */ o("a", { href: E.replaceLink(t.link, I), className: "link", children: i(d) })
75
78
  ] })
76
- ] })
79
+ ] }) })
77
80
  ] })) });
78
- }, F = (f) => {
79
- const [c, w] = k(Math.random() * 99998 + 1), { locale: s } = q(), {
80
- "data-width": b,
81
- "data-height": C,
81
+ }, G = (w) => {
82
+ const [c, b] = k(Math.random() * 99998 + 1), { locale: s } = A(), {
83
+ "data-width": P,
84
+ "data-height": I,
82
85
  "data-type": d,
83
- "data-taxonomy": P,
86
+ "data-taxonomy": y,
84
87
  "data-categories": n,
85
88
  "data-items": p,
86
89
  "data-color": l,
87
- "data-show-post-icons": a,
90
+ "data-show-post-icons": i,
88
91
  "data-show-content-toggle": h,
89
92
  "data-content-toggle-h-position": m,
90
93
  //horizontal position
91
94
  "data-read-more-label": g,
92
- "data-read-less-label": y,
95
+ "data-read-less-label": T,
93
96
  parent: t,
94
97
  editing: e,
95
98
  component: r,
96
- unique: L
97
- } = f;
98
- return /* @__PURE__ */ o(u, { fluid: !0, children: /* @__PURE__ */ o(
99
- _,
99
+ unique: u
100
+ } = w;
101
+ return /* @__PURE__ */ o(f, { fluid: !0, children: /* @__PURE__ */ o(
102
+ j,
100
103
  {
101
104
  type: d,
102
105
  locale: s,
103
- taxonomy: P,
106
+ taxonomy: y,
104
107
  categories: n,
105
- store: "inline_list_" + t + "_" + L,
108
+ store: "inline_list_" + t + "_" + u,
106
109
  page: 1,
107
110
  perPage: p,
108
- children: /* @__PURE__ */ o(j, { children: /* @__PURE__ */ o(
109
- A,
111
+ children: /* @__PURE__ */ o(S, { children: /* @__PURE__ */ o(
112
+ F,
110
113
  {
111
114
  locale: s ?? "en",
112
- showIcons: a === "true",
115
+ showIcons: i === "true",
113
116
  showContentToggle: h === "true",
114
117
  contentToggleHPosition: parseInt(m || "50", 10),
115
118
  readMoreLabel: g,
116
- readLessLabel: y
119
+ readLessLabel: T
117
120
  }
118
121
  ) })
119
122
  }
120
123
  ) });
121
- }, U = V(x.memo(F));
124
+ }, W = q(R.memo(G));
122
125
  export {
123
- U as default
126
+ W as default
124
127
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devgateway/dvz-ui-react",
3
- "version": "1.8.4",
3
+ "version": "1.8.5",
4
4
  "main": "dist/cjs/index.js",
5
5
  "module": "dist/esm/index.js",
6
6
  "types": "dist/types/index.d.ts",