shadcn-chart 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.
- package/README.md +202 -0
- package/dist/index.d.mts +288 -0
- package/dist/index.d.ts +288 -0
- package/dist/index.js +9434 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +9390 -0
- package/dist/index.mjs.map +1 -0
- package/dist/styles/global.css +124 -0
- package/package.json +75 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as React$1 from 'react';
|
|
3
|
+
import React__default from 'react';
|
|
4
|
+
import * as RechartsPrimitive from 'recharts';
|
|
5
|
+
import { ClassValue } from 'clsx';
|
|
6
|
+
|
|
7
|
+
declare const THEMES: {
|
|
8
|
+
readonly light: "";
|
|
9
|
+
readonly dark: ".dark";
|
|
10
|
+
};
|
|
11
|
+
type ChartConfig = {
|
|
12
|
+
[k in string]: {
|
|
13
|
+
label?: React$1.ReactNode;
|
|
14
|
+
icon?: React$1.ComponentType;
|
|
15
|
+
} & ({
|
|
16
|
+
color?: string;
|
|
17
|
+
theme?: never;
|
|
18
|
+
} | {
|
|
19
|
+
color?: never;
|
|
20
|
+
theme: Record<keyof typeof THEMES, string>;
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
declare function ChartContainer({ id, className, children, config, ...props }: React$1.ComponentProps<"div"> & {
|
|
24
|
+
config: ChartConfig;
|
|
25
|
+
children: React$1.ComponentProps<typeof RechartsPrimitive.ResponsiveContainer>["children"];
|
|
26
|
+
}): react_jsx_runtime.JSX.Element;
|
|
27
|
+
declare const ChartStyle: ({ id, config }: {
|
|
28
|
+
id: string;
|
|
29
|
+
config: ChartConfig;
|
|
30
|
+
}) => react_jsx_runtime.JSX.Element | null;
|
|
31
|
+
declare const ChartTooltip: typeof RechartsPrimitive.Tooltip;
|
|
32
|
+
declare function ChartTooltipContent({ active, payload, className, indicator, hideLabel, hideIndicator, label, labelFormatter, labelClassName, formatter, color, nameKey, labelKey, }: React$1.ComponentProps<typeof RechartsPrimitive.Tooltip> & React$1.ComponentProps<"div"> & {
|
|
33
|
+
hideLabel?: boolean;
|
|
34
|
+
hideIndicator?: boolean;
|
|
35
|
+
indicator?: "line" | "dot" | "dashed";
|
|
36
|
+
nameKey?: string;
|
|
37
|
+
labelKey?: string;
|
|
38
|
+
}): react_jsx_runtime.JSX.Element | null;
|
|
39
|
+
declare const ChartLegend: typeof RechartsPrimitive.Legend;
|
|
40
|
+
declare function ChartLegendContent({ className, hideIcon, payload, verticalAlign, nameKey, }: React$1.ComponentProps<"div"> & Pick<RechartsPrimitive.LegendProps, "payload" | "verticalAlign"> & {
|
|
41
|
+
hideIcon?: boolean;
|
|
42
|
+
nameKey?: string;
|
|
43
|
+
}): react_jsx_runtime.JSX.Element | null;
|
|
44
|
+
|
|
45
|
+
type AreaChartVariant = 'default' | 'linear' | 'step' | 'stacked' | 'stacked-expanded' | 'gradient' | 'legend' | 'interactive';
|
|
46
|
+
type AreaCurveType = 'monotone' | 'linear' | 'step' | 'stepBefore' | 'stepAfter' | 'natural' | 'basis';
|
|
47
|
+
interface AreaConfig {
|
|
48
|
+
dataKey: string;
|
|
49
|
+
fill?: string;
|
|
50
|
+
stroke?: string;
|
|
51
|
+
stackId?: string;
|
|
52
|
+
type?: AreaCurveType;
|
|
53
|
+
fillOpacity?: number;
|
|
54
|
+
}
|
|
55
|
+
interface AreaChartComponentProps {
|
|
56
|
+
title?: string;
|
|
57
|
+
description?: string;
|
|
58
|
+
data: Array<Record<string, string | number>>;
|
|
59
|
+
chartConfig: ChartConfig;
|
|
60
|
+
className?: string;
|
|
61
|
+
variant?: AreaChartVariant;
|
|
62
|
+
areas?: AreaConfig[];
|
|
63
|
+
xAxisKey?: string;
|
|
64
|
+
xAxisFormatter?: (value: string) => string;
|
|
65
|
+
yAxisConfig?: {
|
|
66
|
+
domain?: [number, number] | 'auto';
|
|
67
|
+
tickFormatter?: (value: number) => string;
|
|
68
|
+
hide?: boolean;
|
|
69
|
+
};
|
|
70
|
+
showGrid?: boolean;
|
|
71
|
+
showTooltip?: boolean;
|
|
72
|
+
showLegend?: boolean;
|
|
73
|
+
showDots?: boolean;
|
|
74
|
+
showActiveDot?: boolean;
|
|
75
|
+
useGradient?: boolean;
|
|
76
|
+
gradientOpacity?: {
|
|
77
|
+
start: number;
|
|
78
|
+
end: number;
|
|
79
|
+
};
|
|
80
|
+
margin?: {
|
|
81
|
+
top?: number;
|
|
82
|
+
right?: number;
|
|
83
|
+
bottom?: number;
|
|
84
|
+
left?: number;
|
|
85
|
+
};
|
|
86
|
+
footerContent?: {
|
|
87
|
+
mainText?: string;
|
|
88
|
+
subText?: string;
|
|
89
|
+
showTrending?: boolean;
|
|
90
|
+
trendingIcon?: React.ReactNode;
|
|
91
|
+
trendingColor?: string;
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
declare const AreaChartComponent: ({ title, description, data, chartConfig, className, variant, areas, xAxisKey, xAxisFormatter, yAxisConfig, showGrid, showTooltip, showLegend, showDots, showActiveDot, useGradient, gradientOpacity, margin, footerContent, }: AreaChartComponentProps) => react_jsx_runtime.JSX.Element;
|
|
95
|
+
declare const AreaChartExample: () => react_jsx_runtime.JSX.Element;
|
|
96
|
+
|
|
97
|
+
type BarChartVariant = 'default' | 'horizontal' | 'multiple' | 'stacked' | 'stacked-legend' | 'label' | 'negative' | 'mixed' | 'interactive';
|
|
98
|
+
interface BarConfig {
|
|
99
|
+
dataKey: string;
|
|
100
|
+
fill?: string;
|
|
101
|
+
radius?: number | [number, number, number, number];
|
|
102
|
+
stackId?: string;
|
|
103
|
+
name?: string;
|
|
104
|
+
}
|
|
105
|
+
interface BarChartComponentProps {
|
|
106
|
+
title?: string;
|
|
107
|
+
description?: string;
|
|
108
|
+
data: Array<Record<string, string | number>>;
|
|
109
|
+
chartConfig: ChartConfig;
|
|
110
|
+
className?: string;
|
|
111
|
+
variant?: BarChartVariant;
|
|
112
|
+
bars?: BarConfig[];
|
|
113
|
+
xAxisKey?: string;
|
|
114
|
+
xAxisFormatter?: (value: string) => string;
|
|
115
|
+
yAxisConfig?: {
|
|
116
|
+
dataKey?: string;
|
|
117
|
+
domain?: [number, number] | 'auto';
|
|
118
|
+
tickFormatter?: (value: number) => string;
|
|
119
|
+
hide?: boolean;
|
|
120
|
+
};
|
|
121
|
+
showGrid?: boolean;
|
|
122
|
+
showTooltip?: boolean;
|
|
123
|
+
showLegend?: boolean;
|
|
124
|
+
showLabels?: boolean;
|
|
125
|
+
labelPosition?: 'top' | 'center' | 'bottom' | 'inside' | 'insideTop' | 'insideBottom';
|
|
126
|
+
labelFormatter?: (value: number) => string;
|
|
127
|
+
tooltipNameKey?: string;
|
|
128
|
+
layout?: 'vertical' | 'horizontal';
|
|
129
|
+
margin?: {
|
|
130
|
+
top?: number;
|
|
131
|
+
right?: number;
|
|
132
|
+
bottom?: number;
|
|
133
|
+
left?: number;
|
|
134
|
+
};
|
|
135
|
+
barRadius?: number | [number, number, number, number];
|
|
136
|
+
barGap?: number;
|
|
137
|
+
barCategoryGap?: string | number;
|
|
138
|
+
positiveColor?: string;
|
|
139
|
+
negativeColor?: string;
|
|
140
|
+
footerContent?: {
|
|
141
|
+
mainText?: string;
|
|
142
|
+
subText?: string;
|
|
143
|
+
showTrending?: boolean;
|
|
144
|
+
trendingIcon?: React.ReactNode;
|
|
145
|
+
trendingColor?: string;
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
declare const BarChartComponent: ({ title, description, data, chartConfig, className, variant, bars, xAxisKey, xAxisFormatter, yAxisConfig, showGrid, showTooltip, showLegend, showLabels, labelPosition, labelFormatter, tooltipNameKey, layout, margin, barRadius, barGap, barCategoryGap, positiveColor, negativeColor, footerContent, }: BarChartComponentProps) => react_jsx_runtime.JSX.Element;
|
|
149
|
+
declare const BarChartExample: () => react_jsx_runtime.JSX.Element;
|
|
150
|
+
|
|
151
|
+
interface ToggleOption {
|
|
152
|
+
value: string;
|
|
153
|
+
label: string;
|
|
154
|
+
icon?: React__default.ReactNode;
|
|
155
|
+
}
|
|
156
|
+
interface LineChartComponentProps {
|
|
157
|
+
title?: string;
|
|
158
|
+
description?: string;
|
|
159
|
+
data: Array<Record<string, string | number>>;
|
|
160
|
+
chartConfig: ChartConfig;
|
|
161
|
+
xAxisKey?: string;
|
|
162
|
+
yAxisConfig?: {
|
|
163
|
+
domain?: [number, number] | "auto";
|
|
164
|
+
padding?: number;
|
|
165
|
+
tickCount?: number;
|
|
166
|
+
formatType?: 'auto' | 'full' | 'compact' | 'currency' | 'percentage';
|
|
167
|
+
customFormatter?: (value: number) => string;
|
|
168
|
+
tickFormatter?: (value: number) => string;
|
|
169
|
+
};
|
|
170
|
+
lines?: Array<{
|
|
171
|
+
dataKey: string;
|
|
172
|
+
stroke?: string;
|
|
173
|
+
strokeWidth?: number;
|
|
174
|
+
type?: "monotone" | "linear" | "step" | "stepBefore" | "stepAfter";
|
|
175
|
+
dot?: boolean;
|
|
176
|
+
}>;
|
|
177
|
+
dot?: boolean | ((props: any) => React__default.ReactElement);
|
|
178
|
+
margin?: {
|
|
179
|
+
top?: number;
|
|
180
|
+
right?: number;
|
|
181
|
+
bottom?: number;
|
|
182
|
+
left?: number;
|
|
183
|
+
};
|
|
184
|
+
footerContent?: {
|
|
185
|
+
mainText?: string;
|
|
186
|
+
subText?: string;
|
|
187
|
+
showTrending?: boolean;
|
|
188
|
+
trendingIcon?: React__default.ReactNode;
|
|
189
|
+
trendingColor?: string;
|
|
190
|
+
};
|
|
191
|
+
toggleOptions?: {
|
|
192
|
+
options: ToggleOption[];
|
|
193
|
+
currentValue: string;
|
|
194
|
+
onChange: (value: string) => void;
|
|
195
|
+
position?: "header-right" | "header-left";
|
|
196
|
+
};
|
|
197
|
+
className?: string;
|
|
198
|
+
}
|
|
199
|
+
declare function LineChartComponent({ title, description, data, chartConfig, xAxisKey, yAxisConfig, lines, dot, margin, footerContent, toggleOptions, className }: LineChartComponentProps): react_jsx_runtime.JSX.Element;
|
|
200
|
+
interface UserActivityChartProps {
|
|
201
|
+
className?: string;
|
|
202
|
+
}
|
|
203
|
+
declare const LineChartExample: ({ className }: UserActivityChartProps) => react_jsx_runtime.JSX.Element;
|
|
204
|
+
|
|
205
|
+
interface PieChartData {
|
|
206
|
+
category: string;
|
|
207
|
+
value: number;
|
|
208
|
+
percentage: number;
|
|
209
|
+
fill?: string;
|
|
210
|
+
[key: string]: unknown;
|
|
211
|
+
}
|
|
212
|
+
interface PieChartProps {
|
|
213
|
+
title?: string;
|
|
214
|
+
description?: string;
|
|
215
|
+
data: PieChartData[];
|
|
216
|
+
chartConfig: ChartConfig;
|
|
217
|
+
className?: string;
|
|
218
|
+
dataKey?: string;
|
|
219
|
+
nameKey?: string;
|
|
220
|
+
legendKey?: string;
|
|
221
|
+
innerRadius?: number;
|
|
222
|
+
outerRadius?: number;
|
|
223
|
+
cornerRadius?: number;
|
|
224
|
+
paddingAngle?: number;
|
|
225
|
+
strokeWidth?: number;
|
|
226
|
+
stroke?: string;
|
|
227
|
+
animationDuration?: number;
|
|
228
|
+
enableAnimation?: boolean;
|
|
229
|
+
showLegend?: boolean;
|
|
230
|
+
showTooltip?: boolean;
|
|
231
|
+
showActiveSection?: boolean;
|
|
232
|
+
footerContent?: {
|
|
233
|
+
mainText?: string;
|
|
234
|
+
subText?: string;
|
|
235
|
+
showTrending?: boolean;
|
|
236
|
+
trendingColor?: string;
|
|
237
|
+
trendingIcon?: React.ReactNode;
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
declare const PieChartComponent: ({ title, description, data, chartConfig, className, dataKey, nameKey, legendKey, innerRadius, outerRadius, strokeWidth, cornerRadius, paddingAngle, stroke, showLegend, showTooltip, showActiveSection, footerContent }: PieChartProps) => react_jsx_runtime.JSX.Element;
|
|
241
|
+
declare const PieChartExample: () => react_jsx_runtime.JSX.Element;
|
|
242
|
+
|
|
243
|
+
interface RadialChartData {
|
|
244
|
+
category: string;
|
|
245
|
+
value: number;
|
|
246
|
+
percentage: number;
|
|
247
|
+
fill?: string;
|
|
248
|
+
}
|
|
249
|
+
interface RadialChartProps {
|
|
250
|
+
title?: string;
|
|
251
|
+
description?: string;
|
|
252
|
+
data: RadialChartData;
|
|
253
|
+
chartConfig: ChartConfig;
|
|
254
|
+
centerLabel?: string;
|
|
255
|
+
footerContent?: {
|
|
256
|
+
mainText?: string;
|
|
257
|
+
subText?: string;
|
|
258
|
+
showTrending?: boolean;
|
|
259
|
+
trendingColor?: string;
|
|
260
|
+
trendingIcon?: React.ReactNode;
|
|
261
|
+
};
|
|
262
|
+
innerRadius?: number;
|
|
263
|
+
outerRadius?: number;
|
|
264
|
+
cornerRadius?: number;
|
|
265
|
+
startAngle?: number;
|
|
266
|
+
className?: string;
|
|
267
|
+
numberSize?: 'sm' | 'md' | 'lg' | 'xl';
|
|
268
|
+
labelSize?: 'xs' | 'sm' | 'md';
|
|
269
|
+
animationDuration?: number;
|
|
270
|
+
centerOffset?: {
|
|
271
|
+
x?: number;
|
|
272
|
+
y?: number;
|
|
273
|
+
};
|
|
274
|
+
}
|
|
275
|
+
declare const RadialChartShapeComponent: ({ title, description, data, centerLabel, footerContent, chartConfig, innerRadius, outerRadius, cornerRadius, startAngle, className, numberSize, labelSize, animationDuration, centerOffset }: RadialChartProps) => react_jsx_runtime.JSX.Element;
|
|
276
|
+
declare const RadialChartExample: () => react_jsx_runtime.JSX.Element;
|
|
277
|
+
|
|
278
|
+
declare function Card({ className, ...props }: React$1.ComponentProps<"div">): react_jsx_runtime.JSX.Element;
|
|
279
|
+
declare function CardHeader({ className, ...props }: React$1.ComponentProps<"div">): react_jsx_runtime.JSX.Element;
|
|
280
|
+
declare function CardTitle({ className, ...props }: React$1.ComponentProps<"div">): react_jsx_runtime.JSX.Element;
|
|
281
|
+
declare function CardDescription({ className, ...props }: React$1.ComponentProps<"div">): react_jsx_runtime.JSX.Element;
|
|
282
|
+
declare function CardAction({ className, ...props }: React$1.ComponentProps<"div">): react_jsx_runtime.JSX.Element;
|
|
283
|
+
declare function CardContent({ className, ...props }: React$1.ComponentProps<"div">): react_jsx_runtime.JSX.Element;
|
|
284
|
+
declare function CardFooter({ className, ...props }: React$1.ComponentProps<"div">): react_jsx_runtime.JSX.Element;
|
|
285
|
+
|
|
286
|
+
declare function cn(...inputs: ClassValue[]): string;
|
|
287
|
+
|
|
288
|
+
export { AreaChartComponent, type AreaChartComponentProps, AreaChartExample, type AreaChartVariant, type AreaConfig, type AreaCurveType, BarChartComponent, type BarChartComponentProps, BarChartExample, type BarChartVariant, type BarConfig, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, type ChartConfig, ChartContainer, ChartLegend, ChartLegendContent, ChartStyle, ChartTooltip, ChartTooltipContent, LineChartComponent, LineChartExample, PieChartComponent, type PieChartData, PieChartExample, type PieChartProps, type RadialChartData, RadialChartExample, type RadialChartProps, RadialChartShapeComponent, cn };
|