@devgateway/dvz-ui-react 1.8.3 → 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 +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,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.3",
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",