@devgateway/dvz-ui-react 1.1.1 → 1.2.1

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.
Files changed (34) hide show
  1. package/dist/cjs/embeddable/big-number/index.js +1 -1
  2. package/dist/cjs/embeddable/chart/Bar.js +1 -1
  3. package/dist/cjs/embeddable/chart/index.js +1 -1
  4. package/dist/cjs/embeddable/d3Map/BaseLayer.js +1 -1
  5. package/dist/cjs/embeddable/d3Map/DataLayer.js +1 -1
  6. package/dist/cjs/embeddable/d3Map/FlowLayer.js +1 -1
  7. package/dist/cjs/embeddable/d3Map/ZoomControl.js +1 -1
  8. package/dist/cjs/embeddable/d3Map/index.js +1 -1
  9. package/dist/cjs/embeddable/posts-with-filters/DropDownFilter.js +1 -0
  10. package/dist/cjs/embeddable/posts-with-filters/Post.js +1 -1
  11. package/dist/cjs/embeddable/posts-with-filters/index.js +1 -1
  12. package/dist/cjs/embeddable/reducers/data-api.js +1 -1
  13. package/dist/cjs/layout/containers/SlugPostContainer.js +1 -1
  14. package/dist/cjs/styles.css +1 -1
  15. package/dist/esm/embeddable/big-number/index.js +92 -85
  16. package/dist/esm/embeddable/chart/Bar.js +128 -123
  17. package/dist/esm/embeddable/chart/index.js +229 -225
  18. package/dist/esm/embeddable/d3Map/BaseLayer.js +40 -27
  19. package/dist/esm/embeddable/d3Map/DataLayer.js +196 -204
  20. package/dist/esm/embeddable/d3Map/FlowLayer.js +104 -101
  21. package/dist/esm/embeddable/d3Map/ZoomControl.js +64 -54
  22. package/dist/esm/embeddable/d3Map/index.js +110 -99
  23. package/dist/esm/embeddable/posts-with-filters/DropDownFilter.js +25 -0
  24. package/dist/esm/embeddable/posts-with-filters/Post.js +49 -24
  25. package/dist/esm/embeddable/posts-with-filters/index.js +120 -119
  26. package/dist/esm/embeddable/reducers/data-api.js +13 -11
  27. package/dist/esm/layout/containers/SlugPostContainer.js +3 -3
  28. package/dist/esm/styles.css +1 -1
  29. package/dist/types/embeddable/chart/Bar.d.ts +2 -0
  30. package/dist/types/embeddable/d3Map/BaseLayer.d.ts +1 -0
  31. package/dist/types/embeddable/d3Map/ZoomControl.d.ts +2 -1
  32. package/dist/types/embeddable/posts-with-filters/DropDownFilter.d.ts +4 -0
  33. package/dist/types/embeddable/posts-with-filters/Post.d.ts +4 -2
  34. package/package.json +4 -2
@@ -1,156 +1,167 @@
1
- import { jsx as a, jsxs as B } from "react/jsx-runtime";
2
- import { useState as f, useRef as F, useEffect as V } from "react";
3
- import { connect as J } from "react-redux";
4
- import { parse as i, compareJsonProps as E, decode as W } from "../utils/parseUtils.js";
5
- import G from "./Map.js";
6
- import H from "./BaseLayer.js";
7
- import K from "./DataLayer.js";
8
- import O from "./LatLongLayer.js";
9
- import Q from "./ZoomControl.js";
10
- import U from "./ProjectedContainer.js";
11
- import X from "./Legends.js";
12
- import Y from "./FlowLayer.js";
13
- const _ = (L) => {
1
+ import { jsx as n, jsxs as H } from "react/jsx-runtime";
2
+ import { useState as l, useRef as h, useEffect as R } from "react";
3
+ import { connect as K } from "react-redux";
4
+ import { parse as i, compareJsonProps as E, decode as O } from "../utils/parseUtils.js";
5
+ import Q from "./Map.js";
6
+ import U from "./BaseLayer.js";
7
+ import X from "./DataLayer.js";
8
+ import Y from "./LatLongLayer.js";
9
+ import _ from "./ZoomControl.js";
10
+ import $ from "./ProjectedContainer.js";
11
+ import oo from "./Legends.js";
12
+ import eo from "./FlowLayer.js";
13
+ const to = (L) => {
14
14
  const {
15
- unique: l,
16
- editing: r,
15
+ unique: d,
16
+ editing: a,
17
17
  "data-identifier": M,
18
- "data-group": c,
18
+ "data-group": m,
19
19
  "data-layers": g = "[]",
20
- "data-height": w = 400,
21
- "data-width": h = 1e3,
22
- "data-back-ground-color": j = "#88e8dc",
23
- "data-map-position": y = "{}",
24
- "data-projection": k = "geoMercator",
25
- "data-zoom-enabled": x = !0,
20
+ "data-height": V = 400,
21
+ "data-width": C = 1e3,
22
+ "data-back-ground-color": T = "#88e8dc",
23
+ "data-map-position": P = "{}",
24
+ "data-projection": j = "geoMercator",
25
+ "data-zoom-enabled": k = !0,
26
26
  "data-rotation-enabled": z = !1,
27
- "data-wait-for-filters": n = "false",
27
+ "data-wait-for-filters": s = "false",
28
28
  intl: p
29
- } = L, [P, S] = f(i(y, r), []), [s, u] = f(i(g), []), T = F(null), d = F(null), [b, v] = f(null), [C, I] = f(null), [Z, D] = f(null);
30
- V(() => {
31
- const o = i(y, r);
32
- E(P, o) || S(o);
33
- }, [y]), V(() => {
29
+ } = L, [w, x] = l(i(P, a), []), [r, u] = l(i(g), []), S = h(null), c = h(null), [b, v] = l(null), [F, I] = l(null), [D, N] = l(null);
30
+ R(() => {
31
+ const o = i(P, a);
32
+ E(w, o) || x(o);
33
+ }, [P]), R(() => {
34
34
  const o = i(g);
35
- E(s, o) || u(o);
35
+ E(r, o) || u(o);
36
36
  }, [g]);
37
- const N = (o) => {
38
- const e = s.slice(), t = e.find((m) => m.id == o);
39
- t && (t.visible = !t.visible), u(e);
40
- }, R = (o) => {
41
- const e = s.slice(), t = e.find((m) => m.id == o);
42
- t && (t.patternsVisible = t.patternsVisible == null ? !1 : !t.patternsVisible), u(e);
43
- }, q = (o) => {
44
- D(o);
37
+ const q = (o) => {
38
+ const t = r.slice(), e = t.find((f) => f.id == o);
39
+ e && (e.visible = !e.visible), u(t);
45
40
  }, A = (o) => {
46
- const e = s.slice(), t = e.find((m) => m.id == o);
47
- t && (t.colorLayerVisible = t.colorLayerVisible == null ? !1 : !t.colorLayerVisible), u(e);
41
+ const t = r.slice(), e = t.find((f) => f.id == o);
42
+ e && (e.patternsVisible = e.patternsVisible == null ? !1 : !e.patternsVisible), u(t);
43
+ }, B = (o) => {
44
+ N(o);
45
+ }, J = (o) => {
46
+ const t = r.slice(), e = t.find((f) => f.id == o);
47
+ e && (e.colorLayerVisible = e.colorLayerVisible == null ? !1 : !e.colorLayerVisible), u(t);
48
+ }, [W, G] = l(!1), Z = h(0);
49
+ r.length;
50
+ const y = () => {
51
+ Z.current += 1, Z.current === r.length && G(!0);
48
52
  };
49
- return /* @__PURE__ */ a("div", { ref: T, className: "d3map-container", children: /* @__PURE__ */ B(
50
- U,
53
+ return /* @__PURE__ */ n("div", { ref: S, className: "d3map-container", children: /* @__PURE__ */ H(
54
+ $,
51
55
  {
52
- backgroundColor: W(j),
53
- height: w,
54
- width: h,
55
- projectionName: k,
56
- editing: r,
57
- initialPosition: P,
56
+ backgroundColor: O(T),
57
+ height: V,
58
+ width: C,
59
+ projectionName: j,
60
+ editing: a,
61
+ initialPosition: w,
58
62
  children: [
59
- /* @__PURE__ */ a(G, { rotationEnabled: i(z, r), children: s.map((o, e) => {
63
+ /* @__PURE__ */ n(Q, { rotationEnabled: i(z, a), children: r.map((o, t) => {
60
64
  if (o.type === "base")
61
- return /* @__PURE__ */ a(
62
- H,
65
+ return /* @__PURE__ */ n(
66
+ U,
63
67
  {
68
+ minLabelZoomVisible: o.minLabelZoomVisible,
69
+ onReady: y,
64
70
  transform: b,
65
71
  intl: p,
66
- zoom: d,
67
- unique: l,
72
+ zoom: c,
73
+ unique: d,
68
74
  ...o
69
75
  },
70
- e
76
+ t
71
77
  );
72
78
  if (o.type === "data")
73
- return /* @__PURE__ */ a(
74
- K,
79
+ return /* @__PURE__ */ n(
80
+ X,
75
81
  {
76
- editing: r,
77
- onLayerCreated: (t) => {
82
+ minLabelZoomVisible: o.minLabelZoomVisible,
83
+ editing: a,
84
+ onLayerCreated: (e) => {
78
85
  },
86
+ onReady: y,
79
87
  transform: b,
80
88
  intl: p,
81
- group: c,
82
- zoom: d,
83
- unique: l,
89
+ group: m,
90
+ zoom: c,
91
+ unique: d,
84
92
  ...o,
85
93
  settings: L.wordress,
86
- togglePatterns: R,
87
- initialPosition: P,
88
- waitForFilters: n == "true" || n == !0
94
+ togglePatterns: A,
95
+ initialPosition: w,
96
+ waitForFilters: s == "true" || s == !0
89
97
  },
90
- e
98
+ t
91
99
  );
92
100
  if (o.type === "flow")
93
- return /* @__PURE__ */ a(
94
- Y,
101
+ return /* @__PURE__ */ n(
102
+ eo,
95
103
  {
104
+ onReady: y,
96
105
  transform: b,
97
106
  intl: p,
98
- group: c,
99
- zoom: d,
100
- unique: l,
107
+ group: m,
108
+ zoom: c,
109
+ unique: d,
101
110
  ...o,
102
- waitForFilters: n == "true" || n == !0
111
+ waitForFilters: s == "true" || s == !0
103
112
  },
104
- e
113
+ t
105
114
  );
106
115
  if (o.type === "dataPoints")
107
- return /* @__PURE__ */ a(
108
- O,
116
+ return /* @__PURE__ */ n(
117
+ Y,
109
118
  {
110
- onZoomToPoint: q,
111
- selectedItem: C,
119
+ onReady: y,
120
+ onZoomToPoint: B,
121
+ selectedItem: F,
112
122
  transform: b,
113
123
  intl: p,
114
- group: c,
115
- zoom: d,
116
- unique: l,
124
+ group: m,
125
+ zoom: c,
126
+ unique: d,
117
127
  ...o,
118
- waitForFilters: n == "true" || n == !0
128
+ waitForFilters: s == "true" || s == !0
119
129
  },
120
- e
130
+ t
121
131
  );
122
132
  }) }),
123
- /* @__PURE__ */ a(
124
- X,
133
+ /* @__PURE__ */ n(
134
+ oo,
125
135
  {
126
- selectedItem: C,
136
+ selectedItem: F,
127
137
  d2Click: (o) => I(o),
128
138
  patternsData: null,
129
- layers: s,
130
- group: c,
131
- onItemClick: N,
132
- toggleColorLayer: A
139
+ layers: r,
140
+ group: m,
141
+ onItemClick: q,
142
+ toggleColorLayer: J
133
143
  }
134
144
  ),
135
- /* @__PURE__ */ a(
136
- Q,
145
+ /* @__PURE__ */ n(
146
+ _,
137
147
  {
138
- selectedPoint: Z,
139
- rootationEmabled: i(z, r),
140
- zoomEnabled: i(x, r),
148
+ readyToZoom: W,
149
+ selectedPoint: D,
150
+ rootationEmabled: i(z, a),
151
+ zoomEnabled: i(k, a),
141
152
  onZoomed: v,
142
- width: h,
143
- height: w,
144
- ref: d,
145
- group: c,
153
+ width: C,
154
+ height: V,
155
+ ref: c,
156
+ group: m,
146
157
  identifier: M,
147
- editing: r
158
+ editing: a
148
159
  }
149
160
  )
150
161
  ]
151
162
  }
152
163
  ) });
153
- }, $ = (L, l) => ({}), oo = {}, uo = J($, oo)(_);
164
+ }, ao = (L, d) => ({}), ro = {}, go = K(ao, ro)(to);
154
165
  export {
155
- uo as default
166
+ go as default
156
167
  };
@@ -0,0 +1,25 @@
1
+ import { jsx as i } from "react/jsx-runtime";
2
+ import { Dropdown as s } from "semantic-ui-react";
3
+ const f = (n) => {
4
+ const {
5
+ options: t,
6
+ onChange: o
7
+ } = n, a = [{
8
+ key: "all",
9
+ value: "all",
10
+ text: "All"
11
+ }, ...t || []];
12
+ return /* @__PURE__ */ i(
13
+ s,
14
+ {
15
+ ...n,
16
+ options: a,
17
+ onChange: (e, l) => {
18
+ o && (l.value === "all" ? o(e, { ...l, value: void 0 }) : o(e, l));
19
+ }
20
+ }
21
+ );
22
+ };
23
+ export {
24
+ f as default
25
+ };
@@ -1,26 +1,51 @@
1
- import { jsxs as n, jsx as t } from "react/jsx-runtime";
2
- import { Button as m } from "semantic-ui-react";
3
- import { format as c } from "date-fns";
4
- import { decodeHtmlEntitiesToText as u, decodeHtmlEntitiesToHtml as p } from "../../utils/data.js";
5
- const f = (l) => {
6
- var i, o, a, d, s, r;
7
- const { post: e } = l;
8
- return /* @__PURE__ */ n("div", { className: "post-card", children: [
9
- /* @__PURE__ */ t("div", { className: "post-image", children: /* @__PURE__ */ t(
10
- "img",
11
- {
12
- src: e.featured_media_url,
13
- alt: ((i = e.yoast_head_json) == null ? void 0 : i.title) || ((o = e.title) == null ? void 0 : o.rendered)
14
- }
15
- ) }),
16
- /* @__PURE__ */ n("div", { className: "post-content", children: [
17
- /* @__PURE__ */ t("div", { className: "publication-date", children: c(new Date(e.date), "MMM dd, yyyy") }),
18
- /* @__PURE__ */ t("h2", { className: "publication-title", children: u(((a = e.yoast_head_json) == null ? void 0 : a.title) || ((d = e.title) == null ? void 0 : d.rendered) || "Publication Title") }),
19
- /* @__PURE__ */ t("p", { className: "publication-description", dangerouslySetInnerHTML: { __html: p(((s = e.yoast_head_json) == null ? void 0 : s.og_description) || ((r = e.excerpt) == null ? void 0 : r.rendered) || "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.") } }),
20
- /* @__PURE__ */ t(m, { className: "read-more-button", children: "Read more" })
21
- ] })
22
- ] }, e.id);
23
- };
1
+ import { jsxs as l, jsx as t } from "react/jsx-runtime";
2
+ import { useState as m } from "react";
3
+ import { Button as c } from "semantic-ui-react";
4
+ import { format as u } from "date-fns";
5
+ import { decodeHtmlEntitiesToText as h, decodeHtmlEntitiesToHtml as g } from "../../utils/data.js";
6
+ import { MediaProvider as f, MediaConsumer as p } from "@devgateway/wp-react-lib";
7
+ import { injectIntl as v } from "react-intl";
8
+ const M = (i) => {
9
+ const { isPostHovered: e } = i;
10
+ return /* @__PURE__ */ t("div", { className: "post-image", children: /* @__PURE__ */ t(
11
+ "img",
12
+ {
13
+ loading: "lazy",
14
+ className: `${e ? "highlighted" : ""}`,
15
+ src: i.media && i.media.guid ? i.media.guid.rendered : null,
16
+ alt: i.media && i.media.alt_text || ""
17
+ }
18
+ ) });
19
+ }, _ = (i) => {
20
+ var d, n, r, s;
21
+ const { post: e } = i, [a, o] = m(!1);
22
+ return /* @__PURE__ */ l(
23
+ "div",
24
+ {
25
+ className: "post-card",
26
+ onMouseEnter: () => o(!0),
27
+ onMouseLeave: () => o(!1),
28
+ children: [
29
+ /* @__PURE__ */ t("a", { href: e.link, target: "_blank", children: /* @__PURE__ */ t(f, { id: e.featured_media, children: /* @__PURE__ */ t(p, { children: /* @__PURE__ */ t(M, { isPostHovered: a }) }) }) }),
30
+ /* @__PURE__ */ l(
31
+ "div",
32
+ {
33
+ className: "post-content",
34
+ onMouseEnter: () => o(!0),
35
+ onMouseLeave: () => o(!1),
36
+ children: [
37
+ /* @__PURE__ */ t("div", { className: "publication-date", children: u(new Date(e.date), "MMM dd, yyyy") }),
38
+ /* @__PURE__ */ t("a", { href: e.link, target: "_blank", children: /* @__PURE__ */ t("h2", { className: `publication-title ${a ? "highlighted" : ""}`, children: h(((d = e.title) == null ? void 0 : d.rendered) || ((n = e.yoast_head_json) == null ? void 0 : n.title) || "Publication Title") }) }),
39
+ /* @__PURE__ */ t("p", { className: "publication-description", dangerouslySetInnerHTML: { __html: g(((r = e.yoast_head_json) == null ? void 0 : r.og_description) || ((s = e.excerpt) == null ? void 0 : s.rendered) || "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.") } }),
40
+ /* @__PURE__ */ t("a", { href: e.link, children: /* @__PURE__ */ t(c, { className: `read-more-button ${a ? "highlighted" : ""}`, children: "Read more" }) })
41
+ ]
42
+ }
43
+ )
44
+ ]
45
+ },
46
+ e.id
47
+ );
48
+ }, k = v(_);
24
49
  export {
25
- f as default
50
+ k as default
26
51
  };