@robr0/design-system 0.10.0 → 0.12.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/README.md +9 -8
- package/charts.d.ts +1 -0
- package/charts.js +2 -0
- package/components/AgentPlan/AgentPlan.css +14 -3
- package/components/AiButton/AiButton.css +1 -1
- package/components/Alert/Alert.css +9 -0
- package/components/AlertDialog/AlertDialog.css +3 -1
- package/components/AlertDialog/AlertDialog.js +2 -3
- package/components/AppLayout/AppLayout.d.ts +7 -1
- package/components/AppLayout/AppLayout.js +2 -1
- package/components/AppSidebar/AppSidebar.css +113 -40
- package/components/AppSidebar/AppSidebar.d.ts +14 -1
- package/components/AppSidebar/AppSidebar.js +26 -17
- package/components/Badge/Badge.css +4 -5
- package/components/Card/Card.css +7 -2
- package/components/CardStack/CardStack.css +106 -0
- package/components/CardStack/CardStack.d.ts +44 -0
- package/components/CardStack/CardStack.js +140 -0
- package/components/Carousel/Carousel.css +9 -0
- package/components/Carousel/Carousel.js +37 -4
- package/components/Chart/AreaChart.d.ts +5 -1
- package/components/Chart/AreaChart.js +11 -9
- package/components/Chart/BarChart.d.ts +3 -1
- package/components/Chart/BarChart.js +3 -3
- package/components/Chart/Chart.css +45 -0
- package/components/Chart/ComboChart.d.ts +40 -0
- package/components/Chart/ComboChart.js +142 -0
- package/components/Chart/LineChart.d.ts +3 -1
- package/components/Chart/LineChart.js +7 -6
- package/components/Chart/PieChart.d.ts +3 -1
- package/components/Chart/PieChart.js +5 -18
- package/components/Chart/RadarChart.d.ts +3 -1
- package/components/Chart/RadarChart.js +8 -7
- package/components/Chart/RadialChart.d.ts +7 -1
- package/components/Chart/RadialChart.js +53 -58
- package/components/Chart/ScatterChart.d.ts +3 -1
- package/components/Chart/ScatterChart.js +6 -16
- package/components/Chart/StackedBarChart.d.ts +3 -1
- package/components/Chart/StackedBarChart.js +5 -18
- package/components/Chart/Treemap.d.ts +3 -1
- package/components/Chart/Treemap.js +6 -20
- package/components/Chart/palette.d.ts +1 -0
- package/components/Chart/palette.js +17 -0
- package/components/ChatMarker/ChatMarker.css +9 -0
- package/components/ChatMessage/ChatMessage.css +16 -0
- package/components/ChatThread/ChatThread.js +2 -2
- package/components/Chip/Chip.css +9 -0
- package/components/CodeBlock/CodeBlock.css +10 -1
- package/components/CodeBlock/CodeBlock.js +2 -1
- package/components/ColorPicker/ColorPicker.js +10 -0
- package/components/Combobox/Combobox.css +9 -0
- package/components/CommandPalette/CommandPalette.css +9 -0
- package/components/CommandPalette/CommandPalette.js +31 -5
- package/components/Composer/Composer.css +118 -0
- package/components/Composer/Composer.d.ts +7 -0
- package/components/Composer/Composer.js +7 -1
- package/components/ContactCard/ContactCard.css +9 -0
- package/components/ContextMenu/ContextMenu.js +39 -3
- package/components/DatePicker/DatePicker.js +16 -0
- package/components/Dialog/Dialog.css +3 -1
- package/components/Dialog/Dialog.js +5 -4
- package/components/DocumentChip/DocumentChip.css +9 -0
- package/components/Dropdown/Dropdown.js +22 -3
- package/components/DropdownMenu/DropdownMenu.js +43 -6
- package/components/EmptyState/EmptyState.css +9 -0
- package/components/FileInput/FileInput.css +9 -0
- package/components/FunnelChart/FunnelChart.css +41 -0
- package/components/FunnelChart/FunnelChart.d.ts +40 -0
- package/components/FunnelChart/FunnelChart.js +48 -0
- package/components/Globe/Globe.css +155 -0
- package/components/Globe/Globe.d.ts +96 -0
- package/components/Globe/Globe.js +415 -0
- package/components/InterruptCard/InterruptCard.css +27 -17
- package/components/InterruptCard/InterruptCard.d.ts +1 -1
- package/components/InterruptCard/InterruptCard.js +1 -1
- package/components/LegendTile/LegendTile.css +60 -0
- package/components/LegendTile/LegendTile.d.ts +30 -0
- package/components/LegendTile/LegendTile.js +21 -0
- package/components/MapCallout/MapCallout.css +46 -0
- package/components/MapCallout/MapCallout.d.ts +29 -0
- package/components/MapCallout/MapCallout.js +17 -0
- package/components/MapLegend/MapLegend.css +88 -0
- package/components/MapLegend/MapLegend.d.ts +39 -0
- package/components/MapLegend/MapLegend.js +68 -0
- package/components/MessageActions/MessageActions.css +9 -0
- package/components/MessageCard/MessageCard.css +68 -16
- package/components/MessageCard/MessageCard.d.ts +1 -1
- package/components/MessageCard/MessageCard.js +6 -4
- package/components/ModelPicker/ModelPicker.css +4 -1
- package/components/ModelPicker/ModelPicker.js +43 -1
- package/components/NotificationCenter/NotificationCenter.css +9 -0
- package/components/NotificationCenter/NotificationCenter.js +26 -10
- package/components/NumberInput/NumberInput.css +9 -0
- package/components/Panel/Panel.css +26 -0
- package/components/Panel/Panel.d.ts +22 -0
- package/components/Panel/Panel.js +19 -0
- package/components/Popover/Popover.css +3 -1
- package/components/Popover/Popover.js +2 -1
- package/components/SourceChip/SourceChip.css +9 -0
- package/components/Stat/Stat.css +44 -2
- package/components/Stat/Stat.d.ts +3 -1
- package/components/Stat/Stat.js +7 -1
- package/components/Stepper/Stepper.css +9 -0
- package/components/TagInput/TagInput.css +9 -0
- package/components/TimePicker/TimePicker.js +4 -1
- package/components/Toast/Toast.css +32 -11
- package/components/Toast/Toast.js +5 -4
- package/components/ToggleGroup/ToggleGroup.css +9 -0
- package/components/ToolCall/ToolCall.css +18 -6
- package/components/Tooltip/Tooltip.js +20 -16
- package/components/registry.json +70 -0
- package/components/registry.json.d.ts +70 -0
- package/components/registry.json.js +2 -2
- package/index.d.ts +7 -0
- package/index.js +14 -0
- package/package.json +5 -1
- package/tokens/motion.d.ts +23 -0
- package/tokens/motion.js +14 -0
- package/tokens/registry.json +21 -1
- package/tokens/registry.json.d.ts +21 -1
- package/tokens/registry.json.js +1 -1
- package/tokens/tokens-dark.css +14 -0
- package/tokens/tokens-light.css +22 -0
- package/tokens/tokens-primitives.css +2 -0
- package/tokens/tokens-typography.css +32 -5
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { ChartSummaryItem } from './BarChart';
|
|
2
|
+
export interface ComboChartProps {
|
|
3
|
+
/** Array of data objects */
|
|
4
|
+
data: Record<string, unknown>[];
|
|
5
|
+
/** Key in data for x-axis values */
|
|
6
|
+
xKey?: string;
|
|
7
|
+
/** Key in data for the bar series */
|
|
8
|
+
barKey: string;
|
|
9
|
+
/** Display name for the bar series, shown in the tooltip; defaults to the key */
|
|
10
|
+
barLabel?: string;
|
|
11
|
+
/** Key in data for the line series */
|
|
12
|
+
lineKey: string;
|
|
13
|
+
/** Display name for the line series, shown in the tooltip; defaults to the key */
|
|
14
|
+
lineLabel?: string;
|
|
15
|
+
/** Bar fill colour (CSS value or token reference) */
|
|
16
|
+
barColor?: string;
|
|
17
|
+
/** Line stroke colour (CSS value or token reference) */
|
|
18
|
+
lineColor?: string;
|
|
19
|
+
/** Plot the line on its own right-hand y-axis, for series in different units */
|
|
20
|
+
secondaryAxis?: boolean;
|
|
21
|
+
/** Chart title */
|
|
22
|
+
title?: string;
|
|
23
|
+
/** Description text below the title */
|
|
24
|
+
subtitle?: string;
|
|
25
|
+
/** Summary stats displayed in the header */
|
|
26
|
+
summaryItems?: ChartSummaryItem[];
|
|
27
|
+
/** Chart area height in pixels */
|
|
28
|
+
height?: number;
|
|
29
|
+
/** Strip the card chrome (border, padding, fill) when the chart sits inside another panel that supplies the surface */
|
|
30
|
+
bare?: boolean;
|
|
31
|
+
/** Additional CSS classes on the wrapper */
|
|
32
|
+
className?: string;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Combo chart built on Recharts with design-system tokens: one bar series
|
|
36
|
+
* with an overlaid line series, optionally on a second y-axis, for pairs
|
|
37
|
+
* like monthly spend (bars) against ROAS (line). Part of the Chart component
|
|
38
|
+
* family, sharing wrapper, header, tooltip, and summary-stat styles.
|
|
39
|
+
*/
|
|
40
|
+
export declare const ComboChart: ({ data, xKey, barKey, barLabel, lineKey, lineLabel, barColor, lineColor, secondaryAxis, title, subtitle, summaryItems, height, bare, className, }: ComboChartProps) => import("react").JSX.Element;
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback } from "react";
|
|
3
|
+
import { ResponsiveContainer, ComposedChart, CartesianGrid, XAxis, YAxis, Tooltip, Bar, Line } from "recharts";
|
|
4
|
+
import { getChartSeriesColors } from "./palette.js";
|
|
5
|
+
import "./Chart.css";
|
|
6
|
+
function getCSSVar(name, fallback) {
|
|
7
|
+
return `var(${name}, ${fallback})`;
|
|
8
|
+
}
|
|
9
|
+
function ComboTooltip({ active, payload, label }) {
|
|
10
|
+
if (!active || !payload?.length) return null;
|
|
11
|
+
return /* @__PURE__ */ jsxs("div", { className: "ds-chart__tooltip", children: [
|
|
12
|
+
/* @__PURE__ */ jsx("div", { className: "ds-chart__tooltip-label", children: label }),
|
|
13
|
+
payload.map((entry, i) => /* @__PURE__ */ jsxs("div", { className: "ds-chart__tooltip-row", children: [
|
|
14
|
+
/* @__PURE__ */ jsx(
|
|
15
|
+
"span",
|
|
16
|
+
{
|
|
17
|
+
className: "ds-chart__tooltip-dot",
|
|
18
|
+
style: { backgroundColor: entry.color || entry.fill }
|
|
19
|
+
}
|
|
20
|
+
),
|
|
21
|
+
/* @__PURE__ */ jsx("span", { className: "ds-chart__tooltip-name", children: entry.name }),
|
|
22
|
+
/* @__PURE__ */ jsx("span", { className: "ds-chart__tooltip-value", children: entry.value?.toLocaleString() })
|
|
23
|
+
] }, i))
|
|
24
|
+
] });
|
|
25
|
+
}
|
|
26
|
+
const ComboChart = ({
|
|
27
|
+
data,
|
|
28
|
+
xKey = "label",
|
|
29
|
+
barKey,
|
|
30
|
+
barLabel,
|
|
31
|
+
lineKey,
|
|
32
|
+
lineLabel,
|
|
33
|
+
barColor,
|
|
34
|
+
lineColor,
|
|
35
|
+
secondaryAxis = true,
|
|
36
|
+
title,
|
|
37
|
+
subtitle,
|
|
38
|
+
summaryItems,
|
|
39
|
+
height = 350,
|
|
40
|
+
bare = false,
|
|
41
|
+
className = ""
|
|
42
|
+
}) => {
|
|
43
|
+
const baseClass = "ds-chart";
|
|
44
|
+
const classes = [baseClass, bare ? `${baseClass}--bare` : "", className].filter(Boolean).join(" ");
|
|
45
|
+
const seriesColors = getChartSeriesColors();
|
|
46
|
+
const resolvedBarColor = barColor || getCSSVar("--color-action-primary-bg", "#0E6E8F");
|
|
47
|
+
const resolvedLineColor = lineColor || seriesColors[1];
|
|
48
|
+
const textSecondary = getCSSVar("--color-text-secondary", "#A2A2A2");
|
|
49
|
+
const gridColor = getCSSVar("--color-divider", "#232323");
|
|
50
|
+
const cursorColor = getCSSVar("--color-bg-container-secondary", "#303030");
|
|
51
|
+
const resolvedBarLabel = barLabel || barKey;
|
|
52
|
+
const resolvedLineLabel = lineLabel || lineKey;
|
|
53
|
+
const renderTooltip = useCallback(
|
|
54
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
55
|
+
(props) => /* @__PURE__ */ jsx(ComboTooltip, { ...props }),
|
|
56
|
+
[]
|
|
57
|
+
);
|
|
58
|
+
return /* @__PURE__ */ jsxs("div", { className: classes, children: [
|
|
59
|
+
(title || subtitle || summaryItems) && /* @__PURE__ */ jsxs("div", { className: `${baseClass}__header`, children: [
|
|
60
|
+
/* @__PURE__ */ jsxs("div", { className: `${baseClass}__header-text`, children: [
|
|
61
|
+
title && /* @__PURE__ */ jsx("h3", { className: `${baseClass}__title`, children: title }),
|
|
62
|
+
subtitle && /* @__PURE__ */ jsx("p", { className: `${baseClass}__subtitle`, children: subtitle })
|
|
63
|
+
] }),
|
|
64
|
+
summaryItems && summaryItems.length > 0 && /* @__PURE__ */ jsx("div", { className: `${baseClass}__summary`, children: summaryItems.map((item, i) => /* @__PURE__ */ jsxs("div", { className: `${baseClass}__summary-item`, children: [
|
|
65
|
+
/* @__PURE__ */ jsx("span", { className: `${baseClass}__summary-label`, children: item.label }),
|
|
66
|
+
/* @__PURE__ */ jsx("span", { className: `${baseClass}__summary-value`, children: typeof item.value === "number" ? item.value.toLocaleString() : item.value })
|
|
67
|
+
] }, i)) })
|
|
68
|
+
] }),
|
|
69
|
+
/* @__PURE__ */ jsx("div", { className: `${baseClass}__body`, children: /* @__PURE__ */ jsx(ResponsiveContainer, { width: "100%", height, children: /* @__PURE__ */ jsxs(
|
|
70
|
+
ComposedChart,
|
|
71
|
+
{
|
|
72
|
+
data,
|
|
73
|
+
margin: { top: 8, right: secondaryAxis ? -12 : 4, bottom: 0, left: -12 },
|
|
74
|
+
children: [
|
|
75
|
+
/* @__PURE__ */ jsx(CartesianGrid, { vertical: false, stroke: gridColor }),
|
|
76
|
+
/* @__PURE__ */ jsx(
|
|
77
|
+
XAxis,
|
|
78
|
+
{
|
|
79
|
+
dataKey: xKey,
|
|
80
|
+
tick: { fill: textSecondary, fontSize: 12 },
|
|
81
|
+
tickLine: false,
|
|
82
|
+
axisLine: { stroke: gridColor }
|
|
83
|
+
}
|
|
84
|
+
),
|
|
85
|
+
/* @__PURE__ */ jsx(
|
|
86
|
+
YAxis,
|
|
87
|
+
{
|
|
88
|
+
yAxisId: "bar",
|
|
89
|
+
tick: { fill: textSecondary, fontSize: 12 },
|
|
90
|
+
tickLine: false,
|
|
91
|
+
axisLine: false
|
|
92
|
+
}
|
|
93
|
+
),
|
|
94
|
+
secondaryAxis && /* @__PURE__ */ jsx(
|
|
95
|
+
YAxis,
|
|
96
|
+
{
|
|
97
|
+
yAxisId: "line",
|
|
98
|
+
orientation: "right",
|
|
99
|
+
tick: { fill: textSecondary, fontSize: 12 },
|
|
100
|
+
tickLine: false,
|
|
101
|
+
axisLine: false
|
|
102
|
+
}
|
|
103
|
+
),
|
|
104
|
+
/* @__PURE__ */ jsx(
|
|
105
|
+
Tooltip,
|
|
106
|
+
{
|
|
107
|
+
content: renderTooltip,
|
|
108
|
+
cursor: { fill: cursorColor, opacity: 0.4 }
|
|
109
|
+
}
|
|
110
|
+
),
|
|
111
|
+
/* @__PURE__ */ jsx(
|
|
112
|
+
Bar,
|
|
113
|
+
{
|
|
114
|
+
yAxisId: "bar",
|
|
115
|
+
dataKey: barKey,
|
|
116
|
+
name: resolvedBarLabel,
|
|
117
|
+
fill: resolvedBarColor,
|
|
118
|
+
radius: [3, 3, 0, 0],
|
|
119
|
+
maxBarSize: 32
|
|
120
|
+
}
|
|
121
|
+
),
|
|
122
|
+
/* @__PURE__ */ jsx(
|
|
123
|
+
Line,
|
|
124
|
+
{
|
|
125
|
+
yAxisId: secondaryAxis ? "line" : "bar",
|
|
126
|
+
type: "monotone",
|
|
127
|
+
dataKey: lineKey,
|
|
128
|
+
name: resolvedLineLabel,
|
|
129
|
+
stroke: resolvedLineColor,
|
|
130
|
+
strokeWidth: 2,
|
|
131
|
+
dot: false,
|
|
132
|
+
activeDot: { r: 4, strokeWidth: 0 }
|
|
133
|
+
}
|
|
134
|
+
)
|
|
135
|
+
]
|
|
136
|
+
}
|
|
137
|
+
) }) })
|
|
138
|
+
] });
|
|
139
|
+
};
|
|
140
|
+
export {
|
|
141
|
+
ComboChart
|
|
142
|
+
};
|
|
@@ -24,6 +24,8 @@ export interface LineChartProps {
|
|
|
24
24
|
summaryItems?: ChartSummaryItem[];
|
|
25
25
|
/** Chart area height in pixels */
|
|
26
26
|
height?: number;
|
|
27
|
+
/** Strip the card chrome (border, padding, fill) when the chart sits inside another panel that supplies the surface */
|
|
28
|
+
bare?: boolean;
|
|
27
29
|
/** Additional CSS classes on the wrapper */
|
|
28
30
|
className?: string;
|
|
29
31
|
}
|
|
@@ -31,4 +33,4 @@ export interface LineChartProps {
|
|
|
31
33
|
* Line chart built on Recharts with design-system tokens.
|
|
32
34
|
* Supports multiple series with individual colours.
|
|
33
35
|
*/
|
|
34
|
-
export declare const LineChart: ({ data, xKey, series, title, subtitle, summaryItems, height, className, }: LineChartProps) => import("react").JSX.Element;
|
|
36
|
+
export declare const LineChart: ({ data, xKey, series, title, subtitle, summaryItems, height, bare, className, }: LineChartProps) => import("react").JSX.Element;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useCallback } from "react";
|
|
3
3
|
import { ResponsiveContainer, LineChart as LineChart$1, CartesianGrid, XAxis, YAxis, Tooltip, Line } from "recharts";
|
|
4
|
+
import { getChartSeriesColors } from "./palette.js";
|
|
4
5
|
import "./Chart.css";
|
|
5
6
|
function getCSSVar(name, fallback) {
|
|
6
|
-
|
|
7
|
-
return getComputedStyle(document.documentElement).getPropertyValue(name).trim() || fallback;
|
|
7
|
+
return `var(${name}, ${fallback})`;
|
|
8
8
|
}
|
|
9
9
|
function LineChartTooltip({ active, payload, label }) {
|
|
10
10
|
if (!active || !payload?.length) return null;
|
|
@@ -25,13 +25,14 @@ const LineChart = ({
|
|
|
25
25
|
subtitle,
|
|
26
26
|
summaryItems,
|
|
27
27
|
height = 350,
|
|
28
|
+
bare = false,
|
|
28
29
|
className = ""
|
|
29
30
|
}) => {
|
|
30
31
|
const baseClass = "ds-chart";
|
|
31
|
-
const classes = [baseClass, className].filter(Boolean).join(" ");
|
|
32
|
+
const classes = [baseClass, bare ? `${baseClass}--bare` : "", className].filter(Boolean).join(" ");
|
|
32
33
|
const textSecondary = getCSSVar("--color-text-secondary", "#A2A2A2");
|
|
33
34
|
const gridColor = getCSSVar("--color-divider", "#232323");
|
|
34
|
-
const
|
|
35
|
+
const seriesColors = getChartSeriesColors();
|
|
35
36
|
const renderTooltip = useCallback(
|
|
36
37
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
37
38
|
(props) => /* @__PURE__ */ jsx(LineChartTooltip, { ...props }),
|
|
@@ -68,13 +69,13 @@ const LineChart = ({
|
|
|
68
69
|
}
|
|
69
70
|
),
|
|
70
71
|
/* @__PURE__ */ jsx(Tooltip, { content: renderTooltip }),
|
|
71
|
-
series.map((s) => /* @__PURE__ */ jsx(
|
|
72
|
+
series.map((s, i) => /* @__PURE__ */ jsx(
|
|
72
73
|
Line,
|
|
73
74
|
{
|
|
74
75
|
type: "monotone",
|
|
75
76
|
dataKey: s.dataKey,
|
|
76
77
|
name: s.label,
|
|
77
|
-
stroke: s.color ||
|
|
78
|
+
stroke: s.color || seriesColors[i % seriesColors.length],
|
|
78
79
|
strokeWidth: 2,
|
|
79
80
|
strokeDasharray: s.strokeDasharray,
|
|
80
81
|
dot: false,
|
|
@@ -24,6 +24,8 @@ export interface PieChartProps {
|
|
|
24
24
|
outerRadius?: number;
|
|
25
25
|
/** Show legend */
|
|
26
26
|
showLegend?: boolean;
|
|
27
|
+
/** Strip the card chrome (border, padding, fill) when the chart sits inside another panel that supplies the surface */
|
|
28
|
+
bare?: boolean;
|
|
27
29
|
/** Additional CSS classes on the wrapper */
|
|
28
30
|
className?: string;
|
|
29
31
|
}
|
|
@@ -31,4 +33,4 @@ export interface PieChartProps {
|
|
|
31
33
|
* Pie / donut chart built on Recharts with design-system tokens.
|
|
32
34
|
* Set innerRadius > 0 for a donut variant.
|
|
33
35
|
*/
|
|
34
|
-
export declare const PieChart: ({ data, title, subtitle, summaryItems, height, innerRadius, outerRadius, showLegend, className, }: PieChartProps) => import("react").JSX.Element;
|
|
36
|
+
export declare const PieChart: ({ data, title, subtitle, summaryItems, height, innerRadius, outerRadius, showLegend, bare, className, }: PieChartProps) => import("react").JSX.Element;
|
|
@@ -1,24 +1,10 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useCallback } from "react";
|
|
3
3
|
import { ResponsiveContainer, PieChart as PieChart$1, Pie, Cell, Tooltip, Legend } from "recharts";
|
|
4
|
+
import { getChartSeriesColors } from "./palette.js";
|
|
4
5
|
import "./Chart.css";
|
|
5
|
-
function getDefaultColors() {
|
|
6
|
-
if (typeof window === "undefined") {
|
|
7
|
-
return ["#0E6E8F", "#06D6A0", "#FFD166", "#EF476F", "#9E47EF", "#EF8247"];
|
|
8
|
-
}
|
|
9
|
-
const get = (v, fb) => getComputedStyle(document.documentElement).getPropertyValue(v).trim() || fb;
|
|
10
|
-
return [
|
|
11
|
-
get("--color-action-primary-bg", "#0E6E8F"),
|
|
12
|
-
get("--color-core-accent-mint", "#06D6A0"),
|
|
13
|
-
get("--color-core-accent-gold", "#FFD166"),
|
|
14
|
-
get("--color-core-accent-coral", "#EF476F"),
|
|
15
|
-
get("--color-core-accent-violet", "#9E47EF"),
|
|
16
|
-
get("--color-core-accent-amber", "#EF8247")
|
|
17
|
-
];
|
|
18
|
-
}
|
|
19
6
|
function getCSSVar(name, fallback) {
|
|
20
|
-
|
|
21
|
-
return getComputedStyle(document.documentElement).getPropertyValue(name).trim() || fallback;
|
|
7
|
+
return `var(${name}, ${fallback})`;
|
|
22
8
|
}
|
|
23
9
|
function PieChartTooltip({ active, payload }) {
|
|
24
10
|
if (!active || !payload?.length) return null;
|
|
@@ -44,11 +30,12 @@ const PieChart = ({
|
|
|
44
30
|
innerRadius = 0,
|
|
45
31
|
outerRadius = 140,
|
|
46
32
|
showLegend = true,
|
|
33
|
+
bare = false,
|
|
47
34
|
className = ""
|
|
48
35
|
}) => {
|
|
49
36
|
const baseClass = "ds-chart";
|
|
50
|
-
const classes = [baseClass, className].filter(Boolean).join(" ");
|
|
51
|
-
const defaultColors =
|
|
37
|
+
const classes = [baseClass, bare ? `${baseClass}--bare` : "", className].filter(Boolean).join(" ");
|
|
38
|
+
const defaultColors = getChartSeriesColors();
|
|
52
39
|
const textSecondary = getCSSVar("--color-text-secondary", "#A2A2A2");
|
|
53
40
|
const renderTooltip = useCallback(
|
|
54
41
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
@@ -24,6 +24,8 @@ export interface RadarChartProps {
|
|
|
24
24
|
summaryItems?: ChartSummaryItem[];
|
|
25
25
|
/** Chart area height in pixels */
|
|
26
26
|
height?: number;
|
|
27
|
+
/** Strip the card chrome (border, padding, fill) when the chart sits inside another panel that supplies the surface */
|
|
28
|
+
bare?: boolean;
|
|
27
29
|
/** Additional CSS classes on the wrapper */
|
|
28
30
|
className?: string;
|
|
29
31
|
}
|
|
@@ -31,4 +33,4 @@ export interface RadarChartProps {
|
|
|
31
33
|
* Radar chart built on Recharts with design-system tokens.
|
|
32
34
|
* Renders one or more data series as filled polygons on a polar grid.
|
|
33
35
|
*/
|
|
34
|
-
export declare const RadarChart: ({ data, categoryKey, series, title, subtitle, summaryItems, height, className, }: RadarChartProps) => import("react").JSX.Element;
|
|
36
|
+
export declare const RadarChart: ({ data, categoryKey, series, title, subtitle, summaryItems, height, bare, className, }: RadarChartProps) => import("react").JSX.Element;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useCallback } from "react";
|
|
3
3
|
import { ResponsiveContainer, RadarChart as RadarChart$1, PolarGrid, PolarAngleAxis, PolarRadiusAxis, Tooltip, Radar, Legend } from "recharts";
|
|
4
|
+
import { getChartSeriesColors } from "./palette.js";
|
|
4
5
|
import "./Chart.css";
|
|
5
6
|
function getCSSVar(name, fallback) {
|
|
6
|
-
|
|
7
|
-
return getComputedStyle(document.documentElement).getPropertyValue(name).trim() || fallback;
|
|
7
|
+
return `var(${name}, ${fallback})`;
|
|
8
8
|
}
|
|
9
9
|
function RadarTooltip({ active, payload, label }) {
|
|
10
10
|
if (!active || !payload?.length) return null;
|
|
@@ -25,13 +25,14 @@ const RadarChart = ({
|
|
|
25
25
|
subtitle,
|
|
26
26
|
summaryItems,
|
|
27
27
|
height = 350,
|
|
28
|
+
bare = false,
|
|
28
29
|
className = ""
|
|
29
30
|
}) => {
|
|
30
31
|
const baseClass = "ds-chart";
|
|
31
|
-
const classes = [baseClass, className].filter(Boolean).join(" ");
|
|
32
|
+
const classes = [baseClass, bare ? `${baseClass}--bare` : "", className].filter(Boolean).join(" ");
|
|
32
33
|
const textSecondary = getCSSVar("--color-text-secondary", "#A2A2A2");
|
|
33
34
|
const gridColor = getCSSVar("--color-divider", "#232323");
|
|
34
|
-
const
|
|
35
|
+
const seriesColors = getChartSeriesColors();
|
|
35
36
|
const renderTooltip = useCallback(
|
|
36
37
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
37
38
|
(props) => /* @__PURE__ */ jsx(RadarTooltip, { ...props }),
|
|
@@ -66,13 +67,13 @@ const RadarChart = ({
|
|
|
66
67
|
}
|
|
67
68
|
),
|
|
68
69
|
/* @__PURE__ */ jsx(Tooltip, { content: renderTooltip }),
|
|
69
|
-
series.map((s) => /* @__PURE__ */ jsx(
|
|
70
|
+
series.map((s, i) => /* @__PURE__ */ jsx(
|
|
70
71
|
Radar,
|
|
71
72
|
{
|
|
72
73
|
name: s.label,
|
|
73
74
|
dataKey: s.dataKey,
|
|
74
|
-
stroke: s.color ||
|
|
75
|
-
fill: s.color ||
|
|
75
|
+
stroke: s.color || seriesColors[i % seriesColors.length],
|
|
76
|
+
fill: s.color || seriesColors[i % seriesColors.length],
|
|
76
77
|
fillOpacity: s.fillOpacity ?? 0.3
|
|
77
78
|
},
|
|
78
79
|
s.dataKey
|
|
@@ -26,6 +26,12 @@ export interface RadialChartProps {
|
|
|
26
26
|
outerRadius?: number;
|
|
27
27
|
/** Show legend */
|
|
28
28
|
showLegend?: boolean;
|
|
29
|
+
/** Headline printed in the donut hole, e.g. "46%"; pairs best with showLegend false, since the legend shifts the rings above centre */
|
|
30
|
+
centerLabel?: string;
|
|
31
|
+
/** Small caption under the centre headline */
|
|
32
|
+
centerSublabel?: string;
|
|
33
|
+
/** Strip the card chrome (border, padding, fill) when the chart sits inside another panel that supplies the surface */
|
|
34
|
+
bare?: boolean;
|
|
29
35
|
/** Additional CSS classes on the wrapper */
|
|
30
36
|
className?: string;
|
|
31
37
|
}
|
|
@@ -34,4 +40,4 @@ export interface RadialChartProps {
|
|
|
34
40
|
* Each data item renders as a concentric ring — great for
|
|
35
41
|
* progress indicators and comparative gauges.
|
|
36
42
|
*/
|
|
37
|
-
export declare const RadialChart: ({ data, maxValue, title, subtitle, summaryItems, height, innerRadius, outerRadius, showLegend, className, }: RadialChartProps) => import("react").JSX.Element;
|
|
43
|
+
export declare const RadialChart: ({ data, maxValue, title, subtitle, summaryItems, height, innerRadius, outerRadius, showLegend, centerLabel, centerSublabel, bare, className, }: RadialChartProps) => import("react").JSX.Element;
|
|
@@ -1,24 +1,10 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useCallback } from "react";
|
|
3
3
|
import { ResponsiveContainer, RadialBarChart, PolarAngleAxis, RadialBar, Tooltip, Legend } from "recharts";
|
|
4
|
+
import { getChartSeriesColors } from "./palette.js";
|
|
4
5
|
import "./Chart.css";
|
|
5
|
-
function getDefaultColors() {
|
|
6
|
-
if (typeof window === "undefined") {
|
|
7
|
-
return ["#0E6E8F", "#06D6A0", "#FFD166", "#EF476F", "#9E47EF", "#EF8247"];
|
|
8
|
-
}
|
|
9
|
-
const get = (v, fb) => getComputedStyle(document.documentElement).getPropertyValue(v).trim() || fb;
|
|
10
|
-
return [
|
|
11
|
-
get("--color-action-primary-bg", "#0E6E8F"),
|
|
12
|
-
get("--color-core-accent-mint", "#06D6A0"),
|
|
13
|
-
get("--color-core-accent-gold", "#FFD166"),
|
|
14
|
-
get("--color-core-accent-coral", "#EF476F"),
|
|
15
|
-
get("--color-core-accent-violet", "#9E47EF"),
|
|
16
|
-
get("--color-core-accent-amber", "#EF8247")
|
|
17
|
-
];
|
|
18
|
-
}
|
|
19
6
|
function getCSSVar(name, fallback) {
|
|
20
|
-
|
|
21
|
-
return getComputedStyle(document.documentElement).getPropertyValue(name).trim() || fallback;
|
|
7
|
+
return `var(${name}, ${fallback})`;
|
|
22
8
|
}
|
|
23
9
|
function RadialTooltip({ active, payload }) {
|
|
24
10
|
if (!active || !payload?.length) return null;
|
|
@@ -45,11 +31,14 @@ const RadialChart = ({
|
|
|
45
31
|
innerRadius = 40,
|
|
46
32
|
outerRadius = 140,
|
|
47
33
|
showLegend = true,
|
|
34
|
+
centerLabel,
|
|
35
|
+
centerSublabel,
|
|
36
|
+
bare = false,
|
|
48
37
|
className = ""
|
|
49
38
|
}) => {
|
|
50
39
|
const baseClass = "ds-chart";
|
|
51
|
-
const classes = [baseClass, className].filter(Boolean).join(" ");
|
|
52
|
-
const defaultColors =
|
|
40
|
+
const classes = [baseClass, bare ? `${baseClass}--bare` : "", className].filter(Boolean).join(" ");
|
|
41
|
+
const defaultColors = getChartSeriesColors();
|
|
53
42
|
const textSecondary = getCSSVar("--color-text-secondary", "#A2A2A2");
|
|
54
43
|
const bgColor = getCSSVar("--color-bg-container-primary", "#0E0E0E");
|
|
55
44
|
const chartData = data.map((item, i) => ({
|
|
@@ -72,46 +61,52 @@ const RadialChart = ({
|
|
|
72
61
|
/* @__PURE__ */ jsx("span", { className: `${baseClass}__summary-value`, children: typeof item.value === "number" ? item.value.toLocaleString() : item.value })
|
|
73
62
|
] }, i)) })
|
|
74
63
|
] }),
|
|
75
|
-
/* @__PURE__ */
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
64
|
+
/* @__PURE__ */ jsxs("div", { className: `${baseClass}__body`, children: [
|
|
65
|
+
/* @__PURE__ */ jsx(ResponsiveContainer, { width: "100%", height, children: /* @__PURE__ */ jsxs(
|
|
66
|
+
RadialBarChart,
|
|
67
|
+
{
|
|
68
|
+
cx: "50%",
|
|
69
|
+
cy: "50%",
|
|
70
|
+
innerRadius,
|
|
71
|
+
outerRadius,
|
|
72
|
+
data: chartData,
|
|
73
|
+
startAngle: 90,
|
|
74
|
+
endAngle: -270,
|
|
75
|
+
barSize: 16,
|
|
76
|
+
children: [
|
|
77
|
+
/* @__PURE__ */ jsx(PolarAngleAxis, { type: "number", domain: [0, maxValue], tick: false }),
|
|
78
|
+
/* @__PURE__ */ jsx(
|
|
79
|
+
RadialBar,
|
|
80
|
+
{
|
|
81
|
+
background: { fill: bgColor },
|
|
82
|
+
dataKey: "value",
|
|
83
|
+
cornerRadius: 8
|
|
84
|
+
}
|
|
85
|
+
),
|
|
86
|
+
/* @__PURE__ */ jsx(Tooltip, { content: renderTooltip }),
|
|
87
|
+
showLegend && /* @__PURE__ */ jsx(
|
|
88
|
+
Legend,
|
|
89
|
+
{
|
|
90
|
+
verticalAlign: "bottom",
|
|
91
|
+
iconType: "circle",
|
|
92
|
+
iconSize: 8,
|
|
93
|
+
...{ payload: chartData.map((d) => ({
|
|
94
|
+
value: d.name,
|
|
95
|
+
type: "circle",
|
|
96
|
+
color: d.fill
|
|
97
|
+
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
98
|
+
})) },
|
|
99
|
+
formatter: (value) => /* @__PURE__ */ jsx("span", { style: { color: textSecondary, fontSize: 12 }, children: value })
|
|
100
|
+
}
|
|
101
|
+
)
|
|
102
|
+
]
|
|
103
|
+
}
|
|
104
|
+
) }),
|
|
105
|
+
centerLabel && /* @__PURE__ */ jsxs("div", { className: `${baseClass}__radial-center`, children: [
|
|
106
|
+
/* @__PURE__ */ jsx("span", { className: `${baseClass}__radial-center-value`, children: centerLabel }),
|
|
107
|
+
centerSublabel && /* @__PURE__ */ jsx("span", { className: `${baseClass}__radial-center-sub`, children: centerSublabel })
|
|
108
|
+
] })
|
|
109
|
+
] })
|
|
115
110
|
] });
|
|
116
111
|
};
|
|
117
112
|
export {
|
|
@@ -26,6 +26,8 @@ export interface ScatterChartProps {
|
|
|
26
26
|
summaryItems?: ChartSummaryItem[];
|
|
27
27
|
/** Chart area height in pixels */
|
|
28
28
|
height?: number;
|
|
29
|
+
/** Strip the card chrome (border, padding, fill) when the chart sits inside another panel that supplies the surface */
|
|
30
|
+
bare?: boolean;
|
|
29
31
|
/** Additional CSS classes on the wrapper */
|
|
30
32
|
className?: string;
|
|
31
33
|
}
|
|
@@ -33,4 +35,4 @@ export interface ScatterChartProps {
|
|
|
33
35
|
* Scatter chart built on Recharts with design-system tokens.
|
|
34
36
|
* Plots one or more datasets as point clouds on an X/Y grid.
|
|
35
37
|
*/
|
|
36
|
-
export declare const ScatterChart: ({ datasets, xKey, yKey, xLabel, yLabel, title, subtitle, summaryItems, height, className, }: ScatterChartProps) => import("react").JSX.Element;
|
|
38
|
+
export declare const ScatterChart: ({ datasets, xKey, yKey, xLabel, yLabel, title, subtitle, summaryItems, height, bare, className, }: ScatterChartProps) => import("react").JSX.Element;
|
|
@@ -1,22 +1,10 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useCallback } from "react";
|
|
3
3
|
import { ResponsiveContainer, ScatterChart as ScatterChart$1, CartesianGrid, XAxis, YAxis, ZAxis, Tooltip, Scatter, Legend } from "recharts";
|
|
4
|
+
import { getChartSeriesColors } from "./palette.js";
|
|
4
5
|
import "./Chart.css";
|
|
5
|
-
const PALETTE = [
|
|
6
|
-
"#118AB2",
|
|
7
|
-
// teal-07
|
|
8
|
-
"#06D6A0",
|
|
9
|
-
// green-07
|
|
10
|
-
"#EF476F",
|
|
11
|
-
// red-07
|
|
12
|
-
"#FFD166",
|
|
13
|
-
// yellow-07
|
|
14
|
-
"#9E47EF"
|
|
15
|
-
// purple-07
|
|
16
|
-
];
|
|
17
6
|
function getCSSVar(name, fallback) {
|
|
18
|
-
|
|
19
|
-
return getComputedStyle(document.documentElement).getPropertyValue(name).trim() || fallback;
|
|
7
|
+
return `var(${name}, ${fallback})`;
|
|
20
8
|
}
|
|
21
9
|
function ScatterTooltip({ active, payload, xLabel, yLabel }) {
|
|
22
10
|
if (!active || !payload?.length) return null;
|
|
@@ -43,10 +31,12 @@ const ScatterChart = ({
|
|
|
43
31
|
subtitle,
|
|
44
32
|
summaryItems,
|
|
45
33
|
height = 350,
|
|
34
|
+
bare = false,
|
|
46
35
|
className = ""
|
|
47
36
|
}) => {
|
|
48
37
|
const baseClass = "ds-chart";
|
|
49
|
-
const classes = [baseClass, className].filter(Boolean).join(" ");
|
|
38
|
+
const classes = [baseClass, bare ? `${baseClass}--bare` : "", className].filter(Boolean).join(" ");
|
|
39
|
+
const seriesColors = getChartSeriesColors();
|
|
50
40
|
const textSecondary = getCSSVar("--color-text-secondary", "#A2A2A2");
|
|
51
41
|
const gridColor = getCSSVar("--color-divider", "#232323");
|
|
52
42
|
const renderTooltip = useCallback(
|
|
@@ -96,7 +86,7 @@ const ScatterChart = ({
|
|
|
96
86
|
{
|
|
97
87
|
name: ds.name,
|
|
98
88
|
data: ds.data,
|
|
99
|
-
fill: ds.color ||
|
|
89
|
+
fill: ds.color || seriesColors[i % seriesColors.length]
|
|
100
90
|
},
|
|
101
91
|
ds.name
|
|
102
92
|
)),
|
|
@@ -24,6 +24,8 @@ export interface StackedBarChartProps {
|
|
|
24
24
|
height?: number;
|
|
25
25
|
/** Y-axis tick formatter */
|
|
26
26
|
yAxisFormatter?: (value: number) => string;
|
|
27
|
+
/** Strip the card chrome (border, padding, fill) when the chart sits inside another panel that supplies the surface */
|
|
28
|
+
bare?: boolean;
|
|
27
29
|
/** Additional CSS classes on the wrapper */
|
|
28
30
|
className?: string;
|
|
29
31
|
}
|
|
@@ -31,4 +33,4 @@ export interface StackedBarChartProps {
|
|
|
31
33
|
* Stacked bar chart built on Recharts with design-system tokens.
|
|
32
34
|
* Supports multiple series stacked on top of each other.
|
|
33
35
|
*/
|
|
34
|
-
export declare const StackedBarChart: ({ data, xKey, series, title, subtitle, summaryItems, height, yAxisFormatter, className, }: StackedBarChartProps) => import("react").JSX.Element;
|
|
36
|
+
export declare const StackedBarChart: ({ data, xKey, series, title, subtitle, summaryItems, height, yAxisFormatter, bare, className, }: StackedBarChartProps) => import("react").JSX.Element;
|
|
@@ -1,24 +1,10 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useCallback } from "react";
|
|
3
3
|
import { ResponsiveContainer, BarChart, CartesianGrid, XAxis, YAxis, Tooltip, Bar } from "recharts";
|
|
4
|
+
import { getChartSeriesColors } from "./palette.js";
|
|
4
5
|
import "./Chart.css";
|
|
5
6
|
function getCSSVar(name, fallback) {
|
|
6
|
-
|
|
7
|
-
return getComputedStyle(document.documentElement).getPropertyValue(name).trim() || fallback;
|
|
8
|
-
}
|
|
9
|
-
function getDefaultColors() {
|
|
10
|
-
if (typeof window === "undefined") {
|
|
11
|
-
return ["#0E6E8F", "#06D6A0", "#FFD166", "#EF476F", "#9E47EF", "#EF8247"];
|
|
12
|
-
}
|
|
13
|
-
const get = (v, fb) => getComputedStyle(document.documentElement).getPropertyValue(v).trim() || fb;
|
|
14
|
-
return [
|
|
15
|
-
get("--color-action-primary-bg", "#0E6E8F"),
|
|
16
|
-
get("--color-core-accent-mint", "#06D6A0"),
|
|
17
|
-
get("--color-core-accent-gold", "#FFD166"),
|
|
18
|
-
get("--color-core-accent-coral", "#EF476F"),
|
|
19
|
-
get("--color-core-accent-violet", "#9E47EF"),
|
|
20
|
-
get("--color-core-accent-amber", "#EF8247")
|
|
21
|
-
];
|
|
7
|
+
return `var(${name}, ${fallback})`;
|
|
22
8
|
}
|
|
23
9
|
function StackedTooltip({ active, payload, label }) {
|
|
24
10
|
if (!active || !payload?.length) return null;
|
|
@@ -40,14 +26,15 @@ const StackedBarChart = ({
|
|
|
40
26
|
summaryItems,
|
|
41
27
|
height = 350,
|
|
42
28
|
yAxisFormatter,
|
|
29
|
+
bare = false,
|
|
43
30
|
className = ""
|
|
44
31
|
}) => {
|
|
45
32
|
const baseClass = "ds-chart";
|
|
46
|
-
const classes = [baseClass, className].filter(Boolean).join(" ");
|
|
33
|
+
const classes = [baseClass, bare ? `${baseClass}--bare` : "", className].filter(Boolean).join(" ");
|
|
47
34
|
const textSecondary = getCSSVar("--color-text-secondary", "#A2A2A2");
|
|
48
35
|
const gridColor = getCSSVar("--color-divider", "#232323");
|
|
49
36
|
const cursorColor = getCSSVar("--color-bg-container-secondary", "#303030");
|
|
50
|
-
const defaultColors =
|
|
37
|
+
const defaultColors = getChartSeriesColors();
|
|
51
38
|
const renderTooltip = useCallback(
|
|
52
39
|
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
|
|
53
40
|
(props) => /* @__PURE__ */ jsx(StackedTooltip, { ...props }),
|