@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.
Files changed (38) hide show
  1. package/CHANGELOG.md +96 -0
  2. package/dist/{NicePivotGrid-BshofJh1.cjs → NicePivotGrid-D53CQ2cY.cjs} +1 -1
  3. package/dist/charts/NiceAdvancedCharts.mjs +621 -764
  4. package/dist/charts/NiceBarGauge.mjs +100 -65
  5. package/dist/charts/NiceBullet.mjs +103 -98
  6. package/dist/charts/NiceChart.mjs +269 -266
  7. package/dist/charts/NiceChartRangeSelector.mjs +159 -0
  8. package/dist/charts/NiceCircularGauge.mjs +99 -70
  9. package/dist/charts/NiceHeatMap.mjs +140 -70
  10. package/dist/charts/NiceLinearGauge.mjs +168 -119
  11. package/dist/charts/NiceOrganizationChart.mjs +183 -90
  12. package/dist/charts/NicePieChart.mjs +94 -49
  13. package/dist/charts/NicePolarChart.mjs +2 -2
  14. package/dist/charts/NiceSankey.mjs +166 -93
  15. package/dist/charts/NiceStockChart.mjs +258 -157
  16. package/dist/charts-CSgOgfES.cjs +867 -0
  17. package/dist/charts.cjs +1 -1
  18. package/dist/charts.d.ts +150 -104
  19. package/dist/charts.mjs +22 -24
  20. package/dist/core/lazy.mjs +50 -63
  21. package/dist/core-lazy-sO0xvg64.cjs +1 -0
  22. package/dist/data.cjs +1 -1
  23. package/dist/demo/docs/docPreviews.mjs +450 -466
  24. package/dist/demo/docs/docRegistry.mjs +5 -35
  25. package/dist/index.cjs +60 -67
  26. package/dist/index.d.ts +145 -174
  27. package/dist/index.mjs +831 -836
  28. package/dist/lazy.cjs +1 -1
  29. package/dist/lazy.d.ts +49 -23
  30. package/dist/lazy.mjs +1 -1
  31. package/dist/style.css +1 -1
  32. package/dist/tools/NiceShowcase.mjs +1 -2
  33. package/package.json +4 -4
  34. package/dist/charts/NiceRangeSelector.mjs +0 -135
  35. package/dist/charts/NiceTreeMap.mjs +0 -100
  36. package/dist/charts/NiceVectorMap.mjs +0 -59
  37. package/dist/charts-C3Q3r8Yz.cjs +0 -918
  38. package/dist/core-lazy-CUnBYI-T.cjs +0 -1
@@ -1,147 +1,196 @@
1
- import { jsx as r, jsxs as N } from "react/jsx-runtime";
2
- const L = ({
3
- value: i,
4
- min: o = 0,
5
- max: g = 100,
6
- width: n = 300,
7
- height: c = 60,
8
- orientation: A = "horizontal",
9
- color: k = "var(--nice-color-primary, #3b82f6)",
10
- label: s,
11
- formatValue: x,
12
- ranges: y,
13
- showTicks: v = !0,
14
- tickCount: _ = 5,
15
- className: m,
16
- style: p,
17
- testId: $,
18
- "data-testid": h
1
+ import { jsx as t, jsxs as D } from "react/jsx-runtime";
2
+ const A = 16, I = 7, P = ({
3
+ value: x,
4
+ min: i = 0,
5
+ max: y = 100,
6
+ width: a = 300,
7
+ height: k = 60,
8
+ orientation: F = "horizontal",
9
+ color: J,
10
+ label: e,
11
+ labelPlacement: d = "bottom",
12
+ showValueLabel: f = !1,
13
+ formatValue: b,
14
+ ranges: H,
15
+ showTicks: _ = !0,
16
+ tickCount: K = 5,
17
+ className: L,
18
+ style: S,
19
+ testId: j,
20
+ "data-testid": C
19
21
  }) => {
20
- const u = A === "horizontal", t = u ? n - 40 : c - 40, a = Math.max(0, Math.min(1, (i - o) / (g - o || 1))), e = 10;
21
- let f = k;
22
- if (y) {
23
- for (const l of y)
24
- if (i >= l.start && i <= l.end) {
25
- f = l.color;
22
+ const Q = F === "horizontal", p = Math.max(0, Math.min(1, (x - i) / (y - i || 1))), n = 10, $ = b ? b(x) : String(x);
23
+ let B = J || "var(--nice-color-primary, #3b82f6)";
24
+ if (H) {
25
+ for (const c of H)
26
+ if (x >= c.start && x <= c.end) {
27
+ B = c.color;
26
28
  break;
27
29
  }
28
30
  }
29
- const z = Array.from(
30
- { length: _ },
31
- (l, d) => o + (g - o) * (d / (_ - 1))
32
- );
33
- if (u) {
34
- const l = s ? 14 : 0;
35
- return /* @__PURE__ */ r(
31
+ const R = Math.max(2, K), Y = Array.from({ length: R }, (c, s) => i + (y - i) * (s / (R - 1)));
32
+ if (Q) {
33
+ const c = e && d === "left", s = e && d === "top", O = e && d === "bottom", W = c ? Math.min(a * 0.35, e.length * I + 12) : 0, Z = (s ? A : 0) + (f ? 16 : 6), l = 20 + W, m = Math.max(20, a - 40 - W), o = Z + 8, X = o + n + 12, z = Math.max(k, X + (_ ? 4 : -8) + (O ? A + 4 : 4)), N = l + m * p;
34
+ return /* @__PURE__ */ t(
36
35
  "div",
37
36
  {
38
- className: `nice-gauge nice-gauge--linear ${m || ""}`,
39
- style: p,
40
- "data-testid": h ?? $,
41
- children: /* @__PURE__ */ N("svg", { width: n, height: c + l, children: [
42
- /* @__PURE__ */ r(
43
- "text",
44
- {
45
- x: 20 + t * a,
46
- y: 14,
47
- textAnchor: "middle",
48
- className: "nice-gauge__value",
49
- style: { fontSize: 12 },
50
- children: x ? x(i) : i
51
- }
52
- ),
53
- /* @__PURE__ */ r(
54
- "rect",
55
- {
56
- x: 20,
57
- y: c / 2 - e / 2,
58
- width: t,
59
- height: e,
60
- rx: 5,
61
- fill: "var(--nice-border-color, #e2e8f0)"
62
- }
63
- ),
64
- /* @__PURE__ */ r(
65
- "rect",
66
- {
67
- x: 20,
68
- y: c / 2 - e / 2,
69
- width: t * a,
70
- height: e,
71
- rx: 5,
72
- fill: f
73
- }
74
- ),
75
- /* @__PURE__ */ r(
76
- "polygon",
77
- {
78
- points: `${20 + t * a},${c / 2 - e / 2 - 2} ${20 + t * a - 5},${c / 2 - e / 2 - 8} ${20 + t * a + 5},${c / 2 - e / 2 - 8}`,
79
- fill: "var(--nice-text-primary, #333)"
80
- }
81
- ),
82
- v && z.map((d, b) => {
83
- const j = 20 + (d - o) / (g - o) * t;
84
- return /* @__PURE__ */ r(
85
- "text",
86
- {
87
- x: j,
88
- y: c / 2 + e / 2 + 12,
89
- textAnchor: "middle",
90
- className: "nice-gauge__tick",
91
- children: d
92
- },
93
- b
94
- );
95
- }),
96
- s && /* @__PURE__ */ r(
97
- "text",
98
- {
99
- x: n / 2,
100
- y: c + l - 2,
101
- textAnchor: "middle",
102
- className: "nice-gauge__label",
103
- children: s
104
- }
105
- )
106
- ] })
37
+ className: `nice-gauge nice-gauge--linear ${L || ""}`,
38
+ style: S,
39
+ "data-testid": C ?? j,
40
+ children: /* @__PURE__ */ D(
41
+ "svg",
42
+ {
43
+ width: a,
44
+ height: z,
45
+ viewBox: `0 0 ${a} ${z}`,
46
+ style: { maxWidth: "100%" },
47
+ children: [
48
+ s && /* @__PURE__ */ t("text", { x: l, y: 12, className: "nice-gauge__label", children: e }),
49
+ c && /* @__PURE__ */ t(
50
+ "text",
51
+ {
52
+ x: W + 8,
53
+ y: o + n / 2,
54
+ textAnchor: "end",
55
+ dominantBaseline: "middle",
56
+ className: "nice-gauge__label",
57
+ children: e
58
+ }
59
+ ),
60
+ f && /* @__PURE__ */ t(
61
+ "text",
62
+ {
63
+ x: N,
64
+ y: o - 10,
65
+ textAnchor: "middle",
66
+ className: "nice-gauge__value",
67
+ style: { fontSize: 12 },
68
+ children: $
69
+ }
70
+ ),
71
+ /* @__PURE__ */ t(
72
+ "rect",
73
+ {
74
+ x: l,
75
+ y: o,
76
+ width: m,
77
+ height: n,
78
+ rx: 5,
79
+ fill: "var(--nice-border-color, #e2e8f0)"
80
+ }
81
+ ),
82
+ /* @__PURE__ */ t(
83
+ "rect",
84
+ {
85
+ x: l,
86
+ y: o,
87
+ width: m * p,
88
+ height: n,
89
+ rx: 5,
90
+ fill: B
91
+ }
92
+ ),
93
+ /* @__PURE__ */ t(
94
+ "polygon",
95
+ {
96
+ points: `${N},${o - 2} ${N - 5},${o - 8} ${N + 5},${o - 8}`,
97
+ fill: "var(--nice-text-primary, #333)",
98
+ children: /* @__PURE__ */ t("title", { children: $ })
99
+ }
100
+ ),
101
+ _ && Y.map((q, T) => /* @__PURE__ */ t(
102
+ "text",
103
+ {
104
+ x: l + (q - i) / (y - i || 1) * m,
105
+ y: X,
106
+ textAnchor: "middle",
107
+ className: "nice-gauge__tick",
108
+ children: Math.round(q * 100) / 100
109
+ },
110
+ T
111
+ )),
112
+ O && /* @__PURE__ */ t(
113
+ "text",
114
+ {
115
+ x: l + m / 2,
116
+ y: z - 4,
117
+ textAnchor: "middle",
118
+ className: "nice-gauge__label",
119
+ children: e
120
+ }
121
+ )
122
+ ]
123
+ }
124
+ )
107
125
  }
108
126
  );
109
127
  }
110
- return /* @__PURE__ */ r(
128
+ const u = Math.max(a, k), h = Math.max(72, Math.min(a, k, 140)), E = e && d !== "bottom", G = e && d === "bottom", g = (E ? A + 4 : 0) + (f ? 18 : 8), U = G ? A + 8 : 8, v = Math.max(20, u - g - U), r = h / 2 - n / 2 - (_ ? 10 : 0), M = g + v * (1 - p);
129
+ return /* @__PURE__ */ t(
111
130
  "div",
112
131
  {
113
- className: `nice-gauge nice-gauge--linear nice-gauge--vertical ${m || ""}`,
114
- style: p,
115
- "data-testid": h ?? $,
116
- children: /* @__PURE__ */ N("svg", { width: n, height: c, children: [
117
- /* @__PURE__ */ r(
132
+ className: `nice-gauge nice-gauge--linear nice-gauge--vertical ${L || ""}`,
133
+ style: S,
134
+ "data-testid": C ?? j,
135
+ children: /* @__PURE__ */ D("svg", { width: h, height: u, viewBox: `0 0 ${h} ${u}`, style: { maxWidth: "100%" }, children: [
136
+ E && /* @__PURE__ */ t("text", { x: h / 2, y: 12, textAnchor: "middle", className: "nice-gauge__label", children: e }),
137
+ f && /* @__PURE__ */ t(
138
+ "text",
139
+ {
140
+ x: r + n / 2,
141
+ y: g - 6,
142
+ textAnchor: "middle",
143
+ className: "nice-gauge__value",
144
+ style: { fontSize: 12 },
145
+ children: $
146
+ }
147
+ ),
148
+ /* @__PURE__ */ t(
118
149
  "rect",
119
150
  {
120
- x: n / 2 - e / 2,
121
- y: 20,
122
- width: e,
123
- height: t,
151
+ x: r,
152
+ y: g,
153
+ width: n,
154
+ height: v,
124
155
  rx: 5,
125
156
  fill: "var(--nice-border-color, #e2e8f0)"
126
157
  }
127
158
  ),
128
- /* @__PURE__ */ r(
159
+ /* @__PURE__ */ t(
129
160
  "rect",
130
161
  {
131
- x: n / 2 - e / 2,
132
- y: 20 + t * (1 - a),
133
- width: e,
134
- height: t * a,
162
+ x: r,
163
+ y: M,
164
+ width: n,
165
+ height: v * p,
135
166
  rx: 5,
136
- fill: f
167
+ fill: B
137
168
  }
138
169
  ),
139
- /* @__PURE__ */ r("text", { x: n / 2, y: 14, textAnchor: "middle", className: "nice-gauge__value", children: x ? x(i) : i }),
140
- s && /* @__PURE__ */ r("text", { x: n / 2, y: c - 4, textAnchor: "middle", className: "nice-gauge__label", children: s })
170
+ /* @__PURE__ */ t(
171
+ "polygon",
172
+ {
173
+ points: `${r - 2},${M} ${r - 8},${M - 5} ${r - 8},${M + 5}`,
174
+ fill: "var(--nice-text-primary, #333)",
175
+ children: /* @__PURE__ */ t("title", { children: $ })
176
+ }
177
+ ),
178
+ _ && Y.map((c, s) => /* @__PURE__ */ t(
179
+ "text",
180
+ {
181
+ x: r + n + 6,
182
+ y: g + v * (1 - (c - i) / (y - i || 1)),
183
+ dominantBaseline: "middle",
184
+ className: "nice-gauge__tick",
185
+ children: Math.round(c * 100) / 100
186
+ },
187
+ s
188
+ )),
189
+ G && /* @__PURE__ */ t("text", { x: h / 2, y: u - 6, textAnchor: "middle", className: "nice-gauge__label", children: e })
141
190
  ] })
142
191
  }
143
192
  );
144
193
  };
145
194
  export {
146
- L as NiceLinearGauge
195
+ P as NiceLinearGauge
147
196
  };