@algorithm-shift/design-system 1.2.975 → 1.2.977
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/client.js +9 -6
- package/dist/client.js.map +1 -1
- package/dist/client.mjs +9 -6
- package/dist/client.mjs.map +1 -1
- package/dist/index.css +468 -23
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +14 -3
- package/dist/index.d.ts +14 -3
- package/dist/index.js +655 -180
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +663 -189
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -26930,7 +26930,7 @@ var TextInput = ({ className, style, ...props }) => {
|
|
|
26930
26930
|
/* @__PURE__ */ jsx20(
|
|
26931
26931
|
Input,
|
|
26932
26932
|
{
|
|
26933
|
-
type: "text",
|
|
26933
|
+
type: props.inputType || "text",
|
|
26934
26934
|
name: props.name,
|
|
26935
26935
|
className: cn(className, props.errorMessage ? "border-red-500" : ""),
|
|
26936
26936
|
style: {
|
|
@@ -29826,7 +29826,7 @@ function DataTable({
|
|
|
29826
29826
|
setRowSelection((old) => {
|
|
29827
29827
|
const newState = typeof updater === "function" ? updater(old) : updater;
|
|
29828
29828
|
const selectedData = Object.keys(newState).filter((key) => newState[key]).map((rowId) => tableData[Number(rowId)]);
|
|
29829
|
-
getRowSelection?.(selectedData);
|
|
29829
|
+
getRowSelection?.({ rows: selectedData });
|
|
29830
29830
|
return newState;
|
|
29831
29831
|
});
|
|
29832
29832
|
},
|
|
@@ -30819,8 +30819,22 @@ var Tabs_default = Tabs;
|
|
|
30819
30819
|
// src/components/Navigation/Stages/Stages.tsx
|
|
30820
30820
|
import React10, { useState as useState10 } from "react";
|
|
30821
30821
|
import { jsx as jsx57, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
30822
|
-
var StagesComponent = ({
|
|
30823
|
-
|
|
30822
|
+
var StagesComponent = ({
|
|
30823
|
+
stages,
|
|
30824
|
+
isShowBtn,
|
|
30825
|
+
buttonText,
|
|
30826
|
+
className,
|
|
30827
|
+
style,
|
|
30828
|
+
onStageChange,
|
|
30829
|
+
currentStage,
|
|
30830
|
+
dataKey = "key",
|
|
30831
|
+
dataLabel = "header",
|
|
30832
|
+
loading,
|
|
30833
|
+
saving,
|
|
30834
|
+
triggerOnClick = false,
|
|
30835
|
+
canvasMode = "desktop"
|
|
30836
|
+
}) => {
|
|
30837
|
+
const [activeStage, setActiveStage] = useState10(currentStage || (stages && stages.length > 0 ? stages[0][dataKey] : null));
|
|
30824
30838
|
const [isCompleted, setIsCompleted] = useState10(false);
|
|
30825
30839
|
const updateStage = (stageKey) => {
|
|
30826
30840
|
setActiveStage(stageKey);
|
|
@@ -30830,18 +30844,19 @@ var StagesComponent = ({ stages, isShowBtn, buttonText, className, style, onStag
|
|
|
30830
30844
|
if (!stages || stages.length === 0) return;
|
|
30831
30845
|
const currentIndex = stages.findIndex((stage) => stage[dataKey] === activeStage);
|
|
30832
30846
|
if (currentIndex + 1 === stages.length) {
|
|
30833
|
-
const
|
|
30834
|
-
updateStage(
|
|
30847
|
+
const currentStageObj = stages[currentIndex];
|
|
30848
|
+
updateStage(currentStageObj[dataKey]);
|
|
30835
30849
|
setIsCompleted(true);
|
|
30836
30850
|
return;
|
|
30837
30851
|
}
|
|
30838
|
-
if (currentIndex < stages.length) {
|
|
30839
|
-
const
|
|
30840
|
-
updateStage(
|
|
30852
|
+
if (currentIndex < stages.length - 1) {
|
|
30853
|
+
const nextStageObj = stages[currentIndex + 1];
|
|
30854
|
+
updateStage(nextStageObj[dataKey]);
|
|
30841
30855
|
return;
|
|
30842
30856
|
}
|
|
30843
30857
|
};
|
|
30844
30858
|
const lastStage = stages && stages.length > 0 ? stages[stages.length - 1][dataKey] : null;
|
|
30859
|
+
const isMobile = canvasMode === "mobile";
|
|
30845
30860
|
const onStageClick = (stageKey) => {
|
|
30846
30861
|
if (!stageKey || stageKey === activeStage || activeStage === lastStage) return;
|
|
30847
30862
|
setActiveStage(stageKey);
|
|
@@ -30851,50 +30866,91 @@ var StagesComponent = ({ stages, isShowBtn, buttonText, className, style, onStag
|
|
|
30851
30866
|
};
|
|
30852
30867
|
const isAllStagesCompleted = isCompleted || currentStage === lastStage;
|
|
30853
30868
|
const disabled = isAllStagesCompleted || loading || saving;
|
|
30854
|
-
return /* @__PURE__ */ jsx57("div", { className, style, children: /* @__PURE__ */ jsxs34(
|
|
30855
|
-
|
|
30856
|
-
|
|
30857
|
-
|
|
30858
|
-
|
|
30859
|
-
|
|
30860
|
-
|
|
30861
|
-
|
|
30862
|
-
|
|
30863
|
-
|
|
30864
|
-
|
|
30865
|
-
)) : stages?.length > 0 && stages?.map((stage, index) => {
|
|
30866
|
-
const currentIndex = stages.findIndex((s) => s[dataKey] === activeStage);
|
|
30867
|
-
const isCompleted2 = isAllStagesCompleted || index < currentIndex;
|
|
30868
|
-
const isActive = !isAllStagesCompleted && index === currentIndex;
|
|
30869
|
-
return /* @__PURE__ */ jsxs34(React10.Fragment, { children: [
|
|
30869
|
+
return /* @__PURE__ */ jsx57("div", { className, style, children: /* @__PURE__ */ jsxs34(
|
|
30870
|
+
"div",
|
|
30871
|
+
{
|
|
30872
|
+
className: `
|
|
30873
|
+
flex flex-col lg:flex-row items-start lg:items-center
|
|
30874
|
+
justify-between bg-red p-2 rounded-lg border border-gray-200 w-full
|
|
30875
|
+
gap-3 lg:gap-0
|
|
30876
|
+
${isMobile ? "p-3 sm:p-4" : "p-2"}
|
|
30877
|
+
`,
|
|
30878
|
+
children: [
|
|
30879
|
+
/* @__PURE__ */ jsx57("div", { className: "flex items-center flex-shrink-0 order-1 lg:order-1", children: /* @__PURE__ */ jsx57("button", { className: "p-2 hover:bg-gray-100 rounded flex-shrink-0", children: /* @__PURE__ */ jsx57("svg", { className: "w-4 h-4 text-gray-600", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx57("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M19 9l-7 7-7-7" }) }) }) }),
|
|
30870
30880
|
/* @__PURE__ */ jsx57(
|
|
30871
|
-
"
|
|
30881
|
+
"div",
|
|
30872
30882
|
{
|
|
30873
30883
|
className: `
|
|
30874
|
-
|
|
30875
|
-
|
|
30876
|
-
|
|
30877
|
-
|
|
30878
|
-
|
|
30879
|
-
|
|
30880
|
-
|
|
30884
|
+
flex flex-col sm:flex-row items-center flex-1 px-1 sm:px-2
|
|
30885
|
+
flex-wrap gap-2 sm:gap-2 lg:gap-3 w-full lg:w-auto
|
|
30886
|
+
${isMobile ? "order-2 mt-2 lg:mt-0" : "order-2"}
|
|
30887
|
+
`,
|
|
30888
|
+
children: loading ? Array(6).fill(null).map((_, index) => /* @__PURE__ */ jsx57(
|
|
30889
|
+
"button",
|
|
30890
|
+
{
|
|
30891
|
+
className: `
|
|
30892
|
+
min-w-[70px] sm:min-w-[80px] w-full sm:w-auto
|
|
30893
|
+
min-h-[32px] sm:min-h-[35px] px-3 sm:px-4 py-2 rounded-full
|
|
30894
|
+
text-xs sm:text-sm font-medium transition-colors duration-200
|
|
30895
|
+
whitespace-nowrap text-gray-700 hover:bg-gray-100 border
|
|
30896
|
+
border-gray-200 bg-gray-100 animate-pulse flex-shrink-0
|
|
30897
|
+
${isMobile ? "flex-1" : ""}
|
|
30898
|
+
`,
|
|
30899
|
+
disabled: true
|
|
30900
|
+
},
|
|
30901
|
+
index
|
|
30902
|
+
)) : stages?.length > 0 && stages?.map((stage, index) => {
|
|
30903
|
+
const currentIndex = stages.findIndex((s) => s[dataKey] === activeStage);
|
|
30904
|
+
const isCompletedStage = isAllStagesCompleted || index <= currentIndex;
|
|
30905
|
+
const isActive = !isAllStagesCompleted && index === currentIndex;
|
|
30906
|
+
return /* @__PURE__ */ jsxs34(React10.Fragment, { children: [
|
|
30907
|
+
/* @__PURE__ */ jsx57(
|
|
30908
|
+
"button",
|
|
30909
|
+
{
|
|
30910
|
+
className: `
|
|
30911
|
+
min-w-[70px] sm:min-w-[80px] w-full sm:w-auto px-3 sm:px-4 py-1.5 sm:py-2
|
|
30912
|
+
rounded-full text-xs sm:text-sm font-medium transition-colors duration-200
|
|
30913
|
+
whitespace-normal sm:whitespace-nowrap flex-shrink-0
|
|
30914
|
+
${isActive ? "bg-green-700 text-white shadow-md" : isCompletedStage ? "bg-green-50 text-green-700 border-2 border-green-700" : "bg-white text-gray-700 hover:bg-gray-100 border border-gray-200"}
|
|
30915
|
+
${isMobile ? "flex-1 text-center py-2.5" : ""}
|
|
30916
|
+
`,
|
|
30917
|
+
onClick: () => {
|
|
30918
|
+
if (isAllStagesCompleted) return;
|
|
30919
|
+
onStageClick(stage[dataKey]);
|
|
30920
|
+
},
|
|
30921
|
+
children: stage[dataLabel]
|
|
30922
|
+
}
|
|
30923
|
+
),
|
|
30924
|
+
!isMobile && index < stages.length - 1 && /* @__PURE__ */ jsx57("div", { className: "hidden sm:flex sm:flex-shrink-0 w-3 h-px bg-gray-300 sm:w-4" })
|
|
30925
|
+
] }, stage.id);
|
|
30926
|
+
})
|
|
30881
30927
|
}
|
|
30882
30928
|
),
|
|
30883
|
-
|
|
30884
|
-
|
|
30885
|
-
|
|
30886
|
-
|
|
30887
|
-
|
|
30888
|
-
|
|
30889
|
-
|
|
30890
|
-
|
|
30891
|
-
|
|
30892
|
-
|
|
30893
|
-
|
|
30894
|
-
|
|
30895
|
-
|
|
30896
|
-
|
|
30897
|
-
|
|
30929
|
+
isShowBtn && /* @__PURE__ */ jsx57(
|
|
30930
|
+
"div",
|
|
30931
|
+
{
|
|
30932
|
+
className: `
|
|
30933
|
+
flex items-center flex-shrink-0 w-full lg:w-auto
|
|
30934
|
+
${isMobile ? "order-3 mt-3 lg:mt-0" : "order-3"}
|
|
30935
|
+
`,
|
|
30936
|
+
children: /* @__PURE__ */ jsx57(
|
|
30937
|
+
"button",
|
|
30938
|
+
{
|
|
30939
|
+
className: `
|
|
30940
|
+
w-full lg:w-auto bg-green-700 text-white px-4 lg:px-6 py-2.5
|
|
30941
|
+
rounded-lg text-sm font-medium transition-colors duration-200
|
|
30942
|
+
shadow-sm ${disabled ? "opacity-50 cursor-not-allowed" : "hover:shadow-md"}
|
|
30943
|
+
`,
|
|
30944
|
+
onClick: nextStage,
|
|
30945
|
+
disabled,
|
|
30946
|
+
children: saving ? "Updating..." : buttonText
|
|
30947
|
+
}
|
|
30948
|
+
)
|
|
30949
|
+
}
|
|
30950
|
+
)
|
|
30951
|
+
]
|
|
30952
|
+
}
|
|
30953
|
+
) });
|
|
30898
30954
|
};
|
|
30899
30955
|
var Stages_default = StagesComponent;
|
|
30900
30956
|
|
|
@@ -31099,7 +31155,8 @@ function Navbar({
|
|
|
31099
31155
|
}
|
|
31100
31156
|
|
|
31101
31157
|
// src/components/Chart/BarChart.tsx
|
|
31102
|
-
import React12 from "react";
|
|
31158
|
+
import React12, { useEffect as useEffect25, useMemo as useMemo9, useState as useState12, useCallback as useCallback5 } from "react";
|
|
31159
|
+
import axios2 from "axios";
|
|
31103
31160
|
import {
|
|
31104
31161
|
BarChart,
|
|
31105
31162
|
Bar,
|
|
@@ -31113,194 +31170,611 @@ import {
|
|
|
31113
31170
|
Legend
|
|
31114
31171
|
} from "recharts";
|
|
31115
31172
|
import { jsx as jsx64, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
31116
|
-
var
|
|
31117
|
-
const
|
|
31173
|
+
var getRandomColor = () => {
|
|
31174
|
+
const palette = [
|
|
31175
|
+
"#2563eb",
|
|
31176
|
+
"#1d4ed8",
|
|
31177
|
+
"#1e40af",
|
|
31178
|
+
"#1e3a8a",
|
|
31179
|
+
"#1e293b",
|
|
31180
|
+
"#10b981",
|
|
31181
|
+
"#059669",
|
|
31182
|
+
"#047857",
|
|
31183
|
+
"#065f46",
|
|
31184
|
+
"#022c22",
|
|
31185
|
+
"#f59e0b",
|
|
31186
|
+
"#d97706",
|
|
31187
|
+
"#b45309",
|
|
31188
|
+
"#92400e",
|
|
31189
|
+
"#422006",
|
|
31190
|
+
"#ef4444",
|
|
31191
|
+
"#dc2626",
|
|
31192
|
+
"#b91c1c",
|
|
31193
|
+
"#991b1b",
|
|
31194
|
+
"#7f1d1d",
|
|
31195
|
+
"#8b5cf6",
|
|
31196
|
+
"#7c3aed",
|
|
31197
|
+
"#6d28d9",
|
|
31198
|
+
"#5b21b6",
|
|
31199
|
+
"#4c1d95",
|
|
31200
|
+
"#14b8a6",
|
|
31201
|
+
"#0d9488",
|
|
31202
|
+
"#0f766e",
|
|
31203
|
+
"#115e59",
|
|
31204
|
+
"#134e4a",
|
|
31205
|
+
"#ec4899",
|
|
31206
|
+
"#db2777",
|
|
31207
|
+
"#be185d",
|
|
31208
|
+
"#9d174d",
|
|
31209
|
+
"#831843",
|
|
31210
|
+
"#22c55e",
|
|
31211
|
+
"#16a34a",
|
|
31212
|
+
"#15803d",
|
|
31213
|
+
"#166534",
|
|
31214
|
+
"#14532d"
|
|
31215
|
+
];
|
|
31216
|
+
return palette[Math.floor(Math.random() * palette.length)];
|
|
31217
|
+
};
|
|
31218
|
+
var ChartComponent = ({
|
|
31219
|
+
className,
|
|
31220
|
+
style,
|
|
31221
|
+
loading: externalLoading,
|
|
31222
|
+
dataKey,
|
|
31223
|
+
dataLabel,
|
|
31224
|
+
apiUrl,
|
|
31225
|
+
isPaginationEnabled,
|
|
31226
|
+
limit = 10,
|
|
31227
|
+
canvasMode,
|
|
31228
|
+
...props
|
|
31229
|
+
}) => {
|
|
31230
|
+
const [rawData, setRawData] = useState12([]);
|
|
31231
|
+
const [rawMeta, setRawMeta] = useState12(null);
|
|
31232
|
+
const [localLoading, setLocalLoading] = useState12(false);
|
|
31233
|
+
const [currentPage, setCurrentPage] = useState12(1);
|
|
31234
|
+
const effectiveData = apiUrl ? rawData : props.data || [];
|
|
31235
|
+
const effectiveLoading = apiUrl ? localLoading : externalLoading;
|
|
31236
|
+
useEffect25(() => {
|
|
31237
|
+
if (apiUrl) {
|
|
31238
|
+
setCurrentPage(1);
|
|
31239
|
+
}
|
|
31240
|
+
}, [apiUrl]);
|
|
31241
|
+
const fetchData = useCallback5(async (page) => {
|
|
31242
|
+
if (!apiUrl) return;
|
|
31243
|
+
const cancelled = false;
|
|
31244
|
+
try {
|
|
31245
|
+
setLocalLoading(true);
|
|
31246
|
+
const params = new URLSearchParams({
|
|
31247
|
+
page: page.toString(),
|
|
31248
|
+
limit: limit.toString()
|
|
31249
|
+
});
|
|
31250
|
+
const res = await axios2.get(`${apiUrl}?${params.toString()}`, {
|
|
31251
|
+
withCredentials: true
|
|
31252
|
+
});
|
|
31253
|
+
if (!cancelled) {
|
|
31254
|
+
let data2 = [];
|
|
31255
|
+
let meta = null;
|
|
31256
|
+
if (res.data?.success && Array.isArray(res.data.data)) {
|
|
31257
|
+
data2 = res.data.data;
|
|
31258
|
+
meta = res.data.meta || null;
|
|
31259
|
+
} else if (Array.isArray(res.data)) {
|
|
31260
|
+
data2 = res.data;
|
|
31261
|
+
}
|
|
31262
|
+
setRawData(data2);
|
|
31263
|
+
setRawMeta(meta);
|
|
31264
|
+
}
|
|
31265
|
+
} catch (err) {
|
|
31266
|
+
if (!cancelled) {
|
|
31267
|
+
showSonnerToast({
|
|
31268
|
+
title: err?.response?.data?.message || err?.message || "Failed to load chart data",
|
|
31269
|
+
variant: "error"
|
|
31270
|
+
});
|
|
31271
|
+
setRawData([]);
|
|
31272
|
+
}
|
|
31273
|
+
} finally {
|
|
31274
|
+
if (!cancelled) setLocalLoading(false);
|
|
31275
|
+
}
|
|
31276
|
+
}, [apiUrl, limit]);
|
|
31277
|
+
useEffect25(() => {
|
|
31278
|
+
if (!apiUrl) return;
|
|
31279
|
+
fetchData(currentPage);
|
|
31280
|
+
}, [apiUrl, currentPage, fetchData]);
|
|
31281
|
+
const handlePageChange = (newPage) => {
|
|
31282
|
+
if (rawMeta && (newPage < 1 || newPage > rawMeta.pages)) return;
|
|
31283
|
+
setCurrentPage(newPage);
|
|
31284
|
+
};
|
|
31285
|
+
const data = useMemo9(() => {
|
|
31286
|
+
if (!Array.isArray(effectiveData) || effectiveData.length === 0 || !dataKey || !dataLabel) {
|
|
31287
|
+
return [];
|
|
31288
|
+
}
|
|
31289
|
+
return effectiveData.map((item) => ({
|
|
31290
|
+
...item,
|
|
31291
|
+
[dataKey]: Number(item[dataKey] || 0),
|
|
31292
|
+
fill: getRandomColor()
|
|
31293
|
+
}));
|
|
31294
|
+
}, [effectiveData, dataKey, dataLabel]);
|
|
31118
31295
|
const chartType = props.chartType || "bar";
|
|
31119
|
-
const legendsPosition =
|
|
31120
|
-
if (
|
|
31121
|
-
return /* @__PURE__ */
|
|
31296
|
+
const legendsPosition = ["middle", "bottom"].includes(props.legendsPosition) ? props.legendsPosition : "top";
|
|
31297
|
+
if (effectiveLoading || data.length === 0) {
|
|
31298
|
+
return /* @__PURE__ */ jsxs38(
|
|
31122
31299
|
"div",
|
|
31123
31300
|
{
|
|
31124
|
-
className: `flex
|
|
31301
|
+
className: `relative flex flex-col w-full h-[300px] md:h-[400px] bg-gradient-to-br from-gray-50 to-gray-100 rounded-xl p-6 ${className}`,
|
|
31125
31302
|
style,
|
|
31126
|
-
children:
|
|
31303
|
+
children: [
|
|
31304
|
+
/* @__PURE__ */ jsx64("div", { className: "mb-6 flex justify-center", children: /* @__PURE__ */ jsxs38("div", { className: "inline-flex items-center space-x-2 bg-white/90 px-6 py-2.5 rounded-xl backdrop-blur-sm border border-gray-200 shadow-lg", children: [
|
|
31305
|
+
/* @__PURE__ */ jsx64("div", { className: "w-5 h-5 border-2 border-gray-400 border-t-blue-500 rounded-full animate-spin" }),
|
|
31306
|
+
/* @__PURE__ */ jsx64("span", { className: "text-sm font-medium text-gray-700 bg-gradient-to-r from-gray-300 bg-clip-text animate-pulse", children: "Loading chart data..." })
|
|
31307
|
+
] }) }),
|
|
31308
|
+
/* @__PURE__ */ jsx64("div", { className: "absolute inset-0 bg-gradient-to-r from-transparent via-white/60 to-transparent animate-shimmer rounded-xl" }),
|
|
31309
|
+
/* @__PURE__ */ jsx64("div", { className: "flex-1 relative w-full h-full min-h-[240px] md:min-h-[320px] bg-white/80 rounded-lg border border-gray-200/50 shadow-sm", children: /* @__PURE__ */ jsx64("div", { className: "absolute bottom-0 left-4 right-4 flex gap-2 h-[200px] md:h-[280px] justify-center items-end", children: [...Array(20)].map((_, idx) => {
|
|
31310
|
+
const randomHeight = `${Math.floor(Math.random() * 76) + 20}%`;
|
|
31311
|
+
return /* @__PURE__ */ jsxs38(
|
|
31312
|
+
"div",
|
|
31313
|
+
{
|
|
31314
|
+
className: `relative w-10 md:w-12 flex-1 max-w-[48px] rounded-t-lg bg-gradient-to-t from-gray-100 via-gray-200 to-transparent shadow-lg border border-gray-200/50 animate-slide-up stagger-${idx} overflow-hidden`,
|
|
31315
|
+
style: { height: randomHeight, animationDelay: `${idx * 0.08}s` },
|
|
31316
|
+
children: [
|
|
31317
|
+
/* @__PURE__ */ jsx64("div", { className: "absolute inset-0 bg-gradient-to-r from-white/40 via-transparent to-white/40 animate-shimmer-bar" }),
|
|
31318
|
+
/* @__PURE__ */ jsx64("div", { className: "absolute bottom-1 left-1/2 w-4 h-1 rounded-full transform -translate-x-1/2 blur-sm" })
|
|
31319
|
+
]
|
|
31320
|
+
},
|
|
31321
|
+
`bar-${idx}`
|
|
31322
|
+
);
|
|
31323
|
+
}) }) })
|
|
31324
|
+
]
|
|
31127
31325
|
}
|
|
31128
31326
|
);
|
|
31129
31327
|
}
|
|
31130
|
-
return /* @__PURE__ */
|
|
31131
|
-
/* @__PURE__ */
|
|
31132
|
-
|
|
31133
|
-
|
|
31134
|
-
|
|
31135
|
-
|
|
31136
|
-
|
|
31137
|
-
|
|
31138
|
-
|
|
31139
|
-
|
|
31140
|
-
|
|
31141
|
-
|
|
31142
|
-
|
|
31143
|
-
|
|
31144
|
-
|
|
31328
|
+
return /* @__PURE__ */ jsxs38("div", { className: `${className} h-[450px]`, style, children: [
|
|
31329
|
+
isPaginationEnabled && rawMeta && /* @__PURE__ */ jsxs38("div", { className: "flex items-center justify-between mb-4 px-2", children: [
|
|
31330
|
+
/* @__PURE__ */ jsxs38("div", { className: "text-sm text-gray-600 hidden sm:block", children: [
|
|
31331
|
+
"Page ",
|
|
31332
|
+
rawMeta.page,
|
|
31333
|
+
" of ",
|
|
31334
|
+
rawMeta.pages,
|
|
31335
|
+
" (",
|
|
31336
|
+
rawMeta.total.toLocaleString(),
|
|
31337
|
+
" total records)"
|
|
31338
|
+
] }),
|
|
31339
|
+
/* @__PURE__ */ jsxs38("div", { className: "flex items-center space-x-2 sm:hidden w-full justify-center", children: [
|
|
31340
|
+
/* @__PURE__ */ jsx64(
|
|
31341
|
+
"button",
|
|
31342
|
+
{
|
|
31343
|
+
onClick: () => handlePageChange(currentPage - 1),
|
|
31344
|
+
disabled: currentPage === 1 || localLoading,
|
|
31345
|
+
className: "flex-1 px-3 py-2 text-xs font-medium rounded-lg border bg-white shadow-sm hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed transition-all duration-200 flex items-center justify-center space-x-1 min-w-0",
|
|
31346
|
+
children: /* @__PURE__ */ jsx64("span", { children: "\u2190 Prev" })
|
|
31347
|
+
}
|
|
31348
|
+
),
|
|
31349
|
+
/* @__PURE__ */ jsx64("span", { className: "px-2 py-2 text-xs font-semibold text-gray-700 min-w-[36px] text-center flex-shrink-0", children: currentPage }),
|
|
31350
|
+
/* @__PURE__ */ jsx64(
|
|
31351
|
+
"button",
|
|
31352
|
+
{
|
|
31353
|
+
onClick: () => handlePageChange(currentPage + 1),
|
|
31354
|
+
disabled: currentPage >= rawMeta.pages || localLoading,
|
|
31355
|
+
className: "flex-1 px-3 py-2 text-xs font-medium rounded-lg border bg-white shadow-sm hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed transition-all duration-200 flex items-center justify-center space-x-1 min-w-0",
|
|
31356
|
+
children: /* @__PURE__ */ jsx64("span", { children: "Next \u2192" })
|
|
31357
|
+
}
|
|
31358
|
+
)
|
|
31359
|
+
] }),
|
|
31360
|
+
/* @__PURE__ */ jsxs38("div", { className: "flex items-center space-x-2 hidden sm:flex", children: [
|
|
31361
|
+
/* @__PURE__ */ jsx64(
|
|
31362
|
+
"button",
|
|
31145
31363
|
{
|
|
31146
|
-
|
|
31364
|
+
onClick: () => handlePageChange(currentPage - 1),
|
|
31365
|
+
disabled: currentPage === 1 || localLoading,
|
|
31366
|
+
className: "px-3 py-1.5 text-sm font-medium rounded-lg border bg-white shadow-sm hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed transition-all duration-200 flex items-center space-x-1",
|
|
31367
|
+
children: /* @__PURE__ */ jsx64("span", { children: "\u2190 Prev" })
|
|
31368
|
+
}
|
|
31369
|
+
),
|
|
31370
|
+
/* @__PURE__ */ jsx64("span", { className: "px-3 py-1 text-sm font-medium text-gray-700", children: currentPage }),
|
|
31371
|
+
/* @__PURE__ */ jsx64(
|
|
31372
|
+
"button",
|
|
31373
|
+
{
|
|
31374
|
+
onClick: () => handlePageChange(currentPage + 1),
|
|
31375
|
+
disabled: currentPage >= rawMeta.pages || localLoading,
|
|
31376
|
+
className: "px-3 py-1.5 text-sm font-medium rounded-lg border bg-white shadow-sm hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed transition-all duration-200 flex items-center space-x-1",
|
|
31377
|
+
children: /* @__PURE__ */ jsx64("span", { children: "Next \u2192" })
|
|
31378
|
+
}
|
|
31379
|
+
)
|
|
31380
|
+
] })
|
|
31381
|
+
] }),
|
|
31382
|
+
/* @__PURE__ */ jsx64(ResponsiveContainer, { width: "100%", height: "100%", children: chartType === "bar" ? /* @__PURE__ */ jsxs38(BarChart, { data, children: [
|
|
31383
|
+
/* @__PURE__ */ jsx64(CartesianGrid, { strokeDasharray: "3 3" }),
|
|
31384
|
+
/* @__PURE__ */ jsx64(
|
|
31385
|
+
XAxis,
|
|
31386
|
+
{
|
|
31387
|
+
dataKey: dataLabel,
|
|
31388
|
+
angle: -45,
|
|
31389
|
+
textAnchor: "end",
|
|
31390
|
+
interval: 0,
|
|
31391
|
+
tickFormatter: (value) => value?.toString().length > 10 ? `${value.toString().substring(0, 10)}...` : value,
|
|
31392
|
+
tick: {
|
|
31393
|
+
fontSize: 13,
|
|
31394
|
+
fontWeight: 500,
|
|
31395
|
+
fill: "#666",
|
|
31396
|
+
fontFamily: "inherit"
|
|
31147
31397
|
},
|
|
31148
|
-
|
|
31149
|
-
|
|
31150
|
-
|
|
31151
|
-
|
|
31152
|
-
|
|
31153
|
-
|
|
31154
|
-
|
|
31155
|
-
|
|
31156
|
-
|
|
31157
|
-
|
|
31158
|
-
|
|
31159
|
-
|
|
31160
|
-
|
|
31161
|
-
|
|
31162
|
-
|
|
31163
|
-
|
|
31164
|
-
|
|
31165
|
-
|
|
31166
|
-
|
|
31167
|
-
|
|
31168
|
-
|
|
31169
|
-
|
|
31170
|
-
|
|
31171
|
-
|
|
31172
|
-
|
|
31398
|
+
height: 80,
|
|
31399
|
+
className: "hidden sm:block"
|
|
31400
|
+
}
|
|
31401
|
+
),
|
|
31402
|
+
/* @__PURE__ */ jsx64(
|
|
31403
|
+
YAxis,
|
|
31404
|
+
{
|
|
31405
|
+
tickFormatter: (value) => `${(value / 1e3).toFixed(0)}k`,
|
|
31406
|
+
tick: {
|
|
31407
|
+
fontSize: 12,
|
|
31408
|
+
fill: "#94a3b8",
|
|
31409
|
+
fontWeight: 500
|
|
31410
|
+
},
|
|
31411
|
+
domain: ["dataMin", "dataMax"],
|
|
31412
|
+
width: 60
|
|
31413
|
+
}
|
|
31414
|
+
),
|
|
31415
|
+
/* @__PURE__ */ jsx64(Tooltip, { formatter: (value) => [`${value}`, "Count"] }),
|
|
31416
|
+
/* @__PURE__ */ jsx64(Legend, { verticalAlign: legendsPosition, align: "center" }),
|
|
31417
|
+
/* @__PURE__ */ jsx64(
|
|
31418
|
+
Bar,
|
|
31419
|
+
{
|
|
31420
|
+
dataKey,
|
|
31421
|
+
radius: [6, 6, 0, 0],
|
|
31422
|
+
isAnimationActive: false
|
|
31423
|
+
}
|
|
31424
|
+
)
|
|
31425
|
+
] }) : /* @__PURE__ */ jsxs38(AreaChart, { data, children: [
|
|
31426
|
+
/* @__PURE__ */ jsx64("defs", { children: /* @__PURE__ */ jsxs38("linearGradient", { id: "colorCount", x1: "0", y1: "0", x2: "0", y2: "1", children: [
|
|
31427
|
+
/* @__PURE__ */ jsx64("stop", { offset: "5%", stopColor: "#00695C", stopOpacity: 0.8 }),
|
|
31428
|
+
/* @__PURE__ */ jsx64("stop", { offset: "95%", stopColor: "#00695C", stopOpacity: 0 })
|
|
31429
|
+
] }) }),
|
|
31430
|
+
/* @__PURE__ */ jsx64(CartesianGrid, { strokeDasharray: "3 3" }),
|
|
31431
|
+
/* @__PURE__ */ jsx64(
|
|
31432
|
+
XAxis,
|
|
31433
|
+
{
|
|
31434
|
+
dataKey: dataLabel,
|
|
31435
|
+
angle: 0,
|
|
31436
|
+
interval: 0,
|
|
31437
|
+
tick: {
|
|
31438
|
+
fontSize: 13,
|
|
31439
|
+
fontWeight: 500,
|
|
31440
|
+
fill: "#666",
|
|
31441
|
+
fontFamily: "inherit"
|
|
31442
|
+
}
|
|
31443
|
+
}
|
|
31444
|
+
),
|
|
31445
|
+
/* @__PURE__ */ jsx64(
|
|
31446
|
+
YAxis,
|
|
31447
|
+
{
|
|
31448
|
+
tickFormatter: (value) => `${(value / 1e3).toFixed(0)}k`,
|
|
31449
|
+
tick: {
|
|
31450
|
+
fontSize: 12,
|
|
31451
|
+
fill: "#94a3b8",
|
|
31452
|
+
fontWeight: 500
|
|
31453
|
+
},
|
|
31454
|
+
domain: ["dataMin", "dataMax"],
|
|
31455
|
+
width: 60
|
|
31456
|
+
}
|
|
31457
|
+
),
|
|
31458
|
+
/* @__PURE__ */ jsx64(Tooltip, { formatter: (value) => `${value}k` }),
|
|
31459
|
+
/* @__PURE__ */ jsx64(
|
|
31460
|
+
Area,
|
|
31461
|
+
{
|
|
31462
|
+
type: "monotone",
|
|
31463
|
+
dataKey,
|
|
31464
|
+
stroke: "#00695C",
|
|
31465
|
+
fillOpacity: 1,
|
|
31466
|
+
fill: "url(#colorCount)",
|
|
31467
|
+
isAnimationActive: false
|
|
31468
|
+
}
|
|
31469
|
+
)
|
|
31470
|
+
] }) })
|
|
31471
|
+
] });
|
|
31173
31472
|
};
|
|
31174
31473
|
var BarChart_default = React12.memo(ChartComponent);
|
|
31175
31474
|
|
|
31176
31475
|
// src/components/Chart/PieChart.tsx
|
|
31177
|
-
import React13, { useEffect as
|
|
31476
|
+
import React13, { useEffect as useEffect26, useMemo as useMemo10, useState as useState13 } from "react";
|
|
31477
|
+
import axios3 from "axios";
|
|
31178
31478
|
import {
|
|
31179
31479
|
PieChart,
|
|
31180
31480
|
Pie,
|
|
31181
31481
|
Cell,
|
|
31182
31482
|
ResponsiveContainer as ResponsiveContainer2,
|
|
31183
|
-
Tooltip as Tooltip2
|
|
31184
|
-
LabelList
|
|
31483
|
+
Tooltip as Tooltip2
|
|
31185
31484
|
} from "recharts";
|
|
31186
|
-
import {
|
|
31187
|
-
var
|
|
31485
|
+
import { jsx as jsx65, jsxs as jsxs39 } from "react/jsx-runtime";
|
|
31486
|
+
var getRandomColor2 = () => {
|
|
31188
31487
|
const palette = [
|
|
31189
31488
|
"#2563eb",
|
|
31489
|
+
"#1d4ed8",
|
|
31490
|
+
"#1e40af",
|
|
31491
|
+
"#1e3a8a",
|
|
31492
|
+
"#1e293b",
|
|
31190
31493
|
"#10b981",
|
|
31494
|
+
"#059669",
|
|
31495
|
+
"#047857",
|
|
31496
|
+
"#065f46",
|
|
31497
|
+
"#022c22",
|
|
31191
31498
|
"#f59e0b",
|
|
31499
|
+
"#d97706",
|
|
31500
|
+
"#b45309",
|
|
31501
|
+
"#92400e",
|
|
31502
|
+
"#422006",
|
|
31192
31503
|
"#ef4444",
|
|
31504
|
+
"#dc2626",
|
|
31505
|
+
"#b91c1c",
|
|
31506
|
+
"#991b1b",
|
|
31507
|
+
"#7f1d1d",
|
|
31193
31508
|
"#8b5cf6",
|
|
31509
|
+
"#7c3aed",
|
|
31510
|
+
"#6d28d9",
|
|
31511
|
+
"#5b21b6",
|
|
31512
|
+
"#4c1d95",
|
|
31194
31513
|
"#14b8a6",
|
|
31514
|
+
"#0d9488",
|
|
31515
|
+
"#0f766e",
|
|
31516
|
+
"#115e59",
|
|
31517
|
+
"#134e4a",
|
|
31195
31518
|
"#ec4899",
|
|
31196
|
-
"#
|
|
31519
|
+
"#db2777",
|
|
31520
|
+
"#be185d",
|
|
31521
|
+
"#9d174d",
|
|
31522
|
+
"#831843",
|
|
31197
31523
|
"#22c55e",
|
|
31198
|
-
"#
|
|
31524
|
+
"#16a34a",
|
|
31525
|
+
"#15803d",
|
|
31526
|
+
"#166534",
|
|
31527
|
+
"#14532d",
|
|
31528
|
+
"#3b82f6",
|
|
31529
|
+
"#2563eb",
|
|
31530
|
+
"#1d4ed8",
|
|
31531
|
+
"#1e40af",
|
|
31532
|
+
"#1e3a8a",
|
|
31533
|
+
"#f97316",
|
|
31534
|
+
"#ea580c",
|
|
31535
|
+
"#c2410c",
|
|
31536
|
+
"#9a3412",
|
|
31537
|
+
"#7c2d12",
|
|
31538
|
+
"#a855f7",
|
|
31539
|
+
"#9333ea",
|
|
31540
|
+
"#7e22ce",
|
|
31541
|
+
"#6b21a8",
|
|
31542
|
+
"#581c87",
|
|
31543
|
+
"#06b6d4",
|
|
31544
|
+
"#0891b2",
|
|
31545
|
+
"#0e7490",
|
|
31546
|
+
"#155e75",
|
|
31547
|
+
"#164e63"
|
|
31199
31548
|
];
|
|
31200
31549
|
return palette[Math.floor(Math.random() * palette.length)];
|
|
31201
31550
|
};
|
|
31202
|
-
var DonutChart = ({
|
|
31551
|
+
var DonutChart = ({
|
|
31552
|
+
className,
|
|
31553
|
+
style,
|
|
31554
|
+
loading: externalLoading,
|
|
31555
|
+
dataKey = "value",
|
|
31556
|
+
dataLabel = "name",
|
|
31557
|
+
apiUrl,
|
|
31558
|
+
...props
|
|
31559
|
+
}) => {
|
|
31203
31560
|
const showLegends = props.showLegends ?? true;
|
|
31204
|
-
const labelType = props.labelType || "inside";
|
|
31205
31561
|
const canvasMode = props.canvasMode;
|
|
31206
|
-
const
|
|
31207
|
-
|
|
31208
|
-
|
|
31209
|
-
|
|
31210
|
-
|
|
31562
|
+
const [rawData, setRawData] = useState13([]);
|
|
31563
|
+
const [localLoading, setLocalLoading] = useState13(false);
|
|
31564
|
+
const effectiveData = apiUrl ? rawData : props.data || [];
|
|
31565
|
+
const effectiveLoading = apiUrl ? localLoading : externalLoading;
|
|
31566
|
+
useEffect26(() => {
|
|
31567
|
+
if (!apiUrl) return;
|
|
31568
|
+
let cancelled = false;
|
|
31569
|
+
const fetchData = async () => {
|
|
31570
|
+
try {
|
|
31571
|
+
setLocalLoading(true);
|
|
31572
|
+
const res = await axios3.get(apiUrl, {
|
|
31573
|
+
withCredentials: true
|
|
31574
|
+
});
|
|
31575
|
+
if (!cancelled) {
|
|
31576
|
+
let data2 = [];
|
|
31577
|
+
if (res.data?.success && Array.isArray(res.data.data)) {
|
|
31578
|
+
data2 = res.data.data;
|
|
31579
|
+
} else if (Array.isArray(res.data)) {
|
|
31580
|
+
data2 = res.data;
|
|
31581
|
+
}
|
|
31582
|
+
setRawData(data2);
|
|
31583
|
+
}
|
|
31584
|
+
} catch (err) {
|
|
31585
|
+
if (!cancelled) {
|
|
31586
|
+
showSonnerToast({
|
|
31587
|
+
title: err?.response?.data?.message || err?.message || "Failed to load chart data",
|
|
31588
|
+
variant: "error"
|
|
31589
|
+
});
|
|
31590
|
+
setRawData([]);
|
|
31591
|
+
}
|
|
31592
|
+
} finally {
|
|
31593
|
+
if (!cancelled) setLocalLoading(false);
|
|
31594
|
+
}
|
|
31595
|
+
};
|
|
31596
|
+
fetchData();
|
|
31597
|
+
return () => {
|
|
31598
|
+
cancelled = true;
|
|
31599
|
+
};
|
|
31600
|
+
}, [apiUrl]);
|
|
31601
|
+
const data = useMemo10(() => {
|
|
31602
|
+
if (!Array.isArray(effectiveData) || effectiveData.length === 0) return [];
|
|
31603
|
+
return effectiveData.map((item) => ({
|
|
31604
|
+
...item,
|
|
31605
|
+
color: item.color || getRandomColor2(),
|
|
31606
|
+
[dataKey]: Number(item[dataKey] ?? 0),
|
|
31607
|
+
[dataLabel]: item[dataLabel] ?? "Unknown"
|
|
31608
|
+
}));
|
|
31609
|
+
}, [effectiveData, dataKey, dataLabel]);
|
|
31610
|
+
const total = useMemo10(
|
|
31611
|
+
() => data.reduce((sum, d) => sum + (d[dataKey] ?? 0), 0),
|
|
31612
|
+
[data, dataKey]
|
|
31613
|
+
);
|
|
31614
|
+
const formattedTotal = useMemo10(() => {
|
|
31615
|
+
if (total >= 1e6) {
|
|
31616
|
+
return `${(total / 1e6).toFixed(1)}M`;
|
|
31617
|
+
}
|
|
31618
|
+
if (total >= 1e3) {
|
|
31619
|
+
return `${(total / 1e3).toFixed(0)}k`;
|
|
31620
|
+
}
|
|
31621
|
+
return total.toString();
|
|
31622
|
+
}, [total]);
|
|
31623
|
+
const chartData = useMemo10(() => {
|
|
31624
|
+
if (total === 0) return data;
|
|
31625
|
+
const sortedData = [...data].sort((a, b) => (b[dataKey] ?? 0) - (a[dataKey] ?? 0));
|
|
31626
|
+
const minAngle = 360 / Math.max(12, sortedData.length);
|
|
31627
|
+
const minValue = total * minAngle / 360;
|
|
31628
|
+
return sortedData.map((item, index) => {
|
|
31629
|
+
const value = item[dataKey] ?? 0;
|
|
31630
|
+
if (value < minValue && index < 12) {
|
|
31631
|
+
return {
|
|
31632
|
+
...item,
|
|
31633
|
+
[dataKey]: minValue * 1.2,
|
|
31634
|
+
isBoosted: true
|
|
31635
|
+
};
|
|
31636
|
+
}
|
|
31637
|
+
return item;
|
|
31638
|
+
});
|
|
31639
|
+
}, [data, total, dataKey]);
|
|
31211
31640
|
const forceMobile = canvasMode === "mobile" || canvasMode === "tablet";
|
|
31212
|
-
const
|
|
31213
|
-
|
|
31641
|
+
const getDynamicRadius = () => {
|
|
31642
|
+
if (forceMobile) return { inner: 60, outer: 100 };
|
|
31643
|
+
if (chartData.length <= 6) return { inner: 85, outer: 150 };
|
|
31644
|
+
return { inner: 70, outer: 130 };
|
|
31645
|
+
};
|
|
31646
|
+
const [mounted, setMounted] = useState13(false);
|
|
31647
|
+
useEffect26(() => {
|
|
31214
31648
|
const timeout = setTimeout(() => setMounted(true), 100);
|
|
31215
31649
|
return () => clearTimeout(timeout);
|
|
31216
31650
|
}, []);
|
|
31217
|
-
const renderLegends =
|
|
31651
|
+
const renderLegends = useMemo10(() => {
|
|
31218
31652
|
if (!showLegends) return null;
|
|
31219
|
-
return /* @__PURE__ */ jsx65(
|
|
31220
|
-
|
|
31221
|
-
|
|
31222
|
-
|
|
31223
|
-
|
|
31224
|
-
|
|
31225
|
-
|
|
31226
|
-
|
|
31227
|
-
|
|
31228
|
-
|
|
31229
|
-
|
|
31230
|
-
|
|
31231
|
-
|
|
31232
|
-
|
|
31233
|
-
|
|
31234
|
-
|
|
31235
|
-
|
|
31236
|
-
|
|
31653
|
+
return /* @__PURE__ */ jsx65("div", { className: "flex flex-wrap justify-center gap-2 mt-4 w-full max-w-4xl", children: chartData.map((d, index) => {
|
|
31654
|
+
const actualValue = data.find(
|
|
31655
|
+
(item) => item[dataLabel] === d[dataLabel]
|
|
31656
|
+
)?.[dataKey] ?? d[dataKey];
|
|
31657
|
+
const displayValue = actualValue >= 1e3 ? `${(actualValue / 1e3).toFixed(0)}k` : actualValue.toLocaleString();
|
|
31658
|
+
return /* @__PURE__ */ jsxs39(
|
|
31659
|
+
"div",
|
|
31660
|
+
{
|
|
31661
|
+
className: "flex items-center space-x-2 rounded-lg border border-gray-200/50 px-3 py-1.5 w-[48%] sm:w-[32%] md:w-auto bg-white/80 backdrop-blur-sm shadow-sm hover:shadow-md transition-all",
|
|
31662
|
+
children: [
|
|
31663
|
+
/* @__PURE__ */ jsx65(
|
|
31664
|
+
"span",
|
|
31665
|
+
{
|
|
31666
|
+
className: "inline-block w-[12px] h-[12px] rounded-full shrink-0 border-2 border-white/50",
|
|
31667
|
+
style: { backgroundColor: d.color }
|
|
31668
|
+
}
|
|
31669
|
+
),
|
|
31670
|
+
/* @__PURE__ */ jsxs39("div", { className: "min-w-0 flex-1", children: [
|
|
31671
|
+
/* @__PURE__ */ jsx65("span", { className: "text-gray-900 text-[11px] md:text-[13px] font-semibold block truncate leading-tight", children: d[dataLabel] }),
|
|
31672
|
+
/* @__PURE__ */ jsxs39("div", { className: "flex items-center gap-1 text-xs text-gray-600 font-medium", children: [
|
|
31673
|
+
/* @__PURE__ */ jsx65("span", { children: displayValue }),
|
|
31674
|
+
/* @__PURE__ */ jsxs39("span", { children: [
|
|
31675
|
+
(actualValue / total * 100).toFixed(1),
|
|
31676
|
+
"%"
|
|
31677
|
+
] }),
|
|
31678
|
+
d.isBoosted && /* @__PURE__ */ jsx65("span", { className: "text-[9px] px-1 py-0.5 bg-blue-100 text-blue-700 rounded-full", children: "min" })
|
|
31679
|
+
] })
|
|
31680
|
+
] })
|
|
31681
|
+
]
|
|
31682
|
+
},
|
|
31683
|
+
`legend-${index}`
|
|
31684
|
+
);
|
|
31685
|
+
}) });
|
|
31686
|
+
}, [chartData, data, dataLabel, dataKey, total, showLegends]);
|
|
31237
31687
|
if (!mounted) return null;
|
|
31238
|
-
if (
|
|
31239
|
-
return /* @__PURE__ */
|
|
31688
|
+
if (effectiveLoading || data.length === 0) {
|
|
31689
|
+
return /* @__PURE__ */ jsxs39(
|
|
31240
31690
|
"div",
|
|
31241
31691
|
{
|
|
31242
|
-
className: `flex
|
|
31692
|
+
className: `relative flex flex-col items-center w-full h-[300px] md:h-[400px] bg-gradient-to-br from-gray-50 to-gray-100 rounded-xl p-6 ${className}`,
|
|
31243
31693
|
style,
|
|
31244
|
-
children:
|
|
31245
|
-
|
|
31246
|
-
|
|
31247
|
-
|
|
31248
|
-
|
|
31249
|
-
"div",
|
|
31250
|
-
{
|
|
31251
|
-
className: `relative flex flex-col items-center ${className}`,
|
|
31252
|
-
style,
|
|
31253
|
-
children: [
|
|
31254
|
-
/* @__PURE__ */ jsxs39("div", { className: "relative w-full md:w-[70%] h-[300px] md:h-[400px] flex items-center justify-center", children: [
|
|
31255
|
-
/* @__PURE__ */ jsx65(ResponsiveContainer2, { width: "99%", height: "100%", children: /* @__PURE__ */ jsxs39(PieChart, { children: [
|
|
31256
|
-
/* @__PURE__ */ jsxs39(
|
|
31257
|
-
Pie,
|
|
31258
|
-
{
|
|
31259
|
-
data,
|
|
31260
|
-
cx: "50%",
|
|
31261
|
-
cy: "50%",
|
|
31262
|
-
innerRadius: forceMobile ? 60 : 80,
|
|
31263
|
-
outerRadius: forceMobile ? 100 : 140,
|
|
31264
|
-
dataKey: "value",
|
|
31265
|
-
labelLine: false,
|
|
31266
|
-
isAnimationActive: false,
|
|
31267
|
-
children: [
|
|
31268
|
-
data.map((entry, index) => /* @__PURE__ */ jsx65(Cell, { fill: entry.color }, `cell-${index}`)),
|
|
31269
|
-
/* @__PURE__ */ jsx65(
|
|
31270
|
-
LabelList,
|
|
31271
|
-
{
|
|
31272
|
-
dataKey: "value",
|
|
31273
|
-
position: labelType === "inside" ? "inside" : "outside",
|
|
31274
|
-
fill: labelType === "inside" ? "#fff" : "#000",
|
|
31275
|
-
fontSize: forceMobile ? 10 : 13,
|
|
31276
|
-
fontWeight: 600
|
|
31277
|
-
}
|
|
31278
|
-
)
|
|
31279
|
-
]
|
|
31280
|
-
}
|
|
31281
|
-
),
|
|
31282
|
-
/* @__PURE__ */ jsx65(
|
|
31283
|
-
Tooltip2,
|
|
31284
|
-
{
|
|
31285
|
-
formatter: (value, name) => [`${value}k`, name]
|
|
31286
|
-
}
|
|
31287
|
-
)
|
|
31694
|
+
children: [
|
|
31695
|
+
/* @__PURE__ */ jsx65("div", { className: "absolute inset-0 bg-gradient-to-r from-transparent via-white/60 to-transparent animate-shimmer rounded-xl" }),
|
|
31696
|
+
/* @__PURE__ */ jsx65("div", { className: "mt-6 text-center", children: /* @__PURE__ */ jsxs39("div", { className: "inline-flex items-center space-x-2 bg-white/80 px-6 py-2 rounded-full backdrop-blur-sm border border-gray-200 shadow-lg", children: [
|
|
31697
|
+
/* @__PURE__ */ jsx65("div", { className: "w-5 h-5 border-2 border-gray-300 border-t-blue-400 rounded-full animate-spin" }),
|
|
31698
|
+
/* @__PURE__ */ jsx65("span", { className: "text-sm font-medium text-gray-600 bg-gradient-to-r from-gray-300 bg-clip-text animate-pulse", children: "Loading chart data..." })
|
|
31288
31699
|
] }) }),
|
|
31289
|
-
/* @__PURE__ */ jsxs39(
|
|
31700
|
+
/* @__PURE__ */ jsx65("div", { className: "flex flex-wrap justify-center gap-3 mt-8 w-full max-w-4xl", children: [...Array(18)].map((_, idx) => /* @__PURE__ */ jsxs39(
|
|
31290
31701
|
"div",
|
|
31291
31702
|
{
|
|
31292
|
-
className: `
|
|
31703
|
+
className: `h-10 w-[48%] sm:w-[32%] md:w-32 rounded-xl bg-gradient-to-r from-gray-200 via-gray-300/50 to-gray-200 p-3 flex items-center space-x-3 animate-slide-up stagger-${idx} shadow-sm border border-gray-200/50`,
|
|
31293
31704
|
children: [
|
|
31294
|
-
|
|
31295
|
-
"
|
|
31705
|
+
/* @__PURE__ */ jsx65("div", { className: "w-4 h-4 rounded-full bg-gradient-to-r from-blue-300 to-purple-300 animate-pulse" }),
|
|
31706
|
+
/* @__PURE__ */ jsxs39("div", { className: "flex-1 space-y-1", children: [
|
|
31707
|
+
/* @__PURE__ */ jsx65("div", { className: "h-3 w-20 bg-gray-300 rounded animate-pulse" }),
|
|
31708
|
+
/* @__PURE__ */ jsx65("div", { className: "h-2.5 w-16 bg-gray-200/60 rounded animate-pulse-delayed" })
|
|
31709
|
+
] })
|
|
31296
31710
|
]
|
|
31711
|
+
},
|
|
31712
|
+
idx
|
|
31713
|
+
)) })
|
|
31714
|
+
]
|
|
31715
|
+
}
|
|
31716
|
+
);
|
|
31717
|
+
}
|
|
31718
|
+
const { inner, outer } = getDynamicRadius();
|
|
31719
|
+
const innerRadius = inner;
|
|
31720
|
+
const outerRadius = outer;
|
|
31721
|
+
return /* @__PURE__ */ jsxs39("div", { className: `relative flex flex-col items-center ${className}`, style, children: [
|
|
31722
|
+
/* @__PURE__ */ jsxs39("div", { className: "relative w-full md:w-[75%] h-[280px] md:h-[380px] flex items-center justify-center mb-2", children: [
|
|
31723
|
+
/* @__PURE__ */ jsx65(ResponsiveContainer2, { width: "100%", height: "100%", children: /* @__PURE__ */ jsxs39(PieChart, { children: [
|
|
31724
|
+
/* @__PURE__ */ jsx65(
|
|
31725
|
+
Pie,
|
|
31726
|
+
{
|
|
31727
|
+
data: chartData,
|
|
31728
|
+
cx: "50%",
|
|
31729
|
+
cy: "50%",
|
|
31730
|
+
innerRadius,
|
|
31731
|
+
outerRadius,
|
|
31732
|
+
dataKey,
|
|
31733
|
+
labelLine: false,
|
|
31734
|
+
isAnimationActive: true,
|
|
31735
|
+
animationDuration: 800,
|
|
31736
|
+
minAngle: 3,
|
|
31737
|
+
children: chartData.map((entry, index) => /* @__PURE__ */ jsx65(
|
|
31738
|
+
Cell,
|
|
31739
|
+
{
|
|
31740
|
+
fill: entry.color,
|
|
31741
|
+
stroke: entry.isBoosted ? "#fff" : "transparent",
|
|
31742
|
+
strokeWidth: entry.isBoosted ? 1.5 : 0
|
|
31743
|
+
},
|
|
31744
|
+
`cell-${index}`
|
|
31745
|
+
))
|
|
31746
|
+
}
|
|
31747
|
+
),
|
|
31748
|
+
/* @__PURE__ */ jsx65(
|
|
31749
|
+
Tooltip2,
|
|
31750
|
+
{
|
|
31751
|
+
formatter: (value, name, payload) => {
|
|
31752
|
+
const label = payload && payload.payload ? payload.payload[dataLabel] : name;
|
|
31753
|
+
const actualItem = data.find((item) => item[dataLabel] === label);
|
|
31754
|
+
const actualValue = actualItem ? actualItem[dataKey] : value;
|
|
31755
|
+
const valueFormatted = actualValue >= 1e3 ? `${(actualValue / 1e3).toFixed(0)}k` : actualValue.toLocaleString();
|
|
31756
|
+
const percentage = (actualValue / total * 100).toFixed(1);
|
|
31757
|
+
return [
|
|
31758
|
+
`${label}: ${valueFormatted} (${percentage}%)`
|
|
31759
|
+
];
|
|
31760
|
+
},
|
|
31761
|
+
contentStyle: {
|
|
31762
|
+
backgroundColor: "white",
|
|
31763
|
+
border: "1px solid #e5e7eb",
|
|
31764
|
+
borderRadius: "8px",
|
|
31765
|
+
fontSize: "13px",
|
|
31766
|
+
padding: "8px 12px"
|
|
31297
31767
|
}
|
|
31298
|
-
|
|
31299
|
-
|
|
31300
|
-
|
|
31301
|
-
]
|
|
31302
|
-
|
|
31303
|
-
|
|
31768
|
+
}
|
|
31769
|
+
)
|
|
31770
|
+
] }) }),
|
|
31771
|
+
total > 0 && /* @__PURE__ */ jsx65("div", { className: `absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 text-center pointer-events-none ${forceMobile ? "text-xl px-2" : "text-3xl px-4"} font-bold bg-white/90 backdrop-blur-sm rounded-full py-1 shadow-lg`, children: /* @__PURE__ */ jsxs39("div", { className: "text-[#1f2937] leading-tight", children: [
|
|
31772
|
+
formattedTotal,
|
|
31773
|
+
/* @__PURE__ */ jsx65("span", { className: "text-sm md:text-base font-normal text-gray-600 block md:inline-block md:ml-1", children: "total" })
|
|
31774
|
+
] }) })
|
|
31775
|
+
] }),
|
|
31776
|
+
renderLegends
|
|
31777
|
+
] });
|
|
31304
31778
|
};
|
|
31305
31779
|
var PieChart_default = React13.memo(DonutChart);
|
|
31306
31780
|
|