framepexls-ui-lib 0.3.23 → 0.3.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/dist/RechartsDonutCard.js +23 -12
- package/dist/RechartsDonutCard.mjs +23 -12
- package/package.json +1 -1
|
@@ -55,6 +55,28 @@ function RechartsDonutCard({
|
|
|
55
55
|
valueFormatter
|
|
56
56
|
}) {
|
|
57
57
|
const safeData = Array.isArray(data) ? data : [];
|
|
58
|
+
const renderTooltip = (props) => {
|
|
59
|
+
var _a, _b;
|
|
60
|
+
const { active, payload } = props || {};
|
|
61
|
+
if (!active || !(payload == null ? void 0 : payload.length)) return null;
|
|
62
|
+
const p = payload[0];
|
|
63
|
+
const rawValue = p.value;
|
|
64
|
+
const value = typeof rawValue === "number" ? valueFormatter ? valueFormatter(rawValue) : rawValue.toLocaleString("es-MX", { maximumFractionDigits: 2 }) : rawValue;
|
|
65
|
+
const label = (_b = (_a = p.payload && p.payload[nameKey]) != null ? _a : p.name) != null ? _b : "";
|
|
66
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "rounded-xl border border-slate-200 bg-white/95 px-3 py-2 text-xs shadow-xl dark:border-white/10 dark:bg-slate-900/95 dark:text-slate-50", children: [
|
|
67
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "mb-1 font-medium text-slate-800 dark:text-slate-50", children: label }),
|
|
68
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
69
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
70
|
+
"span",
|
|
71
|
+
{
|
|
72
|
+
className: "inline-block h-2 w-2 rounded-full",
|
|
73
|
+
style: { backgroundColor: p.color }
|
|
74
|
+
}
|
|
75
|
+
),
|
|
76
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "font-semibold text-slate-800 dark:text-slate-50", children: value })
|
|
77
|
+
] })
|
|
78
|
+
] });
|
|
79
|
+
};
|
|
58
80
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ChartCard.default, { title, subtitle, children: !safeData.length ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "flex h-[220px] items-center justify-center text-xs text-slate-500 dark:text-slate-400", children: "Sin datos para los filtros seleccionados." }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "flex h-[240px] w-full items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_recharts.PieChart, { width: 260, height: 220, children: [
|
|
59
81
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
60
82
|
import_recharts.Pie,
|
|
@@ -74,17 +96,6 @@ function RechartsDonutCard({
|
|
|
74
96
|
))
|
|
75
97
|
}
|
|
76
98
|
),
|
|
77
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
78
|
-
import_recharts.Tooltip,
|
|
79
|
-
{
|
|
80
|
-
formatter: (value, name, props) => {
|
|
81
|
-
const v = typeof value === "number" ? valueFormatter ? valueFormatter(value) : value.toLocaleString("es-MX", {
|
|
82
|
-
maximumFractionDigits: 2
|
|
83
|
-
}) : value;
|
|
84
|
-
const label = (props == null ? void 0 : props.payload) && props.payload[nameKey] || name;
|
|
85
|
-
return [v, label];
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
)
|
|
99
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_recharts.Tooltip, { content: renderTooltip })
|
|
89
100
|
] }) }) });
|
|
90
101
|
}
|
|
@@ -22,6 +22,28 @@ function RechartsDonutCard({
|
|
|
22
22
|
valueFormatter
|
|
23
23
|
}) {
|
|
24
24
|
const safeData = Array.isArray(data) ? data : [];
|
|
25
|
+
const renderTooltip = (props) => {
|
|
26
|
+
var _a, _b;
|
|
27
|
+
const { active, payload } = props || {};
|
|
28
|
+
if (!active || !(payload == null ? void 0 : payload.length)) return null;
|
|
29
|
+
const p = payload[0];
|
|
30
|
+
const rawValue = p.value;
|
|
31
|
+
const value = typeof rawValue === "number" ? valueFormatter ? valueFormatter(rawValue) : rawValue.toLocaleString("es-MX", { maximumFractionDigits: 2 }) : rawValue;
|
|
32
|
+
const label = (_b = (_a = p.payload && p.payload[nameKey]) != null ? _a : p.name) != null ? _b : "";
|
|
33
|
+
return /* @__PURE__ */ jsxs("div", { className: "rounded-xl border border-slate-200 bg-white/95 px-3 py-2 text-xs shadow-xl dark:border-white/10 dark:bg-slate-900/95 dark:text-slate-50", children: [
|
|
34
|
+
label && /* @__PURE__ */ jsx("div", { className: "mb-1 font-medium text-slate-800 dark:text-slate-50", children: label }),
|
|
35
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
36
|
+
/* @__PURE__ */ jsx(
|
|
37
|
+
"span",
|
|
38
|
+
{
|
|
39
|
+
className: "inline-block h-2 w-2 rounded-full",
|
|
40
|
+
style: { backgroundColor: p.color }
|
|
41
|
+
}
|
|
42
|
+
),
|
|
43
|
+
/* @__PURE__ */ jsx("span", { className: "font-semibold text-slate-800 dark:text-slate-50", children: value })
|
|
44
|
+
] })
|
|
45
|
+
] });
|
|
46
|
+
};
|
|
25
47
|
return /* @__PURE__ */ jsx(ChartCard, { title, subtitle, children: !safeData.length ? /* @__PURE__ */ jsx("div", { className: "flex h-[220px] items-center justify-center text-xs text-slate-500 dark:text-slate-400", children: "Sin datos para los filtros seleccionados." }) : /* @__PURE__ */ jsx("div", { className: "flex h-[240px] w-full items-center justify-center", children: /* @__PURE__ */ jsxs(PieChart, { width: 260, height: 220, children: [
|
|
26
48
|
/* @__PURE__ */ jsx(
|
|
27
49
|
Pie,
|
|
@@ -41,18 +63,7 @@ function RechartsDonutCard({
|
|
|
41
63
|
))
|
|
42
64
|
}
|
|
43
65
|
),
|
|
44
|
-
/* @__PURE__ */ jsx(
|
|
45
|
-
Tooltip,
|
|
46
|
-
{
|
|
47
|
-
formatter: (value, name, props) => {
|
|
48
|
-
const v = typeof value === "number" ? valueFormatter ? valueFormatter(value) : value.toLocaleString("es-MX", {
|
|
49
|
-
maximumFractionDigits: 2
|
|
50
|
-
}) : value;
|
|
51
|
-
const label = (props == null ? void 0 : props.payload) && props.payload[nameKey] || name;
|
|
52
|
-
return [v, label];
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
)
|
|
66
|
+
/* @__PURE__ */ jsx(Tooltip, { content: renderTooltip })
|
|
56
67
|
] }) }) });
|
|
57
68
|
}
|
|
58
69
|
export {
|