@moontra/moonui-pro 2.30.0 → 2.30.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.
- package/dist/index.global.js +62 -62
- package/dist/index.global.js.map +1 -1
- package/dist/index.mjs +106 -58
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -86064,8 +86064,16 @@ function ChartWidget2({
|
|
|
86064
86064
|
// red
|
|
86065
86065
|
"#8b5cf6",
|
|
86066
86066
|
// violet
|
|
86067
|
-
"#ec4899"
|
|
86067
|
+
"#ec4899",
|
|
86068
86068
|
// pink
|
|
86069
|
+
"#14b8a6",
|
|
86070
|
+
// teal
|
|
86071
|
+
"#f97316",
|
|
86072
|
+
// orange
|
|
86073
|
+
"#06b6d4",
|
|
86074
|
+
// cyan
|
|
86075
|
+
"#a855f7"
|
|
86076
|
+
// purple
|
|
86069
86077
|
];
|
|
86070
86078
|
const chartColors = colors || defaultColors2;
|
|
86071
86079
|
const maxValue = t__default.useMemo(() => {
|
|
@@ -86101,24 +86109,31 @@ function ChartWidget2({
|
|
|
86101
86109
|
animate: { opacity: 1, y: 0 },
|
|
86102
86110
|
transition: { delay: index2 * 0.05 },
|
|
86103
86111
|
children: [
|
|
86104
|
-
isHovered &&
|
|
86105
|
-
|
|
86106
|
-
|
|
86107
|
-
|
|
86108
|
-
|
|
86109
|
-
|
|
86110
|
-
|
|
86111
|
-
|
|
86112
|
-
|
|
86113
|
-
|
|
86114
|
-
|
|
86115
|
-
|
|
86116
|
-
|
|
86117
|
-
|
|
86118
|
-
|
|
86119
|
-
|
|
86120
|
-
|
|
86121
|
-
|
|
86112
|
+
isHovered && (() => {
|
|
86113
|
+
const showInside = percentage > 70;
|
|
86114
|
+
return /* @__PURE__ */ jsxs(
|
|
86115
|
+
motion.div,
|
|
86116
|
+
{
|
|
86117
|
+
className: "absolute bg-background border rounded-lg px-3 py-2 text-xs pointer-events-none z-20 shadow-lg",
|
|
86118
|
+
style: showInside ? {
|
|
86119
|
+
top: "20px",
|
|
86120
|
+
left: "50%",
|
|
86121
|
+
transform: "translateX(-50%)"
|
|
86122
|
+
} : {
|
|
86123
|
+
bottom: `calc(${percentage}% + 8px)`,
|
|
86124
|
+
left: "50%",
|
|
86125
|
+
transform: "translateX(-50%)"
|
|
86126
|
+
},
|
|
86127
|
+
initial: { opacity: 0, y: showInside ? -10 : 10 },
|
|
86128
|
+
animate: { opacity: 1, y: 0 },
|
|
86129
|
+
transition: { duration: 0.2 },
|
|
86130
|
+
children: [
|
|
86131
|
+
/* @__PURE__ */ jsx("div", { className: "font-medium", children: labels[index2] || `Item ${index2 + 1}` }),
|
|
86132
|
+
/* @__PURE__ */ jsx("div", { className: "text-muted-foreground", children: formatNumber2(value) })
|
|
86133
|
+
]
|
|
86134
|
+
}
|
|
86135
|
+
);
|
|
86136
|
+
})(),
|
|
86122
86137
|
showDataLabels && /* @__PURE__ */ jsx(
|
|
86123
86138
|
motion.span,
|
|
86124
86139
|
{
|
|
@@ -86139,11 +86154,13 @@ function ChartWidget2({
|
|
|
86139
86154
|
{
|
|
86140
86155
|
className: cn(
|
|
86141
86156
|
"w-full rounded-t cursor-pointer transition-all duration-200",
|
|
86157
|
+
"shadow-lg",
|
|
86142
86158
|
isHovered && "brightness-110 scale-y-105"
|
|
86143
86159
|
),
|
|
86144
86160
|
style: {
|
|
86145
|
-
|
|
86146
|
-
minHeight: "2px"
|
|
86161
|
+
background: `linear-gradient(to top, ${chartColors[index2 % chartColors.length]}, ${chartColors[index2 % chartColors.length]}dd)`,
|
|
86162
|
+
minHeight: "2px",
|
|
86163
|
+
boxShadow: isHovered ? `0 4px 20px ${chartColors[index2 % chartColors.length]}40` : "none"
|
|
86147
86164
|
},
|
|
86148
86165
|
initial: { height: 0 },
|
|
86149
86166
|
animate: { height: `${percentage}%` },
|
|
@@ -86185,9 +86202,12 @@ function ChartWidget2({
|
|
|
86185
86202
|
const labels = data.labels || data.categories || [];
|
|
86186
86203
|
if (values.length < 2)
|
|
86187
86204
|
return null;
|
|
86205
|
+
const padding = 5;
|
|
86206
|
+
const chartWidth = 100 - padding * 2;
|
|
86207
|
+
const chartHeight = 100 - padding * 2;
|
|
86188
86208
|
const points = values.map((value, index2) => {
|
|
86189
|
-
const x = index2 / (values.length - 1) *
|
|
86190
|
-
const y =
|
|
86209
|
+
const x = padding + index2 / (values.length - 1) * chartWidth;
|
|
86210
|
+
const y = padding + (chartHeight - value / maxValue * chartHeight);
|
|
86191
86211
|
return { x, y, value, label: labels[index2] };
|
|
86192
86212
|
});
|
|
86193
86213
|
const pathData = points.map((point, index2) => `${index2 === 0 ? "M" : "L"} ${point.x} ${point.y}`).join(" ");
|
|
@@ -86199,25 +86219,42 @@ function ChartWidget2({
|
|
|
86199
86219
|
viewBox: "0 0 100 100",
|
|
86200
86220
|
preserveAspectRatio: "none",
|
|
86201
86221
|
children: [
|
|
86202
|
-
|
|
86203
|
-
"
|
|
86204
|
-
|
|
86205
|
-
|
|
86206
|
-
|
|
86207
|
-
|
|
86208
|
-
|
|
86209
|
-
|
|
86210
|
-
|
|
86211
|
-
|
|
86212
|
-
|
|
86213
|
-
|
|
86222
|
+
/* @__PURE__ */ jsxs("defs", { children: [
|
|
86223
|
+
/* @__PURE__ */ jsxs("linearGradient", { id: "chartLineGradient", x1: "0%", y1: "0%", x2: "100%", y2: "0%", children: [
|
|
86224
|
+
/* @__PURE__ */ jsx("stop", { offset: "0%", stopColor: chartColors[0], stopOpacity: "1" }),
|
|
86225
|
+
/* @__PURE__ */ jsx("stop", { offset: "50%", stopColor: chartColors[1] || chartColors[0], stopOpacity: "1" }),
|
|
86226
|
+
/* @__PURE__ */ jsx("stop", { offset: "100%", stopColor: chartColors[2] || chartColors[0], stopOpacity: "1" })
|
|
86227
|
+
] }),
|
|
86228
|
+
/* @__PURE__ */ jsxs("linearGradient", { id: "chartAreaGradient", x1: "0%", y1: "0%", x2: "0%", y2: "100%", children: [
|
|
86229
|
+
/* @__PURE__ */ jsx("stop", { offset: "0%", stopColor: chartColors[0], stopOpacity: "0.3" }),
|
|
86230
|
+
/* @__PURE__ */ jsx("stop", { offset: "50%", stopColor: chartColors[0], stopOpacity: "0.15" }),
|
|
86231
|
+
/* @__PURE__ */ jsx("stop", { offset: "100%", stopColor: chartColors[0], stopOpacity: "0.05" })
|
|
86232
|
+
] })
|
|
86233
|
+
] }),
|
|
86234
|
+
showGrid && /* @__PURE__ */ jsx("g", { className: "opacity-10", children: [25, 50, 75].map((percentage) => {
|
|
86235
|
+
const y = 5 + percentage / 100 * 90;
|
|
86236
|
+
return /* @__PURE__ */ jsx(
|
|
86237
|
+
"line",
|
|
86238
|
+
{
|
|
86239
|
+
x1: "0",
|
|
86240
|
+
y1: y,
|
|
86241
|
+
x2: "100",
|
|
86242
|
+
y2: y,
|
|
86243
|
+
stroke: "currentColor",
|
|
86244
|
+
strokeWidth: "0.3"
|
|
86245
|
+
},
|
|
86246
|
+
percentage
|
|
86247
|
+
);
|
|
86248
|
+
}) }),
|
|
86214
86249
|
/* @__PURE__ */ jsx(
|
|
86215
86250
|
motion.path,
|
|
86216
86251
|
{
|
|
86217
86252
|
d: pathData,
|
|
86218
86253
|
fill: "none",
|
|
86219
|
-
stroke:
|
|
86220
|
-
strokeWidth: "
|
|
86254
|
+
stroke: "url(#chartLineGradient)",
|
|
86255
|
+
strokeWidth: "1.5",
|
|
86256
|
+
strokeLinecap: "round",
|
|
86257
|
+
strokeLinejoin: "round",
|
|
86221
86258
|
initial: { pathLength: 0 },
|
|
86222
86259
|
animate: { pathLength: 1 },
|
|
86223
86260
|
transition: { duration: animate5 ? 1 : 0 }
|
|
@@ -86226,8 +86263,8 @@ function ChartWidget2({
|
|
|
86226
86263
|
type === "area" && /* @__PURE__ */ jsx(
|
|
86227
86264
|
motion.path,
|
|
86228
86265
|
{
|
|
86229
|
-
d: `${pathData} L
|
|
86230
|
-
fill:
|
|
86266
|
+
d: `${pathData} L ${90} ${90} L ${10} ${90} Z`,
|
|
86267
|
+
fill: "url(#chartAreaGradient)",
|
|
86231
86268
|
initial: { opacity: 0 },
|
|
86232
86269
|
animate: { opacity: 1 },
|
|
86233
86270
|
transition: { duration: animate5 ? 0.5 : 0, delay: 0.5 }
|
|
@@ -86238,35 +86275,46 @@ function ChartWidget2({
|
|
|
86238
86275
|
{
|
|
86239
86276
|
cx: point.x,
|
|
86240
86277
|
cy: point.y,
|
|
86241
|
-
r: "
|
|
86278
|
+
r: "1",
|
|
86242
86279
|
fill: chartColors[0],
|
|
86243
|
-
|
|
86244
|
-
|
|
86280
|
+
stroke: "white",
|
|
86281
|
+
strokeWidth: "1.5",
|
|
86282
|
+
initial: { r: 0, opacity: 0 },
|
|
86283
|
+
animate: {
|
|
86284
|
+
r: hoveredIndex === index2 ? 2.5 : 1,
|
|
86285
|
+
opacity: 1,
|
|
86286
|
+
strokeWidth: hoveredIndex === index2 ? 2 : 1.5
|
|
86287
|
+
},
|
|
86245
86288
|
onMouseEnter: () => setHoveredIndex(index2),
|
|
86246
86289
|
onMouseLeave: () => setHoveredIndex(null),
|
|
86247
86290
|
className: "cursor-pointer",
|
|
86248
|
-
onClick: () => onDataPointClick?.(point)
|
|
86291
|
+
onClick: () => onDataPointClick?.(point),
|
|
86292
|
+
transition: { duration: 0.2 }
|
|
86249
86293
|
},
|
|
86250
86294
|
index2
|
|
86251
86295
|
))
|
|
86252
86296
|
]
|
|
86253
86297
|
}
|
|
86254
86298
|
),
|
|
86255
|
-
showTooltip && hoveredIndex !== null && points[hoveredIndex] &&
|
|
86256
|
-
|
|
86257
|
-
|
|
86258
|
-
|
|
86259
|
-
|
|
86260
|
-
|
|
86261
|
-
|
|
86262
|
-
|
|
86263
|
-
|
|
86264
|
-
|
|
86265
|
-
|
|
86266
|
-
|
|
86267
|
-
|
|
86268
|
-
|
|
86269
|
-
|
|
86299
|
+
showTooltip && hoveredIndex !== null && points[hoveredIndex] && (() => {
|
|
86300
|
+
const point = points[hoveredIndex];
|
|
86301
|
+
const showBelow = point.y < 30;
|
|
86302
|
+
return /* @__PURE__ */ jsxs(
|
|
86303
|
+
"div",
|
|
86304
|
+
{
|
|
86305
|
+
className: "absolute bg-background border rounded px-2 py-1 text-xs pointer-events-none z-10 shadow-lg",
|
|
86306
|
+
style: {
|
|
86307
|
+
left: `${Math.min(90, Math.max(10, point.x))}%`,
|
|
86308
|
+
top: showBelow ? `${point.y}%` : `${point.y}%`,
|
|
86309
|
+
transform: showBelow ? "translate(-50%, 10px)" : "translate(-50%, calc(-100% - 10px))"
|
|
86310
|
+
},
|
|
86311
|
+
children: [
|
|
86312
|
+
/* @__PURE__ */ jsx("div", { className: "font-medium", children: point.label }),
|
|
86313
|
+
/* @__PURE__ */ jsx("div", { children: formatNumber2(point.value) })
|
|
86314
|
+
]
|
|
86315
|
+
}
|
|
86316
|
+
);
|
|
86317
|
+
})()
|
|
86270
86318
|
] });
|
|
86271
86319
|
};
|
|
86272
86320
|
const renderPieChart = () => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moontra/moonui-pro",
|
|
3
|
-
"version": "2.30.
|
|
3
|
+
"version": "2.30.1",
|
|
4
4
|
"description": "Premium React components for MoonUI - Advanced UI library with 50+ pro components including performance, interactive, and gesture components",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.mjs",
|