@devgateway/dvz-ui-react 1.7.15 → 1.8.0
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.
- package/LICENSE +180 -5
- package/README.md +1 -1
- package/dist/cjs/embeddable/chart/Bar.js +1 -1
- package/dist/cjs/embeddable/chart/index.js +1 -1
- package/dist/cjs/embeddable/posts-filter/CategoricalFilter.js +1 -1
- package/dist/cjs/embeddable/posts-filter/index.js +1 -1
- package/dist/cjs/embeddable/posts-filters-reset-button/index.js +1 -1
- package/dist/cjs/embeddable/tabbedposts/index.js +1 -1
- package/dist/cjs/embeddable/vertical-featuredtabs/index.js +2 -2
- package/dist/cjs/layout/Header.js +2 -2
- package/dist/esm/embeddable/chart/Bar.js +199 -191
- package/dist/esm/embeddable/chart/index.js +465 -453
- package/dist/esm/embeddable/posts-filter/CategoricalFilter.js +50 -48
- package/dist/esm/embeddable/posts-filter/index.js +83 -83
- package/dist/esm/embeddable/posts-filters-reset-button/index.js +29 -23
- package/dist/esm/embeddable/tabbedposts/index.js +109 -165
- package/dist/esm/embeddable/vertical-featuredtabs/index.js +193 -243
- package/dist/esm/layout/Header.js +116 -116
- package/dist/types/layout/Header.d.ts +2 -0
- package/package.json +6 -3
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
import { jsx as e, jsxs as u } from "react/jsx-runtime";
|
|
2
|
-
import { Menu as d, Container as
|
|
3
|
-
import
|
|
4
|
-
import { utils as
|
|
5
|
-
import { injectIntl as
|
|
6
|
-
import { useParams as
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
const
|
|
2
|
+
import { Menu as d, Container as N, Flag as U, Image as j } from "semantic-ui-react";
|
|
3
|
+
import E, { useEffect as p, useState as g, useRef as W } from "react";
|
|
4
|
+
import { utils as H, MenuProvider as A, MediaProvider as V, MediaConsumer as B, MenuConsumer as b } from "@devgateway/wp-react-lib";
|
|
5
|
+
import { injectIntl as T } from "react-intl";
|
|
6
|
+
import { useParams as y } from "react-router";
|
|
7
|
+
import K from "./SearchControl.js";
|
|
8
|
+
import q from "./LangSwitcher.js";
|
|
9
|
+
const F = (r, l) => {
|
|
10
10
|
const t = [];
|
|
11
11
|
return r.items.forEach((i) => {
|
|
12
12
|
i.child_items ? i.child_items.forEach((a) => {
|
|
13
|
-
a.slug ==
|
|
14
|
-
}) : i.slug ==
|
|
13
|
+
a.slug == l.slug && (t.push(i), t.push(a));
|
|
14
|
+
}) : i.slug == l.slug && i.url != "/" && t.push(i);
|
|
15
15
|
}), t;
|
|
16
|
-
},
|
|
16
|
+
}, S = (r, l) => {
|
|
17
17
|
if (r) {
|
|
18
18
|
const t = r.indexOf("/wp");
|
|
19
19
|
if (t !== -1) {
|
|
20
20
|
const i = r.substr(t + 3);
|
|
21
|
-
return i.startsWith("/" +
|
|
21
|
+
return i.startsWith("/" + l) ? i : "/" + l + i;
|
|
22
22
|
} else
|
|
23
|
-
return r.startsWith("/" +
|
|
23
|
+
return r.startsWith("/" + l) ? r : "/" + l + r;
|
|
24
24
|
}
|
|
25
25
|
return "";
|
|
26
|
-
},
|
|
27
|
-
const t =
|
|
28
|
-
return /* @__PURE__ */ e(
|
|
26
|
+
}, G = T(({ menu: r, intl: l }) => {
|
|
27
|
+
const t = y(), i = F(r, t);
|
|
28
|
+
return /* @__PURE__ */ e(E.Fragment, { children: i.filter((a) => a.url != "#wpm-languages").map(
|
|
29
29
|
(a) => a.child_items ? /* @__PURE__ */ u("span", { children: [
|
|
30
30
|
a.post_title,
|
|
31
31
|
" "
|
|
@@ -33,7 +33,7 @@ const W = (r, s) => {
|
|
|
33
33
|
"a",
|
|
34
34
|
{
|
|
35
35
|
className: a.slug == t.slug ? "active" : "",
|
|
36
|
-
href:
|
|
36
|
+
href: H.replaceLink(a.url, l.locale),
|
|
37
37
|
children: [
|
|
38
38
|
" ",
|
|
39
39
|
a.post_title
|
|
@@ -41,53 +41,53 @@ const W = (r, s) => {
|
|
|
41
41
|
}
|
|
42
42
|
)
|
|
43
43
|
) });
|
|
44
|
-
}),
|
|
44
|
+
}), O = T(
|
|
45
45
|
({
|
|
46
46
|
settings: r,
|
|
47
|
-
withIcons:
|
|
47
|
+
withIcons: l,
|
|
48
48
|
active: t,
|
|
49
49
|
menu: i,
|
|
50
50
|
onSetSelected: a,
|
|
51
51
|
selected: o,
|
|
52
|
-
intl: { locale:
|
|
53
|
-
isSmallScreen:
|
|
52
|
+
intl: { locale: f },
|
|
53
|
+
isSmallScreen: L
|
|
54
54
|
}) => {
|
|
55
|
-
const z =
|
|
56
|
-
|
|
55
|
+
const z = y();
|
|
56
|
+
p(
|
|
57
57
|
(n) => {
|
|
58
|
-
const
|
|
59
|
-
|
|
58
|
+
const s = F(i, z).filter((_) => _.menu_item_parent == 0);
|
|
59
|
+
s && s.length > 0 ? a(s[0]) : a(null);
|
|
60
60
|
},
|
|
61
61
|
[i, a, z.slug]
|
|
62
62
|
);
|
|
63
|
-
const [v,
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
}, [i]),
|
|
63
|
+
const [v, w] = g(null);
|
|
64
|
+
p(() => {
|
|
65
|
+
w(i);
|
|
66
|
+
}, [i]), p(() => {
|
|
67
67
|
if (r && r.menu_settings && v) {
|
|
68
|
-
const n = [],
|
|
69
|
-
...
|
|
70
|
-
...r.menu_settings["nav_menu_item[" +
|
|
71
|
-
}) :
|
|
72
|
-
Object.keys(r.menu_settings).map((
|
|
73
|
-
const
|
|
74
|
-
if (
|
|
75
|
-
const
|
|
76
|
-
|
|
68
|
+
const n = [], m = i.items.map((s) => (r.menu_settings && r.menu_settings["nav_menu_item[" + s.ID + "]"] === !1 && n.push(s.ID), r.menu_settings && r.menu_settings["nav_menu_item[" + s.ID + "]"] ? (r.menu_settings["nav_menu_item[" + s.ID + "]"], {
|
|
69
|
+
...s,
|
|
70
|
+
...r.menu_settings["nav_menu_item[" + s.ID + "]"]
|
|
71
|
+
}) : s));
|
|
72
|
+
Object.keys(r.menu_settings).map((s) => {
|
|
73
|
+
const _ = r.menu_settings[s];
|
|
74
|
+
if (_.type == "nav_menu_item") {
|
|
75
|
+
const D = /(-)?[0-9]+/g.exec(s), C = parseInt(D[0]);
|
|
76
|
+
m.find(($) => $.ID == C) || m.push(_.value);
|
|
77
77
|
}
|
|
78
|
-
}),
|
|
78
|
+
}), w({
|
|
79
79
|
...i,
|
|
80
|
-
items:
|
|
80
|
+
items: m.filter((s) => n.indexOf(s.ID) === -1)
|
|
81
81
|
});
|
|
82
82
|
}
|
|
83
83
|
}, [r]);
|
|
84
|
-
const [
|
|
85
|
-
return
|
|
84
|
+
const [k, I] = g(!1);
|
|
85
|
+
return p(() => {
|
|
86
86
|
const n = () => {
|
|
87
|
-
|
|
87
|
+
I(window.innerWidth <= 1200);
|
|
88
88
|
};
|
|
89
89
|
return n(), window.addEventListener("resize", n), () => window.removeEventListener("resize", n);
|
|
90
|
-
}, []), v && /* @__PURE__ */ e(
|
|
90
|
+
}, []), v && /* @__PURE__ */ e(E.Fragment, { children: v.items.filter((n) => n.url !== "#wpm-languages").map((n, m) => /* @__PURE__ */ u(E.Fragment, { children: [
|
|
91
91
|
/* @__PURE__ */ u(
|
|
92
92
|
d.Item,
|
|
93
93
|
{
|
|
@@ -95,84 +95,84 @@ const W = (r, s) => {
|
|
|
95
95
|
${o && o.ID === n.ID ? "selected" : ""}
|
|
96
96
|
${t === n.slug ? "active" : ""}`,
|
|
97
97
|
children: [
|
|
98
|
-
|
|
99
|
-
|
|
98
|
+
l && /* @__PURE__ */ e("a", { href: S(n.url, f), children: /* @__PURE__ */ e("div", { className: "mark", children: /* @__PURE__ */ e("span", { className: "sr-only", children: n.title }) }) }),
|
|
99
|
+
L ? n.child_items ? /* @__PURE__ */ e(
|
|
100
100
|
"span",
|
|
101
101
|
{
|
|
102
102
|
onClick: () => a(o === n ? null : n),
|
|
103
103
|
children: n.title
|
|
104
104
|
}
|
|
105
|
-
) : /* @__PURE__ */ e("a", { href:
|
|
105
|
+
) : /* @__PURE__ */ e("a", { href: S(n.url, f), children: n.title }) : n.child_items ? /* @__PURE__ */ e(
|
|
106
106
|
"span",
|
|
107
107
|
{
|
|
108
|
-
onMouseOver: (
|
|
108
|
+
onMouseOver: (s) => a(n),
|
|
109
109
|
onClick: () => a(o === n ? null : n),
|
|
110
110
|
children: n.title
|
|
111
111
|
}
|
|
112
112
|
) : /* @__PURE__ */ e(
|
|
113
113
|
"a",
|
|
114
114
|
{
|
|
115
|
-
onMouseOut: (
|
|
116
|
-
onMouseOver: (
|
|
117
|
-
href:
|
|
115
|
+
onMouseOut: (s) => a(null),
|
|
116
|
+
onMouseOver: (s) => a(n),
|
|
117
|
+
href: S(n.url, f),
|
|
118
118
|
children: n.title
|
|
119
119
|
}
|
|
120
120
|
)
|
|
121
121
|
]
|
|
122
122
|
}
|
|
123
123
|
),
|
|
124
|
-
|
|
124
|
+
k && o && o.ID === n.ID && o.child_items && /* @__PURE__ */ e(E.Fragment, { children: o.child_items.map((s) => /* @__PURE__ */ u(
|
|
125
125
|
d.Item,
|
|
126
126
|
{
|
|
127
|
-
className: `divided child-item ${t ===
|
|
127
|
+
className: `divided child-item ${t === s.slug ? "active" : ""}`,
|
|
128
128
|
children: [
|
|
129
129
|
/* @__PURE__ */ e("div", { className: "mark" }),
|
|
130
|
-
/* @__PURE__ */ e("a", { href:
|
|
130
|
+
/* @__PURE__ */ e("a", { href: S(s.url, f), children: s.title })
|
|
131
131
|
]
|
|
132
132
|
},
|
|
133
|
-
|
|
133
|
+
s.ID
|
|
134
134
|
)) })
|
|
135
135
|
] }, n.ID)) });
|
|
136
136
|
}
|
|
137
|
-
),
|
|
138
|
-
const [
|
|
139
|
-
|
|
137
|
+
), J = ({ intl: r, settings: l, logoSmallSrc: t = "/logo_small.png" }) => {
|
|
138
|
+
const [i, a] = g(), [o, f] = g(!1), [L, z] = g(!1), [v, w] = g(!1), [k, I] = g(!1), { slug: n } = y(), m = W(null), s = W(null), _ = () => {
|
|
139
|
+
I(!k), f(!o);
|
|
140
140
|
};
|
|
141
|
-
|
|
142
|
-
const c = (
|
|
143
|
-
(
|
|
144
|
-
},
|
|
145
|
-
|
|
141
|
+
p(() => {
|
|
142
|
+
const c = (h) => {
|
|
143
|
+
(m.current && !m.current.contains(h.target) && !s.current.contains(h.target) || h.target.closest(".desktop") || h.target.closest(".breadcrumbs")) && (f(!1), I(!1));
|
|
144
|
+
}, M = (h) => {
|
|
145
|
+
h.key === "Escape" && (f(!1), I(!1));
|
|
146
146
|
};
|
|
147
|
-
return document.addEventListener("mousedown", c), document.addEventListener("keydown",
|
|
148
|
-
document.removeEventListener("mousedown", c), document.removeEventListener("keydown",
|
|
147
|
+
return document.addEventListener("mousedown", c), document.addEventListener("keydown", M), () => {
|
|
148
|
+
document.removeEventListener("mousedown", c), document.removeEventListener("keydown", M);
|
|
149
149
|
};
|
|
150
|
-
}, []),
|
|
150
|
+
}, []), p(() => {
|
|
151
151
|
let c;
|
|
152
|
-
const
|
|
153
|
-
const
|
|
154
|
-
|
|
155
|
-
},
|
|
156
|
-
|
|
152
|
+
const M = () => {
|
|
153
|
+
const P = window.innerWidth <= 1200;
|
|
154
|
+
z(P), w(!1);
|
|
155
|
+
}, h = () => {
|
|
156
|
+
w(!0), clearTimeout(c), c = setTimeout(M, 300);
|
|
157
157
|
};
|
|
158
|
-
return
|
|
159
|
-
clearTimeout(c), window.removeEventListener("resize",
|
|
158
|
+
return M(), window.addEventListener("resize", h), () => {
|
|
159
|
+
clearTimeout(c), window.removeEventListener("resize", h);
|
|
160
160
|
};
|
|
161
161
|
}, []);
|
|
162
|
-
const [
|
|
163
|
-
|
|
162
|
+
const [x, D] = g(!1);
|
|
163
|
+
p(() => {
|
|
164
164
|
const c = () => {
|
|
165
|
-
|
|
165
|
+
D(window.innerWidth <= 1364);
|
|
166
166
|
};
|
|
167
167
|
return c(), window.addEventListener("resize", c), () => window.removeEventListener("resize", c);
|
|
168
168
|
}, []);
|
|
169
|
-
const
|
|
170
|
-
return /* @__PURE__ */ e(
|
|
171
|
-
/* @__PURE__ */ u(
|
|
172
|
-
/* @__PURE__ */ e(
|
|
173
|
-
/* @__PURE__ */ e(d.Item, { children: /* @__PURE__ */ u("a", { href: `${
|
|
174
|
-
|
|
175
|
-
|
|
169
|
+
const C = ({ media: c }) => c ? /* @__PURE__ */ e(j, { src: c.guid.rendered }) : /* @__PURE__ */ e("img", { className: "brand logo", size: "large", src: "/logo_full.png" }), R = (l == null ? void 0 : l.landing_page_url) && l.landing_page_url !== !1 && l.landing_page_url !== void 0 && l.landing_page_url !== "", $ = R ? l.landing_page_url : `/${r.locale}`;
|
|
170
|
+
return /* @__PURE__ */ e(E.Fragment, { children: /* @__PURE__ */ u(A, { slug: "main", locale: r.locale, children: [
|
|
171
|
+
/* @__PURE__ */ u(N, { fluid: !0, className: "header", children: [
|
|
172
|
+
/* @__PURE__ */ e(N, { fluid: !0, className: "background", ref: m, children: /* @__PURE__ */ u(d, { className: "branding", text: !0, children: [
|
|
173
|
+
/* @__PURE__ */ e(d.Item, { children: /* @__PURE__ */ u("a", { href: `${$}`, target: R ? "_blank" : "_self", rel: "noopener noreferrer", id: "site_url", children: [
|
|
174
|
+
l.site_logo !== 0 && !x && /* @__PURE__ */ e(V, { id: l.site_logo, children: /* @__PURE__ */ e(B, { children: /* @__PURE__ */ e(C, {}, "logo") }) }),
|
|
175
|
+
l.site_logo === 0 && !x && /* @__PURE__ */ e(
|
|
176
176
|
"img",
|
|
177
177
|
{
|
|
178
178
|
className: "brand logo",
|
|
@@ -180,60 +180,60 @@ const W = (r, s) => {
|
|
|
180
180
|
src: "/logo_full.png"
|
|
181
181
|
}
|
|
182
182
|
),
|
|
183
|
-
|
|
183
|
+
x && /* @__PURE__ */ e(
|
|
184
184
|
"img",
|
|
185
185
|
{
|
|
186
186
|
className: "brand logo small",
|
|
187
187
|
size: "small",
|
|
188
|
-
src:
|
|
188
|
+
src: t
|
|
189
189
|
}
|
|
190
190
|
)
|
|
191
191
|
] }) }),
|
|
192
192
|
/* @__PURE__ */ e(d.Item, { className: "divider", children: /* @__PURE__ */ e("div", {}) }),
|
|
193
193
|
/* @__PURE__ */ u(d.Item, { fitted: !0, href: "/", children: [
|
|
194
|
-
/* @__PURE__ */ e(
|
|
195
|
-
/* @__PURE__ */ e("div", { className: "site name", children:
|
|
194
|
+
/* @__PURE__ */ e(U, { name: "za" }),
|
|
195
|
+
/* @__PURE__ */ e("div", { className: "site name", children: l.name })
|
|
196
196
|
] }),
|
|
197
|
-
!
|
|
198
|
-
|
|
197
|
+
!v && (L ? /* @__PURE__ */ e(d, { className: `pages ${o ? "show" : ""}`, children: /* @__PURE__ */ e(N, { fluid: !0, children: /* @__PURE__ */ e(b, { children: /* @__PURE__ */ e(
|
|
198
|
+
O,
|
|
199
199
|
{
|
|
200
|
-
settings:
|
|
201
|
-
active:
|
|
202
|
-
selected:
|
|
203
|
-
onSetSelected:
|
|
204
|
-
isSmallScreen:
|
|
200
|
+
settings: l,
|
|
201
|
+
active: n,
|
|
202
|
+
selected: i,
|
|
203
|
+
onSetSelected: a,
|
|
204
|
+
isSmallScreen: L
|
|
205
205
|
},
|
|
206
206
|
"items"
|
|
207
|
-
) }) }) }) : /* @__PURE__ */ e(d.Menu, { className: "pages", children: /* @__PURE__ */ e(
|
|
208
|
-
|
|
207
|
+
) }) }) }) : /* @__PURE__ */ e(d.Menu, { className: "pages", children: /* @__PURE__ */ e(b, { children: /* @__PURE__ */ e(
|
|
208
|
+
O,
|
|
209
209
|
{
|
|
210
|
-
settings:
|
|
211
|
-
active:
|
|
212
|
-
selected:
|
|
213
|
-
onSetSelected:
|
|
210
|
+
settings: l,
|
|
211
|
+
active: n,
|
|
212
|
+
selected: i,
|
|
213
|
+
onSetSelected: a
|
|
214
214
|
},
|
|
215
215
|
"items"
|
|
216
216
|
) }) })),
|
|
217
|
-
/* @__PURE__ */ e(d.Item, { children: /* @__PURE__ */ e(
|
|
218
|
-
|
|
217
|
+
/* @__PURE__ */ e(d.Item, { children: /* @__PURE__ */ e(b, { children: /* @__PURE__ */ e(
|
|
218
|
+
q,
|
|
219
219
|
{
|
|
220
220
|
locale: r.locale
|
|
221
221
|
},
|
|
222
222
|
"lang"
|
|
223
223
|
) }) }),
|
|
224
|
-
/* @__PURE__ */ e(d.Item, { fitted: !0, children: /* @__PURE__ */ e(
|
|
225
|
-
|
|
224
|
+
/* @__PURE__ */ e(d.Item, { fitted: !0, children: /* @__PURE__ */ e(b, { children: /* @__PURE__ */ e(
|
|
225
|
+
K,
|
|
226
226
|
{
|
|
227
|
-
onSetSelected:
|
|
228
|
-
settings:
|
|
227
|
+
onSetSelected: a,
|
|
228
|
+
settings: l
|
|
229
229
|
}
|
|
230
230
|
) }) }),
|
|
231
231
|
/* @__PURE__ */ u(
|
|
232
232
|
"div",
|
|
233
233
|
{
|
|
234
|
-
ref:
|
|
235
|
-
className: `hamburger-menu ${
|
|
236
|
-
onClick:
|
|
234
|
+
ref: s,
|
|
235
|
+
className: `hamburger-menu ${k ? "animate" : ""} ${o ? "open" : "close"}`,
|
|
236
|
+
onClick: _,
|
|
237
237
|
children: [
|
|
238
238
|
/* @__PURE__ */ e("div", {}),
|
|
239
239
|
/* @__PURE__ */ e("div", { className: "middle-line" }),
|
|
@@ -242,20 +242,20 @@ const W = (r, s) => {
|
|
|
242
242
|
}
|
|
243
243
|
)
|
|
244
244
|
] }) }),
|
|
245
|
-
/* @__PURE__ */ e(
|
|
246
|
-
|
|
245
|
+
/* @__PURE__ */ e(N, { fluid: !0, className: "child", children: i && i.child_items && /* @__PURE__ */ e(d, { fluid: !0, text: !0, children: /* @__PURE__ */ e(
|
|
246
|
+
O,
|
|
247
247
|
{
|
|
248
|
-
active:
|
|
248
|
+
active: n,
|
|
249
249
|
locale: r.locale,
|
|
250
250
|
withIcons: !0,
|
|
251
251
|
onSetSelected: (c) => null,
|
|
252
|
-
menu: { items:
|
|
252
|
+
menu: { items: i.child_items }
|
|
253
253
|
}
|
|
254
254
|
) }) })
|
|
255
255
|
] }, "header-container"),
|
|
256
|
-
/* @__PURE__ */ e(
|
|
256
|
+
/* @__PURE__ */ e(N, { className: "url breadcrumbs", children: /* @__PURE__ */ e(b, { children: /* @__PURE__ */ e(G, {}) }) })
|
|
257
257
|
] }) });
|
|
258
|
-
},
|
|
258
|
+
}, le = T(J);
|
|
259
259
|
export {
|
|
260
|
-
|
|
260
|
+
le as default
|
|
261
261
|
};
|
|
@@ -2,10 +2,12 @@ import { default as React } from 'react';
|
|
|
2
2
|
declare const _default: React.FC<import('react-intl').WithIntlProps<{
|
|
3
3
|
intl: any;
|
|
4
4
|
settings: any;
|
|
5
|
+
logoSmallSrc?: string | undefined;
|
|
5
6
|
}>> & {
|
|
6
7
|
WrappedComponent: React.ComponentType<{
|
|
7
8
|
intl: any;
|
|
8
9
|
settings: any;
|
|
10
|
+
logoSmallSrc?: string | undefined;
|
|
9
11
|
}>;
|
|
10
12
|
};
|
|
11
13
|
export default _default;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@devgateway/dvz-ui-react",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.8.0",
|
|
4
4
|
"main": "dist/cjs/index.js",
|
|
5
5
|
"module": "dist/esm/index.js",
|
|
6
6
|
"types": "dist/types/index.d.ts",
|
|
@@ -20,8 +20,11 @@
|
|
|
20
20
|
"react-ui-library",
|
|
21
21
|
"react-ui-components"
|
|
22
22
|
],
|
|
23
|
-
"author": "
|
|
24
|
-
"
|
|
23
|
+
"author": "Sebastian Dimunzio <sdimunzio@gmail.com>",
|
|
24
|
+
"contributors": [
|
|
25
|
+
"Timothy Gachengo (https://github.com/timothygachengo)"
|
|
26
|
+
],
|
|
27
|
+
"license": "Apache-2.0",
|
|
25
28
|
"description": "A modular, embeddable React component library for data visualization and UI, built with TypeScript. Provides reusable components for charts, maps, dashboards, and more, with built-in support for internationalization and Redux integration.",
|
|
26
29
|
"repository": {
|
|
27
30
|
"type": "git",
|