@enact-ui/charts 0.1.0 → 0.2.0
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-schema.json +169 -0
- package/dist/__tests__/recharts-mock.d.ts +2 -0
- package/dist/__tests__/recharts-mock.d.ts.map +1 -0
- package/dist/__tests__/recharts-mock.js +19 -0
- package/dist/__tests__/recharts-mock.js.map +1 -0
- package/dist/__tests__/test-utils.d.ts +76 -0
- package/dist/__tests__/test-utils.d.ts.map +1 -0
- package/dist/__tests__/test-utils.js +89 -0
- package/dist/__tests__/test-utils.js.map +1 -0
- package/dist/components/activity-gauges.demo.d.ts +5 -0
- package/dist/components/activity-gauges.demo.d.ts.map +1 -1
- package/dist/components/activity-gauges.demo.js +25 -11
- package/dist/components/activity-gauges.demo.js.map +1 -1
- package/dist/components/activity-gauges.story.d.ts +6 -22
- package/dist/components/activity-gauges.story.d.ts.map +1 -1
- package/dist/components/activity-gauges.story.js +19 -11
- package/dist/components/activity-gauges.story.js.map +1 -1
- package/dist/components/bar-charts.demo.d.ts +6 -0
- package/dist/components/bar-charts.demo.d.ts.map +1 -1
- package/dist/components/bar-charts.demo.js +24 -11
- package/dist/components/bar-charts.demo.js.map +1 -1
- package/dist/components/bar-charts.story.d.ts +6 -18
- package/dist/components/bar-charts.story.d.ts.map +1 -1
- package/dist/components/bar-charts.story.js +19 -9
- package/dist/components/bar-charts.story.js.map +1 -1
- package/dist/components/charts-base.d.ts +0 -8
- package/dist/components/charts-base.d.ts.map +1 -1
- package/dist/components/charts-base.js +2 -28
- package/dist/components/charts-base.js.map +1 -1
- package/dist/components/line-charts.demo.d.ts +6 -0
- package/dist/components/line-charts.demo.d.ts.map +1 -1
- package/dist/components/line-charts.demo.js +32 -18
- package/dist/components/line-charts.demo.js.map +1 -1
- package/dist/components/line-charts.story.d.ts +6 -22
- package/dist/components/line-charts.story.d.ts.map +1 -1
- package/dist/components/line-charts.story.js +19 -11
- package/dist/components/line-charts.story.js.map +1 -1
- package/dist/components/pie-charts.demo.d.ts +5 -0
- package/dist/components/pie-charts.demo.d.ts.map +1 -1
- package/dist/components/pie-charts.demo.js +20 -4
- package/dist/components/pie-charts.demo.js.map +1 -1
- package/dist/components/pie-charts.story.d.ts +6 -26
- package/dist/components/pie-charts.story.d.ts.map +1 -1
- package/dist/components/pie-charts.story.js +19 -13
- package/dist/components/pie-charts.story.js.map +1 -1
- package/dist/components/progress-circles.demo.d.ts +7 -0
- package/dist/components/progress-circles.demo.d.ts.map +1 -1
- package/dist/components/progress-circles.demo.js +11 -6
- package/dist/components/progress-circles.demo.js.map +1 -1
- package/dist/components/progress-circles.story.d.ts +6 -38
- package/dist/components/progress-circles.story.d.ts.map +1 -1
- package/dist/components/progress-circles.story.js +23 -19
- package/dist/components/progress-circles.story.js.map +1 -1
- package/dist/components/radar-charts.demo.d.ts +6 -3
- package/dist/components/radar-charts.demo.d.ts.map +1 -1
- package/dist/components/radar-charts.demo.js +18 -10
- package/dist/components/radar-charts.demo.js.map +1 -1
- package/dist/components/radar-charts.story.d.ts +6 -10
- package/dist/components/radar-charts.story.d.ts.map +1 -1
- package/dist/components/radar-charts.story.js +10 -5
- package/dist/components/radar-charts.story.js.map +1 -1
- package/dist/components/relationship-graph.d.ts +64 -0
- package/dist/components/relationship-graph.d.ts.map +1 -0
- package/dist/components/relationship-graph.demo.d.ts +2 -0
- package/dist/components/relationship-graph.demo.d.ts.map +1 -0
- package/dist/components/relationship-graph.demo.js +61 -0
- package/dist/components/relationship-graph.demo.js.map +1 -0
- package/dist/components/relationship-graph.js +381 -0
- package/dist/components/relationship-graph.js.map +1 -0
- package/dist/components/relationship-graph.story.d.ts +6 -0
- package/dist/components/relationship-graph.story.d.ts.map +1 -0
- package/dist/components/relationship-graph.story.js +13 -0
- package/dist/components/relationship-graph.story.js.map +1 -0
- package/dist/components/trend-indicator.d.ts +40 -0
- package/dist/components/trend-indicator.d.ts.map +1 -0
- package/dist/components/trend-indicator.demo.d.ts +2 -0
- package/dist/components/trend-indicator.demo.d.ts.map +1 -0
- package/dist/components/trend-indicator.demo.js +7 -0
- package/dist/components/trend-indicator.demo.js.map +1 -0
- package/dist/components/trend-indicator.js +50 -0
- package/dist/components/trend-indicator.js.map +1 -0
- package/dist/components/trend-indicator.story.d.ts +6 -0
- package/dist/components/trend-indicator.story.d.ts.map +1 -0
- package/dist/components/trend-indicator.story.js +13 -0
- package/dist/components/trend-indicator.story.js.map +1 -0
- package/dist/index.d.ts +9 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1852 -9
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1837 -9
- package/dist/index.mjs.map +1 -1
- package/dist/utils/chart-utils.d.ts +9 -0
- package/dist/utils/chart-utils.d.ts.map +1 -0
- package/dist/utils/chart-utils.js +26 -0
- package/dist/utils/chart-utils.js.map +1 -0
- package/package.json +8 -3
package/dist/index.js
CHANGED
|
@@ -20,16 +20,33 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// src/index.ts
|
|
21
21
|
var index_exports = {};
|
|
22
22
|
__export(index_exports, {
|
|
23
|
+
BarChart: () => BarChart,
|
|
24
|
+
BarChart02: () => BarChart02,
|
|
25
|
+
BarChart03: () => BarChart03,
|
|
23
26
|
ChartActiveDot: () => ChartActiveDot,
|
|
24
27
|
ChartLegendContent: () => ChartLegendContent,
|
|
25
28
|
ChartTooltipContent: () => ChartTooltipContent,
|
|
29
|
+
LineChart01: () => LineChart01,
|
|
30
|
+
LineChart02: () => LineChart02,
|
|
31
|
+
LineChart03: () => LineChart03,
|
|
32
|
+
LineChart04: () => LineChart04,
|
|
33
|
+
PieChartLg: () => PieChartLg,
|
|
34
|
+
PieChartMd: () => PieChartMd,
|
|
35
|
+
PieChartSm: () => PieChartSm,
|
|
36
|
+
PieChartXs: () => PieChartXs,
|
|
37
|
+
PieChartXxs: () => PieChartXxs,
|
|
38
|
+
RelationshipGraph: () => RelationshipGraph,
|
|
39
|
+
TrendBadge: () => TrendBadge,
|
|
40
|
+
TrendIndicator: () => TrendIndicator,
|
|
26
41
|
selectEvenlySpacedItems: () => selectEvenlySpacedItems
|
|
27
42
|
});
|
|
28
43
|
module.exports = __toCommonJS(index_exports);
|
|
29
44
|
|
|
30
|
-
// src/components/charts
|
|
31
|
-
var
|
|
32
|
-
var
|
|
45
|
+
// src/components/bar-charts.demo.tsx
|
|
46
|
+
var import_react2 = require("@enact-ui/react");
|
|
47
|
+
var import_recharts = require("recharts");
|
|
48
|
+
|
|
49
|
+
// src/utils/chart-utils.ts
|
|
33
50
|
var selectEvenlySpacedItems = (dataArray, count) => {
|
|
34
51
|
if (!dataArray || dataArray.length === 0) {
|
|
35
52
|
return [];
|
|
@@ -48,6 +65,10 @@ var selectEvenlySpacedItems = (dataArray, count) => {
|
|
|
48
65
|
}
|
|
49
66
|
return selectedItems;
|
|
50
67
|
};
|
|
68
|
+
|
|
69
|
+
// src/components/charts-base.tsx
|
|
70
|
+
var import_react = require("@enact-ui/react");
|
|
71
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
51
72
|
var ChartLegendContent = ({ reversed, payload, align, layout, className }) => {
|
|
52
73
|
payload = reversed ? payload?.toReversed() : payload;
|
|
53
74
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
@@ -58,7 +79,7 @@ var ChartLegendContent = ({ reversed, payload, align, layout, className }) => {
|
|
|
58
79
|
layout === "vertical" ? `flex-col gap-1 pl-4 ${align === "center" ? "items-center" : align === "right" ? "items-start" : "items-start"}` : `flex-row gap-3 ${align === "center" ? "justify-center" : align === "right" ? "justify-end" : "justify-start"}`,
|
|
59
80
|
className
|
|
60
81
|
),
|
|
61
|
-
children: payload?.map((entry, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("li", { className: "text-
|
|
82
|
+
children: payload?.map((entry, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("li", { className: "text-content-tertiary flex items-center gap-2 text-sm", children: [
|
|
62
83
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: (0, import_react.cx)("h-2 w-2 rounded-full bg-current", entry.payload?.className) }),
|
|
63
84
|
entry.value
|
|
64
85
|
] }, entry.value ?? index))
|
|
@@ -75,23 +96,1845 @@ var ChartTooltipContent = ({ active, payload, label, isRadialChart, isPieChart,
|
|
|
75
96
|
let secondaryTitle = isSingleDataPoint ? isRadialChart ? payload[0].payload.name : isPieChart ? payload[0].name : label : payload;
|
|
76
97
|
title = isSingleDataPoint && formatter ? formatter(title, payload?.[0].name || label, payload[0], 0, payload) : labelFormatter ? labelFormatter(title, payload) : title;
|
|
77
98
|
secondaryTitle = isSingleDataPoint && labelFormatter ? labelFormatter(secondaryTitle, payload) : secondaryTitle;
|
|
78
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "bg-
|
|
79
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-xs font-semibold text-
|
|
80
|
-
!secondaryTitle ? null : Array.isArray(secondaryTitle) ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { children: secondaryTitle.map((entry, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: (0, import_react.cx)("text-xs text-
|
|
99
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "bg-primary-solid flex flex-col gap-0.5 rounded-lg px-3 py-2 shadow-lg", children: [
|
|
100
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-xs font-semibold text-content-on-brand", children: title }),
|
|
101
|
+
!secondaryTitle ? null : Array.isArray(secondaryTitle) ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { children: secondaryTitle.map((entry, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: (0, import_react.cx)("text-xs text-content-tertiary"), children: `${entry.name}: ${formatter ? formatter(entry.value, entry.name, entry, index, entry.payload) : entry.value}` }, entry.name ?? index)) }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-xs text-content-tertiary", children: secondaryTitle })
|
|
81
102
|
] });
|
|
82
103
|
};
|
|
83
|
-
var ChartActiveDot = ({ cx:
|
|
104
|
+
var ChartActiveDot = ({ cx: cx5 = 0, cy = 0 }) => {
|
|
84
105
|
const size = 12;
|
|
85
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("svg", { x:
|
|
106
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("svg", { x: cx5 - size / 2, y: cy - size / 2, width: size, height: size, viewBox: "0 0 12 12", fill: "none", children: [
|
|
86
107
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("title", { children: "Active data point indicator" }),
|
|
87
108
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("rect", { x: "2", y: "2", width: "8", height: "8", rx: "6", className: "stroke-brand-medium fill-bg-base", strokeWidth: "2" })
|
|
88
109
|
] });
|
|
89
110
|
};
|
|
111
|
+
|
|
112
|
+
// src/components/bar-charts.demo.tsx
|
|
113
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
114
|
+
var barData = [
|
|
115
|
+
// collapse-start
|
|
116
|
+
{
|
|
117
|
+
month: new Date(2025, 0, 1),
|
|
118
|
+
A: 300,
|
|
119
|
+
B: 200,
|
|
120
|
+
C: 350
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
month: new Date(2025, 1, 1),
|
|
124
|
+
A: 320,
|
|
125
|
+
B: 300,
|
|
126
|
+
C: 300
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
month: new Date(2025, 2, 1),
|
|
130
|
+
A: 300,
|
|
131
|
+
B: 200,
|
|
132
|
+
C: 240
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
month: new Date(2025, 3, 1),
|
|
136
|
+
A: 240,
|
|
137
|
+
B: 300,
|
|
138
|
+
C: 280
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
month: new Date(2025, 4, 1),
|
|
142
|
+
A: 320,
|
|
143
|
+
B: 280,
|
|
144
|
+
C: 100
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
month: new Date(2025, 5, 1),
|
|
148
|
+
A: 330,
|
|
149
|
+
B: 300,
|
|
150
|
+
C: 130
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
month: new Date(2025, 6, 1),
|
|
154
|
+
A: 300,
|
|
155
|
+
B: 200,
|
|
156
|
+
C: 100
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
month: new Date(2025, 7, 1),
|
|
160
|
+
A: 350,
|
|
161
|
+
B: 300,
|
|
162
|
+
C: 200
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
month: new Date(2025, 8, 1),
|
|
166
|
+
A: 300,
|
|
167
|
+
B: 200,
|
|
168
|
+
C: 100
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
month: new Date(2025, 9, 1),
|
|
172
|
+
A: 200,
|
|
173
|
+
B: 300,
|
|
174
|
+
C: 280
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
month: new Date(2025, 10, 1),
|
|
178
|
+
A: 240,
|
|
179
|
+
B: 300,
|
|
180
|
+
C: 300
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
month: new Date(2025, 11, 1),
|
|
184
|
+
A: 200,
|
|
185
|
+
B: 400,
|
|
186
|
+
C: 350
|
|
187
|
+
}
|
|
188
|
+
// collapse-end
|
|
189
|
+
];
|
|
190
|
+
var BarChart = () => {
|
|
191
|
+
const isDesktop = (0, import_react2.useBreakpoint)("lg");
|
|
192
|
+
const colors = {
|
|
193
|
+
A: "text-content-brand",
|
|
194
|
+
B: "text-content-brand",
|
|
195
|
+
C: "text-content-tertiary"
|
|
196
|
+
};
|
|
197
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_recharts.ResponsiveContainer, { className: "h-60!", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
198
|
+
import_recharts.BarChart,
|
|
199
|
+
{
|
|
200
|
+
data: barData,
|
|
201
|
+
className: "text-content-tertiary [&_.recharts-text]:text-xs",
|
|
202
|
+
margin: {
|
|
203
|
+
left: 4,
|
|
204
|
+
right: 0,
|
|
205
|
+
top: isDesktop ? 12 : 6,
|
|
206
|
+
bottom: 18
|
|
207
|
+
},
|
|
208
|
+
children: [
|
|
209
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_recharts.CartesianGrid, { vertical: false, stroke: "currentColor", className: "text-content-tertiary" }),
|
|
210
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
211
|
+
import_recharts.Legend,
|
|
212
|
+
{
|
|
213
|
+
verticalAlign: "top",
|
|
214
|
+
align: "right",
|
|
215
|
+
layout: isDesktop ? "vertical" : "horizontal",
|
|
216
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(ChartLegendContent, { className: "-translate-y-2" })
|
|
217
|
+
}
|
|
218
|
+
),
|
|
219
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
220
|
+
import_recharts.XAxis,
|
|
221
|
+
{
|
|
222
|
+
fill: "currentColor",
|
|
223
|
+
axisLine: false,
|
|
224
|
+
tickLine: false,
|
|
225
|
+
tickMargin: 11,
|
|
226
|
+
interval: "preserveStartEnd",
|
|
227
|
+
dataKey: "month",
|
|
228
|
+
tickFormatter: (value) => value.toLocaleDateString(void 0, { month: "short" }),
|
|
229
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_recharts.Label, { value: "Month", fill: "currentColor", className: "!text-xs font-medium", position: "bottom" })
|
|
230
|
+
}
|
|
231
|
+
),
|
|
232
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
233
|
+
import_recharts.YAxis,
|
|
234
|
+
{
|
|
235
|
+
fill: "currentColor",
|
|
236
|
+
axisLine: false,
|
|
237
|
+
tickLine: false,
|
|
238
|
+
interval: "preserveStartEnd",
|
|
239
|
+
tickFormatter: (value) => Number(value).toLocaleString(),
|
|
240
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
241
|
+
import_recharts.Label,
|
|
242
|
+
{
|
|
243
|
+
value: "Active users",
|
|
244
|
+
fill: "currentColor",
|
|
245
|
+
className: "!text-xs font-medium",
|
|
246
|
+
style: { textAnchor: "middle" },
|
|
247
|
+
angle: -90,
|
|
248
|
+
position: "insideLeft"
|
|
249
|
+
}
|
|
250
|
+
)
|
|
251
|
+
}
|
|
252
|
+
),
|
|
253
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
254
|
+
import_recharts.Tooltip,
|
|
255
|
+
{
|
|
256
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(ChartTooltipContent, {}),
|
|
257
|
+
formatter: (value) => Number(value).toLocaleString(),
|
|
258
|
+
labelFormatter: (value) => value.toLocaleDateString(void 0, { month: "short", year: "numeric" }),
|
|
259
|
+
cursor: {
|
|
260
|
+
className: "fill-gray-light_hover/20"
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
),
|
|
264
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
265
|
+
import_recharts.Bar,
|
|
266
|
+
{
|
|
267
|
+
isAnimationActive: false,
|
|
268
|
+
...colors.A !== void 0 && { className: colors.A },
|
|
269
|
+
dataKey: "A",
|
|
270
|
+
name: "Series 1",
|
|
271
|
+
type: "monotone",
|
|
272
|
+
stackId: "a",
|
|
273
|
+
fill: "currentColor",
|
|
274
|
+
maxBarSize: isDesktop ? 32 : 16
|
|
275
|
+
}
|
|
276
|
+
),
|
|
277
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
278
|
+
import_recharts.Bar,
|
|
279
|
+
{
|
|
280
|
+
isAnimationActive: false,
|
|
281
|
+
...colors.B !== void 0 && { className: colors.B },
|
|
282
|
+
dataKey: "B",
|
|
283
|
+
name: "Series 2",
|
|
284
|
+
type: "monotone",
|
|
285
|
+
stackId: "a",
|
|
286
|
+
fill: "currentColor",
|
|
287
|
+
maxBarSize: isDesktop ? 32 : 16
|
|
288
|
+
}
|
|
289
|
+
),
|
|
290
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
291
|
+
import_recharts.Bar,
|
|
292
|
+
{
|
|
293
|
+
isAnimationActive: false,
|
|
294
|
+
...colors.C !== void 0 && { className: colors.C },
|
|
295
|
+
dataKey: "C",
|
|
296
|
+
name: "Series 3",
|
|
297
|
+
type: "monotone",
|
|
298
|
+
stackId: "a",
|
|
299
|
+
fill: "currentColor",
|
|
300
|
+
maxBarSize: isDesktop ? 32 : 16,
|
|
301
|
+
radius: [6, 6, 0, 0]
|
|
302
|
+
}
|
|
303
|
+
)
|
|
304
|
+
]
|
|
305
|
+
}
|
|
306
|
+
) });
|
|
307
|
+
};
|
|
308
|
+
var BarChart02 = () => {
|
|
309
|
+
const colors = {
|
|
310
|
+
A: "text-content-brand",
|
|
311
|
+
B: "text-brand-subtle"
|
|
312
|
+
};
|
|
313
|
+
const data = [
|
|
314
|
+
// collapse-start
|
|
315
|
+
{ A: 633, B: 190, date: "2025-01-01" },
|
|
316
|
+
{ A: 443, B: 228, date: "2025-01-08" },
|
|
317
|
+
{ A: 506, B: 225, date: "2025-01-15" },
|
|
318
|
+
{ A: 316, B: 227, date: "2025-01-22" },
|
|
319
|
+
{ A: 760, B: 209, date: "2025-01-29" },
|
|
320
|
+
{ A: 950, B: 220, date: "2025-02-05" },
|
|
321
|
+
{ A: 760, B: 224, date: "2025-02-12" },
|
|
322
|
+
{ A: 570, B: 279, date: "2025-02-19" },
|
|
323
|
+
{ A: 253, B: 296, date: "2025-02-26" },
|
|
324
|
+
{ A: 380, B: 263, date: "2025-03-05" },
|
|
325
|
+
{ A: 443, B: 333, date: "2025-03-12" },
|
|
326
|
+
{ A: 443, B: 306, date: "2025-03-19" },
|
|
327
|
+
{ A: 316, B: 315, date: "2025-03-26" },
|
|
328
|
+
{ A: 190, B: 325, date: "2025-04-02" },
|
|
329
|
+
{ A: 380, B: 367, date: "2025-04-09" },
|
|
330
|
+
{ A: 506, B: 372, date: "2025-04-16" },
|
|
331
|
+
{ A: 443, B: 374, date: "2025-04-23" },
|
|
332
|
+
{ A: 696, B: 278, date: "2025-04-30" },
|
|
333
|
+
{ A: 950, B: 258, date: "2025-05-07" },
|
|
334
|
+
{ A: 633, B: 357, date: "2025-05-14" },
|
|
335
|
+
{ A: 570, B: 372, date: "2025-05-21" },
|
|
336
|
+
{ A: 253, B: 404, date: "2025-05-28" },
|
|
337
|
+
{ A: 316, B: 314, date: "2025-06-04" },
|
|
338
|
+
{ A: 380, B: 359, date: "2025-06-11" },
|
|
339
|
+
{ A: 253, B: 400, date: "2025-06-18" },
|
|
340
|
+
{ A: 190, B: 381, date: "2025-06-25" },
|
|
341
|
+
{ A: 316, B: 427, date: "2025-07-02" },
|
|
342
|
+
{ A: 633, B: 371, date: "2025-07-09" },
|
|
343
|
+
{ A: 570, B: 382, date: "2025-07-16" },
|
|
344
|
+
{ A: 760, B: 383, date: "2025-07-23" },
|
|
345
|
+
{ A: 950, B: 361, date: "2025-07-30" },
|
|
346
|
+
{ A: 696, B: 405, date: "2025-08-06" },
|
|
347
|
+
{ A: 570, B: 400, date: "2025-08-13" },
|
|
348
|
+
{ A: 443, B: 391, date: "2025-08-20" },
|
|
349
|
+
{ A: 316, B: 425, date: "2025-08-27" },
|
|
350
|
+
{ A: 253, B: 406, date: "2025-09-03" },
|
|
351
|
+
{ A: 380, B: 472, date: "2025-09-10" },
|
|
352
|
+
{ A: 633, B: 477, date: "2025-09-17" },
|
|
353
|
+
{ A: 570, B: 465, date: "2025-09-24" },
|
|
354
|
+
{ A: 443, B: 488, date: "2025-10-01" },
|
|
355
|
+
{ A: 380, B: 501, date: "2025-10-08" },
|
|
356
|
+
{ A: 316, B: 615, date: "2025-10-15" },
|
|
357
|
+
{ A: 570, B: 612, date: "2025-10-22" },
|
|
358
|
+
{ A: 506, B: 673, date: "2025-10-29" },
|
|
359
|
+
{ A: 443, B: 630, date: "2025-11-05" },
|
|
360
|
+
{ A: 760, B: 630, date: "2025-11-12" },
|
|
361
|
+
{ A: 443, B: 597, date: "2025-11-19" },
|
|
362
|
+
{ A: 506, B: 572, date: "2025-11-26" },
|
|
363
|
+
{ A: 316, B: 636, date: "2025-12-03" },
|
|
364
|
+
{ A: 633, B: 664, date: "2025-12-10" },
|
|
365
|
+
{ A: 380, B: 742, date: "2025-12-17" },
|
|
366
|
+
{ A: 633, B: 808, date: "2025-12-24" }
|
|
367
|
+
// collapse-end
|
|
368
|
+
];
|
|
369
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "flex h-60 flex-col gap-2", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_recharts.ResponsiveContainer, { className: "h-full", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
370
|
+
import_recharts.ComposedChart,
|
|
371
|
+
{
|
|
372
|
+
data,
|
|
373
|
+
margin: {
|
|
374
|
+
left: 4,
|
|
375
|
+
right: 0,
|
|
376
|
+
top: 12,
|
|
377
|
+
bottom: 18
|
|
378
|
+
},
|
|
379
|
+
className: "text-content-tertiary [&_.recharts-text]:text-xs",
|
|
380
|
+
children: [
|
|
381
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_recharts.CartesianGrid, { vertical: false, stroke: "currentColor", className: "text-content-tertiary" }),
|
|
382
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
383
|
+
import_recharts.XAxis,
|
|
384
|
+
{
|
|
385
|
+
fill: "currentColor",
|
|
386
|
+
axisLine: false,
|
|
387
|
+
tickLine: false,
|
|
388
|
+
tickMargin: 12,
|
|
389
|
+
interval: "preserveStartEnd",
|
|
390
|
+
dataKey: "date",
|
|
391
|
+
tickFormatter: (value) => new Date(value).toLocaleDateString(void 0, { month: "short" }),
|
|
392
|
+
ticks: selectEvenlySpacedItems(data, 12).map((item) => item.date),
|
|
393
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_recharts.Label, { value: "Month", fill: "currentColor", className: "!text-xs font-medium", position: "bottom" })
|
|
394
|
+
}
|
|
395
|
+
),
|
|
396
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
397
|
+
import_recharts.YAxis,
|
|
398
|
+
{
|
|
399
|
+
fill: "currentColor",
|
|
400
|
+
axisLine: false,
|
|
401
|
+
tickLine: false,
|
|
402
|
+
interval: "preserveStartEnd",
|
|
403
|
+
tickFormatter: (value) => Number(value).toLocaleString(),
|
|
404
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
405
|
+
import_recharts.Label,
|
|
406
|
+
{
|
|
407
|
+
value: "Active users",
|
|
408
|
+
fill: "currentColor",
|
|
409
|
+
className: "!text-xs font-medium",
|
|
410
|
+
style: { textAnchor: "middle" },
|
|
411
|
+
angle: -90,
|
|
412
|
+
position: "insideLeft"
|
|
413
|
+
}
|
|
414
|
+
)
|
|
415
|
+
}
|
|
416
|
+
),
|
|
417
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
418
|
+
import_recharts.Tooltip,
|
|
419
|
+
{
|
|
420
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(ChartTooltipContent, {}),
|
|
421
|
+
formatter: (value) => Number(value).toLocaleString(),
|
|
422
|
+
labelFormatter: (value) => {
|
|
423
|
+
const date = new Date(value);
|
|
424
|
+
const endDate = new Date(date);
|
|
425
|
+
endDate.setDate(date.getDate() + 6);
|
|
426
|
+
if (date.getMonth() === endDate.getMonth()) {
|
|
427
|
+
return `${date.toLocaleDateString(void 0, { month: "long" })} ${date.getDate()}-${endDate.getDate()}, ${endDate.getFullYear()}`;
|
|
428
|
+
}
|
|
429
|
+
return `${date.toLocaleDateString(void 0, { month: "short", day: "numeric" })} - ${endDate.toLocaleDateString(void 0, { month: "short", day: "numeric", year: "numeric" })}`;
|
|
430
|
+
},
|
|
431
|
+
cursor: {
|
|
432
|
+
className: "fill-gray-light_hover/20"
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
),
|
|
436
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
437
|
+
import_recharts.Bar,
|
|
438
|
+
{
|
|
439
|
+
isAnimationActive: false,
|
|
440
|
+
...colors.A !== void 0 && { className: colors.A },
|
|
441
|
+
name: "Mobile",
|
|
442
|
+
dataKey: "A",
|
|
443
|
+
type: "monotone",
|
|
444
|
+
stackId: "a",
|
|
445
|
+
fill: "currentColor",
|
|
446
|
+
maxBarSize: 12,
|
|
447
|
+
radius: [4, 4, 0, 0]
|
|
448
|
+
}
|
|
449
|
+
),
|
|
450
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
451
|
+
import_recharts.Line,
|
|
452
|
+
{
|
|
453
|
+
isAnimationActive: false,
|
|
454
|
+
...colors.B !== void 0 && { className: colors.B },
|
|
455
|
+
dataKey: "B",
|
|
456
|
+
name: "Desktop",
|
|
457
|
+
type: "monotone",
|
|
458
|
+
stroke: "currentColor",
|
|
459
|
+
strokeWidth: 2,
|
|
460
|
+
strokeDasharray: "0.1 8",
|
|
461
|
+
strokeLinecap: "round",
|
|
462
|
+
activeDot: false,
|
|
463
|
+
dot: false
|
|
464
|
+
}
|
|
465
|
+
)
|
|
466
|
+
]
|
|
467
|
+
}
|
|
468
|
+
) }) });
|
|
469
|
+
};
|
|
470
|
+
var BarChart03 = () => {
|
|
471
|
+
const colors = {
|
|
472
|
+
A: "text-content-brand",
|
|
473
|
+
B: "text-brand-subtle"
|
|
474
|
+
};
|
|
475
|
+
const data = [
|
|
476
|
+
// collapse-start
|
|
477
|
+
{ A: 633, B: 190, date: "2025-01-01" },
|
|
478
|
+
{ A: 443, B: 228, date: "2025-01-08" },
|
|
479
|
+
{ A: 506, B: 225, date: "2025-01-15" },
|
|
480
|
+
{ A: 316, B: 227, date: "2025-01-22" },
|
|
481
|
+
{ A: 760, B: 209, date: "2025-01-29" },
|
|
482
|
+
{ A: 950, B: 220, date: "2025-02-05" },
|
|
483
|
+
{ A: 760, B: 224, date: "2025-02-12" },
|
|
484
|
+
{ A: 570, B: 279, date: "2025-02-19" },
|
|
485
|
+
{ A: 253, B: 296, date: "2025-02-26" },
|
|
486
|
+
{ A: 380, B: 263, date: "2025-03-05" },
|
|
487
|
+
{ A: 443, B: 333, date: "2025-03-12" },
|
|
488
|
+
{ A: 443, B: 306, date: "2025-03-19" },
|
|
489
|
+
{ A: 316, B: 315, date: "2025-03-26" },
|
|
490
|
+
{ A: 190, B: 325, date: "2025-04-02" },
|
|
491
|
+
{ A: 380, B: 367, date: "2025-04-09" },
|
|
492
|
+
{ A: 506, B: 372, date: "2025-04-16" },
|
|
493
|
+
{ A: 443, B: 374, date: "2025-04-23" },
|
|
494
|
+
{ A: 696, B: 278, date: "2025-04-30" },
|
|
495
|
+
{ A: 950, B: 258, date: "2025-05-07" },
|
|
496
|
+
{ A: 633, B: 357, date: "2025-05-14" },
|
|
497
|
+
{ A: 570, B: 372, date: "2025-05-21" },
|
|
498
|
+
{ A: 253, B: 404, date: "2025-05-28" },
|
|
499
|
+
{ A: 316, B: 314, date: "2025-06-04" },
|
|
500
|
+
{ A: 380, B: 359, date: "2025-06-11" },
|
|
501
|
+
{ A: 253, B: 400, date: "2025-06-18" },
|
|
502
|
+
{ A: 190, B: 381, date: "2025-06-25" },
|
|
503
|
+
{ A: 316, B: 427, date: "2025-07-02" },
|
|
504
|
+
{ A: 633, B: 371, date: "2025-07-09" },
|
|
505
|
+
{ A: 570, B: 382, date: "2025-07-16" },
|
|
506
|
+
{ A: 760, B: 383, date: "2025-07-23" },
|
|
507
|
+
{ A: 950, B: 361, date: "2025-07-30" },
|
|
508
|
+
{ A: 696, B: 405, date: "2025-08-06" },
|
|
509
|
+
{ A: 570, B: 400, date: "2025-08-13" },
|
|
510
|
+
{ A: 443, B: 391, date: "2025-08-20" },
|
|
511
|
+
{ A: 316, B: 425, date: "2025-08-27" },
|
|
512
|
+
{ A: 253, B: 406, date: "2025-09-03" },
|
|
513
|
+
{ A: 380, B: 472, date: "2025-09-10" },
|
|
514
|
+
{ A: 633, B: 477, date: "2025-09-17" },
|
|
515
|
+
{ A: 570, B: 465, date: "2025-09-24" },
|
|
516
|
+
{ A: 443, B: 488, date: "2025-10-01" },
|
|
517
|
+
{ A: 380, B: 501, date: "2025-10-08" },
|
|
518
|
+
{ A: 316, B: 615, date: "2025-10-15" },
|
|
519
|
+
{ A: 570, B: 612, date: "2025-10-22" },
|
|
520
|
+
{ A: 506, B: 673, date: "2025-10-29" },
|
|
521
|
+
{ A: 443, B: 630, date: "2025-11-05" },
|
|
522
|
+
{ A: 760, B: 630, date: "2025-11-12" },
|
|
523
|
+
{ A: 443, B: 597, date: "2025-11-19" },
|
|
524
|
+
{ A: 506, B: 572, date: "2025-11-26" },
|
|
525
|
+
{ A: 316, B: 636, date: "2025-12-03" },
|
|
526
|
+
{ A: 633, B: 664, date: "2025-12-10" },
|
|
527
|
+
{ A: 380, B: 742, date: "2025-12-17" },
|
|
528
|
+
{ A: 633, B: 808, date: "2025-12-24" }
|
|
529
|
+
// collapse-end
|
|
530
|
+
];
|
|
531
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "flex h-60 flex-col gap-2", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_recharts.ResponsiveContainer, { className: "h-full", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
532
|
+
import_recharts.ComposedChart,
|
|
533
|
+
{
|
|
534
|
+
data,
|
|
535
|
+
margin: {
|
|
536
|
+
left: 4,
|
|
537
|
+
right: 0,
|
|
538
|
+
top: 12,
|
|
539
|
+
bottom: 18
|
|
540
|
+
},
|
|
541
|
+
className: "text-content-tertiary [&_.recharts-text]:text-xs",
|
|
542
|
+
children: [
|
|
543
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_recharts.CartesianGrid, { vertical: false, stroke: "currentColor", className: "text-content-tertiary" }),
|
|
544
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
545
|
+
import_recharts.XAxis,
|
|
546
|
+
{
|
|
547
|
+
fill: "currentColor",
|
|
548
|
+
axisLine: false,
|
|
549
|
+
tickLine: false,
|
|
550
|
+
tickMargin: 12,
|
|
551
|
+
interval: "preserveStartEnd",
|
|
552
|
+
dataKey: "date",
|
|
553
|
+
tickFormatter: (value) => new Date(value).toLocaleDateString(void 0, { month: "short" }),
|
|
554
|
+
ticks: selectEvenlySpacedItems(data, 12).map((item) => item.date),
|
|
555
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_recharts.Label, { value: "Month", fill: "currentColor", className: "!text-xs font-medium", position: "bottom" })
|
|
556
|
+
}
|
|
557
|
+
),
|
|
558
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
559
|
+
import_recharts.YAxis,
|
|
560
|
+
{
|
|
561
|
+
fill: "currentColor",
|
|
562
|
+
axisLine: false,
|
|
563
|
+
tickLine: false,
|
|
564
|
+
interval: "preserveStartEnd",
|
|
565
|
+
tickFormatter: (value) => Number(value).toLocaleString(),
|
|
566
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
567
|
+
import_recharts.Label,
|
|
568
|
+
{
|
|
569
|
+
value: "Active users",
|
|
570
|
+
fill: "currentColor",
|
|
571
|
+
className: "!text-xs font-medium",
|
|
572
|
+
style: { textAnchor: "middle" },
|
|
573
|
+
angle: -90,
|
|
574
|
+
position: "insideLeft"
|
|
575
|
+
}
|
|
576
|
+
)
|
|
577
|
+
}
|
|
578
|
+
),
|
|
579
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
580
|
+
import_recharts.Tooltip,
|
|
581
|
+
{
|
|
582
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(ChartTooltipContent, {}),
|
|
583
|
+
formatter: (value) => Number(value).toLocaleString(),
|
|
584
|
+
labelFormatter: (value) => {
|
|
585
|
+
const date = new Date(value);
|
|
586
|
+
const endDate = new Date(date);
|
|
587
|
+
endDate.setDate(date.getDate() + 6);
|
|
588
|
+
if (date.getMonth() === endDate.getMonth()) {
|
|
589
|
+
return `${date.toLocaleDateString(void 0, { month: "long" })} ${date.getDate()}-${endDate.getDate()}, ${endDate.getFullYear()}`;
|
|
590
|
+
}
|
|
591
|
+
return `${date.toLocaleDateString(void 0, { month: "short", day: "numeric" })} - ${endDate.toLocaleDateString(void 0, { month: "short", day: "numeric", year: "numeric" })}`;
|
|
592
|
+
},
|
|
593
|
+
cursor: {
|
|
594
|
+
className: "fill-gray-light_hover/20"
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
),
|
|
598
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
599
|
+
import_recharts.Bar,
|
|
600
|
+
{
|
|
601
|
+
isAnimationActive: false,
|
|
602
|
+
...colors.A !== void 0 && { className: colors.A },
|
|
603
|
+
name: "Mobile",
|
|
604
|
+
dataKey: "A",
|
|
605
|
+
type: "monotone",
|
|
606
|
+
stackId: "a",
|
|
607
|
+
fill: "currentColor",
|
|
608
|
+
maxBarSize: 8,
|
|
609
|
+
radius: [4, 4, 0, 0]
|
|
610
|
+
}
|
|
611
|
+
),
|
|
612
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
613
|
+
import_recharts.Line,
|
|
614
|
+
{
|
|
615
|
+
isAnimationActive: false,
|
|
616
|
+
...colors.B !== void 0 && { className: colors.B },
|
|
617
|
+
dataKey: "B",
|
|
618
|
+
name: "Desktop",
|
|
619
|
+
type: "monotone",
|
|
620
|
+
stroke: "currentColor",
|
|
621
|
+
strokeWidth: 2,
|
|
622
|
+
strokeDasharray: "0.1 8",
|
|
623
|
+
strokeLinecap: "round",
|
|
624
|
+
activeDot: false,
|
|
625
|
+
dot: false
|
|
626
|
+
}
|
|
627
|
+
)
|
|
628
|
+
]
|
|
629
|
+
}
|
|
630
|
+
) }) });
|
|
631
|
+
};
|
|
632
|
+
|
|
633
|
+
// src/components/line-charts.demo.tsx
|
|
634
|
+
var import_react3 = require("@enact-ui/react");
|
|
635
|
+
var import_recharts2 = require("recharts");
|
|
636
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
637
|
+
var lineData = [
|
|
638
|
+
// collapse-start
|
|
639
|
+
{
|
|
640
|
+
date: new Date(2025, 0, 1),
|
|
641
|
+
A: 600,
|
|
642
|
+
B: 400,
|
|
643
|
+
C: 100
|
|
644
|
+
},
|
|
645
|
+
{
|
|
646
|
+
date: new Date(2025, 1, 1),
|
|
647
|
+
A: 620,
|
|
648
|
+
B: 405,
|
|
649
|
+
C: 160
|
|
650
|
+
},
|
|
651
|
+
{
|
|
652
|
+
date: new Date(2025, 2, 1),
|
|
653
|
+
A: 630,
|
|
654
|
+
B: 400,
|
|
655
|
+
C: 170
|
|
656
|
+
},
|
|
657
|
+
{
|
|
658
|
+
date: new Date(2025, 3, 1),
|
|
659
|
+
A: 650,
|
|
660
|
+
B: 410,
|
|
661
|
+
C: 190
|
|
662
|
+
},
|
|
663
|
+
{
|
|
664
|
+
date: new Date(2025, 4, 1),
|
|
665
|
+
A: 600,
|
|
666
|
+
B: 320,
|
|
667
|
+
C: 200
|
|
668
|
+
},
|
|
669
|
+
{
|
|
670
|
+
date: new Date(2025, 5, 1),
|
|
671
|
+
A: 650,
|
|
672
|
+
B: 430,
|
|
673
|
+
C: 230
|
|
674
|
+
},
|
|
675
|
+
{
|
|
676
|
+
date: new Date(2025, 6, 1),
|
|
677
|
+
A: 620,
|
|
678
|
+
B: 400,
|
|
679
|
+
C: 200
|
|
680
|
+
},
|
|
681
|
+
{
|
|
682
|
+
date: new Date(2025, 7, 1),
|
|
683
|
+
A: 750,
|
|
684
|
+
B: 540,
|
|
685
|
+
C: 300
|
|
686
|
+
},
|
|
687
|
+
{
|
|
688
|
+
date: new Date(2025, 8, 1),
|
|
689
|
+
A: 780,
|
|
690
|
+
B: 490,
|
|
691
|
+
C: 390
|
|
692
|
+
},
|
|
693
|
+
{
|
|
694
|
+
date: new Date(2025, 9, 1),
|
|
695
|
+
A: 750,
|
|
696
|
+
B: 450,
|
|
697
|
+
C: 300
|
|
698
|
+
},
|
|
699
|
+
{
|
|
700
|
+
date: new Date(2025, 10, 1),
|
|
701
|
+
A: 780,
|
|
702
|
+
B: 480,
|
|
703
|
+
C: 340
|
|
704
|
+
},
|
|
705
|
+
{
|
|
706
|
+
date: new Date(2025, 11, 1),
|
|
707
|
+
A: 820,
|
|
708
|
+
B: 500,
|
|
709
|
+
C: 450
|
|
710
|
+
}
|
|
711
|
+
// collapse-end
|
|
712
|
+
];
|
|
713
|
+
var LineChart01 = () => {
|
|
714
|
+
const isDesktop = (0, import_react3.useBreakpoint)("lg");
|
|
715
|
+
const colors = {
|
|
716
|
+
A: "text-content-brand",
|
|
717
|
+
B: "text-brand-subtle",
|
|
718
|
+
C: "text-content-brand"
|
|
719
|
+
};
|
|
720
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "flex h-60 flex-col gap-2", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_recharts2.ResponsiveContainer, { className: "h-full", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
721
|
+
import_recharts2.AreaChart,
|
|
722
|
+
{
|
|
723
|
+
data: lineData,
|
|
724
|
+
className: "text-content-tertiary [&_.recharts-text]:text-xs",
|
|
725
|
+
margin: {
|
|
726
|
+
top: isDesktop ? 12 : 6,
|
|
727
|
+
bottom: isDesktop ? 16 : 0
|
|
728
|
+
},
|
|
729
|
+
children: [
|
|
730
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("linearGradient", { id: "gradient", x1: "0", y1: "0", x2: "0", y2: "1", children: [
|
|
731
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("stop", { offset: "5%", stopColor: "currentColor", className: "text-content-brand", stopOpacity: "0.7" }),
|
|
732
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("stop", { offset: "95%", stopColor: "currentColor", className: "text-content-brand", stopOpacity: "0" })
|
|
733
|
+
] }) }),
|
|
734
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_recharts2.CartesianGrid, { vertical: false, stroke: "currentColor", className: "text-content-tertiary" }),
|
|
735
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
736
|
+
import_recharts2.Legend,
|
|
737
|
+
{
|
|
738
|
+
align: "right",
|
|
739
|
+
verticalAlign: "top",
|
|
740
|
+
layout: isDesktop ? "vertical" : "horizontal",
|
|
741
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ChartLegendContent, { className: "-translate-y-2" })
|
|
742
|
+
}
|
|
743
|
+
),
|
|
744
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
745
|
+
import_recharts2.XAxis,
|
|
746
|
+
{
|
|
747
|
+
fill: "currentColor",
|
|
748
|
+
axisLine: false,
|
|
749
|
+
tickLine: false,
|
|
750
|
+
interval: "preserveStartEnd",
|
|
751
|
+
dataKey: "date",
|
|
752
|
+
tickFormatter: (value) => value.toLocaleDateString(void 0, { month: "short" }),
|
|
753
|
+
padding: { left: 10, right: 10 },
|
|
754
|
+
children: isDesktop && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_recharts2.Label, { fill: "currentColor", className: "!text-xs font-medium max-lg:hidden", position: "bottom", children: "Month" })
|
|
755
|
+
}
|
|
756
|
+
),
|
|
757
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
758
|
+
import_recharts2.YAxis,
|
|
759
|
+
{
|
|
760
|
+
fill: "currentColor",
|
|
761
|
+
axisLine: false,
|
|
762
|
+
tickLine: false,
|
|
763
|
+
interval: "preserveStartEnd",
|
|
764
|
+
tickFormatter: (value) => Number(value).toLocaleString(),
|
|
765
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
766
|
+
import_recharts2.Label,
|
|
767
|
+
{
|
|
768
|
+
value: "Active users",
|
|
769
|
+
fill: "currentColor",
|
|
770
|
+
className: "!text-xs font-medium",
|
|
771
|
+
style: { textAnchor: "middle" },
|
|
772
|
+
angle: -90,
|
|
773
|
+
position: "insideLeft"
|
|
774
|
+
}
|
|
775
|
+
)
|
|
776
|
+
}
|
|
777
|
+
),
|
|
778
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
779
|
+
import_recharts2.Tooltip,
|
|
780
|
+
{
|
|
781
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ChartTooltipContent, {}),
|
|
782
|
+
formatter: (value) => Number(value).toLocaleString(),
|
|
783
|
+
labelFormatter: (value) => value.toLocaleDateString(void 0, { month: "short", year: "numeric" }),
|
|
784
|
+
cursor: {
|
|
785
|
+
className: "stroke-brand-medium stroke-2"
|
|
786
|
+
}
|
|
787
|
+
}
|
|
788
|
+
),
|
|
789
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
790
|
+
import_recharts2.Area,
|
|
791
|
+
{
|
|
792
|
+
isAnimationActive: false,
|
|
793
|
+
className: (0, import_react3.cx)(colors.A, "[&_.recharts-area-area]:translate-y-1.5 [&_.recharts-area-area]:[clip-path:inset(0_0_6px_0)]"),
|
|
794
|
+
dataKey: "A",
|
|
795
|
+
name: "Series 1",
|
|
796
|
+
type: "monotone",
|
|
797
|
+
stroke: "currentColor",
|
|
798
|
+
strokeWidth: 2,
|
|
799
|
+
fill: "url(#gradient)",
|
|
800
|
+
fillOpacity: 0.1,
|
|
801
|
+
activeDot: {
|
|
802
|
+
className: "fill-bg-base stroke-brand-medium stroke-2"
|
|
803
|
+
}
|
|
804
|
+
}
|
|
805
|
+
),
|
|
806
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
807
|
+
import_recharts2.Area,
|
|
808
|
+
{
|
|
809
|
+
isAnimationActive: false,
|
|
810
|
+
className: (0, import_react3.cx)(colors.B, "[&_.recharts-area-area]:translate-y-1.5 [&_.recharts-area-area]:[clip-path:inset(0_0_6px_0)]"),
|
|
811
|
+
dataKey: "B",
|
|
812
|
+
name: "Series 2",
|
|
813
|
+
type: "monotone",
|
|
814
|
+
stroke: "currentColor",
|
|
815
|
+
strokeWidth: 2,
|
|
816
|
+
fill: "none",
|
|
817
|
+
activeDot: {
|
|
818
|
+
className: "fill-bg-base stroke-brand-medium stroke-2"
|
|
819
|
+
}
|
|
820
|
+
}
|
|
821
|
+
),
|
|
822
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
823
|
+
import_recharts2.Area,
|
|
824
|
+
{
|
|
825
|
+
isAnimationActive: false,
|
|
826
|
+
className: (0, import_react3.cx)(colors.C, "[&_.recharts-area-area]:translate-y-1.5 [&_.recharts-area-area]:[clip-path:inset(0_0_6px_0)]"),
|
|
827
|
+
dataKey: "C",
|
|
828
|
+
name: "Series 3",
|
|
829
|
+
type: "monotone",
|
|
830
|
+
stroke: "currentColor",
|
|
831
|
+
strokeWidth: 2,
|
|
832
|
+
fill: "none",
|
|
833
|
+
activeDot: {
|
|
834
|
+
className: "fill-bg-base stroke-brand-medium stroke-2"
|
|
835
|
+
}
|
|
836
|
+
}
|
|
837
|
+
)
|
|
838
|
+
]
|
|
839
|
+
}
|
|
840
|
+
) }) });
|
|
841
|
+
};
|
|
842
|
+
var LineChart02 = () => {
|
|
843
|
+
const isDesktop = (0, import_react3.useBreakpoint)("lg");
|
|
844
|
+
const colors = {
|
|
845
|
+
A: "text-content-brand",
|
|
846
|
+
B: "text-brand-subtle",
|
|
847
|
+
C: "text-content-brand"
|
|
848
|
+
};
|
|
849
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "flex h-60 flex-col gap-2", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_recharts2.ResponsiveContainer, { className: "h-full", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
850
|
+
import_recharts2.AreaChart,
|
|
851
|
+
{
|
|
852
|
+
data: lineData,
|
|
853
|
+
className: "text-content-tertiary [&_.recharts-text]:text-xs",
|
|
854
|
+
margin: {
|
|
855
|
+
left: 5,
|
|
856
|
+
right: 5,
|
|
857
|
+
top: isDesktop ? 12 : 6,
|
|
858
|
+
bottom: isDesktop ? 16 : 0
|
|
859
|
+
},
|
|
860
|
+
children: [
|
|
861
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("linearGradient", { id: "gradient", x1: "0", y1: "0", x2: "0", y2: "1", children: [
|
|
862
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("stop", { offset: "5%", stopColor: "currentColor", className: "text-content-brand", stopOpacity: "0.7" }),
|
|
863
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("stop", { offset: "95%", stopColor: "currentColor", className: "text-content-brand", stopOpacity: "0" })
|
|
864
|
+
] }) }),
|
|
865
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_recharts2.CartesianGrid, { vertical: false, stroke: "currentColor", className: "text-content-tertiary" }),
|
|
866
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
867
|
+
import_recharts2.Legend,
|
|
868
|
+
{
|
|
869
|
+
verticalAlign: "top",
|
|
870
|
+
align: "right",
|
|
871
|
+
layout: isDesktop ? "vertical" : "horizontal",
|
|
872
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ChartLegendContent, { className: "-translate-y-2" })
|
|
873
|
+
}
|
|
874
|
+
),
|
|
875
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
876
|
+
import_recharts2.XAxis,
|
|
877
|
+
{
|
|
878
|
+
fill: "currentColor",
|
|
879
|
+
axisLine: false,
|
|
880
|
+
tickLine: false,
|
|
881
|
+
interval: "preserveStartEnd",
|
|
882
|
+
dataKey: "date",
|
|
883
|
+
tickFormatter: (value) => value.toLocaleDateString(void 0, { month: "short" }),
|
|
884
|
+
padding: { left: 10, right: 10 },
|
|
885
|
+
children: isDesktop && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_recharts2.Label, { fill: "currentColor", className: "!text-xs font-medium max-lg:hidden", position: "bottom", children: "Month" })
|
|
886
|
+
}
|
|
887
|
+
),
|
|
888
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
889
|
+
import_recharts2.YAxis,
|
|
890
|
+
{
|
|
891
|
+
fill: "currentColor",
|
|
892
|
+
axisLine: false,
|
|
893
|
+
tickLine: false,
|
|
894
|
+
interval: "preserveStartEnd",
|
|
895
|
+
tickFormatter: (value) => Number(value).toLocaleString(),
|
|
896
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
897
|
+
import_recharts2.Label,
|
|
898
|
+
{
|
|
899
|
+
value: "Active users",
|
|
900
|
+
fill: "currentColor",
|
|
901
|
+
className: "!text-xs font-medium",
|
|
902
|
+
style: { textAnchor: "middle" },
|
|
903
|
+
angle: -90,
|
|
904
|
+
position: "insideLeft"
|
|
905
|
+
}
|
|
906
|
+
)
|
|
907
|
+
}
|
|
908
|
+
),
|
|
909
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
910
|
+
import_recharts2.Tooltip,
|
|
911
|
+
{
|
|
912
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ChartTooltipContent, {}),
|
|
913
|
+
formatter: (value) => Number(value).toLocaleString(),
|
|
914
|
+
labelFormatter: (value) => value.toLocaleDateString(void 0, { month: "short", year: "numeric" }),
|
|
915
|
+
cursor: {
|
|
916
|
+
className: "stroke-brand-medium stroke-2"
|
|
917
|
+
}
|
|
918
|
+
}
|
|
919
|
+
),
|
|
920
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
921
|
+
import_recharts2.Area,
|
|
922
|
+
{
|
|
923
|
+
isAnimationActive: false,
|
|
924
|
+
className: (0, import_react3.cx)(colors.A, "[&_.recharts-area-area]:translate-y-1.5 [&_.recharts-area-area]:[clip-path:inset(0_0_6px_0)]"),
|
|
925
|
+
dataKey: "A",
|
|
926
|
+
name: "Series 1",
|
|
927
|
+
type: "monotone",
|
|
928
|
+
stroke: "currentColor",
|
|
929
|
+
strokeWidth: 2,
|
|
930
|
+
fill: "url(#gradient)",
|
|
931
|
+
fillOpacity: 0.1,
|
|
932
|
+
activeDot: {
|
|
933
|
+
className: "fill-bg-base stroke-brand-medium stroke-2"
|
|
934
|
+
}
|
|
935
|
+
}
|
|
936
|
+
),
|
|
937
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
938
|
+
import_recharts2.Area,
|
|
939
|
+
{
|
|
940
|
+
isAnimationActive: false,
|
|
941
|
+
className: (0, import_react3.cx)(colors.B, "[&_.recharts-area-area]:translate-y-1.5 [&_.recharts-area-area]:[clip-path:inset(0_0_6px_0)]"),
|
|
942
|
+
dataKey: "B",
|
|
943
|
+
name: "Series 2",
|
|
944
|
+
type: "monotone",
|
|
945
|
+
stroke: "currentColor",
|
|
946
|
+
strokeWidth: 2,
|
|
947
|
+
fill: "none",
|
|
948
|
+
strokeDasharray: "0.1 8",
|
|
949
|
+
strokeLinecap: "round",
|
|
950
|
+
activeDot: {
|
|
951
|
+
className: "fill-bg-base stroke-brand-medium stroke-2"
|
|
952
|
+
}
|
|
953
|
+
}
|
|
954
|
+
),
|
|
955
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
956
|
+
import_recharts2.Area,
|
|
957
|
+
{
|
|
958
|
+
isAnimationActive: false,
|
|
959
|
+
className: (0, import_react3.cx)(colors.C, "[&_.recharts-area-area]:translate-y-1.5 [&_.recharts-area-area]:[clip-path:inset(0_0_6px_0)]"),
|
|
960
|
+
dataKey: "C",
|
|
961
|
+
name: "Series 3",
|
|
962
|
+
type: "monotone",
|
|
963
|
+
stroke: "currentColor",
|
|
964
|
+
strokeWidth: 2,
|
|
965
|
+
fill: "none",
|
|
966
|
+
strokeDasharray: "0.1 8",
|
|
967
|
+
strokeLinecap: "round",
|
|
968
|
+
activeDot: {
|
|
969
|
+
className: "fill-bg-base stroke-brand-medium stroke-2"
|
|
970
|
+
}
|
|
971
|
+
}
|
|
972
|
+
)
|
|
973
|
+
]
|
|
974
|
+
}
|
|
975
|
+
) }) });
|
|
976
|
+
};
|
|
977
|
+
var LineChart03 = () => {
|
|
978
|
+
const isDesktop = (0, import_react3.useBreakpoint)("lg");
|
|
979
|
+
const colors = {
|
|
980
|
+
A: "text-content-brand",
|
|
981
|
+
B: "text-brand-subtle",
|
|
982
|
+
C: "text-content-brand"
|
|
983
|
+
};
|
|
984
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "flex h-60 flex-col gap-2", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_recharts2.ResponsiveContainer, { className: "h-full", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
985
|
+
import_recharts2.AreaChart,
|
|
986
|
+
{
|
|
987
|
+
data: lineData,
|
|
988
|
+
className: "text-content-tertiary [&_.recharts-text]:text-xs",
|
|
989
|
+
margin: {
|
|
990
|
+
left: 5,
|
|
991
|
+
right: 5,
|
|
992
|
+
top: isDesktop ? 12 : 6,
|
|
993
|
+
bottom: isDesktop ? 16 : 0
|
|
994
|
+
},
|
|
995
|
+
children: [
|
|
996
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("defs", { children: [
|
|
997
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("linearGradient", { id: "gradient", x1: "0", y1: "0", x2: "0", y2: "1", children: [
|
|
998
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("stop", { offset: "0%", stopColor: "currentColor", className: "text-content-secondary", stopOpacity: "0.8" }),
|
|
999
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("stop", { offset: "80%", stopColor: "currentColor", className: "text-content-secondary", stopOpacity: "0" })
|
|
1000
|
+
] }),
|
|
1001
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("pattern", { id: "verticalLines", width: "8", height: "100%", fill: "url(#gradient)", patternUnits: "userSpaceOnUse", children: [
|
|
1002
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("line", { x1: "0", y1: "0", x2: "0", y2: "100%", stroke: "currentColor", className: "text-content-tertiary", strokeWidth: "1.5" }),
|
|
1003
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("rect", { width: "100%", height: "100%", fill: "url(#gradient)", fillOpacity: 0.15 })
|
|
1004
|
+
] })
|
|
1005
|
+
] }),
|
|
1006
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_recharts2.CartesianGrid, { vertical: false, stroke: "currentColor", className: "text-content-tertiary" }),
|
|
1007
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1008
|
+
import_recharts2.Legend,
|
|
1009
|
+
{
|
|
1010
|
+
verticalAlign: "top",
|
|
1011
|
+
align: "right",
|
|
1012
|
+
layout: isDesktop ? "vertical" : "horizontal",
|
|
1013
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ChartLegendContent, { className: "-translate-y-2" })
|
|
1014
|
+
}
|
|
1015
|
+
),
|
|
1016
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1017
|
+
import_recharts2.XAxis,
|
|
1018
|
+
{
|
|
1019
|
+
fill: "currentColor",
|
|
1020
|
+
axisLine: false,
|
|
1021
|
+
tickLine: false,
|
|
1022
|
+
tickMargin: 10,
|
|
1023
|
+
interval: "preserveStartEnd",
|
|
1024
|
+
dataKey: "date",
|
|
1025
|
+
padding: { left: 10, right: 10 },
|
|
1026
|
+
tickFormatter: (value) => value.toLocaleDateString(void 0, { month: "short" }),
|
|
1027
|
+
children: isDesktop && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_recharts2.Label, { fill: "currentColor", className: "!text-xs font-medium max-lg:hidden", position: "bottom", children: "Month" })
|
|
1028
|
+
}
|
|
1029
|
+
),
|
|
1030
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1031
|
+
import_recharts2.YAxis,
|
|
1032
|
+
{
|
|
1033
|
+
fill: "currentColor",
|
|
1034
|
+
axisLine: false,
|
|
1035
|
+
tickLine: false,
|
|
1036
|
+
interval: "preserveStartEnd",
|
|
1037
|
+
tickFormatter: (value) => Number(value).toLocaleString(),
|
|
1038
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1039
|
+
import_recharts2.Label,
|
|
1040
|
+
{
|
|
1041
|
+
value: "Active users",
|
|
1042
|
+
fill: "currentColor",
|
|
1043
|
+
className: "!text-xs font-medium",
|
|
1044
|
+
style: { textAnchor: "middle" },
|
|
1045
|
+
angle: -90,
|
|
1046
|
+
position: "insideLeft"
|
|
1047
|
+
}
|
|
1048
|
+
)
|
|
1049
|
+
}
|
|
1050
|
+
),
|
|
1051
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1052
|
+
import_recharts2.Tooltip,
|
|
1053
|
+
{
|
|
1054
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ChartTooltipContent, {}),
|
|
1055
|
+
formatter: (value) => Number(value).toLocaleString(),
|
|
1056
|
+
labelFormatter: (value) => value.toLocaleDateString(void 0, { month: "short", year: "numeric" }),
|
|
1057
|
+
cursor: {
|
|
1058
|
+
className: "stroke-brand-medium stroke-2"
|
|
1059
|
+
}
|
|
1060
|
+
}
|
|
1061
|
+
),
|
|
1062
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1063
|
+
import_recharts2.Area,
|
|
1064
|
+
{
|
|
1065
|
+
isAnimationActive: false,
|
|
1066
|
+
className: (0, import_react3.cx)(colors.A, "[&_.recharts-area-area]:translate-y-1.5 [&_.recharts-area-area]:[clip-path:inset(0_0_6px_0)]"),
|
|
1067
|
+
dataKey: "A",
|
|
1068
|
+
name: "Series 1",
|
|
1069
|
+
type: "monotone",
|
|
1070
|
+
stroke: "currentColor",
|
|
1071
|
+
strokeWidth: 2,
|
|
1072
|
+
fill: "url(#verticalLines)",
|
|
1073
|
+
fillOpacity: 1,
|
|
1074
|
+
activeDot: {
|
|
1075
|
+
className: "fill-bg-base stroke-brand-medium stroke-2"
|
|
1076
|
+
}
|
|
1077
|
+
}
|
|
1078
|
+
),
|
|
1079
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1080
|
+
import_recharts2.Area,
|
|
1081
|
+
{
|
|
1082
|
+
isAnimationActive: false,
|
|
1083
|
+
className: (0, import_react3.cx)(colors.B, "[&_.recharts-area-area]:translate-y-1.5 [&_.recharts-area-area]:[clip-path:inset(0_0_6px_0)]"),
|
|
1084
|
+
dataKey: "B",
|
|
1085
|
+
name: "Series 2",
|
|
1086
|
+
type: "monotone",
|
|
1087
|
+
stroke: "currentColor",
|
|
1088
|
+
strokeWidth: 2,
|
|
1089
|
+
fill: "none",
|
|
1090
|
+
activeDot: {
|
|
1091
|
+
className: "fill-bg-base stroke-brand-medium stroke-2"
|
|
1092
|
+
}
|
|
1093
|
+
}
|
|
1094
|
+
),
|
|
1095
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1096
|
+
import_recharts2.Area,
|
|
1097
|
+
{
|
|
1098
|
+
isAnimationActive: false,
|
|
1099
|
+
className: (0, import_react3.cx)(colors.C, "[&_.recharts-area-area]:translate-y-1.5 [&_.recharts-area-area]:[clip-path:inset(0_0_6px_0)]"),
|
|
1100
|
+
dataKey: "C",
|
|
1101
|
+
name: "Series 3",
|
|
1102
|
+
type: "monotone",
|
|
1103
|
+
stroke: "currentColor",
|
|
1104
|
+
strokeWidth: 2,
|
|
1105
|
+
fill: "none",
|
|
1106
|
+
activeDot: {
|
|
1107
|
+
className: "fill-bg-base stroke-brand-medium stroke-2"
|
|
1108
|
+
}
|
|
1109
|
+
}
|
|
1110
|
+
)
|
|
1111
|
+
]
|
|
1112
|
+
}
|
|
1113
|
+
) }) });
|
|
1114
|
+
};
|
|
1115
|
+
var LineChart04 = () => {
|
|
1116
|
+
const isDesktop = (0, import_react3.useBreakpoint)("lg");
|
|
1117
|
+
const colors = {
|
|
1118
|
+
A: "text-content-brand",
|
|
1119
|
+
B: "text-content-secondary",
|
|
1120
|
+
C: "text-content-tertiary"
|
|
1121
|
+
};
|
|
1122
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "flex h-60 flex-col gap-2", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_recharts2.ResponsiveContainer, { className: "h-full", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|
|
1123
|
+
import_recharts2.AreaChart,
|
|
1124
|
+
{
|
|
1125
|
+
data: lineData,
|
|
1126
|
+
className: "text-content-tertiary [&_.recharts-text]:text-xs",
|
|
1127
|
+
margin: {
|
|
1128
|
+
left: 5,
|
|
1129
|
+
right: 5,
|
|
1130
|
+
top: isDesktop ? 12 : 6,
|
|
1131
|
+
bottom: isDesktop ? 16 : 0
|
|
1132
|
+
},
|
|
1133
|
+
children: [
|
|
1134
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("linearGradient", { id: "gradient", x1: "0", y1: "0", x2: "0", y2: "1", children: [
|
|
1135
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("stop", { offset: "5%", stopColor: "currentColor", className: "text-content-secondary", stopOpacity: "0.7" }),
|
|
1136
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("stop", { offset: "95%", stopColor: "currentColor", className: "text-content-secondary", stopOpacity: "0" })
|
|
1137
|
+
] }) }),
|
|
1138
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_recharts2.CartesianGrid, { vertical: false, stroke: "currentColor", className: "text-content-tertiary" }),
|
|
1139
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1140
|
+
import_recharts2.Legend,
|
|
1141
|
+
{
|
|
1142
|
+
verticalAlign: "top",
|
|
1143
|
+
align: "right",
|
|
1144
|
+
layout: isDesktop ? "vertical" : "horizontal",
|
|
1145
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ChartLegendContent, { className: "-translate-y-2" })
|
|
1146
|
+
}
|
|
1147
|
+
),
|
|
1148
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1149
|
+
import_recharts2.XAxis,
|
|
1150
|
+
{
|
|
1151
|
+
fill: "currentColor",
|
|
1152
|
+
axisLine: false,
|
|
1153
|
+
tickLine: false,
|
|
1154
|
+
tickMargin: 10,
|
|
1155
|
+
interval: "preserveStartEnd",
|
|
1156
|
+
dataKey: "date",
|
|
1157
|
+
tickFormatter: (value) => value.toLocaleDateString(void 0, { month: "short" }),
|
|
1158
|
+
padding: { left: 10, right: 10 },
|
|
1159
|
+
children: isDesktop && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_recharts2.Label, { fill: "currentColor", className: "!text-xs font-medium max-lg:hidden", position: "bottom", children: "Month" })
|
|
1160
|
+
}
|
|
1161
|
+
),
|
|
1162
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1163
|
+
import_recharts2.YAxis,
|
|
1164
|
+
{
|
|
1165
|
+
fill: "currentColor",
|
|
1166
|
+
axisLine: false,
|
|
1167
|
+
tickLine: false,
|
|
1168
|
+
interval: "preserveStartEnd",
|
|
1169
|
+
tickFormatter: (value) => Number(value).toLocaleString(),
|
|
1170
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1171
|
+
import_recharts2.Label,
|
|
1172
|
+
{
|
|
1173
|
+
value: "Active users",
|
|
1174
|
+
fill: "currentColor",
|
|
1175
|
+
className: "!text-xs font-medium",
|
|
1176
|
+
style: { textAnchor: "middle" },
|
|
1177
|
+
angle: -90,
|
|
1178
|
+
position: "insideLeft"
|
|
1179
|
+
}
|
|
1180
|
+
)
|
|
1181
|
+
}
|
|
1182
|
+
),
|
|
1183
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1184
|
+
import_recharts2.Tooltip,
|
|
1185
|
+
{
|
|
1186
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ChartTooltipContent, {}),
|
|
1187
|
+
formatter: (value) => Number(value).toLocaleString(),
|
|
1188
|
+
labelFormatter: (value) => value.toLocaleDateString(void 0, { month: "short", year: "numeric" }),
|
|
1189
|
+
cursor: {
|
|
1190
|
+
className: "stroke-brand-medium stroke-2"
|
|
1191
|
+
}
|
|
1192
|
+
}
|
|
1193
|
+
),
|
|
1194
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1195
|
+
import_recharts2.Area,
|
|
1196
|
+
{
|
|
1197
|
+
isAnimationActive: false,
|
|
1198
|
+
className: (0, import_react3.cx)(colors.A, "[&_.recharts-area-area]:translate-y-1.5 [&_.recharts-area-area]:[clip-path:inset(0_0_6px_0)]"),
|
|
1199
|
+
dataKey: "A",
|
|
1200
|
+
name: "Series 1",
|
|
1201
|
+
type: "monotone",
|
|
1202
|
+
stroke: "currentColor",
|
|
1203
|
+
strokeWidth: 2,
|
|
1204
|
+
fill: "url(#gradient)",
|
|
1205
|
+
fillOpacity: 0.1,
|
|
1206
|
+
activeDot: {
|
|
1207
|
+
className: "fill-bg-base stroke-brand-medium stroke-2"
|
|
1208
|
+
}
|
|
1209
|
+
}
|
|
1210
|
+
),
|
|
1211
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1212
|
+
import_recharts2.Area,
|
|
1213
|
+
{
|
|
1214
|
+
isAnimationActive: false,
|
|
1215
|
+
className: (0, import_react3.cx)(colors.B, "[&_.recharts-area-area]:translate-y-1.5 [&_.recharts-area-area]:[clip-path:inset(0_0_6px_0)]"),
|
|
1216
|
+
dataKey: "B",
|
|
1217
|
+
name: "Series 2",
|
|
1218
|
+
type: "monotone",
|
|
1219
|
+
stroke: "currentColor",
|
|
1220
|
+
strokeWidth: 2,
|
|
1221
|
+
fill: "none",
|
|
1222
|
+
activeDot: {
|
|
1223
|
+
className: "fill-bg-base stroke-brand-medium stroke-2"
|
|
1224
|
+
}
|
|
1225
|
+
}
|
|
1226
|
+
),
|
|
1227
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1228
|
+
import_recharts2.Area,
|
|
1229
|
+
{
|
|
1230
|
+
isAnimationActive: false,
|
|
1231
|
+
className: (0, import_react3.cx)(colors.C, "[&_.recharts-area-area]:translate-y-1.5 [&_.recharts-area-area]:[clip-path:inset(0_0_6px_0)]"),
|
|
1232
|
+
dataKey: "C",
|
|
1233
|
+
name: "Series 3",
|
|
1234
|
+
type: "monotone",
|
|
1235
|
+
stroke: "currentColor",
|
|
1236
|
+
strokeWidth: 2,
|
|
1237
|
+
fill: "none",
|
|
1238
|
+
activeDot: {
|
|
1239
|
+
className: "fill-bg-base stroke-brand-medium stroke-2"
|
|
1240
|
+
}
|
|
1241
|
+
}
|
|
1242
|
+
)
|
|
1243
|
+
]
|
|
1244
|
+
}
|
|
1245
|
+
) }) });
|
|
1246
|
+
};
|
|
1247
|
+
|
|
1248
|
+
// src/components/pie-charts.demo.tsx
|
|
1249
|
+
var import_recharts3 = require("recharts");
|
|
1250
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
1251
|
+
var pieChartData = [
|
|
1252
|
+
// collapse-start
|
|
1253
|
+
{
|
|
1254
|
+
name: "Series 1",
|
|
1255
|
+
value: 200,
|
|
1256
|
+
className: "text-content-brand"
|
|
1257
|
+
},
|
|
1258
|
+
{
|
|
1259
|
+
name: "Series 2",
|
|
1260
|
+
value: 350,
|
|
1261
|
+
className: "text-content-brand"
|
|
1262
|
+
},
|
|
1263
|
+
{
|
|
1264
|
+
name: "Series 3",
|
|
1265
|
+
value: 100,
|
|
1266
|
+
className: "text-brand-subtle"
|
|
1267
|
+
},
|
|
1268
|
+
{
|
|
1269
|
+
name: "Series 4",
|
|
1270
|
+
value: 120,
|
|
1271
|
+
className: "text-brand-subtle"
|
|
1272
|
+
},
|
|
1273
|
+
{
|
|
1274
|
+
name: "Series 5",
|
|
1275
|
+
value: 230,
|
|
1276
|
+
className: "text-content-tertiary"
|
|
1277
|
+
}
|
|
1278
|
+
// collapse-end
|
|
1279
|
+
];
|
|
1280
|
+
var PieChartXxs = ({ data = pieChartData }) => {
|
|
1281
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_recharts3.ResponsiveContainer, { height: 120, className: "max-w-52.5", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
1282
|
+
import_recharts3.PieChart,
|
|
1283
|
+
{
|
|
1284
|
+
margin: {
|
|
1285
|
+
left: 0,
|
|
1286
|
+
right: 0,
|
|
1287
|
+
top: 0,
|
|
1288
|
+
bottom: 0
|
|
1289
|
+
},
|
|
1290
|
+
children: [
|
|
1291
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_recharts3.Legend, { verticalAlign: "top", align: "right", layout: "vertical", content: ChartLegendContent }),
|
|
1292
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_recharts3.Tooltip, { content: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ChartTooltipContent, { isPieChart: true }) }),
|
|
1293
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1294
|
+
import_recharts3.Pie,
|
|
1295
|
+
{
|
|
1296
|
+
isAnimationActive: false,
|
|
1297
|
+
startAngle: -270,
|
|
1298
|
+
endAngle: -630,
|
|
1299
|
+
stroke: "none",
|
|
1300
|
+
data,
|
|
1301
|
+
dataKey: "value",
|
|
1302
|
+
nameKey: "name",
|
|
1303
|
+
fill: "currentColor",
|
|
1304
|
+
innerRadius: 30,
|
|
1305
|
+
outerRadius: 60
|
|
1306
|
+
}
|
|
1307
|
+
)
|
|
1308
|
+
]
|
|
1309
|
+
}
|
|
1310
|
+
) });
|
|
1311
|
+
};
|
|
1312
|
+
var PieChartXs = ({ data = pieChartData }) => {
|
|
1313
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_recharts3.ResponsiveContainer, { height: 160, className: "max-w-62.5", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
1314
|
+
import_recharts3.PieChart,
|
|
1315
|
+
{
|
|
1316
|
+
margin: {
|
|
1317
|
+
left: 0,
|
|
1318
|
+
right: 0,
|
|
1319
|
+
top: 0,
|
|
1320
|
+
bottom: 0
|
|
1321
|
+
},
|
|
1322
|
+
children: [
|
|
1323
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_recharts3.Legend, { verticalAlign: "top", align: "right", layout: "vertical", content: ChartLegendContent }),
|
|
1324
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_recharts3.Tooltip, { content: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ChartTooltipContent, { isPieChart: true }) }),
|
|
1325
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1326
|
+
import_recharts3.Pie,
|
|
1327
|
+
{
|
|
1328
|
+
isAnimationActive: false,
|
|
1329
|
+
startAngle: -270,
|
|
1330
|
+
endAngle: -630,
|
|
1331
|
+
stroke: "none",
|
|
1332
|
+
data,
|
|
1333
|
+
dataKey: "value",
|
|
1334
|
+
nameKey: "name",
|
|
1335
|
+
fill: "currentColor",
|
|
1336
|
+
innerRadius: 40,
|
|
1337
|
+
outerRadius: 80
|
|
1338
|
+
}
|
|
1339
|
+
)
|
|
1340
|
+
]
|
|
1341
|
+
}
|
|
1342
|
+
) });
|
|
1343
|
+
};
|
|
1344
|
+
var PieChartSm = ({ data = pieChartData }) => {
|
|
1345
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_recharts3.ResponsiveContainer, { height: 200, className: "max-w-72.5", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
1346
|
+
import_recharts3.PieChart,
|
|
1347
|
+
{
|
|
1348
|
+
margin: {
|
|
1349
|
+
left: 0,
|
|
1350
|
+
right: 0,
|
|
1351
|
+
top: 0,
|
|
1352
|
+
bottom: 0
|
|
1353
|
+
},
|
|
1354
|
+
children: [
|
|
1355
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_recharts3.Legend, { verticalAlign: "top", align: "right", layout: "vertical", content: ChartLegendContent }),
|
|
1356
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_recharts3.Tooltip, { content: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ChartTooltipContent, { isPieChart: true }) }),
|
|
1357
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1358
|
+
import_recharts3.Pie,
|
|
1359
|
+
{
|
|
1360
|
+
isAnimationActive: false,
|
|
1361
|
+
startAngle: -270,
|
|
1362
|
+
endAngle: -630,
|
|
1363
|
+
stroke: "none",
|
|
1364
|
+
data,
|
|
1365
|
+
dataKey: "value",
|
|
1366
|
+
nameKey: "name",
|
|
1367
|
+
fill: "currentColor",
|
|
1368
|
+
innerRadius: 50,
|
|
1369
|
+
outerRadius: 100
|
|
1370
|
+
}
|
|
1371
|
+
)
|
|
1372
|
+
]
|
|
1373
|
+
}
|
|
1374
|
+
) });
|
|
1375
|
+
};
|
|
1376
|
+
var PieChartMd = ({ data = pieChartData }) => {
|
|
1377
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_recharts3.ResponsiveContainer, { height: 240, className: "max-w-96", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
1378
|
+
import_recharts3.PieChart,
|
|
1379
|
+
{
|
|
1380
|
+
margin: {
|
|
1381
|
+
left: 0,
|
|
1382
|
+
right: 0,
|
|
1383
|
+
top: 0,
|
|
1384
|
+
bottom: 0
|
|
1385
|
+
},
|
|
1386
|
+
children: [
|
|
1387
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_recharts3.Legend, { verticalAlign: "top", align: "right", layout: "vertical", content: ChartLegendContent }),
|
|
1388
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_recharts3.Tooltip, { content: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ChartTooltipContent, { isPieChart: true }) }),
|
|
1389
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1390
|
+
import_recharts3.Pie,
|
|
1391
|
+
{
|
|
1392
|
+
isAnimationActive: false,
|
|
1393
|
+
startAngle: -270,
|
|
1394
|
+
endAngle: -630,
|
|
1395
|
+
stroke: "none",
|
|
1396
|
+
data,
|
|
1397
|
+
dataKey: "value",
|
|
1398
|
+
nameKey: "name",
|
|
1399
|
+
fill: "currentColor",
|
|
1400
|
+
innerRadius: 60,
|
|
1401
|
+
outerRadius: 120
|
|
1402
|
+
}
|
|
1403
|
+
)
|
|
1404
|
+
]
|
|
1405
|
+
}
|
|
1406
|
+
) });
|
|
1407
|
+
};
|
|
1408
|
+
var PieChartLg = ({ data = pieChartData }) => {
|
|
1409
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_recharts3.ResponsiveContainer, { height: 280, className: "max-w-96", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
1410
|
+
import_recharts3.PieChart,
|
|
1411
|
+
{
|
|
1412
|
+
margin: {
|
|
1413
|
+
left: 0,
|
|
1414
|
+
right: 0,
|
|
1415
|
+
top: 0,
|
|
1416
|
+
bottom: 0
|
|
1417
|
+
},
|
|
1418
|
+
children: [
|
|
1419
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_recharts3.Legend, { verticalAlign: "top", align: "right", layout: "vertical", content: ChartLegendContent }),
|
|
1420
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_recharts3.Tooltip, { content: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ChartTooltipContent, { isPieChart: true }) }),
|
|
1421
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1422
|
+
import_recharts3.Pie,
|
|
1423
|
+
{
|
|
1424
|
+
isAnimationActive: false,
|
|
1425
|
+
startAngle: -270,
|
|
1426
|
+
endAngle: -630,
|
|
1427
|
+
stroke: "none",
|
|
1428
|
+
data,
|
|
1429
|
+
dataKey: "value",
|
|
1430
|
+
nameKey: "name",
|
|
1431
|
+
fill: "currentColor",
|
|
1432
|
+
innerRadius: 70,
|
|
1433
|
+
outerRadius: 140
|
|
1434
|
+
}
|
|
1435
|
+
)
|
|
1436
|
+
]
|
|
1437
|
+
}
|
|
1438
|
+
) });
|
|
1439
|
+
};
|
|
1440
|
+
|
|
1441
|
+
// src/components/relationship-graph.tsx
|
|
1442
|
+
var import_react4 = require("@enact-ui/react");
|
|
1443
|
+
var import_framer_motion = require("framer-motion");
|
|
1444
|
+
var import_react5 = require("react");
|
|
1445
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
1446
|
+
var DEFAULT_TYPE_COLORS = {
|
|
1447
|
+
product: "#0284C7",
|
|
1448
|
+
ingredient: "#059669",
|
|
1449
|
+
plant: "#65A30D",
|
|
1450
|
+
recipe: "#F59E0B",
|
|
1451
|
+
variant: "#8B5CF6",
|
|
1452
|
+
field: "#6366F1",
|
|
1453
|
+
domain: "#EC4899",
|
|
1454
|
+
default: "#6B7280"
|
|
1455
|
+
};
|
|
1456
|
+
var EDGE_STYLES = {
|
|
1457
|
+
default: {},
|
|
1458
|
+
dashed: { dashArray: "4,4" },
|
|
1459
|
+
dotted: { dashArray: "2,2" }
|
|
1460
|
+
};
|
|
1461
|
+
function useForceLayout(nodes, edges, width, height) {
|
|
1462
|
+
const [positionedNodes, setPositionedNodes] = (0, import_react5.useState)([]);
|
|
1463
|
+
(0, import_react5.useEffect)(() => {
|
|
1464
|
+
if (nodes.length === 0) return;
|
|
1465
|
+
const centerX = width / 2;
|
|
1466
|
+
const centerY = height / 2;
|
|
1467
|
+
const radius = Math.min(width, height) * 0.35;
|
|
1468
|
+
const positioned = nodes.map((node, i) => {
|
|
1469
|
+
const angle = 2 * Math.PI * i / nodes.length;
|
|
1470
|
+
return {
|
|
1471
|
+
...node,
|
|
1472
|
+
x: node.isRoot ? centerX : centerX + radius * Math.cos(angle),
|
|
1473
|
+
y: node.isRoot ? centerY : centerY + radius * Math.sin(angle),
|
|
1474
|
+
vx: 0,
|
|
1475
|
+
vy: 0
|
|
1476
|
+
};
|
|
1477
|
+
});
|
|
1478
|
+
const iterations = 50;
|
|
1479
|
+
const repulsion = 5e3;
|
|
1480
|
+
const attraction = 0.05;
|
|
1481
|
+
const damping = 0.9;
|
|
1482
|
+
const centerForce = 0.01;
|
|
1483
|
+
for (let iter = 0; iter < iterations; iter++) {
|
|
1484
|
+
for (let i = 0; i < positioned.length; i++) {
|
|
1485
|
+
const node = positioned[i];
|
|
1486
|
+
if (!node) continue;
|
|
1487
|
+
for (let j = 0; j < positioned.length; j++) {
|
|
1488
|
+
if (i === j) continue;
|
|
1489
|
+
const other = positioned[j];
|
|
1490
|
+
if (!other) continue;
|
|
1491
|
+
const dx = node.x - other.x;
|
|
1492
|
+
const dy = node.y - other.y;
|
|
1493
|
+
const dist = Math.sqrt(dx * dx + dy * dy) || 1;
|
|
1494
|
+
const force = repulsion / (dist * dist);
|
|
1495
|
+
node.vx += dx / dist * force;
|
|
1496
|
+
node.vy += dy / dist * force;
|
|
1497
|
+
}
|
|
1498
|
+
edges.forEach((edge) => {
|
|
1499
|
+
if (edge.source === node.id || edge.target === node.id) {
|
|
1500
|
+
const otherId = edge.source === node.id ? edge.target : edge.source;
|
|
1501
|
+
const other = positioned.find((n) => n.id === otherId);
|
|
1502
|
+
if (other) {
|
|
1503
|
+
const dx = other.x - node.x;
|
|
1504
|
+
const dy = other.y - node.y;
|
|
1505
|
+
node.vx += dx * attraction;
|
|
1506
|
+
node.vy += dy * attraction;
|
|
1507
|
+
}
|
|
1508
|
+
}
|
|
1509
|
+
});
|
|
1510
|
+
node.vx += (centerX - node.x) * centerForce;
|
|
1511
|
+
node.vy += (centerY - node.y) * centerForce;
|
|
1512
|
+
if (node.isRoot) {
|
|
1513
|
+
node.vx = (centerX - node.x) * 0.5;
|
|
1514
|
+
node.vy = (centerY - node.y) * 0.5;
|
|
1515
|
+
}
|
|
1516
|
+
}
|
|
1517
|
+
for (const node of positioned) {
|
|
1518
|
+
node.x += node.vx;
|
|
1519
|
+
node.y += node.vy;
|
|
1520
|
+
node.vx *= damping;
|
|
1521
|
+
node.vy *= damping;
|
|
1522
|
+
const padding = 60;
|
|
1523
|
+
node.x = Math.max(padding, Math.min(width - padding, node.x));
|
|
1524
|
+
node.y = Math.max(padding, Math.min(height - padding, node.y));
|
|
1525
|
+
}
|
|
1526
|
+
}
|
|
1527
|
+
setPositionedNodes(positioned);
|
|
1528
|
+
}, [nodes, edges, width, height]);
|
|
1529
|
+
const positionedEdges = (0, import_react5.useMemo)(() => {
|
|
1530
|
+
return edges.map((edge) => {
|
|
1531
|
+
const sourceNode = positionedNodes.find((n) => n.id === edge.source);
|
|
1532
|
+
const targetNode = positionedNodes.find((n) => n.id === edge.target);
|
|
1533
|
+
if (!sourceNode || !targetNode) return null;
|
|
1534
|
+
return { ...edge, sourceNode, targetNode };
|
|
1535
|
+
}).filter(Boolean);
|
|
1536
|
+
}, [edges, positionedNodes]);
|
|
1537
|
+
return { positionedNodes, positionedEdges };
|
|
1538
|
+
}
|
|
1539
|
+
function useHierarchicalLayout(nodes, edges, width, height) {
|
|
1540
|
+
const positionedNodes = (0, import_react5.useMemo)(() => {
|
|
1541
|
+
if (nodes.length === 0) return [];
|
|
1542
|
+
const rootNode = nodes.find((n) => n.isRoot) || nodes[0];
|
|
1543
|
+
if (!rootNode) return [];
|
|
1544
|
+
const children = {};
|
|
1545
|
+
nodes.forEach((n) => {
|
|
1546
|
+
children[n.id] = [];
|
|
1547
|
+
});
|
|
1548
|
+
edges.forEach((edge) => {
|
|
1549
|
+
const sourceChildren = children[edge.source];
|
|
1550
|
+
if (sourceChildren) sourceChildren.push(edge.target);
|
|
1551
|
+
});
|
|
1552
|
+
const levels = { [rootNode.id]: 0 };
|
|
1553
|
+
const queue = [rootNode.id];
|
|
1554
|
+
const visited = /* @__PURE__ */ new Set([rootNode.id]);
|
|
1555
|
+
while (queue.length > 0) {
|
|
1556
|
+
const current = queue.shift();
|
|
1557
|
+
if (current === void 0) break;
|
|
1558
|
+
const currentLevel = levels[current];
|
|
1559
|
+
if (currentLevel !== void 0) {
|
|
1560
|
+
children[current]?.forEach((childId) => {
|
|
1561
|
+
if (!visited.has(childId)) {
|
|
1562
|
+
visited.add(childId);
|
|
1563
|
+
levels[childId] = currentLevel + 1;
|
|
1564
|
+
queue.push(childId);
|
|
1565
|
+
}
|
|
1566
|
+
});
|
|
1567
|
+
}
|
|
1568
|
+
}
|
|
1569
|
+
nodes.forEach((n) => {
|
|
1570
|
+
if (levels[n.id] === void 0) levels[n.id] = 1;
|
|
1571
|
+
});
|
|
1572
|
+
const nodesByLevel = {};
|
|
1573
|
+
nodes.forEach((n) => {
|
|
1574
|
+
const level = levels[n.id];
|
|
1575
|
+
if (level !== void 0) {
|
|
1576
|
+
if (!nodesByLevel[level]) nodesByLevel[level] = [];
|
|
1577
|
+
nodesByLevel[level].push(n);
|
|
1578
|
+
}
|
|
1579
|
+
});
|
|
1580
|
+
const maxLevel = Math.max(...Object.keys(nodesByLevel).map(Number));
|
|
1581
|
+
const levelHeight = height / (maxLevel + 2);
|
|
1582
|
+
return nodes.map((node) => {
|
|
1583
|
+
const level = levels[node.id];
|
|
1584
|
+
if (level === void 0) {
|
|
1585
|
+
return { ...node, x: 0, y: 0, vx: 0, vy: 0 };
|
|
1586
|
+
}
|
|
1587
|
+
const nodesAtLevel = nodesByLevel[level];
|
|
1588
|
+
if (!nodesAtLevel) {
|
|
1589
|
+
return { ...node, x: 0, y: 0, vx: 0, vy: 0 };
|
|
1590
|
+
}
|
|
1591
|
+
const indexAtLevel = nodesAtLevel.indexOf(node);
|
|
1592
|
+
const levelWidth = width / (nodesAtLevel.length + 1);
|
|
1593
|
+
return {
|
|
1594
|
+
...node,
|
|
1595
|
+
x: levelWidth * (indexAtLevel + 1),
|
|
1596
|
+
y: levelHeight * (level + 1),
|
|
1597
|
+
vx: 0,
|
|
1598
|
+
vy: 0
|
|
1599
|
+
};
|
|
1600
|
+
});
|
|
1601
|
+
}, [nodes, edges, width, height]);
|
|
1602
|
+
const positionedEdges = (0, import_react5.useMemo)(() => {
|
|
1603
|
+
return edges.map((edge) => {
|
|
1604
|
+
const sourceNode = positionedNodes.find((n) => n.id === edge.source);
|
|
1605
|
+
const targetNode = positionedNodes.find((n) => n.id === edge.target);
|
|
1606
|
+
if (!sourceNode || !targetNode) return null;
|
|
1607
|
+
return { ...edge, sourceNode, targetNode };
|
|
1608
|
+
}).filter(Boolean);
|
|
1609
|
+
}, [edges, positionedNodes]);
|
|
1610
|
+
return { positionedNodes, positionedEdges };
|
|
1611
|
+
}
|
|
1612
|
+
function useRadialLayout(nodes, edges, width, height) {
|
|
1613
|
+
const positionedNodes = (0, import_react5.useMemo)(() => {
|
|
1614
|
+
if (nodes.length === 0) return [];
|
|
1615
|
+
const centerX = width / 2;
|
|
1616
|
+
const centerY = height / 2;
|
|
1617
|
+
const rootNode = nodes.find((n) => n.isRoot) || nodes[0];
|
|
1618
|
+
if (!rootNode) return [];
|
|
1619
|
+
const distances = { [rootNode.id]: 0 };
|
|
1620
|
+
const queue = [rootNode.id];
|
|
1621
|
+
const visited = /* @__PURE__ */ new Set([rootNode.id]);
|
|
1622
|
+
const adjacent = {};
|
|
1623
|
+
nodes.forEach((n) => {
|
|
1624
|
+
adjacent[n.id] = /* @__PURE__ */ new Set();
|
|
1625
|
+
});
|
|
1626
|
+
edges.forEach((e) => {
|
|
1627
|
+
adjacent[e.source]?.add(e.target);
|
|
1628
|
+
adjacent[e.target]?.add(e.source);
|
|
1629
|
+
});
|
|
1630
|
+
while (queue.length > 0) {
|
|
1631
|
+
const current = queue.shift();
|
|
1632
|
+
if (current === void 0) break;
|
|
1633
|
+
const currentDist = distances[current];
|
|
1634
|
+
if (currentDist !== void 0) {
|
|
1635
|
+
adjacent[current]?.forEach((neighborId) => {
|
|
1636
|
+
if (!visited.has(neighborId)) {
|
|
1637
|
+
visited.add(neighborId);
|
|
1638
|
+
distances[neighborId] = currentDist + 1;
|
|
1639
|
+
queue.push(neighborId);
|
|
1640
|
+
}
|
|
1641
|
+
});
|
|
1642
|
+
}
|
|
1643
|
+
}
|
|
1644
|
+
nodes.forEach((n) => {
|
|
1645
|
+
if (distances[n.id] === void 0) distances[n.id] = 1;
|
|
1646
|
+
});
|
|
1647
|
+
const nodesByDistance = {};
|
|
1648
|
+
nodes.forEach((n) => {
|
|
1649
|
+
const dist = distances[n.id];
|
|
1650
|
+
if (dist !== void 0) {
|
|
1651
|
+
if (!nodesByDistance[dist]) nodesByDistance[dist] = [];
|
|
1652
|
+
nodesByDistance[dist].push(n);
|
|
1653
|
+
}
|
|
1654
|
+
});
|
|
1655
|
+
const maxDistance = Math.max(...Object.keys(nodesByDistance).map(Number));
|
|
1656
|
+
const radiusStep = Math.min(width, height) * 0.35 / Math.max(maxDistance, 1);
|
|
1657
|
+
return nodes.map((node) => {
|
|
1658
|
+
const dist = distances[node.id];
|
|
1659
|
+
if (dist === void 0) {
|
|
1660
|
+
return { ...node, x: centerX, y: centerY, vx: 0, vy: 0 };
|
|
1661
|
+
}
|
|
1662
|
+
if (dist === 0) return { ...node, x: centerX, y: centerY, vx: 0, vy: 0 };
|
|
1663
|
+
const nodesAtDist = nodesByDistance[dist];
|
|
1664
|
+
if (!nodesAtDist) {
|
|
1665
|
+
return { ...node, x: centerX, y: centerY, vx: 0, vy: 0 };
|
|
1666
|
+
}
|
|
1667
|
+
const indexAtDist = nodesAtDist.indexOf(node);
|
|
1668
|
+
const angle = 2 * Math.PI * indexAtDist / nodesAtDist.length;
|
|
1669
|
+
const radius = radiusStep * dist;
|
|
1670
|
+
return {
|
|
1671
|
+
...node,
|
|
1672
|
+
x: centerX + radius * Math.cos(angle),
|
|
1673
|
+
y: centerY + radius * Math.sin(angle),
|
|
1674
|
+
vx: 0,
|
|
1675
|
+
vy: 0
|
|
1676
|
+
};
|
|
1677
|
+
});
|
|
1678
|
+
}, [nodes, edges, width, height]);
|
|
1679
|
+
const positionedEdges = (0, import_react5.useMemo)(() => {
|
|
1680
|
+
return edges.map((edge) => {
|
|
1681
|
+
const sourceNode = positionedNodes.find((n) => n.id === edge.source);
|
|
1682
|
+
const targetNode = positionedNodes.find((n) => n.id === edge.target);
|
|
1683
|
+
if (!sourceNode || !targetNode) return null;
|
|
1684
|
+
return { ...edge, sourceNode, targetNode };
|
|
1685
|
+
}).filter(Boolean);
|
|
1686
|
+
}, [edges, positionedNodes]);
|
|
1687
|
+
return { positionedNodes, positionedEdges };
|
|
1688
|
+
}
|
|
1689
|
+
var GraphNodeComponent = ({ node, onClick, showLabel, isHighlighted, isHovered, onHover, typeColors }) => {
|
|
1690
|
+
const nodeColor = node.color || typeColors[node.type] || typeColors.default || DEFAULT_TYPE_COLORS.default;
|
|
1691
|
+
const nodeSize = node.isRoot ? 28 : 22;
|
|
1692
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
1693
|
+
import_framer_motion.motion.g,
|
|
1694
|
+
{
|
|
1695
|
+
initial: { scale: 0, opacity: 0 },
|
|
1696
|
+
animate: { scale: isHovered || isHighlighted ? 1.2 : 1, opacity: 1 },
|
|
1697
|
+
transition: { type: "spring", stiffness: 300, damping: 20 },
|
|
1698
|
+
style: { cursor: onClick ? "pointer" : "default" },
|
|
1699
|
+
onClick,
|
|
1700
|
+
onMouseEnter: () => onHover(true),
|
|
1701
|
+
onMouseLeave: () => onHover(false),
|
|
1702
|
+
role: onClick ? "button" : void 0,
|
|
1703
|
+
tabIndex: onClick ? 0 : void 0,
|
|
1704
|
+
children: [
|
|
1705
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1706
|
+
"circle",
|
|
1707
|
+
{
|
|
1708
|
+
cx: node.x,
|
|
1709
|
+
cy: node.y,
|
|
1710
|
+
r: nodeSize,
|
|
1711
|
+
fill: nodeColor,
|
|
1712
|
+
stroke: isHighlighted ? "#1F2937" : "white",
|
|
1713
|
+
strokeWidth: isHighlighted ? 3 : 2,
|
|
1714
|
+
style: { filter: isHovered ? "drop-shadow(0 4px 6px rgba(0, 0, 0, 0.3))" : void 0 }
|
|
1715
|
+
}
|
|
1716
|
+
),
|
|
1717
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("text", { x: node.x, y: node.y, textAnchor: "middle", dominantBaseline: "central", fill: "white", fontSize: node.isRoot ? 12 : 10, fontWeight: "bold", children: node.label.charAt(0).toUpperCase() }),
|
|
1718
|
+
showLabel && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("text", { x: node.x, y: node.y + nodeSize + 14, textAnchor: "middle", fill: "#374151", fontSize: 11, fontWeight: node.isRoot ? 600 : 400, children: node.label.length > 20 ? `${node.label.substring(0, 18)}...` : node.label })
|
|
1719
|
+
]
|
|
1720
|
+
}
|
|
1721
|
+
);
|
|
1722
|
+
};
|
|
1723
|
+
var GraphEdgeComponent = ({ edge, onClick, isHighlighted, showLabel }) => {
|
|
1724
|
+
const edgeType = edge.type || "default";
|
|
1725
|
+
const style = EDGE_STYLES[edgeType] ?? EDGE_STYLES.default ?? {};
|
|
1726
|
+
const dashArray = style.dashArray;
|
|
1727
|
+
const strokeWidth = (edge.strength || 0.5) * 2 + 1;
|
|
1728
|
+
const edgeColor = edge.color || "#6B7280";
|
|
1729
|
+
const dx = edge.targetNode.x - edge.sourceNode.x;
|
|
1730
|
+
const dy = edge.targetNode.y - edge.sourceNode.y;
|
|
1731
|
+
const dist = Math.sqrt(dx * dx + dy * dy) || 1;
|
|
1732
|
+
const sourceRadius = edge.sourceNode.isRoot ? 28 : 22;
|
|
1733
|
+
const targetRadius = edge.targetNode.isRoot ? 28 : 22;
|
|
1734
|
+
const startX = edge.sourceNode.x + dx / dist * sourceRadius;
|
|
1735
|
+
const startY = edge.sourceNode.y + dy / dist * sourceRadius;
|
|
1736
|
+
const endX = edge.targetNode.x - dx / dist * targetRadius;
|
|
1737
|
+
const endY = edge.targetNode.y - dy / dist * targetRadius;
|
|
1738
|
+
const midX = (startX + endX) / 2;
|
|
1739
|
+
const midY = (startY + endY) / 2;
|
|
1740
|
+
return (
|
|
1741
|
+
// biome-ignore lint/a11y/noStaticElementInteractions: SVG g element needs role="button" for accessibility when interactive
|
|
1742
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("g", { style: { cursor: onClick ? "pointer" : "default" }, onClick, role: onClick ? "button" : void 0, tabIndex: onClick ? 0 : void 0, children: [
|
|
1743
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1744
|
+
import_framer_motion.motion.line,
|
|
1745
|
+
{
|
|
1746
|
+
x1: startX,
|
|
1747
|
+
y1: startY,
|
|
1748
|
+
x2: endX,
|
|
1749
|
+
y2: endY,
|
|
1750
|
+
stroke: isHighlighted ? "#1F2937" : edgeColor,
|
|
1751
|
+
strokeWidth: isHighlighted ? strokeWidth + 1 : strokeWidth,
|
|
1752
|
+
strokeDasharray: dashArray,
|
|
1753
|
+
initial: { pathLength: 0, opacity: 0 },
|
|
1754
|
+
animate: { pathLength: 1, opacity: 0.7 },
|
|
1755
|
+
transition: { duration: 0.5, delay: 0.2 },
|
|
1756
|
+
markerEnd: "url(#arrowhead)"
|
|
1757
|
+
}
|
|
1758
|
+
),
|
|
1759
|
+
showLabel && edge.label && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("g", { children: [
|
|
1760
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("rect", { x: midX - 30, y: midY - 8, width: 60, height: 16, rx: 4, fill: "white", fillOpacity: 0.9 }),
|
|
1761
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("text", { x: midX, y: midY + 4, textAnchor: "middle", fill: "#6B7280", fontSize: 9, children: edge.label })
|
|
1762
|
+
] })
|
|
1763
|
+
] })
|
|
1764
|
+
);
|
|
1765
|
+
};
|
|
1766
|
+
var NodeTooltip = ({ node, typeColors }) => {
|
|
1767
|
+
const nodeColor = node.color || typeColors[node.type] || typeColors.default || DEFAULT_TYPE_COLORS.default;
|
|
1768
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1769
|
+
import_framer_motion.motion.foreignObject,
|
|
1770
|
+
{
|
|
1771
|
+
x: node.x + 30,
|
|
1772
|
+
y: node.y - 40,
|
|
1773
|
+
width: 200,
|
|
1774
|
+
height: 100,
|
|
1775
|
+
initial: { opacity: 0, scale: 0.9 },
|
|
1776
|
+
animate: { opacity: 1, scale: 1 },
|
|
1777
|
+
exit: { opacity: 0, scale: 0.9 },
|
|
1778
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "rounded-lg border bg-white p-3 shadow-lg", children: [
|
|
1779
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "mb-1 flex items-center gap-2", children: [
|
|
1780
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "h-2 w-2 rounded-full", style: { background: nodeColor } }),
|
|
1781
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("strong", { className: "text-sm", children: node.label })
|
|
1782
|
+
] }),
|
|
1783
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "text-content-tertiary text-xs", children: [
|
|
1784
|
+
"Type: ",
|
|
1785
|
+
node.type
|
|
1786
|
+
] }),
|
|
1787
|
+
node.metadata && Object.entries(node.metadata).map(([key, value]) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "text-content-tertiary text-xs", children: [
|
|
1788
|
+
key,
|
|
1789
|
+
": ",
|
|
1790
|
+
value
|
|
1791
|
+
] }, key))
|
|
1792
|
+
] })
|
|
1793
|
+
}
|
|
1794
|
+
);
|
|
1795
|
+
};
|
|
1796
|
+
var GraphLegend = ({ nodes, typeColors }) => {
|
|
1797
|
+
const types = (0, import_react5.useMemo)(() => Array.from(new Set(nodes.map((n) => n.type))), [nodes]);
|
|
1798
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "absolute bottom-3 left-3 rounded-lg bg-white p-2 text-xs shadow-md", children: [
|
|
1799
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "text-content-primary mb-1.5 font-semibold", children: "Legend" }),
|
|
1800
|
+
types.map((type) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "mb-0.5 flex items-center gap-1.5", children: [
|
|
1801
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "h-2.5 w-2.5 rounded-full", style: { background: typeColors[type] || typeColors.default || DEFAULT_TYPE_COLORS.default } }),
|
|
1802
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "text-content-tertiary capitalize", children: type })
|
|
1803
|
+
] }, type))
|
|
1804
|
+
] });
|
|
1805
|
+
};
|
|
1806
|
+
function RelationshipGraph({
|
|
1807
|
+
nodes,
|
|
1808
|
+
edges,
|
|
1809
|
+
onNodeClick,
|
|
1810
|
+
onEdgeClick,
|
|
1811
|
+
width = 600,
|
|
1812
|
+
height = 400,
|
|
1813
|
+
animate: _animate = true,
|
|
1814
|
+
layout = "force",
|
|
1815
|
+
className,
|
|
1816
|
+
showLabels = true,
|
|
1817
|
+
showLegend = true,
|
|
1818
|
+
interactive = true,
|
|
1819
|
+
highlightNode,
|
|
1820
|
+
typeColors = DEFAULT_TYPE_COLORS
|
|
1821
|
+
}) {
|
|
1822
|
+
const [hoveredNode, setHoveredNode] = (0, import_react5.useState)(null);
|
|
1823
|
+
const svgRef = (0, import_react5.useRef)(null);
|
|
1824
|
+
const mergedColors = { ...DEFAULT_TYPE_COLORS, ...typeColors };
|
|
1825
|
+
const forceLayout = useForceLayout(layout === "force" ? nodes : [], layout === "force" ? edges : [], width, height);
|
|
1826
|
+
const hierarchicalLayout = useHierarchicalLayout(layout === "hierarchical" ? nodes : [], layout === "hierarchical" ? edges : [], width, height);
|
|
1827
|
+
const radialLayout = useRadialLayout(layout === "radial" ? nodes : [], layout === "radial" ? edges : [], width, height);
|
|
1828
|
+
const { positionedNodes, positionedEdges } = layout === "force" ? forceLayout : layout === "hierarchical" ? hierarchicalLayout : radialLayout;
|
|
1829
|
+
const handleNodeClick = (0, import_react5.useCallback)(
|
|
1830
|
+
(node) => {
|
|
1831
|
+
if (onNodeClick && interactive) onNodeClick(node);
|
|
1832
|
+
},
|
|
1833
|
+
[onNodeClick, interactive]
|
|
1834
|
+
);
|
|
1835
|
+
const handleEdgeClick = (0, import_react5.useCallback)(
|
|
1836
|
+
(edge) => {
|
|
1837
|
+
if (onEdgeClick && interactive) onEdgeClick(edge);
|
|
1838
|
+
},
|
|
1839
|
+
[onEdgeClick, interactive]
|
|
1840
|
+
);
|
|
1841
|
+
const hoveredNodeData = (0, import_react5.useMemo)(() => positionedNodes.find((n) => n.id === hoveredNode), [positionedNodes, hoveredNode]);
|
|
1842
|
+
if (nodes.length === 0) {
|
|
1843
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: (0, import_react4.cx)("flex items-center justify-center rounded-lg border border-dashed bg-gray-50", className), style: { width, height }, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "text-content-tertiary text-sm", children: "No relationships to display" }) });
|
|
1844
|
+
}
|
|
1845
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: (0, import_react4.cx)("relative", className), style: { width, height }, children: [
|
|
1846
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("svg", { ref: svgRef, width, height, className: "rounded-lg border bg-gray-50", role: "img", "aria-label": "Relationship graph visualization", children: [
|
|
1847
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("marker", { id: "arrowhead", markerWidth: "10", markerHeight: "7", refX: "9", refY: "3.5", orient: "auto", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("polygon", { points: "0 0, 10 3.5, 0 7", fill: "#6B7280" }) }) }),
|
|
1848
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("g", { className: "edges", children: positionedEdges.map((edge) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1849
|
+
GraphEdgeComponent,
|
|
1850
|
+
{
|
|
1851
|
+
edge,
|
|
1852
|
+
...onEdgeClick ? { onClick: () => handleEdgeClick(edge) } : {},
|
|
1853
|
+
isHighlighted: hoveredNode === edge.source || hoveredNode === edge.target || highlightNode === edge.source || highlightNode === edge.target,
|
|
1854
|
+
showLabel: showLabels
|
|
1855
|
+
},
|
|
1856
|
+
edge.id
|
|
1857
|
+
)) }),
|
|
1858
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("g", { className: "nodes", children: positionedNodes.map((node) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1859
|
+
GraphNodeComponent,
|
|
1860
|
+
{
|
|
1861
|
+
node,
|
|
1862
|
+
...onNodeClick ? { onClick: () => handleNodeClick(node) } : {},
|
|
1863
|
+
showLabel: showLabels,
|
|
1864
|
+
isHighlighted: highlightNode === node.id,
|
|
1865
|
+
isHovered: hoveredNode === node.id,
|
|
1866
|
+
onHover: (hovering) => setHoveredNode(hovering ? node.id : null),
|
|
1867
|
+
typeColors: mergedColors
|
|
1868
|
+
},
|
|
1869
|
+
node.id
|
|
1870
|
+
)) }),
|
|
1871
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_framer_motion.AnimatePresence, { children: interactive && hoveredNodeData && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(NodeTooltip, { node: hoveredNodeData, typeColors: mergedColors }) })
|
|
1872
|
+
] }),
|
|
1873
|
+
showLegend && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(GraphLegend, { nodes, typeColors: mergedColors })
|
|
1874
|
+
] });
|
|
1875
|
+
}
|
|
1876
|
+
|
|
1877
|
+
// src/components/trend-indicator.tsx
|
|
1878
|
+
var import_react6 = require("@enact-ui/react");
|
|
1879
|
+
var import_lucide_react = require("lucide-react");
|
|
1880
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
1881
|
+
var sizeStyles = {
|
|
1882
|
+
sm: {
|
|
1883
|
+
container: "text-xs gap-0.5",
|
|
1884
|
+
icon: "h-3 w-3"
|
|
1885
|
+
},
|
|
1886
|
+
md: {
|
|
1887
|
+
container: "text-sm gap-1",
|
|
1888
|
+
icon: "h-4 w-4"
|
|
1889
|
+
},
|
|
1890
|
+
lg: {
|
|
1891
|
+
container: "text-base gap-1",
|
|
1892
|
+
icon: "h-5 w-5"
|
|
1893
|
+
}
|
|
1894
|
+
};
|
|
1895
|
+
var TrendIndicator = ({ direction, value, inverted = false, size = "md", showPercent = true, className }) => {
|
|
1896
|
+
const isPositive = inverted ? direction === "down" : direction === "up";
|
|
1897
|
+
const isNegative = inverted ? direction === "up" : direction === "down";
|
|
1898
|
+
const colorClass = isPositive ? "text-content-success" : isNegative ? "text-content-error" : "text-content-tertiary";
|
|
1899
|
+
const Icon = direction === "up" ? import_lucide_react.ArrowUp : direction === "down" ? import_lucide_react.ArrowDown : import_lucide_react.Minus;
|
|
1900
|
+
const styles = sizeStyles[size];
|
|
1901
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { className: (0, import_react6.cx)("inline-flex items-center font-medium", styles.container, colorClass, className), children: [
|
|
1902
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Icon, { className: styles.icon }),
|
|
1903
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { children: [
|
|
1904
|
+
value,
|
|
1905
|
+
showPercent && "%"
|
|
1906
|
+
] })
|
|
1907
|
+
] });
|
|
1908
|
+
};
|
|
1909
|
+
var TrendBadge = ({ label, className, ...props }) => {
|
|
1910
|
+
const isPositive = props.inverted ? props.direction === "down" : props.direction === "up";
|
|
1911
|
+
const isNegative = props.inverted ? props.direction === "up" : props.direction === "down";
|
|
1912
|
+
const bgClass = isPositive ? "bg-surface-success-subtle" : isNegative ? "bg-surface-error-subtle" : "bg-surface-raised";
|
|
1913
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { className: (0, import_react6.cx)("inline-flex items-center gap-1.5 rounded-full px-2 py-0.5", bgClass, className), children: [
|
|
1914
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "text-content-secondary text-xs", children: label }),
|
|
1915
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(TrendIndicator, { ...props })
|
|
1916
|
+
] });
|
|
1917
|
+
};
|
|
90
1918
|
// Annotate the CommonJS export names for ESM import in node:
|
|
91
1919
|
0 && (module.exports = {
|
|
1920
|
+
BarChart,
|
|
1921
|
+
BarChart02,
|
|
1922
|
+
BarChart03,
|
|
92
1923
|
ChartActiveDot,
|
|
93
1924
|
ChartLegendContent,
|
|
94
1925
|
ChartTooltipContent,
|
|
1926
|
+
LineChart01,
|
|
1927
|
+
LineChart02,
|
|
1928
|
+
LineChart03,
|
|
1929
|
+
LineChart04,
|
|
1930
|
+
PieChartLg,
|
|
1931
|
+
PieChartMd,
|
|
1932
|
+
PieChartSm,
|
|
1933
|
+
PieChartXs,
|
|
1934
|
+
PieChartXxs,
|
|
1935
|
+
RelationshipGraph,
|
|
1936
|
+
TrendBadge,
|
|
1937
|
+
TrendIndicator,
|
|
95
1938
|
selectEvenlySpacedItems
|
|
96
1939
|
});
|
|
97
1940
|
//# sourceMappingURL=index.js.map
|