@nice2dev/ui 1.4.22 → 1.4.24
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/CHANGELOG.md +96 -0
- package/dist/{NicePivotGrid-BshofJh1.cjs → NicePivotGrid-D53CQ2cY.cjs} +1 -1
- package/dist/charts/NiceAdvancedCharts.mjs +621 -764
- package/dist/charts/NiceBarGauge.mjs +100 -65
- package/dist/charts/NiceBullet.mjs +103 -98
- package/dist/charts/NiceChart.mjs +269 -266
- package/dist/charts/NiceChartRangeSelector.mjs +159 -0
- package/dist/charts/NiceCircularGauge.mjs +99 -70
- package/dist/charts/NiceHeatMap.mjs +140 -70
- package/dist/charts/NiceLinearGauge.mjs +168 -119
- package/dist/charts/NiceOrganizationChart.mjs +183 -90
- package/dist/charts/NicePieChart.mjs +94 -49
- package/dist/charts/NicePolarChart.mjs +2 -2
- package/dist/charts/NiceSankey.mjs +166 -93
- package/dist/charts/NiceStockChart.mjs +258 -157
- package/dist/charts-CSgOgfES.cjs +867 -0
- package/dist/charts.cjs +1 -1
- package/dist/charts.d.ts +150 -104
- package/dist/charts.mjs +22 -24
- package/dist/core/lazy.mjs +50 -63
- package/dist/core-lazy-sO0xvg64.cjs +1 -0
- package/dist/data.cjs +1 -1
- package/dist/demo/docs/docPreviews.mjs +450 -466
- package/dist/demo/docs/docRegistry.mjs +5 -35
- package/dist/index.cjs +60 -67
- package/dist/index.d.ts +145 -174
- package/dist/index.mjs +831 -836
- package/dist/lazy.cjs +1 -1
- package/dist/lazy.d.ts +49 -23
- package/dist/lazy.mjs +1 -1
- package/dist/style.css +1 -1
- package/dist/tools/NiceShowcase.mjs +1 -2
- package/package.json +4 -4
- package/dist/charts/NiceRangeSelector.mjs +0 -135
- package/dist/charts/NiceTreeMap.mjs +0 -100
- package/dist/charts/NiceVectorMap.mjs +0 -59
- package/dist/charts-C3Q3r8Yz.cjs +0 -918
- package/dist/core-lazy-CUnBYI-T.cjs +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nice2dev/ui",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.24",
|
|
4
4
|
"description": "Nice2Dev UI — Universal, themeable, i18n-ready React component library",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -97,12 +97,12 @@
|
|
|
97
97
|
"react-dom": ">=17.0.0"
|
|
98
98
|
},
|
|
99
99
|
"dependencies": {
|
|
100
|
-
"@nice2dev/i18n": "^1.4.
|
|
101
|
-
"@nice2dev/ui-core": "^1.4.
|
|
100
|
+
"@nice2dev/i18n": "^1.4.24",
|
|
101
|
+
"@nice2dev/ui-core": "^1.4.24",
|
|
102
102
|
"country-flag-icons": "^1.6.20"
|
|
103
103
|
},
|
|
104
104
|
"devDependencies": {
|
|
105
|
-
"@nice2dev/testing": "^1.4.
|
|
105
|
+
"@nice2dev/testing": "^1.4.24",
|
|
106
106
|
"@playwright/test": "^1.62.1",
|
|
107
107
|
"@testing-library/dom": "^10.4.1",
|
|
108
108
|
"@testing-library/jest-dom": "^7.0.1",
|
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
import { jsx as r, jsxs as z } from "react/jsx-runtime";
|
|
2
|
-
const B = ({
|
|
3
|
-
data: l,
|
|
4
|
-
min: h,
|
|
5
|
-
max: d,
|
|
6
|
-
start: i,
|
|
7
|
-
end: c,
|
|
8
|
-
onChange: g,
|
|
9
|
-
width: m = 500,
|
|
10
|
-
height: v = 100,
|
|
11
|
-
step: y = 1,
|
|
12
|
-
formatValue: a,
|
|
13
|
-
chartColor: f = "var(--nice-color-primary, #3b82f6)",
|
|
14
|
-
className: D,
|
|
15
|
-
style: E,
|
|
16
|
-
testId: L,
|
|
17
|
-
"data-testid": N
|
|
18
|
-
}) => {
|
|
19
|
-
const t = { top: 10, bottom: 30, left: 10, right: 10 }, p = m - t.left - t.right, e = v - t.top - t.bottom, n = (o) => t.left + (o - h) / (d - h || 1) * p, _ = (o) => {
|
|
20
|
-
const s = Math.max(0, Math.min(1, (o - t.left) / p)), x = h + s * (d - h);
|
|
21
|
-
return Math.round(x / y) * y;
|
|
22
|
-
}, u = (o, s) => {
|
|
23
|
-
s.preventDefault();
|
|
24
|
-
const x = s.target.closest("svg");
|
|
25
|
-
if (!x)
|
|
26
|
-
return;
|
|
27
|
-
const M = (R) => {
|
|
28
|
-
const X = x.getBoundingClientRect(), b = _(R.clientX - X.left);
|
|
29
|
-
o === "start" ? g(Math.min(b, c), c) : g(i, Math.max(b, i));
|
|
30
|
-
}, $ = () => {
|
|
31
|
-
document.removeEventListener("pointermove", M), document.removeEventListener("pointerup", $);
|
|
32
|
-
};
|
|
33
|
-
document.addEventListener("pointermove", M), document.addEventListener("pointerup", $);
|
|
34
|
-
}, w = l ? Math.min(...l) : 0, j = (l ? Math.max(...l) : 1) - w || 1;
|
|
35
|
-
return /* @__PURE__ */ r(
|
|
36
|
-
"div",
|
|
37
|
-
{
|
|
38
|
-
className: `nice-rangeselector ${D || ""}`,
|
|
39
|
-
style: E,
|
|
40
|
-
"data-testid": N ?? L,
|
|
41
|
-
children: /* @__PURE__ */ z("svg", { width: m, height: v, children: [
|
|
42
|
-
l && l.length > 1 && /* @__PURE__ */ r(
|
|
43
|
-
"polygon",
|
|
44
|
-
{
|
|
45
|
-
points: `${t.left},${t.top + e} ${l.map((o, s) => `${t.left + s / (l.length - 1) * p},${t.top + e - (o - w) / j * e}`).join(" ")} ${t.left + p},${t.top + e}`,
|
|
46
|
-
fill: f,
|
|
47
|
-
opacity: 0.15
|
|
48
|
-
}
|
|
49
|
-
),
|
|
50
|
-
/* @__PURE__ */ r(
|
|
51
|
-
"rect",
|
|
52
|
-
{
|
|
53
|
-
x: n(i),
|
|
54
|
-
y: t.top,
|
|
55
|
-
width: n(c) - n(i),
|
|
56
|
-
height: e,
|
|
57
|
-
fill: f,
|
|
58
|
-
opacity: 0.1
|
|
59
|
-
}
|
|
60
|
-
),
|
|
61
|
-
/* @__PURE__ */ r(
|
|
62
|
-
"rect",
|
|
63
|
-
{
|
|
64
|
-
x: t.left,
|
|
65
|
-
y: t.top,
|
|
66
|
-
width: n(i) - t.left,
|
|
67
|
-
height: e,
|
|
68
|
-
fill: "var(--nice-bg-secondary, #f5f5f5)",
|
|
69
|
-
opacity: 0.6
|
|
70
|
-
}
|
|
71
|
-
),
|
|
72
|
-
/* @__PURE__ */ r(
|
|
73
|
-
"rect",
|
|
74
|
-
{
|
|
75
|
-
x: n(c),
|
|
76
|
-
y: t.top,
|
|
77
|
-
width: t.left + p - n(c),
|
|
78
|
-
height: e,
|
|
79
|
-
fill: "var(--nice-bg-secondary, #f5f5f5)",
|
|
80
|
-
opacity: 0.6
|
|
81
|
-
}
|
|
82
|
-
),
|
|
83
|
-
/* @__PURE__ */ r(
|
|
84
|
-
"rect",
|
|
85
|
-
{
|
|
86
|
-
x: n(i) - 4,
|
|
87
|
-
y: t.top,
|
|
88
|
-
width: 8,
|
|
89
|
-
height: e,
|
|
90
|
-
fill: f,
|
|
91
|
-
rx: 2,
|
|
92
|
-
cursor: "ew-resize",
|
|
93
|
-
onPointerDown: (o) => u("start", o)
|
|
94
|
-
}
|
|
95
|
-
),
|
|
96
|
-
/* @__PURE__ */ r(
|
|
97
|
-
"rect",
|
|
98
|
-
{
|
|
99
|
-
x: n(c) - 4,
|
|
100
|
-
y: t.top,
|
|
101
|
-
width: 8,
|
|
102
|
-
height: e,
|
|
103
|
-
fill: f,
|
|
104
|
-
rx: 2,
|
|
105
|
-
cursor: "ew-resize",
|
|
106
|
-
onPointerDown: (o) => u("end", o)
|
|
107
|
-
}
|
|
108
|
-
),
|
|
109
|
-
/* @__PURE__ */ r(
|
|
110
|
-
"text",
|
|
111
|
-
{
|
|
112
|
-
x: n(i),
|
|
113
|
-
y: t.top + e + 18,
|
|
114
|
-
textAnchor: "middle",
|
|
115
|
-
className: "nice-chart__axis-label",
|
|
116
|
-
children: a ? a(i) : i
|
|
117
|
-
}
|
|
118
|
-
),
|
|
119
|
-
/* @__PURE__ */ r(
|
|
120
|
-
"text",
|
|
121
|
-
{
|
|
122
|
-
x: n(c),
|
|
123
|
-
y: t.top + e + 18,
|
|
124
|
-
textAnchor: "middle",
|
|
125
|
-
className: "nice-chart__axis-label",
|
|
126
|
-
children: a ? a(c) : c
|
|
127
|
-
}
|
|
128
|
-
)
|
|
129
|
-
] })
|
|
130
|
-
}
|
|
131
|
-
);
|
|
132
|
-
};
|
|
133
|
-
export {
|
|
134
|
-
B as NiceRangeSelector
|
|
135
|
-
};
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
import { jsx as m, jsxs as p } from "react/jsx-runtime";
|
|
2
|
-
import { useControlId as x } from "@nice2dev/ui-core";
|
|
3
|
-
import { forwardRef as y, useMemo as w } from "react";
|
|
4
|
-
function b(r, f) {
|
|
5
|
-
const t = r.reduce((c, o) => c + o.value, 0);
|
|
6
|
-
if (t === 0 || r.length === 0)
|
|
7
|
-
return [];
|
|
8
|
-
const a = [];
|
|
9
|
-
let { x: i, y: d, w: s, h: l } = f;
|
|
10
|
-
const h = [...r].sort((c, o) => o.value - c.value);
|
|
11
|
-
for (const c of h) {
|
|
12
|
-
const o = c.value / t;
|
|
13
|
-
if (s >= l) {
|
|
14
|
-
const n = s * o;
|
|
15
|
-
a.push({ x: i, y: d, w: n, h: l, node: c }), i += n, s -= n;
|
|
16
|
-
} else {
|
|
17
|
-
const n = l * o;
|
|
18
|
-
a.push({ x: i, y: d, w: s, h: n, node: c }), d += n, l -= n;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
return a;
|
|
22
|
-
}
|
|
23
|
-
const g = [
|
|
24
|
-
"var(--nice-color-primary, #3b82f6)",
|
|
25
|
-
"var(--nice-color-success, #10b981)",
|
|
26
|
-
"var(--nice-color-warning, #f59e0b)",
|
|
27
|
-
"var(--nice-color-error, #ef4444)",
|
|
28
|
-
"var(--nice-color-accent, #8b5cf6)",
|
|
29
|
-
"var(--nice-color-info, #06b6d4)",
|
|
30
|
-
"var(--nice-color-accent-pink, #ec4899)",
|
|
31
|
-
"var(--nice-success, #84cc16)"
|
|
32
|
-
], j = /* @__PURE__ */ Object.assign(
|
|
33
|
-
/* @__PURE__ */ y(
|
|
34
|
-
({
|
|
35
|
-
data: r,
|
|
36
|
-
width: f = 600,
|
|
37
|
-
height: t = 400,
|
|
38
|
-
onNodeClick: a,
|
|
39
|
-
colors: i = g,
|
|
40
|
-
className: d,
|
|
41
|
-
style: s,
|
|
42
|
-
id: l,
|
|
43
|
-
testId: h,
|
|
44
|
-
"data-testid": c
|
|
45
|
-
}, o) => {
|
|
46
|
-
const n = x(l), u = w(() => {
|
|
47
|
-
const e = r.children ?? [r];
|
|
48
|
-
return b(e, { x: 0, y: 0, w: f, h: t });
|
|
49
|
-
}, [r, f, t]);
|
|
50
|
-
return /* @__PURE__ */ m(
|
|
51
|
-
"div",
|
|
52
|
-
{
|
|
53
|
-
ref: o,
|
|
54
|
-
id: n,
|
|
55
|
-
className: `nice-treemap ${d || ""}`,
|
|
56
|
-
style: s,
|
|
57
|
-
"data-testid": c ?? h,
|
|
58
|
-
children: /* @__PURE__ */ m("svg", { width: f, height: t, className: "nice-treemap__svg", children: u.map((e, v) => /* @__PURE__ */ p(
|
|
59
|
-
"g",
|
|
60
|
-
{
|
|
61
|
-
onClick: () => a?.(e.node),
|
|
62
|
-
style: { cursor: a ? "pointer" : void 0 },
|
|
63
|
-
children: [
|
|
64
|
-
/* @__PURE__ */ m(
|
|
65
|
-
"rect",
|
|
66
|
-
{
|
|
67
|
-
x: e.x,
|
|
68
|
-
y: e.y,
|
|
69
|
-
width: Math.max(e.w - 1, 0),
|
|
70
|
-
height: Math.max(e.h - 1, 0),
|
|
71
|
-
fill: e.node.color ?? i[v % i.length],
|
|
72
|
-
rx: 2
|
|
73
|
-
}
|
|
74
|
-
),
|
|
75
|
-
e.w > 40 && e.h > 20 && /* @__PURE__ */ m(
|
|
76
|
-
"text",
|
|
77
|
-
{
|
|
78
|
-
x: e.x + e.w / 2,
|
|
79
|
-
y: e.y + e.h / 2,
|
|
80
|
-
textAnchor: "middle",
|
|
81
|
-
dominantBaseline: "central",
|
|
82
|
-
fill: "var(--nice-color-white, #fff)",
|
|
83
|
-
fontSize: Math.min(12, e.w / 6),
|
|
84
|
-
className: "nice-treemap__label",
|
|
85
|
-
children: e.node.label
|
|
86
|
-
}
|
|
87
|
-
)
|
|
88
|
-
]
|
|
89
|
-
},
|
|
90
|
-
e.node.key
|
|
91
|
-
)) })
|
|
92
|
-
}
|
|
93
|
-
);
|
|
94
|
-
}
|
|
95
|
-
),
|
|
96
|
-
{ displayName: "NiceTreeMap" }
|
|
97
|
-
);
|
|
98
|
-
export {
|
|
99
|
-
j as NiceTreeMap
|
|
100
|
-
};
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { jsxs as S, jsx as c } from "react/jsx-runtime";
|
|
2
|
-
const C = [], O = ({
|
|
3
|
-
regions: l = C,
|
|
4
|
-
width: u = 600,
|
|
5
|
-
height: p = 400,
|
|
6
|
-
viewBox: m = "0 0 1000 600",
|
|
7
|
-
// Literal hex: interpolateColor() parses these as #rrggbb. As var() tokens (a codemod
|
|
8
|
-
// leftover) every region came out rgb(NaN,NaN,NaN).
|
|
9
|
-
// audit-allow: literal-color — interpolateColor() needs #rrggbb (see above)
|
|
10
|
-
colorRange: d = ["#dbeafe", "#1d4ed8"],
|
|
11
|
-
maxValue: v,
|
|
12
|
-
onRegionClick: n,
|
|
13
|
-
selectedRegionId: h,
|
|
14
|
-
title: o,
|
|
15
|
-
showTooltip: b = !0,
|
|
16
|
-
className: M,
|
|
17
|
-
style: $,
|
|
18
|
-
testId: x,
|
|
19
|
-
"data-testid": f
|
|
20
|
-
}) => {
|
|
21
|
-
const I = v ?? Math.max(...l.map((t) => t.value ?? 0), 1), N = (t) => {
|
|
22
|
-
const e = (s) => [
|
|
23
|
-
parseInt(s.slice(1, 3), 16),
|
|
24
|
-
parseInt(s.slice(3, 5), 16),
|
|
25
|
-
parseInt(s.slice(5, 7), 16)
|
|
26
|
-
], [r, a, i] = e(d[0]), [V, _, j] = e(d[1]), k = Math.round(r + (V - r) * t), y = Math.round(a + (_ - a) * t), E = Math.round(i + (j - i) * t);
|
|
27
|
-
return `rgb(${k},${y},${E})`;
|
|
28
|
-
};
|
|
29
|
-
return /* @__PURE__ */ S(
|
|
30
|
-
"div",
|
|
31
|
-
{
|
|
32
|
-
className: `nice-vectormap ${M || ""}`,
|
|
33
|
-
style: $,
|
|
34
|
-
"data-testid": f ?? x,
|
|
35
|
-
children: [
|
|
36
|
-
o && /* @__PURE__ */ c("div", { className: "nice-vectormap__title", children: o }),
|
|
37
|
-
/* @__PURE__ */ c("svg", { width: u, height: p, viewBox: m, children: l.map((t) => {
|
|
38
|
-
const e = t.value != null ? Math.max(0, Math.min(1, t.value / I)) : 0, r = t.value != null ? N(e) : "var(--nice-bg-tertiary, #e5e7eb)", a = t.id === h;
|
|
39
|
-
return /* @__PURE__ */ c(
|
|
40
|
-
"path",
|
|
41
|
-
{
|
|
42
|
-
d: t.path,
|
|
43
|
-
fill: r,
|
|
44
|
-
stroke: a ? "var(--nice-color-primary, #3b82f6)" : "var(--nice-border-color, #d1d5db)",
|
|
45
|
-
strokeWidth: a ? 2 : 0.5,
|
|
46
|
-
cursor: n ? "pointer" : void 0,
|
|
47
|
-
onClick: () => n?.(t),
|
|
48
|
-
children: b && /* @__PURE__ */ c("title", { children: `${t.name}${t.value != null ? `: ${t.value}` : ""}` })
|
|
49
|
-
},
|
|
50
|
-
t.id
|
|
51
|
-
);
|
|
52
|
-
}) })
|
|
53
|
-
]
|
|
54
|
-
}
|
|
55
|
-
);
|
|
56
|
-
};
|
|
57
|
-
export {
|
|
58
|
-
O as NiceVectorMap
|
|
59
|
-
};
|