@mastra/playground-ui 40.0.0 → 40.0.1-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -0
- package/dist/components/ScatterPlotChart.cjs.js +163 -6
- package/dist/components/ScatterPlotChart.cjs.js.map +1 -1
- package/dist/components/ScatterPlotChart.es.js +162 -1
- package/dist/components/ScatterPlotChart.es.js.map +1 -1
- package/dist/ee/signals/components/signal-details-page.cjs.js +66 -157
- package/dist/ee/signals/components/signal-details-page.cjs.js.map +1 -1
- package/dist/ee/signals/components/signal-details-page.es.js +68 -158
- package/dist/ee/signals/components/signal-details-page.es.js.map +1 -1
- package/dist/ee/signals/components.cjs.js +1 -2
- package/dist/ee/signals/components.cjs.js.map +1 -1
- package/dist/ee/signals/components.es.js +1 -1
- package/dist/ee/signals/hooks/use-entity-learning.cjs.js +0 -17
- package/dist/ee/signals/hooks/use-entity-learning.cjs.js.map +1 -1
- package/dist/ee/signals/hooks/use-entity-learning.es.js +1 -17
- package/dist/ee/signals/hooks/use-entity-learning.es.js.map +1 -1
- package/dist/ee/signals/hooks.cjs.js +0 -1
- package/dist/ee/signals/hooks.cjs.js.map +1 -1
- package/dist/ee/signals/hooks.es.js +1 -1
- package/dist/ee/signals/services/entity-learning-service.cjs.js +0 -10
- package/dist/ee/signals/services/entity-learning-service.cjs.js.map +1 -1
- package/dist/ee/signals/services/entity-learning-service.es.js +0 -10
- package/dist/ee/signals/services/entity-learning-service.es.js.map +1 -1
- package/dist/ee/signals.cjs.js +1 -3
- package/dist/ee/signals.cjs.js.map +1 -1
- package/dist/ee/signals.es.js +2 -2
- package/dist/src/ee/signals/components/signal-details-page.d.ts +3 -16
- package/dist/src/ee/signals/hooks/use-entity-learning.d.ts +1 -3
- package/dist/src/ee/signals/services/entity-learning-service.d.ts +1 -8
- package/dist/src/ee/signals/services/entity-learning-types.d.ts +0 -13
- package/package.json +6 -6
- package/dist/scatter-plot-chart-B3hfFMKS.js +0 -163
- package/dist/scatter-plot-chart-B3hfFMKS.js.map +0 -1
- package/dist/scatter-plot-chart-CFZO31md.cjs +0 -169
- package/dist/scatter-plot-chart-CFZO31md.cjs.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @mastra/playground-ui
|
|
2
2
|
|
|
3
|
+
## 40.0.1-alpha.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Fixed signal details pages so their sidebars can scroll within the Studio route, removed the scatter plot tab, and cleaned up unused signal points APIs. ([#19005](https://github.com/mastra-ai/mastra/pull/19005))
|
|
8
|
+
|
|
9
|
+
- Updated dependencies [[`e8eaf3a`](https://github.com/mastra-ai/mastra/commit/e8eaf3aea09d51c131b5d369aee459442f416efc), [`d1c930f`](https://github.com/mastra-ai/mastra/commit/d1c930f713d1de09d5f3cd665cb79a8b7ebd7ec7), [`02634f7`](https://github.com/mastra-ai/mastra/commit/02634f700051e014a125d0d10165e3c9b8414e95)]:
|
|
10
|
+
- @mastra/core@1.50.1-alpha.1
|
|
11
|
+
- @mastra/client-js@1.31.1-alpha.1
|
|
12
|
+
- @mastra/react@1.2.4-alpha.1
|
|
13
|
+
|
|
14
|
+
## 40.0.1-alpha.0
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- Updated dependencies [[`e900f25`](https://github.com/mastra-ai/mastra/commit/e900f25dfe2c9237f15b26cb109ac55aa9de3000)]:
|
|
19
|
+
- @mastra/core@1.50.1-alpha.0
|
|
20
|
+
- @mastra/client-js@1.31.1-alpha.0
|
|
21
|
+
- @mastra/react@1.2.4-alpha.0
|
|
22
|
+
|
|
3
23
|
## 40.0.0
|
|
4
24
|
|
|
5
25
|
### Patch Changes
|
|
@@ -2,13 +2,170 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
|
|
5
|
-
const
|
|
5
|
+
const jsxRuntime = require('react/jsx-runtime');
|
|
6
|
+
const recharts = require('recharts');
|
|
7
|
+
const spacings = require('../spacings-BP8L49kn.cjs');
|
|
8
|
+
const utils_cn = require('../cn-vA5sWo9W.cjs');
|
|
6
9
|
|
|
10
|
+
function ScatterPlotChartTooltip({
|
|
11
|
+
active,
|
|
12
|
+
payload,
|
|
13
|
+
xKey,
|
|
14
|
+
yKey,
|
|
15
|
+
nameKey,
|
|
16
|
+
formatX,
|
|
17
|
+
formatY,
|
|
18
|
+
formatTooltipLabel
|
|
19
|
+
}) {
|
|
20
|
+
const point = payload?.[0]?.payload;
|
|
21
|
+
if (!active || !point) return null;
|
|
22
|
+
const label = formatTooltipLabel?.(point) ?? (nameKey ? point[nameKey] : void 0);
|
|
23
|
+
const xValue = point[xKey];
|
|
24
|
+
const yValue = point[yKey];
|
|
25
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-md border border-border1 bg-surface2 px-3 py-2 text-xs shadow-lg", children: [
|
|
26
|
+
label !== void 0 && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mb-1 font-medium text-icon6", children: String(label) }),
|
|
27
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid gap-1 text-icon2", children: [
|
|
28
|
+
/* @__PURE__ */ jsxRuntime.jsxs("p", { children: [
|
|
29
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-neutral3", children: "X:" }),
|
|
30
|
+
" ",
|
|
31
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-mono", children: formatX ? formatX(xValue, point) : String(xValue) })
|
|
32
|
+
] }),
|
|
33
|
+
/* @__PURE__ */ jsxRuntime.jsxs("p", { children: [
|
|
34
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-neutral3", children: "Y:" }),
|
|
35
|
+
" ",
|
|
36
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-mono", children: formatY ? formatY(yValue, point) : String(yValue) })
|
|
37
|
+
] })
|
|
38
|
+
] })
|
|
39
|
+
] });
|
|
40
|
+
}
|
|
7
41
|
|
|
42
|
+
function getScatterPlotPointColor(point, colorKey) {
|
|
43
|
+
const color = colorKey ? point[colorKey] : void 0;
|
|
44
|
+
return typeof color === "string" && color.length > 0 ? color : spacings.Colors.accent3;
|
|
45
|
+
}
|
|
46
|
+
function getScatterPlotClickedPoint(payload) {
|
|
47
|
+
return payload?.payload;
|
|
48
|
+
}
|
|
49
|
+
function formatScatterPlotAxisTick(value, formatter) {
|
|
50
|
+
return (formatter?.(value, {}) ?? String(value)).replace(/\s+/g, " ");
|
|
51
|
+
}
|
|
8
52
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
53
|
+
const LABEL_COLOR = "#a1a1aa";
|
|
54
|
+
const DEFAULT_POINT_SIZE = 48;
|
|
55
|
+
const CHART_MARGIN = { top: 16, right: 16, bottom: 16, left: 16 };
|
|
56
|
+
function ScatterPlotChart({
|
|
57
|
+
data,
|
|
58
|
+
xKey,
|
|
59
|
+
yKey,
|
|
60
|
+
nameKey,
|
|
61
|
+
colorKey,
|
|
62
|
+
height = 210,
|
|
63
|
+
xLabel,
|
|
64
|
+
yLabel,
|
|
65
|
+
xDomain,
|
|
66
|
+
yDomain,
|
|
67
|
+
formatX,
|
|
68
|
+
formatY,
|
|
69
|
+
formatTooltipLabel,
|
|
70
|
+
onPointClick,
|
|
71
|
+
className
|
|
72
|
+
}) {
|
|
73
|
+
const isClickable = typeof onPointClick === "function";
|
|
74
|
+
const fillsContainer = height === "100%";
|
|
75
|
+
if (data.length === 0) {
|
|
76
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
77
|
+
"div",
|
|
78
|
+
{
|
|
79
|
+
className: utils_cn.cn(
|
|
80
|
+
"flex items-center justify-center rounded-md border border-border1 text-ui-sm text-neutral3",
|
|
81
|
+
className
|
|
82
|
+
),
|
|
83
|
+
style: { height },
|
|
84
|
+
children: "No data to display"
|
|
85
|
+
}
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: utils_cn.cn(fillsContainer && "flex h-full min-h-0 flex-col", className), children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: utils_cn.cn(fillsContainer && "min-h-0 flex-1"), style: { height: fillsContainer ? void 0 : height }, children: /* @__PURE__ */ jsxRuntime.jsx(recharts.ResponsiveContainer, { width: "100%", height: "100%", children: /* @__PURE__ */ jsxRuntime.jsxs(recharts.ScatterChart, { data, margin: CHART_MARGIN, children: [
|
|
89
|
+
/* @__PURE__ */ jsxRuntime.jsx(recharts.CartesianGrid, { stroke: spacings.Colors.neutral3, strokeDasharray: "4 4", strokeOpacity: 0.18, vertical: false }),
|
|
90
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
91
|
+
recharts.XAxis,
|
|
92
|
+
{
|
|
93
|
+
dataKey: xKey,
|
|
94
|
+
name: xLabel,
|
|
95
|
+
type: "number",
|
|
96
|
+
tick: { fontSize: 10, fill: LABEL_COLOR, fontFamily: "var(--font-mono)" },
|
|
97
|
+
tickLine: false,
|
|
98
|
+
axisLine: false,
|
|
99
|
+
domain: xDomain,
|
|
100
|
+
tickFormatter: (value) => formatScatterPlotAxisTick(value, formatX)
|
|
101
|
+
}
|
|
102
|
+
),
|
|
103
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
104
|
+
recharts.YAxis,
|
|
105
|
+
{
|
|
106
|
+
dataKey: yKey,
|
|
107
|
+
name: yLabel,
|
|
108
|
+
type: "number",
|
|
109
|
+
tick: { fontSize: 10, fill: LABEL_COLOR, fontFamily: "var(--font-mono)" },
|
|
110
|
+
tickLine: false,
|
|
111
|
+
axisLine: false,
|
|
112
|
+
width: 44,
|
|
113
|
+
domain: yDomain,
|
|
114
|
+
tickFormatter: (value) => formatScatterPlotAxisTick(value, formatY)
|
|
115
|
+
}
|
|
116
|
+
),
|
|
117
|
+
/* @__PURE__ */ jsxRuntime.jsx(recharts.ZAxis, { range: [DEFAULT_POINT_SIZE, DEFAULT_POINT_SIZE] }),
|
|
118
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
119
|
+
recharts.Tooltip,
|
|
120
|
+
{
|
|
121
|
+
cursor: { stroke: spacings.Colors.neutral3, strokeOpacity: 0.16 },
|
|
122
|
+
content: /* @__PURE__ */ jsxRuntime.jsx(
|
|
123
|
+
ScatterPlotChartTooltip,
|
|
124
|
+
{
|
|
125
|
+
xKey,
|
|
126
|
+
yKey,
|
|
127
|
+
nameKey,
|
|
128
|
+
formatX,
|
|
129
|
+
formatY,
|
|
130
|
+
formatTooltipLabel
|
|
131
|
+
}
|
|
132
|
+
)
|
|
133
|
+
}
|
|
134
|
+
),
|
|
135
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
136
|
+
recharts.Scatter,
|
|
137
|
+
{
|
|
138
|
+
data,
|
|
139
|
+
fill: spacings.Colors.accent3,
|
|
140
|
+
shape: (props) => {
|
|
141
|
+
const point = props.payload ?? {};
|
|
142
|
+
const cx = props.cx;
|
|
143
|
+
const cy = props.cy;
|
|
144
|
+
if (typeof cx !== "number" || typeof cy !== "number") return /* @__PURE__ */ jsxRuntime.jsx("g", {});
|
|
145
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
146
|
+
"circle",
|
|
147
|
+
{
|
|
148
|
+
cx,
|
|
149
|
+
cy,
|
|
150
|
+
r: 4,
|
|
151
|
+
fill: getScatterPlotPointColor(point, colorKey),
|
|
152
|
+
opacity: 0.9,
|
|
153
|
+
style: { cursor: isClickable ? "pointer" : void 0 }
|
|
154
|
+
}
|
|
155
|
+
);
|
|
156
|
+
},
|
|
157
|
+
onClick: (_, payload) => {
|
|
158
|
+
const point = getScatterPlotClickedPoint(payload);
|
|
159
|
+
if (point) onPointClick?.(point);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
)
|
|
163
|
+
] }) }) }) });
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
exports.ScatterPlotChart = ScatterPlotChart;
|
|
167
|
+
exports.ScatterPlotChartTooltip = ScatterPlotChartTooltip;
|
|
168
|
+
exports.formatScatterPlotAxisTick = formatScatterPlotAxisTick;
|
|
169
|
+
exports.getScatterPlotClickedPoint = getScatterPlotClickedPoint;
|
|
170
|
+
exports.getScatterPlotPointColor = getScatterPlotPointColor;
|
|
14
171
|
//# sourceMappingURL=ScatterPlotChart.cjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScatterPlotChart.cjs.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"ScatterPlotChart.cjs.js","sources":["../../src/ds/components/ScatterPlotChart/scatter-plot-chart-tooltip.tsx","../../src/ds/components/ScatterPlotChart/scatter-plot-chart-utils.ts","../../src/ds/components/ScatterPlotChart/scatter-plot-chart.tsx"],"sourcesContent":["import type { ScatterPlotChartFormatter } from './scatter-plot-chart';\n\ntype ScatterTooltipPayload = Array<{\n color?: string;\n payload?: Record<string, unknown>;\n}>;\n\nexport function ScatterPlotChartTooltip({\n active,\n payload,\n xKey,\n yKey,\n nameKey,\n formatX,\n formatY,\n formatTooltipLabel,\n}: {\n active?: boolean;\n payload?: ScatterTooltipPayload;\n xKey: string;\n yKey: string;\n nameKey?: string;\n formatX?: ScatterPlotChartFormatter;\n formatY?: ScatterPlotChartFormatter;\n formatTooltipLabel?: (point: Record<string, unknown>) => string;\n}) {\n const point = payload?.[0]?.payload;\n if (!active || !point) return null;\n\n const label = formatTooltipLabel?.(point) ?? (nameKey ? point[nameKey] : undefined);\n const xValue = point[xKey];\n const yValue = point[yKey];\n\n return (\n <div className=\"rounded-md border border-border1 bg-surface2 px-3 py-2 text-xs shadow-lg\">\n {label !== undefined && <p className=\"mb-1 font-medium text-icon6\">{String(label)}</p>}\n <div className=\"grid gap-1 text-icon2\">\n <p>\n <span className=\"text-neutral3\">X:</span>{' '}\n <span className=\"font-mono\">{formatX ? formatX(xValue, point) : String(xValue)}</span>\n </p>\n <p>\n <span className=\"text-neutral3\">Y:</span>{' '}\n <span className=\"font-mono\">{formatY ? formatY(yValue, point) : String(yValue)}</span>\n </p>\n </div>\n </div>\n );\n}\n","import type { ScatterPlotChartFormatter } from './scatter-plot-chart';\nimport { Colors } from '@/ds/tokens';\n\nexport function getScatterPlotPointColor(point: Record<string, unknown>, colorKey?: string) {\n const color = colorKey ? point[colorKey] : undefined;\n return typeof color === 'string' && color.length > 0 ? color : Colors.accent3;\n}\n\nexport function getScatterPlotClickedPoint(payload: unknown) {\n return (payload as { payload?: Record<string, unknown> } | undefined)?.payload;\n}\n\nexport function formatScatterPlotAxisTick(value: unknown, formatter?: ScatterPlotChartFormatter) {\n return (formatter?.(value, {}) ?? String(value)).replace(/\\s+/g, '\\u00A0');\n}\n","import { CartesianGrid, ResponsiveContainer, Scatter, ScatterChart, Tooltip, XAxis, YAxis, ZAxis } from 'recharts';\nimport { ScatterPlotChartTooltip } from './scatter-plot-chart-tooltip';\nimport {\n formatScatterPlotAxisTick,\n getScatterPlotClickedPoint,\n getScatterPlotPointColor,\n} from './scatter-plot-chart-utils';\nimport { Colors } from '@/ds/tokens';\nimport { cn } from '@/lib/utils';\n\nconst LABEL_COLOR = '#a1a1aa';\nconst DEFAULT_POINT_SIZE = 48;\nconst CHART_MARGIN = { top: 16, right: 16, bottom: 16, left: 16 };\n\nexport type ScatterPlotChartDomain = [number | 'auto', number | 'auto'];\nexport type ScatterPlotChartFormatter = (value: unknown, point: Record<string, unknown>) => string;\nexport type ScatterPlotChartPointClickHandler = (point: Record<string, unknown>) => void;\n\nexport type ScatterPlotChartProps = {\n data: Array<Record<string, unknown>>;\n xKey: string;\n yKey: string;\n nameKey?: string;\n colorKey?: string;\n height?: React.CSSProperties['height'];\n xLabel?: string;\n yLabel?: string;\n xDomain?: ScatterPlotChartDomain;\n yDomain?: ScatterPlotChartDomain;\n formatX?: ScatterPlotChartFormatter;\n formatY?: ScatterPlotChartFormatter;\n formatTooltipLabel?: (point: Record<string, unknown>) => string;\n onPointClick?: ScatterPlotChartPointClickHandler;\n className?: string;\n};\n\nexport function ScatterPlotChart({\n data,\n xKey,\n yKey,\n nameKey,\n colorKey,\n height = 210,\n xLabel,\n yLabel,\n xDomain,\n yDomain,\n formatX,\n formatY,\n formatTooltipLabel,\n onPointClick,\n className,\n}: ScatterPlotChartProps) {\n const isClickable = typeof onPointClick === 'function';\n const fillsContainer = height === '100%';\n\n if (data.length === 0) {\n return (\n <div\n className={cn(\n 'flex items-center justify-center rounded-md border border-border1 text-ui-sm text-neutral3',\n className,\n )}\n style={{ height }}\n >\n No data to display\n </div>\n );\n }\n\n return (\n <div className={cn(fillsContainer && 'flex h-full min-h-0 flex-col', className)}>\n <div className={cn(fillsContainer && 'min-h-0 flex-1')} style={{ height: fillsContainer ? undefined : height }}>\n <ResponsiveContainer width=\"100%\" height=\"100%\">\n <ScatterChart data={data} margin={CHART_MARGIN}>\n <CartesianGrid stroke={Colors.neutral3} strokeDasharray=\"4 4\" strokeOpacity={0.18} vertical={false} />\n <XAxis\n dataKey={xKey}\n name={xLabel}\n type=\"number\"\n tick={{ fontSize: 10, fill: LABEL_COLOR, fontFamily: 'var(--font-mono)' }}\n tickLine={false}\n axisLine={false}\n domain={xDomain}\n tickFormatter={value => formatScatterPlotAxisTick(value, formatX)}\n />\n <YAxis\n dataKey={yKey}\n name={yLabel}\n type=\"number\"\n tick={{ fontSize: 10, fill: LABEL_COLOR, fontFamily: 'var(--font-mono)' }}\n tickLine={false}\n axisLine={false}\n width={44}\n domain={yDomain}\n tickFormatter={value => formatScatterPlotAxisTick(value, formatY)}\n />\n <ZAxis range={[DEFAULT_POINT_SIZE, DEFAULT_POINT_SIZE]} />\n <Tooltip\n cursor={{ stroke: Colors.neutral3, strokeOpacity: 0.16 }}\n content={\n <ScatterPlotChartTooltip\n xKey={xKey}\n yKey={yKey}\n nameKey={nameKey}\n formatX={formatX}\n formatY={formatY}\n formatTooltipLabel={formatTooltipLabel}\n />\n }\n />\n <Scatter\n data={data}\n fill={Colors.accent3}\n shape={(props: unknown) => {\n const point = (props as { payload?: Record<string, unknown> }).payload ?? {};\n const cx = (props as { cx?: number }).cx;\n const cy = (props as { cy?: number }).cy;\n if (typeof cx !== 'number' || typeof cy !== 'number') return <g />;\n return (\n <circle\n cx={cx}\n cy={cy}\n r={4}\n fill={getScatterPlotPointColor(point, colorKey)}\n opacity={0.9}\n style={{ cursor: isClickable ? 'pointer' : undefined }}\n />\n );\n }}\n onClick={(_: unknown, payload: unknown) => {\n const point = getScatterPlotClickedPoint(payload);\n if (point) onPointClick?.(point);\n }}\n />\n </ScatterChart>\n </ResponsiveContainer>\n </div>\n </div>\n );\n}\n"],"names":["jsxs","jsx","Colors","cn","ResponsiveContainer","ScatterChart","CartesianGrid","XAxis","YAxis","ZAxis","Tooltip","Scatter"],"mappings":";;;;;;;;;AAOO,SAAS,uBAAA,CAAwB;AAAA,EACtC,MAAA;AAAA,EACA,OAAA;AAAA,EACA,IAAA;AAAA,EACA,IAAA;AAAA,EACA,OAAA;AAAA,EACA,OAAA;AAAA,EACA,OAAA;AAAA,EACA;AACF,CAAA,EASG;AACD,EAAA,MAAM,KAAA,GAAQ,OAAA,GAAU,CAAC,CAAA,EAAG,OAAA;AAC5B,EAAA,IAAI,CAAC,MAAA,IAAU,CAAC,KAAA,EAAO,OAAO,IAAA;AAE9B,EAAA,MAAM,QAAQ,kBAAA,GAAqB,KAAK,MAAM,OAAA,GAAU,KAAA,CAAM,OAAO,CAAA,GAAI,MAAA,CAAA;AACzE,EAAA,MAAM,MAAA,GAAS,MAAM,IAAI,CAAA;AACzB,EAAA,MAAM,MAAA,GAAS,MAAM,IAAI,CAAA;AAEzB,EAAA,uBACEA,eAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAU,0EAAA,EACZ,QAAA,EAAA;AAAA,IAAA,KAAA,KAAU,0BAAaC,cAAA,C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,UAAA,MAAM,KAAA,GAAQ,2BAA2B,OAAO,CAAA;AAChD,UAAA,IAAI,KAAA,iBAAsB,KAAK,CAAA;AAAA,QACjC;AAAA;AAAA;AACF,GAAA,EACF,CAAA,EACF,GACF,CAAA,EACF,CAAA;AAEJ;;;;;;;;"}
|
|
@@ -1,2 +1,163 @@
|
|
|
1
|
-
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { ResponsiveContainer, ScatterChart, CartesianGrid, XAxis, YAxis, ZAxis, Tooltip, Scatter } from 'recharts';
|
|
3
|
+
import { C as Colors } from '../spacings-C87dXiT-.js';
|
|
4
|
+
import { c as cn } from '../cn-BakJzhuv.js';
|
|
5
|
+
|
|
6
|
+
function ScatterPlotChartTooltip({
|
|
7
|
+
active,
|
|
8
|
+
payload,
|
|
9
|
+
xKey,
|
|
10
|
+
yKey,
|
|
11
|
+
nameKey,
|
|
12
|
+
formatX,
|
|
13
|
+
formatY,
|
|
14
|
+
formatTooltipLabel
|
|
15
|
+
}) {
|
|
16
|
+
const point = payload?.[0]?.payload;
|
|
17
|
+
if (!active || !point) return null;
|
|
18
|
+
const label = formatTooltipLabel?.(point) ?? (nameKey ? point[nameKey] : void 0);
|
|
19
|
+
const xValue = point[xKey];
|
|
20
|
+
const yValue = point[yKey];
|
|
21
|
+
return /* @__PURE__ */ jsxs("div", { className: "rounded-md border border-border1 bg-surface2 px-3 py-2 text-xs shadow-lg", children: [
|
|
22
|
+
label !== void 0 && /* @__PURE__ */ jsx("p", { className: "mb-1 font-medium text-icon6", children: String(label) }),
|
|
23
|
+
/* @__PURE__ */ jsxs("div", { className: "grid gap-1 text-icon2", children: [
|
|
24
|
+
/* @__PURE__ */ jsxs("p", { children: [
|
|
25
|
+
/* @__PURE__ */ jsx("span", { className: "text-neutral3", children: "X:" }),
|
|
26
|
+
" ",
|
|
27
|
+
/* @__PURE__ */ jsx("span", { className: "font-mono", children: formatX ? formatX(xValue, point) : String(xValue) })
|
|
28
|
+
] }),
|
|
29
|
+
/* @__PURE__ */ jsxs("p", { children: [
|
|
30
|
+
/* @__PURE__ */ jsx("span", { className: "text-neutral3", children: "Y:" }),
|
|
31
|
+
" ",
|
|
32
|
+
/* @__PURE__ */ jsx("span", { className: "font-mono", children: formatY ? formatY(yValue, point) : String(yValue) })
|
|
33
|
+
] })
|
|
34
|
+
] })
|
|
35
|
+
] });
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function getScatterPlotPointColor(point, colorKey) {
|
|
39
|
+
const color = colorKey ? point[colorKey] : void 0;
|
|
40
|
+
return typeof color === "string" && color.length > 0 ? color : Colors.accent3;
|
|
41
|
+
}
|
|
42
|
+
function getScatterPlotClickedPoint(payload) {
|
|
43
|
+
return payload?.payload;
|
|
44
|
+
}
|
|
45
|
+
function formatScatterPlotAxisTick(value, formatter) {
|
|
46
|
+
return (formatter?.(value, {}) ?? String(value)).replace(/\s+/g, " ");
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const LABEL_COLOR = "#a1a1aa";
|
|
50
|
+
const DEFAULT_POINT_SIZE = 48;
|
|
51
|
+
const CHART_MARGIN = { top: 16, right: 16, bottom: 16, left: 16 };
|
|
52
|
+
function ScatterPlotChart({
|
|
53
|
+
data,
|
|
54
|
+
xKey,
|
|
55
|
+
yKey,
|
|
56
|
+
nameKey,
|
|
57
|
+
colorKey,
|
|
58
|
+
height = 210,
|
|
59
|
+
xLabel,
|
|
60
|
+
yLabel,
|
|
61
|
+
xDomain,
|
|
62
|
+
yDomain,
|
|
63
|
+
formatX,
|
|
64
|
+
formatY,
|
|
65
|
+
formatTooltipLabel,
|
|
66
|
+
onPointClick,
|
|
67
|
+
className
|
|
68
|
+
}) {
|
|
69
|
+
const isClickable = typeof onPointClick === "function";
|
|
70
|
+
const fillsContainer = height === "100%";
|
|
71
|
+
if (data.length === 0) {
|
|
72
|
+
return /* @__PURE__ */ jsx(
|
|
73
|
+
"div",
|
|
74
|
+
{
|
|
75
|
+
className: cn(
|
|
76
|
+
"flex items-center justify-center rounded-md border border-border1 text-ui-sm text-neutral3",
|
|
77
|
+
className
|
|
78
|
+
),
|
|
79
|
+
style: { height },
|
|
80
|
+
children: "No data to display"
|
|
81
|
+
}
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
return /* @__PURE__ */ jsx("div", { className: cn(fillsContainer && "flex h-full min-h-0 flex-col", className), children: /* @__PURE__ */ jsx("div", { className: cn(fillsContainer && "min-h-0 flex-1"), style: { height: fillsContainer ? void 0 : height }, children: /* @__PURE__ */ jsx(ResponsiveContainer, { width: "100%", height: "100%", children: /* @__PURE__ */ jsxs(ScatterChart, { data, margin: CHART_MARGIN, children: [
|
|
85
|
+
/* @__PURE__ */ jsx(CartesianGrid, { stroke: Colors.neutral3, strokeDasharray: "4 4", strokeOpacity: 0.18, vertical: false }),
|
|
86
|
+
/* @__PURE__ */ jsx(
|
|
87
|
+
XAxis,
|
|
88
|
+
{
|
|
89
|
+
dataKey: xKey,
|
|
90
|
+
name: xLabel,
|
|
91
|
+
type: "number",
|
|
92
|
+
tick: { fontSize: 10, fill: LABEL_COLOR, fontFamily: "var(--font-mono)" },
|
|
93
|
+
tickLine: false,
|
|
94
|
+
axisLine: false,
|
|
95
|
+
domain: xDomain,
|
|
96
|
+
tickFormatter: (value) => formatScatterPlotAxisTick(value, formatX)
|
|
97
|
+
}
|
|
98
|
+
),
|
|
99
|
+
/* @__PURE__ */ jsx(
|
|
100
|
+
YAxis,
|
|
101
|
+
{
|
|
102
|
+
dataKey: yKey,
|
|
103
|
+
name: yLabel,
|
|
104
|
+
type: "number",
|
|
105
|
+
tick: { fontSize: 10, fill: LABEL_COLOR, fontFamily: "var(--font-mono)" },
|
|
106
|
+
tickLine: false,
|
|
107
|
+
axisLine: false,
|
|
108
|
+
width: 44,
|
|
109
|
+
domain: yDomain,
|
|
110
|
+
tickFormatter: (value) => formatScatterPlotAxisTick(value, formatY)
|
|
111
|
+
}
|
|
112
|
+
),
|
|
113
|
+
/* @__PURE__ */ jsx(ZAxis, { range: [DEFAULT_POINT_SIZE, DEFAULT_POINT_SIZE] }),
|
|
114
|
+
/* @__PURE__ */ jsx(
|
|
115
|
+
Tooltip,
|
|
116
|
+
{
|
|
117
|
+
cursor: { stroke: Colors.neutral3, strokeOpacity: 0.16 },
|
|
118
|
+
content: /* @__PURE__ */ jsx(
|
|
119
|
+
ScatterPlotChartTooltip,
|
|
120
|
+
{
|
|
121
|
+
xKey,
|
|
122
|
+
yKey,
|
|
123
|
+
nameKey,
|
|
124
|
+
formatX,
|
|
125
|
+
formatY,
|
|
126
|
+
formatTooltipLabel
|
|
127
|
+
}
|
|
128
|
+
)
|
|
129
|
+
}
|
|
130
|
+
),
|
|
131
|
+
/* @__PURE__ */ jsx(
|
|
132
|
+
Scatter,
|
|
133
|
+
{
|
|
134
|
+
data,
|
|
135
|
+
fill: Colors.accent3,
|
|
136
|
+
shape: (props) => {
|
|
137
|
+
const point = props.payload ?? {};
|
|
138
|
+
const cx = props.cx;
|
|
139
|
+
const cy = props.cy;
|
|
140
|
+
if (typeof cx !== "number" || typeof cy !== "number") return /* @__PURE__ */ jsx("g", {});
|
|
141
|
+
return /* @__PURE__ */ jsx(
|
|
142
|
+
"circle",
|
|
143
|
+
{
|
|
144
|
+
cx,
|
|
145
|
+
cy,
|
|
146
|
+
r: 4,
|
|
147
|
+
fill: getScatterPlotPointColor(point, colorKey),
|
|
148
|
+
opacity: 0.9,
|
|
149
|
+
style: { cursor: isClickable ? "pointer" : void 0 }
|
|
150
|
+
}
|
|
151
|
+
);
|
|
152
|
+
},
|
|
153
|
+
onClick: (_, payload) => {
|
|
154
|
+
const point = getScatterPlotClickedPoint(payload);
|
|
155
|
+
if (point) onPointClick?.(point);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
)
|
|
159
|
+
] }) }) }) });
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
export { ScatterPlotChart, ScatterPlotChartTooltip, formatScatterPlotAxisTick, getScatterPlotClickedPoint, getScatterPlotPointColor };
|
|
2
163
|
//# sourceMappingURL=ScatterPlotChart.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScatterPlotChart.es.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"ScatterPlotChart.es.js","sources":["../../src/ds/components/ScatterPlotChart/scatter-plot-chart-tooltip.tsx","../../src/ds/components/ScatterPlotChart/scatter-plot-chart-utils.ts","../../src/ds/components/ScatterPlotChart/scatter-plot-chart.tsx"],"sourcesContent":["import type { ScatterPlotChartFormatter } from './scatter-plot-chart';\n\ntype ScatterTooltipPayload = Array<{\n color?: string;\n payload?: Record<string, unknown>;\n}>;\n\nexport function ScatterPlotChartTooltip({\n active,\n payload,\n xKey,\n yKey,\n nameKey,\n formatX,\n formatY,\n formatTooltipLabel,\n}: {\n active?: boolean;\n payload?: ScatterTooltipPayload;\n xKey: string;\n yKey: string;\n nameKey?: string;\n formatX?: ScatterPlotChartFormatter;\n formatY?: ScatterPlotChartFormatter;\n formatTooltipLabel?: (point: Record<string, unknown>) => string;\n}) {\n const point = payload?.[0]?.payload;\n if (!active || !point) return null;\n\n const label = formatTooltipLabel?.(point) ?? (nameKey ? point[nameKey] : undefined);\n const xValue = point[xKey];\n const yValue = point[yKey];\n\n return (\n <div className=\"rounded-md border border-border1 bg-surface2 px-3 py-2 text-xs shadow-lg\">\n {label !== undefined && <p className=\"mb-1 font-medium text-icon6\">{String(label)}</p>}\n <div className=\"grid gap-1 text-icon2\">\n <p>\n <span className=\"text-neutral3\">X:</span>{' '}\n <span className=\"font-mono\">{formatX ? formatX(xValue, point) : String(xValue)}</span>\n </p>\n <p>\n <span className=\"text-neutral3\">Y:</span>{' '}\n <span className=\"font-mono\">{formatY ? formatY(yValue, point) : String(yValue)}</span>\n </p>\n </div>\n </div>\n );\n}\n","import type { ScatterPlotChartFormatter } from './scatter-plot-chart';\nimport { Colors } from '@/ds/tokens';\n\nexport function getScatterPlotPointColor(point: Record<string, unknown>, colorKey?: string) {\n const color = colorKey ? point[colorKey] : undefined;\n return typeof color === 'string' && color.length > 0 ? color : Colors.accent3;\n}\n\nexport function getScatterPlotClickedPoint(payload: unknown) {\n return (payload as { payload?: Record<string, unknown> } | undefined)?.payload;\n}\n\nexport function formatScatterPlotAxisTick(value: unknown, formatter?: ScatterPlotChartFormatter) {\n return (formatter?.(value, {}) ?? String(value)).replace(/\\s+/g, '\\u00A0');\n}\n","import { CartesianGrid, ResponsiveContainer, Scatter, ScatterChart, Tooltip, XAxis, YAxis, ZAxis } from 'recharts';\nimport { ScatterPlotChartTooltip } from './scatter-plot-chart-tooltip';\nimport {\n formatScatterPlotAxisTick,\n getScatterPlotClickedPoint,\n getScatterPlotPointColor,\n} from './scatter-plot-chart-utils';\nimport { Colors } from '@/ds/tokens';\nimport { cn } from '@/lib/utils';\n\nconst LABEL_COLOR = '#a1a1aa';\nconst DEFAULT_POINT_SIZE = 48;\nconst CHART_MARGIN = { top: 16, right: 16, bottom: 16, left: 16 };\n\nexport type ScatterPlotChartDomain = [number | 'auto', number | 'auto'];\nexport type ScatterPlotChartFormatter = (value: unknown, point: Record<string, unknown>) => string;\nexport type ScatterPlotChartPointClickHandler = (point: Record<string, unknown>) => void;\n\nexport type ScatterPlotChartProps = {\n data: Array<Record<string, unknown>>;\n xKey: string;\n yKey: string;\n nameKey?: string;\n colorKey?: string;\n height?: React.CSSProperties['height'];\n xLabel?: string;\n yLabel?: string;\n xDomain?: ScatterPlotChartDomain;\n yDomain?: ScatterPlotChartDomain;\n formatX?: ScatterPlotChartFormatter;\n formatY?: ScatterPlotChartFormatter;\n formatTooltipLabel?: (point: Record<string, unknown>) => string;\n onPointClick?: ScatterPlotChartPointClickHandler;\n className?: string;\n};\n\nexport function ScatterPlotChart({\n data,\n xKey,\n yKey,\n nameKey,\n colorKey,\n height = 210,\n xLabel,\n yLabel,\n xDomain,\n yDomain,\n formatX,\n formatY,\n formatTooltipLabel,\n onPointClick,\n className,\n}: ScatterPlotChartProps) {\n const isClickable = typeof onPointClick === 'function';\n const fillsContainer = height === '100%';\n\n if (data.length === 0) {\n return (\n <div\n className={cn(\n 'flex items-center justify-center rounded-md border border-border1 text-ui-sm text-neutral3',\n className,\n )}\n style={{ height }}\n >\n No data to display\n </div>\n );\n }\n\n return (\n <div className={cn(fillsContainer && 'flex h-full min-h-0 flex-col', className)}>\n <div className={cn(fillsContainer && 'min-h-0 flex-1')} style={{ height: fillsContainer ? undefined : height }}>\n <ResponsiveContainer width=\"100%\" height=\"100%\">\n <ScatterChart data={data} margin={CHART_MARGIN}>\n <CartesianGrid stroke={Colors.neutral3} strokeDasharray=\"4 4\" strokeOpacity={0.18} vertical={false} />\n <XAxis\n dataKey={xKey}\n name={xLabel}\n type=\"number\"\n tick={{ fontSize: 10, fill: LABEL_COLOR, fontFamily: 'var(--font-mono)' }}\n tickLine={false}\n axisLine={false}\n domain={xDomain}\n tickFormatter={value => formatScatterPlotAxisTick(value, formatX)}\n />\n <YAxis\n dataKey={yKey}\n name={yLabel}\n type=\"number\"\n tick={{ fontSize: 10, fill: LABEL_COLOR, fontFamily: 'var(--font-mono)' }}\n tickLine={false}\n axisLine={false}\n width={44}\n domain={yDomain}\n tickFormatter={value => formatScatterPlotAxisTick(value, formatY)}\n />\n <ZAxis range={[DEFAULT_POINT_SIZE, DEFAULT_POINT_SIZE]} />\n <Tooltip\n cursor={{ stroke: Colors.neutral3, strokeOpacity: 0.16 }}\n content={\n <ScatterPlotChartTooltip\n xKey={xKey}\n yKey={yKey}\n nameKey={nameKey}\n formatX={formatX}\n formatY={formatY}\n formatTooltipLabel={formatTooltipLabel}\n />\n }\n />\n <Scatter\n data={data}\n fill={Colors.accent3}\n shape={(props: unknown) => {\n const point = (props as { payload?: Record<string, unknown> }).payload ?? {};\n const cx = (props as { cx?: number }).cx;\n const cy = (props as { cy?: number }).cy;\n if (typeof cx !== 'number' || typeof cy !== 'number') return <g />;\n return (\n <circle\n cx={cx}\n cy={cy}\n r={4}\n fill={getScatterPlotPointColor(point, colorKey)}\n opacity={0.9}\n style={{ cursor: isClickable ? 'pointer' : undefined }}\n />\n );\n }}\n onClick={(_: unknown, payload: unknown) => {\n const point = getScatterPlotClickedPoint(payload);\n if (point) onPointClick?.(point);\n }}\n />\n </ScatterChart>\n </ResponsiveContainer>\n </div>\n </div>\n );\n}\n"],"names":[],"mappings":";;;;;AAOO,SAAS,uBAAA,CAAwB;AAAA,EACtC,MAAA;AAAA,EACA,OAAA;AAAA,EACA,IAAA;AAAA,EACA,IAAA;AAAA,EACA,OAAA;AAAA,EACA,OAAA;AAAA,EACA,OAAA;AAAA,EACA;AACF,CAAA,EASG;AACD,EAAA,MAAM,KAAA,GAAQ,OAAA,GAAU,CAAC,CAAA,EAAG,OAAA;AAC5B,EAAA,IAAI,CAAC,MAAA,IAAU,CAAC,KAAA,EAAO,OAAO,IAAA;AAE9B,EAAA,MAAM,QAAQ,kBAAA,GAAqB,KAAK,MAAM,OAAA,GAAU,KAAA,CAAM,OAAO,CAAA,GAAI,MAAA,CAAA;AACzE,EAAA,MAAM,MAAA,GAAS,MAAM,IAAI,CAAA;AACzB,EAAA,MAAM,MAAA,GAAS,MAAM,IAAI,CAAA;AAEzB,EAAA,uBACE,IAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAU,0EAAA,EACZ,QAAA,EAAA;AAAA,IAAA,KAAA,KAAU,0BAAa,GAAA,CAAC,GAAA,EAAA,EAAE,WAAU,6BAAA,EAA+B,QAAA,EAAA,MAAA,CAAO,KAAK,CAAA,EAAE,CAAA;AAAA,oBAClF,IAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAU,uBAAA,EACb,QAAA,EAAA;AAAA,sBAAA,IAAA,CAAC,GAAA,EAAA,EACC,QAAA,EAAA;AAAA,wBAAA,GAAA,CAAC,MAAA,EAAA,EAAK,SAAA,EAAU,eAAA,EAAgB,QAAA,EAAA,IAAA,EAAE,CAAA;AAAA,QAAQ,GAAA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