@robr0/design-system 0.1.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.
Files changed (223) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +127 -0
  3. package/charts.d.ts +14 -0
  4. package/charts.js +20 -0
  5. package/components/Accordion/Accordion.css +119 -0
  6. package/components/Accordion/Accordion.d.ts +24 -0
  7. package/components/Accordion/Accordion.js +76 -0
  8. package/components/Alert/Alert.css +252 -0
  9. package/components/Alert/Alert.d.ts +24 -0
  10. package/components/Alert/Alert.js +53 -0
  11. package/components/AlertDialog/AlertDialog.css +131 -0
  12. package/components/AlertDialog/AlertDialog.d.ts +29 -0
  13. package/components/AlertDialog/AlertDialog.js +143 -0
  14. package/components/AppLayout/AppLayout.css +52 -0
  15. package/components/AppLayout/AppLayout.d.ts +27 -0
  16. package/components/AppLayout/AppLayout.js +45 -0
  17. package/components/AppSidebar/AppSidebar.css +434 -0
  18. package/components/AppSidebar/AppSidebar.d.ts +67 -0
  19. package/components/AppSidebar/AppSidebar.js +272 -0
  20. package/components/Avatar/Avatar.css +133 -0
  21. package/components/Avatar/Avatar.d.ts +20 -0
  22. package/components/Avatar/Avatar.js +56 -0
  23. package/components/Avatar/demoAvatars.d.ts +14 -0
  24. package/components/Avatar/demoAvatars.js +16 -0
  25. package/components/Badge/Badge.css +68 -0
  26. package/components/Badge/Badge.d.ts +13 -0
  27. package/components/Badge/Badge.js +15 -0
  28. package/components/Breadcrumb/Breadcrumb.css +92 -0
  29. package/components/Breadcrumb/Breadcrumb.d.ts +19 -0
  30. package/components/Breadcrumb/Breadcrumb.js +39 -0
  31. package/components/Button/Button.css +381 -0
  32. package/components/Button/Button.d.ts +39 -0
  33. package/components/Button/Button.js +71 -0
  34. package/components/ButtonGroup/ButtonGroup.css +39 -0
  35. package/components/ButtonGroup/ButtonGroup.d.ts +13 -0
  36. package/components/ButtonGroup/ButtonGroup.js +37 -0
  37. package/components/Card/Card.css +169 -0
  38. package/components/Card/Card.d.ts +30 -0
  39. package/components/Card/Card.js +90 -0
  40. package/components/Carousel/Carousel.css +112 -0
  41. package/components/Carousel/Carousel.d.ts +25 -0
  42. package/components/Carousel/Carousel.js +126 -0
  43. package/components/Chart/AreaChart.d.ts +36 -0
  44. package/components/Chart/AreaChart.js +99 -0
  45. package/components/Chart/BarChart.d.ts +34 -0
  46. package/components/Chart/BarChart.js +107 -0
  47. package/components/Chart/Chart.css +176 -0
  48. package/components/Chart/LineChart.d.ts +34 -0
  49. package/components/Chart/LineChart.js +90 -0
  50. package/components/Chart/PieChart.d.ts +34 -0
  51. package/components/Chart/PieChart.js +106 -0
  52. package/components/Chart/RadarChart.d.ts +34 -0
  53. package/components/Chart/RadarChart.js +91 -0
  54. package/components/Chart/RadialChart.d.ts +37 -0
  55. package/components/Chart/RadialChart.js +119 -0
  56. package/components/Chart/ScatterChart.d.ts +36 -0
  57. package/components/Chart/ScatterChart.js +109 -0
  58. package/components/Chart/StackedBarChart.d.ts +34 -0
  59. package/components/Chart/StackedBarChart.js +111 -0
  60. package/components/Chart/Treemap.d.ts +33 -0
  61. package/components/Chart/Treemap.js +109 -0
  62. package/components/Checkbox/Checkbox.css +164 -0
  63. package/components/Checkbox/Checkbox.d.ts +45 -0
  64. package/components/Checkbox/Checkbox.js +125 -0
  65. package/components/Chip/Chip.css +195 -0
  66. package/components/Chip/Chip.d.ts +27 -0
  67. package/components/Chip/Chip.js +80 -0
  68. package/components/CircularButton/CircularButton.css +206 -0
  69. package/components/CircularButton/CircularButton.d.ts +30 -0
  70. package/components/CircularButton/CircularButton.js +54 -0
  71. package/components/CodeBlock/CodeBlock.css +180 -0
  72. package/components/CodeBlock/CodeBlock.d.ts +23 -0
  73. package/components/CodeBlock/CodeBlock.js +85 -0
  74. package/components/ColourSwatch/ColourSwatch.css +88 -0
  75. package/components/ColourSwatch/ColourSwatch.d.ts +34 -0
  76. package/components/ColourSwatch/ColourSwatch.js +42 -0
  77. package/components/Combobox/Combobox.css +411 -0
  78. package/components/Combobox/Combobox.d.ts +73 -0
  79. package/components/Combobox/Combobox.js +312 -0
  80. package/components/CommandPalette/CommandPalette.css +310 -0
  81. package/components/CommandPalette/CommandPalette.d.ts +60 -0
  82. package/components/CommandPalette/CommandPalette.js +263 -0
  83. package/components/ContactCard/ContactCard.css +123 -0
  84. package/components/ContactCard/ContactCard.d.ts +23 -0
  85. package/components/ContactCard/ContactCard.js +78 -0
  86. package/components/ContributionGraph/ContributionGraph.css +142 -0
  87. package/components/ContributionGraph/ContributionGraph.d.ts +26 -0
  88. package/components/ContributionGraph/ContributionGraph.js +125 -0
  89. package/components/DateInput/DateInput.css +163 -0
  90. package/components/DateInput/DateInput.d.ts +43 -0
  91. package/components/DateInput/DateInput.js +69 -0
  92. package/components/DatePicker/DatePicker.css +198 -0
  93. package/components/DatePicker/DatePicker.d.ts +22 -0
  94. package/components/DatePicker/DatePicker.js +170 -0
  95. package/components/Dialog/Dialog.css +176 -0
  96. package/components/Dialog/Dialog.d.ts +28 -0
  97. package/components/Dialog/Dialog.js +132 -0
  98. package/components/Divider/Divider.css +100 -0
  99. package/components/Divider/Divider.d.ts +18 -0
  100. package/components/Divider/Divider.js +31 -0
  101. package/components/Drawer/Drawer.css +262 -0
  102. package/components/Drawer/Drawer.d.ts +30 -0
  103. package/components/Drawer/Drawer.js +134 -0
  104. package/components/Dropdown/Dropdown.css +300 -0
  105. package/components/Dropdown/Dropdown.d.ts +48 -0
  106. package/components/Dropdown/Dropdown.js +196 -0
  107. package/components/DropdownMenu/DropdownMenu.css +303 -0
  108. package/components/DropdownMenu/DropdownMenu.d.ts +42 -0
  109. package/components/DropdownMenu/DropdownMenu.js +322 -0
  110. package/components/EmptyState/EmptyState.css +115 -0
  111. package/components/EmptyState/EmptyState.d.ts +27 -0
  112. package/components/EmptyState/EmptyState.js +32 -0
  113. package/components/EntityCard/EntityCard.css +69 -0
  114. package/components/EntityCard/EntityCard.d.ts +18 -0
  115. package/components/EntityCard/EntityCard.js +26 -0
  116. package/components/Figure/Figure.css +61 -0
  117. package/components/Figure/Figure.d.ts +17 -0
  118. package/components/Figure/Figure.js +35 -0
  119. package/components/FileInput/FileInput.css +308 -0
  120. package/components/FileInput/FileInput.d.ts +54 -0
  121. package/components/FileInput/FileInput.js +177 -0
  122. package/components/Input/Input.css +193 -0
  123. package/components/Input/Input.d.ts +40 -0
  124. package/components/Input/Input.js +71 -0
  125. package/components/Instructions/Instructions.css +216 -0
  126. package/components/Instructions/Instructions.d.ts +28 -0
  127. package/components/Instructions/Instructions.js +32 -0
  128. package/components/LinkList/LinkList.css +71 -0
  129. package/components/LinkList/LinkList.d.ts +20 -0
  130. package/components/LinkList/LinkList.js +41 -0
  131. package/components/MotionSwatch/MotionSwatch.css +176 -0
  132. package/components/MotionSwatch/MotionSwatch.d.ts +25 -0
  133. package/components/MotionSwatch/MotionSwatch.js +74 -0
  134. package/components/Nav/Nav.css +51 -0
  135. package/components/Nav/Nav.d.ts +19 -0
  136. package/components/Nav/Nav.js +26 -0
  137. package/components/Pagination/Pagination.css +126 -0
  138. package/components/Pagination/Pagination.d.ts +22 -0
  139. package/components/Pagination/Pagination.js +83 -0
  140. package/components/Popover/Popover.css +99 -0
  141. package/components/Popover/Popover.d.ts +28 -0
  142. package/components/Popover/Popover.js +102 -0
  143. package/components/ProgressBar/ProgressBar.css +60 -0
  144. package/components/ProgressBar/ProgressBar.d.ts +16 -0
  145. package/components/ProgressBar/ProgressBar.js +27 -0
  146. package/components/Quote/Quote.css +79 -0
  147. package/components/Quote/Quote.d.ts +18 -0
  148. package/components/Quote/Quote.js +26 -0
  149. package/components/RadioButton/RadioButton.css +132 -0
  150. package/components/RadioButton/RadioButton.d.ts +43 -0
  151. package/components/RadioButton/RadioButton.js +77 -0
  152. package/components/SectionTitle/SectionTitle.css +37 -0
  153. package/components/SectionTitle/SectionTitle.d.ts +10 -0
  154. package/components/SectionTitle/SectionTitle.js +17 -0
  155. package/components/SegmentedControl/SegmentedControl.css +129 -0
  156. package/components/SegmentedControl/SegmentedControl.d.ts +33 -0
  157. package/components/SegmentedControl/SegmentedControl.js +91 -0
  158. package/components/SelectionCard/SelectionCard.css +251 -0
  159. package/components/SelectionCard/SelectionCard.d.ts +26 -0
  160. package/components/SelectionCard/SelectionCard.js +85 -0
  161. package/components/Skeleton/Skeleton.css +79 -0
  162. package/components/Skeleton/Skeleton.d.ts +16 -0
  163. package/components/Skeleton/Skeleton.js +30 -0
  164. package/components/Slider/Slider.css +86 -0
  165. package/components/Slider/Slider.d.ts +25 -0
  166. package/components/Slider/Slider.js +46 -0
  167. package/components/SpacingSwatch/SpacingSwatch.css +108 -0
  168. package/components/SpacingSwatch/SpacingSwatch.d.ts +20 -0
  169. package/components/SpacingSwatch/SpacingSwatch.js +50 -0
  170. package/components/Spinner/Spinner.css +73 -0
  171. package/components/Spinner/Spinner.d.ts +14 -0
  172. package/components/Spinner/Spinner.js +42 -0
  173. package/components/Stat/Stat.css +78 -0
  174. package/components/Stat/Stat.d.ts +19 -0
  175. package/components/Stat/Stat.js +30 -0
  176. package/components/Table/Table.css +186 -0
  177. package/components/Table/Table.d.ts +45 -0
  178. package/components/Table/Table.js +65 -0
  179. package/components/Tabs/Tabs.css +140 -0
  180. package/components/Tabs/Tabs.d.ts +28 -0
  181. package/components/Tabs/Tabs.js +77 -0
  182. package/components/Textarea/Textarea.css +152 -0
  183. package/components/Textarea/Textarea.d.ts +40 -0
  184. package/components/Textarea/Textarea.js +74 -0
  185. package/components/Timeline/Timeline.css +339 -0
  186. package/components/Timeline/Timeline.d.ts +63 -0
  187. package/components/Timeline/Timeline.js +69 -0
  188. package/components/Toast/Toast.css +342 -0
  189. package/components/Toast/Toast.d.ts +63 -0
  190. package/components/Toast/Toast.js +213 -0
  191. package/components/ToggleGroup/ToggleGroup.css +84 -0
  192. package/components/ToggleGroup/ToggleGroup.d.ts +30 -0
  193. package/components/ToggleGroup/ToggleGroup.js +53 -0
  194. package/components/ToggleSwitch/ToggleSwitch.css +139 -0
  195. package/components/ToggleSwitch/ToggleSwitch.d.ts +23 -0
  196. package/components/ToggleSwitch/ToggleSwitch.js +50 -0
  197. package/components/Tooltip/Tooltip.css +122 -0
  198. package/components/Tooltip/Tooltip.d.ts +21 -0
  199. package/components/Tooltip/Tooltip.js +63 -0
  200. package/components/TypographySwatch/TypographySwatch.css +81 -0
  201. package/components/TypographySwatch/TypographySwatch.d.ts +24 -0
  202. package/components/TypographySwatch/TypographySwatch.js +40 -0
  203. package/components/registry.d.ts +20 -0
  204. package/components/registry.js +7 -0
  205. package/components/registry.json +67 -0
  206. package/components/registry.json.d.ts +70 -0
  207. package/components/registry.json.js +8 -0
  208. package/fonts/MaterialSymbolsRounded-VariableFont_FILL,GRAD,opsz,wght.woff2 +0 -0
  209. package/fonts/material-symbols.css +94 -0
  210. package/index.d.ts +62 -0
  211. package/index.js +123 -0
  212. package/package.json +63 -0
  213. package/tokens/registry.d.ts +22 -0
  214. package/tokens/registry.js +14 -0
  215. package/tokens/registry.json +203 -0
  216. package/tokens/registry.json.d.ts +206 -0
  217. package/tokens/registry.json.js +8 -0
  218. package/tokens/tokens-dark.css +119 -0
  219. package/tokens/tokens-light.css +159 -0
  220. package/tokens/tokens-motion.css +68 -0
  221. package/tokens/tokens-primitives.css +176 -0
  222. package/tokens/tokens-typography.css +116 -0
  223. package/tokens/tokens.css +11 -0
@@ -0,0 +1,99 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { useCallback } from "react";
3
+ import { ResponsiveContainer, AreaChart as AreaChart$1, CartesianGrid, XAxis, YAxis, Tooltip, Area, Legend } from "recharts";
4
+ import "./Chart.css";
5
+ function getCSSVar(name, fallback) {
6
+ if (typeof window === "undefined") return fallback;
7
+ return getComputedStyle(document.documentElement).getPropertyValue(name).trim() || fallback;
8
+ }
9
+ function AreaTooltip({ 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("span", { className: "ds-chart__tooltip-dot", style: { backgroundColor: entry.color } }),
15
+ /* @__PURE__ */ jsx("span", { className: "ds-chart__tooltip-name", children: entry.name }),
16
+ /* @__PURE__ */ jsx("span", { className: "ds-chart__tooltip-value", children: entry.value?.toLocaleString() })
17
+ ] }, i))
18
+ ] });
19
+ }
20
+ const AreaChart = ({
21
+ data,
22
+ xKey = "label",
23
+ series,
24
+ stacked = false,
25
+ title,
26
+ subtitle,
27
+ summaryItems,
28
+ height = 350,
29
+ className = ""
30
+ }) => {
31
+ const baseClass = "ds-chart";
32
+ const classes = [baseClass, className].filter(Boolean).join(" ");
33
+ const textSecondary = getCSSVar("--color-text-secondary", "#A2A2A2");
34
+ const gridColor = getCSSVar("--color-divider", "#232323");
35
+ const defaultColor = getCSSVar("--color-action-primary-bg", "#118AB2");
36
+ const renderTooltip = useCallback(
37
+ /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
38
+ (props) => /* @__PURE__ */ jsx(AreaTooltip, { ...props }),
39
+ []
40
+ );
41
+ return /* @__PURE__ */ jsxs("div", { className: classes, children: [
42
+ (title || subtitle || summaryItems) && /* @__PURE__ */ jsxs("div", { className: `${baseClass}__header`, children: [
43
+ /* @__PURE__ */ jsxs("div", { className: `${baseClass}__header-text`, children: [
44
+ title && /* @__PURE__ */ jsx("h3", { className: `${baseClass}__title`, children: title }),
45
+ subtitle && /* @__PURE__ */ jsx("p", { className: `${baseClass}__subtitle`, children: subtitle })
46
+ ] }),
47
+ summaryItems && summaryItems.length > 0 && /* @__PURE__ */ jsx("div", { className: `${baseClass}__summary`, children: summaryItems.map((item, i) => /* @__PURE__ */ jsxs("div", { className: `${baseClass}__summary-item`, children: [
48
+ /* @__PURE__ */ jsx("span", { className: `${baseClass}__summary-label`, children: item.label }),
49
+ /* @__PURE__ */ jsx("span", { className: `${baseClass}__summary-value`, children: typeof item.value === "number" ? item.value.toLocaleString() : item.value })
50
+ ] }, i)) })
51
+ ] }),
52
+ /* @__PURE__ */ jsx("div", { className: `${baseClass}__body`, children: /* @__PURE__ */ jsx(ResponsiveContainer, { width: "100%", height, children: /* @__PURE__ */ jsxs(AreaChart$1, { data, margin: { top: 8, right: 4, bottom: 0, left: -12 }, children: [
53
+ /* @__PURE__ */ jsx("defs", { children: series.map((s) => {
54
+ const color = s.color || defaultColor;
55
+ return /* @__PURE__ */ jsxs("linearGradient", { id: `area-gradient-${s.dataKey}`, x1: "0", y1: "0", x2: "0", y2: "1", children: [
56
+ /* @__PURE__ */ jsx("stop", { offset: "0%", stopColor: color, stopOpacity: 0.4 }),
57
+ /* @__PURE__ */ jsx("stop", { offset: "100%", stopColor: color, stopOpacity: 0.05 })
58
+ ] }, `grad-${s.dataKey}`);
59
+ }) }),
60
+ /* @__PURE__ */ jsx(CartesianGrid, { vertical: false, stroke: gridColor }),
61
+ /* @__PURE__ */ jsx(
62
+ XAxis,
63
+ {
64
+ dataKey: xKey,
65
+ tick: { fill: textSecondary, fontSize: 12 },
66
+ tickLine: false,
67
+ axisLine: { stroke: gridColor }
68
+ }
69
+ ),
70
+ /* @__PURE__ */ jsx(
71
+ YAxis,
72
+ {
73
+ tick: { fill: textSecondary, fontSize: 12 },
74
+ tickLine: false,
75
+ axisLine: false
76
+ }
77
+ ),
78
+ /* @__PURE__ */ jsx(Tooltip, { content: renderTooltip }),
79
+ series.map((s) => /* @__PURE__ */ jsx(
80
+ Area,
81
+ {
82
+ type: "monotone",
83
+ dataKey: s.dataKey,
84
+ name: s.label,
85
+ stroke: s.color || defaultColor,
86
+ strokeWidth: 2,
87
+ fill: `url(#area-gradient-${s.dataKey})`,
88
+ fillOpacity: s.fillOpacity ?? 1,
89
+ stackId: stacked ? "stack" : void 0
90
+ },
91
+ s.dataKey
92
+ )),
93
+ series.length > 1 && /* @__PURE__ */ jsx(Legend, { wrapperStyle: { color: textSecondary, fontSize: 12 } })
94
+ ] }) }) })
95
+ ] });
96
+ };
97
+ export {
98
+ AreaChart
99
+ };
@@ -0,0 +1,34 @@
1
+ export interface ChartSummaryItem {
2
+ /** Label shown above the value */
3
+ label: string;
4
+ /** Formatted value to display */
5
+ value: string | number;
6
+ }
7
+ export interface BarChartProps {
8
+ /** Array of data objects */
9
+ data: Record<string, unknown>[];
10
+ /** Key in data for x-axis values */
11
+ xKey?: string;
12
+ /** Key in data for y-axis values */
13
+ yKey?: string;
14
+ /** Display name for the data series (shown in tooltip) */
15
+ dataLabel?: string;
16
+ /** Chart title */
17
+ title?: string;
18
+ /** Description text below the title */
19
+ subtitle?: string;
20
+ /** Summary stats displayed in the header */
21
+ summaryItems?: ChartSummaryItem[];
22
+ /** Bar fill colour — CSS value or token reference */
23
+ barColor?: string;
24
+ /** Chart area height in pixels */
25
+ height?: number;
26
+ /** Additional CSS classes on the wrapper */
27
+ className?: string;
28
+ }
29
+ /**
30
+ * Bar chart built on Recharts with design-system tokens.
31
+ * Part of the Chart component family — shares wrapper, header,
32
+ * tooltip, and summary-stat styles with future chart types.
33
+ */
34
+ export declare const BarChart: ({ data, xKey, yKey, dataLabel, title, subtitle, summaryItems, barColor, height, className, }: BarChartProps) => import("react").JSX.Element;
@@ -0,0 +1,107 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { useCallback } from "react";
3
+ import { ResponsiveContainer, BarChart as BarChart$1, CartesianGrid, XAxis, YAxis, Tooltip, Bar } from "recharts";
4
+ import "./Chart.css";
5
+ function getCSSVar(name, fallback) {
6
+ if (typeof window === "undefined") return fallback;
7
+ return getComputedStyle(document.documentElement).getPropertyValue(name).trim() || fallback;
8
+ }
9
+ function ChartTooltip({
10
+ active,
11
+ payload,
12
+ label,
13
+ barColor,
14
+ dataLabel
15
+ }) {
16
+ if (!active || !payload?.length) return null;
17
+ return /* @__PURE__ */ jsxs("div", { className: "ds-chart__tooltip", children: [
18
+ /* @__PURE__ */ jsx("div", { className: "ds-chart__tooltip-label", children: label }),
19
+ payload.map((entry, i) => /* @__PURE__ */ jsxs("div", { className: "ds-chart__tooltip-row", children: [
20
+ /* @__PURE__ */ jsx("span", { className: "ds-chart__tooltip-dot", style: { backgroundColor: barColor } }),
21
+ /* @__PURE__ */ jsx("span", { className: "ds-chart__tooltip-name", children: dataLabel }),
22
+ /* @__PURE__ */ jsx("span", { className: "ds-chart__tooltip-value", children: entry.value?.toLocaleString() })
23
+ ] }, i))
24
+ ] });
25
+ }
26
+ const BarChart = ({
27
+ data,
28
+ xKey = "label",
29
+ yKey = "value",
30
+ dataLabel = "Value",
31
+ title,
32
+ subtitle,
33
+ summaryItems,
34
+ barColor,
35
+ height = 350,
36
+ className = ""
37
+ }) => {
38
+ const baseClass = "ds-chart";
39
+ const classes = [baseClass, className].filter(Boolean).join(" ");
40
+ const resolvedBarColor = barColor || getCSSVar("--color-action-primary-bg", "#118AB2");
41
+ const textSecondary = getCSSVar("--color-text-secondary", "#A2A2A2");
42
+ const gridColor = getCSSVar("--color-divider", "#232323");
43
+ const cursorColor = getCSSVar("--color-bg-container-secondary", "#303030");
44
+ const renderTooltip = useCallback(
45
+ /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
46
+ (props) => /* @__PURE__ */ jsx(ChartTooltip, { ...props, barColor: resolvedBarColor, dataLabel }),
47
+ [resolvedBarColor, dataLabel]
48
+ );
49
+ return /* @__PURE__ */ jsxs("div", { className: classes, children: [
50
+ (title || subtitle || summaryItems) && /* @__PURE__ */ jsxs("div", { className: `${baseClass}__header`, children: [
51
+ /* @__PURE__ */ jsxs("div", { className: `${baseClass}__header-text`, children: [
52
+ title && /* @__PURE__ */ jsx("h3", { className: `${baseClass}__title`, children: title }),
53
+ subtitle && /* @__PURE__ */ jsx("p", { className: `${baseClass}__subtitle`, children: subtitle })
54
+ ] }),
55
+ summaryItems && summaryItems.length > 0 && /* @__PURE__ */ jsx("div", { className: `${baseClass}__summary`, children: summaryItems.map((item, i) => /* @__PURE__ */ jsxs("div", { className: `${baseClass}__summary-item`, children: [
56
+ /* @__PURE__ */ jsx("span", { className: `${baseClass}__summary-label`, children: item.label }),
57
+ /* @__PURE__ */ jsx("span", { className: `${baseClass}__summary-value`, children: typeof item.value === "number" ? item.value.toLocaleString() : item.value })
58
+ ] }, i)) })
59
+ ] }),
60
+ /* @__PURE__ */ jsx("div", { className: `${baseClass}__body`, children: /* @__PURE__ */ jsx(ResponsiveContainer, { width: "100%", height, children: /* @__PURE__ */ jsxs(BarChart$1, { data, margin: { top: 8, right: 4, bottom: 0, left: -12 }, children: [
61
+ /* @__PURE__ */ jsx(
62
+ CartesianGrid,
63
+ {
64
+ vertical: false,
65
+ stroke: gridColor,
66
+ strokeDasharray: ""
67
+ }
68
+ ),
69
+ /* @__PURE__ */ jsx(
70
+ XAxis,
71
+ {
72
+ dataKey: xKey,
73
+ tick: { fill: textSecondary, fontSize: 12 },
74
+ tickLine: false,
75
+ axisLine: { stroke: gridColor }
76
+ }
77
+ ),
78
+ /* @__PURE__ */ jsx(
79
+ YAxis,
80
+ {
81
+ tick: { fill: textSecondary, fontSize: 12 },
82
+ tickLine: false,
83
+ axisLine: false
84
+ }
85
+ ),
86
+ /* @__PURE__ */ jsx(
87
+ Tooltip,
88
+ {
89
+ content: renderTooltip,
90
+ cursor: { fill: cursorColor, opacity: 0.4 }
91
+ }
92
+ ),
93
+ /* @__PURE__ */ jsx(
94
+ Bar,
95
+ {
96
+ dataKey: yKey,
97
+ fill: resolvedBarColor,
98
+ radius: [3, 3, 0, 0],
99
+ maxBarSize: 32
100
+ }
101
+ )
102
+ ] }) }) })
103
+ ] });
104
+ };
105
+ export {
106
+ BarChart
107
+ };
@@ -0,0 +1,176 @@
1
+ /* ============================================
2
+ CHART COMPONENT — shared styles
3
+ Wrapper, header, tooltip, and summary stats
4
+ used across all chart types (bar, line, pie…).
5
+ ============================================ */
6
+
7
+ /* ============================================
8
+ WRAPPER
9
+ ============================================ */
10
+
11
+ .ds-chart {
12
+ display: flex;
13
+ flex-direction: column;
14
+ gap: var(--gap-lg); /* 20px */
15
+ width: 100%;
16
+ padding: var(--padding-lg); /* 24px */
17
+ border: var(--border-xs) solid var(--color-bg-container-border);
18
+ border-radius: var(--radius-lg); /* 16px */
19
+ background-color: var(--color-bg-container-primary);
20
+ }
21
+
22
+ /* ============================================
23
+ HEADER — title / subtitle + summary stats
24
+ ============================================ */
25
+
26
+ .ds-chart__header {
27
+ display: flex;
28
+ align-items: flex-start;
29
+ justify-content: space-between;
30
+ gap: var(--gap-lg);
31
+ }
32
+
33
+ .ds-chart__header-text {
34
+ display: flex;
35
+ flex-direction: column;
36
+ gap: var(--gap-xxs); /* 4px */
37
+ }
38
+
39
+ .ds-chart__title {
40
+ font-family: var(--font-heading-3-family);
41
+ font-size: var(--font-heading-3-size);
42
+ font-weight: var(--font-heading-3-weight);
43
+ line-height: var(--font-heading-3-line-height);
44
+ letter-spacing: var(--font-heading-3-letter-spacing);
45
+ color: var(--color-text-primary);
46
+ }
47
+
48
+ .ds-chart__subtitle {
49
+ font-family: var(--font-paragraph-sm-family);
50
+ font-size: var(--font-paragraph-sm-size);
51
+ font-weight: var(--font-paragraph-sm-weight);
52
+ line-height: var(--font-paragraph-sm-line-height);
53
+ letter-spacing: var(--font-paragraph-sm-letter-spacing);
54
+ color: var(--color-text-secondary);
55
+ }
56
+
57
+ /* ============================================
58
+ SUMMARY STATS — top-right key values
59
+ ============================================ */
60
+
61
+ .ds-chart__summary {
62
+ display: flex;
63
+ gap: var(--gap-lg);
64
+ flex-shrink: 0;
65
+ }
66
+
67
+ .ds-chart__summary-item {
68
+ display: flex;
69
+ flex-direction: column;
70
+ align-items: flex-end;
71
+ gap: var(--gap-xxs);
72
+ padding: var(--padding-xs) var(--padding-md);
73
+ border-left: var(--border-xs) solid var(--color-bg-container-border);
74
+ }
75
+
76
+ .ds-chart__summary-label {
77
+ font-family: var(--font-paragraph-sm-family);
78
+ font-size: var(--font-paragraph-sm-size);
79
+ font-weight: var(--font-paragraph-sm-weight);
80
+ line-height: var(--font-paragraph-sm-line-height);
81
+ color: var(--color-text-secondary);
82
+ }
83
+
84
+ .ds-chart__summary-value {
85
+ font-family: var(--font-heading-1-family);
86
+ font-size: var(--font-heading-1-size);
87
+ font-weight: var(--font-heading-1-weight);
88
+ line-height: var(--font-heading-1-line-height);
89
+ letter-spacing: var(--font-heading-1-letter-spacing);
90
+ color: var(--color-text-primary);
91
+ }
92
+
93
+ /* ============================================
94
+ BODY — the chart area
95
+ ============================================ */
96
+
97
+ .ds-chart__body {
98
+ width: 100%;
99
+ }
100
+
101
+ /* ============================================
102
+ CUSTOM TOOLTIP
103
+ ============================================ */
104
+
105
+ .ds-chart__tooltip {
106
+ padding: var(--padding-sm) var(--padding-md);
107
+ background-color: var(--color-bg-container-primary);
108
+ border: var(--border-xs) solid var(--color-bg-container-border);
109
+ border-radius: var(--radius-sm); /* 8px */
110
+ box-shadow: var(--shadow-floating);
111
+ }
112
+
113
+ .ds-chart__tooltip-label {
114
+ font-family: var(--font-paragraph-sm-em-family);
115
+ font-size: var(--font-paragraph-sm-em-size);
116
+ font-weight: var(--font-paragraph-sm-em-weight);
117
+ line-height: var(--font-paragraph-sm-em-line-height);
118
+ color: var(--color-text-primary);
119
+ margin-bottom: var(--gap-xxs);
120
+ }
121
+
122
+ .ds-chart__tooltip-row {
123
+ display: flex;
124
+ align-items: center;
125
+ gap: var(--gap-sm);
126
+ }
127
+
128
+ .ds-chart__tooltip-dot {
129
+ width: 8px;
130
+ height: 8px;
131
+ border-radius: var(--radius-full);
132
+ flex-shrink: 0;
133
+ }
134
+
135
+ .ds-chart__tooltip-name {
136
+ font-family: var(--font-paragraph-sm-family);
137
+ font-size: var(--font-paragraph-sm-size);
138
+ font-weight: var(--font-paragraph-sm-weight);
139
+ line-height: var(--font-paragraph-sm-line-height);
140
+ color: var(--color-text-secondary);
141
+ }
142
+
143
+ .ds-chart__tooltip-value {
144
+ font-family: var(--font-paragraph-sm-em-family);
145
+ font-size: var(--font-paragraph-sm-em-size);
146
+ font-weight: var(--font-paragraph-sm-em-weight);
147
+ line-height: var(--font-paragraph-sm-em-line-height);
148
+ color: var(--color-text-primary);
149
+ margin-left: auto;
150
+ }
151
+
152
+ /* ============================================
153
+ RESPONSIVE — stack header on small screens
154
+ ============================================ */
155
+
156
+ @media (max-width: 599px) {
157
+ .ds-chart {
158
+ padding: var(--padding-md);
159
+ }
160
+
161
+ .ds-chart__header {
162
+ flex-direction: column;
163
+ }
164
+
165
+ .ds-chart__summary {
166
+ width: 100%;
167
+ }
168
+
169
+ .ds-chart__summary-item {
170
+ align-items: flex-start;
171
+ flex: 1;
172
+ border-left: none;
173
+ border-top: var(--border-xs) solid var(--color-bg-container-border);
174
+ padding: var(--padding-xs) 0;
175
+ }
176
+ }
@@ -0,0 +1,34 @@
1
+ import { ChartSummaryItem } from './BarChart';
2
+ export interface LineSeriesConfig {
3
+ /** Key in data for this series */
4
+ dataKey: string;
5
+ /** Display name (shown in tooltip) */
6
+ label: string;
7
+ /** Line colour — CSS value */
8
+ color?: string;
9
+ /** Dashed line */
10
+ strokeDasharray?: string;
11
+ }
12
+ export interface LineChartProps {
13
+ /** Array of data objects */
14
+ data: Record<string, unknown>[];
15
+ /** Key in data for x-axis values */
16
+ xKey?: string;
17
+ /** One or more line series to render */
18
+ series: LineSeriesConfig[];
19
+ /** Chart title */
20
+ title?: string;
21
+ /** Description text below the title */
22
+ subtitle?: string;
23
+ /** Summary stats displayed in the header */
24
+ summaryItems?: ChartSummaryItem[];
25
+ /** Chart area height in pixels */
26
+ height?: number;
27
+ /** Additional CSS classes on the wrapper */
28
+ className?: string;
29
+ }
30
+ /**
31
+ * Line chart built on Recharts with design-system tokens.
32
+ * Supports multiple series with individual colours.
33
+ */
34
+ export declare const LineChart: ({ data, xKey, series, title, subtitle, summaryItems, height, className, }: LineChartProps) => import("react").JSX.Element;
@@ -0,0 +1,90 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { useCallback } from "react";
3
+ import { ResponsiveContainer, LineChart as LineChart$1, CartesianGrid, XAxis, YAxis, Tooltip, Line } from "recharts";
4
+ import "./Chart.css";
5
+ function getCSSVar(name, fallback) {
6
+ if (typeof window === "undefined") return fallback;
7
+ return getComputedStyle(document.documentElement).getPropertyValue(name).trim() || fallback;
8
+ }
9
+ function LineChartTooltip({ 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("span", { className: "ds-chart__tooltip-dot", style: { backgroundColor: entry.color } }),
15
+ /* @__PURE__ */ jsx("span", { className: "ds-chart__tooltip-name", children: entry.name }),
16
+ /* @__PURE__ */ jsx("span", { className: "ds-chart__tooltip-value", children: entry.value?.toLocaleString() })
17
+ ] }, i))
18
+ ] });
19
+ }
20
+ const LineChart = ({
21
+ data,
22
+ xKey = "label",
23
+ series,
24
+ title,
25
+ subtitle,
26
+ summaryItems,
27
+ height = 350,
28
+ className = ""
29
+ }) => {
30
+ const baseClass = "ds-chart";
31
+ const classes = [baseClass, className].filter(Boolean).join(" ");
32
+ const textSecondary = getCSSVar("--color-text-secondary", "#A2A2A2");
33
+ const gridColor = getCSSVar("--color-divider", "#232323");
34
+ const defaultColor = getCSSVar("--color-action-primary-bg", "#118AB2");
35
+ const renderTooltip = useCallback(
36
+ /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
37
+ (props) => /* @__PURE__ */ jsx(LineChartTooltip, { ...props }),
38
+ []
39
+ );
40
+ return /* @__PURE__ */ jsxs("div", { className: classes, children: [
41
+ (title || subtitle || summaryItems) && /* @__PURE__ */ jsxs("div", { className: `${baseClass}__header`, children: [
42
+ /* @__PURE__ */ jsxs("div", { className: `${baseClass}__header-text`, children: [
43
+ title && /* @__PURE__ */ jsx("h3", { className: `${baseClass}__title`, children: title }),
44
+ subtitle && /* @__PURE__ */ jsx("p", { className: `${baseClass}__subtitle`, children: subtitle })
45
+ ] }),
46
+ summaryItems && summaryItems.length > 0 && /* @__PURE__ */ jsx("div", { className: `${baseClass}__summary`, children: summaryItems.map((item, i) => /* @__PURE__ */ jsxs("div", { className: `${baseClass}__summary-item`, children: [
47
+ /* @__PURE__ */ jsx("span", { className: `${baseClass}__summary-label`, children: item.label }),
48
+ /* @__PURE__ */ jsx("span", { className: `${baseClass}__summary-value`, children: typeof item.value === "number" ? item.value.toLocaleString() : item.value })
49
+ ] }, i)) })
50
+ ] }),
51
+ /* @__PURE__ */ jsx("div", { className: `${baseClass}__body`, children: /* @__PURE__ */ jsx(ResponsiveContainer, { width: "100%", height, children: /* @__PURE__ */ jsxs(LineChart$1, { data, margin: { top: 8, right: 4, bottom: 0, left: -12 }, children: [
52
+ /* @__PURE__ */ jsx(CartesianGrid, { vertical: false, stroke: gridColor }),
53
+ /* @__PURE__ */ jsx(
54
+ XAxis,
55
+ {
56
+ dataKey: xKey,
57
+ tick: { fill: textSecondary, fontSize: 12 },
58
+ tickLine: false,
59
+ axisLine: { stroke: gridColor }
60
+ }
61
+ ),
62
+ /* @__PURE__ */ jsx(
63
+ YAxis,
64
+ {
65
+ tick: { fill: textSecondary, fontSize: 12 },
66
+ tickLine: false,
67
+ axisLine: false
68
+ }
69
+ ),
70
+ /* @__PURE__ */ jsx(Tooltip, { content: renderTooltip }),
71
+ series.map((s) => /* @__PURE__ */ jsx(
72
+ Line,
73
+ {
74
+ type: "monotone",
75
+ dataKey: s.dataKey,
76
+ name: s.label,
77
+ stroke: s.color || defaultColor,
78
+ strokeWidth: 2,
79
+ strokeDasharray: s.strokeDasharray,
80
+ dot: false,
81
+ activeDot: { r: 4, strokeWidth: 0 }
82
+ },
83
+ s.dataKey
84
+ ))
85
+ ] }) }) })
86
+ ] });
87
+ };
88
+ export {
89
+ LineChart
90
+ };
@@ -0,0 +1,34 @@
1
+ import { ChartSummaryItem } from './BarChart';
2
+ export interface PieSlice {
3
+ /** Display name */
4
+ name: string;
5
+ /** Numeric value */
6
+ value: number;
7
+ /** Slice fill colour */
8
+ color?: string;
9
+ }
10
+ export interface PieChartProps {
11
+ /** Array of slices */
12
+ data: PieSlice[];
13
+ /** Chart title */
14
+ title?: string;
15
+ /** Description text below the title */
16
+ subtitle?: string;
17
+ /** Summary stats displayed in the header */
18
+ summaryItems?: ChartSummaryItem[];
19
+ /** Chart area height in pixels */
20
+ height?: number;
21
+ /** Inner radius for donut style (0 = solid pie) */
22
+ innerRadius?: number;
23
+ /** Outer radius */
24
+ outerRadius?: number;
25
+ /** Show legend */
26
+ showLegend?: boolean;
27
+ /** Additional CSS classes on the wrapper */
28
+ className?: string;
29
+ }
30
+ /**
31
+ * Pie / donut chart built on Recharts with design-system tokens.
32
+ * Set innerRadius > 0 for a donut variant.
33
+ */
34
+ export declare const PieChart: ({ data, title, subtitle, summaryItems, height, innerRadius, outerRadius, showLegend, className, }: PieChartProps) => import("react").JSX.Element;
@@ -0,0 +1,106 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { useCallback } from "react";
3
+ import { ResponsiveContainer, PieChart as PieChart$1, Pie, Cell, Tooltip, Legend } from "recharts";
4
+ import "./Chart.css";
5
+ function getDefaultColors() {
6
+ if (typeof window === "undefined") {
7
+ return ["#118AB2", "#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", "#118AB2"),
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
+ function getCSSVar(name, fallback) {
20
+ if (typeof window === "undefined") return fallback;
21
+ return getComputedStyle(document.documentElement).getPropertyValue(name).trim() || fallback;
22
+ }
23
+ function PieChartTooltip({ active, payload }) {
24
+ if (!active || !payload?.length) return null;
25
+ const entry = payload[0];
26
+ return /* @__PURE__ */ jsx("div", { className: "ds-chart__tooltip", children: /* @__PURE__ */ jsxs("div", { className: "ds-chart__tooltip-row", children: [
27
+ /* @__PURE__ */ jsx(
28
+ "span",
29
+ {
30
+ className: "ds-chart__tooltip-dot",
31
+ style: { backgroundColor: entry.payload?.fill }
32
+ }
33
+ ),
34
+ /* @__PURE__ */ jsx("span", { className: "ds-chart__tooltip-name", children: entry.name }),
35
+ /* @__PURE__ */ jsx("span", { className: "ds-chart__tooltip-value", children: entry.value?.toLocaleString() })
36
+ ] }) });
37
+ }
38
+ const PieChart = ({
39
+ data,
40
+ title,
41
+ subtitle,
42
+ summaryItems,
43
+ height = 350,
44
+ innerRadius = 0,
45
+ outerRadius = 140,
46
+ showLegend = true,
47
+ className = ""
48
+ }) => {
49
+ const baseClass = "ds-chart";
50
+ const classes = [baseClass, className].filter(Boolean).join(" ");
51
+ const defaultColors = getDefaultColors();
52
+ const textSecondary = getCSSVar("--color-text-secondary", "#A2A2A2");
53
+ const renderTooltip = useCallback(
54
+ /* eslint-disable-next-line @typescript-eslint/no-explicit-any */
55
+ (props) => /* @__PURE__ */ jsx(PieChartTooltip, { ...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(PieChart$1, { children: [
70
+ /* @__PURE__ */ jsx(
71
+ Pie,
72
+ {
73
+ data,
74
+ dataKey: "value",
75
+ nameKey: "name",
76
+ cx: "50%",
77
+ cy: "50%",
78
+ innerRadius,
79
+ outerRadius,
80
+ strokeWidth: 2,
81
+ stroke: "var(--color-bg-container-primary)",
82
+ children: data.map((slice, i) => /* @__PURE__ */ jsx(
83
+ Cell,
84
+ {
85
+ fill: slice.color || defaultColors[i % defaultColors.length]
86
+ },
87
+ slice.name
88
+ ))
89
+ }
90
+ ),
91
+ /* @__PURE__ */ jsx(Tooltip, { content: renderTooltip }),
92
+ showLegend && /* @__PURE__ */ jsx(
93
+ Legend,
94
+ {
95
+ verticalAlign: "bottom",
96
+ iconType: "circle",
97
+ iconSize: 8,
98
+ formatter: (value) => /* @__PURE__ */ jsx("span", { style: { color: textSecondary, fontSize: 12 }, children: value })
99
+ }
100
+ )
101
+ ] }) }) })
102
+ ] });
103
+ };
104
+ export {
105
+ PieChart
106
+ };