@devgateway/dvz-ui-react 1.6.18 → 1.6.19

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