@alpic-ai/ui 0.0.0-dev.g378c8b6 → 0.0.0-dev.g380fab7

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 (109) hide show
  1. package/dist/components/accordion-card.d.mts +5 -5
  2. package/dist/components/accordion.d.mts +5 -5
  3. package/dist/components/alert.d.mts +8 -8
  4. package/dist/components/area-chart.d.mts +62 -0
  5. package/dist/components/area-chart.mjs +269 -0
  6. package/dist/components/attachment-tile.d.mts +1 -1
  7. package/dist/components/avatar.d.mts +7 -7
  8. package/dist/components/badge.d.mts +1 -1
  9. package/dist/components/bar-chart.d.mts +48 -0
  10. package/dist/components/bar-chart.mjs +245 -0
  11. package/dist/components/bar-list.d.mts +28 -0
  12. package/dist/components/bar-list.mjs +98 -0
  13. package/dist/components/breadcrumb.d.mts +10 -10
  14. package/dist/components/button.d.mts +5 -5
  15. package/dist/components/card.d.mts +9 -9
  16. package/dist/components/chart-card.d.mts +25 -0
  17. package/dist/components/chart-card.mjs +48 -0
  18. package/dist/components/chart-container.d.mts +20 -0
  19. package/dist/components/chart-container.mjs +37 -0
  20. package/dist/components/chart-legend.d.mts +16 -0
  21. package/dist/components/chart-legend.mjs +26 -0
  22. package/dist/components/chart-tooltip.d.mts +33 -0
  23. package/dist/components/chart-tooltip.mjs +52 -0
  24. package/dist/components/checkbox.d.mts +2 -2
  25. package/dist/components/collapsible.d.mts +4 -4
  26. package/dist/components/combobox.d.mts +10 -10
  27. package/dist/components/command.d.mts +9 -9
  28. package/dist/components/copyable.d.mts +2 -2
  29. package/dist/components/description-list.d.mts +5 -5
  30. package/dist/components/dialog.d.mts +13 -13
  31. package/dist/components/donut-chart.d.mts +46 -0
  32. package/dist/components/donut-chart.mjs +185 -0
  33. package/dist/components/dropdown-menu.d.mts +17 -17
  34. package/dist/components/form.d.mts +18 -18
  35. package/dist/components/form.mjs +6 -6
  36. package/dist/components/github-button.d.mts +1 -1
  37. package/dist/components/grid-fx.d.mts +13 -0
  38. package/dist/components/grid-fx.mjs +188 -0
  39. package/dist/components/heatmap-chart.d.mts +40 -0
  40. package/dist/components/heatmap-chart.mjs +198 -0
  41. package/dist/components/input-group.d.mts +4 -4
  42. package/dist/components/input.d.mts +4 -4
  43. package/dist/components/input.mjs +2 -2
  44. package/dist/components/label.d.mts +2 -2
  45. package/dist/components/line-chart.d.mts +55 -0
  46. package/dist/components/line-chart.mjs +211 -0
  47. package/dist/components/page-loader.d.mts +1 -1
  48. package/dist/components/pagination.d.mts +3 -3
  49. package/dist/components/popover.d.mts +5 -5
  50. package/dist/components/radio-group.d.mts +3 -3
  51. package/dist/components/scroll-area.d.mts +3 -3
  52. package/dist/components/select.d.mts +9 -9
  53. package/dist/components/separator.d.mts +2 -2
  54. package/dist/components/sheet.d.mts +11 -11
  55. package/dist/components/shimmer-text.d.mts +3 -1
  56. package/dist/components/sidebar.d.mts +33 -33
  57. package/dist/components/sidebar.mjs +10 -10
  58. package/dist/components/skeleton.d.mts +1 -1
  59. package/dist/components/sonner.d.mts +5 -5
  60. package/dist/components/spinner.d.mts +2 -2
  61. package/dist/components/stat.d.mts +30 -0
  62. package/dist/components/stat.mjs +107 -0
  63. package/dist/components/status-dot.d.mts +1 -1
  64. package/dist/components/switch.d.mts +2 -2
  65. package/dist/components/table.d.mts +10 -10
  66. package/dist/components/tabs.d.mts +10 -10
  67. package/dist/components/tag.d.mts +3 -3
  68. package/dist/components/task-progress.d.mts +1 -1
  69. package/dist/components/textarea.d.mts +3 -3
  70. package/dist/components/textarea.mjs +2 -2
  71. package/dist/components/toggle-group.d.mts +3 -3
  72. package/dist/components/toggle-group.mjs +3 -3
  73. package/dist/components/tooltip.d.mts +5 -5
  74. package/dist/components/typography.d.mts +4 -4
  75. package/dist/components/wizard.d.mts +4 -4
  76. package/dist/hooks/use-chart-theme.d.mts +18 -0
  77. package/dist/hooks/use-chart-theme.mjs +57 -0
  78. package/dist/hooks/use-mobile.mjs +3 -3
  79. package/dist/hooks/use-reduced-motion.d.mts +4 -0
  80. package/dist/hooks/use-reduced-motion.mjs +16 -0
  81. package/dist/lib/chart-palette.d.mts +4 -0
  82. package/dist/lib/chart-palette.mjs +95 -0
  83. package/dist/lib/chart.d.mts +14 -0
  84. package/dist/lib/chart.mjs +27 -0
  85. package/package.json +30 -29
  86. package/src/components/area-chart.tsx +339 -0
  87. package/src/components/bar-chart.tsx +300 -0
  88. package/src/components/bar-list.tsx +150 -0
  89. package/src/components/chart-card.tsx +63 -0
  90. package/src/components/chart-container.tsx +49 -0
  91. package/src/components/chart-legend.tsx +41 -0
  92. package/src/components/chart-tooltip.tsx +93 -0
  93. package/src/components/donut-chart.tsx +217 -0
  94. package/src/components/grid-fx.tsx +238 -0
  95. package/src/components/heatmap-chart.tsx +287 -0
  96. package/src/components/line-chart.tsx +264 -0
  97. package/src/components/stat.tsx +109 -0
  98. package/src/hooks/use-chart-theme.ts +75 -0
  99. package/src/hooks/use-reduced-motion.ts +17 -0
  100. package/src/lib/chart-palette.ts +110 -0
  101. package/src/lib/chart.ts +56 -0
  102. package/src/stories/area-chart.stories.tsx +200 -0
  103. package/src/stories/bar-chart.stories.tsx +169 -0
  104. package/src/stories/bar-list.stories.tsx +85 -0
  105. package/src/stories/donut-chart.stories.tsx +112 -0
  106. package/src/stories/heatmap-chart.stories.tsx +107 -0
  107. package/src/stories/line-chart.stories.tsx +146 -0
  108. package/src/stories/stat.stories.tsx +64 -0
  109. package/src/styles/tokens.css +63 -0
@@ -0,0 +1,245 @@
1
+ "use client";
2
+ import { cn } from "../lib/cn.mjs";
3
+ import { useReducedMotion } from "../hooks/use-reduced-motion.mjs";
4
+ import { orderByLuminance, resolveSeries } from "../lib/chart.mjs";
5
+ import { useChartContext } from "./chart-container.mjs";
6
+ import { ChartLegend } from "./chart-legend.mjs";
7
+ import { ChartTooltipContent } from "./chart-tooltip.mjs";
8
+ import { jsx, jsxs } from "react/jsx-runtime";
9
+ import * as React$1 from "react";
10
+ import { Bar, BarChart as BarChart$1, CartesianGrid, LabelList, ReferenceArea, ReferenceDot, ReferenceLine, ResponsiveContainer, Tooltip, XAxis, YAxis } from "recharts";
11
+ //#region src/components/bar-chart.tsx
12
+ const BAR_RADIUS = 4;
13
+ const MAX_BAR_SIZE = 48;
14
+ function BarChart({ data, index, series, variant = "stacked", legend = false, valueLabels = false, height = 200, yAxisWidth = 48, palette, referenceLine, markers, texture = false, loading = false, valueFormatter = (value) => value.toLocaleString("en-US"), labelFormatter, className }) {
15
+ const { palette: paletteColors, theme } = useChartContext(palette);
16
+ const reactId = React$1.useId().replace(/:/g, "");
17
+ const animated = !useReducedMotion();
18
+ const resolved = resolveSeries(series, paletteColors, theme);
19
+ const stacked = variant === "stacked" || variant === "expand";
20
+ const rendered = stacked ? orderByLuminance(resolved) : resolved;
21
+ const lead = resolved[0];
22
+ const withTotal = stacked && rendered.length > 1;
23
+ const numericMax = React$1.useMemo(() => {
24
+ let max = 0;
25
+ for (const row of data) for (const entry of series) {
26
+ const value = Number(row[entry.key]);
27
+ if (Number.isFinite(value) && value > max) max = value;
28
+ }
29
+ return max;
30
+ }, [data, series]);
31
+ const margin = {
32
+ top: markers?.length || valueLabels ? 18 : 8,
33
+ right: 8,
34
+ bottom: 2,
35
+ left: 0
36
+ };
37
+ const axis = {
38
+ stroke: theme.border,
39
+ tick: {
40
+ fill: theme.axisForeground,
41
+ fontSize: 10,
42
+ fontFamily: theme.fontMono
43
+ },
44
+ tickLine: false,
45
+ axisLine: {
46
+ stroke: theme.border,
47
+ strokeOpacity: .6
48
+ }
49
+ };
50
+ const legendItems = resolved.map((entry) => ({
51
+ name: entry.name,
52
+ color: entry.color,
53
+ dashed: entry.dashed
54
+ }));
55
+ const radiusFor = (slot) => {
56
+ if (!stacked || slot === rendered.length - 1) return [
57
+ BAR_RADIUS,
58
+ BAR_RADIUS,
59
+ 0,
60
+ 0
61
+ ];
62
+ return [
63
+ 0,
64
+ 0,
65
+ 0,
66
+ 0
67
+ ];
68
+ };
69
+ const fillFor = (entry, slot) => {
70
+ if (texture && lead && entry.key === lead.key) return `url(#bar-hatch-${reactId})`;
71
+ if (stacked) return entry.color;
72
+ return `url(#bar-${reactId}-${slot})`;
73
+ };
74
+ const renderValueLabel = (color) => (props) => {
75
+ if (props.x == null || props.y == null) return null;
76
+ return /* @__PURE__ */ jsx("text", {
77
+ x: Number(props.x) + Number(props.width ?? 0) / 2,
78
+ y: Number(props.y) - 5,
79
+ textAnchor: "middle",
80
+ fill: color,
81
+ fontFamily: theme.fontMono,
82
+ fontSize: 10,
83
+ style: { fontVariantNumeric: "tabular-nums" },
84
+ children: valueFormatter(Number(props.value ?? 0))
85
+ });
86
+ };
87
+ const isEmpty = data.length === 0 || rendered.length === 0;
88
+ return /* @__PURE__ */ jsxs("div", {
89
+ "data-slot": "bar-chart",
90
+ className: cn("flex w-full flex-col gap-3", className),
91
+ children: [/* @__PURE__ */ jsx("div", {
92
+ className: "w-full",
93
+ style: { height },
94
+ children: loading ? /* @__PURE__ */ jsxs("div", {
95
+ className: "flex h-full items-center justify-center gap-2.5 font-mono text-quaternary-foreground text-text-xs",
96
+ children: [/* @__PURE__ */ jsx("span", { className: "size-4 animate-spin rounded-full border-2 border-border border-t-foreground" }), "loading…"]
97
+ }) : isEmpty ? /* @__PURE__ */ jsx("div", {
98
+ className: "flex h-full items-center justify-center rounded-lg border border-border border-dashed font-mono text-quaternary-foreground text-text-xs",
99
+ children: "no data in range"
100
+ }) : /* @__PURE__ */ jsx(ResponsiveContainer, {
101
+ width: "100%",
102
+ height: "100%",
103
+ children: /* @__PURE__ */ jsxs(BarChart$1, {
104
+ data,
105
+ stackOffset: variant === "expand" ? "expand" : "none",
106
+ margin,
107
+ barCategoryGap: stacked ? "20%" : "16%",
108
+ children: [
109
+ /* @__PURE__ */ jsxs("defs", { children: [!stacked && rendered.map((entry, slot) => /* @__PURE__ */ jsxs("linearGradient", {
110
+ id: `bar-${reactId}-${slot}`,
111
+ x1: "0",
112
+ y1: "0",
113
+ x2: "0",
114
+ y2: "1",
115
+ children: [/* @__PURE__ */ jsx("stop", {
116
+ offset: "0%",
117
+ stopColor: entry.color,
118
+ stopOpacity: .95
119
+ }), /* @__PURE__ */ jsx("stop", {
120
+ offset: "100%",
121
+ stopColor: entry.color,
122
+ stopOpacity: .5
123
+ })]
124
+ }, entry.key)), texture && lead && /* @__PURE__ */ jsxs("pattern", {
125
+ id: `bar-hatch-${reactId}`,
126
+ patternUnits: "userSpaceOnUse",
127
+ width: 6,
128
+ height: 6,
129
+ patternTransform: "rotate(45)",
130
+ children: [/* @__PURE__ */ jsx("rect", {
131
+ width: 6,
132
+ height: 6,
133
+ fill: lead.color,
134
+ fillOpacity: .22
135
+ }), /* @__PURE__ */ jsx("line", {
136
+ x1: 0,
137
+ y1: 0,
138
+ x2: 0,
139
+ y2: 6,
140
+ stroke: lead.color,
141
+ strokeWidth: 1.2,
142
+ strokeOpacity: .65
143
+ })]
144
+ })] }),
145
+ /* @__PURE__ */ jsx(CartesianGrid, {
146
+ vertical: false,
147
+ stroke: theme.grid,
148
+ strokeDasharray: "2 4"
149
+ }),
150
+ /* @__PURE__ */ jsx(XAxis, {
151
+ dataKey: index,
152
+ ...axis,
153
+ interval: "preserveStartEnd",
154
+ minTickGap: 44
155
+ }),
156
+ /* @__PURE__ */ jsx(YAxis, {
157
+ ...axis,
158
+ width: yAxisWidth,
159
+ domain: referenceLine && variant !== "expand" ? [0, Math.ceil(Math.max(numericMax, referenceLine.y) * 1.15)] : void 0,
160
+ tickFormatter: (value) => variant === "expand" ? `${Math.round(value * 100)}%` : valueFormatter(value)
161
+ }),
162
+ /* @__PURE__ */ jsx(Tooltip, {
163
+ offset: 12,
164
+ allowEscapeViewBox: {
165
+ x: false,
166
+ y: false
167
+ },
168
+ cursor: {
169
+ fill: lead?.color ?? theme.mutedForeground,
170
+ fillOpacity: theme.isDark ? .1 : .06
171
+ },
172
+ content: /* @__PURE__ */ jsx(ChartTooltipContent, {
173
+ valueFormatter,
174
+ labelFormatter,
175
+ showTotal: withTotal
176
+ })
177
+ }),
178
+ referenceLine?.band && /* @__PURE__ */ jsx(ReferenceArea, {
179
+ y1: referenceLine.y,
180
+ y2: numericMax,
181
+ fill: theme.warning,
182
+ fillOpacity: .06,
183
+ ifOverflow: "extendDomain"
184
+ }),
185
+ referenceLine && /* @__PURE__ */ jsx(ReferenceLine, {
186
+ y: referenceLine.y,
187
+ stroke: theme.warning,
188
+ strokeDasharray: "4 4",
189
+ strokeOpacity: .6,
190
+ label: referenceLine.label ? {
191
+ value: referenceLine.label,
192
+ fill: theme.warning,
193
+ fontSize: 9,
194
+ fontFamily: theme.fontMono,
195
+ position: "insideBottomRight"
196
+ } : void 0
197
+ }),
198
+ rendered.map((entry, slot) => /* @__PURE__ */ jsx(Bar, {
199
+ dataKey: entry.key,
200
+ name: entry.name,
201
+ stackId: stacked ? "stack" : void 0,
202
+ fill: fillFor(entry, slot),
203
+ stroke: entry.color,
204
+ strokeWidth: 0,
205
+ radius: radiusFor(slot),
206
+ maxBarSize: MAX_BAR_SIZE,
207
+ activeBar: {
208
+ fillOpacity: 1,
209
+ stroke: theme.card,
210
+ strokeWidth: 1
211
+ },
212
+ isAnimationActive: animated,
213
+ animationDuration: 650,
214
+ animationEasing: "ease-out",
215
+ children: valueLabels && (!stacked || rendered.length === 1) && /* @__PURE__ */ jsx(LabelList, {
216
+ dataKey: entry.key,
217
+ content: renderValueLabel(entry.color)
218
+ })
219
+ }, entry.key)),
220
+ markers?.map((marker) => /* @__PURE__ */ jsx(ReferenceDot, {
221
+ x: marker.x,
222
+ y: marker.y,
223
+ r: 3.5,
224
+ fill: marker.color ?? theme.foreground,
225
+ stroke: theme.card,
226
+ strokeWidth: 2,
227
+ label: marker.label ? {
228
+ value: marker.label,
229
+ fill: marker.color ?? theme.foreground,
230
+ fontSize: 9,
231
+ fontFamily: theme.fontMono,
232
+ position: "top"
233
+ } : void 0
234
+ }, `${marker.x}-${marker.y}`))
235
+ ]
236
+ })
237
+ })
238
+ }), legend && !isEmpty && /* @__PURE__ */ jsx(ChartLegend, {
239
+ items: legendItems,
240
+ style: { paddingLeft: yAxisWidth }
241
+ })]
242
+ });
243
+ }
244
+ //#endregion
245
+ export { BarChart };
@@ -0,0 +1,28 @@
1
+ import { ChartPaletteName } from "../lib/chart-palette.mjs";
2
+ import * as React$1 from "react";
3
+
4
+ //#region src/components/bar-list.d.ts
5
+ interface BarListProps {
6
+ data: ReadonlyArray<Record<string, string | number | null | undefined>>;
7
+ index: string;
8
+ dataKey?: string;
9
+ maxItems?: number;
10
+ palette?: ChartPaletteName;
11
+ loading?: boolean;
12
+ valueFormatter?: (value: number) => string;
13
+ labelFormatter?: (label: string | number) => string;
14
+ className?: string;
15
+ }
16
+ declare function BarList({
17
+ data,
18
+ index,
19
+ dataKey,
20
+ maxItems,
21
+ palette,
22
+ loading,
23
+ valueFormatter,
24
+ labelFormatter,
25
+ className
26
+ }: BarListProps): React$1.JSX.Element;
27
+ //#endregion
28
+ export { BarList, BarListProps };
@@ -0,0 +1,98 @@
1
+ "use client";
2
+ import { cn } from "../lib/cn.mjs";
3
+ import { useReducedMotion } from "../hooks/use-reduced-motion.mjs";
4
+ import { rampColor } from "../lib/chart-palette.mjs";
5
+ import { formatShare } from "../lib/chart.mjs";
6
+ import { useChartContext } from "./chart-container.mjs";
7
+ import { jsx, jsxs } from "react/jsx-runtime";
8
+ import * as React$1 from "react";
9
+ //#region src/components/bar-list.tsx
10
+ const PLACEHOLDER_HEIGHT = 168;
11
+ const RAMP_CEILING = .8;
12
+ const IN_FILL_SHADOW = "0 1px 2px rgb(0 0 0 / 0.28)";
13
+ function BarList({ data, index, dataKey = "value", maxItems, palette, loading = false, valueFormatter = (value) => value.toLocaleString("en-US"), labelFormatter, className }) {
14
+ const { paletteName } = useChartContext(palette);
15
+ const reducedMotion = useReducedMotion();
16
+ const [mounted, setMounted] = React$1.useState(false);
17
+ const [active, setActive] = React$1.useState(null);
18
+ React$1.useEffect(() => {
19
+ setMounted(true);
20
+ }, []);
21
+ const total = React$1.useMemo(() => data.reduce((sum, row) => sum + (Number(row[dataKey]) || 0), 0), [data, dataKey]);
22
+ const rows = React$1.useMemo(() => {
23
+ const mapped = data.map((row) => ({
24
+ name: String(row[index] ?? ""),
25
+ value: Number(row[dataKey]) || 0
26
+ }));
27
+ mapped.sort((lower, upper) => upper.value - lower.value);
28
+ const capped = maxItems ? mapped.slice(0, maxItems) : mapped;
29
+ return capped.map((row, rank) => ({
30
+ ...row,
31
+ color: rampColor(paletteName, (capped.length > 1 ? rank / (capped.length - 1) : 0) * RAMP_CEILING)
32
+ }));
33
+ }, [
34
+ data,
35
+ index,
36
+ dataKey,
37
+ maxItems,
38
+ paletteName
39
+ ]);
40
+ const maxValue = rows.reduce((max, row) => row.value > max ? row.value : max, 0);
41
+ const isEmpty = rows.length === 0;
42
+ const formatName = (name) => labelFormatter ? labelFormatter(name) : name;
43
+ if (loading) return /* @__PURE__ */ jsxs("div", {
44
+ className: cn("flex items-center justify-center gap-2.5 font-mono text-quaternary-foreground text-text-xs", className),
45
+ style: { minHeight: PLACEHOLDER_HEIGHT },
46
+ children: [/* @__PURE__ */ jsx("span", { className: "size-4 animate-spin rounded-full border-2 border-border border-t-foreground" }), "loading…"]
47
+ });
48
+ if (isEmpty) return /* @__PURE__ */ jsx("div", {
49
+ className: cn("flex items-center justify-center rounded-lg border border-border border-dashed font-mono text-quaternary-foreground text-text-xs", className),
50
+ style: { minHeight: PLACEHOLDER_HEIGHT },
51
+ children: "no data in range"
52
+ });
53
+ return /* @__PURE__ */ jsx("div", {
54
+ "data-slot": "bar-list",
55
+ className: cn("flex w-full flex-col gap-2", className),
56
+ children: rows.map((row, slot) => {
57
+ const fraction = maxValue > 0 ? row.value / maxValue : 0;
58
+ const fillWidth = !reducedMotion && !mounted ? "0%" : `${fraction * 100}%`;
59
+ const dimmed = active !== null && active !== slot;
60
+ const isActive = active === slot;
61
+ return /* @__PURE__ */ jsxs("div", {
62
+ onMouseEnter: () => setActive(slot),
63
+ onMouseLeave: () => setActive(null),
64
+ className: "flex items-center gap-3",
65
+ children: [/* @__PURE__ */ jsxs("div", {
66
+ className: "relative h-[30px] flex-1 overflow-hidden rounded-md bg-muted",
67
+ children: [/* @__PURE__ */ jsx("span", {
68
+ className: "pointer-events-none absolute inset-x-3 top-1/2 z-0 -translate-y-1/2 truncate type-text-xs font-medium text-foreground",
69
+ children: formatName(row.name)
70
+ }), /* @__PURE__ */ jsx("div", {
71
+ className: "absolute inset-y-0 left-0 z-10 overflow-hidden rounded-md motion-safe:transition-[width,opacity] motion-safe:duration-700 motion-safe:ease-out",
72
+ style: {
73
+ width: fillWidth,
74
+ background: `linear-gradient(90deg, ${row.color}, color-mix(in oklab, ${row.color} 82%, transparent))`,
75
+ boxShadow: `inset 0 0 0 1px ${row.color}`,
76
+ opacity: dimmed ? .45 : 1
77
+ },
78
+ children: /* @__PURE__ */ jsx("span", {
79
+ className: "pointer-events-none absolute top-1/2 -translate-y-1/2 truncate type-text-xs font-medium text-white",
80
+ style: {
81
+ left: 12,
82
+ width: `calc(${100 / Math.max(fraction, 1e-4)}% - 24px)`,
83
+ textShadow: IN_FILL_SHADOW
84
+ },
85
+ children: formatName(row.name)
86
+ })
87
+ })]
88
+ }), /* @__PURE__ */ jsx("span", {
89
+ className: "w-16 shrink-0 text-right font-mono text-text-xs tabular-nums motion-safe:transition-colors",
90
+ style: { color: isActive ? row.color : void 0 },
91
+ children: isActive ? formatShare(total > 0 ? row.value / total : 0) : valueFormatter(row.value)
92
+ })]
93
+ }, row.name);
94
+ })
95
+ });
96
+ }
97
+ //#endregion
98
+ export { BarList };
@@ -1,41 +1,41 @@
1
- import * as React from "react";
1
+ import * as React$1 from "react";
2
2
 
3
3
  //#region src/components/breadcrumb.d.ts
4
4
  declare function Breadcrumb({
5
5
  className,
6
6
  ...props
7
- }: React.ComponentProps<"nav">): import("react/jsx-runtime").JSX.Element;
7
+ }: React$1.ComponentProps<"nav">): React$1.JSX.Element;
8
8
  declare function BreadcrumbList({
9
9
  className,
10
10
  ...props
11
- }: React.ComponentProps<"ol">): import("react/jsx-runtime").JSX.Element;
11
+ }: React$1.ComponentProps<"ol">): React$1.JSX.Element;
12
12
  declare function BreadcrumbItem({
13
13
  className,
14
14
  ...props
15
- }: React.ComponentProps<"li">): import("react/jsx-runtime").JSX.Element;
15
+ }: React$1.ComponentProps<"li">): React$1.JSX.Element;
16
16
  declare function BreadcrumbLink({
17
17
  asChild,
18
18
  className,
19
19
  ...props
20
- }: React.ComponentProps<"a"> & {
20
+ }: React$1.ComponentProps<"a"> & {
21
21
  asChild?: boolean;
22
- }): import("react/jsx-runtime").JSX.Element;
22
+ }): React$1.JSX.Element;
23
23
  declare function BreadcrumbPage({
24
24
  className,
25
25
  ...props
26
- }: React.ComponentProps<"span">): import("react/jsx-runtime").JSX.Element;
26
+ }: React$1.ComponentProps<"span">): React$1.JSX.Element;
27
27
  declare function BreadcrumbSeparator({
28
28
  children,
29
29
  className,
30
30
  ...props
31
- }: React.ComponentProps<"li">): import("react/jsx-runtime").JSX.Element;
31
+ }: React$1.ComponentProps<"li">): React$1.JSX.Element;
32
32
  declare function BreadcrumbChevron({
33
33
  className,
34
34
  ...props
35
- }: React.ComponentProps<"span">): import("react/jsx-runtime").JSX.Element;
35
+ }: React$1.ComponentProps<"span">): React$1.JSX.Element;
36
36
  declare function BreadcrumbEllipsis({
37
37
  className,
38
38
  ...props
39
- }: React.ComponentProps<"span">): import("react/jsx-runtime").JSX.Element;
39
+ }: React$1.ComponentProps<"span">): React$1.JSX.Element;
40
40
  //#endregion
41
41
  export { Breadcrumb, BreadcrumbChevron, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator };
@@ -1,16 +1,16 @@
1
1
  import { VariantProps } from "class-variance-authority";
2
- import * as React from "react";
2
+ import * as React$1 from "react";
3
3
 
4
4
  //#region src/components/button.d.ts
5
5
  declare const buttonVariants: (props?: ({
6
6
  variant?: "destructive" | "secondary" | "primary" | "tertiary" | "link" | "link-muted" | "cta" | null | undefined;
7
7
  size?: "default" | "icon" | "icon-rounded" | "pill" | null | undefined;
8
8
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
9
- interface ButtonProps extends React.ComponentProps<"button">, VariantProps<typeof buttonVariants> {
9
+ interface ButtonProps extends React$1.ComponentProps<"button">, VariantProps<typeof buttonVariants> {
10
10
  asChild?: boolean;
11
11
  loading?: boolean;
12
- icon?: React.ReactNode;
13
- iconTrailing?: React.ReactNode;
12
+ icon?: React$1.ReactNode;
13
+ iconTrailing?: React$1.ReactNode;
14
14
  }
15
15
  declare function Button({
16
16
  className,
@@ -24,6 +24,6 @@ declare function Button({
24
24
  disabled,
25
25
  children,
26
26
  ...props
27
- }: ButtonProps): import("react/jsx-runtime").JSX.Element;
27
+ }: ButtonProps): React$1.JSX.Element;
28
28
  //#endregion
29
29
  export { Button, type ButtonProps, buttonVariants };
@@ -1,36 +1,36 @@
1
- import * as React from "react";
1
+ import * as React$1 from "react";
2
2
 
3
3
  //#region src/components/card.d.ts
4
4
  declare function Card({
5
5
  className,
6
6
  hoverable,
7
7
  ...props
8
- }: React.ComponentProps<"div"> & {
8
+ }: React$1.ComponentProps<"div"> & {
9
9
  hoverable?: boolean;
10
- }): import("react/jsx-runtime").JSX.Element;
10
+ }): React$1.JSX.Element;
11
11
  declare function CardHeader({
12
12
  className,
13
13
  ...props
14
- }: React.ComponentProps<"div">): import("react/jsx-runtime").JSX.Element;
14
+ }: React$1.ComponentProps<"div">): React$1.JSX.Element;
15
15
  declare function CardTitle({
16
16
  className,
17
17
  ...props
18
- }: React.ComponentProps<"div">): import("react/jsx-runtime").JSX.Element;
18
+ }: React$1.ComponentProps<"div">): React$1.JSX.Element;
19
19
  declare function CardDescription({
20
20
  className,
21
21
  ...props
22
- }: React.ComponentProps<"div">): import("react/jsx-runtime").JSX.Element;
22
+ }: React$1.ComponentProps<"div">): React$1.JSX.Element;
23
23
  declare function CardAction({
24
24
  className,
25
25
  ...props
26
- }: React.ComponentProps<"div">): import("react/jsx-runtime").JSX.Element;
26
+ }: React$1.ComponentProps<"div">): React$1.JSX.Element;
27
27
  declare function CardContent({
28
28
  className,
29
29
  ...props
30
- }: React.ComponentProps<"div">): import("react/jsx-runtime").JSX.Element;
30
+ }: React$1.ComponentProps<"div">): React$1.JSX.Element;
31
31
  declare function CardFooter({
32
32
  className,
33
33
  ...props
34
- }: React.ComponentProps<"div">): import("react/jsx-runtime").JSX.Element;
34
+ }: React$1.ComponentProps<"div">): React$1.JSX.Element;
35
35
  //#endregion
36
36
  export { Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle };
@@ -0,0 +1,25 @@
1
+ import { ChartPaletteName } from "../lib/chart-palette.mjs";
2
+ import * as React$1 from "react";
3
+
4
+ //#region src/components/chart-card.d.ts
5
+ interface ChartCardProps extends Omit<React$1.ComponentProps<"section">, "title"> {
6
+ palette?: ChartPaletteName;
7
+ kicker?: React$1.ReactNode;
8
+ title?: React$1.ReactNode;
9
+ description?: React$1.ReactNode;
10
+ action?: React$1.ReactNode;
11
+ accent?: "top" | "left";
12
+ }
13
+ declare function ChartCard({
14
+ palette,
15
+ kicker,
16
+ title,
17
+ description,
18
+ action,
19
+ accent,
20
+ className,
21
+ children,
22
+ ...props
23
+ }: ChartCardProps): React$1.JSX.Element;
24
+ //#endregion
25
+ export { ChartCard, ChartCardProps };
@@ -0,0 +1,48 @@
1
+ "use client";
2
+ import { cn } from "../lib/cn.mjs";
3
+ import { CHART_PALETTES } from "../lib/chart-palette.mjs";
4
+ import { ChartContainer } from "./chart-container.mjs";
5
+ import { jsx, jsxs } from "react/jsx-runtime";
6
+ //#region src/components/chart-card.tsx
7
+ function ChartCard({ palette = "magenta", kicker, title, description, action, accent = "top", className, children, ...props }) {
8
+ const lead = CHART_PALETTES[palette][0];
9
+ const isLeft = accent === "left";
10
+ return /* @__PURE__ */ jsxs("section", {
11
+ "data-slot": "chart-card",
12
+ className: cn("chart-rise relative overflow-hidden rounded-xl border bg-card p-5 text-card-foreground shadow-shadow", isLeft && "pl-6", className),
13
+ ...props,
14
+ children: [
15
+ /* @__PURE__ */ jsx("span", {
16
+ "aria-hidden": true,
17
+ className: cn("absolute", isLeft ? "inset-y-0 left-0 w-[3px]" : "inset-x-0 top-0 h-[3px]"),
18
+ style: { background: lead }
19
+ }),
20
+ (kicker || title || action) && /* @__PURE__ */ jsxs("header", {
21
+ className: "mb-4 flex items-start justify-between gap-4",
22
+ children: [/* @__PURE__ */ jsxs("div", {
23
+ className: "flex flex-col gap-1",
24
+ children: [
25
+ kicker && /* @__PURE__ */ jsx("span", {
26
+ className: "font-mono text-[10px] text-primary uppercase tracking-[0.18em]",
27
+ children: kicker
28
+ }),
29
+ title && /* @__PURE__ */ jsx("h3", {
30
+ className: "type-text-md font-semibold leading-none tracking-tight",
31
+ children: title
32
+ }),
33
+ description && /* @__PURE__ */ jsx("p", {
34
+ className: "type-text-xs text-muted-foreground",
35
+ children: description
36
+ })
37
+ ]
38
+ }), action]
39
+ }),
40
+ /* @__PURE__ */ jsx(ChartContainer, {
41
+ palette,
42
+ children
43
+ })
44
+ ]
45
+ });
46
+ }
47
+ //#endregion
48
+ export { ChartCard };
@@ -0,0 +1,20 @@
1
+ import { ChartTheme } from "../hooks/use-chart-theme.mjs";
2
+ import { ChartPaletteName } from "../lib/chart-palette.mjs";
3
+ import * as React$1 from "react";
4
+
5
+ //#region src/components/chart-container.d.ts
6
+ interface ChartContextValue {
7
+ palette: readonly string[];
8
+ paletteName: ChartPaletteName;
9
+ theme: ChartTheme;
10
+ }
11
+ declare function ChartContainer({
12
+ palette,
13
+ className,
14
+ ...props
15
+ }: React$1.ComponentProps<"div"> & {
16
+ palette?: ChartPaletteName;
17
+ }): React$1.JSX.Element;
18
+ declare function useChartContext(paletteOverride?: ChartPaletteName): ChartContextValue;
19
+ //#endregion
20
+ export { ChartContainer, type ChartContextValue, useChartContext };
@@ -0,0 +1,37 @@
1
+ "use client";
2
+ import { cn } from "../lib/cn.mjs";
3
+ import { CHART_PALETTES } from "../lib/chart-palette.mjs";
4
+ import { useChartTheme } from "../hooks/use-chart-theme.mjs";
5
+ import { jsx } from "react/jsx-runtime";
6
+ import * as React$1 from "react";
7
+ //#region src/components/chart-container.tsx
8
+ const ChartContext = React$1.createContext(null);
9
+ function ChartContainer({ palette = "magenta", className, ...props }) {
10
+ const theme = useChartTheme();
11
+ const value = React$1.useMemo(() => ({
12
+ palette: CHART_PALETTES[palette],
13
+ paletteName: palette,
14
+ theme
15
+ }), [palette, theme]);
16
+ return /* @__PURE__ */ jsx(ChartContext.Provider, {
17
+ value,
18
+ children: /* @__PURE__ */ jsx("div", {
19
+ "data-slot": "chart-container",
20
+ className: cn("flex flex-col gap-4", className),
21
+ ...props
22
+ })
23
+ });
24
+ }
25
+ function useChartContext(paletteOverride) {
26
+ const provided = React$1.useContext(ChartContext);
27
+ const fallbackTheme = useChartTheme();
28
+ if (provided && !paletteOverride) return provided;
29
+ const paletteName = paletteOverride ?? provided?.paletteName ?? "magenta";
30
+ return {
31
+ palette: CHART_PALETTES[paletteName],
32
+ paletteName,
33
+ theme: provided?.theme ?? fallbackTheme
34
+ };
35
+ }
36
+ //#endregion
37
+ export { ChartContainer, useChartContext };
@@ -0,0 +1,16 @@
1
+ //#region src/components/chart-legend.d.ts
2
+ interface ChartLegendItem {
3
+ name: string;
4
+ color: string;
5
+ dashed?: boolean;
6
+ }
7
+ interface ChartLegendProps extends React.HTMLAttributes<HTMLDivElement> {
8
+ items: ChartLegendItem[];
9
+ }
10
+ declare function ChartLegend({
11
+ items,
12
+ className,
13
+ ...props
14
+ }: ChartLegendProps): import("react").JSX.Element;
15
+ //#endregion
16
+ export { ChartLegend, ChartLegendItem, ChartLegendProps };
@@ -0,0 +1,26 @@
1
+ "use client";
2
+ import { cn } from "../lib/cn.mjs";
3
+ import { jsx, jsxs } from "react/jsx-runtime";
4
+ //#region src/components/chart-legend.tsx
5
+ function Swatch({ color, dashed }) {
6
+ return /* @__PURE__ */ jsx("span", {
7
+ "aria-hidden": true,
8
+ className: "size-2 shrink-0 rounded-full",
9
+ style: dashed ? { border: `1.5px solid ${color}` } : { background: color }
10
+ });
11
+ }
12
+ function ChartLegend({ items, className, ...props }) {
13
+ return /* @__PURE__ */ jsx("div", {
14
+ className: cn("flex flex-wrap gap-x-4 gap-y-1.5", className),
15
+ ...props,
16
+ children: items.map((item) => /* @__PURE__ */ jsxs("span", {
17
+ className: "inline-flex items-center gap-1.5 font-mono text-[10px] text-muted-foreground uppercase tracking-[0.12em]",
18
+ children: [/* @__PURE__ */ jsx(Swatch, {
19
+ color: item.color,
20
+ dashed: item.dashed
21
+ }), item.name]
22
+ }, item.name))
23
+ });
24
+ }
25
+ //#endregion
26
+ export { ChartLegend };