@devgateway/dvz-ui-react 1.6.1 → 1.6.2

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,88 +1,89 @@
1
- import { jsx as a, jsxs as p, Fragment as L } from "react/jsx-runtime";
2
- import { useState as l, useEffect as $ } from "react";
3
- import { injectIntl as me } from "react-intl";
4
- import { ResponsivePie as pe } from "@nivo/pie";
5
- import ue, { formatContent as he } from "./Tooltip.js";
1
+ import { jsx as r, jsxs as p, Fragment as L } from "react/jsx-runtime";
2
+ import { useState as l, useEffect as M } from "react";
3
+ import { injectIntl as pe } from "react-intl";
4
+ import { ResponsivePie as ue } from "@nivo/pie";
5
+ import fe, { formatContent as ge } from "./Tooltip.js";
6
6
  import "@nivo/colors";
7
7
  import "d3";
8
- import { v4 as fe } from "uuid";
9
- import ge from "../../layout/FlexWrapDetector.js";
10
- const be = ({
11
- legends: Le,
8
+ import { v4 as he } from "uuid";
9
+ import be from "../../layout/FlexWrapDetector.js";
10
+ import Le from "../../utils/deviceType.js";
11
+ const $ = Le() === "mobile", xe = ({
12
+ legends: ke,
12
13
  marginLeft: j,
13
14
  marginTop: x,
14
15
  marginRight: w,
15
16
  marginBottom: k,
16
17
  options: u,
17
- intl: h,
18
- format: f,
19
- colors: xe,
20
- groupMode: ke,
18
+ intl: f,
19
+ format: g,
20
+ colors: ve,
21
+ groupMode: Ce,
21
22
  tooltipEnabled: B,
22
23
  height: I,
23
24
  showLegends: v,
24
- legendPosition: r,
25
- tickRotation: ve,
26
- tickColor: Ce,
27
- tooltip: i,
28
- startAngle: M,
29
- endAngle: z,
25
+ legendPosition: a,
26
+ tickRotation: ye,
27
+ tickColor: Ne,
28
+ tooltip: s,
29
+ startAngle: z,
30
+ endAngle: O,
30
31
  legendLabel: C,
31
32
  legendCheckBack: y,
32
- legendLabelBack: O,
33
- legendLabelColor: V,
34
- centerLabel: R,
35
- showArcLabels: H,
36
- showArcLinkLabels: E,
37
- slicePadding: X,
33
+ legendLabelBack: V,
34
+ legendLabelColor: R,
35
+ centerLabel: H,
36
+ showArcLabels: E,
37
+ showArcLinkLabels: X,
38
+ slicePadding: Y,
38
39
  colorGenerator: N,
39
- centerLabelFontWeight: Y,
40
- centerLabelFontSize: q,
41
- centerLabelXOffset: J,
42
- centerLabelYOffset: K,
43
- tooltipEnableMarkdown: Q,
44
- reverseLegend: U,
45
- showPercentage: Z
40
+ centerLabelFontWeight: q,
41
+ centerLabelFontSize: J,
42
+ centerLabelXOffset: K,
43
+ centerLabelYOffset: Q,
44
+ tooltipEnableMarkdown: U,
45
+ reverseLegend: Z,
46
+ showPercentage: _
46
47
  }) => {
47
- const [c, _] = l([]), [G, P] = l(i), [o, ee] = l(u), [S, te] = l(50), [A, ae] = l(x), [ye, T] = l(0), [W, re] = l(k), d = o.data.sort((e, t) => e.position && t.position ? e.position - t.position : 0).map((e, t) => ({
48
+ const [c, G] = l([]), [P, ee] = l(s), [o, te] = l(u), [S, re] = l(50), [T, ae] = l(x), [Se, A] = l(0), [D, ne] = l(k), d = o.data.sort((e, t) => e.position && t.position ? e.position - t.position : 0).map((e, t) => ({
48
49
  color: N.getColor(e.id, e),
49
50
  id: e.id,
50
51
  label: e.label
51
52
  }));
52
- $(() => {
53
- P(i), ee({
53
+ M(() => {
54
+ ee(s), te({
54
55
  ...u,
55
- id: fe()
56
+ id: he()
56
57
  });
57
- }, [i, u]), $(() => {
58
+ }, [s, u]), M(() => {
58
59
  (() => {
59
60
  const n = 5 * Math.max(d.length - 5, 0);
60
- te(n);
61
+ re(n);
61
62
  })();
62
63
  }, [d]);
63
- const ne = {
64
+ const oe = {
64
65
  bottom: `-${S}px`
65
- }, oe = {
66
+ }, le = {
66
67
  bottom: `-${S}px`,
67
68
  gap: "0px"
68
- }, le = (e) => {
69
+ }, ie = (e) => {
69
70
  const t = c.slice();
70
71
  if (t.indexOf(e) > -1) {
71
72
  const n = t.indexOf(e);
72
73
  t.splice(n, 1);
73
74
  } else
74
75
  t.push(e);
75
- _(t);
76
+ G(t);
76
77
  }, se = (e) => c ? e.filter((t) => c.indexOf(t.id) === -1) : e;
77
78
  if (!o || !o.data)
78
79
  return null;
79
- const ie = {
80
- top: A,
80
+ const ce = {
81
+ top: T,
81
82
  right: w,
82
- bottom: W,
83
+ bottom: D,
83
84
  left: j
84
- }, D = () => /* @__PURE__ */ a(L, { children: v && C && /* @__PURE__ */ a("div", { className: "legend item", children: /* @__PURE__ */ a("label", { className: "legend-title", children: C }) }) }), F = () => (U && d.reverse(), /* @__PURE__ */ a(L, { children: v && d.map((e) => /* @__PURE__ */ p("div", { className: "legend item", onClick: () => le(e.id), children: [
85
- /* @__PURE__ */ a(
85
+ }, W = () => /* @__PURE__ */ r(L, { children: v && C && /* @__PURE__ */ r("div", { className: "legend item", children: /* @__PURE__ */ r("label", { className: "legend-title", children: C }) }) }), F = () => (Z && d.reverse(), /* @__PURE__ */ r(L, { children: v && d.map((e) => /* @__PURE__ */ p("div", { className: "legend item", onClick: () => ie(e.id), children: [
86
+ /* @__PURE__ */ r(
86
87
  "input",
87
88
  {
88
89
  className: "ignore",
@@ -90,7 +91,7 @@ const be = ({
90
91
  checked: c.length == 0 || !c.includes(e.id)
91
92
  }
92
93
  ),
93
- /* @__PURE__ */ a(
94
+ /* @__PURE__ */ r(
94
95
  "span",
95
96
  {
96
97
  className: y ? "checkmark-with-bg" : "checkmark",
@@ -99,80 +100,80 @@ const be = ({
99
100
  }
100
101
  }
101
102
  ),
102
- /* @__PURE__ */ a(
103
+ /* @__PURE__ */ r(
103
104
  "label",
104
105
  {
105
106
  style: {
106
- backgroundColor: O == !0 ? e.color : "transparent",
107
- color: V
107
+ backgroundColor: V == !0 ? e.color : "transparent",
108
+ color: R
108
109
  },
109
110
  children: e.label
110
111
  }
111
112
  )
112
- ] })) })), ce = (e) => {
113
- const { centerX: t, centerY: n } = e, s = R.split(/[\r\n]/g);
113
+ ] })) })), de = (e) => {
114
+ const { centerX: t, centerY: n } = e, i = H.split(/[\r\n]/g);
114
115
  let m = 0;
115
116
  return e.dataWithArc && (m = e.dataWithArc.reduce(
116
- function(g, b) {
117
- return g + b.value;
117
+ function(h, b) {
118
+ return h + b.value;
118
119
  },
119
120
  0
120
- )), /* @__PURE__ */ a(
121
+ )), /* @__PURE__ */ r(
121
122
  "text",
122
123
  {
123
124
  x: t,
124
125
  y: n,
125
126
  textAnchor: "start",
126
127
  dominantBaseline: "central",
127
- children: s.map((g, b) => /* @__PURE__ */ a(
128
+ children: i.map((h, b) => /* @__PURE__ */ r(
128
129
  "tspan",
129
130
  {
130
- x: t + parseInt(J),
131
- y: n + parseInt(K) + b * 20,
131
+ x: t + parseInt(K),
132
+ y: n + parseInt(Q) + b * 20,
132
133
  style: {
133
- fontSize: q + "px",
134
- fontWeight: Y,
134
+ fontSize: J + "px",
135
+ fontWeight: q,
135
136
  fill: "#000"
136
137
  },
137
- children: he(g, { totalValue: m }, h)
138
+ children: ge(h, { totalValue: m }, f)
138
139
  }
139
140
  ))
140
141
  }
141
142
  );
142
- }, de = (e, t) => {
143
+ }, me = (e, t) => {
143
144
  if (t) {
144
- const n = e.reduce((s, m) => s + m.value, 0);
145
- return e.map((s) => ({
146
- ...s,
147
- value: s.value / n * 100
145
+ const n = e.reduce((i, m) => i + m.value, 0);
146
+ return e.map((i) => ({
147
+ ...i,
148
+ value: i.value / n * 100
148
149
  }));
149
150
  }
150
151
  return e;
151
152
  };
152
- return /* @__PURE__ */ a("div", { style: { height: I }, className: "pie-chart", children: o && o.data && o.data.length > 0 && /* @__PURE__ */ p(L, { children: [
153
- /* @__PURE__ */ a(
154
- pe,
153
+ return /* @__PURE__ */ r("div", { style: { height: I }, className: "pie-chart", children: o && o.data && o.data.length > 0 && /* @__PURE__ */ p(L, { children: [
154
+ /* @__PURE__ */ r(
155
+ ue,
155
156
  {
156
- data: se(de(o.data, Z)),
157
- margin: ie,
158
- startAngle: M,
159
- endAngle: z,
157
+ data: se(me(o.data, _)),
158
+ margin: ce,
159
+ startAngle: z,
160
+ endAngle: O,
160
161
  sortByValue: !0,
161
162
  innerRadius: 0.7,
162
- padAngle: X,
163
+ padAngle: Y,
163
164
  cornerRadius: 3,
164
165
  colors: (e) => N.getColor(e.id, e.data),
165
166
  borderWidth: 1,
166
167
  borderColor: { from: "color", modifiers: [["brighter", "2"]] },
167
- enableArcLabels: H,
168
- enableArcLinkLabels: E,
168
+ enableArcLabels: E,
169
+ enableArcLinkLabels: X,
169
170
  arcLabelsTextColor: "#333333",
170
171
  arcLinkLabelsSkipAngle: 5,
171
172
  arcLabelsSkipAngle: 15,
172
173
  sliceLabelsSkipAngle: 20,
173
- arcLabel: (e) => h.formatNumber(
174
- f.style === "percent" ? e.value / 100 : e.value,
175
- f
174
+ arcLabel: (e) => f.formatNumber(
175
+ g.style === "percent" ? e.value / 100 : e.value,
176
+ g
176
177
  ),
177
178
  radialLabelsSkipAngle: 20,
178
179
  radialLabelsTextColor: "#333333",
@@ -187,7 +188,7 @@ const be = ({
187
188
  "arcs",
188
189
  "arcLabels",
189
190
  "legends",
190
- ce
191
+ de
191
192
  ],
192
193
  animate: !0,
193
194
  motionStiffness: 90,
@@ -199,32 +200,32 @@ const be = ({
199
200
  const t = e.datum.arc.angleDeg / 360 * 100;
200
201
  e.datum.data.variables.valuePercent = t, e.datum.data.variables.category = e.datum.id;
201
202
  }
202
- return B && i && i.trim().length > 0 ? /* @__PURE__ */ a(
203
- ue,
203
+ return B && s && s.trim().length > 0 ? /* @__PURE__ */ r(
204
+ fe,
204
205
  {
205
- intl: h,
206
- format: f,
206
+ intl: f,
207
+ format: g,
207
208
  d: e,
208
- tooltip: G,
209
- tooltipEnableMarkdown: Q
209
+ tooltip: P,
210
+ tooltipEnableMarkdown: U
210
211
  }
211
212
  ) : null;
212
213
  }
213
214
  },
214
215
  o.id
215
216
  ),
216
- (r === "top" || r === "bottom") && /* @__PURE__ */ a(
217
+ (a === "top" || a === "bottom") && /* @__PURE__ */ r(
217
218
  "div",
218
219
  {
219
- className: `legends container has-standard-12-font-size ${r}`,
220
- style: r === "top" ? { marginTop: `${A}px` } : r === "bottom" ? { marginBottom: `${W}px` } : {},
220
+ className: `legends container has-standard-12-font-size ${a}`,
221
+ style: a === "top" ? { marginTop: $ && `${T}px` } : a === "bottom" ? { marginBottom: `${D}px` } : {},
221
222
  children: /* @__PURE__ */ p("div", { className: "legend-sections", children: [
222
- /* @__PURE__ */ a("div", { className: "title-section", children: D() }),
223
- /* @__PURE__ */ a(
224
- ge,
223
+ /* @__PURE__ */ r("div", { className: "title-section", children: W() }),
224
+ /* @__PURE__ */ r(
225
+ be,
225
226
  {
226
227
  onWrapChange: (e) => {
227
- r === "top" ? (ae(x + e / 2 * 40), T(e)) : (re(k + e / 2 * 25), T(e));
228
+ a === "top" && $ ? (ae(x + e / 2 * 40), A(e)) : (ne(k + e / 2 * 25), A(e));
228
229
  },
229
230
  className: "legends container has-standard-12-font-size items-section",
230
231
  children: F()
@@ -233,19 +234,19 @@ const be = ({
233
234
  ] })
234
235
  }
235
236
  ),
236
- (r === "right" || r === "left") && /* @__PURE__ */ p(
237
+ (a === "right" || a === "left") && /* @__PURE__ */ p(
237
238
  "div",
238
239
  {
239
- className: `legends container has-standard-12-font-size ${r}`,
240
- style: r === "right" ? ne : oe,
240
+ className: `legends container has-standard-12-font-size ${a}`,
241
+ style: a === "right" ? oe : le,
241
242
  children: [
242
- D(),
243
+ W(),
243
244
  F()
244
245
  ]
245
246
  }
246
247
  )
247
248
  ] }) });
248
- }, we = me(be);
249
+ }, Ie = pe(xe);
249
250
  export {
250
- we as default
251
+ Ie as default
251
252
  };
@@ -180,7 +180,7 @@ const W = (r, s) => {
180
180
  {
181
181
  className: "brand logo small",
182
182
  size: "small",
183
- src: "/TCDI-Icon-small_02.png"
183
+ src: "/wp-media/TCDI-Icon-small_02.png"
184
184
  }
185
185
  )
186
186
  ] }) }),