@alpic-ai/ui 0.0.0-staging.gcd4957c → 0.0.0-staging.gcd7c19c

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