@underverse-ui/underverse 1.0.58 → 1.0.59
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/api-reference.json +2 -170
- package/dist/index.cjs +547 -2213
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -209
- package/dist/index.d.ts +1 -209
- package/dist/index.js +533 -2192
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -32,11 +32,9 @@ var index_exports = {};
|
|
|
32
32
|
__export(index_exports, {
|
|
33
33
|
AccessDenied: () => AccessDenied,
|
|
34
34
|
Alert: () => Alert_default,
|
|
35
|
-
AreaChart: () => AreaChart,
|
|
36
35
|
Avatar: () => Avatar_default,
|
|
37
36
|
Badge: () => Badge_default,
|
|
38
37
|
BadgeBase: () => Badge,
|
|
39
|
-
BarChart: () => BarChart,
|
|
40
38
|
BatteryProgress: () => BatteryProgress,
|
|
41
39
|
BottomSheet: () => BottomSheet,
|
|
42
40
|
Breadcrumb: () => Breadcrumb_default,
|
|
@@ -77,7 +75,6 @@ __export(index_exports, {
|
|
|
77
75
|
FormLabel: () => FormLabel,
|
|
78
76
|
FormMessage: () => FormMessage,
|
|
79
77
|
FormSubmitButton: () => FormSubmitButton,
|
|
80
|
-
GaugeChart: () => GaugeChart,
|
|
81
78
|
GlobalLoading: () => GlobalLoading,
|
|
82
79
|
GradientBadge: () => GradientBadge,
|
|
83
80
|
Grid: () => Grid_default,
|
|
@@ -89,7 +86,6 @@ __export(index_exports, {
|
|
|
89
86
|
Label: () => Label,
|
|
90
87
|
LanguageSwitcher: () => LanguageSwitcherHeadless,
|
|
91
88
|
LanguageSwitcherHeadless: () => LanguageSwitcherHeadless,
|
|
92
|
-
LineChart: () => LineChart,
|
|
93
89
|
List: () => List_default,
|
|
94
90
|
ListItem: () => ListItem,
|
|
95
91
|
LoadingBar: () => LoadingBar,
|
|
@@ -112,12 +108,10 @@ __export(index_exports, {
|
|
|
112
108
|
PageLoading: () => PageLoading,
|
|
113
109
|
Pagination: () => Pagination,
|
|
114
110
|
PasswordInput: () => PasswordInput,
|
|
115
|
-
PieChart: () => PieChart,
|
|
116
111
|
PillTabs: () => PillTabs,
|
|
117
112
|
Popover: () => Popover,
|
|
118
113
|
Progress: () => Progress,
|
|
119
114
|
PulseBadge: () => PulseBadge,
|
|
120
|
-
RadarChart: () => RadarChart,
|
|
121
115
|
RadioGroup: () => RadioGroup,
|
|
122
116
|
RadioGroupItem: () => RadioGroupItem,
|
|
123
117
|
SIZE_STYLES_BTN: () => SIZE_STYLES_BTN,
|
|
@@ -142,7 +136,6 @@ __export(index_exports, {
|
|
|
142
136
|
SlideOver: () => SlideOver,
|
|
143
137
|
Slider: () => Slider,
|
|
144
138
|
SmartImage: () => SmartImage,
|
|
145
|
-
Sparkline: () => Sparkline,
|
|
146
139
|
StatusBadge: () => StatusBadge,
|
|
147
140
|
StepProgress: () => StepProgress,
|
|
148
141
|
Switch: () => Switch_default,
|
|
@@ -18670,1675 +18663,23 @@ GridItem.displayName = "Grid.Item";
|
|
|
18670
18663
|
var Grid = Object.assign(GridRoot, { Item: GridItem });
|
|
18671
18664
|
var Grid_default = Grid;
|
|
18672
18665
|
|
|
18673
|
-
// src/components/
|
|
18674
|
-
var import_react27 = require("react");
|
|
18675
|
-
|
|
18676
|
-
// src/components/ChartTooltip.tsx
|
|
18666
|
+
// src/components/ClientOnly.tsx
|
|
18677
18667
|
var import_react26 = require("react");
|
|
18678
|
-
var import_react_dom6 = require("react-dom");
|
|
18679
18668
|
var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
18680
|
-
function ChartTooltip({
|
|
18681
|
-
x,
|
|
18682
|
-
y,
|
|
18683
|
-
visible,
|
|
18684
|
-
label,
|
|
18685
|
-
value,
|
|
18686
|
-
color,
|
|
18687
|
-
secondaryLabel,
|
|
18688
|
-
secondaryValue,
|
|
18689
|
-
items,
|
|
18690
|
-
containerRef,
|
|
18691
|
-
formatter
|
|
18692
|
-
}) {
|
|
18693
|
-
const [isMounted, setIsMounted] = (0, import_react26.useState)(false);
|
|
18694
|
-
const [position, setPosition] = (0, import_react26.useState)(null);
|
|
18695
|
-
const tooltipRef = (0, import_react26.useRef)(null);
|
|
18696
|
-
(0, import_react26.useEffect)(() => {
|
|
18697
|
-
setIsMounted(true);
|
|
18698
|
-
}, []);
|
|
18699
|
-
(0, import_react26.useEffect)(() => {
|
|
18700
|
-
if (visible && containerRef?.current) {
|
|
18701
|
-
const rect = containerRef.current.getBoundingClientRect();
|
|
18702
|
-
const tw = tooltipRef.current?.offsetWidth ?? 160;
|
|
18703
|
-
const th = tooltipRef.current?.offsetHeight ?? 80;
|
|
18704
|
-
let left = rect.left + x + 12;
|
|
18705
|
-
let top = rect.top + y - th / 2;
|
|
18706
|
-
if (left + tw > window.innerWidth - 8) {
|
|
18707
|
-
left = rect.left + x - tw - 12;
|
|
18708
|
-
}
|
|
18709
|
-
if (top + th > window.innerHeight - 8) {
|
|
18710
|
-
top = window.innerHeight - th - 8;
|
|
18711
|
-
}
|
|
18712
|
-
if (top < 8) top = 8;
|
|
18713
|
-
if (left < 8) left = 8;
|
|
18714
|
-
setPosition({ top, left });
|
|
18715
|
-
}
|
|
18716
|
-
}, [visible, x, y, containerRef]);
|
|
18717
|
-
if (!visible || !isMounted || !position) return null;
|
|
18718
|
-
const tooltipContent = /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(
|
|
18719
|
-
"div",
|
|
18720
|
-
{
|
|
18721
|
-
ref: tooltipRef,
|
|
18722
|
-
style: {
|
|
18723
|
-
position: "fixed",
|
|
18724
|
-
top: position.top,
|
|
18725
|
-
left: position.left,
|
|
18726
|
-
zIndex: 99999,
|
|
18727
|
-
pointerEvents: "none",
|
|
18728
|
-
animation: "chartTooltipFadeIn 0.15s ease-out"
|
|
18729
|
-
},
|
|
18730
|
-
children: [
|
|
18731
|
-
/* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(
|
|
18732
|
-
"div",
|
|
18733
|
-
{
|
|
18734
|
-
className: cn("bg-popover text-popover-foreground border border-border/50", "rounded-2xl shadow-xl px-3 py-2 text-sm", "backdrop-blur-sm"),
|
|
18735
|
-
style: {
|
|
18736
|
-
minWidth: "80px",
|
|
18737
|
-
width: "max-content",
|
|
18738
|
-
boxShadow: "0 10px 25px -3px rgba(0, 0, 0, 0.5), 0 4px 10px -2px rgba(0, 0, 0, 0.3)"
|
|
18739
|
-
},
|
|
18740
|
-
children: [
|
|
18741
|
-
label && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("div", { className: "text-muted-foreground text-xs mb-1", children: label }),
|
|
18742
|
-
items && items.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("div", { className: "flex flex-col gap-1", children: items.map((item, i) => /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
18743
|
-
item.color && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("div", { className: "w-2 h-2 rounded-full shrink-0", style: { backgroundColor: item.color } }),
|
|
18744
|
-
/* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("span", { className: "text-muted-foreground", children: [
|
|
18745
|
-
item.label,
|
|
18746
|
-
":"
|
|
18747
|
-
] }),
|
|
18748
|
-
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)("span", { className: "font-semibold ml-auto", children: formatter ? formatter(item.value) : item.value })
|
|
18749
|
-
] }, i)) }) : /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(import_jsx_runtime57.Fragment, { children: [
|
|
18750
|
-
/* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
18751
|
-
color && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("div", { className: "w-2 h-2 rounded-full shrink-0", style: { backgroundColor: color } }),
|
|
18752
|
-
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)("span", { className: "font-semibold", children: formatter && value != null ? formatter(value) : value })
|
|
18753
|
-
] }),
|
|
18754
|
-
secondaryLabel && /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("div", { className: "text-muted-foreground text-xs mt-1", children: [
|
|
18755
|
-
secondaryLabel,
|
|
18756
|
-
": ",
|
|
18757
|
-
secondaryValue
|
|
18758
|
-
] })
|
|
18759
|
-
] })
|
|
18760
|
-
]
|
|
18761
|
-
}
|
|
18762
|
-
),
|
|
18763
|
-
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)("style", { children: `
|
|
18764
|
-
@keyframes chartTooltipFadeIn {
|
|
18765
|
-
from { opacity: 0; transform: translateX(-5px); }
|
|
18766
|
-
to { opacity: 1; transform: translateX(0); }
|
|
18767
|
-
}
|
|
18768
|
-
` })
|
|
18769
|
-
]
|
|
18770
|
-
}
|
|
18771
|
-
);
|
|
18772
|
-
return (0, import_react_dom6.createPortal)(tooltipContent, document.body);
|
|
18773
|
-
}
|
|
18774
|
-
|
|
18775
|
-
// src/utils/chart-utils.ts
|
|
18776
|
-
var React51 = __toESM(require("react"), 1);
|
|
18777
|
-
function getCatmullRomSpline(points, tension = 0.5) {
|
|
18778
|
-
if (points.length < 2) return "";
|
|
18779
|
-
if (points.length === 2) {
|
|
18780
|
-
return `M ${points[0].x} ${points[0].y} L ${points[1].x} ${points[1].y}`;
|
|
18781
|
-
}
|
|
18782
|
-
let path = `M ${points[0].x} ${points[0].y}`;
|
|
18783
|
-
for (let i = 0; i < points.length - 1; i++) {
|
|
18784
|
-
const p0 = points[Math.max(0, i - 1)];
|
|
18785
|
-
const p1 = points[i];
|
|
18786
|
-
const p2 = points[i + 1];
|
|
18787
|
-
const p3 = points[Math.min(points.length - 1, i + 2)];
|
|
18788
|
-
const cp1x = p1.x + (p2.x - p0.x) * tension / 6;
|
|
18789
|
-
const cp1y = p1.y + (p2.y - p0.y) * tension / 6;
|
|
18790
|
-
const cp2x = p2.x - (p3.x - p1.x) * tension / 6;
|
|
18791
|
-
const cp2y = p2.y - (p3.y - p1.y) * tension / 6;
|
|
18792
|
-
path += ` C ${cp1x} ${cp1y}, ${cp2x} ${cp2y}, ${p2.x} ${p2.y}`;
|
|
18793
|
-
}
|
|
18794
|
-
return path;
|
|
18795
|
-
}
|
|
18796
|
-
function getPathLength(points) {
|
|
18797
|
-
return points.reduce((acc, p, i) => {
|
|
18798
|
-
if (i === 0) return 0;
|
|
18799
|
-
const prev = points[i - 1];
|
|
18800
|
-
return acc + Math.sqrt((p.x - prev.x) ** 2 + (p.y - prev.y) ** 2);
|
|
18801
|
-
}, 0);
|
|
18802
|
-
}
|
|
18803
|
-
|
|
18804
|
-
// src/components/LineChart.tsx
|
|
18805
|
-
var import_jsx_runtime58 = require("react/jsx-runtime");
|
|
18806
|
-
function LineChart({
|
|
18807
|
-
data,
|
|
18808
|
-
series,
|
|
18809
|
-
width = 400,
|
|
18810
|
-
height = 200,
|
|
18811
|
-
color = "currentColor",
|
|
18812
|
-
fillColor,
|
|
18813
|
-
showDots = true,
|
|
18814
|
-
showGrid = true,
|
|
18815
|
-
showLabels = true,
|
|
18816
|
-
showValues = false,
|
|
18817
|
-
showLegend,
|
|
18818
|
-
animated = true,
|
|
18819
|
-
curved = true,
|
|
18820
|
-
formatValue,
|
|
18821
|
-
referenceLines = [],
|
|
18822
|
-
labelClassName,
|
|
18823
|
-
className = ""
|
|
18824
|
-
}) {
|
|
18825
|
-
const svgRef = (0, import_react27.useRef)(null);
|
|
18826
|
-
const clipId = (0, import_react27.useRef)(`line-clip-${Math.random().toString(36).slice(2, 8)}`).current;
|
|
18827
|
-
const padding = { top: 20, right: 20, bottom: 40, left: 40 };
|
|
18828
|
-
const chartWidth = width - padding.left - padding.right;
|
|
18829
|
-
const chartHeight = height - padding.top - padding.bottom;
|
|
18830
|
-
const [hoveredPoint, setHoveredPoint] = (0, import_react27.useState)(null);
|
|
18831
|
-
const [hiddenSeries, setHiddenSeries] = (0, import_react27.useState)(/* @__PURE__ */ new Set());
|
|
18832
|
-
const toggleSeries = (0, import_react27.useCallback)((name) => {
|
|
18833
|
-
setHiddenSeries((prev) => {
|
|
18834
|
-
const next = new Set(prev);
|
|
18835
|
-
if (next.has(name)) next.delete(name);
|
|
18836
|
-
else next.add(name);
|
|
18837
|
-
return next;
|
|
18838
|
-
});
|
|
18839
|
-
}, []);
|
|
18840
|
-
const normalizedSeries = (0, import_react27.useMemo)(() => {
|
|
18841
|
-
if (series && series.length > 0) return series;
|
|
18842
|
-
if (data && data.length > 0) return [{ name: "", data, color, fillColor }];
|
|
18843
|
-
return [];
|
|
18844
|
-
}, [series, data, color, fillColor]);
|
|
18845
|
-
const isMultiSeries = normalizedSeries.length > 1;
|
|
18846
|
-
const { minValue, maxValue, processedSeries, labels } = (0, import_react27.useMemo)(() => {
|
|
18847
|
-
if (!normalizedSeries.length || !normalizedSeries[0]?.data?.length) {
|
|
18848
|
-
return { minValue: 0, maxValue: 0, processedSeries: [], labels: [] };
|
|
18849
|
-
}
|
|
18850
|
-
const allLabels = normalizedSeries[0].data.map((d) => d.label);
|
|
18851
|
-
const allValues = normalizedSeries.flatMap((s) => s.data.map((d) => d.value));
|
|
18852
|
-
const min = Math.min(...allValues);
|
|
18853
|
-
const max = Math.max(...allValues);
|
|
18854
|
-
const range = max - min || 1;
|
|
18855
|
-
const processed = normalizedSeries.map((s) => {
|
|
18856
|
-
const pts = s.data.map((d, i) => ({
|
|
18857
|
-
x: padding.left + i / (s.data.length - 1 || 1) * chartWidth,
|
|
18858
|
-
y: padding.top + chartHeight - (d.value - min) / range * chartHeight,
|
|
18859
|
-
...d
|
|
18860
|
-
}));
|
|
18861
|
-
let linePath = "";
|
|
18862
|
-
let areaPath = "";
|
|
18863
|
-
if (curved && pts.length > 2) {
|
|
18864
|
-
linePath = getCatmullRomSpline(pts);
|
|
18865
|
-
areaPath = `${linePath} L ${pts[pts.length - 1].x} ${padding.top + chartHeight} L ${pts[0].x} ${padding.top + chartHeight} Z`;
|
|
18866
|
-
} else {
|
|
18867
|
-
linePath = pts.map((p, i) => `${i === 0 ? "M" : "L"} ${p.x} ${p.y}`).join(" ");
|
|
18868
|
-
areaPath = `M ${pts[0].x} ${padding.top + chartHeight} ` + pts.map((p) => `L ${p.x} ${p.y}`).join(" ") + ` L ${pts[pts.length - 1].x} ${padding.top + chartHeight} Z`;
|
|
18869
|
-
}
|
|
18870
|
-
const lineLength = getPathLength(pts);
|
|
18871
|
-
return { ...s, points: pts, linePath, areaPath, lineLength };
|
|
18872
|
-
});
|
|
18873
|
-
return { minValue: min, maxValue: max, processedSeries: processed, labels: allLabels };
|
|
18874
|
-
}, [normalizedSeries, chartWidth, chartHeight, curved, padding.left, padding.top]);
|
|
18875
|
-
const gridLines = (0, import_react27.useMemo)(() => {
|
|
18876
|
-
const lines = [];
|
|
18877
|
-
const steps = 5;
|
|
18878
|
-
for (let i = 0; i <= steps; i++) {
|
|
18879
|
-
const y = padding.top + i / steps * chartHeight;
|
|
18880
|
-
const value = maxValue - i / steps * (maxValue - minValue);
|
|
18881
|
-
lines.push({ y, value });
|
|
18882
|
-
}
|
|
18883
|
-
return lines;
|
|
18884
|
-
}, [minValue, maxValue, chartHeight, padding.top]);
|
|
18885
|
-
return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(import_jsx_runtime58.Fragment, { children: [
|
|
18886
|
-
/* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("svg", { ref: svgRef, width, height, className: `overflow-visible ${className}`, style: { fontFamily: "inherit" }, children: [
|
|
18887
|
-
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("clipPath", { id: clipId, children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("rect", { x: padding.left, y: padding.top, width: chartWidth, height: chartHeight }) }) }),
|
|
18888
|
-
showGrid && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("g", { className: "text-muted-foreground/20", children: gridLines.map((line, i) => /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("g", { children: [
|
|
18889
|
-
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("line", { x1: padding.left, y1: line.y, x2: width - padding.right, y2: line.y, stroke: "currentColor", strokeDasharray: "4 4" }),
|
|
18890
|
-
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
18891
|
-
"text",
|
|
18892
|
-
{
|
|
18893
|
-
x: padding.left - 8,
|
|
18894
|
-
y: line.y + 4,
|
|
18895
|
-
textAnchor: "end",
|
|
18896
|
-
fontSize: "10",
|
|
18897
|
-
fill: "currentColor",
|
|
18898
|
-
className: labelClassName || "text-muted-foreground",
|
|
18899
|
-
children: formatValue ? formatValue(line.value) : line.value.toFixed(0)
|
|
18900
|
-
}
|
|
18901
|
-
)
|
|
18902
|
-
] }, i)) }),
|
|
18903
|
-
/* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("g", { clipPath: `url(#${clipId})`, children: [
|
|
18904
|
-
processedSeries.map(
|
|
18905
|
-
(s, si) => s.fillColor && s.areaPath && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
18906
|
-
"path",
|
|
18907
|
-
{
|
|
18908
|
-
d: s.areaPath,
|
|
18909
|
-
fill: s.fillColor,
|
|
18910
|
-
className: "transition-opacity duration-300",
|
|
18911
|
-
opacity: hiddenSeries.has(s.name) ? 0 : 0.15,
|
|
18912
|
-
style: animated ? { opacity: 0, animation: `fadeIn 0.6s ease-out ${si * 0.1}s forwards` } : void 0
|
|
18913
|
-
},
|
|
18914
|
-
`area-${si}`
|
|
18915
|
-
)
|
|
18916
|
-
),
|
|
18917
|
-
processedSeries.map((s, si) => /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
18918
|
-
"path",
|
|
18919
|
-
{
|
|
18920
|
-
d: s.linePath,
|
|
18921
|
-
fill: "none",
|
|
18922
|
-
stroke: s.color,
|
|
18923
|
-
strokeWidth: 2,
|
|
18924
|
-
strokeLinecap: "round",
|
|
18925
|
-
strokeLinejoin: "round",
|
|
18926
|
-
className: "transition-opacity duration-300",
|
|
18927
|
-
opacity: hiddenSeries.has(s.name) ? 0 : 1,
|
|
18928
|
-
style: animated ? {
|
|
18929
|
-
strokeDasharray: s.lineLength,
|
|
18930
|
-
strokeDashoffset: s.lineLength,
|
|
18931
|
-
animation: `drawLine 1s ease-out ${si * 0.15}s forwards`
|
|
18932
|
-
} : void 0
|
|
18933
|
-
},
|
|
18934
|
-
`line-${si}`
|
|
18935
|
-
))
|
|
18936
|
-
] }),
|
|
18937
|
-
showDots && processedSeries.map(
|
|
18938
|
-
(s, si) => !hiddenSeries.has(s.name) && s.points.map((point, i) => /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(
|
|
18939
|
-
"g",
|
|
18940
|
-
{
|
|
18941
|
-
onMouseEnter: () => {
|
|
18942
|
-
if (isMultiSeries) {
|
|
18943
|
-
const items = processedSeries.filter((ps) => !hiddenSeries.has(ps.name)).map((ps) => ({
|
|
18944
|
-
label: ps.name,
|
|
18945
|
-
value: ps.points[i]?.value ?? 0,
|
|
18946
|
-
color: ps.color
|
|
18947
|
-
}));
|
|
18948
|
-
setHoveredPoint({ x: point.x, y: point.y, label: point.label, value: point.value, items });
|
|
18949
|
-
} else {
|
|
18950
|
-
setHoveredPoint({ x: point.x, y: point.y, label: point.label, value: point.value });
|
|
18951
|
-
}
|
|
18952
|
-
},
|
|
18953
|
-
onMouseLeave: () => setHoveredPoint(null),
|
|
18954
|
-
className: "cursor-pointer",
|
|
18955
|
-
children: [
|
|
18956
|
-
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
18957
|
-
"circle",
|
|
18958
|
-
{
|
|
18959
|
-
cx: point.x,
|
|
18960
|
-
cy: point.y,
|
|
18961
|
-
r: hoveredPoint?.x === point.x ? 6 : 4,
|
|
18962
|
-
fill: s.color,
|
|
18963
|
-
className: `transition-all duration-150 ${animated ? "animate-[scaleIn_0.3s_ease-out]" : ""}`,
|
|
18964
|
-
style: animated ? { animationDelay: `${si * 0.15 + i * 0.05}s`, animationFillMode: "both" } : void 0
|
|
18965
|
-
}
|
|
18966
|
-
),
|
|
18967
|
-
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("circle", { cx: point.x, cy: point.y, r: 16, fill: "transparent" }),
|
|
18968
|
-
showValues && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
18969
|
-
"text",
|
|
18970
|
-
{
|
|
18971
|
-
x: point.x,
|
|
18972
|
-
y: point.y - 12,
|
|
18973
|
-
textAnchor: "middle",
|
|
18974
|
-
fontSize: "10",
|
|
18975
|
-
fontWeight: "500",
|
|
18976
|
-
className: "text-foreground",
|
|
18977
|
-
fill: "currentColor",
|
|
18978
|
-
children: formatValue ? formatValue(point.value) : point.value
|
|
18979
|
-
}
|
|
18980
|
-
)
|
|
18981
|
-
]
|
|
18982
|
-
},
|
|
18983
|
-
`dot-${si}-${i}`
|
|
18984
|
-
))
|
|
18985
|
-
),
|
|
18986
|
-
referenceLines.map((ref, i) => {
|
|
18987
|
-
const range = maxValue - minValue || 1;
|
|
18988
|
-
const y = padding.top + chartHeight - (ref.value - minValue) / range * chartHeight;
|
|
18989
|
-
return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("g", { className: "pointer-events-none", children: [
|
|
18990
|
-
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
18991
|
-
"line",
|
|
18992
|
-
{
|
|
18993
|
-
x1: padding.left,
|
|
18994
|
-
y1: y,
|
|
18995
|
-
x2: padding.left + chartWidth,
|
|
18996
|
-
y2: y,
|
|
18997
|
-
stroke: ref.color || "#ef4444",
|
|
18998
|
-
strokeWidth: 1.5,
|
|
18999
|
-
strokeDasharray: ref.strokeDasharray || "6 4",
|
|
19000
|
-
opacity: 0.7
|
|
19001
|
-
}
|
|
19002
|
-
),
|
|
19003
|
-
ref.label && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("text", { x: padding.left + chartWidth + 4, y: y + 4, fontSize: "10", fill: ref.color || "#ef4444", fontWeight: "500", children: ref.label })
|
|
19004
|
-
] }, `ref-${i}`);
|
|
19005
|
-
}),
|
|
19006
|
-
hoveredPoint && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("g", { className: "pointer-events-none", children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
19007
|
-
"line",
|
|
19008
|
-
{
|
|
19009
|
-
x1: hoveredPoint.x,
|
|
19010
|
-
y1: padding.top,
|
|
19011
|
-
x2: hoveredPoint.x,
|
|
19012
|
-
y2: padding.top + chartHeight,
|
|
19013
|
-
stroke: "currentColor",
|
|
19014
|
-
strokeWidth: 1,
|
|
19015
|
-
strokeDasharray: "4 4",
|
|
19016
|
-
opacity: 0.3,
|
|
19017
|
-
className: "text-foreground"
|
|
19018
|
-
}
|
|
19019
|
-
) }),
|
|
19020
|
-
showLabels && labels.map((lbl, i) => {
|
|
19021
|
-
const x = padding.left + i / (labels.length - 1 || 1) * chartWidth;
|
|
19022
|
-
return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
19023
|
-
"text",
|
|
19024
|
-
{
|
|
19025
|
-
x,
|
|
19026
|
-
y: height - 10,
|
|
19027
|
-
textAnchor: "middle",
|
|
19028
|
-
fontSize: "10",
|
|
19029
|
-
className: labelClassName || "text-muted-foreground",
|
|
19030
|
-
fill: "currentColor",
|
|
19031
|
-
children: lbl
|
|
19032
|
-
},
|
|
19033
|
-
i
|
|
19034
|
-
);
|
|
19035
|
-
}),
|
|
19036
|
-
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("style", { children: `
|
|
19037
|
-
@keyframes drawLine {
|
|
19038
|
-
to { stroke-dashoffset: 0; }
|
|
19039
|
-
}
|
|
19040
|
-
@keyframes scaleIn {
|
|
19041
|
-
from { transform: scale(0); opacity: 0; }
|
|
19042
|
-
to { transform: scale(1); opacity: 1; }
|
|
19043
|
-
}
|
|
19044
|
-
@keyframes fadeIn {
|
|
19045
|
-
from { opacity: 0; }
|
|
19046
|
-
to { opacity: 0.15; }
|
|
19047
|
-
}
|
|
19048
|
-
` })
|
|
19049
|
-
] }),
|
|
19050
|
-
(showLegend ?? isMultiSeries) && isMultiSeries && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { className: "flex items-center justify-center gap-6 mt-2", children: normalizedSeries.map((s, i) => /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { className: "flex items-center gap-2 text-sm cursor-pointer select-none", onClick: () => toggleSeries(s.name), children: [
|
|
19051
|
-
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
19052
|
-
"div",
|
|
19053
|
-
{
|
|
19054
|
-
className: "w-3 h-3 rounded-md transition-opacity",
|
|
19055
|
-
style: { backgroundColor: s.color, opacity: hiddenSeries.has(s.name) ? 0.3 : 1 }
|
|
19056
|
-
}
|
|
19057
|
-
),
|
|
19058
|
-
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("span", { className: hiddenSeries.has(s.name) ? "text-muted-foreground/40 line-through" : "text-muted-foreground", children: s.name })
|
|
19059
|
-
] }, i)) }),
|
|
19060
|
-
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
19061
|
-
ChartTooltip,
|
|
19062
|
-
{
|
|
19063
|
-
x: hoveredPoint?.x ?? 0,
|
|
19064
|
-
y: hoveredPoint?.y ?? 0,
|
|
19065
|
-
visible: !!hoveredPoint,
|
|
19066
|
-
label: hoveredPoint?.label,
|
|
19067
|
-
value: !isMultiSeries ? hoveredPoint?.value : void 0,
|
|
19068
|
-
items: isMultiSeries ? hoveredPoint?.items : void 0,
|
|
19069
|
-
color: !isMultiSeries ? processedSeries[0]?.color || color : void 0,
|
|
19070
|
-
containerRef: svgRef,
|
|
19071
|
-
formatter: formatValue ? (v) => formatValue(Number(v)) : void 0
|
|
19072
|
-
}
|
|
19073
|
-
)
|
|
19074
|
-
] });
|
|
19075
|
-
}
|
|
19076
|
-
|
|
19077
|
-
// src/components/BarChart.tsx
|
|
19078
|
-
var import_react28 = require("react");
|
|
19079
|
-
var import_jsx_runtime59 = require("react/jsx-runtime");
|
|
19080
|
-
function BarChart({
|
|
19081
|
-
data,
|
|
19082
|
-
series,
|
|
19083
|
-
width = 400,
|
|
19084
|
-
height = 200,
|
|
19085
|
-
color = "currentColor",
|
|
19086
|
-
showLabels = true,
|
|
19087
|
-
showValues = true,
|
|
19088
|
-
showGrid = true,
|
|
19089
|
-
showLegend,
|
|
19090
|
-
horizontal = false,
|
|
19091
|
-
animated = true,
|
|
19092
|
-
stacked = false,
|
|
19093
|
-
barRadius = 4,
|
|
19094
|
-
barGap = 0.3,
|
|
19095
|
-
formatValue,
|
|
19096
|
-
labelClassName,
|
|
19097
|
-
className = ""
|
|
19098
|
-
}) {
|
|
19099
|
-
const svgRef = (0, import_react28.useRef)(null);
|
|
19100
|
-
const padding = (0, import_react28.useMemo)(
|
|
19101
|
-
() => horizontal ? { top: 20, right: 40, bottom: 20, left: 80 } : { top: 20, right: 20, bottom: 40, left: 40 },
|
|
19102
|
-
[horizontal]
|
|
19103
|
-
);
|
|
19104
|
-
const chartWidth = width - padding.left - padding.right;
|
|
19105
|
-
const chartHeight = height - padding.top - padding.bottom;
|
|
19106
|
-
const [hoveredBar, setHoveredBar] = (0, import_react28.useState)(null);
|
|
19107
|
-
const normalizedSeries = (0, import_react28.useMemo)(() => {
|
|
19108
|
-
if (series && series.length > 0) return series;
|
|
19109
|
-
if (data && data.length > 0) return [{ name: "", data, color }];
|
|
19110
|
-
return [];
|
|
19111
|
-
}, [series, data, color]);
|
|
19112
|
-
const isMultiSeries = normalizedSeries.length > 1;
|
|
19113
|
-
const { maxValue, barGroups, gridLines } = (0, import_react28.useMemo)(() => {
|
|
19114
|
-
if (!normalizedSeries.length || !normalizedSeries[0]?.data?.length) {
|
|
19115
|
-
return { maxValue: 0, barGroups: [], gridLines: [] };
|
|
19116
|
-
}
|
|
19117
|
-
const allLabels = normalizedSeries[0].data.map((d) => d.label);
|
|
19118
|
-
const seriesCount = normalizedSeries.length;
|
|
19119
|
-
const labelCount = allLabels.length;
|
|
19120
|
-
let max = 0;
|
|
19121
|
-
if (stacked) {
|
|
19122
|
-
for (let li = 0; li < labelCount; li++) {
|
|
19123
|
-
const stackVal = normalizedSeries.reduce((sum, s) => sum + (s.data[li]?.value || 0), 0);
|
|
19124
|
-
max = Math.max(max, stackVal);
|
|
19125
|
-
}
|
|
19126
|
-
} else {
|
|
19127
|
-
max = Math.max(...normalizedSeries.flatMap((s) => s.data.map((d) => d.value)));
|
|
19128
|
-
}
|
|
19129
|
-
const groups = allLabels.map((label, li) => {
|
|
19130
|
-
if (horizontal) {
|
|
19131
|
-
const groupH = chartHeight / labelCount;
|
|
19132
|
-
const gap = groupH * barGap;
|
|
19133
|
-
const usable = groupH - gap;
|
|
19134
|
-
if (stacked) {
|
|
19135
|
-
let cum = 0;
|
|
19136
|
-
const bars = normalizedSeries.map((s) => {
|
|
19137
|
-
const val = s.data[li]?.value || 0;
|
|
19138
|
-
const w = val / max * chartWidth;
|
|
19139
|
-
const bar = {
|
|
19140
|
-
x: padding.left + cum,
|
|
19141
|
-
y: padding.top + li * groupH + gap / 2,
|
|
19142
|
-
width: w,
|
|
19143
|
-
height: usable,
|
|
19144
|
-
value: val,
|
|
19145
|
-
color: s.data[li]?.color || s.color,
|
|
19146
|
-
seriesName: s.name,
|
|
19147
|
-
label
|
|
19148
|
-
};
|
|
19149
|
-
cum += w;
|
|
19150
|
-
return bar;
|
|
19151
|
-
});
|
|
19152
|
-
return { label, bars };
|
|
19153
|
-
} else {
|
|
19154
|
-
const bH = usable / seriesCount;
|
|
19155
|
-
const bars = normalizedSeries.map((s, si) => {
|
|
19156
|
-
const val = s.data[li]?.value || 0;
|
|
19157
|
-
return {
|
|
19158
|
-
x: padding.left,
|
|
19159
|
-
y: padding.top + li * groupH + gap / 2 + si * bH,
|
|
19160
|
-
width: val / max * chartWidth,
|
|
19161
|
-
height: bH,
|
|
19162
|
-
value: val,
|
|
19163
|
-
color: s.data[li]?.color || s.color,
|
|
19164
|
-
seriesName: s.name,
|
|
19165
|
-
label
|
|
19166
|
-
};
|
|
19167
|
-
});
|
|
19168
|
-
return { label, bars };
|
|
19169
|
-
}
|
|
19170
|
-
} else {
|
|
19171
|
-
const groupW = chartWidth / labelCount;
|
|
19172
|
-
const gap = groupW * barGap;
|
|
19173
|
-
const usable = groupW - gap;
|
|
19174
|
-
if (stacked) {
|
|
19175
|
-
let cum = 0;
|
|
19176
|
-
const bars = normalizedSeries.map((s) => {
|
|
19177
|
-
const val = s.data[li]?.value || 0;
|
|
19178
|
-
const h = val / max * chartHeight;
|
|
19179
|
-
const bar = {
|
|
19180
|
-
x: padding.left + li * groupW + gap / 2,
|
|
19181
|
-
y: padding.top + chartHeight - cum - h,
|
|
19182
|
-
width: usable,
|
|
19183
|
-
height: h,
|
|
19184
|
-
value: val,
|
|
19185
|
-
color: s.data[li]?.color || s.color,
|
|
19186
|
-
seriesName: s.name,
|
|
19187
|
-
label
|
|
19188
|
-
};
|
|
19189
|
-
cum += h;
|
|
19190
|
-
return bar;
|
|
19191
|
-
});
|
|
19192
|
-
return { label, bars };
|
|
19193
|
-
} else {
|
|
19194
|
-
const bW = usable / seriesCount;
|
|
19195
|
-
const bars = normalizedSeries.map((s, si) => {
|
|
19196
|
-
const val = s.data[li]?.value || 0;
|
|
19197
|
-
return {
|
|
19198
|
-
x: padding.left + li * groupW + gap / 2 + si * bW,
|
|
19199
|
-
y: padding.top + chartHeight - val / max * chartHeight,
|
|
19200
|
-
width: bW,
|
|
19201
|
-
height: val / max * chartHeight,
|
|
19202
|
-
value: val,
|
|
19203
|
-
color: s.data[li]?.color || s.color,
|
|
19204
|
-
seriesName: s.name,
|
|
19205
|
-
label
|
|
19206
|
-
};
|
|
19207
|
-
});
|
|
19208
|
-
return { label, bars };
|
|
19209
|
-
}
|
|
19210
|
-
}
|
|
19211
|
-
});
|
|
19212
|
-
const lines = [];
|
|
19213
|
-
const steps = 5;
|
|
19214
|
-
for (let i = 0; i <= steps; i++) {
|
|
19215
|
-
const value = i / steps * max;
|
|
19216
|
-
if (horizontal) {
|
|
19217
|
-
lines.push({ x: padding.left + i / steps * chartWidth, y1: padding.top, y2: height - padding.bottom, value });
|
|
19218
|
-
} else {
|
|
19219
|
-
lines.push({ y: padding.top + chartHeight - i / steps * chartHeight, x1: padding.left, x2: width - padding.right, value });
|
|
19220
|
-
}
|
|
19221
|
-
}
|
|
19222
|
-
return { maxValue: max, barGroups: groups, gridLines: lines };
|
|
19223
|
-
}, [normalizedSeries, chartWidth, chartHeight, horizontal, stacked, barGap, padding, width, height]);
|
|
19224
|
-
return /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(import_jsx_runtime59.Fragment, { children: [
|
|
19225
|
-
/* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("svg", { ref: svgRef, width, height, className: `overflow-visible ${className}`, style: { fontFamily: "inherit" }, children: [
|
|
19226
|
-
showGrid && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("g", { className: "text-muted-foreground/20", children: gridLines.map((line, i) => /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("g", { children: horizontal ? /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(import_jsx_runtime59.Fragment, { children: [
|
|
19227
|
-
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("line", { x1: line.x, y1: line.y1, x2: line.x, y2: line.y2, stroke: "currentColor", strokeDasharray: "4 4" }),
|
|
19228
|
-
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
19229
|
-
"text",
|
|
19230
|
-
{
|
|
19231
|
-
x: line.x,
|
|
19232
|
-
y: height - 8,
|
|
19233
|
-
textAnchor: "middle",
|
|
19234
|
-
fontSize: "10",
|
|
19235
|
-
className: labelClassName || "text-muted-foreground",
|
|
19236
|
-
fill: "currentColor",
|
|
19237
|
-
children: formatValue ? formatValue(line.value) : line.value.toFixed(0)
|
|
19238
|
-
}
|
|
19239
|
-
)
|
|
19240
|
-
] }) : /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(import_jsx_runtime59.Fragment, { children: [
|
|
19241
|
-
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("line", { x1: line.x1, y1: line.y, x2: line.x2, y2: line.y, stroke: "currentColor", strokeDasharray: "4 4" }),
|
|
19242
|
-
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
19243
|
-
"text",
|
|
19244
|
-
{
|
|
19245
|
-
x: padding.left - 8,
|
|
19246
|
-
y: line.y + 4,
|
|
19247
|
-
textAnchor: "end",
|
|
19248
|
-
fontSize: "10",
|
|
19249
|
-
className: labelClassName || "text-muted-foreground",
|
|
19250
|
-
fill: "currentColor",
|
|
19251
|
-
children: formatValue ? formatValue(line.value) : line.value.toFixed(0)
|
|
19252
|
-
}
|
|
19253
|
-
)
|
|
19254
|
-
] }) }, i)) }),
|
|
19255
|
-
barGroups.map((group, gi) => /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("g", { children: [
|
|
19256
|
-
group.bars.map((bar, bi) => {
|
|
19257
|
-
const animDelay = gi * 0.08 + bi * 0.04;
|
|
19258
|
-
return /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(
|
|
19259
|
-
"g",
|
|
19260
|
-
{
|
|
19261
|
-
onMouseEnter: () => setHoveredBar({
|
|
19262
|
-
x: horizontal ? bar.x + bar.width : bar.x + bar.width / 2,
|
|
19263
|
-
y: horizontal ? bar.y + bar.height / 2 : bar.y,
|
|
19264
|
-
label: bar.label,
|
|
19265
|
-
value: bar.value,
|
|
19266
|
-
color: bar.color,
|
|
19267
|
-
seriesName: bar.seriesName
|
|
19268
|
-
}),
|
|
19269
|
-
onMouseLeave: () => setHoveredBar(null),
|
|
19270
|
-
className: "cursor-pointer",
|
|
19271
|
-
children: [
|
|
19272
|
-
/* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(
|
|
19273
|
-
"rect",
|
|
19274
|
-
{
|
|
19275
|
-
x: bar.x,
|
|
19276
|
-
y: bar.y,
|
|
19277
|
-
width: bar.width,
|
|
19278
|
-
height: bar.height,
|
|
19279
|
-
rx: barRadius,
|
|
19280
|
-
ry: barRadius,
|
|
19281
|
-
fill: bar.color,
|
|
19282
|
-
className: `transition-all duration-150 ${hoveredBar?.label === bar.label && hoveredBar?.seriesName === bar.seriesName ? "opacity-80" : ""}`,
|
|
19283
|
-
style: animated ? {
|
|
19284
|
-
animation: horizontal ? `growWidth 0.5s ease-out ${animDelay}s forwards` : `growHeight 0.5s ease-out ${animDelay}s forwards`,
|
|
19285
|
-
...horizontal ? { width: 0 } : { height: 0, y: padding.top + chartHeight }
|
|
19286
|
-
} : void 0,
|
|
19287
|
-
children: [
|
|
19288
|
-
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
19289
|
-
"animate",
|
|
19290
|
-
{
|
|
19291
|
-
attributeName: horizontal ? "width" : "height",
|
|
19292
|
-
from: "0",
|
|
19293
|
-
to: horizontal ? bar.width : bar.height,
|
|
19294
|
-
dur: "0.5s",
|
|
19295
|
-
begin: `${animDelay}s`,
|
|
19296
|
-
fill: "freeze"
|
|
19297
|
-
}
|
|
19298
|
-
),
|
|
19299
|
-
!horizontal && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("animate", { attributeName: "y", from: padding.top + chartHeight, to: bar.y, dur: "0.5s", begin: `${animDelay}s`, fill: "freeze" })
|
|
19300
|
-
]
|
|
19301
|
-
}
|
|
19302
|
-
),
|
|
19303
|
-
showValues && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
19304
|
-
"text",
|
|
19305
|
-
{
|
|
19306
|
-
x: horizontal ? bar.x + bar.width + 8 : bar.x + bar.width / 2,
|
|
19307
|
-
y: horizontal ? bar.y + bar.height / 2 + 4 : bar.y - 8,
|
|
19308
|
-
textAnchor: horizontal ? "start" : "middle",
|
|
19309
|
-
fontSize: "11",
|
|
19310
|
-
fontWeight: "500",
|
|
19311
|
-
className: "text-foreground",
|
|
19312
|
-
fill: "currentColor",
|
|
19313
|
-
style: animated ? { opacity: 0, animation: `fadeIn 0.3s ease-out ${animDelay + 0.3}s forwards` } : void 0,
|
|
19314
|
-
children: formatValue ? formatValue(bar.value) : bar.value
|
|
19315
|
-
}
|
|
19316
|
-
)
|
|
19317
|
-
]
|
|
19318
|
-
},
|
|
19319
|
-
bi
|
|
19320
|
-
);
|
|
19321
|
-
}),
|
|
19322
|
-
showLabels && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
19323
|
-
"text",
|
|
19324
|
-
{
|
|
19325
|
-
x: horizontal ? padding.left - 8 : padding.left + (gi + 0.5) * (chartWidth / barGroups.length),
|
|
19326
|
-
y: horizontal ? padding.top + (gi + 0.5) * (chartHeight / barGroups.length) + 4 : height - 10,
|
|
19327
|
-
textAnchor: horizontal ? "end" : "middle",
|
|
19328
|
-
fontSize: "10",
|
|
19329
|
-
className: labelClassName || "text-muted-foreground",
|
|
19330
|
-
fill: "currentColor",
|
|
19331
|
-
children: group.label
|
|
19332
|
-
}
|
|
19333
|
-
)
|
|
19334
|
-
] }, gi)),
|
|
19335
|
-
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("style", { children: `
|
|
19336
|
-
@keyframes growHeight {
|
|
19337
|
-
from { height: 0; }
|
|
19338
|
-
}
|
|
19339
|
-
@keyframes growWidth {
|
|
19340
|
-
from { width: 0; }
|
|
19341
|
-
}
|
|
19342
|
-
@keyframes fadeIn {
|
|
19343
|
-
from { opacity: 0; }
|
|
19344
|
-
to { opacity: 1; }
|
|
19345
|
-
}
|
|
19346
|
-
` })
|
|
19347
|
-
] }),
|
|
19348
|
-
(showLegend ?? isMultiSeries) && isMultiSeries && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { className: "flex items-center justify-center gap-6 mt-2", children: normalizedSeries.map((s, i) => /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("div", { className: "flex items-center gap-2 text-sm", children: [
|
|
19349
|
-
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { className: "w-3 h-3 rounded-md", style: { backgroundColor: s.color } }),
|
|
19350
|
-
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("span", { className: "text-muted-foreground", children: s.name })
|
|
19351
|
-
] }, i)) }),
|
|
19352
|
-
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
19353
|
-
ChartTooltip,
|
|
19354
|
-
{
|
|
19355
|
-
x: hoveredBar?.x ?? 0,
|
|
19356
|
-
y: hoveredBar?.y ?? 0,
|
|
19357
|
-
visible: !!hoveredBar,
|
|
19358
|
-
label: hoveredBar?.seriesName ? `${hoveredBar.label} \u2014 ${hoveredBar.seriesName}` : hoveredBar?.label,
|
|
19359
|
-
value: hoveredBar?.value,
|
|
19360
|
-
color: hoveredBar?.color,
|
|
19361
|
-
containerRef: svgRef,
|
|
19362
|
-
formatter: formatValue ? (v) => formatValue(Number(v)) : void 0
|
|
19363
|
-
}
|
|
19364
|
-
)
|
|
19365
|
-
] });
|
|
19366
|
-
}
|
|
19367
|
-
|
|
19368
|
-
// src/components/PieChart.tsx
|
|
19369
|
-
var import_react29 = require("react");
|
|
19370
|
-
var import_jsx_runtime60 = require("react/jsx-runtime");
|
|
19371
|
-
function PieChart({
|
|
19372
|
-
data,
|
|
19373
|
-
size = 200,
|
|
19374
|
-
donut = false,
|
|
19375
|
-
donutWidth = 40,
|
|
19376
|
-
showLabels = true,
|
|
19377
|
-
showLegend = true,
|
|
19378
|
-
showPercentage = true,
|
|
19379
|
-
animated = true,
|
|
19380
|
-
startAngle = -90,
|
|
19381
|
-
renderCenter,
|
|
19382
|
-
formatValue,
|
|
19383
|
-
labelClassName,
|
|
19384
|
-
className = ""
|
|
19385
|
-
}) {
|
|
19386
|
-
const containerRef = (0, import_react29.useRef)(null);
|
|
19387
|
-
const center = size / 2;
|
|
19388
|
-
const radius = size / 2 - 10;
|
|
19389
|
-
const innerRadius = donut ? radius - donutWidth : 0;
|
|
19390
|
-
const { segments, total } = (0, import_react29.useMemo)(() => {
|
|
19391
|
-
if (!data.length) return { segments: [], total: 0 };
|
|
19392
|
-
const sum = data.reduce((acc, d) => acc + d.value, 0);
|
|
19393
|
-
let currentAngle = startAngle;
|
|
19394
|
-
const segs = data.map((d, i) => {
|
|
19395
|
-
const percentage = d.value / sum;
|
|
19396
|
-
const angle = percentage * 360;
|
|
19397
|
-
const startRad = currentAngle * Math.PI / 180;
|
|
19398
|
-
const endRad = (currentAngle + angle) * Math.PI / 180;
|
|
19399
|
-
const midRad = (currentAngle + angle / 2) * Math.PI / 180;
|
|
19400
|
-
const largeArc = angle > 180 ? 1 : 0;
|
|
19401
|
-
const x1 = center + radius * Math.cos(startRad);
|
|
19402
|
-
const y1 = center + radius * Math.sin(startRad);
|
|
19403
|
-
const x2 = center + radius * Math.cos(endRad);
|
|
19404
|
-
const y2 = center + radius * Math.sin(endRad);
|
|
19405
|
-
const x3 = center + innerRadius * Math.cos(endRad);
|
|
19406
|
-
const y3 = center + innerRadius * Math.sin(endRad);
|
|
19407
|
-
const x4 = center + innerRadius * Math.cos(startRad);
|
|
19408
|
-
const y4 = center + innerRadius * Math.sin(startRad);
|
|
19409
|
-
const labelRadius = radius + 20;
|
|
19410
|
-
const labelX = center + labelRadius * Math.cos(midRad);
|
|
19411
|
-
const labelY = center + labelRadius * Math.sin(midRad);
|
|
19412
|
-
let path;
|
|
19413
|
-
if (donut) {
|
|
19414
|
-
path = [
|
|
19415
|
-
`M ${x1} ${y1}`,
|
|
19416
|
-
`A ${radius} ${radius} 0 ${largeArc} 1 ${x2} ${y2}`,
|
|
19417
|
-
`L ${x3} ${y3}`,
|
|
19418
|
-
`A ${innerRadius} ${innerRadius} 0 ${largeArc} 0 ${x4} ${y4}`,
|
|
19419
|
-
"Z"
|
|
19420
|
-
].join(" ");
|
|
19421
|
-
} else {
|
|
19422
|
-
path = [`M ${center} ${center}`, `L ${x1} ${y1}`, `A ${radius} ${radius} 0 ${largeArc} 1 ${x2} ${y2}`, "Z"].join(" ");
|
|
19423
|
-
}
|
|
19424
|
-
currentAngle += angle;
|
|
19425
|
-
return {
|
|
19426
|
-
path,
|
|
19427
|
-
...d,
|
|
19428
|
-
percentage,
|
|
19429
|
-
labelX,
|
|
19430
|
-
labelY,
|
|
19431
|
-
midAngle: currentAngle - angle / 2
|
|
19432
|
-
};
|
|
19433
|
-
});
|
|
19434
|
-
return { segments: segs, total: sum };
|
|
19435
|
-
}, [data, center, radius, innerRadius, donut, startAngle]);
|
|
19436
|
-
const [hoveredSegment, setHoveredSegment] = (0, import_react29.useState)(null);
|
|
19437
|
-
return /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("div", { ref: containerRef, className: `relative flex items-center gap-6 ${className}`, children: [
|
|
19438
|
-
/* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("svg", { width: size + 40, height: size + 40, className: "overflow-visible", style: { fontFamily: "inherit" }, children: [
|
|
19439
|
-
/* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("g", { transform: `translate(20, 20)`, children: [
|
|
19440
|
-
segments.map((seg, i) => /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(
|
|
19441
|
-
"g",
|
|
19442
|
-
{
|
|
19443
|
-
onMouseEnter: () => setHoveredSegment({
|
|
19444
|
-
x: seg.labelX + 20,
|
|
19445
|
-
y: seg.labelY + 20,
|
|
19446
|
-
label: seg.label,
|
|
19447
|
-
value: seg.value,
|
|
19448
|
-
percentage: seg.percentage,
|
|
19449
|
-
color: seg.color
|
|
19450
|
-
}),
|
|
19451
|
-
onMouseLeave: () => setHoveredSegment(null),
|
|
19452
|
-
children: [
|
|
19453
|
-
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
19454
|
-
"path",
|
|
19455
|
-
{
|
|
19456
|
-
d: seg.path,
|
|
19457
|
-
fill: seg.color,
|
|
19458
|
-
className: `transition-all duration-150 cursor-pointer ${hoveredSegment?.label === seg.label ? "opacity-80" : ""}`,
|
|
19459
|
-
style: {
|
|
19460
|
-
transformOrigin: `${center}px ${center}px`,
|
|
19461
|
-
transform: hoveredSegment?.label === seg.label ? "scale(1.05)" : "scale(1)",
|
|
19462
|
-
...animated ? {
|
|
19463
|
-
opacity: hoveredSegment?.label === seg.label ? 0.8 : 0,
|
|
19464
|
-
animation: `pieSlice 0.5s ease-out ${i * 0.1}s forwards`
|
|
19465
|
-
} : void 0
|
|
19466
|
-
}
|
|
19467
|
-
}
|
|
19468
|
-
),
|
|
19469
|
-
showLabels && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
19470
|
-
"text",
|
|
19471
|
-
{
|
|
19472
|
-
x: seg.labelX,
|
|
19473
|
-
y: seg.labelY,
|
|
19474
|
-
textAnchor: seg.labelX > center ? "start" : "end",
|
|
19475
|
-
fontSize: "10",
|
|
19476
|
-
className: labelClassName || "text-foreground",
|
|
19477
|
-
fill: "currentColor",
|
|
19478
|
-
style: animated ? { opacity: 0, animation: `fadeIn 0.3s ease-out ${i * 0.1 + 0.3}s forwards` } : void 0,
|
|
19479
|
-
children: showPercentage ? `${(seg.percentage * 100).toFixed(0)}%` : formatValue ? formatValue(seg.value) : seg.value
|
|
19480
|
-
}
|
|
19481
|
-
)
|
|
19482
|
-
]
|
|
19483
|
-
},
|
|
19484
|
-
i
|
|
19485
|
-
)),
|
|
19486
|
-
donut && (renderCenter ? /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("foreignObject", { x: center - donutWidth, y: center - donutWidth / 2, width: donutWidth * 2, height: donutWidth, children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", { style: { display: "flex", alignItems: "center", justifyContent: "center", width: "100%", height: "100%" }, children: renderCenter(total) }) }) : /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("g", { children: [
|
|
19487
|
-
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)("text", { x: center, y: center - 5, textAnchor: "middle", fontSize: "12", className: "text-muted-foreground", fill: "currentColor", children: "Total" }),
|
|
19488
|
-
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)("text", { x: center, y: center + 15, textAnchor: "middle", fontSize: "18", fontWeight: "600", className: "text-foreground", fill: "currentColor", children: formatValue ? formatValue(total) : total })
|
|
19489
|
-
] }))
|
|
19490
|
-
] }),
|
|
19491
|
-
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)("style", { children: `
|
|
19492
|
-
@keyframes pieSlice {
|
|
19493
|
-
from {
|
|
19494
|
-
opacity: 0;
|
|
19495
|
-
transform: scale(0);
|
|
19496
|
-
}
|
|
19497
|
-
to {
|
|
19498
|
-
opacity: 1;
|
|
19499
|
-
transform: scale(1);
|
|
19500
|
-
}
|
|
19501
|
-
}
|
|
19502
|
-
@keyframes fadeIn {
|
|
19503
|
-
from { opacity: 0; }
|
|
19504
|
-
to { opacity: 1; }
|
|
19505
|
-
}
|
|
19506
|
-
` })
|
|
19507
|
-
] }),
|
|
19508
|
-
showLegend && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", { className: "flex flex-col gap-2", children: segments.map((seg, i) => /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(
|
|
19509
|
-
"div",
|
|
19510
|
-
{
|
|
19511
|
-
className: "flex items-center gap-2 text-sm",
|
|
19512
|
-
style: animated ? { opacity: 0, animation: `fadeIn 0.3s ease-out ${i * 0.1 + 0.3}s forwards` } : void 0,
|
|
19513
|
-
children: [
|
|
19514
|
-
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", { className: "w-3 h-3 rounded-md shrink-0", style: { backgroundColor: seg.color } }),
|
|
19515
|
-
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)("span", { className: "text-muted-foreground", children: seg.label }),
|
|
19516
|
-
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)("span", { className: "text-foreground font-medium ml-auto", children: showPercentage ? `${(seg.percentage * 100).toFixed(0)}%` : formatValue ? formatValue(seg.value) : seg.value })
|
|
19517
|
-
]
|
|
19518
|
-
},
|
|
19519
|
-
i
|
|
19520
|
-
)) }),
|
|
19521
|
-
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
19522
|
-
ChartTooltip,
|
|
19523
|
-
{
|
|
19524
|
-
x: hoveredSegment?.x ?? center,
|
|
19525
|
-
y: hoveredSegment?.y ?? center,
|
|
19526
|
-
visible: !!hoveredSegment,
|
|
19527
|
-
label: hoveredSegment?.label,
|
|
19528
|
-
value: `${hoveredSegment?.value} (${((hoveredSegment?.percentage ?? 0) * 100).toFixed(1)}%)`,
|
|
19529
|
-
color: hoveredSegment?.color,
|
|
19530
|
-
containerRef
|
|
19531
|
-
}
|
|
19532
|
-
)
|
|
19533
|
-
] });
|
|
19534
|
-
}
|
|
19535
|
-
|
|
19536
|
-
// src/components/AreaChart.tsx
|
|
19537
|
-
var import_react30 = require("react");
|
|
19538
|
-
var import_jsx_runtime61 = require("react/jsx-runtime");
|
|
19539
|
-
function AreaChart({
|
|
19540
|
-
series,
|
|
19541
|
-
width = 400,
|
|
19542
|
-
height = 200,
|
|
19543
|
-
showDots = true,
|
|
19544
|
-
showGrid = true,
|
|
19545
|
-
showLabels = true,
|
|
19546
|
-
showLegend = true,
|
|
19547
|
-
animated = true,
|
|
19548
|
-
stacked = false,
|
|
19549
|
-
curved = true,
|
|
19550
|
-
formatValue,
|
|
19551
|
-
emptyText = "No data",
|
|
19552
|
-
labelClassName,
|
|
19553
|
-
className = ""
|
|
19554
|
-
}) {
|
|
19555
|
-
const containerRef = (0, import_react30.useRef)(null);
|
|
19556
|
-
const clipId = (0, import_react30.useRef)(`area-clip-${Math.random().toString(36).slice(2, 8)}`).current;
|
|
19557
|
-
const padding = (0, import_react30.useMemo)(() => ({ top: 20, right: 20, bottom: 40, left: 50 }), []);
|
|
19558
|
-
const chartWidth = width - padding.left - padding.right;
|
|
19559
|
-
const chartHeight = height - padding.top - padding.bottom;
|
|
19560
|
-
const [hoveredPoint, setHoveredPoint] = (0, import_react30.useState)(null);
|
|
19561
|
-
const [hiddenSeries, setHiddenSeries] = (0, import_react30.useState)(/* @__PURE__ */ new Set());
|
|
19562
|
-
const toggleSeries = (0, import_react30.useCallback)((name) => {
|
|
19563
|
-
setHiddenSeries((prev) => {
|
|
19564
|
-
const next = new Set(prev);
|
|
19565
|
-
if (next.has(name)) next.delete(name);
|
|
19566
|
-
else next.add(name);
|
|
19567
|
-
return next;
|
|
19568
|
-
});
|
|
19569
|
-
}, []);
|
|
19570
|
-
const { processedSeries, gridLines, maxValue, labels } = (0, import_react30.useMemo)(() => {
|
|
19571
|
-
if (!series.length || !series[0]?.data?.length) {
|
|
19572
|
-
return { processedSeries: [], gridLines: [], maxValue: 0, labels: [] };
|
|
19573
|
-
}
|
|
19574
|
-
const allLabels = series[0].data.map((d) => d.label);
|
|
19575
|
-
const dataLength = series[0].data.length;
|
|
19576
|
-
let max = 0;
|
|
19577
|
-
if (stacked) {
|
|
19578
|
-
for (let i = 0; i < dataLength; i++) {
|
|
19579
|
-
const stackedValue = series.reduce((sum, s) => sum + (s.data[i]?.value || 0), 0);
|
|
19580
|
-
max = Math.max(max, stackedValue);
|
|
19581
|
-
}
|
|
19582
|
-
} else {
|
|
19583
|
-
max = Math.max(...series.flatMap((s) => s.data.map((d) => d.value)));
|
|
19584
|
-
}
|
|
19585
|
-
const processed = series.map((s, seriesIndex) => {
|
|
19586
|
-
const points = s.data.map((d, i) => {
|
|
19587
|
-
const x = padding.left + i / (dataLength - 1) * chartWidth;
|
|
19588
|
-
let y;
|
|
19589
|
-
if (stacked && seriesIndex > 0) {
|
|
19590
|
-
const stackedBase = series.slice(0, seriesIndex).reduce((sum, prevS) => sum + (prevS.data[i]?.value || 0), 0);
|
|
19591
|
-
const stackedValue = stackedBase + d.value;
|
|
19592
|
-
y = padding.top + chartHeight - stackedValue / max * chartHeight;
|
|
19593
|
-
} else {
|
|
19594
|
-
y = padding.top + chartHeight - d.value / max * chartHeight;
|
|
19595
|
-
}
|
|
19596
|
-
return { x, y, value: d.value, label: d.label };
|
|
19597
|
-
});
|
|
19598
|
-
const linePath = curved ? getCatmullRomSpline(points) : `M ${points.map((p) => `${p.x} ${p.y}`).join(" L ")}`;
|
|
19599
|
-
let areaPath;
|
|
19600
|
-
if (stacked && seriesIndex > 0) {
|
|
19601
|
-
const prevSeriesPoints = series.slice(0, seriesIndex).reduce((acc, prevS) => {
|
|
19602
|
-
return prevS.data.map((d, i) => {
|
|
19603
|
-
const prevVal = acc[i] || 0;
|
|
19604
|
-
return prevVal + d.value;
|
|
19605
|
-
});
|
|
19606
|
-
}, []).map((val, i) => ({
|
|
19607
|
-
x: padding.left + i / (dataLength - 1) * chartWidth,
|
|
19608
|
-
y: padding.top + chartHeight - val / max * chartHeight
|
|
19609
|
-
}));
|
|
19610
|
-
const reversedPrevPoints = [...prevSeriesPoints].reverse();
|
|
19611
|
-
areaPath = `${linePath} L ${reversedPrevPoints.map((p) => `${p.x} ${p.y}`).join(" L ")} Z`;
|
|
19612
|
-
} else {
|
|
19613
|
-
areaPath = `${linePath} L ${padding.left + chartWidth} ${padding.top + chartHeight} L ${padding.left} ${padding.top + chartHeight} Z`;
|
|
19614
|
-
}
|
|
19615
|
-
return {
|
|
19616
|
-
...s,
|
|
19617
|
-
points,
|
|
19618
|
-
linePath,
|
|
19619
|
-
areaPath,
|
|
19620
|
-
lineLength: points.reduce((acc, p, i) => {
|
|
19621
|
-
if (i === 0) return 0;
|
|
19622
|
-
const prev = points[i - 1];
|
|
19623
|
-
return acc + Math.sqrt(Math.pow(p.x - prev.x, 2) + Math.pow(p.y - prev.y, 2));
|
|
19624
|
-
}, 0)
|
|
19625
|
-
};
|
|
19626
|
-
});
|
|
19627
|
-
const lines = [];
|
|
19628
|
-
const steps = 5;
|
|
19629
|
-
for (let i = 0; i <= steps; i++) {
|
|
19630
|
-
const value = i / steps * max;
|
|
19631
|
-
lines.push({
|
|
19632
|
-
y: padding.top + chartHeight - i / steps * chartHeight,
|
|
19633
|
-
value
|
|
19634
|
-
});
|
|
19635
|
-
}
|
|
19636
|
-
return { processedSeries: processed, gridLines: lines, maxValue: max, labels: allLabels };
|
|
19637
|
-
}, [series, chartWidth, chartHeight, padding, stacked, curved]);
|
|
19638
|
-
return /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("div", { ref: containerRef, className: `relative flex flex-col gap-4 ${className}`, children: [
|
|
19639
|
-
/* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("svg", { width, height, className: "overflow-visible", style: { fontFamily: "inherit" }, children: [
|
|
19640
|
-
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("clipPath", { id: clipId, children: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("rect", { x: padding.left, y: padding.top, width: chartWidth, height: chartHeight }) }) }),
|
|
19641
|
-
showGrid && /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("g", { className: "text-muted-foreground/20", children: gridLines.map((line, i) => /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("g", { children: [
|
|
19642
|
-
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)("line", { x1: padding.left, y1: line.y, x2: width - padding.right, y2: line.y, stroke: "currentColor", strokeDasharray: "4 4" }),
|
|
19643
|
-
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
19644
|
-
"text",
|
|
19645
|
-
{
|
|
19646
|
-
x: padding.left - 8,
|
|
19647
|
-
y: line.y + 4,
|
|
19648
|
-
textAnchor: "end",
|
|
19649
|
-
fontSize: "10",
|
|
19650
|
-
className: labelClassName || "text-muted-foreground",
|
|
19651
|
-
fill: "currentColor",
|
|
19652
|
-
children: formatValue ? formatValue(line.value) : line.value.toFixed(0)
|
|
19653
|
-
}
|
|
19654
|
-
)
|
|
19655
|
-
] }, i)) }),
|
|
19656
|
-
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)("g", { clipPath: `url(#${clipId})`, children: [...processedSeries].reverse().map((s, i) => /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
19657
|
-
"path",
|
|
19658
|
-
{
|
|
19659
|
-
d: s.areaPath,
|
|
19660
|
-
fill: s.color,
|
|
19661
|
-
fillOpacity: hiddenSeries.has(s.name) ? 0 : s.fillOpacity ?? 0.3,
|
|
19662
|
-
className: "transition-all duration-300",
|
|
19663
|
-
style: animated ? {
|
|
19664
|
-
opacity: 0,
|
|
19665
|
-
animation: `fadeIn 0.5s ease-out ${i * 0.1}s forwards`
|
|
19666
|
-
} : void 0
|
|
19667
|
-
},
|
|
19668
|
-
`area-${i}`
|
|
19669
|
-
)) }),
|
|
19670
|
-
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)("g", { clipPath: `url(#${clipId})`, children: processedSeries.map((s, i) => /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
19671
|
-
"path",
|
|
19672
|
-
{
|
|
19673
|
-
d: s.linePath,
|
|
19674
|
-
fill: "none",
|
|
19675
|
-
stroke: s.color,
|
|
19676
|
-
strokeWidth: 2,
|
|
19677
|
-
strokeLinecap: "round",
|
|
19678
|
-
strokeLinejoin: "round",
|
|
19679
|
-
className: "transition-opacity duration-300",
|
|
19680
|
-
opacity: hiddenSeries.has(s.name) ? 0 : 1,
|
|
19681
|
-
style: animated ? {
|
|
19682
|
-
strokeDasharray: s.lineLength,
|
|
19683
|
-
strokeDashoffset: s.lineLength,
|
|
19684
|
-
animation: `drawLine 1s ease-out ${i * 0.1}s forwards`
|
|
19685
|
-
} : void 0
|
|
19686
|
-
},
|
|
19687
|
-
`line-${i}`
|
|
19688
|
-
)) }),
|
|
19689
|
-
showDots && processedSeries.map(
|
|
19690
|
-
(s, seriesIdx) => !hiddenSeries.has(s.name) && s.points.map((point, i) => /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(
|
|
19691
|
-
"g",
|
|
19692
|
-
{
|
|
19693
|
-
onMouseEnter: () => {
|
|
19694
|
-
const items = processedSeries.map((ps) => ({
|
|
19695
|
-
label: ps.name,
|
|
19696
|
-
value: ps.points[i]?.value ?? 0,
|
|
19697
|
-
color: ps.color
|
|
19698
|
-
}));
|
|
19699
|
-
setHoveredPoint({
|
|
19700
|
-
x: point.x,
|
|
19701
|
-
y: point.y,
|
|
19702
|
-
label: point.label,
|
|
19703
|
-
items
|
|
19704
|
-
});
|
|
19705
|
-
},
|
|
19706
|
-
onMouseLeave: () => setHoveredPoint(null),
|
|
19707
|
-
className: "cursor-pointer",
|
|
19708
|
-
children: [
|
|
19709
|
-
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
19710
|
-
"circle",
|
|
19711
|
-
{
|
|
19712
|
-
cx: point.x,
|
|
19713
|
-
cy: point.y,
|
|
19714
|
-
r: hoveredPoint?.x === point.x ? 6 : 4,
|
|
19715
|
-
fill: s.color,
|
|
19716
|
-
className: "transition-all duration-150",
|
|
19717
|
-
style: animated ? {
|
|
19718
|
-
transform: "scale(0)",
|
|
19719
|
-
opacity: 0,
|
|
19720
|
-
transformOrigin: `${point.x}px ${point.y}px`,
|
|
19721
|
-
animation: `dotPop 0.3s ease-out ${seriesIdx * 0.1 + i * 0.05 + 0.5}s forwards`
|
|
19722
|
-
} : void 0
|
|
19723
|
-
}
|
|
19724
|
-
),
|
|
19725
|
-
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)("circle", { cx: point.x, cy: point.y, r: 12, fill: "transparent" })
|
|
19726
|
-
]
|
|
19727
|
-
},
|
|
19728
|
-
`dot-${seriesIdx}-${i}`
|
|
19729
|
-
))
|
|
19730
|
-
),
|
|
19731
|
-
showLabels && /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("g", { className: labelClassName || "text-muted-foreground", children: labels.map((label, i) => {
|
|
19732
|
-
const x = padding.left + i / (labels.length - 1) * chartWidth;
|
|
19733
|
-
return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("text", { x, y: height - 10, textAnchor: "middle", fontSize: "10", fill: "currentColor", children: label }, i);
|
|
19734
|
-
}) }),
|
|
19735
|
-
hoveredPoint && /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("g", { className: "pointer-events-none", children: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
19736
|
-
"line",
|
|
19737
|
-
{
|
|
19738
|
-
x1: hoveredPoint.x,
|
|
19739
|
-
y1: padding.top,
|
|
19740
|
-
x2: hoveredPoint.x,
|
|
19741
|
-
y2: padding.top + chartHeight,
|
|
19742
|
-
stroke: "currentColor",
|
|
19743
|
-
strokeWidth: 1,
|
|
19744
|
-
strokeDasharray: "4 4",
|
|
19745
|
-
opacity: 0.3,
|
|
19746
|
-
className: "text-foreground"
|
|
19747
|
-
}
|
|
19748
|
-
) }),
|
|
19749
|
-
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)("style", { children: `
|
|
19750
|
-
@keyframes drawLine {
|
|
19751
|
-
to {
|
|
19752
|
-
stroke-dashoffset: 0;
|
|
19753
|
-
}
|
|
19754
|
-
}
|
|
19755
|
-
@keyframes fadeIn {
|
|
19756
|
-
from { opacity: 0; }
|
|
19757
|
-
to { opacity: 1; }
|
|
19758
|
-
}
|
|
19759
|
-
@keyframes dotPop {
|
|
19760
|
-
from {
|
|
19761
|
-
transform: scale(0);
|
|
19762
|
-
opacity: 0;
|
|
19763
|
-
}
|
|
19764
|
-
to {
|
|
19765
|
-
transform: scale(1);
|
|
19766
|
-
opacity: 1;
|
|
19767
|
-
}
|
|
19768
|
-
}
|
|
19769
|
-
` })
|
|
19770
|
-
] }),
|
|
19771
|
-
showLegend && /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("div", { className: "flex items-center justify-center gap-6", children: series.map((s, i) => /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(
|
|
19772
|
-
"div",
|
|
19773
|
-
{
|
|
19774
|
-
className: "flex items-center gap-2 text-sm cursor-pointer select-none",
|
|
19775
|
-
style: animated ? { opacity: 0, animation: `fadeIn 0.3s ease-out ${i * 0.1 + 0.5}s forwards` } : void 0,
|
|
19776
|
-
onClick: () => toggleSeries(s.name),
|
|
19777
|
-
children: [
|
|
19778
|
-
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
19779
|
-
"div",
|
|
19780
|
-
{
|
|
19781
|
-
className: "w-3 h-3 rounded-md transition-opacity",
|
|
19782
|
-
style: { backgroundColor: s.color, opacity: hiddenSeries.has(s.name) ? 0.3 : 1 }
|
|
19783
|
-
}
|
|
19784
|
-
),
|
|
19785
|
-
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)("span", { className: hiddenSeries.has(s.name) ? "text-muted-foreground/40 line-through" : "text-muted-foreground", children: s.name })
|
|
19786
|
-
]
|
|
19787
|
-
},
|
|
19788
|
-
i
|
|
19789
|
-
)) }),
|
|
19790
|
-
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
19791
|
-
ChartTooltip,
|
|
19792
|
-
{
|
|
19793
|
-
x: hoveredPoint?.x ?? 0,
|
|
19794
|
-
y: hoveredPoint?.y ?? 0,
|
|
19795
|
-
visible: !!hoveredPoint,
|
|
19796
|
-
label: hoveredPoint?.label,
|
|
19797
|
-
items: hoveredPoint?.items,
|
|
19798
|
-
containerRef
|
|
19799
|
-
}
|
|
19800
|
-
)
|
|
19801
|
-
] });
|
|
19802
|
-
}
|
|
19803
|
-
|
|
19804
|
-
// src/components/Sparkline.tsx
|
|
19805
|
-
var import_react31 = require("react");
|
|
19806
|
-
var import_jsx_runtime62 = require("react/jsx-runtime");
|
|
19807
|
-
function Sparkline({
|
|
19808
|
-
data,
|
|
19809
|
-
width = 100,
|
|
19810
|
-
height = 30,
|
|
19811
|
-
color = "currentColor",
|
|
19812
|
-
fillColor,
|
|
19813
|
-
showFill = true,
|
|
19814
|
-
showDots = false,
|
|
19815
|
-
showEndDot = true,
|
|
19816
|
-
animated = true,
|
|
19817
|
-
curved = true,
|
|
19818
|
-
strokeWidth = 2,
|
|
19819
|
-
className = ""
|
|
19820
|
-
}) {
|
|
19821
|
-
const padding = 4;
|
|
19822
|
-
const chartWidth = width - padding * 2;
|
|
19823
|
-
const chartHeight = height - padding * 2;
|
|
19824
|
-
const { points, linePath, areaPath, lineLength, trend } = (0, import_react31.useMemo)(() => {
|
|
19825
|
-
const normalizedData = data.map((d) => typeof d === "number" ? d : d.value);
|
|
19826
|
-
if (!normalizedData.length) {
|
|
19827
|
-
return { points: [], linePath: "", areaPath: "", lineLength: 0, trend: 0 };
|
|
19828
|
-
}
|
|
19829
|
-
const min = Math.min(...normalizedData);
|
|
19830
|
-
const max = Math.max(...normalizedData);
|
|
19831
|
-
const range = max - min || 1;
|
|
19832
|
-
const pts = normalizedData.map((value, i) => ({
|
|
19833
|
-
x: padding + i / (normalizedData.length - 1) * chartWidth,
|
|
19834
|
-
y: padding + chartHeight - (value - min) / range * chartHeight,
|
|
19835
|
-
value
|
|
19836
|
-
}));
|
|
19837
|
-
const line = curved ? getCatmullRomSpline(pts) : `M ${pts.map((p) => `${p.x} ${p.y}`).join(" L ")}`;
|
|
19838
|
-
const area = `${line} L ${padding + chartWidth} ${padding + chartHeight} L ${padding} ${padding + chartHeight} Z`;
|
|
19839
|
-
const length = pts.reduce((acc, p, i) => {
|
|
19840
|
-
if (i === 0) return 0;
|
|
19841
|
-
const prev = pts[i - 1];
|
|
19842
|
-
return acc + Math.sqrt(Math.pow(p.x - prev.x, 2) + Math.pow(p.y - prev.y, 2));
|
|
19843
|
-
}, 0);
|
|
19844
|
-
const trendValue = normalizedData[normalizedData.length - 1] - normalizedData[0];
|
|
19845
|
-
return { points: pts, linePath: line, areaPath: area, lineLength: length, trend: trendValue };
|
|
19846
|
-
}, [data, chartWidth, chartHeight, padding, curved]);
|
|
19847
|
-
const effectiveFillColor = fillColor || color;
|
|
19848
|
-
return /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("svg", { width, height, className: `overflow-visible ${className}`, style: { fontFamily: "inherit" }, children: [
|
|
19849
|
-
showFill && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
19850
|
-
"path",
|
|
19851
|
-
{
|
|
19852
|
-
d: areaPath,
|
|
19853
|
-
fill: effectiveFillColor,
|
|
19854
|
-
fillOpacity: 0.1,
|
|
19855
|
-
style: animated ? { opacity: 0, animation: "fadeIn 0.5s ease-out 0.3s forwards" } : void 0
|
|
19856
|
-
}
|
|
19857
|
-
),
|
|
19858
|
-
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
19859
|
-
"path",
|
|
19860
|
-
{
|
|
19861
|
-
d: linePath,
|
|
19862
|
-
fill: "none",
|
|
19863
|
-
stroke: color,
|
|
19864
|
-
strokeWidth,
|
|
19865
|
-
strokeLinecap: "round",
|
|
19866
|
-
strokeLinejoin: "round",
|
|
19867
|
-
style: animated ? {
|
|
19868
|
-
strokeDasharray: lineLength,
|
|
19869
|
-
strokeDashoffset: lineLength,
|
|
19870
|
-
animation: "drawLine 0.8s ease-out forwards"
|
|
19871
|
-
} : void 0
|
|
19872
|
-
}
|
|
19873
|
-
),
|
|
19874
|
-
showDots && points.map((point, i) => /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
19875
|
-
"circle",
|
|
19876
|
-
{
|
|
19877
|
-
cx: point.x,
|
|
19878
|
-
cy: point.y,
|
|
19879
|
-
r: 2,
|
|
19880
|
-
fill: color,
|
|
19881
|
-
style: animated ? {
|
|
19882
|
-
opacity: 0,
|
|
19883
|
-
animation: `fadeIn 0.3s ease-out ${i * 0.05 + 0.5}s forwards`
|
|
19884
|
-
} : void 0
|
|
19885
|
-
},
|
|
19886
|
-
i
|
|
19887
|
-
)),
|
|
19888
|
-
showEndDot && !showDots && points.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
19889
|
-
"circle",
|
|
19890
|
-
{
|
|
19891
|
-
cx: points[points.length - 1].x,
|
|
19892
|
-
cy: points[points.length - 1].y,
|
|
19893
|
-
r: 3,
|
|
19894
|
-
fill: color,
|
|
19895
|
-
style: animated ? {
|
|
19896
|
-
opacity: 0,
|
|
19897
|
-
transform: "scale(0)",
|
|
19898
|
-
transformOrigin: `${points[points.length - 1].x}px ${points[points.length - 1].y}px`,
|
|
19899
|
-
animation: "dotPop 0.3s ease-out 0.6s forwards"
|
|
19900
|
-
} : void 0
|
|
19901
|
-
}
|
|
19902
|
-
),
|
|
19903
|
-
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("style", { children: `
|
|
19904
|
-
@keyframes drawLine {
|
|
19905
|
-
to {
|
|
19906
|
-
stroke-dashoffset: 0;
|
|
19907
|
-
}
|
|
19908
|
-
}
|
|
19909
|
-
@keyframes fadeIn {
|
|
19910
|
-
from { opacity: 0; }
|
|
19911
|
-
to { opacity: 1; }
|
|
19912
|
-
}
|
|
19913
|
-
@keyframes dotPop {
|
|
19914
|
-
from {
|
|
19915
|
-
transform: scale(0);
|
|
19916
|
-
opacity: 0;
|
|
19917
|
-
}
|
|
19918
|
-
to {
|
|
19919
|
-
transform: scale(1);
|
|
19920
|
-
opacity: 1;
|
|
19921
|
-
}
|
|
19922
|
-
}
|
|
19923
|
-
` })
|
|
19924
|
-
] });
|
|
19925
|
-
}
|
|
19926
|
-
|
|
19927
|
-
// src/components/RadarChart.tsx
|
|
19928
|
-
var import_react32 = require("react");
|
|
19929
|
-
var import_jsx_runtime63 = require("react/jsx-runtime");
|
|
19930
|
-
function RadarChart({
|
|
19931
|
-
series,
|
|
19932
|
-
size = 300,
|
|
19933
|
-
levels = 5,
|
|
19934
|
-
showLabels = true,
|
|
19935
|
-
showLegend = true,
|
|
19936
|
-
showValues = false,
|
|
19937
|
-
animated = true,
|
|
19938
|
-
formatValue,
|
|
19939
|
-
labelClassName,
|
|
19940
|
-
className = ""
|
|
19941
|
-
}) {
|
|
19942
|
-
const containerRef = (0, import_react32.useRef)(null);
|
|
19943
|
-
const center = size / 2;
|
|
19944
|
-
const radius = size / 2 - 40;
|
|
19945
|
-
const [hoveredPoint, setHoveredPoint] = (0, import_react32.useState)(null);
|
|
19946
|
-
const [hiddenSeries, setHiddenSeries] = (0, import_react32.useState)(/* @__PURE__ */ new Set());
|
|
19947
|
-
const toggleSeries = (0, import_react32.useCallback)((name) => {
|
|
19948
|
-
setHiddenSeries((prev) => {
|
|
19949
|
-
const next = new Set(prev);
|
|
19950
|
-
if (next.has(name)) next.delete(name);
|
|
19951
|
-
else next.add(name);
|
|
19952
|
-
return next;
|
|
19953
|
-
});
|
|
19954
|
-
}, []);
|
|
19955
|
-
const { axes, processedSeries, levelPaths } = (0, import_react32.useMemo)(() => {
|
|
19956
|
-
if (!series.length || !series[0]?.data?.length) {
|
|
19957
|
-
return { axes: [], processedSeries: [], levelPaths: [] };
|
|
19958
|
-
}
|
|
19959
|
-
const axisLabels = series[0].data.map((d) => d.axis);
|
|
19960
|
-
const axisCount = axisLabels.length;
|
|
19961
|
-
const angleStep = 2 * Math.PI / axisCount;
|
|
19962
|
-
const maxValue = Math.max(...series.flatMap((s) => s.data.map((d) => d.value)));
|
|
19963
|
-
const axesData = axisLabels.map((label, i) => {
|
|
19964
|
-
const angle = i * angleStep - Math.PI / 2;
|
|
19965
|
-
const x = center + radius * Math.cos(angle);
|
|
19966
|
-
const y = center + radius * Math.sin(angle);
|
|
19967
|
-
const labelX = center + (radius + 20) * Math.cos(angle);
|
|
19968
|
-
const labelY = center + (radius + 20) * Math.sin(angle);
|
|
19969
|
-
return { label, x, y, labelX, labelY, angle };
|
|
19970
|
-
});
|
|
19971
|
-
const levelsData = [];
|
|
19972
|
-
for (let l = 1; l <= levels; l++) {
|
|
19973
|
-
const levelRadius = l / levels * radius;
|
|
19974
|
-
const points = axisLabels.map((_, i) => {
|
|
19975
|
-
const angle = i * angleStep - Math.PI / 2;
|
|
19976
|
-
return {
|
|
19977
|
-
x: center + levelRadius * Math.cos(angle),
|
|
19978
|
-
y: center + levelRadius * Math.sin(angle)
|
|
19979
|
-
};
|
|
19980
|
-
});
|
|
19981
|
-
levelsData.push({
|
|
19982
|
-
path: `M ${points.map((p) => `${p.x} ${p.y}`).join(" L ")} Z`,
|
|
19983
|
-
level: l,
|
|
19984
|
-
value: l / levels * maxValue
|
|
19985
|
-
});
|
|
19986
|
-
}
|
|
19987
|
-
const processed = series.map((s) => {
|
|
19988
|
-
const points = s.data.map((d, i) => {
|
|
19989
|
-
const angle = i * angleStep - Math.PI / 2;
|
|
19990
|
-
const r = d.value / maxValue * radius;
|
|
19991
|
-
return {
|
|
19992
|
-
x: center + r * Math.cos(angle),
|
|
19993
|
-
y: center + r * Math.sin(angle),
|
|
19994
|
-
value: d.value
|
|
19995
|
-
};
|
|
19996
|
-
});
|
|
19997
|
-
return {
|
|
19998
|
-
...s,
|
|
19999
|
-
points,
|
|
20000
|
-
path: `M ${points.map((p) => `${p.x} ${p.y}`).join(" L ")} Z`
|
|
20001
|
-
};
|
|
20002
|
-
});
|
|
20003
|
-
return { axes: axesData, processedSeries: processed, levelPaths: levelsData };
|
|
20004
|
-
}, [series, center, radius, levels]);
|
|
20005
|
-
return /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("div", { ref: containerRef, className: `relative flex flex-col gap-4 ${className}`, children: [
|
|
20006
|
-
/* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("svg", { width: size, height: size, className: "overflow-visible", style: { fontFamily: "inherit" }, children: [
|
|
20007
|
-
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)("g", { className: "text-muted-foreground/20", children: levelPaths.map((level, i) => /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("path", { d: level.path, fill: "none", stroke: "currentColor", strokeWidth: 1 }, i)) }),
|
|
20008
|
-
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)("g", { className: "text-muted-foreground/30", children: axes.map((axis, i) => /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("line", { x1: center, y1: center, x2: axis.x, y2: axis.y, stroke: "currentColor", strokeWidth: 1 }, i)) }),
|
|
20009
|
-
processedSeries.map(
|
|
20010
|
-
(s, i) => !hiddenSeries.has(s.name) && /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("g", { children: [
|
|
20011
|
-
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
20012
|
-
"path",
|
|
20013
|
-
{
|
|
20014
|
-
d: s.path,
|
|
20015
|
-
fill: s.color,
|
|
20016
|
-
fillOpacity: s.fillOpacity ?? 0.2,
|
|
20017
|
-
stroke: s.color,
|
|
20018
|
-
strokeWidth: 2,
|
|
20019
|
-
strokeLinejoin: "round",
|
|
20020
|
-
className: "transition-all duration-300",
|
|
20021
|
-
style: animated ? {
|
|
20022
|
-
opacity: 0,
|
|
20023
|
-
transform: "scale(0)",
|
|
20024
|
-
transformOrigin: `${center}px ${center}px`,
|
|
20025
|
-
animation: `radarPop 0.5s ease-out ${i * 0.15}s forwards`
|
|
20026
|
-
} : void 0
|
|
20027
|
-
}
|
|
20028
|
-
),
|
|
20029
|
-
s.points.map((point, j) => /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
|
|
20030
|
-
"g",
|
|
20031
|
-
{
|
|
20032
|
-
onMouseEnter: () => {
|
|
20033
|
-
const items = processedSeries.map((ps) => ({
|
|
20034
|
-
label: ps.name,
|
|
20035
|
-
value: ps.points[j]?.value ?? 0,
|
|
20036
|
-
color: ps.color
|
|
20037
|
-
}));
|
|
20038
|
-
setHoveredPoint({
|
|
20039
|
-
x: point.x,
|
|
20040
|
-
y: point.y,
|
|
20041
|
-
axis: series[0]?.data[j]?.axis ?? "",
|
|
20042
|
-
items
|
|
20043
|
-
});
|
|
20044
|
-
},
|
|
20045
|
-
onMouseLeave: () => setHoveredPoint(null),
|
|
20046
|
-
className: "cursor-pointer",
|
|
20047
|
-
children: [
|
|
20048
|
-
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
20049
|
-
"circle",
|
|
20050
|
-
{
|
|
20051
|
-
cx: point.x,
|
|
20052
|
-
cy: point.y,
|
|
20053
|
-
r: hoveredPoint?.axis === series[0]?.data[j]?.axis ? 6 : 4,
|
|
20054
|
-
fill: s.color,
|
|
20055
|
-
className: "transition-all duration-150",
|
|
20056
|
-
style: animated ? {
|
|
20057
|
-
opacity: 0,
|
|
20058
|
-
transform: "scale(0)",
|
|
20059
|
-
transformOrigin: `${point.x}px ${point.y}px`,
|
|
20060
|
-
animation: `dotPop 0.3s ease-out ${i * 0.15 + j * 0.05 + 0.3}s forwards`
|
|
20061
|
-
} : void 0
|
|
20062
|
-
}
|
|
20063
|
-
),
|
|
20064
|
-
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)("circle", { cx: point.x, cy: point.y, r: 12, fill: "transparent" })
|
|
20065
|
-
]
|
|
20066
|
-
},
|
|
20067
|
-
j
|
|
20068
|
-
)),
|
|
20069
|
-
showValues && s.points.map((point, j) => /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
20070
|
-
"text",
|
|
20071
|
-
{
|
|
20072
|
-
x: point.x,
|
|
20073
|
-
y: point.y - 10,
|
|
20074
|
-
textAnchor: "middle",
|
|
20075
|
-
fontSize: "10",
|
|
20076
|
-
fontWeight: "500",
|
|
20077
|
-
className: "text-foreground",
|
|
20078
|
-
fill: "currentColor",
|
|
20079
|
-
style: animated ? { opacity: 0, animation: `fadeIn 0.3s ease-out ${i * 0.15 + 0.5}s forwards` } : void 0,
|
|
20080
|
-
children: point.value
|
|
20081
|
-
},
|
|
20082
|
-
`val-${j}`
|
|
20083
|
-
))
|
|
20084
|
-
] }, i)
|
|
20085
|
-
),
|
|
20086
|
-
showLabels && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("g", { className: labelClassName || "text-muted-foreground", children: axes.map((axis, i) => /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("text", { x: axis.labelX, y: axis.labelY, textAnchor: "middle", dominantBaseline: "middle", fontSize: "11", fill: "currentColor", children: axis.label }, i)) }),
|
|
20087
|
-
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)("style", { children: `
|
|
20088
|
-
@keyframes radarPop {
|
|
20089
|
-
from {
|
|
20090
|
-
opacity: 0;
|
|
20091
|
-
transform: scale(0);
|
|
20092
|
-
}
|
|
20093
|
-
to {
|
|
20094
|
-
opacity: 1;
|
|
20095
|
-
transform: scale(1);
|
|
20096
|
-
}
|
|
20097
|
-
}
|
|
20098
|
-
@keyframes dotPop {
|
|
20099
|
-
from {
|
|
20100
|
-
transform: scale(0);
|
|
20101
|
-
opacity: 0;
|
|
20102
|
-
}
|
|
20103
|
-
to {
|
|
20104
|
-
transform: scale(1);
|
|
20105
|
-
opacity: 1;
|
|
20106
|
-
}
|
|
20107
|
-
}
|
|
20108
|
-
@keyframes fadeIn {
|
|
20109
|
-
from { opacity: 0; }
|
|
20110
|
-
to { opacity: 1; }
|
|
20111
|
-
}
|
|
20112
|
-
` })
|
|
20113
|
-
] }),
|
|
20114
|
-
showLegend && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("div", { className: "flex items-center justify-center gap-6", children: series.map((s, i) => /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
|
|
20115
|
-
"div",
|
|
20116
|
-
{
|
|
20117
|
-
className: "flex items-center gap-2 text-sm cursor-pointer select-none",
|
|
20118
|
-
style: animated ? { opacity: 0, animation: `fadeIn 0.3s ease-out ${i * 0.1 + 0.5}s forwards` } : void 0,
|
|
20119
|
-
onClick: () => toggleSeries(s.name),
|
|
20120
|
-
children: [
|
|
20121
|
-
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
20122
|
-
"div",
|
|
20123
|
-
{
|
|
20124
|
-
className: "w-3 h-3 rounded-md transition-opacity",
|
|
20125
|
-
style: { backgroundColor: s.color, opacity: hiddenSeries.has(s.name) ? 0.3 : 1 }
|
|
20126
|
-
}
|
|
20127
|
-
),
|
|
20128
|
-
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)("span", { className: hiddenSeries.has(s.name) ? "text-muted-foreground/40 line-through" : "text-muted-foreground", children: s.name })
|
|
20129
|
-
]
|
|
20130
|
-
},
|
|
20131
|
-
i
|
|
20132
|
-
)) }),
|
|
20133
|
-
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
20134
|
-
ChartTooltip,
|
|
20135
|
-
{
|
|
20136
|
-
x: hoveredPoint?.x ?? 0,
|
|
20137
|
-
y: hoveredPoint?.y ?? 0,
|
|
20138
|
-
visible: !!hoveredPoint,
|
|
20139
|
-
label: hoveredPoint?.axis,
|
|
20140
|
-
items: hoveredPoint?.items,
|
|
20141
|
-
containerRef
|
|
20142
|
-
}
|
|
20143
|
-
)
|
|
20144
|
-
] });
|
|
20145
|
-
}
|
|
20146
|
-
|
|
20147
|
-
// src/components/GaugeChart.tsx
|
|
20148
|
-
var import_react33 = require("react");
|
|
20149
|
-
var import_jsx_runtime64 = require("react/jsx-runtime");
|
|
20150
|
-
function GaugeChart({
|
|
20151
|
-
value,
|
|
20152
|
-
min = 0,
|
|
20153
|
-
max = 100,
|
|
20154
|
-
size = 200,
|
|
20155
|
-
thickness = 20,
|
|
20156
|
-
color = "currentColor",
|
|
20157
|
-
backgroundColor,
|
|
20158
|
-
showValue = true,
|
|
20159
|
-
showMinMax = true,
|
|
20160
|
-
label,
|
|
20161
|
-
animated = true,
|
|
20162
|
-
startAngle = -135,
|
|
20163
|
-
endAngle = 135,
|
|
20164
|
-
zones,
|
|
20165
|
-
formatValue,
|
|
20166
|
-
labelClassName,
|
|
20167
|
-
className = ""
|
|
20168
|
-
}) {
|
|
20169
|
-
const center = size / 2;
|
|
20170
|
-
const radius = center - thickness / 2 - 10;
|
|
20171
|
-
const { backgroundPath, valuePath, percentage, needleAngle, zonePaths } = (0, import_react33.useMemo)(() => {
|
|
20172
|
-
const normalizedValue = Math.min(Math.max(value, min), max);
|
|
20173
|
-
const pct = (normalizedValue - min) / (max - min);
|
|
20174
|
-
const totalAngle = endAngle - startAngle;
|
|
20175
|
-
const currentAngle = startAngle + pct * totalAngle;
|
|
20176
|
-
const polarToCartesian = (angle) => {
|
|
20177
|
-
const radians = angle * Math.PI / 180;
|
|
20178
|
-
return {
|
|
20179
|
-
x: center + radius * Math.cos(radians),
|
|
20180
|
-
y: center + radius * Math.sin(radians)
|
|
20181
|
-
};
|
|
20182
|
-
};
|
|
20183
|
-
const createArc = (start, end) => {
|
|
20184
|
-
const startPoint = polarToCartesian(start);
|
|
20185
|
-
const endPoint = polarToCartesian(end);
|
|
20186
|
-
const largeArc = Math.abs(end - start) > 180 ? 1 : 0;
|
|
20187
|
-
return `M ${startPoint.x} ${startPoint.y} A ${radius} ${radius} 0 ${largeArc} 1 ${endPoint.x} ${endPoint.y}`;
|
|
20188
|
-
};
|
|
20189
|
-
const zonePaths2 = (zones ?? []).map((zone) => {
|
|
20190
|
-
const zoneStart = startAngle + (Math.max(zone.min, min) - min) / (max - min) * totalAngle;
|
|
20191
|
-
const zoneEnd = startAngle + (Math.min(zone.max, max) - min) / (max - min) * totalAngle;
|
|
20192
|
-
return { path: createArc(zoneStart, zoneEnd), color: zone.color };
|
|
20193
|
-
});
|
|
20194
|
-
return {
|
|
20195
|
-
backgroundPath: createArc(startAngle, endAngle),
|
|
20196
|
-
valuePath: createArc(startAngle, currentAngle),
|
|
20197
|
-
percentage: pct,
|
|
20198
|
-
needleAngle: currentAngle,
|
|
20199
|
-
zonePaths: zonePaths2
|
|
20200
|
-
};
|
|
20201
|
-
}, [value, min, max, center, radius, startAngle, endAngle, zones]);
|
|
20202
|
-
const needleLength = radius - 10;
|
|
20203
|
-
const needleAngleRad = needleAngle * Math.PI / 180;
|
|
20204
|
-
const needleX = center + needleLength * Math.cos(needleAngleRad);
|
|
20205
|
-
const needleY = center + needleLength * Math.sin(needleAngleRad);
|
|
20206
|
-
return /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("svg", { width: size, height: size * 0.7, className: `overflow-visible ${className}`, style: { fontFamily: "inherit" }, children: [
|
|
20207
|
-
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
20208
|
-
"path",
|
|
20209
|
-
{
|
|
20210
|
-
d: backgroundPath,
|
|
20211
|
-
fill: "none",
|
|
20212
|
-
stroke: backgroundColor || "currentColor",
|
|
20213
|
-
strokeWidth: thickness,
|
|
20214
|
-
strokeLinecap: "round",
|
|
20215
|
-
className: !backgroundColor ? "text-muted-foreground/20" : ""
|
|
20216
|
-
}
|
|
20217
|
-
),
|
|
20218
|
-
zonePaths.map((zone, i) => /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("path", { d: zone.path, fill: "none", stroke: zone.color, strokeWidth: thickness, strokeLinecap: "round", opacity: 0.35 }, `zone-${i}`)),
|
|
20219
|
-
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
20220
|
-
"path",
|
|
20221
|
-
{
|
|
20222
|
-
d: valuePath,
|
|
20223
|
-
fill: "none",
|
|
20224
|
-
stroke: color,
|
|
20225
|
-
strokeWidth: thickness,
|
|
20226
|
-
strokeLinecap: "round",
|
|
20227
|
-
style: animated ? {
|
|
20228
|
-
strokeDasharray: "1000",
|
|
20229
|
-
strokeDashoffset: 1e3,
|
|
20230
|
-
animation: "drawArc 1s ease-out forwards"
|
|
20231
|
-
} : void 0
|
|
20232
|
-
}
|
|
20233
|
-
),
|
|
20234
|
-
/* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(
|
|
20235
|
-
"g",
|
|
20236
|
-
{
|
|
20237
|
-
style: animated ? {
|
|
20238
|
-
transform: `rotate(${startAngle}deg)`,
|
|
20239
|
-
transformOrigin: `${center}px ${center}px`,
|
|
20240
|
-
animation: `needleRotate 1s ease-out forwards`,
|
|
20241
|
-
["--needle-end"]: `${needleAngle}deg`
|
|
20242
|
-
} : {
|
|
20243
|
-
transform: `rotate(${needleAngle}deg)`,
|
|
20244
|
-
transformOrigin: `${center}px ${center}px`
|
|
20245
|
-
},
|
|
20246
|
-
children: [
|
|
20247
|
-
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)("line", { x1: center, y1: center, x2: center + needleLength, y2: center, stroke: color, strokeWidth: 3, strokeLinecap: "round" }),
|
|
20248
|
-
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)("circle", { cx: center, cy: center, r: 8, fill: color }),
|
|
20249
|
-
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)("circle", { cx: center, cy: center, r: 4, className: "text-background", fill: "currentColor" })
|
|
20250
|
-
]
|
|
20251
|
-
}
|
|
20252
|
-
),
|
|
20253
|
-
showMinMax && /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("g", { className: labelClassName || "text-muted-foreground", children: [
|
|
20254
|
-
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
20255
|
-
"text",
|
|
20256
|
-
{
|
|
20257
|
-
x: center + (radius + 20) * Math.cos(startAngle * Math.PI / 180),
|
|
20258
|
-
y: center + (radius + 20) * Math.sin(startAngle * Math.PI / 180) + 5,
|
|
20259
|
-
textAnchor: "middle",
|
|
20260
|
-
fontSize: "10",
|
|
20261
|
-
fill: "currentColor",
|
|
20262
|
-
children: min
|
|
20263
|
-
}
|
|
20264
|
-
),
|
|
20265
|
-
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
20266
|
-
"text",
|
|
20267
|
-
{
|
|
20268
|
-
x: center + (radius + 20) * Math.cos(endAngle * Math.PI / 180),
|
|
20269
|
-
y: center + (radius + 20) * Math.sin(endAngle * Math.PI / 180) + 5,
|
|
20270
|
-
textAnchor: "middle",
|
|
20271
|
-
fontSize: "10",
|
|
20272
|
-
fill: "currentColor",
|
|
20273
|
-
children: max
|
|
20274
|
-
}
|
|
20275
|
-
)
|
|
20276
|
-
] }),
|
|
20277
|
-
showValue && /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("g", { children: [
|
|
20278
|
-
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
20279
|
-
"text",
|
|
20280
|
-
{
|
|
20281
|
-
x: center,
|
|
20282
|
-
y: center + 35,
|
|
20283
|
-
textAnchor: "middle",
|
|
20284
|
-
fontSize: "24",
|
|
20285
|
-
fontWeight: "600",
|
|
20286
|
-
className: "text-foreground",
|
|
20287
|
-
fill: "currentColor",
|
|
20288
|
-
style: animated ? { opacity: 0, animation: "fadeIn 0.5s ease-out 0.5s forwards" } : void 0,
|
|
20289
|
-
children: formatValue ? formatValue(value) : value
|
|
20290
|
-
}
|
|
20291
|
-
),
|
|
20292
|
-
label && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
20293
|
-
"text",
|
|
20294
|
-
{
|
|
20295
|
-
x: center,
|
|
20296
|
-
y: center + 55,
|
|
20297
|
-
textAnchor: "middle",
|
|
20298
|
-
fontSize: "12",
|
|
20299
|
-
className: "text-muted-foreground",
|
|
20300
|
-
fill: "currentColor",
|
|
20301
|
-
style: animated ? { opacity: 0, animation: "fadeIn 0.5s ease-out 0.6s forwards" } : void 0,
|
|
20302
|
-
children: label
|
|
20303
|
-
}
|
|
20304
|
-
)
|
|
20305
|
-
] }),
|
|
20306
|
-
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)("style", { children: `
|
|
20307
|
-
@keyframes drawArc {
|
|
20308
|
-
to {
|
|
20309
|
-
stroke-dashoffset: 0;
|
|
20310
|
-
}
|
|
20311
|
-
}
|
|
20312
|
-
@keyframes needleRotate {
|
|
20313
|
-
to {
|
|
20314
|
-
transform: rotate(var(--needle-end));
|
|
20315
|
-
}
|
|
20316
|
-
}
|
|
20317
|
-
@keyframes fadeIn {
|
|
20318
|
-
from { opacity: 0; }
|
|
20319
|
-
to { opacity: 1; }
|
|
20320
|
-
}
|
|
20321
|
-
` })
|
|
20322
|
-
] });
|
|
20323
|
-
}
|
|
20324
|
-
|
|
20325
|
-
// src/components/ClientOnly.tsx
|
|
20326
|
-
var import_react34 = require("react");
|
|
20327
|
-
var import_jsx_runtime65 = require("react/jsx-runtime");
|
|
20328
18669
|
function ClientOnly({ children, fallback = null }) {
|
|
20329
|
-
const [hasMounted, setHasMounted] = (0,
|
|
20330
|
-
(0,
|
|
18670
|
+
const [hasMounted, setHasMounted] = (0, import_react26.useState)(false);
|
|
18671
|
+
(0, import_react26.useEffect)(() => {
|
|
20331
18672
|
setHasMounted(true);
|
|
20332
18673
|
}, []);
|
|
20333
18674
|
if (!hasMounted) {
|
|
20334
|
-
return /* @__PURE__ */ (0,
|
|
18675
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(import_jsx_runtime57.Fragment, { children: fallback });
|
|
20335
18676
|
}
|
|
20336
|
-
return /* @__PURE__ */ (0,
|
|
18677
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(import_jsx_runtime57.Fragment, { children });
|
|
20337
18678
|
}
|
|
20338
18679
|
|
|
20339
18680
|
// src/components/Loading.tsx
|
|
20340
18681
|
var import_lucide_react33 = require("lucide-react");
|
|
20341
|
-
var
|
|
18682
|
+
var import_jsx_runtime58 = require("react/jsx-runtime");
|
|
20342
18683
|
var LoadingSpinner = ({
|
|
20343
18684
|
size = "md",
|
|
20344
18685
|
className,
|
|
@@ -20354,7 +18695,7 @@ var LoadingSpinner = ({
|
|
|
20354
18695
|
foreground: "text-foreground",
|
|
20355
18696
|
muted: "text-muted-foreground"
|
|
20356
18697
|
};
|
|
20357
|
-
return /* @__PURE__ */ (0,
|
|
18698
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
20358
18699
|
import_lucide_react33.Activity,
|
|
20359
18700
|
{
|
|
20360
18701
|
className: cn(
|
|
@@ -20375,7 +18716,7 @@ var LoadingDots = ({
|
|
|
20375
18716
|
foreground: "bg-foreground",
|
|
20376
18717
|
muted: "bg-muted-foreground"
|
|
20377
18718
|
};
|
|
20378
|
-
return /* @__PURE__ */ (0,
|
|
18719
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { className: cn("flex items-center space-x-1", className), children: [0, 1, 2].map((i) => /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
20379
18720
|
"div",
|
|
20380
18721
|
{
|
|
20381
18722
|
className: cn(
|
|
@@ -20397,7 +18738,7 @@ var LoadingBar = ({
|
|
|
20397
18738
|
label
|
|
20398
18739
|
}) => {
|
|
20399
18740
|
const pct = progress ? Math.min(Math.max(progress, 0), 100) : void 0;
|
|
20400
|
-
return /* @__PURE__ */ (0,
|
|
18741
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
20401
18742
|
"div",
|
|
20402
18743
|
{
|
|
20403
18744
|
className: cn("w-full bg-muted rounded-full h-2", className),
|
|
@@ -20406,7 +18747,7 @@ var LoadingBar = ({
|
|
|
20406
18747
|
"aria-valuemax": pct === void 0 ? void 0 : 100,
|
|
20407
18748
|
"aria-valuenow": pct === void 0 ? void 0 : Math.round(pct),
|
|
20408
18749
|
"aria-label": label || "Loading",
|
|
20409
|
-
children: /* @__PURE__ */ (0,
|
|
18750
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
20410
18751
|
"div",
|
|
20411
18752
|
{
|
|
20412
18753
|
className: cn(
|
|
@@ -20423,8 +18764,8 @@ var LoadingBar = ({
|
|
|
20423
18764
|
};
|
|
20424
18765
|
|
|
20425
18766
|
// src/components/Table.tsx
|
|
20426
|
-
var
|
|
20427
|
-
var
|
|
18767
|
+
var import_react27 = __toESM(require("react"), 1);
|
|
18768
|
+
var import_jsx_runtime59 = require("react/jsx-runtime");
|
|
20428
18769
|
var TABLE_BASE_CLASS = "w-full caption-bottom text-sm";
|
|
20429
18770
|
var TABLE_CONTAINER_BASE_CLASS = [
|
|
20430
18771
|
"relative w-full overflow-auto",
|
|
@@ -20441,10 +18782,10 @@ function assignRef3(ref, value) {
|
|
|
20441
18782
|
ref.current = value;
|
|
20442
18783
|
}
|
|
20443
18784
|
}
|
|
20444
|
-
var TableContainer =
|
|
20445
|
-
const containerRef =
|
|
18785
|
+
var TableContainer = import_react27.default.forwardRef(({ className, useOverlayScrollbar = false, ...props }, ref) => {
|
|
18786
|
+
const containerRef = import_react27.default.useRef(null);
|
|
20446
18787
|
useOverlayScrollbarTarget(containerRef, { enabled: useOverlayScrollbar });
|
|
20447
|
-
return /* @__PURE__ */ (0,
|
|
18788
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
20448
18789
|
"div",
|
|
20449
18790
|
{
|
|
20450
18791
|
ref: (node) => {
|
|
@@ -20457,25 +18798,25 @@ var TableContainer = import_react35.default.forwardRef(({ className, useOverlayS
|
|
|
20457
18798
|
);
|
|
20458
18799
|
});
|
|
20459
18800
|
TableContainer.displayName = "TableContainer";
|
|
20460
|
-
var Table =
|
|
18801
|
+
var Table = import_react27.default.forwardRef(
|
|
20461
18802
|
({ className, containerClassName, disableContainer = false, useOverlayScrollbar = false, ...props }, ref) => {
|
|
20462
18803
|
if (disableContainer) {
|
|
20463
|
-
return /* @__PURE__ */ (0,
|
|
18804
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("table", { ref, className: cn(TABLE_BASE_CLASS, className), ...props });
|
|
20464
18805
|
}
|
|
20465
|
-
return /* @__PURE__ */ (0,
|
|
18806
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(TableContainer, { className: containerClassName, useOverlayScrollbar, children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("table", { ref, className: cn(TABLE_BASE_CLASS, className), ...props }) });
|
|
20466
18807
|
}
|
|
20467
18808
|
);
|
|
20468
18809
|
Table.displayName = "Table";
|
|
20469
|
-
var TableHeader =
|
|
18810
|
+
var TableHeader = import_react27.default.forwardRef(({ className, children, filterRow, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("thead", { ref, className: cn("[&_tr]:border-b [&_tr]:border-border/50", "bg-muted", className), ...props, children: [
|
|
20470
18811
|
children,
|
|
20471
18812
|
filterRow
|
|
20472
18813
|
] }));
|
|
20473
18814
|
TableHeader.displayName = "TableHeader";
|
|
20474
|
-
var TableBody =
|
|
18815
|
+
var TableBody = import_react27.default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("tbody", { ref, className: cn("[&_tr:last-child]:border-0", className), ...props }));
|
|
20475
18816
|
TableBody.displayName = "TableBody";
|
|
20476
|
-
var TableFooter =
|
|
18817
|
+
var TableFooter = import_react27.default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("tfoot", { ref, className: cn("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0", className), ...props }));
|
|
20477
18818
|
TableFooter.displayName = "TableFooter";
|
|
20478
|
-
var TableRow =
|
|
18819
|
+
var TableRow = import_react27.default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
20479
18820
|
"tr",
|
|
20480
18821
|
{
|
|
20481
18822
|
ref,
|
|
@@ -20489,7 +18830,7 @@ var TableRow = import_react35.default.forwardRef(({ className, ...props }, ref)
|
|
|
20489
18830
|
}
|
|
20490
18831
|
));
|
|
20491
18832
|
TableRow.displayName = "TableRow";
|
|
20492
|
-
var TableHead =
|
|
18833
|
+
var TableHead = import_react27.default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
20493
18834
|
"th",
|
|
20494
18835
|
{
|
|
20495
18836
|
ref,
|
|
@@ -20498,16 +18839,16 @@ var TableHead = import_react35.default.forwardRef(({ className, ...props }, ref)
|
|
|
20498
18839
|
}
|
|
20499
18840
|
));
|
|
20500
18841
|
TableHead.displayName = "TableHead";
|
|
20501
|
-
var TableCell =
|
|
18842
|
+
var TableCell = import_react27.default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("td", { ref, className: cn("p-4 align-middle [&:has([role=checkbox])]:pr-0", className), ...props }));
|
|
20502
18843
|
TableCell.displayName = "TableCell";
|
|
20503
|
-
var TableCaption =
|
|
18844
|
+
var TableCaption = import_react27.default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("caption", { ref, className: cn("mt-4 text-sm text-muted-foreground", className), ...props }));
|
|
20504
18845
|
TableCaption.displayName = "TableCaption";
|
|
20505
18846
|
|
|
20506
18847
|
// src/components/DataTable/DataTable.tsx
|
|
20507
|
-
var
|
|
18848
|
+
var import_react36 = __toESM(require("react"), 1);
|
|
20508
18849
|
|
|
20509
18850
|
// src/components/DataTable/components/DataTableBody.tsx
|
|
20510
|
-
var
|
|
18851
|
+
var import_jsx_runtime60 = require("react/jsx-runtime");
|
|
20511
18852
|
function DataTableBodyRows({
|
|
20512
18853
|
leafColumns,
|
|
20513
18854
|
displayedData,
|
|
@@ -20522,10 +18863,10 @@ function DataTableBodyRows({
|
|
|
20522
18863
|
getStickyCellClass,
|
|
20523
18864
|
t
|
|
20524
18865
|
}) {
|
|
20525
|
-
return /* @__PURE__ */ (0,
|
|
20526
|
-
/* @__PURE__ */ (0,
|
|
20527
|
-
/* @__PURE__ */ (0,
|
|
20528
|
-
/* @__PURE__ */ (0,
|
|
18866
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(TableBody, { children: loading2 ? /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(TableRow, { children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(TableCell, { colSpan: leafColumns.length, className: "text-center py-8", children: /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("div", { className: "flex items-center justify-center gap-2 text-muted-foreground", children: [
|
|
18867
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("svg", { className: "animate-spin h-4 w-4", xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", children: [
|
|
18868
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }),
|
|
18869
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
20529
18870
|
"path",
|
|
20530
18871
|
{
|
|
20531
18872
|
className: "opacity-75",
|
|
@@ -20534,13 +18875,13 @@ function DataTableBodyRows({
|
|
|
20534
18875
|
}
|
|
20535
18876
|
)
|
|
20536
18877
|
] }),
|
|
20537
|
-
/* @__PURE__ */ (0,
|
|
18878
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("span", { className: "text-sm", children: [
|
|
20538
18879
|
t("loading"),
|
|
20539
18880
|
"\u2026"
|
|
20540
18881
|
] })
|
|
20541
|
-
] }) }) }) : displayedData.length === 0 ? /* @__PURE__ */ (0,
|
|
18882
|
+
] }) }) }) : displayedData.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(TableRow, { children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(TableCell, { colSpan: leafColumns.length, className: "text-center py-6 text-muted-foreground", children: t("noData") }) }) : displayedData.map((row, idx) => {
|
|
20542
18883
|
const isStripedRow = striped && idx % 2 === 0;
|
|
20543
|
-
return /* @__PURE__ */ (0,
|
|
18884
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
20544
18885
|
TableRow,
|
|
20545
18886
|
{
|
|
20546
18887
|
className: cn(densityRowClass, isStripedRow ? "bg-surface-1" : "bg-surface-0"),
|
|
@@ -20553,7 +18894,7 @@ function DataTableBodyRows({
|
|
|
20553
18894
|
const prevCol = colIdx > 0 ? leafColumns[colIdx - 1] : null;
|
|
20554
18895
|
const isAfterFixedLeft = prevCol?.fixed === "left";
|
|
20555
18896
|
const showBorderLeft = columnDividers && colIdx > 0 && !isAfterFixedLeft && !col.fixed;
|
|
20556
|
-
return /* @__PURE__ */ (0,
|
|
18897
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
20557
18898
|
TableCell,
|
|
20558
18899
|
{
|
|
20559
18900
|
style: getStickyColumnStyle(col),
|
|
@@ -20576,9 +18917,9 @@ function DataTableBodyRows({
|
|
|
20576
18917
|
}
|
|
20577
18918
|
|
|
20578
18919
|
// src/components/DataTable/components/DataTableHeader.tsx
|
|
20579
|
-
var
|
|
18920
|
+
var import_react28 = __toESM(require("react"), 1);
|
|
20580
18921
|
var import_lucide_react34 = require("lucide-react");
|
|
20581
|
-
var
|
|
18922
|
+
var import_jsx_runtime61 = require("react/jsx-runtime");
|
|
20582
18923
|
function DataTableHeader({
|
|
20583
18924
|
headerRows,
|
|
20584
18925
|
headerAlign,
|
|
@@ -20596,13 +18937,13 @@ function DataTableHeader({
|
|
|
20596
18937
|
getStickyHeaderCellStyle,
|
|
20597
18938
|
t
|
|
20598
18939
|
}) {
|
|
20599
|
-
const renderFilterControl =
|
|
18940
|
+
const renderFilterControl = import_react28.default.useCallback(
|
|
20600
18941
|
(col) => {
|
|
20601
18942
|
if (!col.filter) return null;
|
|
20602
18943
|
const key = col.key;
|
|
20603
18944
|
const commonProps = { className: "w-full", size };
|
|
20604
18945
|
if (col.filter.type === "text") {
|
|
20605
|
-
return /* @__PURE__ */ (0,
|
|
18946
|
+
return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
20606
18947
|
Input_default,
|
|
20607
18948
|
{
|
|
20608
18949
|
...commonProps,
|
|
@@ -20616,7 +18957,7 @@ function DataTableHeader({
|
|
|
20616
18957
|
);
|
|
20617
18958
|
}
|
|
20618
18959
|
if (col.filter.type === "select") {
|
|
20619
|
-
return /* @__PURE__ */ (0,
|
|
18960
|
+
return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
20620
18961
|
Combobox,
|
|
20621
18962
|
{
|
|
20622
18963
|
options: ["", ...col.filter.options || []],
|
|
@@ -20632,7 +18973,7 @@ function DataTableHeader({
|
|
|
20632
18973
|
);
|
|
20633
18974
|
}
|
|
20634
18975
|
if (col.filter.type === "date") {
|
|
20635
|
-
return /* @__PURE__ */ (0,
|
|
18976
|
+
return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
20636
18977
|
DatePicker,
|
|
20637
18978
|
{
|
|
20638
18979
|
size,
|
|
@@ -20649,10 +18990,10 @@ function DataTableHeader({
|
|
|
20649
18990
|
},
|
|
20650
18991
|
[filters, setCurPage, setFilters, size]
|
|
20651
18992
|
);
|
|
20652
|
-
const renderHeaderContent =
|
|
18993
|
+
const renderHeaderContent = import_react28.default.useCallback(
|
|
20653
18994
|
(col, isLeaf) => {
|
|
20654
18995
|
if (!isLeaf) {
|
|
20655
|
-
return /* @__PURE__ */ (0,
|
|
18996
|
+
return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
20656
18997
|
"div",
|
|
20657
18998
|
{
|
|
20658
18999
|
className: cn(
|
|
@@ -20662,15 +19003,15 @@ function DataTableHeader({
|
|
|
20662
19003
|
col.align === "center" && "justify-center",
|
|
20663
19004
|
!col.align && "justify-start"
|
|
20664
19005
|
),
|
|
20665
|
-
children: /* @__PURE__ */ (0,
|
|
19006
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("span", { className: cn("font-medium whitespace-nowrap", headerTitleClass), children: col.title })
|
|
20666
19007
|
}
|
|
20667
19008
|
);
|
|
20668
19009
|
}
|
|
20669
19010
|
const isRightAlign = col.align === "right" || !col.align && headerAlign === "right";
|
|
20670
19011
|
const isCenterAlign = col.align === "center" || !col.align && headerAlign === "center";
|
|
20671
|
-
const titleContent = /* @__PURE__ */ (0,
|
|
20672
|
-
/* @__PURE__ */ (0,
|
|
20673
|
-
col.sortable && /* @__PURE__ */ (0,
|
|
19012
|
+
const titleContent = /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
19013
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)("span", { className: cn("font-medium whitespace-nowrap", headerTitleClass), children: col.title }),
|
|
19014
|
+
col.sortable && /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
20674
19015
|
"button",
|
|
20675
19016
|
{
|
|
20676
19017
|
className: cn(
|
|
@@ -20687,8 +19028,8 @@ function DataTableHeader({
|
|
|
20687
19028
|
},
|
|
20688
19029
|
"aria-label": "Sort",
|
|
20689
19030
|
title: `Sort by ${String(col.title)}`,
|
|
20690
|
-
children: /* @__PURE__ */ (0,
|
|
20691
|
-
/* @__PURE__ */ (0,
|
|
19031
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("svg", { viewBox: "0 0 20 20", fill: "none", className: cn("inline-block", sortIconClass), children: [
|
|
19032
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
20692
19033
|
"path",
|
|
20693
19034
|
{
|
|
20694
19035
|
d: "M7 8l3-3 3 3",
|
|
@@ -20699,7 +19040,7 @@ function DataTableHeader({
|
|
|
20699
19040
|
opacity: sort?.key === col.key && sort.order === "asc" ? 1 : 0.4
|
|
20700
19041
|
}
|
|
20701
19042
|
),
|
|
20702
|
-
/* @__PURE__ */ (0,
|
|
19043
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
20703
19044
|
"path",
|
|
20704
19045
|
{
|
|
20705
19046
|
d: "M7 12l3 3 3-3",
|
|
@@ -20714,11 +19055,11 @@ function DataTableHeader({
|
|
|
20714
19055
|
}
|
|
20715
19056
|
)
|
|
20716
19057
|
] });
|
|
20717
|
-
const filterContent = col.filter ? /* @__PURE__ */ (0,
|
|
19058
|
+
const filterContent = col.filter ? /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
20718
19059
|
Popover,
|
|
20719
19060
|
{
|
|
20720
19061
|
placement: "bottom-start",
|
|
20721
|
-
trigger: /* @__PURE__ */ (0,
|
|
19062
|
+
trigger: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
20722
19063
|
"button",
|
|
20723
19064
|
{
|
|
20724
19065
|
className: cn(
|
|
@@ -20727,13 +19068,13 @@ function DataTableHeader({
|
|
|
20727
19068
|
),
|
|
20728
19069
|
"aria-label": "Filter",
|
|
20729
19070
|
title: `Filter by ${String(col.title)}`,
|
|
20730
|
-
children: /* @__PURE__ */ (0,
|
|
19071
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(import_lucide_react34.Filter, { className: "w-4 h-4" })
|
|
20731
19072
|
}
|
|
20732
19073
|
),
|
|
20733
|
-
children: /* @__PURE__ */ (0,
|
|
20734
|
-
/* @__PURE__ */ (0,
|
|
20735
|
-
/* @__PURE__ */ (0,
|
|
20736
|
-
filters[col.key] !== void 0 && filters[col.key] !== null && filters[col.key] !== "" && /* @__PURE__ */ (0,
|
|
19074
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("div", { className: "p-3 w-64 space-y-3", children: [
|
|
19075
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
19076
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)("div", { className: "text-sm font-medium", children: col.title }),
|
|
19077
|
+
filters[col.key] !== void 0 && filters[col.key] !== null && filters[col.key] !== "" && /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
20737
19078
|
"button",
|
|
20738
19079
|
{
|
|
20739
19080
|
onClick: () => {
|
|
@@ -20749,7 +19090,7 @@ function DataTableHeader({
|
|
|
20749
19090
|
] })
|
|
20750
19091
|
}
|
|
20751
19092
|
) : null;
|
|
20752
|
-
return /* @__PURE__ */ (0,
|
|
19093
|
+
return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
20753
19094
|
"div",
|
|
20754
19095
|
{
|
|
20755
19096
|
className: cn(
|
|
@@ -20759,10 +19100,10 @@ function DataTableHeader({
|
|
|
20759
19100
|
isCenterAlign && "justify-center",
|
|
20760
19101
|
!isRightAlign && !isCenterAlign && "justify-start"
|
|
20761
19102
|
),
|
|
20762
|
-
children: isRightAlign ? /* @__PURE__ */ (0,
|
|
19103
|
+
children: isRightAlign ? /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(import_jsx_runtime61.Fragment, { children: [
|
|
20763
19104
|
filterContent,
|
|
20764
19105
|
titleContent
|
|
20765
|
-
] }) : /* @__PURE__ */ (0,
|
|
19106
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(import_jsx_runtime61.Fragment, { children: [
|
|
20766
19107
|
titleContent,
|
|
20767
19108
|
filterContent
|
|
20768
19109
|
] })
|
|
@@ -20783,13 +19124,13 @@ function DataTableHeader({
|
|
|
20783
19124
|
t
|
|
20784
19125
|
]
|
|
20785
19126
|
);
|
|
20786
|
-
return /* @__PURE__ */ (0,
|
|
19127
|
+
return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(import_jsx_runtime61.Fragment, { children: headerRows.map((row, rowIndex) => /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(TableRow, { children: row.map((headerCell, cellIndex) => {
|
|
20787
19128
|
const { column: col, colSpan, rowSpan, isLeaf } = headerCell;
|
|
20788
19129
|
const prevCell = cellIndex > 0 ? row[cellIndex - 1] : null;
|
|
20789
19130
|
const prevCol = prevCell?.column;
|
|
20790
19131
|
const isAfterFixedLeft = prevCol?.fixed === "left";
|
|
20791
19132
|
const showBorderLeft = columnDividers && cellIndex > 0 && !isAfterFixedLeft && !col.fixed;
|
|
20792
|
-
return /* @__PURE__ */ (0,
|
|
19133
|
+
return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
20793
19134
|
TableHead,
|
|
20794
19135
|
{
|
|
20795
19136
|
colSpan,
|
|
@@ -20812,8 +19153,8 @@ function DataTableHeader({
|
|
|
20812
19153
|
}
|
|
20813
19154
|
|
|
20814
19155
|
// src/components/DataTable/components/Pagination.tsx
|
|
20815
|
-
var
|
|
20816
|
-
var
|
|
19156
|
+
var import_react29 = __toESM(require("react"), 1);
|
|
19157
|
+
var import_jsx_runtime62 = require("react/jsx-runtime");
|
|
20817
19158
|
function DataTablePagination({
|
|
20818
19159
|
totalItems,
|
|
20819
19160
|
curPage,
|
|
@@ -20824,7 +19165,7 @@ function DataTablePagination({
|
|
|
20824
19165
|
size
|
|
20825
19166
|
}) {
|
|
20826
19167
|
const totalPages = Math.ceil(totalItems / curPageSize);
|
|
20827
|
-
const pages =
|
|
19168
|
+
const pages = import_react29.default.useMemo(() => {
|
|
20828
19169
|
const result = [];
|
|
20829
19170
|
if (totalPages <= 5) {
|
|
20830
19171
|
for (let i = 1; i <= totalPages; i++) result.push(i);
|
|
@@ -20846,16 +19187,16 @@ function DataTablePagination({
|
|
|
20846
19187
|
const pageBtnClass = size === "sm" ? "h-6 min-w-6 px-1.5 rounded-full text-[11px] font-medium transition-colors" : size === "lg" ? "h-8 min-w-8 px-2.5 rounded-full text-sm font-medium transition-colors" : "h-7 min-w-7 px-2 rounded-full text-xs font-medium transition-colors";
|
|
20847
19188
|
const containerTextClass = size === "sm" ? "text-[11px]" : size === "lg" ? "text-sm" : "text-xs";
|
|
20848
19189
|
const pageSizeClass = size === "sm" ? "w-16" : size === "lg" ? "w-24" : "w-20";
|
|
20849
|
-
return /* @__PURE__ */ (0,
|
|
20850
|
-
/* @__PURE__ */ (0,
|
|
19190
|
+
return /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { className: cn("flex items-center justify-between gap-2 px-1 pt-3 text-muted-foreground", containerTextClass), children: [
|
|
19191
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { className: "tabular-nums", children: [
|
|
20851
19192
|
(curPage - 1) * curPageSize + 1,
|
|
20852
19193
|
"-",
|
|
20853
19194
|
Math.min(curPage * curPageSize, totalItems),
|
|
20854
19195
|
"/",
|
|
20855
19196
|
totalItems
|
|
20856
19197
|
] }),
|
|
20857
|
-
/* @__PURE__ */ (0,
|
|
20858
|
-
/* @__PURE__ */ (0,
|
|
19198
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { className: "flex items-center gap-0.5", children: [
|
|
19199
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
20859
19200
|
Button_default,
|
|
20860
19201
|
{
|
|
20861
19202
|
variant: "ghost",
|
|
@@ -20863,11 +19204,11 @@ function DataTablePagination({
|
|
|
20863
19204
|
className: navBtnClass,
|
|
20864
19205
|
onClick: () => setCurPage(Math.max(1, curPage - 1)),
|
|
20865
19206
|
disabled: curPage === 1,
|
|
20866
|
-
children: /* @__PURE__ */ (0,
|
|
19207
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("svg", { className: navIconClass, fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M15 19l-7-7 7-7" }) })
|
|
20867
19208
|
}
|
|
20868
19209
|
),
|
|
20869
19210
|
pages.map(
|
|
20870
|
-
(p, i) => p === "..." ? /* @__PURE__ */ (0,
|
|
19211
|
+
(p, i) => p === "..." ? /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { className: "px-1 text-muted-foreground/60", children: "\u2026" }, `dots-${i}`) : /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
20871
19212
|
"button",
|
|
20872
19213
|
{
|
|
20873
19214
|
onClick: () => setCurPage(p),
|
|
@@ -20877,7 +19218,7 @@ function DataTablePagination({
|
|
|
20877
19218
|
p
|
|
20878
19219
|
)
|
|
20879
19220
|
),
|
|
20880
|
-
/* @__PURE__ */ (0,
|
|
19221
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
20881
19222
|
Button_default,
|
|
20882
19223
|
{
|
|
20883
19224
|
variant: "ghost",
|
|
@@ -20885,11 +19226,11 @@ function DataTablePagination({
|
|
|
20885
19226
|
className: navBtnClass,
|
|
20886
19227
|
onClick: () => setCurPage(Math.min(totalPages, curPage + 1)),
|
|
20887
19228
|
disabled: curPage === totalPages,
|
|
20888
|
-
children: /* @__PURE__ */ (0,
|
|
19229
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("svg", { className: navIconClass, fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M9 5l7 7-7 7" }) })
|
|
20889
19230
|
}
|
|
20890
19231
|
)
|
|
20891
19232
|
] }),
|
|
20892
|
-
pageSizeOptions && /* @__PURE__ */ (0,
|
|
19233
|
+
pageSizeOptions && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
20893
19234
|
Combobox,
|
|
20894
19235
|
{
|
|
20895
19236
|
options: pageSizeOptions.map(String),
|
|
@@ -20906,7 +19247,7 @@ function DataTablePagination({
|
|
|
20906
19247
|
}
|
|
20907
19248
|
|
|
20908
19249
|
// src/components/DataTable/components/Toolbar.tsx
|
|
20909
|
-
var
|
|
19250
|
+
var import_react30 = __toESM(require("react"), 1);
|
|
20910
19251
|
|
|
20911
19252
|
// src/components/DataTable/utils/headers.ts
|
|
20912
19253
|
function isLeafColumn(col) {
|
|
@@ -21006,7 +19347,7 @@ function getLeafColumnsWithFixedInheritance(columns, inheritedFixed) {
|
|
|
21006
19347
|
}
|
|
21007
19348
|
|
|
21008
19349
|
// src/components/DataTable/components/Toolbar.tsx
|
|
21009
|
-
var
|
|
19350
|
+
var import_jsx_runtime63 = require("react/jsx-runtime");
|
|
21010
19351
|
function DataTableToolbar({
|
|
21011
19352
|
caption,
|
|
21012
19353
|
toolbar,
|
|
@@ -21027,15 +19368,15 @@ function DataTableToolbar({
|
|
|
21027
19368
|
const controlButtonClass = size === "sm" ? "h-7 px-2 text-xs" : size === "lg" ? "h-9 px-3 text-sm" : "h-8 px-2";
|
|
21028
19369
|
const iconClass = size === "sm" ? "w-3.5 h-3.5 mr-1" : "w-4 h-4 mr-1";
|
|
21029
19370
|
const captionClass = size === "sm" ? "text-xs" : size === "lg" ? "text-sm" : "text-sm";
|
|
21030
|
-
const leafCols =
|
|
21031
|
-
return /* @__PURE__ */ (0,
|
|
21032
|
-
/* @__PURE__ */ (0,
|
|
21033
|
-
/* @__PURE__ */ (0,
|
|
21034
|
-
enableDensityToggle && /* @__PURE__ */ (0,
|
|
19371
|
+
const leafCols = import_react30.default.useMemo(() => getLeafColumns(columns), [columns]);
|
|
19372
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("div", { className: "flex items-center justify-between gap-4 mb-1", children: [
|
|
19373
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)("div", { className: captionClass + " text-muted-foreground", children: caption }),
|
|
19374
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
19375
|
+
enableDensityToggle && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
21035
19376
|
DropdownMenu_default,
|
|
21036
19377
|
{
|
|
21037
|
-
trigger: /* @__PURE__ */ (0,
|
|
21038
|
-
/* @__PURE__ */ (0,
|
|
19378
|
+
trigger: /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(Button_default, { variant: "ghost", size: controlButtonSize, className: controlButtonClass, children: [
|
|
19379
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)("svg", { className: iconClass, fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M4 6h16M4 10h16M4 14h16M4 18h16" }) }),
|
|
21039
19380
|
labels?.density || t("density")
|
|
21040
19381
|
] }),
|
|
21041
19382
|
items: [
|
|
@@ -21045,11 +19386,11 @@ function DataTableToolbar({
|
|
|
21045
19386
|
]
|
|
21046
19387
|
}
|
|
21047
19388
|
),
|
|
21048
|
-
enableColumnVisibilityToggle && /* @__PURE__ */ (0,
|
|
19389
|
+
enableColumnVisibilityToggle && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
21049
19390
|
DropdownMenu_default,
|
|
21050
19391
|
{
|
|
21051
|
-
trigger: /* @__PURE__ */ (0,
|
|
21052
|
-
/* @__PURE__ */ (0,
|
|
19392
|
+
trigger: /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(Button_default, { variant: "ghost", size: controlButtonSize, className: controlButtonClass, children: [
|
|
19393
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)("svg", { className: iconClass, fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
21053
19394
|
"path",
|
|
21054
19395
|
{
|
|
21055
19396
|
strokeLinecap: "round",
|
|
@@ -21060,26 +19401,26 @@ function DataTableToolbar({
|
|
|
21060
19401
|
) }),
|
|
21061
19402
|
labels?.columns || t("columns")
|
|
21062
19403
|
] }),
|
|
21063
|
-
children: leafCols.map((c) => /* @__PURE__ */ (0,
|
|
19404
|
+
children: leafCols.map((c) => /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
|
|
21064
19405
|
DropdownMenuItem,
|
|
21065
19406
|
{
|
|
21066
19407
|
onClick: () => {
|
|
21067
19408
|
setVisibleCols((prev) => prev.includes(c.key) ? prev.filter((k) => k !== c.key) : [...prev, c.key]);
|
|
21068
19409
|
},
|
|
21069
19410
|
children: [
|
|
21070
|
-
/* @__PURE__ */ (0,
|
|
21071
|
-
/* @__PURE__ */ (0,
|
|
19411
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)("input", { type: "checkbox", className: "mr-2 rounded-md border-border/50", readOnly: true, checked: visibleCols.includes(c.key) }),
|
|
19412
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)("span", { className: "truncate", children: c.title })
|
|
21072
19413
|
]
|
|
21073
19414
|
},
|
|
21074
19415
|
c.key
|
|
21075
19416
|
))
|
|
21076
19417
|
}
|
|
21077
19418
|
),
|
|
21078
|
-
enableHeaderAlignToggle && /* @__PURE__ */ (0,
|
|
19419
|
+
enableHeaderAlignToggle && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
21079
19420
|
DropdownMenu_default,
|
|
21080
19421
|
{
|
|
21081
|
-
trigger: /* @__PURE__ */ (0,
|
|
21082
|
-
/* @__PURE__ */ (0,
|
|
19422
|
+
trigger: /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(Button_default, { variant: "ghost", size: controlButtonSize, className: controlButtonClass, children: [
|
|
19423
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)("svg", { className: iconClass, fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M4 6h16M4 12h10M4 18h16" }) }),
|
|
21083
19424
|
labels?.headerAlign || t("headerAlign")
|
|
21084
19425
|
] }),
|
|
21085
19426
|
items: [
|
|
@@ -21095,10 +19436,10 @@ function DataTableToolbar({
|
|
|
21095
19436
|
}
|
|
21096
19437
|
|
|
21097
19438
|
// src/components/DataTable/hooks/useDebounced.ts
|
|
21098
|
-
var
|
|
19439
|
+
var import_react31 = __toESM(require("react"), 1);
|
|
21099
19440
|
function useDebounced(value, delay = 300) {
|
|
21100
|
-
const [debounced, setDebounced] =
|
|
21101
|
-
|
|
19441
|
+
const [debounced, setDebounced] = import_react31.default.useState(value);
|
|
19442
|
+
import_react31.default.useEffect(() => {
|
|
21102
19443
|
const id = setTimeout(() => setDebounced(value), delay);
|
|
21103
19444
|
return () => clearTimeout(id);
|
|
21104
19445
|
}, [value, delay]);
|
|
@@ -21106,7 +19447,7 @@ function useDebounced(value, delay = 300) {
|
|
|
21106
19447
|
}
|
|
21107
19448
|
|
|
21108
19449
|
// src/components/DataTable/hooks/useDataTableModel.ts
|
|
21109
|
-
var
|
|
19450
|
+
var import_react32 = __toESM(require("react"), 1);
|
|
21110
19451
|
|
|
21111
19452
|
// src/components/DataTable/utils/columns.ts
|
|
21112
19453
|
function getColumnWidth(col, fallback = 150) {
|
|
@@ -21134,22 +19475,22 @@ function useDataTableModel({
|
|
|
21134
19475
|
isServerMode,
|
|
21135
19476
|
total
|
|
21136
19477
|
}) {
|
|
21137
|
-
const visibleColsSet =
|
|
21138
|
-
const allLeafColumns =
|
|
21139
|
-
const columnMap =
|
|
19478
|
+
const visibleColsSet = import_react32.default.useMemo(() => new Set(visibleCols), [visibleCols]);
|
|
19479
|
+
const allLeafColumns = import_react32.default.useMemo(() => getLeafColumns(columns), [columns]);
|
|
19480
|
+
const columnMap = import_react32.default.useMemo(() => {
|
|
21140
19481
|
return new Map(allLeafColumns.map((column) => [column.key, column]));
|
|
21141
19482
|
}, [allLeafColumns]);
|
|
21142
|
-
const visibleColumns =
|
|
19483
|
+
const visibleColumns = import_react32.default.useMemo(() => {
|
|
21143
19484
|
return filterVisibleColumns(columns, visibleColsSet);
|
|
21144
19485
|
}, [columns, visibleColsSet]);
|
|
21145
|
-
const leafColumns =
|
|
19486
|
+
const leafColumns = import_react32.default.useMemo(() => {
|
|
21146
19487
|
return getLeafColumnsWithFixedInheritance(visibleColumns);
|
|
21147
19488
|
}, [visibleColumns]);
|
|
21148
|
-
const headerRows =
|
|
21149
|
-
const totalColumnsWidth =
|
|
19489
|
+
const headerRows = import_react32.default.useMemo(() => buildHeaderRows(visibleColumns), [visibleColumns]);
|
|
19490
|
+
const totalColumnsWidth = import_react32.default.useMemo(() => {
|
|
21150
19491
|
return leafColumns.reduce((sum, column) => sum + getColumnWidth(column), 0);
|
|
21151
19492
|
}, [leafColumns]);
|
|
21152
|
-
const processedData =
|
|
19493
|
+
const processedData = import_react32.default.useMemo(() => {
|
|
21153
19494
|
if (isServerMode) return data;
|
|
21154
19495
|
let result = [...data];
|
|
21155
19496
|
if (Object.keys(filters).length > 0) {
|
|
@@ -21181,7 +19522,7 @@ function useDataTableModel({
|
|
|
21181
19522
|
return result;
|
|
21182
19523
|
}, [columnMap, data, filters, isServerMode, sort]);
|
|
21183
19524
|
const totalItems = isServerMode ? total : processedData.length;
|
|
21184
|
-
const displayedData =
|
|
19525
|
+
const displayedData = import_react32.default.useMemo(() => {
|
|
21185
19526
|
if (isServerMode) return data;
|
|
21186
19527
|
const start = (curPage - 1) * curPageSize;
|
|
21187
19528
|
return processedData.slice(start, start + curPageSize);
|
|
@@ -21197,13 +19538,13 @@ function useDataTableModel({
|
|
|
21197
19538
|
}
|
|
21198
19539
|
|
|
21199
19540
|
// src/components/DataTable/hooks/useDataTableState.ts
|
|
21200
|
-
var
|
|
19541
|
+
var import_react34 = __toESM(require("react"), 1);
|
|
21201
19542
|
|
|
21202
19543
|
// src/components/DataTable/hooks/usePageSizeStorage.ts
|
|
21203
|
-
var
|
|
19544
|
+
var import_react33 = __toESM(require("react"), 1);
|
|
21204
19545
|
function usePageSizeStorage({ pageSize, storageKey }) {
|
|
21205
|
-
const loadedFromStorage =
|
|
21206
|
-
const [curPageSize, setCurPageSize] =
|
|
19546
|
+
const loadedFromStorage = import_react33.default.useRef(false);
|
|
19547
|
+
const [curPageSize, setCurPageSize] = import_react33.default.useState(() => {
|
|
21207
19548
|
if (typeof window === "undefined" || !storageKey) return pageSize;
|
|
21208
19549
|
try {
|
|
21209
19550
|
const saved = localStorage.getItem(`datatable_${storageKey}_pageSize`);
|
|
@@ -21218,11 +19559,11 @@ function usePageSizeStorage({ pageSize, storageKey }) {
|
|
|
21218
19559
|
}
|
|
21219
19560
|
return pageSize;
|
|
21220
19561
|
});
|
|
21221
|
-
const hasMounted =
|
|
21222
|
-
|
|
19562
|
+
const hasMounted = import_react33.default.useRef(false);
|
|
19563
|
+
import_react33.default.useEffect(() => {
|
|
21223
19564
|
hasMounted.current = true;
|
|
21224
19565
|
}, []);
|
|
21225
|
-
|
|
19566
|
+
import_react33.default.useEffect(() => {
|
|
21226
19567
|
if (typeof window === "undefined" || !storageKey) return;
|
|
21227
19568
|
if (!hasMounted.current) return;
|
|
21228
19569
|
try {
|
|
@@ -21230,7 +19571,7 @@ function usePageSizeStorage({ pageSize, storageKey }) {
|
|
|
21230
19571
|
} catch {
|
|
21231
19572
|
}
|
|
21232
19573
|
}, [curPageSize, storageKey]);
|
|
21233
|
-
|
|
19574
|
+
import_react33.default.useEffect(() => {
|
|
21234
19575
|
if (storageKey && loadedFromStorage.current) return;
|
|
21235
19576
|
setCurPageSize(pageSize);
|
|
21236
19577
|
}, [pageSize, storageKey]);
|
|
@@ -21250,17 +19591,17 @@ function useDataTableState({
|
|
|
21250
19591
|
size,
|
|
21251
19592
|
storageKey
|
|
21252
19593
|
}) {
|
|
21253
|
-
const allLeafColumns =
|
|
21254
|
-
const defaultVisibleLeafKeys =
|
|
21255
|
-
const knownLeafKeysRef =
|
|
21256
|
-
const [headerAlign, setHeaderAlign] =
|
|
21257
|
-
const [visibleCols, setVisibleCols] =
|
|
21258
|
-
const [filters, setFilters] =
|
|
21259
|
-
const [sort, setSort] =
|
|
21260
|
-
const [density, setDensity] =
|
|
21261
|
-
const [curPage, setCurPage] =
|
|
19594
|
+
const allLeafColumns = import_react34.default.useMemo(() => getLeafColumns(columns), [columns]);
|
|
19595
|
+
const defaultVisibleLeafKeys = import_react34.default.useMemo(() => allLeafColumns.filter((column) => column.visible !== false).map((column) => column.key), [allLeafColumns]);
|
|
19596
|
+
const knownLeafKeysRef = import_react34.default.useRef(new Set(defaultVisibleLeafKeys));
|
|
19597
|
+
const [headerAlign, setHeaderAlign] = import_react34.default.useState("left");
|
|
19598
|
+
const [visibleCols, setVisibleCols] = import_react34.default.useState(defaultVisibleLeafKeys);
|
|
19599
|
+
const [filters, setFilters] = import_react34.default.useState({});
|
|
19600
|
+
const [sort, setSort] = import_react34.default.useState(null);
|
|
19601
|
+
const [density, setDensity] = import_react34.default.useState(() => SIZE_TO_DENSITY[size]);
|
|
19602
|
+
const [curPage, setCurPage] = import_react34.default.useState(page);
|
|
21262
19603
|
const { curPageSize, setCurPageSize } = usePageSizeStorage({ pageSize, storageKey });
|
|
21263
|
-
|
|
19604
|
+
import_react34.default.useEffect(() => {
|
|
21264
19605
|
const knownLeafKeys = knownLeafKeysRef.current;
|
|
21265
19606
|
setVisibleCols((prev) => {
|
|
21266
19607
|
const prevSet = new Set(prev);
|
|
@@ -21268,10 +19609,10 @@ function useDataTableState({
|
|
|
21268
19609
|
});
|
|
21269
19610
|
knownLeafKeysRef.current = new Set(allLeafColumns.map((column) => column.key));
|
|
21270
19611
|
}, [allLeafColumns]);
|
|
21271
|
-
|
|
19612
|
+
import_react34.default.useEffect(() => {
|
|
21272
19613
|
setCurPage(page);
|
|
21273
19614
|
}, [page]);
|
|
21274
|
-
|
|
19615
|
+
import_react34.default.useEffect(() => {
|
|
21275
19616
|
setDensity(SIZE_TO_DENSITY[size]);
|
|
21276
19617
|
}, [size]);
|
|
21277
19618
|
return {
|
|
@@ -21293,7 +19634,7 @@ function useDataTableState({
|
|
|
21293
19634
|
}
|
|
21294
19635
|
|
|
21295
19636
|
// src/components/DataTable/hooks/useStickyColumns.ts
|
|
21296
|
-
var
|
|
19637
|
+
var import_react35 = __toESM(require("react"), 1);
|
|
21297
19638
|
|
|
21298
19639
|
// src/components/DataTable/utils/sticky.ts
|
|
21299
19640
|
function buildStickyLayout(visibleColumns) {
|
|
@@ -21340,8 +19681,8 @@ function resolveGroupStickyPosition(column, positions) {
|
|
|
21340
19681
|
|
|
21341
19682
|
// src/components/DataTable/hooks/useStickyColumns.ts
|
|
21342
19683
|
function useStickyColumns(visibleColumns) {
|
|
21343
|
-
const { positions, leftBoundaryKey, rightBoundaryKey } =
|
|
21344
|
-
const getStickyColumnStyle =
|
|
19684
|
+
const { positions, leftBoundaryKey, rightBoundaryKey } = import_react35.default.useMemo(() => buildStickyLayout(visibleColumns), [visibleColumns]);
|
|
19685
|
+
const getStickyColumnStyle = import_react35.default.useCallback(
|
|
21345
19686
|
(col) => {
|
|
21346
19687
|
const pos = resolveStickyPosition(col, positions);
|
|
21347
19688
|
if (!pos) return {};
|
|
@@ -21352,7 +19693,7 @@ function useStickyColumns(visibleColumns) {
|
|
|
21352
19693
|
},
|
|
21353
19694
|
[positions]
|
|
21354
19695
|
);
|
|
21355
|
-
const getBoundaryShadowClass =
|
|
19696
|
+
const getBoundaryShadowClass = import_react35.default.useCallback(
|
|
21356
19697
|
(col) => {
|
|
21357
19698
|
if (col.fixed === "left" && col.key === leftBoundaryKey) {
|
|
21358
19699
|
return "border-r border-border/80 shadow-[10px_0_16px_-10px_rgba(0,0,0,0.55)]";
|
|
@@ -21364,14 +19705,14 @@ function useStickyColumns(visibleColumns) {
|
|
|
21364
19705
|
},
|
|
21365
19706
|
[leftBoundaryKey, rightBoundaryKey]
|
|
21366
19707
|
);
|
|
21367
|
-
const getStickyHeaderClass =
|
|
19708
|
+
const getStickyHeaderClass = import_react35.default.useCallback(
|
|
21368
19709
|
(col) => {
|
|
21369
19710
|
if (!col.fixed) return "";
|
|
21370
19711
|
return cn("sticky", col.fixed === "left" && "left-0", col.fixed === "right" && "right-0", getBoundaryShadowClass(col), "z-50 !bg-muted");
|
|
21371
19712
|
},
|
|
21372
19713
|
[getBoundaryShadowClass]
|
|
21373
19714
|
);
|
|
21374
|
-
const getStickyCellClass =
|
|
19715
|
+
const getStickyCellClass = import_react35.default.useCallback(
|
|
21375
19716
|
(col, isStripedRow) => {
|
|
21376
19717
|
if (!col.fixed) return "";
|
|
21377
19718
|
return cn(
|
|
@@ -21384,7 +19725,7 @@ function useStickyColumns(visibleColumns) {
|
|
|
21384
19725
|
},
|
|
21385
19726
|
[getBoundaryShadowClass]
|
|
21386
19727
|
);
|
|
21387
|
-
const getStickyHeaderCellStyle =
|
|
19728
|
+
const getStickyHeaderCellStyle = import_react35.default.useCallback(
|
|
21388
19729
|
(headerCell) => {
|
|
21389
19730
|
const col = headerCell.column;
|
|
21390
19731
|
if (headerCell.isLeaf) {
|
|
@@ -21482,7 +19823,7 @@ function validateColumns(columns) {
|
|
|
21482
19823
|
}
|
|
21483
19824
|
|
|
21484
19825
|
// src/components/DataTable/DataTable.tsx
|
|
21485
|
-
var
|
|
19826
|
+
var import_jsx_runtime64 = require("react/jsx-runtime");
|
|
21486
19827
|
function DataTable({
|
|
21487
19828
|
columns,
|
|
21488
19829
|
data,
|
|
@@ -21531,7 +19872,7 @@ function DataTable({
|
|
|
21531
19872
|
size,
|
|
21532
19873
|
storageKey
|
|
21533
19874
|
});
|
|
21534
|
-
|
|
19875
|
+
import_react36.default.useEffect(() => {
|
|
21535
19876
|
if (process.env.NODE_ENV === "development") {
|
|
21536
19877
|
const warnings = validateColumns(columns);
|
|
21537
19878
|
warnings.forEach((w) => console.warn(`[DataTable] ${w}`));
|
|
@@ -21539,8 +19880,8 @@ function DataTable({
|
|
|
21539
19880
|
}, [columns]);
|
|
21540
19881
|
const debouncedFilters = useDebounced(filters, 350);
|
|
21541
19882
|
const isServerMode = Boolean(onQueryChange);
|
|
21542
|
-
const hasEmittedQuery =
|
|
21543
|
-
|
|
19883
|
+
const hasEmittedQuery = import_react36.default.useRef(false);
|
|
19884
|
+
import_react36.default.useEffect(() => {
|
|
21544
19885
|
if (!onQueryChange) return;
|
|
21545
19886
|
if (!hasEmittedQuery.current) {
|
|
21546
19887
|
hasEmittedQuery.current = true;
|
|
@@ -21548,7 +19889,7 @@ function DataTable({
|
|
|
21548
19889
|
}
|
|
21549
19890
|
onQueryChange({ filters: debouncedFilters, sort, page: curPage, pageSize: curPageSize });
|
|
21550
19891
|
}, [debouncedFilters, sort, curPage, curPageSize, onQueryChange]);
|
|
21551
|
-
|
|
19892
|
+
import_react36.default.useEffect(() => {
|
|
21552
19893
|
if (process.env.NODE_ENV !== "development" || rowKey) return;
|
|
21553
19894
|
const hasQueryFeatures = columns.some((column) => column.sortable || column.filter) || Boolean(pageSizeOptions?.length) || isServerMode;
|
|
21554
19895
|
if (!hasQueryFeatures) return;
|
|
@@ -21576,10 +19917,10 @@ function DataTable({
|
|
|
21576
19917
|
if (typeof rowKey === "function") return String(rowKey(row));
|
|
21577
19918
|
return String(row[rowKey]);
|
|
21578
19919
|
};
|
|
21579
|
-
const viewportRef =
|
|
19920
|
+
const viewportRef = import_react36.default.useRef(null);
|
|
21580
19921
|
useOverlayScrollbarTarget(viewportRef, { enabled: useOverlayScrollbar });
|
|
21581
|
-
return /* @__PURE__ */ (0,
|
|
21582
|
-
/* @__PURE__ */ (0,
|
|
19922
|
+
return /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("div", { className: cn("space-y-2", className), children: [
|
|
19923
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
21583
19924
|
DataTableToolbar,
|
|
21584
19925
|
{
|
|
21585
19926
|
caption,
|
|
@@ -21598,20 +19939,20 @@ function DataTable({
|
|
|
21598
19939
|
t
|
|
21599
19940
|
}
|
|
21600
19941
|
),
|
|
21601
|
-
/* @__PURE__ */ (0,
|
|
19942
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
21602
19943
|
"div",
|
|
21603
19944
|
{
|
|
21604
19945
|
className: cn(
|
|
21605
19946
|
"relative rounded-2xl md:rounded-3xl border border-border/50 bg-card overflow-hidden",
|
|
21606
19947
|
loading2 && "opacity-60 pointer-events-none"
|
|
21607
19948
|
),
|
|
21608
|
-
children: /* @__PURE__ */ (0,
|
|
19949
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
21609
19950
|
"div",
|
|
21610
19951
|
{
|
|
21611
19952
|
ref: viewportRef,
|
|
21612
19953
|
className: cn("w-full overflow-x-auto", stickyHeader && "overflow-y-auto"),
|
|
21613
19954
|
style: stickyHeader ? { maxHeight: typeof maxHeight === "number" ? `${maxHeight}px` : maxHeight } : void 0,
|
|
21614
|
-
children: /* @__PURE__ */ (0,
|
|
19955
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(
|
|
21615
19956
|
Table,
|
|
21616
19957
|
{
|
|
21617
19958
|
disableContainer: true,
|
|
@@ -21621,7 +19962,7 @@ function DataTable({
|
|
|
21621
19962
|
),
|
|
21622
19963
|
style: { minWidth: totalColumnsWidth > 0 ? `${totalColumnsWidth}px` : void 0 },
|
|
21623
19964
|
children: [
|
|
21624
|
-
/* @__PURE__ */ (0,
|
|
19965
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(TableHeader, { children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
21625
19966
|
DataTableHeader,
|
|
21626
19967
|
{
|
|
21627
19968
|
headerRows,
|
|
@@ -21641,7 +19982,7 @@ function DataTable({
|
|
|
21641
19982
|
t
|
|
21642
19983
|
}
|
|
21643
19984
|
) }),
|
|
21644
|
-
/* @__PURE__ */ (0,
|
|
19985
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
21645
19986
|
DataTableBodyRows,
|
|
21646
19987
|
{
|
|
21647
19988
|
leafColumns,
|
|
@@ -21665,7 +20006,7 @@ function DataTable({
|
|
|
21665
20006
|
)
|
|
21666
20007
|
}
|
|
21667
20008
|
),
|
|
21668
|
-
/* @__PURE__ */ (0,
|
|
20009
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
21669
20010
|
DataTablePagination,
|
|
21670
20011
|
{
|
|
21671
20012
|
totalItems,
|
|
@@ -21682,10 +20023,10 @@ function DataTable({
|
|
|
21682
20023
|
var DataTable_default = DataTable;
|
|
21683
20024
|
|
|
21684
20025
|
// src/components/Form.tsx
|
|
21685
|
-
var
|
|
20026
|
+
var React60 = __toESM(require("react"), 1);
|
|
21686
20027
|
var import_react_hook_form = require("react-hook-form");
|
|
21687
|
-
var
|
|
21688
|
-
var FormConfigContext =
|
|
20028
|
+
var import_jsx_runtime65 = require("react/jsx-runtime");
|
|
20029
|
+
var FormConfigContext = React60.createContext({ size: "md" });
|
|
21689
20030
|
var FormWrapper = ({
|
|
21690
20031
|
children,
|
|
21691
20032
|
onSubmit,
|
|
@@ -21698,24 +20039,24 @@ var FormWrapper = ({
|
|
|
21698
20039
|
const methods = (0, import_react_hook_form.useForm)({
|
|
21699
20040
|
defaultValues: initialValues
|
|
21700
20041
|
});
|
|
21701
|
-
|
|
20042
|
+
React60.useEffect(() => {
|
|
21702
20043
|
if (initialValues) {
|
|
21703
20044
|
methods.reset(initialValues);
|
|
21704
20045
|
}
|
|
21705
20046
|
}, [JSON.stringify(initialValues)]);
|
|
21706
20047
|
const { validationSchema: _, ...formProps } = props;
|
|
21707
|
-
return /* @__PURE__ */ (0,
|
|
20048
|
+
return /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(import_react_hook_form.FormProvider, { ...methods, children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(FormConfigContext.Provider, { value: { size }, children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("form", { onSubmit: methods.handleSubmit(onSubmit), className, ...formProps, children }) }) });
|
|
21708
20049
|
};
|
|
21709
20050
|
var Form = FormWrapper;
|
|
21710
|
-
var FormFieldContext =
|
|
20051
|
+
var FormFieldContext = React60.createContext({});
|
|
21711
20052
|
var FormField = ({
|
|
21712
20053
|
...props
|
|
21713
20054
|
}) => {
|
|
21714
|
-
return /* @__PURE__ */ (0,
|
|
20055
|
+
return /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(FormFieldContext.Provider, { value: { name: props.name }, children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(import_react_hook_form.Controller, { ...props }) });
|
|
21715
20056
|
};
|
|
21716
20057
|
var useFormField = () => {
|
|
21717
|
-
const fieldContext =
|
|
21718
|
-
const itemContext =
|
|
20058
|
+
const fieldContext = React60.useContext(FormFieldContext);
|
|
20059
|
+
const itemContext = React60.useContext(FormItemContext);
|
|
21719
20060
|
const { getFieldState, formState } = (0, import_react_hook_form.useFormContext)();
|
|
21720
20061
|
if (!fieldContext) {
|
|
21721
20062
|
throw new Error("useFormField must be used within FormField");
|
|
@@ -21731,27 +20072,27 @@ var useFormField = () => {
|
|
|
21731
20072
|
...fieldState
|
|
21732
20073
|
};
|
|
21733
20074
|
};
|
|
21734
|
-
var FormItemContext =
|
|
21735
|
-
var FormItem =
|
|
21736
|
-
const id =
|
|
21737
|
-
return /* @__PURE__ */ (0,
|
|
20075
|
+
var FormItemContext = React60.createContext({});
|
|
20076
|
+
var FormItem = React60.forwardRef(({ className, ...props }, ref) => {
|
|
20077
|
+
const id = React60.useId();
|
|
20078
|
+
return /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(FormItemContext.Provider, { value: { id }, children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("div", { ref, className: cn("space-y-2", className), ...props }) });
|
|
21738
20079
|
});
|
|
21739
20080
|
FormItem.displayName = "FormItem";
|
|
21740
|
-
var FormLabel =
|
|
20081
|
+
var FormLabel = React60.forwardRef(
|
|
21741
20082
|
({ className, children, required, ...props }, ref) => {
|
|
21742
20083
|
const { error, formItemId } = useFormField();
|
|
21743
|
-
const config =
|
|
20084
|
+
const config = React60.useContext(FormConfigContext);
|
|
21744
20085
|
const sizeClass = config.size === "sm" ? "text-xs" : config.size === "lg" ? "text-base" : "text-sm";
|
|
21745
|
-
return /* @__PURE__ */ (0,
|
|
20086
|
+
return /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(Label, { ref, className: cn(sizeClass, error && "text-destructive", className), htmlFor: formItemId, ...props, children: [
|
|
21746
20087
|
children,
|
|
21747
|
-
required && /* @__PURE__ */ (0,
|
|
20088
|
+
required && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("span", { className: "text-destructive ml-1", children: "*" })
|
|
21748
20089
|
] });
|
|
21749
20090
|
}
|
|
21750
20091
|
);
|
|
21751
20092
|
FormLabel.displayName = "FormLabel";
|
|
21752
|
-
var FormControl =
|
|
20093
|
+
var FormControl = React60.forwardRef(({ ...props }, ref) => {
|
|
21753
20094
|
const { error, formItemId, formDescriptionId, formMessageId } = useFormField();
|
|
21754
|
-
return /* @__PURE__ */ (0,
|
|
20095
|
+
return /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
21755
20096
|
"div",
|
|
21756
20097
|
{
|
|
21757
20098
|
ref,
|
|
@@ -21763,37 +20104,37 @@ var FormControl = React69.forwardRef(({ ...props }, ref) => {
|
|
|
21763
20104
|
);
|
|
21764
20105
|
});
|
|
21765
20106
|
FormControl.displayName = "FormControl";
|
|
21766
|
-
var FormDescription =
|
|
20107
|
+
var FormDescription = React60.forwardRef(({ className, ...props }, ref) => {
|
|
21767
20108
|
const { formDescriptionId } = useFormField();
|
|
21768
|
-
return /* @__PURE__ */ (0,
|
|
20109
|
+
return /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("p", { ref, id: formDescriptionId, className: cn("text-sm text-muted-foreground", className), ...props });
|
|
21769
20110
|
});
|
|
21770
20111
|
FormDescription.displayName = "FormDescription";
|
|
21771
|
-
var FormMessage =
|
|
20112
|
+
var FormMessage = React60.forwardRef(({ className, children, ...props }, ref) => {
|
|
21772
20113
|
const { error, formMessageId } = useFormField();
|
|
21773
20114
|
const body = error ? String(error?.message) : children;
|
|
21774
20115
|
if (!body) {
|
|
21775
20116
|
return null;
|
|
21776
20117
|
}
|
|
21777
|
-
return /* @__PURE__ */ (0,
|
|
20118
|
+
return /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("p", { ref, id: formMessageId, className: cn("text-sm font-medium text-destructive", className), ...props, children: body });
|
|
21778
20119
|
});
|
|
21779
20120
|
FormMessage.displayName = "FormMessage";
|
|
21780
|
-
var FormInput =
|
|
20121
|
+
var FormInput = React60.forwardRef(({ name, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(FormConfigContext.Consumer, { children: ({ size }) => /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
21781
20122
|
FormField,
|
|
21782
20123
|
{
|
|
21783
20124
|
name,
|
|
21784
|
-
render: ({ field }) => /* @__PURE__ */ (0,
|
|
21785
|
-
/* @__PURE__ */ (0,
|
|
21786
|
-
/* @__PURE__ */ (0,
|
|
20125
|
+
render: ({ field }) => /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(FormItem, { children: [
|
|
20126
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(FormControl, { children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(Input_default, { size: props.size ?? size, ...field, ...props }) }),
|
|
20127
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(FormMessage, {})
|
|
21787
20128
|
] })
|
|
21788
20129
|
}
|
|
21789
20130
|
) }));
|
|
21790
20131
|
FormInput.displayName = "FormInput";
|
|
21791
|
-
var FormCheckbox =
|
|
20132
|
+
var FormCheckbox = React60.forwardRef(({ name, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(FormConfigContext.Consumer, { children: ({ size }) => /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
21792
20133
|
FormField,
|
|
21793
20134
|
{
|
|
21794
20135
|
name,
|
|
21795
|
-
render: ({ field }) => /* @__PURE__ */ (0,
|
|
21796
|
-
/* @__PURE__ */ (0,
|
|
20136
|
+
render: ({ field }) => /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(FormItem, { children: [
|
|
20137
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(FormControl, { children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
|
|
21797
20138
|
Checkbox,
|
|
21798
20139
|
{
|
|
21799
20140
|
ref,
|
|
@@ -21807,21 +20148,21 @@ var FormCheckbox = React69.forwardRef(({ name, ...props }, ref) => /* @__PURE__
|
|
|
21807
20148
|
...props
|
|
21808
20149
|
}
|
|
21809
20150
|
) }),
|
|
21810
|
-
/* @__PURE__ */ (0,
|
|
20151
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(FormMessage, {})
|
|
21811
20152
|
] })
|
|
21812
20153
|
}
|
|
21813
20154
|
) }));
|
|
21814
20155
|
FormCheckbox.displayName = "FormCheckbox";
|
|
21815
|
-
var FormActions =
|
|
20156
|
+
var FormActions = React60.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("div", { ref, className: cn("flex gap-2 justify-end", className), ...props }));
|
|
21816
20157
|
FormActions.displayName = "FormActions";
|
|
21817
|
-
var FormSubmitButton =
|
|
21818
|
-
({ children, loading: loading2, ...props }, ref) => /* @__PURE__ */ (0,
|
|
20158
|
+
var FormSubmitButton = React60.forwardRef(
|
|
20159
|
+
({ children, loading: loading2, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(FormConfigContext.Consumer, { children: ({ size }) => /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(Button_default, { ref, type: "submit", size: props.size ?? size, disabled: loading2, ...props, children }) })
|
|
21819
20160
|
);
|
|
21820
20161
|
FormSubmitButton.displayName = "FormSubmitButton";
|
|
21821
20162
|
|
|
21822
20163
|
// src/components/NotificationModal.tsx
|
|
21823
20164
|
var import_lucide_react35 = require("lucide-react");
|
|
21824
|
-
var
|
|
20165
|
+
var import_jsx_runtime66 = require("react/jsx-runtime");
|
|
21825
20166
|
function NotificationModal({ isOpen, onClose, notification, titleText, openLinkText, closeText }) {
|
|
21826
20167
|
const t = useSmartTranslations("Common");
|
|
21827
20168
|
if (!notification) return null;
|
|
@@ -21842,20 +20183,20 @@ function NotificationModal({ isOpen, onClose, notification, titleText, openLinkT
|
|
|
21842
20183
|
onClose();
|
|
21843
20184
|
}
|
|
21844
20185
|
};
|
|
21845
|
-
return /* @__PURE__ */ (0,
|
|
21846
|
-
/* @__PURE__ */ (0,
|
|
21847
|
-
/* @__PURE__ */ (0,
|
|
21848
|
-
/* @__PURE__ */ (0,
|
|
20186
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Modal_default, { isOpen, onClose, title: titleText || t("notifications"), size: "md", children: /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { className: "space-y-4", children: [
|
|
20187
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { className: "flex items-center gap-2 pb-2 border-b border-border/50", children: [
|
|
20188
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)("div", { className: cn("w-2 h-2 rounded-full", !notification.is_read ? "bg-primary" : "bg-border") }),
|
|
20189
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)("span", { className: "text-xs text-muted-foreground", children: !notification.is_read ? t("newNotification") : t("readStatus") })
|
|
21849
20190
|
] }),
|
|
21850
|
-
notification.title && /* @__PURE__ */ (0,
|
|
21851
|
-
notification.body && /* @__PURE__ */ (0,
|
|
21852
|
-
/* @__PURE__ */ (0,
|
|
21853
|
-
/* @__PURE__ */ (0,
|
|
21854
|
-
hasLink && /* @__PURE__ */ (0,
|
|
21855
|
-
/* @__PURE__ */ (0,
|
|
20191
|
+
notification.title && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("h3", { className: "text-lg font-semibold text-foreground", children: notification.title }),
|
|
20192
|
+
notification.body && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("div", { className: "text-sm text-muted-foreground whitespace-pre-wrap leading-relaxed", children: notification.body }),
|
|
20193
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)("div", { className: "text-xs text-muted-foreground border-t border-border/50 pt-2", children: formatTime3(notification.created_at) }),
|
|
20194
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { className: "flex gap-2 justify-end pt-2", children: [
|
|
20195
|
+
hasLink && /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(Button_default, { variant: "primary", size: "sm", onClick: handleLinkClick, className: "gap-2", children: [
|
|
20196
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)(import_lucide_react35.ExternalLink, { className: "w-4 h-4" }),
|
|
21856
20197
|
openLinkText || t("openLink")
|
|
21857
20198
|
] }),
|
|
21858
|
-
/* @__PURE__ */ (0,
|
|
20199
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)(Button_default, { variant: "ghost", size: "sm", onClick: onClose, children: closeText || t("close") })
|
|
21859
20200
|
] })
|
|
21860
20201
|
] }) });
|
|
21861
20202
|
}
|
|
@@ -21863,7 +20204,7 @@ var NotificationModal_default = NotificationModal;
|
|
|
21863
20204
|
|
|
21864
20205
|
// src/components/AccessDenied.tsx
|
|
21865
20206
|
var import_lucide_react36 = require("lucide-react");
|
|
21866
|
-
var
|
|
20207
|
+
var import_jsx_runtime67 = require("react/jsx-runtime");
|
|
21867
20208
|
var VARIANT_STYLES = {
|
|
21868
20209
|
destructive: { bg: "bg-destructive/5", border: "border-destructive/20", text: "text-destructive" },
|
|
21869
20210
|
warning: { bg: "bg-warning/5", border: "border-warning/20", text: "text-warning" },
|
|
@@ -21884,32 +20225,32 @@ function AccessDenied({
|
|
|
21884
20225
|
}) {
|
|
21885
20226
|
const styles = VARIANT_STYLES[variant];
|
|
21886
20227
|
const UsedIcon = Icon || DEFAULT_ICONS[variant];
|
|
21887
|
-
return /* @__PURE__ */ (0,
|
|
21888
|
-
/* @__PURE__ */ (0,
|
|
21889
|
-
/* @__PURE__ */ (0,
|
|
21890
|
-
/* @__PURE__ */ (0,
|
|
21891
|
-
/* @__PURE__ */ (0,
|
|
20228
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Card_default, { className: cn("p-8 text-center shadow-sm", styles.bg, styles.border, className), children: /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { className: "flex flex-col items-center gap-4", children: [
|
|
20229
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)("div", { className: cn("p-3 rounded-lg", styles.bg.replace("/5", "/10")), children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(UsedIcon, { className: cn("w-8 h-8", styles.text) }) }),
|
|
20230
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsxs)("div", { children: [
|
|
20231
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)("h3", { className: cn("font-semibold mb-2", styles.text), children: title }),
|
|
20232
|
+
/* @__PURE__ */ (0, import_jsx_runtime67.jsx)("p", { className: cn(styles.text.replace("text-", "text-") + "/80", "text-sm"), children: description })
|
|
21892
20233
|
] }),
|
|
21893
|
-
children && /* @__PURE__ */ (0,
|
|
20234
|
+
children && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("div", { className: "mt-2 flex flex-wrap gap-2 justify-center", children })
|
|
21894
20235
|
] }) });
|
|
21895
20236
|
}
|
|
21896
20237
|
|
|
21897
20238
|
// src/components/ThemeToggleHeadless.tsx
|
|
21898
20239
|
var import_lucide_react37 = require("lucide-react");
|
|
21899
|
-
var
|
|
21900
|
-
var
|
|
21901
|
-
var
|
|
20240
|
+
var import_react37 = require("react");
|
|
20241
|
+
var import_react_dom6 = require("react-dom");
|
|
20242
|
+
var import_jsx_runtime68 = require("react/jsx-runtime");
|
|
21902
20243
|
function ThemeToggleHeadless({
|
|
21903
20244
|
theme,
|
|
21904
20245
|
onChange,
|
|
21905
20246
|
labels,
|
|
21906
20247
|
className
|
|
21907
20248
|
}) {
|
|
21908
|
-
const [isOpen, setIsOpen] = (0,
|
|
21909
|
-
const [mounted, setMounted] = (0,
|
|
21910
|
-
const triggerRef = (0,
|
|
21911
|
-
const [dropdownPosition, setDropdownPosition] = (0,
|
|
21912
|
-
(0,
|
|
20249
|
+
const [isOpen, setIsOpen] = (0, import_react37.useState)(false);
|
|
20250
|
+
const [mounted, setMounted] = (0, import_react37.useState)(false);
|
|
20251
|
+
const triggerRef = (0, import_react37.useRef)(null);
|
|
20252
|
+
const [dropdownPosition, setDropdownPosition] = (0, import_react37.useState)(null);
|
|
20253
|
+
(0, import_react37.useEffect)(() => setMounted(true), []);
|
|
21913
20254
|
const themes = [
|
|
21914
20255
|
{ value: "light", label: labels?.light ?? "Light", icon: import_lucide_react37.Sun },
|
|
21915
20256
|
{ value: "dark", label: labels?.dark ?? "Dark", icon: import_lucide_react37.Moon },
|
|
@@ -21927,8 +20268,8 @@ function ThemeToggleHeadless({
|
|
|
21927
20268
|
const top = rect.bottom + scrollTop + 8;
|
|
21928
20269
|
return { top, left, width };
|
|
21929
20270
|
};
|
|
21930
|
-
return /* @__PURE__ */ (0,
|
|
21931
|
-
/* @__PURE__ */ (0,
|
|
20271
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("div", { className: cn("relative", className), children: [
|
|
20272
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
21932
20273
|
Button_default,
|
|
21933
20274
|
{
|
|
21934
20275
|
variant: "ghost",
|
|
@@ -21946,25 +20287,25 @@ function ThemeToggleHeadless({
|
|
|
21946
20287
|
"aria-haspopup": "menu",
|
|
21947
20288
|
"aria-expanded": isOpen,
|
|
21948
20289
|
"aria-label": labels?.heading ?? "Theme",
|
|
21949
|
-
children: /* @__PURE__ */ (0,
|
|
20290
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(CurrentIcon, { className: "h-5 w-5" })
|
|
21950
20291
|
}
|
|
21951
20292
|
),
|
|
21952
|
-
isOpen && /* @__PURE__ */ (0,
|
|
21953
|
-
typeof window !== "undefined" && (0,
|
|
21954
|
-
typeof window !== "undefined" && dropdownPosition && (0,
|
|
21955
|
-
/* @__PURE__ */ (0,
|
|
20293
|
+
isOpen && /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)(import_jsx_runtime68.Fragment, { children: [
|
|
20294
|
+
typeof window !== "undefined" && (0, import_react_dom6.createPortal)(/* @__PURE__ */ (0, import_jsx_runtime68.jsx)("div", { className: "fixed inset-0 z-9998", onClick: () => setIsOpen(false) }), document.body),
|
|
20295
|
+
typeof window !== "undefined" && dropdownPosition && (0, import_react_dom6.createPortal)(
|
|
20296
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
21956
20297
|
"div",
|
|
21957
20298
|
{
|
|
21958
20299
|
className: "z-9999 bg-card border border-border/50 rounded-lg shadow-lg overflow-hidden",
|
|
21959
20300
|
style: { position: "absolute", top: dropdownPosition.top, left: dropdownPosition.left, width: dropdownPosition.width },
|
|
21960
20301
|
onMouseDown: (e) => e.stopPropagation(),
|
|
21961
20302
|
role: "menu",
|
|
21962
|
-
children: /* @__PURE__ */ (0,
|
|
21963
|
-
/* @__PURE__ */ (0,
|
|
20303
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("div", { className: "p-2", children: [
|
|
20304
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)("div", { className: "px-3 py-2 text-sm font-medium text-muted-foreground border-b border-border/50 mb-2", children: labels?.heading ?? "Theme" }),
|
|
21964
20305
|
themes.map((opt) => {
|
|
21965
20306
|
const Icon = opt.icon;
|
|
21966
20307
|
const active = theme === opt.value;
|
|
21967
|
-
return /* @__PURE__ */ (0,
|
|
20308
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)(
|
|
21968
20309
|
Button_default,
|
|
21969
20310
|
{
|
|
21970
20311
|
variant: "ghost",
|
|
@@ -21980,9 +20321,9 @@ function ThemeToggleHeadless({
|
|
|
21980
20321
|
role: "menuitemradio",
|
|
21981
20322
|
"aria-checked": active,
|
|
21982
20323
|
children: [
|
|
21983
|
-
/* @__PURE__ */ (0,
|
|
21984
|
-
/* @__PURE__ */ (0,
|
|
21985
|
-
active && /* @__PURE__ */ (0,
|
|
20324
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)(Icon, { className: "h-4 w-4" }),
|
|
20325
|
+
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)("span", { className: "flex-1 text-left", children: opt.label }),
|
|
20326
|
+
active && /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("div", { className: "w-2 h-2 rounded-full bg-primary" })
|
|
21986
20327
|
]
|
|
21987
20328
|
},
|
|
21988
20329
|
opt.value
|
|
@@ -21998,10 +20339,10 @@ function ThemeToggleHeadless({
|
|
|
21998
20339
|
}
|
|
21999
20340
|
|
|
22000
20341
|
// src/components/LanguageSwitcherHeadless.tsx
|
|
22001
|
-
var
|
|
22002
|
-
var
|
|
20342
|
+
var import_react38 = require("react");
|
|
20343
|
+
var import_react_dom7 = require("react-dom");
|
|
22003
20344
|
var import_lucide_react38 = require("lucide-react");
|
|
22004
|
-
var
|
|
20345
|
+
var import_jsx_runtime69 = require("react/jsx-runtime");
|
|
22005
20346
|
function LanguageSwitcherHeadless({
|
|
22006
20347
|
locales,
|
|
22007
20348
|
currentLocale,
|
|
@@ -22009,9 +20350,9 @@ function LanguageSwitcherHeadless({
|
|
|
22009
20350
|
labels,
|
|
22010
20351
|
className
|
|
22011
20352
|
}) {
|
|
22012
|
-
const [isOpen, setIsOpen] = (0,
|
|
22013
|
-
const [dropdownPosition, setDropdownPosition] = (0,
|
|
22014
|
-
const triggerButtonRef = (0,
|
|
20353
|
+
const [isOpen, setIsOpen] = (0, import_react38.useState)(false);
|
|
20354
|
+
const [dropdownPosition, setDropdownPosition] = (0, import_react38.useState)(null);
|
|
20355
|
+
const triggerButtonRef = (0, import_react38.useRef)(null);
|
|
22015
20356
|
const currentLanguage = locales.find((l) => l.code === currentLocale) || locales[0];
|
|
22016
20357
|
const calculatePosition = () => {
|
|
22017
20358
|
const rect = triggerButtonRef.current?.getBoundingClientRect();
|
|
@@ -22023,8 +20364,8 @@ function LanguageSwitcherHeadless({
|
|
|
22023
20364
|
const top = rect.bottom + scrollTop + 8;
|
|
22024
20365
|
return { top, left, width };
|
|
22025
20366
|
};
|
|
22026
|
-
return /* @__PURE__ */ (0,
|
|
22027
|
-
/* @__PURE__ */ (0,
|
|
20367
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("div", { className: cn("relative", className), children: [
|
|
20368
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
22028
20369
|
Button_default,
|
|
22029
20370
|
{
|
|
22030
20371
|
variant: "ghost",
|
|
@@ -22043,22 +20384,22 @@ function LanguageSwitcherHeadless({
|
|
|
22043
20384
|
"aria-expanded": isOpen,
|
|
22044
20385
|
"aria-label": labels?.heading ?? "Language",
|
|
22045
20386
|
title: labels?.heading ?? "Language",
|
|
22046
|
-
children: /* @__PURE__ */ (0,
|
|
20387
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(import_lucide_react38.Globe, { className: "h-5 w-5" })
|
|
22047
20388
|
}
|
|
22048
20389
|
),
|
|
22049
|
-
isOpen && /* @__PURE__ */ (0,
|
|
22050
|
-
typeof window !== "undefined" && (0,
|
|
22051
|
-
typeof window !== "undefined" && dropdownPosition && (0,
|
|
22052
|
-
/* @__PURE__ */ (0,
|
|
20390
|
+
isOpen && /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(import_jsx_runtime69.Fragment, { children: [
|
|
20391
|
+
typeof window !== "undefined" && (0, import_react_dom7.createPortal)(/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("div", { className: "fixed inset-0 z-9998", onClick: () => setIsOpen(false) }), document.body),
|
|
20392
|
+
typeof window !== "undefined" && dropdownPosition && (0, import_react_dom7.createPortal)(
|
|
20393
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
22053
20394
|
"div",
|
|
22054
20395
|
{
|
|
22055
20396
|
className: "z-9999 bg-card border border-border/50 rounded-lg shadow-lg overflow-hidden",
|
|
22056
20397
|
style: { position: "absolute", top: dropdownPosition.top, left: dropdownPosition.left, width: dropdownPosition.width },
|
|
22057
20398
|
onMouseDown: (e) => e.stopPropagation(),
|
|
22058
20399
|
role: "menu",
|
|
22059
|
-
children: /* @__PURE__ */ (0,
|
|
22060
|
-
/* @__PURE__ */ (0,
|
|
22061
|
-
locales.map((language) => /* @__PURE__ */ (0,
|
|
20400
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)("div", { className: "p-2", children: [
|
|
20401
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("div", { className: "px-3 py-2 text-sm font-medium text-muted-foreground border-b border-border/50 mb-2", children: labels?.heading ?? "Language" }),
|
|
20402
|
+
locales.map((language) => /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(
|
|
22062
20403
|
Button_default,
|
|
22063
20404
|
{
|
|
22064
20405
|
variant: "ghost",
|
|
@@ -22071,9 +20412,9 @@ function LanguageSwitcherHeadless({
|
|
|
22071
20412
|
role: "menuitemradio",
|
|
22072
20413
|
"aria-checked": currentLocale === language.code,
|
|
22073
20414
|
children: [
|
|
22074
|
-
language.flag && /* @__PURE__ */ (0,
|
|
22075
|
-
/* @__PURE__ */ (0,
|
|
22076
|
-
currentLocale === language.code && /* @__PURE__ */ (0,
|
|
20415
|
+
language.flag && /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("span", { className: "text-lg", children: language.flag }),
|
|
20416
|
+
/* @__PURE__ */ (0, import_jsx_runtime69.jsx)("span", { className: "flex-1 text-left", children: language.name }),
|
|
20417
|
+
currentLocale === language.code && /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("div", { className: "w-2 h-2 rounded-full bg-primary" })
|
|
22077
20418
|
]
|
|
22078
20419
|
},
|
|
22079
20420
|
language.code
|
|
@@ -22105,8 +20446,8 @@ var VARIANT_STYLES_ALERT = {
|
|
|
22105
20446
|
};
|
|
22106
20447
|
|
|
22107
20448
|
// ../../lib/i18n/translation-adapter.tsx
|
|
22108
|
-
var
|
|
22109
|
-
var
|
|
20449
|
+
var React62 = __toESM(require("react"), 1);
|
|
20450
|
+
var import_jsx_runtime70 = require("react/jsx-runtime");
|
|
22110
20451
|
var defaultTranslations2 = {
|
|
22111
20452
|
en: {
|
|
22112
20453
|
Common: {
|
|
@@ -22470,9 +20811,9 @@ function resolveTranslationValue2(translations, namespace, key) {
|
|
|
22470
20811
|
const value = resolveObjectPath2(namespaceValue, key);
|
|
22471
20812
|
return typeof value === "string" ? value : null;
|
|
22472
20813
|
}
|
|
22473
|
-
var TranslationContext2 =
|
|
20814
|
+
var TranslationContext2 = React62.createContext(null);
|
|
22474
20815
|
var UnderverseProvider = ({ children, locale = "en", translations }) => {
|
|
22475
|
-
const t =
|
|
20816
|
+
const t = React62.useCallback(
|
|
22476
20817
|
(namespace) => {
|
|
22477
20818
|
return (key) => {
|
|
22478
20819
|
const mergedTranslations = {
|
|
@@ -22484,7 +20825,7 @@ var UnderverseProvider = ({ children, locale = "en", translations }) => {
|
|
|
22484
20825
|
},
|
|
22485
20826
|
[locale, translations]
|
|
22486
20827
|
);
|
|
22487
|
-
return /* @__PURE__ */ (0,
|
|
20828
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(TranslationContext2.Provider, { value: { locale, t }, children });
|
|
22488
20829
|
};
|
|
22489
20830
|
var nextIntlAvailable = false;
|
|
22490
20831
|
var nextIntlUseTranslations = null;
|
|
@@ -22513,7 +20854,7 @@ function getInternalTranslation(namespace, locale) {
|
|
|
22513
20854
|
};
|
|
22514
20855
|
}
|
|
22515
20856
|
function useTranslations(namespace) {
|
|
22516
|
-
const underverseContext =
|
|
20857
|
+
const underverseContext = React62.useContext(TranslationContext2);
|
|
22517
20858
|
if (underverseContext) {
|
|
22518
20859
|
return (key, params) => {
|
|
22519
20860
|
const result = underverseContext.t(namespace)(key);
|
|
@@ -22530,7 +20871,7 @@ function useTranslations(namespace) {
|
|
|
22530
20871
|
return getInternalTranslation(namespace, "en");
|
|
22531
20872
|
}
|
|
22532
20873
|
function useLocale() {
|
|
22533
|
-
const underverseContext =
|
|
20874
|
+
const underverseContext = React62.useContext(TranslationContext2);
|
|
22534
20875
|
if (underverseContext) {
|
|
22535
20876
|
return underverseContext.locale;
|
|
22536
20877
|
}
|
|
@@ -22549,8 +20890,8 @@ function useLocale() {
|
|
|
22549
20890
|
}
|
|
22550
20891
|
|
|
22551
20892
|
// src/components/UEditor/UEditor.tsx
|
|
22552
|
-
var
|
|
22553
|
-
var
|
|
20893
|
+
var import_react50 = __toESM(require("react"), 1);
|
|
20894
|
+
var import_react51 = require("@tiptap/react");
|
|
22554
20895
|
|
|
22555
20896
|
// src/components/UEditor/extensions.ts
|
|
22556
20897
|
var import_extension_document = __toESM(require("@tiptap/extension-document"), 1);
|
|
@@ -22589,11 +20930,11 @@ var import_lowlight = require("lowlight");
|
|
|
22589
20930
|
// src/components/UEditor/slash-command.tsx
|
|
22590
20931
|
var import_core = require("@tiptap/core");
|
|
22591
20932
|
var import_suggestion = __toESM(require("@tiptap/suggestion"), 1);
|
|
22592
|
-
var
|
|
22593
|
-
var
|
|
20933
|
+
var import_react39 = require("@tiptap/react");
|
|
20934
|
+
var import_react40 = require("react");
|
|
22594
20935
|
var import_lucide_react39 = require("lucide-react");
|
|
22595
20936
|
var import_tippy = __toESM(require("tippy.js"), 1);
|
|
22596
|
-
var
|
|
20937
|
+
var import_jsx_runtime71 = require("react/jsx-runtime");
|
|
22597
20938
|
var DEFAULT_MESSAGES = {
|
|
22598
20939
|
noResults: "No results",
|
|
22599
20940
|
basicBlocks: "Basic Blocks",
|
|
@@ -22620,17 +20961,17 @@ var DEFAULT_MESSAGES = {
|
|
|
22620
20961
|
table: "Table",
|
|
22621
20962
|
tableDesc: "Insert a table"
|
|
22622
20963
|
};
|
|
22623
|
-
var CommandList = (0,
|
|
22624
|
-
const [selectedIndex, setSelectedIndex] = (0,
|
|
22625
|
-
const listRef = (0,
|
|
22626
|
-
(0,
|
|
20964
|
+
var CommandList = (0, import_react40.forwardRef)((props, ref) => {
|
|
20965
|
+
const [selectedIndex, setSelectedIndex] = (0, import_react40.useState)(0);
|
|
20966
|
+
const listRef = (0, import_react40.useRef)(null);
|
|
20967
|
+
(0, import_react40.useEffect)(() => {
|
|
22627
20968
|
setSelectedIndex(0);
|
|
22628
20969
|
}, [props.items]);
|
|
22629
|
-
(0,
|
|
20970
|
+
(0, import_react40.useEffect)(() => {
|
|
22630
20971
|
const selectedElement = listRef.current?.querySelector(`[data-index="${selectedIndex}"]`);
|
|
22631
20972
|
selectedElement?.scrollIntoView({ block: "nearest" });
|
|
22632
20973
|
}, [selectedIndex, props.items]);
|
|
22633
|
-
(0,
|
|
20974
|
+
(0, import_react40.useImperativeHandle)(ref, () => ({
|
|
22634
20975
|
onKeyDown: ({ event }) => {
|
|
22635
20976
|
if (event.key === "ArrowUp") {
|
|
22636
20977
|
setSelectedIndex((prev) => (prev + props.items.length - 1) % props.items.length);
|
|
@@ -22651,11 +20992,11 @@ var CommandList = (0, import_react48.forwardRef)((props, ref) => {
|
|
|
22651
20992
|
}
|
|
22652
20993
|
}));
|
|
22653
20994
|
if (props.items.length === 0) {
|
|
22654
|
-
return /* @__PURE__ */ (0,
|
|
20995
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("div", { className: "w-72 p-4 text-center text-sm text-muted-foreground", children: props.messages.noResults });
|
|
22655
20996
|
}
|
|
22656
|
-
return /* @__PURE__ */ (0,
|
|
22657
|
-
/* @__PURE__ */ (0,
|
|
22658
|
-
/* @__PURE__ */ (0,
|
|
20997
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { ref: listRef, className: "w-72 max-h-80 overflow-y-auto bg-card border border-border/50 rounded-2xl shadow-lg", children: [
|
|
20998
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)("div", { className: "px-3 py-2 border-b", children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("span", { className: "text-xs font-semibold text-muted-foreground uppercase tracking-wider", children: props.messages.basicBlocks }) }),
|
|
20999
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)("div", { className: "p-1", children: props.items.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(
|
|
22659
21000
|
"button",
|
|
22660
21001
|
{
|
|
22661
21002
|
type: "button",
|
|
@@ -22666,19 +21007,19 @@ var CommandList = (0, import_react48.forwardRef)((props, ref) => {
|
|
|
22666
21007
|
selectedIndex === index ? "bg-accent" : "hover:bg-accent/50"
|
|
22667
21008
|
),
|
|
22668
21009
|
children: [
|
|
22669
|
-
/* @__PURE__ */ (0,
|
|
21010
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
22670
21011
|
"div",
|
|
22671
21012
|
{
|
|
22672
21013
|
className: cn(
|
|
22673
21014
|
"flex items-center justify-center w-10 h-10 rounded-lg mr-3 transition-colors",
|
|
22674
21015
|
selectedIndex === index ? "bg-primary/10" : "bg-muted/50 group-hover:bg-muted"
|
|
22675
21016
|
),
|
|
22676
|
-
children: /* @__PURE__ */ (0,
|
|
21017
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(item.icon, { className: cn("w-5 h-5", selectedIndex === index ? "text-primary" : "text-muted-foreground") })
|
|
22677
21018
|
}
|
|
22678
21019
|
),
|
|
22679
|
-
/* @__PURE__ */ (0,
|
|
22680
|
-
/* @__PURE__ */ (0,
|
|
22681
|
-
/* @__PURE__ */ (0,
|
|
21020
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: "text-left", children: [
|
|
21021
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)("div", { className: cn("text-sm font-medium", selectedIndex === index && "text-primary"), children: item.title }),
|
|
21022
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)("div", { className: "text-xs text-muted-foreground", children: item.description })
|
|
22682
21023
|
] })
|
|
22683
21024
|
]
|
|
22684
21025
|
},
|
|
@@ -22801,7 +21142,7 @@ var SlashCommand = import_core.Extension.create({
|
|
|
22801
21142
|
let popup;
|
|
22802
21143
|
return {
|
|
22803
21144
|
onStart: (props) => {
|
|
22804
|
-
component = new
|
|
21145
|
+
component = new import_react39.ReactRenderer(CommandList, {
|
|
22805
21146
|
props: {
|
|
22806
21147
|
...props,
|
|
22807
21148
|
messages
|
|
@@ -22949,9 +21290,9 @@ var ClipboardImages = import_core2.Extension.create({
|
|
|
22949
21290
|
// src/components/UEditor/emoji-suggestion.tsx
|
|
22950
21291
|
var import_core3 = require("@tiptap/core");
|
|
22951
21292
|
var import_suggestion2 = __toESM(require("@tiptap/suggestion"), 1);
|
|
22952
|
-
var
|
|
21293
|
+
var import_react41 = require("@tiptap/react");
|
|
22953
21294
|
var import_state2 = require("@tiptap/pm/state");
|
|
22954
|
-
var
|
|
21295
|
+
var import_react42 = require("react");
|
|
22955
21296
|
var import_lucide_react40 = require("lucide-react");
|
|
22956
21297
|
var import_tippy2 = __toESM(require("tippy.js"), 1);
|
|
22957
21298
|
|
|
@@ -23721,13 +22062,13 @@ var EMOJI_LIST = [
|
|
|
23721
22062
|
];
|
|
23722
22063
|
|
|
23723
22064
|
// src/components/UEditor/emoji-suggestion.tsx
|
|
23724
|
-
var
|
|
23725
|
-
var EmojiList = (0,
|
|
23726
|
-
const [selectedIndex, setSelectedIndex] = (0,
|
|
23727
|
-
(0,
|
|
22065
|
+
var import_jsx_runtime72 = require("react/jsx-runtime");
|
|
22066
|
+
var EmojiList = (0, import_react42.forwardRef)((props, ref) => {
|
|
22067
|
+
const [selectedIndex, setSelectedIndex] = (0, import_react42.useState)(0);
|
|
22068
|
+
(0, import_react42.useEffect)(() => {
|
|
23728
22069
|
setSelectedIndex(0);
|
|
23729
22070
|
}, [props.items]);
|
|
23730
|
-
(0,
|
|
22071
|
+
(0, import_react42.useImperativeHandle)(ref, () => ({
|
|
23731
22072
|
onKeyDown: ({ event }) => {
|
|
23732
22073
|
if (event.key === "ArrowUp") {
|
|
23733
22074
|
setSelectedIndex((prev) => (prev + props.items.length - 1) % props.items.length);
|
|
@@ -23756,15 +22097,15 @@ var EmojiList = (0, import_react50.forwardRef)((props, ref) => {
|
|
|
23756
22097
|
}
|
|
23757
22098
|
}));
|
|
23758
22099
|
if (props.items.length === 0) {
|
|
23759
|
-
return /* @__PURE__ */ (0,
|
|
22100
|
+
return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { className: "w-80 p-4 text-center text-sm text-muted-foreground bg-card border border-border/50 rounded-2xl shadow-lg", children: "No emoji found" });
|
|
23760
22101
|
}
|
|
23761
|
-
return /* @__PURE__ */ (0,
|
|
23762
|
-
/* @__PURE__ */ (0,
|
|
23763
|
-
/* @__PURE__ */ (0,
|
|
23764
|
-
/* @__PURE__ */ (0,
|
|
22102
|
+
return /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { className: "w-80 max-h-80 overflow-y-auto bg-card border border-border/50 rounded-2xl shadow-lg", children: [
|
|
22103
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { className: "px-3 py-2 border-b bg-muted/30", children: /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
22104
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(import_lucide_react40.Smile, { className: "w-4 h-4 text-primary" }),
|
|
22105
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)("span", { className: "text-xs font-semibold text-muted-foreground uppercase tracking-wider", children: "Emoji" })
|
|
23765
22106
|
] }) }),
|
|
23766
|
-
/* @__PURE__ */ (0,
|
|
23767
|
-
/* @__PURE__ */ (0,
|
|
22107
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { className: "p-3", children: [
|
|
22108
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { className: "grid grid-cols-8 gap-1", children: props.items.slice(0, 64).map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
23768
22109
|
"button",
|
|
23769
22110
|
{
|
|
23770
22111
|
type: "button",
|
|
@@ -23778,7 +22119,7 @@ var EmojiList = (0, import_react50.forwardRef)((props, ref) => {
|
|
|
23778
22119
|
},
|
|
23779
22120
|
item.name
|
|
23780
22121
|
)) }),
|
|
23781
|
-
props.items.length > 64 && /* @__PURE__ */ (0,
|
|
22122
|
+
props.items.length > 64 && /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { className: "mt-2 text-xs text-center text-muted-foreground", children: [
|
|
23782
22123
|
"Showing first 64 of ",
|
|
23783
22124
|
props.items.length,
|
|
23784
22125
|
" emojis"
|
|
@@ -23814,7 +22155,7 @@ var EmojiSuggestion = import_core3.Extension.create({
|
|
|
23814
22155
|
let popup;
|
|
23815
22156
|
return {
|
|
23816
22157
|
onStart: (props) => {
|
|
23817
|
-
component = new
|
|
22158
|
+
component = new import_react41.ReactRenderer(EmojiList, {
|
|
23818
22159
|
props,
|
|
23819
22160
|
editor: props.editor
|
|
23820
22161
|
});
|
|
@@ -23932,11 +22273,11 @@ var UEditorPlaceholder = import_core4.Extension.create({
|
|
|
23932
22273
|
});
|
|
23933
22274
|
|
|
23934
22275
|
// src/components/UEditor/resizable-image.tsx
|
|
23935
|
-
var
|
|
22276
|
+
var import_react43 = require("react");
|
|
23936
22277
|
var import_extension_image = __toESM(require("@tiptap/extension-image"), 1);
|
|
23937
22278
|
var import_core5 = require("@tiptap/core");
|
|
23938
|
-
var
|
|
23939
|
-
var
|
|
22279
|
+
var import_react44 = require("@tiptap/react");
|
|
22280
|
+
var import_jsx_runtime73 = require("react/jsx-runtime");
|
|
23940
22281
|
var MIN_IMAGE_SIZE_PX = 40;
|
|
23941
22282
|
var AXIS_LOCK_THRESHOLD_PX = 4;
|
|
23942
22283
|
function toNullableNumber(value) {
|
|
@@ -23952,15 +22293,15 @@ function clamp8(value, min, max) {
|
|
|
23952
22293
|
}
|
|
23953
22294
|
function ResizableImageNodeView(props) {
|
|
23954
22295
|
const { node, selected, updateAttributes, editor, getPos } = props;
|
|
23955
|
-
const wrapperRef = (0,
|
|
23956
|
-
const imgRef = (0,
|
|
23957
|
-
const [isHovered, setIsHovered] = (0,
|
|
23958
|
-
const [isResizing, setIsResizing] = (0,
|
|
22296
|
+
const wrapperRef = (0, import_react43.useRef)(null);
|
|
22297
|
+
const imgRef = (0, import_react43.useRef)(null);
|
|
22298
|
+
const [isHovered, setIsHovered] = (0, import_react43.useState)(false);
|
|
22299
|
+
const [isResizing, setIsResizing] = (0, import_react43.useState)(false);
|
|
23959
22300
|
const widthAttr = toNullableNumber(node.attrs["width"]);
|
|
23960
22301
|
const heightAttr = toNullableNumber(node.attrs["height"]);
|
|
23961
22302
|
const textAlign = String(node.attrs["textAlign"] ?? "");
|
|
23962
|
-
const dragStateRef = (0,
|
|
23963
|
-
(0,
|
|
22303
|
+
const dragStateRef = (0, import_react43.useRef)(null);
|
|
22304
|
+
(0, import_react43.useEffect)(() => {
|
|
23964
22305
|
const img = imgRef.current;
|
|
23965
22306
|
if (!img) return;
|
|
23966
22307
|
img.style.width = widthAttr ? `${widthAttr}px` : "";
|
|
@@ -24054,8 +22395,8 @@ function ResizableImageNodeView(props) {
|
|
|
24054
22395
|
const showHandle = selected || isHovered || isResizing;
|
|
24055
22396
|
const wrapperAlignClass = textAlign === "center" ? "mx-auto" : textAlign === "right" ? "ml-auto" : textAlign === "justify" ? "mx-auto" : "";
|
|
24056
22397
|
const wrapperWidthClass = "w-fit";
|
|
24057
|
-
return /* @__PURE__ */ (0,
|
|
24058
|
-
|
|
22398
|
+
return /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)(
|
|
22399
|
+
import_react44.NodeViewWrapper,
|
|
24059
22400
|
{
|
|
24060
22401
|
as: "div",
|
|
24061
22402
|
ref: wrapperRef,
|
|
@@ -24068,7 +22409,7 @@ function ResizableImageNodeView(props) {
|
|
|
24068
22409
|
},
|
|
24069
22410
|
contentEditable: false,
|
|
24070
22411
|
children: [
|
|
24071
|
-
/* @__PURE__ */ (0,
|
|
22412
|
+
/* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
24072
22413
|
"img",
|
|
24073
22414
|
{
|
|
24074
22415
|
ref: imgRef,
|
|
@@ -24087,7 +22428,7 @@ function ResizableImageNodeView(props) {
|
|
|
24087
22428
|
}
|
|
24088
22429
|
}
|
|
24089
22430
|
),
|
|
24090
|
-
showHandle && /* @__PURE__ */ (0,
|
|
22431
|
+
showHandle && /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
24091
22432
|
"div",
|
|
24092
22433
|
{
|
|
24093
22434
|
"aria-hidden": "true",
|
|
@@ -24136,7 +22477,7 @@ var ResizableImage = import_extension_image.default.extend({
|
|
|
24136
22477
|
return ["img", (0, import_core5.mergeAttributes)(this.options.HTMLAttributes, HTMLAttributes)];
|
|
24137
22478
|
},
|
|
24138
22479
|
addNodeView() {
|
|
24139
|
-
return (0,
|
|
22480
|
+
return (0, import_react44.ReactNodeViewRenderer)(ResizableImageNodeView);
|
|
24140
22481
|
}
|
|
24141
22482
|
}).configure({
|
|
24142
22483
|
allowBase64: true,
|
|
@@ -24291,16 +22632,16 @@ function buildUEditorExtensions({
|
|
|
24291
22632
|
}
|
|
24292
22633
|
|
|
24293
22634
|
// src/components/UEditor/toolbar.tsx
|
|
24294
|
-
var
|
|
22635
|
+
var import_react48 = __toESM(require("react"), 1);
|
|
24295
22636
|
var import_lucide_react44 = require("lucide-react");
|
|
24296
22637
|
|
|
24297
22638
|
// src/components/UEditor/colors.tsx
|
|
24298
|
-
var
|
|
22639
|
+
var import_react45 = require("react");
|
|
24299
22640
|
var import_lucide_react41 = require("lucide-react");
|
|
24300
|
-
var
|
|
22641
|
+
var import_jsx_runtime74 = require("react/jsx-runtime");
|
|
24301
22642
|
var useEditorColors = () => {
|
|
24302
22643
|
const t = useSmartTranslations("UEditor");
|
|
24303
|
-
const textColors = (0,
|
|
22644
|
+
const textColors = (0, import_react45.useMemo)(
|
|
24304
22645
|
() => [
|
|
24305
22646
|
{ name: t("colors.default"), color: "inherit", cssClass: "text-foreground" },
|
|
24306
22647
|
{ name: t("colors.muted"), color: "var(--muted-foreground)", cssClass: "text-muted-foreground" },
|
|
@@ -24313,7 +22654,7 @@ var useEditorColors = () => {
|
|
|
24313
22654
|
],
|
|
24314
22655
|
[t]
|
|
24315
22656
|
);
|
|
24316
|
-
const highlightColors = (0,
|
|
22657
|
+
const highlightColors = (0, import_react45.useMemo)(
|
|
24317
22658
|
() => [
|
|
24318
22659
|
{ name: t("colors.default"), color: "", cssClass: "" },
|
|
24319
22660
|
{ name: t("colors.muted"), color: "var(--muted)", cssClass: "bg-muted" },
|
|
@@ -24334,9 +22675,9 @@ var EditorColorPalette = ({
|
|
|
24334
22675
|
currentColor,
|
|
24335
22676
|
onSelect,
|
|
24336
22677
|
label
|
|
24337
|
-
}) => /* @__PURE__ */ (0,
|
|
24338
|
-
/* @__PURE__ */ (0,
|
|
24339
|
-
/* @__PURE__ */ (0,
|
|
22678
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("div", { className: "p-2", children: [
|
|
22679
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)("span", { className: "text-xs font-medium text-muted-foreground uppercase tracking-wider px-2", children: label }),
|
|
22680
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { className: "grid grid-cols-4 gap-1.5 mt-2", children: colors.map((c) => /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(
|
|
24340
22681
|
"button",
|
|
24341
22682
|
{
|
|
24342
22683
|
type: "button",
|
|
@@ -24349,8 +22690,8 @@ var EditorColorPalette = ({
|
|
|
24349
22690
|
style: { backgroundColor: c.color || "transparent" },
|
|
24350
22691
|
title: c.name,
|
|
24351
22692
|
children: [
|
|
24352
|
-
c.color === "" && /* @__PURE__ */ (0,
|
|
24353
|
-
c.color === "inherit" && /* @__PURE__ */ (0,
|
|
22693
|
+
c.color === "" && /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(import_lucide_react41.X, { className: "w-4 h-4 text-muted-foreground" }),
|
|
22694
|
+
c.color === "inherit" && /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("span", { className: "text-xs font-medium", children: "A" })
|
|
24354
22695
|
]
|
|
24355
22696
|
},
|
|
24356
22697
|
c.name
|
|
@@ -24358,9 +22699,9 @@ var EditorColorPalette = ({
|
|
|
24358
22699
|
] });
|
|
24359
22700
|
|
|
24360
22701
|
// src/components/UEditor/inputs.tsx
|
|
24361
|
-
var
|
|
22702
|
+
var import_react46 = require("react");
|
|
24362
22703
|
var import_lucide_react42 = require("lucide-react");
|
|
24363
|
-
var
|
|
22704
|
+
var import_jsx_runtime75 = require("react/jsx-runtime");
|
|
24364
22705
|
function normalizeUrl(raw) {
|
|
24365
22706
|
const url = raw.trim();
|
|
24366
22707
|
if (!url) return "";
|
|
@@ -24374,9 +22715,9 @@ var LinkInput = ({
|
|
|
24374
22715
|
initialUrl = ""
|
|
24375
22716
|
}) => {
|
|
24376
22717
|
const t = useSmartTranslations("UEditor");
|
|
24377
|
-
const [url, setUrl] = (0,
|
|
24378
|
-
const inputRef = (0,
|
|
24379
|
-
(0,
|
|
22718
|
+
const [url, setUrl] = (0, import_react46.useState)(initialUrl);
|
|
22719
|
+
const inputRef = (0, import_react46.useRef)(null);
|
|
22720
|
+
(0, import_react46.useEffect)(() => {
|
|
24380
22721
|
inputRef.current?.focus();
|
|
24381
22722
|
inputRef.current?.select();
|
|
24382
22723
|
}, []);
|
|
@@ -24385,8 +22726,8 @@ var LinkInput = ({
|
|
|
24385
22726
|
const normalized = normalizeUrl(url);
|
|
24386
22727
|
if (normalized) onSubmit(normalized);
|
|
24387
22728
|
};
|
|
24388
|
-
return /* @__PURE__ */ (0,
|
|
24389
|
-
/* @__PURE__ */ (0,
|
|
22729
|
+
return /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)("form", { onSubmit: handleSubmit, className: "flex items-center gap-2 p-2", children: [
|
|
22730
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
24390
22731
|
"input",
|
|
24391
22732
|
{
|
|
24392
22733
|
ref: inputRef,
|
|
@@ -24397,16 +22738,16 @@ var LinkInput = ({
|
|
|
24397
22738
|
className: "flex-1 px-3 py-2 text-sm bg-muted/50 border-0 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary/20"
|
|
24398
22739
|
}
|
|
24399
22740
|
),
|
|
24400
|
-
/* @__PURE__ */ (0,
|
|
24401
|
-
/* @__PURE__ */ (0,
|
|
22741
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)("button", { type: "submit", className: "p-2 rounded-lg bg-primary text-primary-foreground hover:bg-primary/90 transition-colors", children: /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(import_lucide_react42.Check, { className: "w-4 h-4" }) }),
|
|
22742
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)("button", { type: "button", onClick: onCancel, className: "p-2 rounded-lg hover:bg-muted transition-colors text-muted-foreground", children: /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(import_lucide_react42.X, { className: "w-4 h-4" }) })
|
|
24402
22743
|
] });
|
|
24403
22744
|
};
|
|
24404
22745
|
var ImageInput = ({ onSubmit, onCancel }) => {
|
|
24405
22746
|
const t = useSmartTranslations("UEditor");
|
|
24406
|
-
const [url, setUrl] = (0,
|
|
24407
|
-
const [alt, setAlt] = (0,
|
|
24408
|
-
const inputRef = (0,
|
|
24409
|
-
(0,
|
|
22747
|
+
const [url, setUrl] = (0, import_react46.useState)("");
|
|
22748
|
+
const [alt, setAlt] = (0, import_react46.useState)("");
|
|
22749
|
+
const inputRef = (0, import_react46.useRef)(null);
|
|
22750
|
+
(0, import_react46.useEffect)(() => {
|
|
24410
22751
|
inputRef.current?.focus();
|
|
24411
22752
|
}, []);
|
|
24412
22753
|
const handleSubmit = (e) => {
|
|
@@ -24415,10 +22756,10 @@ var ImageInput = ({ onSubmit, onCancel }) => {
|
|
|
24415
22756
|
onSubmit(url, alt);
|
|
24416
22757
|
}
|
|
24417
22758
|
};
|
|
24418
|
-
return /* @__PURE__ */ (0,
|
|
24419
|
-
/* @__PURE__ */ (0,
|
|
24420
|
-
/* @__PURE__ */ (0,
|
|
24421
|
-
/* @__PURE__ */ (0,
|
|
22759
|
+
return /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)("form", { onSubmit: handleSubmit, className: "p-3 space-y-3", children: [
|
|
22760
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsxs)("div", { children: [
|
|
22761
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)("label", { className: "text-xs font-medium text-muted-foreground", children: t("imageInput.urlLabel") }),
|
|
22762
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
24422
22763
|
"input",
|
|
24423
22764
|
{
|
|
24424
22765
|
ref: inputRef,
|
|
@@ -24430,9 +22771,9 @@ var ImageInput = ({ onSubmit, onCancel }) => {
|
|
|
24430
22771
|
}
|
|
24431
22772
|
)
|
|
24432
22773
|
] }),
|
|
24433
|
-
/* @__PURE__ */ (0,
|
|
24434
|
-
/* @__PURE__ */ (0,
|
|
24435
|
-
/* @__PURE__ */ (0,
|
|
22774
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsxs)("div", { children: [
|
|
22775
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)("label", { className: "text-xs font-medium text-muted-foreground", children: t("imageInput.altLabel") }),
|
|
22776
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
24436
22777
|
"input",
|
|
24437
22778
|
{
|
|
24438
22779
|
type: "text",
|
|
@@ -24443,8 +22784,8 @@ var ImageInput = ({ onSubmit, onCancel }) => {
|
|
|
24443
22784
|
}
|
|
24444
22785
|
)
|
|
24445
22786
|
] }),
|
|
24446
|
-
/* @__PURE__ */ (0,
|
|
24447
|
-
/* @__PURE__ */ (0,
|
|
22787
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsxs)("div", { className: "flex gap-2", children: [
|
|
22788
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
24448
22789
|
"button",
|
|
24449
22790
|
{
|
|
24450
22791
|
type: "submit",
|
|
@@ -24453,15 +22794,15 @@ var ImageInput = ({ onSubmit, onCancel }) => {
|
|
|
24453
22794
|
children: t("imageInput.addBtn")
|
|
24454
22795
|
}
|
|
24455
22796
|
),
|
|
24456
|
-
/* @__PURE__ */ (0,
|
|
22797
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)("button", { type: "button", onClick: onCancel, className: "px-4 py-2 rounded-lg hover:bg-muted transition-colors text-muted-foreground", children: t("imageInput.cancelBtn") })
|
|
24457
22798
|
] })
|
|
24458
22799
|
] });
|
|
24459
22800
|
};
|
|
24460
22801
|
|
|
24461
22802
|
// src/components/UEditor/emoji-picker.tsx
|
|
24462
|
-
var
|
|
22803
|
+
var import_react47 = require("react");
|
|
24463
22804
|
var import_lucide_react43 = require("lucide-react");
|
|
24464
|
-
var
|
|
22805
|
+
var import_jsx_runtime76 = require("react/jsx-runtime");
|
|
24465
22806
|
var CATEGORY_ICONS = {
|
|
24466
22807
|
"smileys_people": import_lucide_react43.Smile,
|
|
24467
22808
|
"animals_nature": import_lucide_react43.Leaf,
|
|
@@ -24473,12 +22814,12 @@ var CATEGORY_ICONS = {
|
|
|
24473
22814
|
};
|
|
24474
22815
|
var EmojiPicker = ({ onSelect, onClose }) => {
|
|
24475
22816
|
const t = useSmartTranslations("UEditor");
|
|
24476
|
-
const [search, setSearch] = (0,
|
|
24477
|
-
const [activeCategory, setActiveCategory] = (0,
|
|
24478
|
-
const scrollContainerRef = (0,
|
|
24479
|
-
const categoryRefs = (0,
|
|
24480
|
-
const isUserScrolling = (0,
|
|
24481
|
-
const filteredCategories = (0,
|
|
22817
|
+
const [search, setSearch] = (0, import_react47.useState)("");
|
|
22818
|
+
const [activeCategory, setActiveCategory] = (0, import_react47.useState)(EMOJI_LIST[0]?.id || "");
|
|
22819
|
+
const scrollContainerRef = (0, import_react47.useRef)(null);
|
|
22820
|
+
const categoryRefs = (0, import_react47.useRef)({});
|
|
22821
|
+
const isUserScrolling = (0, import_react47.useRef)(false);
|
|
22822
|
+
const filteredCategories = (0, import_react47.useMemo)(() => {
|
|
24482
22823
|
if (!search.trim()) return EMOJI_LIST;
|
|
24483
22824
|
const query = search.toLowerCase();
|
|
24484
22825
|
return EMOJI_LIST.map((category) => ({
|
|
@@ -24492,7 +22833,7 @@ var EmojiPicker = ({ onSelect, onClose }) => {
|
|
|
24492
22833
|
onSelect(emoji);
|
|
24493
22834
|
setSearch("");
|
|
24494
22835
|
};
|
|
24495
|
-
(0,
|
|
22836
|
+
(0, import_react47.useEffect)(() => {
|
|
24496
22837
|
if (search) return;
|
|
24497
22838
|
const container = scrollContainerRef.current;
|
|
24498
22839
|
if (!container) return;
|
|
@@ -24532,13 +22873,13 @@ var EmojiPicker = ({ onSelect, onClose }) => {
|
|
|
24532
22873
|
isUserScrolling.current = true;
|
|
24533
22874
|
}, 500);
|
|
24534
22875
|
};
|
|
24535
|
-
(0,
|
|
22876
|
+
(0, import_react47.useEffect)(() => {
|
|
24536
22877
|
isUserScrolling.current = true;
|
|
24537
22878
|
}, []);
|
|
24538
|
-
return /* @__PURE__ */ (0,
|
|
24539
|
-
/* @__PURE__ */ (0,
|
|
24540
|
-
/* @__PURE__ */ (0,
|
|
24541
|
-
/* @__PURE__ */ (0,
|
|
22879
|
+
return /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)("div", { className: "w-96 bg-card border border-border/50 rounded-2xl shadow-xl overflow-hidden flex flex-col max-h-128", children: [
|
|
22880
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)("div", { className: "p-3 border-b bg-muted/30 shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)("div", { className: "relative", children: [
|
|
22881
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)(import_lucide_react43.Search, { className: "absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground" }),
|
|
22882
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
24542
22883
|
"input",
|
|
24543
22884
|
{
|
|
24544
22885
|
type: "text",
|
|
@@ -24553,16 +22894,16 @@ var EmojiPicker = ({ onSelect, onClose }) => {
|
|
|
24553
22894
|
)
|
|
24554
22895
|
}
|
|
24555
22896
|
),
|
|
24556
|
-
search && /* @__PURE__ */ (0,
|
|
22897
|
+
search && /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
24557
22898
|
"button",
|
|
24558
22899
|
{
|
|
24559
22900
|
onClick: () => setSearch(""),
|
|
24560
22901
|
className: "absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",
|
|
24561
|
-
children: /* @__PURE__ */ (0,
|
|
22902
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(import_lucide_react43.X, { className: "w-4 h-4" })
|
|
24562
22903
|
}
|
|
24563
22904
|
)
|
|
24564
22905
|
] }) }),
|
|
24565
|
-
/* @__PURE__ */ (0,
|
|
22906
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
24566
22907
|
"div",
|
|
24567
22908
|
{
|
|
24568
22909
|
ref: scrollContainerRef,
|
|
@@ -24570,9 +22911,9 @@ var EmojiPicker = ({ onSelect, onClose }) => {
|
|
|
24570
22911
|
style: { height: "20rem" },
|
|
24571
22912
|
children: search ? (
|
|
24572
22913
|
// Search Results
|
|
24573
|
-
filteredCategories.length > 0 ? filteredCategories.map((category) => /* @__PURE__ */ (0,
|
|
24574
|
-
/* @__PURE__ */ (0,
|
|
24575
|
-
/* @__PURE__ */ (0,
|
|
22914
|
+
filteredCategories.length > 0 ? filteredCategories.map((category) => /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)("div", { className: "mb-4", children: [
|
|
22915
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)("div", { className: "text-xs font-semibold text-muted-foreground uppercase tracking-wider mb-2 sticky top-0 bg-card py-1", children: category.name }),
|
|
22916
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)("div", { className: "grid grid-cols-9 gap-1", children: category.emojis.map((emoji) => /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
24576
22917
|
"button",
|
|
24577
22918
|
{
|
|
24578
22919
|
onClick: () => handleEmojiClick(emoji.emoji),
|
|
@@ -24586,22 +22927,22 @@ var EmojiPicker = ({ onSelect, onClose }) => {
|
|
|
24586
22927
|
},
|
|
24587
22928
|
emoji.name
|
|
24588
22929
|
)) })
|
|
24589
|
-
] }, category.id)) : /* @__PURE__ */ (0,
|
|
24590
|
-
/* @__PURE__ */ (0,
|
|
24591
|
-
/* @__PURE__ */ (0,
|
|
24592
|
-
/* @__PURE__ */ (0,
|
|
22930
|
+
] }, category.id)) : /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)("div", { className: "flex flex-col items-center justify-center h-full text-center", children: [
|
|
22931
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)("div", { className: "text-4xl mb-2", children: "\u{1F50D}" }),
|
|
22932
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)("div", { className: "text-sm font-medium text-muted-foreground", children: t("emojiPicker.noResults") }),
|
|
22933
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)("div", { className: "text-xs text-muted-foreground mt-1", children: t("emojiPicker.tryDifferentSearch") })
|
|
24593
22934
|
] })
|
|
24594
22935
|
) : (
|
|
24595
22936
|
// All Categories - Messenger Style
|
|
24596
|
-
/* @__PURE__ */ (0,
|
|
22937
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)("div", { className: "space-y-4", children: EMOJI_LIST.map((category) => /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)(
|
|
24597
22938
|
"div",
|
|
24598
22939
|
{
|
|
24599
22940
|
ref: (el) => {
|
|
24600
22941
|
categoryRefs.current[category.id] = el;
|
|
24601
22942
|
},
|
|
24602
22943
|
children: [
|
|
24603
|
-
/* @__PURE__ */ (0,
|
|
24604
|
-
/* @__PURE__ */ (0,
|
|
22944
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)("div", { className: "text-xs font-semibold text-muted-foreground uppercase tracking-wider mb-2 sticky top-0 bg-card py-1 z-10", children: category.name }),
|
|
22945
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsx)("div", { className: "grid grid-cols-9 gap-1", children: category.emojis.map((emoji) => /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
24605
22946
|
"button",
|
|
24606
22947
|
{
|
|
24607
22948
|
onClick: () => handleEmojiClick(emoji.emoji),
|
|
@@ -24622,9 +22963,9 @@ var EmojiPicker = ({ onSelect, onClose }) => {
|
|
|
24622
22963
|
)
|
|
24623
22964
|
}
|
|
24624
22965
|
),
|
|
24625
|
-
!search && /* @__PURE__ */ (0,
|
|
22966
|
+
!search && /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("div", { className: "flex items-center justify-around px-2 py-2 border-t bg-muted/30 shrink-0", children: EMOJI_LIST.map((category) => {
|
|
24626
22967
|
const IconComponent = CATEGORY_ICONS[category.id] || import_lucide_react43.Smile;
|
|
24627
|
-
return /* @__PURE__ */ (0,
|
|
22968
|
+
return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
24628
22969
|
"button",
|
|
24629
22970
|
{
|
|
24630
22971
|
onClick: () => handleCategoryClick(category.id),
|
|
@@ -24633,7 +22974,7 @@ var EmojiPicker = ({ onSelect, onClose }) => {
|
|
|
24633
22974
|
activeCategory === category.id ? "text-primary bg-primary/10" : "text-muted-foreground hover:text-foreground hover:bg-accent"
|
|
24634
22975
|
),
|
|
24635
22976
|
title: category.name,
|
|
24636
|
-
children: /* @__PURE__ */ (0,
|
|
22977
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(IconComponent, { className: "w-5 h-5" })
|
|
24637
22978
|
},
|
|
24638
22979
|
category.id
|
|
24639
22980
|
);
|
|
@@ -24642,7 +22983,7 @@ var EmojiPicker = ({ onSelect, onClose }) => {
|
|
|
24642
22983
|
};
|
|
24643
22984
|
|
|
24644
22985
|
// src/components/UEditor/toolbar.tsx
|
|
24645
|
-
var
|
|
22986
|
+
var import_jsx_runtime77 = require("react/jsx-runtime");
|
|
24646
22987
|
function fileToDataUrl2(file) {
|
|
24647
22988
|
return new Promise((resolve, reject) => {
|
|
24648
22989
|
const reader = new FileReader();
|
|
@@ -24651,8 +22992,8 @@ function fileToDataUrl2(file) {
|
|
|
24651
22992
|
reader.readAsDataURL(file);
|
|
24652
22993
|
});
|
|
24653
22994
|
}
|
|
24654
|
-
var ToolbarButton =
|
|
24655
|
-
const button = /* @__PURE__ */ (0,
|
|
22995
|
+
var ToolbarButton = import_react48.default.forwardRef(({ onClick, onMouseDown, active, disabled, children, title, className }, ref) => {
|
|
22996
|
+
const button = /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
24656
22997
|
"button",
|
|
24657
22998
|
{
|
|
24658
22999
|
ref,
|
|
@@ -24675,12 +23016,12 @@ var ToolbarButton = import_react56.default.forwardRef(({ onClick, onMouseDown, a
|
|
|
24675
23016
|
}
|
|
24676
23017
|
);
|
|
24677
23018
|
if (title) {
|
|
24678
|
-
return /* @__PURE__ */ (0,
|
|
23019
|
+
return /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(Tooltip, { content: title, placement: "top", delay: { open: 200, close: 0 }, children: button });
|
|
24679
23020
|
}
|
|
24680
23021
|
return button;
|
|
24681
23022
|
});
|
|
24682
23023
|
ToolbarButton.displayName = "ToolbarButton";
|
|
24683
|
-
var ToolbarDivider = () => /* @__PURE__ */ (0,
|
|
23024
|
+
var ToolbarDivider = () => /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("div", { className: "w-px h-6 bg-border/50 mx-1" });
|
|
24684
23025
|
var EditorToolbar = ({
|
|
24685
23026
|
editor,
|
|
24686
23027
|
variant,
|
|
@@ -24689,10 +23030,10 @@ var EditorToolbar = ({
|
|
|
24689
23030
|
}) => {
|
|
24690
23031
|
const t = useSmartTranslations("UEditor");
|
|
24691
23032
|
const { textColors, highlightColors } = useEditorColors();
|
|
24692
|
-
const [showImageInput, setShowImageInput] = (0,
|
|
24693
|
-
const fileInputRef = (0,
|
|
24694
|
-
const [isUploadingImage, setIsUploadingImage] = (0,
|
|
24695
|
-
const [imageUploadError, setImageUploadError] = (0,
|
|
23033
|
+
const [showImageInput, setShowImageInput] = (0, import_react48.useState)(false);
|
|
23034
|
+
const fileInputRef = (0, import_react48.useRef)(null);
|
|
23035
|
+
const [isUploadingImage, setIsUploadingImage] = (0, import_react48.useState)(false);
|
|
23036
|
+
const [imageUploadError, setImageUploadError] = (0, import_react48.useState)(null);
|
|
24696
23037
|
const insertImageFiles = async (files) => {
|
|
24697
23038
|
if (files.length === 0) return;
|
|
24698
23039
|
setIsUploadingImage(true);
|
|
@@ -24711,31 +23052,31 @@ var EditorToolbar = ({
|
|
|
24711
23052
|
setIsUploadingImage(false);
|
|
24712
23053
|
};
|
|
24713
23054
|
if (variant === "minimal") {
|
|
24714
|
-
return /* @__PURE__ */ (0,
|
|
24715
|
-
/* @__PURE__ */ (0,
|
|
24716
|
-
/* @__PURE__ */ (0,
|
|
24717
|
-
/* @__PURE__ */ (0,
|
|
23055
|
+
return /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)("div", { className: "flex items-center gap-1 p-2 border-b bg-muted/30", children: [
|
|
23056
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(ToolbarButton, { onClick: () => editor.chain().focus().toggleBold().run(), active: editor.isActive("bold"), title: t("toolbar.bold"), children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(import_lucide_react44.Bold, { className: "w-4 h-4" }) }),
|
|
23057
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(ToolbarButton, { onClick: () => editor.chain().focus().toggleItalic().run(), active: editor.isActive("italic"), title: t("toolbar.italic"), children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(import_lucide_react44.Italic, { className: "w-4 h-4" }) }),
|
|
23058
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
24718
23059
|
ToolbarButton,
|
|
24719
23060
|
{
|
|
24720
23061
|
onClick: () => editor.chain().focus().toggleBulletList().run(),
|
|
24721
23062
|
active: editor.isActive("bulletList"),
|
|
24722
23063
|
title: t("toolbar.bulletList"),
|
|
24723
|
-
children: /* @__PURE__ */ (0,
|
|
23064
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(import_lucide_react44.List, { className: "w-4 h-4" })
|
|
24724
23065
|
}
|
|
24725
23066
|
)
|
|
24726
23067
|
] });
|
|
24727
23068
|
}
|
|
24728
|
-
return /* @__PURE__ */ (0,
|
|
24729
|
-
/* @__PURE__ */ (0,
|
|
23069
|
+
return /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)("div", { className: "flex flex-wrap items-center gap-1 p-2 border-b bg-linear-to-r from-muted/30 to-transparent", children: [
|
|
23070
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(
|
|
24730
23071
|
DropdownMenu,
|
|
24731
23072
|
{
|
|
24732
|
-
trigger: /* @__PURE__ */ (0,
|
|
23073
|
+
trigger: /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(ToolbarButton, { onClick: () => {
|
|
24733
23074
|
}, title: t("toolbar.textStyle"), className: "px-2 w-auto gap-1", children: [
|
|
24734
|
-
/* @__PURE__ */ (0,
|
|
24735
|
-
/* @__PURE__ */ (0,
|
|
23075
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(import_lucide_react44.Type, { className: "w-4 h-4" }),
|
|
23076
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(import_lucide_react44.ChevronDown, { className: "w-3 h-3" })
|
|
24736
23077
|
] }),
|
|
24737
23078
|
children: [
|
|
24738
|
-
/* @__PURE__ */ (0,
|
|
23079
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
24739
23080
|
DropdownMenuItem,
|
|
24740
23081
|
{
|
|
24741
23082
|
icon: import_lucide_react44.Type,
|
|
@@ -24744,7 +23085,7 @@ var EditorToolbar = ({
|
|
|
24744
23085
|
active: editor.isActive("paragraph")
|
|
24745
23086
|
}
|
|
24746
23087
|
),
|
|
24747
|
-
/* @__PURE__ */ (0,
|
|
23088
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
24748
23089
|
DropdownMenuItem,
|
|
24749
23090
|
{
|
|
24750
23091
|
icon: import_lucide_react44.Heading1,
|
|
@@ -24754,7 +23095,7 @@ var EditorToolbar = ({
|
|
|
24754
23095
|
shortcut: "Ctrl+Alt+1"
|
|
24755
23096
|
}
|
|
24756
23097
|
),
|
|
24757
|
-
/* @__PURE__ */ (0,
|
|
23098
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
24758
23099
|
DropdownMenuItem,
|
|
24759
23100
|
{
|
|
24760
23101
|
icon: import_lucide_react44.Heading2,
|
|
@@ -24764,7 +23105,7 @@ var EditorToolbar = ({
|
|
|
24764
23105
|
shortcut: "Ctrl+Alt+2"
|
|
24765
23106
|
}
|
|
24766
23107
|
),
|
|
24767
|
-
/* @__PURE__ */ (0,
|
|
23108
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
24768
23109
|
DropdownMenuItem,
|
|
24769
23110
|
{
|
|
24770
23111
|
icon: import_lucide_react44.Heading3,
|
|
@@ -24777,30 +23118,30 @@ var EditorToolbar = ({
|
|
|
24777
23118
|
]
|
|
24778
23119
|
}
|
|
24779
23120
|
),
|
|
24780
|
-
/* @__PURE__ */ (0,
|
|
24781
|
-
/* @__PURE__ */ (0,
|
|
24782
|
-
/* @__PURE__ */ (0,
|
|
24783
|
-
/* @__PURE__ */ (0,
|
|
23121
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(ToolbarDivider, {}),
|
|
23122
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(ToolbarButton, { onClick: () => editor.chain().focus().toggleBold().run(), active: editor.isActive("bold"), title: t("toolbar.bold"), children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(import_lucide_react44.Bold, { className: "w-4 h-4" }) }),
|
|
23123
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(ToolbarButton, { onClick: () => editor.chain().focus().toggleItalic().run(), active: editor.isActive("italic"), title: t("toolbar.italic"), children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(import_lucide_react44.Italic, { className: "w-4 h-4" }) }),
|
|
23124
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
24784
23125
|
ToolbarButton,
|
|
24785
23126
|
{
|
|
24786
23127
|
onClick: () => editor.chain().focus().toggleUnderline().run(),
|
|
24787
23128
|
active: editor.isActive("underline"),
|
|
24788
23129
|
title: t("toolbar.underline"),
|
|
24789
|
-
children: /* @__PURE__ */ (0,
|
|
23130
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(import_lucide_react44.Underline, { className: "w-4 h-4" })
|
|
24790
23131
|
}
|
|
24791
23132
|
),
|
|
24792
|
-
/* @__PURE__ */ (0,
|
|
24793
|
-
/* @__PURE__ */ (0,
|
|
24794
|
-
/* @__PURE__ */ (0,
|
|
24795
|
-
/* @__PURE__ */ (0,
|
|
23133
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(ToolbarButton, { onClick: () => editor.chain().focus().toggleStrike().run(), active: editor.isActive("strike"), title: t("toolbar.strike"), children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(import_lucide_react44.Strikethrough, { className: "w-4 h-4" }) }),
|
|
23134
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(ToolbarButton, { onClick: () => editor.chain().focus().toggleCode().run(), active: editor.isActive("code"), title: t("toolbar.code"), children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(import_lucide_react44.Code, { className: "w-4 h-4" }) }),
|
|
23135
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(ToolbarDivider, {}),
|
|
23136
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
24796
23137
|
DropdownMenu,
|
|
24797
23138
|
{
|
|
24798
|
-
trigger: /* @__PURE__ */ (0,
|
|
23139
|
+
trigger: /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(ToolbarButton, { onClick: () => {
|
|
24799
23140
|
}, title: t("colors.textColor"), children: [
|
|
24800
|
-
/* @__PURE__ */ (0,
|
|
24801
|
-
/* @__PURE__ */ (0,
|
|
23141
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(import_lucide_react44.Palette, { className: "w-4 h-4" }),
|
|
23142
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(import_lucide_react44.ChevronDown, { className: "w-3 h-3" })
|
|
24802
23143
|
] }),
|
|
24803
|
-
children: /* @__PURE__ */ (0,
|
|
23144
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
24804
23145
|
EditorColorPalette,
|
|
24805
23146
|
{
|
|
24806
23147
|
colors: textColors,
|
|
@@ -24817,15 +23158,15 @@ var EditorToolbar = ({
|
|
|
24817
23158
|
)
|
|
24818
23159
|
}
|
|
24819
23160
|
),
|
|
24820
|
-
/* @__PURE__ */ (0,
|
|
23161
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
24821
23162
|
DropdownMenu,
|
|
24822
23163
|
{
|
|
24823
|
-
trigger: /* @__PURE__ */ (0,
|
|
23164
|
+
trigger: /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(ToolbarButton, { onClick: () => {
|
|
24824
23165
|
}, active: editor.isActive("highlight"), title: t("colors.highlight"), children: [
|
|
24825
|
-
/* @__PURE__ */ (0,
|
|
24826
|
-
/* @__PURE__ */ (0,
|
|
23166
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(import_lucide_react44.Highlighter, { className: "w-4 h-4" }),
|
|
23167
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(import_lucide_react44.ChevronDown, { className: "w-3 h-3" })
|
|
24827
23168
|
] }),
|
|
24828
|
-
children: /* @__PURE__ */ (0,
|
|
23169
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
24829
23170
|
EditorColorPalette,
|
|
24830
23171
|
{
|
|
24831
23172
|
colors: highlightColors,
|
|
@@ -24842,13 +23183,13 @@ var EditorToolbar = ({
|
|
|
24842
23183
|
)
|
|
24843
23184
|
}
|
|
24844
23185
|
),
|
|
24845
|
-
/* @__PURE__ */ (0,
|
|
24846
|
-
/* @__PURE__ */ (0,
|
|
23186
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(ToolbarDivider, {}),
|
|
23187
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
24847
23188
|
DropdownMenu,
|
|
24848
23189
|
{
|
|
24849
|
-
trigger: /* @__PURE__ */ (0,
|
|
24850
|
-
}, title: t("toolbar.emoji"), children: /* @__PURE__ */ (0,
|
|
24851
|
-
children: /* @__PURE__ */ (0,
|
|
23190
|
+
trigger: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(ToolbarButton, { onClick: () => {
|
|
23191
|
+
}, title: t("toolbar.emoji"), children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(import_lucide_react44.Smile, { className: "w-4 h-4" }) }),
|
|
23192
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
24852
23193
|
EmojiPicker,
|
|
24853
23194
|
{
|
|
24854
23195
|
onSelect: (emoji) => {
|
|
@@ -24858,17 +23199,17 @@ var EditorToolbar = ({
|
|
|
24858
23199
|
)
|
|
24859
23200
|
}
|
|
24860
23201
|
),
|
|
24861
|
-
/* @__PURE__ */ (0,
|
|
24862
|
-
/* @__PURE__ */ (0,
|
|
23202
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(ToolbarDivider, {}),
|
|
23203
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(
|
|
24863
23204
|
DropdownMenu,
|
|
24864
23205
|
{
|
|
24865
|
-
trigger: /* @__PURE__ */ (0,
|
|
23206
|
+
trigger: /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(ToolbarButton, { onClick: () => {
|
|
24866
23207
|
}, title: t("toolbar.alignment"), children: [
|
|
24867
|
-
/* @__PURE__ */ (0,
|
|
24868
|
-
/* @__PURE__ */ (0,
|
|
23208
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(import_lucide_react44.AlignLeft, { className: "w-4 h-4" }),
|
|
23209
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(import_lucide_react44.ChevronDown, { className: "w-3 h-3" })
|
|
24869
23210
|
] }),
|
|
24870
23211
|
children: [
|
|
24871
|
-
/* @__PURE__ */ (0,
|
|
23212
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
24872
23213
|
DropdownMenuItem,
|
|
24873
23214
|
{
|
|
24874
23215
|
icon: import_lucide_react44.AlignLeft,
|
|
@@ -24877,7 +23218,7 @@ var EditorToolbar = ({
|
|
|
24877
23218
|
active: editor.isActive({ textAlign: "left" })
|
|
24878
23219
|
}
|
|
24879
23220
|
),
|
|
24880
|
-
/* @__PURE__ */ (0,
|
|
23221
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
24881
23222
|
DropdownMenuItem,
|
|
24882
23223
|
{
|
|
24883
23224
|
icon: import_lucide_react44.AlignCenter,
|
|
@@ -24886,7 +23227,7 @@ var EditorToolbar = ({
|
|
|
24886
23227
|
active: editor.isActive({ textAlign: "center" })
|
|
24887
23228
|
}
|
|
24888
23229
|
),
|
|
24889
|
-
/* @__PURE__ */ (0,
|
|
23230
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
24890
23231
|
DropdownMenuItem,
|
|
24891
23232
|
{
|
|
24892
23233
|
icon: import_lucide_react44.AlignRight,
|
|
@@ -24895,7 +23236,7 @@ var EditorToolbar = ({
|
|
|
24895
23236
|
active: editor.isActive({ textAlign: "right" })
|
|
24896
23237
|
}
|
|
24897
23238
|
),
|
|
24898
|
-
/* @__PURE__ */ (0,
|
|
23239
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
24899
23240
|
DropdownMenuItem,
|
|
24900
23241
|
{
|
|
24901
23242
|
icon: import_lucide_react44.AlignJustify,
|
|
@@ -24907,17 +23248,17 @@ var EditorToolbar = ({
|
|
|
24907
23248
|
]
|
|
24908
23249
|
}
|
|
24909
23250
|
),
|
|
24910
|
-
/* @__PURE__ */ (0,
|
|
24911
|
-
/* @__PURE__ */ (0,
|
|
23251
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(ToolbarDivider, {}),
|
|
23252
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(
|
|
24912
23253
|
DropdownMenu,
|
|
24913
23254
|
{
|
|
24914
|
-
trigger: /* @__PURE__ */ (0,
|
|
23255
|
+
trigger: /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(ToolbarButton, { onClick: () => {
|
|
24915
23256
|
}, title: t("toolbar.bulletList"), children: [
|
|
24916
|
-
/* @__PURE__ */ (0,
|
|
24917
|
-
/* @__PURE__ */ (0,
|
|
23257
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(import_lucide_react44.List, { className: "w-4 h-4" }),
|
|
23258
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(import_lucide_react44.ChevronDown, { className: "w-3 h-3" })
|
|
24918
23259
|
] }),
|
|
24919
23260
|
children: [
|
|
24920
|
-
/* @__PURE__ */ (0,
|
|
23261
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
24921
23262
|
DropdownMenuItem,
|
|
24922
23263
|
{
|
|
24923
23264
|
icon: import_lucide_react44.List,
|
|
@@ -24927,7 +23268,7 @@ var EditorToolbar = ({
|
|
|
24927
23268
|
shortcut: "Ctrl+Shift+8"
|
|
24928
23269
|
}
|
|
24929
23270
|
),
|
|
24930
|
-
/* @__PURE__ */ (0,
|
|
23271
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
24931
23272
|
DropdownMenuItem,
|
|
24932
23273
|
{
|
|
24933
23274
|
icon: import_lucide_react44.ListOrdered,
|
|
@@ -24937,7 +23278,7 @@ var EditorToolbar = ({
|
|
|
24937
23278
|
shortcut: "Ctrl+Shift+7"
|
|
24938
23279
|
}
|
|
24939
23280
|
),
|
|
24940
|
-
/* @__PURE__ */ (0,
|
|
23281
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
24941
23282
|
DropdownMenuItem,
|
|
24942
23283
|
{
|
|
24943
23284
|
icon: import_lucide_react44.ListTodo,
|
|
@@ -24950,16 +23291,16 @@ var EditorToolbar = ({
|
|
|
24950
23291
|
]
|
|
24951
23292
|
}
|
|
24952
23293
|
),
|
|
24953
|
-
/* @__PURE__ */ (0,
|
|
23294
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(
|
|
24954
23295
|
DropdownMenu,
|
|
24955
23296
|
{
|
|
24956
|
-
trigger: /* @__PURE__ */ (0,
|
|
23297
|
+
trigger: /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(ToolbarButton, { onClick: () => {
|
|
24957
23298
|
}, title: t("toolbar.quote"), children: [
|
|
24958
|
-
/* @__PURE__ */ (0,
|
|
24959
|
-
/* @__PURE__ */ (0,
|
|
23299
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(import_lucide_react44.Quote, { className: "w-4 h-4" }),
|
|
23300
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(import_lucide_react44.ChevronDown, { className: "w-3 h-3" })
|
|
24960
23301
|
] }),
|
|
24961
23302
|
children: [
|
|
24962
|
-
/* @__PURE__ */ (0,
|
|
23303
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
24963
23304
|
DropdownMenuItem,
|
|
24964
23305
|
{
|
|
24965
23306
|
icon: import_lucide_react44.Quote,
|
|
@@ -24969,7 +23310,7 @@ var EditorToolbar = ({
|
|
|
24969
23310
|
shortcut: "Ctrl+Shift+B"
|
|
24970
23311
|
}
|
|
24971
23312
|
),
|
|
24972
|
-
/* @__PURE__ */ (0,
|
|
23313
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
24973
23314
|
DropdownMenuItem,
|
|
24974
23315
|
{
|
|
24975
23316
|
icon: import_lucide_react44.FileCode,
|
|
@@ -24982,15 +23323,15 @@ var EditorToolbar = ({
|
|
|
24982
23323
|
]
|
|
24983
23324
|
}
|
|
24984
23325
|
),
|
|
24985
|
-
/* @__PURE__ */ (0,
|
|
23326
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
24986
23327
|
DropdownMenu,
|
|
24987
23328
|
{
|
|
24988
|
-
trigger: /* @__PURE__ */ (0,
|
|
23329
|
+
trigger: /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(ToolbarButton, { onClick: () => {
|
|
24989
23330
|
}, title: t("toolbar.image"), children: [
|
|
24990
|
-
/* @__PURE__ */ (0,
|
|
24991
|
-
/* @__PURE__ */ (0,
|
|
23331
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(import_lucide_react44.Image, { className: "w-4 h-4" }),
|
|
23332
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(import_lucide_react44.ChevronDown, { className: "w-3 h-3" })
|
|
24992
23333
|
] }),
|
|
24993
|
-
children: showImageInput ? /* @__PURE__ */ (0,
|
|
23334
|
+
children: showImageInput ? /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
24994
23335
|
ImageInput,
|
|
24995
23336
|
{
|
|
24996
23337
|
onSubmit: (url, alt) => {
|
|
@@ -24999,9 +23340,9 @@ var EditorToolbar = ({
|
|
|
24999
23340
|
},
|
|
25000
23341
|
onCancel: () => setShowImageInput(false)
|
|
25001
23342
|
}
|
|
25002
|
-
) : /* @__PURE__ */ (0,
|
|
25003
|
-
/* @__PURE__ */ (0,
|
|
25004
|
-
/* @__PURE__ */ (0,
|
|
23343
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(import_jsx_runtime77.Fragment, { children: [
|
|
23344
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(DropdownMenuItem, { icon: import_lucide_react44.Link, label: t("imageInput.addFromUrl"), onClick: () => setShowImageInput(true) }),
|
|
23345
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
25005
23346
|
DropdownMenuItem,
|
|
25006
23347
|
{
|
|
25007
23348
|
icon: import_lucide_react44.Upload,
|
|
@@ -25010,8 +23351,8 @@ var EditorToolbar = ({
|
|
|
25010
23351
|
onClick: () => fileInputRef.current?.click()
|
|
25011
23352
|
}
|
|
25012
23353
|
),
|
|
25013
|
-
imageUploadError && /* @__PURE__ */ (0,
|
|
25014
|
-
/* @__PURE__ */ (0,
|
|
23354
|
+
imageUploadError && /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(DropdownMenuItem, { label: imageUploadError, disabled: true, destructive: true }),
|
|
23355
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
25015
23356
|
"input",
|
|
25016
23357
|
{
|
|
25017
23358
|
ref: fileInputRef,
|
|
@@ -25029,16 +23370,16 @@ var EditorToolbar = ({
|
|
|
25029
23370
|
] })
|
|
25030
23371
|
}
|
|
25031
23372
|
),
|
|
25032
|
-
/* @__PURE__ */ (0,
|
|
23373
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(
|
|
25033
23374
|
DropdownMenu,
|
|
25034
23375
|
{
|
|
25035
|
-
trigger: /* @__PURE__ */ (0,
|
|
23376
|
+
trigger: /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(ToolbarButton, { onClick: () => {
|
|
25036
23377
|
}, title: t("toolbar.table"), children: [
|
|
25037
|
-
/* @__PURE__ */ (0,
|
|
25038
|
-
/* @__PURE__ */ (0,
|
|
23378
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(import_lucide_react44.Table, { className: "w-4 h-4" }),
|
|
23379
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(import_lucide_react44.ChevronDown, { className: "w-3 h-3" })
|
|
25039
23380
|
] }),
|
|
25040
23381
|
children: [
|
|
25041
|
-
/* @__PURE__ */ (0,
|
|
23382
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
25042
23383
|
DropdownMenuItem,
|
|
25043
23384
|
{
|
|
25044
23385
|
icon: import_lucide_react44.Table,
|
|
@@ -25046,8 +23387,8 @@ var EditorToolbar = ({
|
|
|
25046
23387
|
onClick: () => editor.chain().focus().insertTable({ rows: 3, cols: 3, withHeaderRow: true }).run()
|
|
25047
23388
|
}
|
|
25048
23389
|
),
|
|
25049
|
-
/* @__PURE__ */ (0,
|
|
25050
|
-
/* @__PURE__ */ (0,
|
|
23390
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)("div", { className: "my-1 border-t" }),
|
|
23391
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
25051
23392
|
DropdownMenuItem,
|
|
25052
23393
|
{
|
|
25053
23394
|
icon: import_lucide_react44.ArrowDown,
|
|
@@ -25056,7 +23397,7 @@ var EditorToolbar = ({
|
|
|
25056
23397
|
disabled: !editor.can().addColumnBefore()
|
|
25057
23398
|
}
|
|
25058
23399
|
),
|
|
25059
|
-
/* @__PURE__ */ (0,
|
|
23400
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
25060
23401
|
DropdownMenuItem,
|
|
25061
23402
|
{
|
|
25062
23403
|
icon: import_lucide_react44.ArrowDown,
|
|
@@ -25065,7 +23406,7 @@ var EditorToolbar = ({
|
|
|
25065
23406
|
disabled: !editor.can().addColumnAfter()
|
|
25066
23407
|
}
|
|
25067
23408
|
),
|
|
25068
|
-
/* @__PURE__ */ (0,
|
|
23409
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
25069
23410
|
DropdownMenuItem,
|
|
25070
23411
|
{
|
|
25071
23412
|
icon: import_lucide_react44.ArrowRight,
|
|
@@ -25074,7 +23415,7 @@ var EditorToolbar = ({
|
|
|
25074
23415
|
disabled: !editor.can().addRowBefore()
|
|
25075
23416
|
}
|
|
25076
23417
|
),
|
|
25077
|
-
/* @__PURE__ */ (0,
|
|
23418
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
25078
23419
|
DropdownMenuItem,
|
|
25079
23420
|
{
|
|
25080
23421
|
icon: import_lucide_react44.ArrowRight,
|
|
@@ -25083,8 +23424,8 @@ var EditorToolbar = ({
|
|
|
25083
23424
|
disabled: !editor.can().addRowAfter()
|
|
25084
23425
|
}
|
|
25085
23426
|
),
|
|
25086
|
-
/* @__PURE__ */ (0,
|
|
25087
|
-
/* @__PURE__ */ (0,
|
|
23427
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)("div", { className: "my-1 border-t" }),
|
|
23428
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
25088
23429
|
DropdownMenuItem,
|
|
25089
23430
|
{
|
|
25090
23431
|
icon: import_lucide_react44.Trash2,
|
|
@@ -25093,7 +23434,7 @@ var EditorToolbar = ({
|
|
|
25093
23434
|
disabled: !editor.can().deleteColumn()
|
|
25094
23435
|
}
|
|
25095
23436
|
),
|
|
25096
|
-
/* @__PURE__ */ (0,
|
|
23437
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
25097
23438
|
DropdownMenuItem,
|
|
25098
23439
|
{
|
|
25099
23440
|
icon: import_lucide_react44.Trash2,
|
|
@@ -25102,7 +23443,7 @@ var EditorToolbar = ({
|
|
|
25102
23443
|
disabled: !editor.can().deleteRow()
|
|
25103
23444
|
}
|
|
25104
23445
|
),
|
|
25105
|
-
/* @__PURE__ */ (0,
|
|
23446
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
25106
23447
|
DropdownMenuItem,
|
|
25107
23448
|
{
|
|
25108
23449
|
icon: import_lucide_react44.Trash2,
|
|
@@ -25114,41 +23455,41 @@ var EditorToolbar = ({
|
|
|
25114
23455
|
]
|
|
25115
23456
|
}
|
|
25116
23457
|
),
|
|
25117
|
-
/* @__PURE__ */ (0,
|
|
25118
|
-
/* @__PURE__ */ (0,
|
|
23458
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(ToolbarDivider, {}),
|
|
23459
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
25119
23460
|
ToolbarButton,
|
|
25120
23461
|
{
|
|
25121
23462
|
onClick: () => editor.chain().focus().toggleSubscript().run(),
|
|
25122
23463
|
active: editor.isActive("subscript"),
|
|
25123
23464
|
title: t("toolbar.subscript"),
|
|
25124
|
-
children: /* @__PURE__ */ (0,
|
|
23465
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(import_lucide_react44.Subscript, { className: "w-4 h-4" })
|
|
25125
23466
|
}
|
|
25126
23467
|
),
|
|
25127
|
-
/* @__PURE__ */ (0,
|
|
23468
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
25128
23469
|
ToolbarButton,
|
|
25129
23470
|
{
|
|
25130
23471
|
onClick: () => editor.chain().focus().toggleSuperscript().run(),
|
|
25131
23472
|
active: editor.isActive("superscript"),
|
|
25132
23473
|
title: t("toolbar.superscript"),
|
|
25133
|
-
children: /* @__PURE__ */ (0,
|
|
23474
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(import_lucide_react44.Superscript, { className: "w-4 h-4" })
|
|
25134
23475
|
}
|
|
25135
23476
|
),
|
|
25136
|
-
/* @__PURE__ */ (0,
|
|
25137
|
-
/* @__PURE__ */ (0,
|
|
25138
|
-
/* @__PURE__ */ (0,
|
|
23477
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(ToolbarDivider, {}),
|
|
23478
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(ToolbarButton, { onClick: () => editor.chain().focus().undo().run(), disabled: !editor.can().undo(), title: t("toolbar.undo"), children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(import_lucide_react44.Undo, { className: "w-4 h-4" }) }),
|
|
23479
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(ToolbarButton, { onClick: () => editor.chain().focus().redo().run(), disabled: !editor.can().redo(), title: t("toolbar.redo"), children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(import_lucide_react44.Redo, { className: "w-4 h-4" }) })
|
|
25139
23480
|
] });
|
|
25140
23481
|
};
|
|
25141
23482
|
|
|
25142
23483
|
// src/components/UEditor/menus.tsx
|
|
25143
|
-
var
|
|
25144
|
-
var
|
|
23484
|
+
var import_react49 = require("react");
|
|
23485
|
+
var import_react_dom8 = require("react-dom");
|
|
25145
23486
|
var import_lucide_react45 = require("lucide-react");
|
|
25146
|
-
var
|
|
23487
|
+
var import_jsx_runtime78 = require("react/jsx-runtime");
|
|
25147
23488
|
var SlashCommandMenu = ({ editor, onClose, filterText = "" }) => {
|
|
25148
23489
|
const t = useSmartTranslations("UEditor");
|
|
25149
|
-
const [selectedIndex, setSelectedIndex] = (0,
|
|
25150
|
-
const menuRef = (0,
|
|
25151
|
-
const allCommands = (0,
|
|
23490
|
+
const [selectedIndex, setSelectedIndex] = (0, import_react49.useState)(0);
|
|
23491
|
+
const menuRef = (0, import_react49.useRef)(null);
|
|
23492
|
+
const allCommands = (0, import_react49.useMemo)(
|
|
25152
23493
|
() => [
|
|
25153
23494
|
{
|
|
25154
23495
|
icon: import_lucide_react45.Type,
|
|
@@ -25219,19 +23560,19 @@ var SlashCommandMenu = ({ editor, onClose, filterText = "" }) => {
|
|
|
25219
23560
|
],
|
|
25220
23561
|
[editor, t]
|
|
25221
23562
|
);
|
|
25222
|
-
const commands = (0,
|
|
23563
|
+
const commands = (0, import_react49.useMemo)(() => {
|
|
25223
23564
|
if (!filterText) return allCommands;
|
|
25224
23565
|
const lowerFilter = filterText.toLowerCase();
|
|
25225
23566
|
return allCommands.filter((cmd) => cmd.label.toLowerCase().includes(lowerFilter) || cmd.description.toLowerCase().includes(lowerFilter));
|
|
25226
23567
|
}, [allCommands, filterText]);
|
|
25227
|
-
(0,
|
|
23568
|
+
(0, import_react49.useEffect)(() => {
|
|
25228
23569
|
setSelectedIndex(0);
|
|
25229
23570
|
}, [filterText]);
|
|
25230
|
-
(0,
|
|
23571
|
+
(0, import_react49.useEffect)(() => {
|
|
25231
23572
|
const selectedElement = menuRef.current?.querySelector(`[data-index="${selectedIndex}"]`);
|
|
25232
23573
|
selectedElement?.scrollIntoView({ block: "nearest" });
|
|
25233
23574
|
}, [selectedIndex]);
|
|
25234
|
-
const selectCommand = (0,
|
|
23575
|
+
const selectCommand = (0, import_react49.useCallback)(
|
|
25235
23576
|
(index) => {
|
|
25236
23577
|
const command = commands[index];
|
|
25237
23578
|
if (command) {
|
|
@@ -25241,7 +23582,7 @@ var SlashCommandMenu = ({ editor, onClose, filterText = "" }) => {
|
|
|
25241
23582
|
},
|
|
25242
23583
|
[commands, onClose]
|
|
25243
23584
|
);
|
|
25244
|
-
(0,
|
|
23585
|
+
(0, import_react49.useEffect)(() => {
|
|
25245
23586
|
const handleKeyDown = (e) => {
|
|
25246
23587
|
if (commands.length === 0) return;
|
|
25247
23588
|
if (e.key === "ArrowDown") {
|
|
@@ -25262,11 +23603,11 @@ var SlashCommandMenu = ({ editor, onClose, filterText = "" }) => {
|
|
|
25262
23603
|
return () => document.removeEventListener("keydown", handleKeyDown);
|
|
25263
23604
|
}, [commands, selectedIndex, selectCommand, onClose]);
|
|
25264
23605
|
if (commands.length === 0) {
|
|
25265
|
-
return /* @__PURE__ */ (0,
|
|
23606
|
+
return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("div", { className: "w-72 p-4 text-center text-muted-foreground text-sm", children: t("slashCommand.noResults") });
|
|
25266
23607
|
}
|
|
25267
|
-
return /* @__PURE__ */ (0,
|
|
25268
|
-
/* @__PURE__ */ (0,
|
|
25269
|
-
/* @__PURE__ */ (0,
|
|
23608
|
+
return /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("div", { ref: menuRef, className: "w-72 max-h-80 overflow-y-auto", children: [
|
|
23609
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)("div", { className: "px-3 py-2 border-b", children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("span", { className: "text-xs font-semibold text-muted-foreground uppercase tracking-wider", children: t("slashCommand.basicBlocks") }) }),
|
|
23610
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)("div", { className: "p-1", children: commands.map((cmd, index) => /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(
|
|
25270
23611
|
"button",
|
|
25271
23612
|
{
|
|
25272
23613
|
type: "button",
|
|
@@ -25279,19 +23620,19 @@ var SlashCommandMenu = ({ editor, onClose, filterText = "" }) => {
|
|
|
25279
23620
|
selectedIndex === index ? "bg-accent" : "hover:bg-accent/50"
|
|
25280
23621
|
),
|
|
25281
23622
|
children: [
|
|
25282
|
-
/* @__PURE__ */ (0,
|
|
23623
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
25283
23624
|
"div",
|
|
25284
23625
|
{
|
|
25285
23626
|
className: cn(
|
|
25286
23627
|
"flex items-center justify-center w-10 h-10 rounded-lg mr-3 transition-colors",
|
|
25287
23628
|
selectedIndex === index ? "bg-primary/10" : "bg-muted/50 group-hover:bg-muted"
|
|
25288
23629
|
),
|
|
25289
|
-
children: /* @__PURE__ */ (0,
|
|
23630
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(cmd.icon, { className: cn("w-5 h-5", selectedIndex === index ? "text-primary" : "text-muted-foreground") })
|
|
25290
23631
|
}
|
|
25291
23632
|
),
|
|
25292
|
-
/* @__PURE__ */ (0,
|
|
25293
|
-
/* @__PURE__ */ (0,
|
|
25294
|
-
/* @__PURE__ */ (0,
|
|
23633
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("div", { className: "text-left", children: [
|
|
23634
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)("div", { className: cn("text-sm font-medium", selectedIndex === index && "text-primary"), children: cmd.label }),
|
|
23635
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)("div", { className: "text-xs text-muted-foreground", children: cmd.description })
|
|
25295
23636
|
] })
|
|
25296
23637
|
]
|
|
25297
23638
|
},
|
|
@@ -25301,19 +23642,19 @@ var SlashCommandMenu = ({ editor, onClose, filterText = "" }) => {
|
|
|
25301
23642
|
};
|
|
25302
23643
|
var FloatingMenuContent = ({ editor }) => {
|
|
25303
23644
|
const t = useSmartTranslations("UEditor");
|
|
25304
|
-
const [showCommands, setShowCommands] = (0,
|
|
23645
|
+
const [showCommands, setShowCommands] = (0, import_react49.useState)(false);
|
|
25305
23646
|
if (showCommands) {
|
|
25306
|
-
return /* @__PURE__ */ (0,
|
|
23647
|
+
return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(SlashCommandMenu, { editor, onClose: () => setShowCommands(false) });
|
|
25307
23648
|
}
|
|
25308
|
-
return /* @__PURE__ */ (0,
|
|
23649
|
+
return /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(
|
|
25309
23650
|
"button",
|
|
25310
23651
|
{
|
|
25311
23652
|
type: "button",
|
|
25312
23653
|
onClick: () => setShowCommands(true),
|
|
25313
23654
|
className: "flex items-center gap-1 px-2 py-1.5 rounded-lg hover:bg-accent transition-all group",
|
|
25314
23655
|
children: [
|
|
25315
|
-
/* @__PURE__ */ (0,
|
|
25316
|
-
/* @__PURE__ */ (0,
|
|
23656
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)(import_lucide_react45.Plus, { className: "w-4 h-4 text-muted-foreground group-hover:text-foreground" }),
|
|
23657
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)("span", { className: "text-sm text-muted-foreground group-hover:text-foreground", children: t("floatingMenu.addBlock") })
|
|
25317
23658
|
]
|
|
25318
23659
|
}
|
|
25319
23660
|
);
|
|
@@ -25324,12 +23665,12 @@ var BubbleMenuContent = ({
|
|
|
25324
23665
|
}) => {
|
|
25325
23666
|
const t = useSmartTranslations("UEditor");
|
|
25326
23667
|
const { textColors, highlightColors } = useEditorColors();
|
|
25327
|
-
const [showLinkInput, setShowLinkInput] = (0,
|
|
25328
|
-
const [showEditorColorPalette, setShowEditorColorPalette] = (0,
|
|
25329
|
-
(0,
|
|
23668
|
+
const [showLinkInput, setShowLinkInput] = (0, import_react49.useState)(false);
|
|
23669
|
+
const [showEditorColorPalette, setShowEditorColorPalette] = (0, import_react49.useState)(false);
|
|
23670
|
+
(0, import_react49.useEffect)(() => {
|
|
25330
23671
|
onKeepOpenChange?.(showLinkInput);
|
|
25331
23672
|
}, [onKeepOpenChange, showLinkInput]);
|
|
25332
|
-
(0,
|
|
23673
|
+
(0, import_react49.useEffect)(() => {
|
|
25333
23674
|
if (!showLinkInput) return;
|
|
25334
23675
|
const close = () => setShowLinkInput(false);
|
|
25335
23676
|
editor.on("selectionUpdate", close);
|
|
@@ -25340,7 +23681,7 @@ var BubbleMenuContent = ({
|
|
|
25340
23681
|
};
|
|
25341
23682
|
}, [editor, showLinkInput]);
|
|
25342
23683
|
if (showLinkInput) {
|
|
25343
|
-
return /* @__PURE__ */ (0,
|
|
23684
|
+
return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
25344
23685
|
LinkInput,
|
|
25345
23686
|
{
|
|
25346
23687
|
initialUrl: editor.getAttributes("link").href || "",
|
|
@@ -25357,8 +23698,8 @@ var BubbleMenuContent = ({
|
|
|
25357
23698
|
);
|
|
25358
23699
|
}
|
|
25359
23700
|
if (showEditorColorPalette) {
|
|
25360
|
-
return /* @__PURE__ */ (0,
|
|
25361
|
-
/* @__PURE__ */ (0,
|
|
23701
|
+
return /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("div", { className: "w-48", children: [
|
|
23702
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
25362
23703
|
EditorColorPalette,
|
|
25363
23704
|
{
|
|
25364
23705
|
colors: textColors,
|
|
@@ -25373,8 +23714,8 @@ var BubbleMenuContent = ({
|
|
|
25373
23714
|
label: t("colors.textColor")
|
|
25374
23715
|
}
|
|
25375
23716
|
),
|
|
25376
|
-
/* @__PURE__ */ (0,
|
|
25377
|
-
/* @__PURE__ */ (0,
|
|
23717
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)("div", { className: "border-t my-1" }),
|
|
23718
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
25378
23719
|
EditorColorPalette,
|
|
25379
23720
|
{
|
|
25380
23721
|
colors: highlightColors,
|
|
@@ -25389,7 +23730,7 @@ var BubbleMenuContent = ({
|
|
|
25389
23730
|
label: t("colors.highlight")
|
|
25390
23731
|
}
|
|
25391
23732
|
),
|
|
25392
|
-
/* @__PURE__ */ (0,
|
|
23733
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)("div", { className: "p-2 border-t", children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
25393
23734
|
"button",
|
|
25394
23735
|
{
|
|
25395
23736
|
type: "button",
|
|
@@ -25400,22 +23741,22 @@ var BubbleMenuContent = ({
|
|
|
25400
23741
|
) })
|
|
25401
23742
|
] });
|
|
25402
23743
|
}
|
|
25403
|
-
return /* @__PURE__ */ (0,
|
|
25404
|
-
/* @__PURE__ */ (0,
|
|
25405
|
-
/* @__PURE__ */ (0,
|
|
25406
|
-
/* @__PURE__ */ (0,
|
|
23744
|
+
return /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("div", { className: "flex items-center gap-0.5 p-1", children: [
|
|
23745
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)(ToolbarButton, { onClick: () => editor.chain().focus().toggleBold().run(), active: editor.isActive("bold"), title: t("toolbar.bold"), children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(import_lucide_react45.Bold, { className: "w-4 h-4" }) }),
|
|
23746
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)(ToolbarButton, { onClick: () => editor.chain().focus().toggleItalic().run(), active: editor.isActive("italic"), title: t("toolbar.italic"), children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(import_lucide_react45.Italic, { className: "w-4 h-4" }) }),
|
|
23747
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
25407
23748
|
ToolbarButton,
|
|
25408
23749
|
{
|
|
25409
23750
|
onClick: () => editor.chain().focus().toggleUnderline().run(),
|
|
25410
23751
|
active: editor.isActive("underline"),
|
|
25411
23752
|
title: t("toolbar.underline"),
|
|
25412
|
-
children: /* @__PURE__ */ (0,
|
|
23753
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(import_lucide_react45.Underline, { className: "w-4 h-4" })
|
|
25413
23754
|
}
|
|
25414
23755
|
),
|
|
25415
|
-
/* @__PURE__ */ (0,
|
|
25416
|
-
/* @__PURE__ */ (0,
|
|
25417
|
-
/* @__PURE__ */ (0,
|
|
25418
|
-
/* @__PURE__ */ (0,
|
|
23756
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)(ToolbarButton, { onClick: () => editor.chain().focus().toggleStrike().run(), active: editor.isActive("strike"), title: t("toolbar.strike"), children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(import_lucide_react45.Strikethrough, { className: "w-4 h-4" }) }),
|
|
23757
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)(ToolbarButton, { onClick: () => editor.chain().focus().toggleCode().run(), active: editor.isActive("code"), title: t("toolbar.code"), children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(import_lucide_react45.Code, { className: "w-4 h-4" }) }),
|
|
23758
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)("div", { className: "w-px h-6 bg-border/50 mx-1" }),
|
|
23759
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
25419
23760
|
ToolbarButton,
|
|
25420
23761
|
{
|
|
25421
23762
|
onMouseDown: () => {
|
|
@@ -25426,41 +23767,41 @@ var BubbleMenuContent = ({
|
|
|
25426
23767
|
},
|
|
25427
23768
|
active: editor.isActive("link"),
|
|
25428
23769
|
title: t("toolbar.link"),
|
|
25429
|
-
children: /* @__PURE__ */ (0,
|
|
23770
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(import_lucide_react45.Link, { className: "w-4 h-4" })
|
|
25430
23771
|
}
|
|
25431
23772
|
),
|
|
25432
|
-
/* @__PURE__ */ (0,
|
|
25433
|
-
/* @__PURE__ */ (0,
|
|
25434
|
-
/* @__PURE__ */ (0,
|
|
23773
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)(ToolbarButton, { onClick: () => setShowEditorColorPalette(true), title: t("colors.textColor"), children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(import_lucide_react45.Palette, { className: "w-4 h-4" }) }),
|
|
23774
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)("div", { className: "w-px h-6 bg-border/50 mx-1" }),
|
|
23775
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
25435
23776
|
ToolbarButton,
|
|
25436
23777
|
{
|
|
25437
23778
|
onClick: () => editor.chain().focus().toggleSubscript().run(),
|
|
25438
23779
|
active: editor.isActive("subscript"),
|
|
25439
23780
|
title: t("toolbar.subscript"),
|
|
25440
|
-
children: /* @__PURE__ */ (0,
|
|
23781
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(import_lucide_react45.Subscript, { className: "w-4 h-4" })
|
|
25441
23782
|
}
|
|
25442
23783
|
),
|
|
25443
|
-
/* @__PURE__ */ (0,
|
|
23784
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
25444
23785
|
ToolbarButton,
|
|
25445
23786
|
{
|
|
25446
23787
|
onClick: () => editor.chain().focus().toggleSuperscript().run(),
|
|
25447
23788
|
active: editor.isActive("superscript"),
|
|
25448
23789
|
title: t("toolbar.superscript"),
|
|
25449
|
-
children: /* @__PURE__ */ (0,
|
|
23790
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(import_lucide_react45.Superscript, { className: "w-4 h-4" })
|
|
25450
23791
|
}
|
|
25451
23792
|
)
|
|
25452
23793
|
] });
|
|
25453
23794
|
};
|
|
25454
23795
|
var CustomBubbleMenu = ({ editor }) => {
|
|
25455
|
-
const [isVisible, setIsVisible] = (0,
|
|
25456
|
-
const [position, setPosition] = (0,
|
|
25457
|
-
const menuRef = (0,
|
|
25458
|
-
const keepOpenRef = (0,
|
|
25459
|
-
const setKeepOpen = (0,
|
|
23796
|
+
const [isVisible, setIsVisible] = (0, import_react49.useState)(false);
|
|
23797
|
+
const [position, setPosition] = (0, import_react49.useState)({ top: 0, left: 0 });
|
|
23798
|
+
const menuRef = (0, import_react49.useRef)(null);
|
|
23799
|
+
const keepOpenRef = (0, import_react49.useRef)(false);
|
|
23800
|
+
const setKeepOpen = (0, import_react49.useCallback)((next) => {
|
|
25460
23801
|
keepOpenRef.current = next;
|
|
25461
23802
|
if (next) setIsVisible(true);
|
|
25462
23803
|
}, []);
|
|
25463
|
-
(0,
|
|
23804
|
+
(0, import_react49.useEffect)(() => {
|
|
25464
23805
|
const updatePosition = () => {
|
|
25465
23806
|
const { state, view } = editor;
|
|
25466
23807
|
const { from, to, empty } = state.selection;
|
|
@@ -25488,8 +23829,8 @@ var CustomBubbleMenu = ({ editor }) => {
|
|
|
25488
23829
|
};
|
|
25489
23830
|
}, [editor]);
|
|
25490
23831
|
if (!isVisible) return null;
|
|
25491
|
-
return (0,
|
|
25492
|
-
/* @__PURE__ */ (0,
|
|
23832
|
+
return (0, import_react_dom8.createPortal)(
|
|
23833
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
25493
23834
|
"div",
|
|
25494
23835
|
{
|
|
25495
23836
|
ref: menuRef,
|
|
@@ -25500,7 +23841,7 @@ var CustomBubbleMenu = ({ editor }) => {
|
|
|
25500
23841
|
transform: "translate(-50%, -100%)"
|
|
25501
23842
|
},
|
|
25502
23843
|
onMouseDown: (e) => e.preventDefault(),
|
|
25503
|
-
children: /* @__PURE__ */ (0,
|
|
23844
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
25504
23845
|
BubbleMenuContent,
|
|
25505
23846
|
{
|
|
25506
23847
|
editor,
|
|
@@ -25513,9 +23854,9 @@ var CustomBubbleMenu = ({ editor }) => {
|
|
|
25513
23854
|
);
|
|
25514
23855
|
};
|
|
25515
23856
|
var CustomFloatingMenu = ({ editor }) => {
|
|
25516
|
-
const [isVisible, setIsVisible] = (0,
|
|
25517
|
-
const [position, setPosition] = (0,
|
|
25518
|
-
(0,
|
|
23857
|
+
const [isVisible, setIsVisible] = (0, import_react49.useState)(false);
|
|
23858
|
+
const [position, setPosition] = (0, import_react49.useState)({ top: 0, left: 0 });
|
|
23859
|
+
(0, import_react49.useEffect)(() => {
|
|
25519
23860
|
const updatePosition = () => {
|
|
25520
23861
|
const { state, view } = editor;
|
|
25521
23862
|
const { $from, empty } = state.selection;
|
|
@@ -25541,8 +23882,8 @@ var CustomFloatingMenu = ({ editor }) => {
|
|
|
25541
23882
|
};
|
|
25542
23883
|
}, [editor]);
|
|
25543
23884
|
if (!isVisible) return null;
|
|
25544
|
-
return (0,
|
|
25545
|
-
/* @__PURE__ */ (0,
|
|
23885
|
+
return (0, import_react_dom8.createPortal)(
|
|
23886
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
25546
23887
|
"div",
|
|
25547
23888
|
{
|
|
25548
23889
|
className: "fixed z-50 rounded-2xl border border-border/50 bg-card text-card-foreground shadow-lg backdrop-blur-sm overflow-hidden animate-in fade-in-0 slide-in-from-bottom-2",
|
|
@@ -25552,7 +23893,7 @@ var CustomFloatingMenu = ({ editor }) => {
|
|
|
25552
23893
|
transform: "translate(-50%, -100%)"
|
|
25553
23894
|
},
|
|
25554
23895
|
onMouseDown: (e) => e.preventDefault(),
|
|
25555
|
-
children: /* @__PURE__ */ (0,
|
|
23896
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(FloatingMenuContent, { editor })
|
|
25556
23897
|
}
|
|
25557
23898
|
),
|
|
25558
23899
|
document.body
|
|
@@ -25560,25 +23901,25 @@ var CustomFloatingMenu = ({ editor }) => {
|
|
|
25560
23901
|
};
|
|
25561
23902
|
|
|
25562
23903
|
// src/components/UEditor/CharacterCount.tsx
|
|
25563
|
-
var
|
|
23904
|
+
var import_jsx_runtime79 = require("react/jsx-runtime");
|
|
25564
23905
|
var CharacterCountDisplay = ({ editor, maxCharacters }) => {
|
|
25565
23906
|
const t = useSmartTranslations("UEditor");
|
|
25566
23907
|
const storage = editor.storage;
|
|
25567
23908
|
const characterCount = storage.characterCount?.characters?.() ?? 0;
|
|
25568
23909
|
const wordCount = storage.characterCount?.words?.() ?? 0;
|
|
25569
23910
|
const percentage = maxCharacters ? Math.round(characterCount / maxCharacters * 100) : 0;
|
|
25570
|
-
return /* @__PURE__ */ (0,
|
|
25571
|
-
/* @__PURE__ */ (0,
|
|
23911
|
+
return /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)("div", { className: "flex items-center gap-3 px-3 py-2 text-xs text-muted-foreground border-t bg-muted/20", children: [
|
|
23912
|
+
/* @__PURE__ */ (0, import_jsx_runtime79.jsxs)("span", { children: [
|
|
25572
23913
|
wordCount,
|
|
25573
23914
|
" ",
|
|
25574
23915
|
t("words")
|
|
25575
23916
|
] }),
|
|
25576
|
-
/* @__PURE__ */ (0,
|
|
23917
|
+
/* @__PURE__ */ (0, import_jsx_runtime79.jsxs)("span", { children: [
|
|
25577
23918
|
characterCount,
|
|
25578
23919
|
" ",
|
|
25579
23920
|
t("characters")
|
|
25580
23921
|
] }),
|
|
25581
|
-
maxCharacters && /* @__PURE__ */ (0,
|
|
23922
|
+
maxCharacters && /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)("span", { className: cn(percentage > 90 && "text-destructive", percentage > 100 && "font-bold"), children: [
|
|
25582
23923
|
characterCount,
|
|
25583
23924
|
"/",
|
|
25584
23925
|
maxCharacters
|
|
@@ -25833,8 +24174,8 @@ async function prepareUEditorContentForSave({
|
|
|
25833
24174
|
}
|
|
25834
24175
|
|
|
25835
24176
|
// src/components/UEditor/UEditor.tsx
|
|
25836
|
-
var
|
|
25837
|
-
var UEditor =
|
|
24177
|
+
var import_jsx_runtime80 = require("react/jsx-runtime");
|
|
24178
|
+
var UEditor = import_react50.default.forwardRef(({
|
|
25838
24179
|
content = "",
|
|
25839
24180
|
onChange,
|
|
25840
24181
|
onHtmlChange,
|
|
@@ -25857,12 +24198,12 @@ var UEditor = import_react58.default.forwardRef(({
|
|
|
25857
24198
|
}, ref) => {
|
|
25858
24199
|
const t = useSmartTranslations("UEditor");
|
|
25859
24200
|
const effectivePlaceholder = placeholder ?? t("placeholder");
|
|
25860
|
-
const inFlightPrepareRef = (0,
|
|
25861
|
-
const extensions = (0,
|
|
24201
|
+
const inFlightPrepareRef = (0, import_react50.useRef)(null);
|
|
24202
|
+
const extensions = (0, import_react50.useMemo)(
|
|
25862
24203
|
() => buildUEditorExtensions({ placeholder: effectivePlaceholder, translate: t, maxCharacters, uploadImage, imageInsertMode, editable }),
|
|
25863
24204
|
[effectivePlaceholder, t, maxCharacters, uploadImage, imageInsertMode, editable]
|
|
25864
24205
|
);
|
|
25865
|
-
const editor = (0,
|
|
24206
|
+
const editor = (0, import_react51.useEditor)({
|
|
25866
24207
|
immediatelyRender: false,
|
|
25867
24208
|
extensions,
|
|
25868
24209
|
content,
|
|
@@ -25976,7 +24317,7 @@ var UEditor = import_react58.default.forwardRef(({
|
|
|
25976
24317
|
onJsonChange?.(editor2.getJSON());
|
|
25977
24318
|
}
|
|
25978
24319
|
});
|
|
25979
|
-
(0,
|
|
24320
|
+
(0, import_react50.useImperativeHandle)(
|
|
25980
24321
|
ref,
|
|
25981
24322
|
() => ({
|
|
25982
24323
|
prepareContentForSave: async ({ throwOnError = false } = {}) => {
|
|
@@ -25998,7 +24339,7 @@ var UEditor = import_react58.default.forwardRef(({
|
|
|
25998
24339
|
}),
|
|
25999
24340
|
[content, editor, uploadImageForSave]
|
|
26000
24341
|
);
|
|
26001
|
-
(0,
|
|
24342
|
+
(0, import_react50.useEffect)(() => {
|
|
26002
24343
|
if (editor && content !== editor.getHTML()) {
|
|
26003
24344
|
if (editor.isEmpty && content) {
|
|
26004
24345
|
editor.commands.setContent(content);
|
|
@@ -26006,7 +24347,7 @@ var UEditor = import_react58.default.forwardRef(({
|
|
|
26006
24347
|
}
|
|
26007
24348
|
}, [content, editor]);
|
|
26008
24349
|
if (!editor) {
|
|
26009
|
-
return /* @__PURE__ */ (0,
|
|
24350
|
+
return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
26010
24351
|
"div",
|
|
26011
24352
|
{
|
|
26012
24353
|
className: cn("w-full rounded-lg border bg-background flex items-center justify-center text-muted-foreground", className),
|
|
@@ -26015,7 +24356,7 @@ var UEditor = import_react58.default.forwardRef(({
|
|
|
26015
24356
|
}
|
|
26016
24357
|
);
|
|
26017
24358
|
}
|
|
26018
|
-
return /* @__PURE__ */ (0,
|
|
24359
|
+
return /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)(
|
|
26019
24360
|
"div",
|
|
26020
24361
|
{
|
|
26021
24362
|
className: cn(
|
|
@@ -26027,11 +24368,11 @@ var UEditor = import_react58.default.forwardRef(({
|
|
|
26027
24368
|
className
|
|
26028
24369
|
),
|
|
26029
24370
|
children: [
|
|
26030
|
-
editable && showToolbar && /* @__PURE__ */ (0,
|
|
26031
|
-
editable && showBubbleMenu && /* @__PURE__ */ (0,
|
|
26032
|
-
editable && showFloatingMenu && /* @__PURE__ */ (0,
|
|
26033
|
-
/* @__PURE__ */ (0,
|
|
26034
|
-
|
|
24371
|
+
editable && showToolbar && /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(EditorToolbar, { editor, variant, uploadImage, imageInsertMode }),
|
|
24372
|
+
editable && showBubbleMenu && /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(CustomBubbleMenu, { editor }),
|
|
24373
|
+
editable && showFloatingMenu && /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(CustomFloatingMenu, { editor }),
|
|
24374
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
24375
|
+
import_react51.EditorContent,
|
|
26035
24376
|
{
|
|
26036
24377
|
editor,
|
|
26037
24378
|
className: "flex-1 overflow-y-auto",
|
|
@@ -26041,7 +24382,7 @@ var UEditor = import_react58.default.forwardRef(({
|
|
|
26041
24382
|
}
|
|
26042
24383
|
}
|
|
26043
24384
|
),
|
|
26044
|
-
showCharacterCount && /* @__PURE__ */ (0,
|
|
24385
|
+
showCharacterCount && /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(CharacterCountDisplay, { editor, maxCharacters })
|
|
26045
24386
|
]
|
|
26046
24387
|
}
|
|
26047
24388
|
);
|
|
@@ -26058,11 +24399,9 @@ function getUnderverseMessages(locale = "en") {
|
|
|
26058
24399
|
0 && (module.exports = {
|
|
26059
24400
|
AccessDenied,
|
|
26060
24401
|
Alert,
|
|
26061
|
-
AreaChart,
|
|
26062
24402
|
Avatar,
|
|
26063
24403
|
Badge,
|
|
26064
24404
|
BadgeBase,
|
|
26065
|
-
BarChart,
|
|
26066
24405
|
BatteryProgress,
|
|
26067
24406
|
BottomSheet,
|
|
26068
24407
|
Breadcrumb,
|
|
@@ -26103,7 +24442,6 @@ function getUnderverseMessages(locale = "en") {
|
|
|
26103
24442
|
FormLabel,
|
|
26104
24443
|
FormMessage,
|
|
26105
24444
|
FormSubmitButton,
|
|
26106
|
-
GaugeChart,
|
|
26107
24445
|
GlobalLoading,
|
|
26108
24446
|
GradientBadge,
|
|
26109
24447
|
Grid,
|
|
@@ -26115,7 +24453,6 @@ function getUnderverseMessages(locale = "en") {
|
|
|
26115
24453
|
Label,
|
|
26116
24454
|
LanguageSwitcher,
|
|
26117
24455
|
LanguageSwitcherHeadless,
|
|
26118
|
-
LineChart,
|
|
26119
24456
|
List,
|
|
26120
24457
|
ListItem,
|
|
26121
24458
|
LoadingBar,
|
|
@@ -26138,12 +24475,10 @@ function getUnderverseMessages(locale = "en") {
|
|
|
26138
24475
|
PageLoading,
|
|
26139
24476
|
Pagination,
|
|
26140
24477
|
PasswordInput,
|
|
26141
|
-
PieChart,
|
|
26142
24478
|
PillTabs,
|
|
26143
24479
|
Popover,
|
|
26144
24480
|
Progress,
|
|
26145
24481
|
PulseBadge,
|
|
26146
|
-
RadarChart,
|
|
26147
24482
|
RadioGroup,
|
|
26148
24483
|
RadioGroupItem,
|
|
26149
24484
|
SIZE_STYLES_BTN,
|
|
@@ -26168,7 +24503,6 @@ function getUnderverseMessages(locale = "en") {
|
|
|
26168
24503
|
SlideOver,
|
|
26169
24504
|
Slider,
|
|
26170
24505
|
SmartImage,
|
|
26171
|
-
Sparkline,
|
|
26172
24506
|
StatusBadge,
|
|
26173
24507
|
StepProgress,
|
|
26174
24508
|
Switch,
|