@fanvue/ui 1.18.2 → 1.19.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 (54) hide show
  1. package/dist/charts.d.ts +372 -0
  2. package/dist/charts.mjs +28 -0
  3. package/dist/charts.mjs.map +1 -0
  4. package/dist/cjs/charts.cjs +28 -0
  5. package/dist/cjs/charts.cjs.map +1 -0
  6. package/dist/cjs/components/Chart/ChartCard.cjs +88 -0
  7. package/dist/cjs/components/Chart/ChartCard.cjs.map +1 -0
  8. package/dist/cjs/components/Chart/ChartCenterLabel.cjs +51 -0
  9. package/dist/cjs/components/Chart/ChartCenterLabel.cjs.map +1 -0
  10. package/dist/cjs/components/Chart/ChartContainer.cjs +64 -0
  11. package/dist/cjs/components/Chart/ChartContainer.cjs.map +1 -0
  12. package/dist/cjs/components/Chart/ChartLegend.cjs +69 -0
  13. package/dist/cjs/components/Chart/ChartLegend.cjs.map +1 -0
  14. package/dist/cjs/components/Chart/ChartLoadingOverlay.cjs +35 -0
  15. package/dist/cjs/components/Chart/ChartLoadingOverlay.cjs.map +1 -0
  16. package/dist/cjs/components/Chart/ChartPieLegend.cjs +54 -0
  17. package/dist/cjs/components/Chart/ChartPieLegend.cjs.map +1 -0
  18. package/dist/cjs/components/Chart/ChartSeriesToggle.cjs +65 -0
  19. package/dist/cjs/components/Chart/ChartSeriesToggle.cjs.map +1 -0
  20. package/dist/cjs/components/Chart/ChartStyle.cjs +40 -0
  21. package/dist/cjs/components/Chart/ChartStyle.cjs.map +1 -0
  22. package/dist/cjs/components/Chart/ChartTooltip.cjs +147 -0
  23. package/dist/cjs/components/Chart/ChartTooltip.cjs.map +1 -0
  24. package/dist/cjs/components/Chart/chartUtils.cjs +23 -0
  25. package/dist/cjs/components/Chart/chartUtils.cjs.map +1 -0
  26. package/dist/cjs/components/Chart/useChart.cjs +32 -0
  27. package/dist/cjs/components/Chart/useChart.cjs.map +1 -0
  28. package/dist/cjs/components/TextField/TextField.cjs +0 -4
  29. package/dist/cjs/components/TextField/TextField.cjs.map +1 -1
  30. package/dist/components/Chart/ChartCard.mjs +71 -0
  31. package/dist/components/Chart/ChartCard.mjs.map +1 -0
  32. package/dist/components/Chart/ChartCenterLabel.mjs +34 -0
  33. package/dist/components/Chart/ChartCenterLabel.mjs.map +1 -0
  34. package/dist/components/Chart/ChartContainer.mjs +47 -0
  35. package/dist/components/Chart/ChartContainer.mjs.map +1 -0
  36. package/dist/components/Chart/ChartLegend.mjs +52 -0
  37. package/dist/components/Chart/ChartLegend.mjs.map +1 -0
  38. package/dist/components/Chart/ChartLoadingOverlay.mjs +18 -0
  39. package/dist/components/Chart/ChartLoadingOverlay.mjs.map +1 -0
  40. package/dist/components/Chart/ChartPieLegend.mjs +37 -0
  41. package/dist/components/Chart/ChartPieLegend.mjs.map +1 -0
  42. package/dist/components/Chart/ChartSeriesToggle.mjs +48 -0
  43. package/dist/components/Chart/ChartSeriesToggle.mjs.map +1 -0
  44. package/dist/components/Chart/ChartStyle.mjs +23 -0
  45. package/dist/components/Chart/ChartStyle.mjs.map +1 -0
  46. package/dist/components/Chart/ChartTooltip.mjs +130 -0
  47. package/dist/components/Chart/ChartTooltip.mjs.map +1 -0
  48. package/dist/components/Chart/chartUtils.mjs +23 -0
  49. package/dist/components/Chart/chartUtils.mjs.map +1 -0
  50. package/dist/components/Chart/useChart.mjs +15 -0
  51. package/dist/components/Chart/useChart.mjs.map +1 -0
  52. package/dist/components/TextField/TextField.mjs +0 -4
  53. package/dist/components/TextField/TextField.mjs.map +1 -1
  54. package/package.json +18 -2
@@ -0,0 +1,372 @@
1
+ import { Legend } from 'recharts';
2
+ import { LegendPayload } from 'recharts/types/component/DefaultLegendContent';
3
+ import { NameType } from 'recharts/types/component/DefaultTooltipContent';
4
+ import { Payload } from 'recharts/types/component/DefaultTooltipContent';
5
+ import * as React_2 from 'react';
6
+ import { ResponsiveContainer } from 'recharts';
7
+ import { Tooltip } from 'recharts';
8
+ import { ValueType } from 'recharts/types/component/DefaultTooltipContent';
9
+
10
+ /**
11
+ * Wraps any chart with a structured header containing title, subtitle,
12
+ * optional trend chip, date range label, info tooltip, and a loading
13
+ * skeleton state.
14
+ *
15
+ * @example
16
+ * ```tsx
17
+ * <ChartCard
18
+ * title="Revenue"
19
+ * subtitle="$4,523"
20
+ * trendChip={{ label: "+12.5%", trend: "positive" }}
21
+ * dateInfo="Jan 1 – Mar 17"
22
+ * tooltip="Total revenue for the selected period."
23
+ * >
24
+ * <MyLineChart />
25
+ * </ChartCard>
26
+ * ```
27
+ */
28
+ export declare const ChartCard: React_2.ForwardRefExoticComponent<ChartCardProps & React_2.RefAttributes<HTMLDivElement>>;
29
+
30
+ /** Props for {@link ChartCard}. */
31
+ export declare interface ChartCardProps extends Omit<React_2.HTMLAttributes<HTMLDivElement>, "title"> {
32
+ /** Card title text. Pass translated string for i18n. */
33
+ title: React_2.ReactNode;
34
+ /** Large subtitle value (e.g. formatted price or count). */
35
+ subtitle?: React_2.ReactNode;
36
+ /** Tooltip text shown next to the title. Pass translated string for i18n. */
37
+ tooltip?: React_2.ReactNode;
38
+ /** Accessible label for the info tooltip trigger. Override for i18n. @default "More info" */
39
+ tooltipAriaLabel?: string;
40
+ /** Date range or period label shown below the subtitle. */
41
+ dateInfo?: React_2.ReactNode;
42
+ /** Trend indicator chip config. */
43
+ trendChip?: {
44
+ /** Display label (e.g. "12.5%"). */
45
+ label: React_2.ReactNode;
46
+ /** Whether the trend is positive (green) or negative (red). */
47
+ trend: "positive" | "negative";
48
+ };
49
+ /** Show loading skeleton instead of content. @default false */
50
+ loading?: boolean;
51
+ /** Chart content rendered below the header. */
52
+ children?: React_2.ReactNode;
53
+ }
54
+
55
+ /**
56
+ * Centered label for radial/pie charts, rendered inside a Recharts `<Label>`.
57
+ *
58
+ * @example
59
+ * ```tsx
60
+ * <PolarRadiusAxis tick={false} tickLine={false} axisLine={false}>
61
+ * <Label content={({ viewBox }) => (
62
+ * <ChartCenterLabel viewBox={viewBox} value="78%" subtitle="Complete" />
63
+ * )} />
64
+ * </PolarRadiusAxis>
65
+ * ```
66
+ */
67
+ export declare const ChartCenterLabel: React_2.ForwardRefExoticComponent<ChartCenterLabelProps & React_2.RefAttributes<SVGTextElement>>;
68
+
69
+ /** Props for {@link ChartCenterLabel}. */
70
+ export declare interface ChartCenterLabelProps extends Omit<React_2.SVGAttributes<SVGTextElement>, "viewBox"> {
71
+ /** Recharts viewBox with center coordinates. */
72
+ viewBox?: {
73
+ cx?: number;
74
+ cy?: number;
75
+ [key: string]: unknown;
76
+ };
77
+ /** Primary value displayed in the center. */
78
+ value: React_2.ReactNode;
79
+ /** Secondary text below the value. */
80
+ subtitle: React_2.ReactNode;
81
+ /** Custom className for the value tspan. @default "fill-foreground-default font-bold text-3xl" */
82
+ valueClassName?: string;
83
+ }
84
+
85
+ /**
86
+ * Maps data keys to their display configuration (label, color, icon).
87
+ *
88
+ * @example
89
+ * ```ts
90
+ * const config: ChartConfig = {
91
+ * revenue: {
92
+ * label: t("chart.revenue"),
93
+ * color: "var(--color-special-chart-teal)",
94
+ * },
95
+ * subscribers: {
96
+ * label: t("chart.subscribers"),
97
+ * theme: { light: "#2563eb", dark: "#60a5fa" },
98
+ * },
99
+ * };
100
+ * ```
101
+ */
102
+ export declare type ChartConfig = Record<string, ChartConfigEntry>;
103
+
104
+ /**
105
+ * Configuration for a single data series in a chart.
106
+ *
107
+ * Each key in a {@link ChartConfig} record maps to a data key used by Recharts.
108
+ * Provide a human-readable `label` (supports i18n — pass translated strings)
109
+ * and either a single `color` or a `theme` map for light/dark mode.
110
+ */
111
+ export declare type ChartConfigEntry = {
112
+ /** Human-readable label for this series. Pass a translated string for i18n. */
113
+ label?: React_2.ReactNode;
114
+ /** Optional icon component rendered in tooltips and legends. */
115
+ icon?: React_2.ComponentType;
116
+ /** Single color for all themes. */
117
+ color?: string;
118
+ /** Per-theme color overrides. Takes precedence over `color` when present. */
119
+ theme?: Record<ChartThemeKey, string>;
120
+ };
121
+
122
+ /**
123
+ * Wraps a Recharts chart with responsive sizing, design-token theming, and
124
+ * accessible config context for tooltips and legends.
125
+ *
126
+ * @example
127
+ * ```tsx
128
+ * <ChartContainer config={chartConfig} className="min-h-48">
129
+ * <LineChart data={data} accessibilityLayer>
130
+ * <Line dataKey="revenue" stroke="var(--color-revenue)" />
131
+ * </LineChart>
132
+ * </ChartContainer>
133
+ * ```
134
+ */
135
+ export declare const ChartContainer: React_2.ForwardRefExoticComponent<ChartContainerProps & React_2.RefAttributes<HTMLDivElement>>;
136
+
137
+ /** Props for {@link ChartContainer}. */
138
+ export declare interface ChartContainerProps extends React_2.HTMLAttributes<HTMLDivElement> {
139
+ /** Series configuration mapping data keys to labels, colors, and icons. */
140
+ config: ChartConfig;
141
+ /**
142
+ * Recharts chart element(s) to render inside the responsive container.
143
+ * Typically a single `<AreaChart>`, `<BarChart>`, `<LineChart>`, etc.
144
+ */
145
+ children: React_2.ComponentProps<typeof ResponsiveContainer>["children"];
146
+ }
147
+
148
+ declare type ChartContextValue = {
149
+ config: ChartConfig;
150
+ };
151
+
152
+ /** Re-export of Recharts `Legend` — use with `content={<ChartLegendContent />}`. */
153
+ export declare const ChartLegend: typeof Legend;
154
+
155
+ /**
156
+ * Styled legend content for use with `<ChartLegend content={<ChartLegendContent />} />`.
157
+ *
158
+ * Reads chart config from context to resolve labels and icons.
159
+ *
160
+ * @example
161
+ * ```tsx
162
+ * <ChartLegend content={<ChartLegendContent />} />
163
+ * ```
164
+ */
165
+ export declare const ChartLegendContent: React_2.ForwardRefExoticComponent<ChartLegendContentProps & React_2.RefAttributes<HTMLDivElement>>;
166
+
167
+ /** Props for {@link ChartLegendContent}. */
168
+ export declare interface ChartLegendContentProps extends React_2.HTMLAttributes<HTMLDivElement> {
169
+ /** Legend payload data. Passed by Recharts. */
170
+ payload?: readonly LegendPayload[];
171
+ /** Vertical alignment — controls padding direction. @default "bottom" */
172
+ verticalAlign?: "top" | "bottom";
173
+ /** Hide the color/icon indicator. @default false */
174
+ hideIcon?: boolean;
175
+ /** Data key used to resolve the display name from config. */
176
+ nameKey?: string;
177
+ }
178
+
179
+ /**
180
+ * A positioned overlay that displays a loading spinner on top of chart content.
181
+ * The children are always rendered to maintain layout dimensions; the overlay
182
+ * covers them with a semi-transparent background and a centered spinner.
183
+ *
184
+ * @example
185
+ * ```tsx
186
+ * <ChartLoadingOverlay loading={isFetching}>
187
+ * <ChartContainer config={config} className="min-h-48">
188
+ * <LineChart data={data}>...</LineChart>
189
+ * </ChartContainer>
190
+ * </ChartLoadingOverlay>
191
+ * ```
192
+ */
193
+ export declare const ChartLoadingOverlay: React_2.ForwardRefExoticComponent<ChartLoadingOverlayProps & React_2.RefAttributes<HTMLDivElement>>;
194
+
195
+ /** Props for {@link ChartLoadingOverlay}. */
196
+ export declare interface ChartLoadingOverlayProps extends React_2.HTMLAttributes<HTMLDivElement> {
197
+ /** Whether to show the loading overlay. @default false */
198
+ loading?: boolean;
199
+ /** Chart content to render underneath the overlay. */
200
+ children: React_2.ReactNode;
201
+ }
202
+
203
+ /**
204
+ * A side legend for pie/donut charts that shows each slice's label,
205
+ * formatted value, and a proportional progress bar.
206
+ *
207
+ * @example
208
+ * ```tsx
209
+ * <ChartPieLegend
210
+ * items={[
211
+ * { label: "Subscriptions", value: 4500, formattedValue: "$4,500", color: "var(--color-special-chart-teal)" },
212
+ * { label: "Messages", value: 2100, formattedValue: "$2,100", color: "var(--color-special-chart-sky)" },
213
+ * { label: "Tips", value: 1200, formattedValue: "$1,200", color: "var(--color-special-chart-orange)" },
214
+ * ]}
215
+ * />
216
+ * ```
217
+ */
218
+ export declare const ChartPieLegend: React_2.ForwardRefExoticComponent<ChartPieLegendProps & React_2.RefAttributes<HTMLDivElement>>;
219
+
220
+ /** A single item in a {@link ChartPieLegend}. */
221
+ export declare interface ChartPieLegendItem {
222
+ /** Display label. Pass translated string for i18n. */
223
+ label: React_2.ReactNode;
224
+ /** Numeric value for this slice. Used to calculate the proportional bar width. */
225
+ value: number;
226
+ /** Formatted display value (e.g. "$4,500"). If omitted, `value.toLocaleString()` is used. */
227
+ formattedValue?: React_2.ReactNode;
228
+ /** Slice color (CSS value). */
229
+ color: string;
230
+ /** Optional icon to show instead of the color dot. */
231
+ icon?: React_2.ReactNode;
232
+ }
233
+
234
+ /** Props for {@link ChartPieLegend}. */
235
+ export declare interface ChartPieLegendProps extends React_2.HTMLAttributes<HTMLDivElement> {
236
+ /** Legend items to display. */
237
+ items: ChartPieLegendItem[];
238
+ }
239
+
240
+ /**
241
+ * Renders a grid of toggleable chips that control which series are visible
242
+ * on a multi-series chart. Each toggle shows a color indicator dot and a label.
243
+ *
244
+ * @example
245
+ * ```tsx
246
+ * const [visible, setVisible] = useState(new Set(["subscription", "message", "tip"]));
247
+ *
248
+ * <ChartSeriesToggle
249
+ * items={[
250
+ * { key: "subscription", label: "Subscription", color: "var(--color-special-chart-teal)" },
251
+ * { key: "message", label: "Message", color: "var(--color-special-chart-sky)" },
252
+ * { key: "tip", label: "Tip", color: "var(--color-special-chart-orange)" },
253
+ * ]}
254
+ * value={visible}
255
+ * onValueChange={setVisible}
256
+ * />
257
+ * ```
258
+ */
259
+ export declare const ChartSeriesToggle: React_2.ForwardRefExoticComponent<ChartSeriesToggleProps & React_2.RefAttributes<HTMLDivElement>>;
260
+
261
+ /** A single toggleable series in a {@link ChartSeriesToggle}. */
262
+ export declare interface ChartSeriesToggleItem {
263
+ /** Unique key matching the data series key and ChartConfig key. */
264
+ key: string;
265
+ /** Human-readable label. Pass translated string for i18n. */
266
+ label: React_2.ReactNode;
267
+ /** Series color (CSS value). Shown as indicator dot. */
268
+ color: string;
269
+ }
270
+
271
+ /** Props for {@link ChartSeriesToggle}. */
272
+ export declare interface ChartSeriesToggleProps extends React_2.HTMLAttributes<HTMLDivElement> {
273
+ /** Available series that can be toggled. */
274
+ items: ChartSeriesToggleItem[];
275
+ /** Set of currently visible series keys. */
276
+ value: Set<string>;
277
+ /** Called when a series is toggled. Receives the updated Set. */
278
+ onValueChange: (value: Set<string>) => void;
279
+ }
280
+
281
+ /**
282
+ * Injects a scoped `<style>` tag that maps each config entry to a
283
+ * `--color-{key}` CSS custom property, with light/dark theme support.
284
+ *
285
+ * Rendered automatically by {@link ChartContainer} — you rarely need this directly.
286
+ */
287
+ export declare const ChartStyle: React_2.NamedExoticComponent<ChartStyleProps>;
288
+
289
+ /** Props for the scoped CSS variable injector used by {@link ChartContainer}. */
290
+ export declare interface ChartStyleProps {
291
+ /** Unique identifier scoped to the chart instance. */
292
+ id: string;
293
+ /** Chart configuration mapping data keys to colors and themes. */
294
+ config: ChartConfig;
295
+ }
296
+
297
+ /** Light/dark theme key for chart color resolution. */
298
+ export declare type ChartThemeKey = "light" | "dark";
299
+
300
+ /** Re-export of Recharts `Tooltip` — use with `content={<ChartTooltipContent />}`. */
301
+ export declare const ChartTooltip: typeof Tooltip;
302
+
303
+ /**
304
+ * Styled tooltip content for use with `<ChartTooltip content={<ChartTooltipContent />} />`.
305
+ *
306
+ * Reads chart config from context to resolve labels, colors, and icons.
307
+ * Supports dot/line/dashed indicators. Pass translated `label`s in config for i18n.
308
+ *
309
+ * @example
310
+ * ```tsx
311
+ * <ChartTooltip
312
+ * content={<ChartTooltipContent indicator="line" />}
313
+ * />
314
+ * ```
315
+ */
316
+ export declare const ChartTooltipContent: React_2.ForwardRefExoticComponent<ChartTooltipContentProps & React_2.RefAttributes<HTMLDivElement>>;
317
+
318
+ /** Props for {@link ChartTooltipContent}. */
319
+ export declare interface ChartTooltipContentProps extends React_2.HTMLAttributes<HTMLDivElement> {
320
+ /** Whether the tooltip is currently active/visible. Passed by Recharts. */
321
+ active?: boolean;
322
+ /** Tooltip payload data. Passed by Recharts. */
323
+ payload?: Payload<ValueType, NameType>[];
324
+ /** Axis label. Passed by Recharts. */
325
+ label?: string | number;
326
+ /** Custom label formatter. */
327
+ labelFormatter?: (label: string | number, payload: Payload<ValueType, NameType>[]) => React_2.ReactNode;
328
+ /** Custom value formatter. */
329
+ formatter?: (value: ValueType, name: NameType, item: Payload<ValueType, NameType>, index: number, payload: Payload<ValueType, NameType>[]) => React_2.ReactNode;
330
+ /** CSS class for the label element. */
331
+ labelClassName?: string;
332
+ /** Hide the tooltip header label. @default false */
333
+ hideLabel?: boolean;
334
+ /** Hide the color indicator beside each row. @default false */
335
+ hideIndicator?: boolean;
336
+ /** Visual style of the color indicator. @default "dot" */
337
+ indicator?: ChartTooltipIndicator;
338
+ /**
339
+ * Data key used to resolve the display name from config.
340
+ * Useful when the payload `name` differs from the config key.
341
+ */
342
+ nameKey?: string;
343
+ /**
344
+ * Data key used to resolve the header label from config.
345
+ * Falls back to the first payload item's `dataKey`.
346
+ */
347
+ labelKey?: string;
348
+ /** Override indicator color for all rows. */
349
+ color?: string;
350
+ }
351
+
352
+ /** Indicator shape rendered beside each tooltip row. */
353
+ export declare type ChartTooltipIndicator = "dot" | "line" | "dashed";
354
+
355
+ /**
356
+ * Resolves the {@link ChartConfig} entry for a given tooltip/legend payload
357
+ * item. Recharts wraps the original data point inside `payload.payload` —
358
+ * this function checks both levels before falling back to a direct `key` lookup.
359
+ */
360
+ export declare function resolveConfigEntry(config: ChartConfig, payload: unknown, key: string): ChartConfigEntry | undefined;
361
+
362
+ /** Access the nearest {@link ChartContainer}'s config. Throws if used outside a chart. */
363
+ export declare function useChart(): ChartContextValue;
364
+
365
+ export { }
366
+
367
+
368
+ declare module "vitest" {
369
+ interface Assertion<T> {
370
+ toHaveNoViolations(): T;
371
+ }
372
+ }
@@ -0,0 +1,28 @@
1
+ "use client";
2
+ import { ChartCard } from "./components/Chart/ChartCard.mjs";
3
+ import { ChartCenterLabel } from "./components/Chart/ChartCenterLabel.mjs";
4
+ import { ChartContainer } from "./components/Chart/ChartContainer.mjs";
5
+ import { ChartLegend, ChartLegendContent } from "./components/Chart/ChartLegend.mjs";
6
+ import { ChartLoadingOverlay } from "./components/Chart/ChartLoadingOverlay.mjs";
7
+ import { ChartPieLegend } from "./components/Chart/ChartPieLegend.mjs";
8
+ import { ChartSeriesToggle } from "./components/Chart/ChartSeriesToggle.mjs";
9
+ import { ChartStyle } from "./components/Chart/ChartStyle.mjs";
10
+ import { ChartTooltip, ChartTooltipContent } from "./components/Chart/ChartTooltip.mjs";
11
+ import { resolveConfigEntry } from "./components/Chart/chartUtils.mjs";
12
+ import { useChart } from "./components/Chart/useChart.mjs";
13
+ export {
14
+ ChartCard,
15
+ ChartCenterLabel,
16
+ ChartContainer,
17
+ ChartLegend,
18
+ ChartLegendContent,
19
+ ChartLoadingOverlay,
20
+ ChartPieLegend,
21
+ ChartSeriesToggle,
22
+ ChartStyle,
23
+ ChartTooltip,
24
+ ChartTooltipContent,
25
+ resolveConfigEntry,
26
+ useChart
27
+ };
28
+ //# sourceMappingURL=charts.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"charts.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;"}
@@ -0,0 +1,28 @@
1
+ "use client";
2
+ "use strict";
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
4
+ const ChartCard = require("./components/Chart/ChartCard.cjs");
5
+ const ChartCenterLabel = require("./components/Chart/ChartCenterLabel.cjs");
6
+ const ChartContainer = require("./components/Chart/ChartContainer.cjs");
7
+ const ChartLegend = require("./components/Chart/ChartLegend.cjs");
8
+ const ChartLoadingOverlay = require("./components/Chart/ChartLoadingOverlay.cjs");
9
+ const ChartPieLegend = require("./components/Chart/ChartPieLegend.cjs");
10
+ const ChartSeriesToggle = require("./components/Chart/ChartSeriesToggle.cjs");
11
+ const ChartStyle = require("./components/Chart/ChartStyle.cjs");
12
+ const ChartTooltip = require("./components/Chart/ChartTooltip.cjs");
13
+ const chartUtils = require("./components/Chart/chartUtils.cjs");
14
+ const useChart = require("./components/Chart/useChart.cjs");
15
+ exports.ChartCard = ChartCard.ChartCard;
16
+ exports.ChartCenterLabel = ChartCenterLabel.ChartCenterLabel;
17
+ exports.ChartContainer = ChartContainer.ChartContainer;
18
+ exports.ChartLegend = ChartLegend.ChartLegend;
19
+ exports.ChartLegendContent = ChartLegend.ChartLegendContent;
20
+ exports.ChartLoadingOverlay = ChartLoadingOverlay.ChartLoadingOverlay;
21
+ exports.ChartPieLegend = ChartPieLegend.ChartPieLegend;
22
+ exports.ChartSeriesToggle = ChartSeriesToggle.ChartSeriesToggle;
23
+ exports.ChartStyle = ChartStyle.ChartStyle;
24
+ exports.ChartTooltip = ChartTooltip.ChartTooltip;
25
+ exports.ChartTooltipContent = ChartTooltip.ChartTooltipContent;
26
+ exports.resolveConfigEntry = chartUtils.resolveConfigEntry;
27
+ exports.useChart = useChart.useChart;
28
+ //# sourceMappingURL=charts.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"charts.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,88 @@
1
+ "use client";
2
+ "use strict";
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
4
+ const jsxRuntime = require("react/jsx-runtime");
5
+ const React = require("react");
6
+ const cn = require("../../utils/cn.cjs");
7
+ const Card = require("../Card/Card.cjs");
8
+ const IconButton = require("../IconButton/IconButton.cjs");
9
+ const InfoCircleIcon = require("../Icons/InfoCircleIcon.cjs");
10
+ const Skeleton = require("../Skeleton/Skeleton.cjs");
11
+ const Tooltip = require("../Tooltip/Tooltip.cjs");
12
+ function _interopNamespaceDefault(e) {
13
+ const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
14
+ if (e) {
15
+ for (const k in e) {
16
+ if (k !== "default") {
17
+ const d = Object.getOwnPropertyDescriptor(e, k);
18
+ Object.defineProperty(n, k, d.get ? d : {
19
+ enumerable: true,
20
+ get: () => e[k]
21
+ });
22
+ }
23
+ }
24
+ }
25
+ n.default = e;
26
+ return Object.freeze(n);
27
+ }
28
+ const React__namespace = /* @__PURE__ */ _interopNamespaceDefault(React);
29
+ const TREND_CLASSES = {
30
+ positive: "bg-success-background text-success-default",
31
+ negative: "bg-error-background text-error-default"
32
+ };
33
+ const ChartCard = React__namespace.forwardRef(
34
+ ({
35
+ className,
36
+ title,
37
+ subtitle,
38
+ tooltip,
39
+ tooltipAriaLabel = "More info",
40
+ dateInfo,
41
+ trendChip,
42
+ loading = false,
43
+ children,
44
+ ...props
45
+ }, ref) => {
46
+ return /* @__PURE__ */ jsxRuntime.jsx(Card.Card, { ref, variant: "outlined", noPadding: true, className, ...props, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-2 p-4", children: [
47
+ loading ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
48
+ /* @__PURE__ */ jsxRuntime.jsx(Skeleton.Skeleton, { animation: "wave", variant: "rounded", className: "h-4 w-32" }),
49
+ /* @__PURE__ */ jsxRuntime.jsx(Skeleton.Skeleton, { animation: "wave", variant: "rounded", className: "h-7 w-44" }),
50
+ /* @__PURE__ */ jsxRuntime.jsx(Skeleton.Skeleton, { animation: "wave", variant: "rounded", className: "h-3 w-24" })
51
+ ] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
52
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1.5", children: [
53
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "typography-semibold-body-md text-foreground-default", children: title }),
54
+ tooltip && /* @__PURE__ */ jsxRuntime.jsx(Tooltip.TooltipProvider, { children: /* @__PURE__ */ jsxRuntime.jsxs(Tooltip.Tooltip, { children: [
55
+ /* @__PURE__ */ jsxRuntime.jsx(Tooltip.TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
56
+ IconButton.IconButton,
57
+ {
58
+ variant: "tertiary",
59
+ size: "24",
60
+ "aria-label": tooltipAriaLabel,
61
+ icon: /* @__PURE__ */ jsxRuntime.jsx(InfoCircleIcon.InfoCircleIcon, { className: "size-4 text-foreground-tertiary" })
62
+ }
63
+ ) }),
64
+ /* @__PURE__ */ jsxRuntime.jsx(Tooltip.TooltipContent, { children: tooltip })
65
+ ] }) })
66
+ ] }),
67
+ subtitle && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
68
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "typography-bold-heading-sm text-foreground-default", children: subtitle }),
69
+ trendChip && /* @__PURE__ */ jsxRuntime.jsx(
70
+ "span",
71
+ {
72
+ className: cn.cn(
73
+ "typography-semibold-body-sm rounded-full px-2 py-0.5",
74
+ TREND_CLASSES[trendChip.trend]
75
+ ),
76
+ children: trendChip.label
77
+ }
78
+ )
79
+ ] }),
80
+ dateInfo && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "typography-regular-body-sm text-foreground-tertiary", children: dateInfo })
81
+ ] }),
82
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-auto", children })
83
+ ] }) });
84
+ }
85
+ );
86
+ ChartCard.displayName = "ChartCard";
87
+ exports.ChartCard = ChartCard;
88
+ //# sourceMappingURL=ChartCard.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ChartCard.cjs","sources":["../../../../src/components/Chart/ChartCard.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { cn } from \"../../utils/cn\";\nimport { Card } from \"../Card/Card\";\nimport { IconButton } from \"../IconButton/IconButton\";\nimport { InfoCircleIcon } from \"../Icons/InfoCircleIcon\";\nimport { Skeleton } from \"../Skeleton/Skeleton\";\nimport { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from \"../Tooltip/Tooltip\";\n\n/** Props for {@link ChartCard}. */\nexport interface ChartCardProps extends Omit<React.HTMLAttributes<HTMLDivElement>, \"title\"> {\n /** Card title text. Pass translated string for i18n. */\n title: React.ReactNode;\n /** Large subtitle value (e.g. formatted price or count). */\n subtitle?: React.ReactNode;\n /** Tooltip text shown next to the title. Pass translated string for i18n. */\n tooltip?: React.ReactNode;\n /** Accessible label for the info tooltip trigger. Override for i18n. @default \"More info\" */\n tooltipAriaLabel?: string;\n /** Date range or period label shown below the subtitle. */\n dateInfo?: React.ReactNode;\n /** Trend indicator chip config. */\n trendChip?: {\n /** Display label (e.g. \"12.5%\"). */\n label: React.ReactNode;\n /** Whether the trend is positive (green) or negative (red). */\n trend: \"positive\" | \"negative\";\n };\n /** Show loading skeleton instead of content. @default false */\n loading?: boolean;\n /** Chart content rendered below the header. */\n children?: React.ReactNode;\n}\n\nconst TREND_CLASSES: Record<\"positive\" | \"negative\", string> = {\n positive: \"bg-success-background text-success-default\",\n negative: \"bg-error-background text-error-default\",\n};\n\n/**\n * Wraps any chart with a structured header containing title, subtitle,\n * optional trend chip, date range label, info tooltip, and a loading\n * skeleton state.\n *\n * @example\n * ```tsx\n * <ChartCard\n * title=\"Revenue\"\n * subtitle=\"$4,523\"\n * trendChip={{ label: \"+12.5%\", trend: \"positive\" }}\n * dateInfo=\"Jan 1 – Mar 17\"\n * tooltip=\"Total revenue for the selected period.\"\n * >\n * <MyLineChart />\n * </ChartCard>\n * ```\n */\nexport const ChartCard = React.forwardRef<HTMLDivElement, ChartCardProps>(\n (\n {\n className,\n title,\n subtitle,\n tooltip,\n tooltipAriaLabel = \"More info\",\n dateInfo,\n trendChip,\n loading = false,\n children,\n ...props\n },\n ref,\n ) => {\n return (\n <Card ref={ref} variant=\"outlined\" noPadding className={className} {...props}>\n <div className=\"flex flex-col gap-2 p-4\">\n {loading ? (\n <>\n <Skeleton animation=\"wave\" variant=\"rounded\" className=\"h-4 w-32\" />\n <Skeleton animation=\"wave\" variant=\"rounded\" className=\"h-7 w-44\" />\n <Skeleton animation=\"wave\" variant=\"rounded\" className=\"h-3 w-24\" />\n </>\n ) : (\n <>\n <div className=\"flex items-center gap-1.5\">\n <span className=\"typography-semibold-body-md text-foreground-default\">{title}</span>\n {tooltip && (\n <TooltipProvider>\n <Tooltip>\n <TooltipTrigger asChild>\n <IconButton\n variant=\"tertiary\"\n size=\"24\"\n aria-label={tooltipAriaLabel}\n icon={<InfoCircleIcon className=\"size-4 text-foreground-tertiary\" />}\n />\n </TooltipTrigger>\n <TooltipContent>{tooltip}</TooltipContent>\n </Tooltip>\n </TooltipProvider>\n )}\n </div>\n {subtitle && (\n <div className=\"flex items-center gap-2\">\n <span className=\"typography-bold-heading-sm text-foreground-default\">\n {subtitle}\n </span>\n {trendChip && (\n <span\n className={cn(\n \"typography-semibold-body-sm rounded-full px-2 py-0.5\",\n TREND_CLASSES[trendChip.trend],\n )}\n >\n {trendChip.label}\n </span>\n )}\n </div>\n )}\n {dateInfo && (\n <span className=\"typography-regular-body-sm text-foreground-tertiary\">\n {dateInfo}\n </span>\n )}\n </>\n )}\n <div className=\"mt-auto\">{children}</div>\n </div>\n </Card>\n );\n },\n);\nChartCard.displayName = \"ChartCard\";\n"],"names":["React","jsx","Card","jsxs","Fragment","Skeleton","TooltipProvider","Tooltip","TooltipTrigger","IconButton","InfoCircleIcon","TooltipContent","cn"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCA,MAAM,gBAAyD;AAAA,EAC7D,UAAU;AAAA,EACV,UAAU;AACZ;AAoBO,MAAM,YAAYA,iBAAM;AAAA,EAC7B,CACE;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,mBAAmB;AAAA,IACnB;AAAA,IACA;AAAA,IACA,UAAU;AAAA,IACV;AAAA,IACA,GAAG;AAAA,EAAA,GAEL,QACG;AACH,WACEC,2BAAAA,IAACC,KAAAA,MAAA,EAAK,KAAU,SAAQ,YAAW,WAAS,MAAC,WAAuB,GAAG,OACrE,UAAAC,2BAAAA,KAAC,OAAA,EAAI,WAAU,2BACZ,UAAA;AAAA,MAAA,UACCA,2BAAAA,KAAAC,qBAAA,EACE,UAAA;AAAA,QAAAH,+BAACI,SAAAA,YAAS,WAAU,QAAO,SAAQ,WAAU,WAAU,YAAW;AAAA,uCACjEA,SAAAA,UAAA,EAAS,WAAU,QAAO,SAAQ,WAAU,WAAU,YAAW;AAAA,uCACjEA,SAAAA,UAAA,EAAS,WAAU,QAAO,SAAQ,WAAU,WAAU,WAAA,CAAW;AAAA,MAAA,EAAA,CACpE,IAEAF,2BAAAA,KAAAC,WAAAA,UAAA,EACE,UAAA;AAAA,QAAAD,2BAAAA,KAAC,OAAA,EAAI,WAAU,6BACb,UAAA;AAAA,UAAAF,2BAAAA,IAAC,QAAA,EAAK,WAAU,uDAAuD,UAAA,OAAM;AAAA,UAC5E,WACCA,2BAAAA,IAACK,yBAAA,EACC,UAAAH,gCAACI,QAAAA,SAAA,EACC,UAAA;AAAA,YAAAN,2BAAAA,IAACO,QAAAA,gBAAA,EAAe,SAAO,MACrB,UAAAP,2BAAAA;AAAAA,cAACQ,WAAAA;AAAAA,cAAA;AAAA,gBACC,SAAQ;AAAA,gBACR,MAAK;AAAA,gBACL,cAAY;AAAA,gBACZ,MAAMR,2BAAAA,IAACS,eAAAA,gBAAA,EAAe,WAAU,kCAAA,CAAkC;AAAA,cAAA;AAAA,YAAA,GAEtE;AAAA,YACAT,2BAAAA,IAACU,QAAAA,kBAAgB,UAAA,QAAA,CAAQ;AAAA,UAAA,EAAA,CAC3B,EAAA,CACF;AAAA,QAAA,GAEJ;AAAA,QACC,YACCR,2BAAAA,KAAC,OAAA,EAAI,WAAU,2BACb,UAAA;AAAA,UAAAF,2BAAAA,IAAC,QAAA,EAAK,WAAU,sDACb,UAAA,UACH;AAAA,UACC,aACCA,2BAAAA;AAAAA,YAAC;AAAA,YAAA;AAAA,cACC,WAAWW,GAAAA;AAAAA,gBACT;AAAA,gBACA,cAAc,UAAU,KAAK;AAAA,cAAA;AAAA,cAG9B,UAAA,UAAU;AAAA,YAAA;AAAA,UAAA;AAAA,QACb,GAEJ;AAAA,QAED,YACCX,2BAAAA,IAAC,QAAA,EAAK,WAAU,uDACb,UAAA,SAAA,CACH;AAAA,MAAA,GAEJ;AAAA,MAEFA,2BAAAA,IAAC,OAAA,EAAI,WAAU,WAAW,SAAA,CAAS;AAAA,IAAA,EAAA,CACrC,EAAA,CACF;AAAA,EAEJ;AACF;AACA,UAAU,cAAc;;"}
@@ -0,0 +1,51 @@
1
+ "use client";
2
+ "use strict";
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
4
+ const jsxRuntime = require("react/jsx-runtime");
5
+ const React = require("react");
6
+ function _interopNamespaceDefault(e) {
7
+ const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
8
+ if (e) {
9
+ for (const k in e) {
10
+ if (k !== "default") {
11
+ const d = Object.getOwnPropertyDescriptor(e, k);
12
+ Object.defineProperty(n, k, d.get ? d : {
13
+ enumerable: true,
14
+ get: () => e[k]
15
+ });
16
+ }
17
+ }
18
+ }
19
+ n.default = e;
20
+ return Object.freeze(n);
21
+ }
22
+ const React__namespace = /* @__PURE__ */ _interopNamespaceDefault(React);
23
+ const ChartCenterLabel = React__namespace.forwardRef(
24
+ ({
25
+ viewBox,
26
+ value,
27
+ subtitle,
28
+ valueClassName = "fill-foreground-default font-bold text-3xl",
29
+ ...props
30
+ }, ref) => {
31
+ if (!viewBox || !("cx" in viewBox) || !("cy" in viewBox)) return null;
32
+ return /* @__PURE__ */ jsxRuntime.jsxs(
33
+ "text",
34
+ {
35
+ ref,
36
+ x: viewBox.cx,
37
+ y: viewBox.cy,
38
+ textAnchor: "middle",
39
+ dominantBaseline: "middle",
40
+ ...props,
41
+ children: [
42
+ /* @__PURE__ */ jsxRuntime.jsx("tspan", { x: viewBox.cx, y: viewBox.cy, className: valueClassName, children: value }),
43
+ /* @__PURE__ */ jsxRuntime.jsx("tspan", { x: viewBox.cx, y: (viewBox.cy || 0) + 24, className: "fill-foreground-tertiary", children: subtitle })
44
+ ]
45
+ }
46
+ );
47
+ }
48
+ );
49
+ ChartCenterLabel.displayName = "ChartCenterLabel";
50
+ exports.ChartCenterLabel = ChartCenterLabel;
51
+ //# sourceMappingURL=ChartCenterLabel.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ChartCenterLabel.cjs","sources":["../../../../src/components/Chart/ChartCenterLabel.tsx"],"sourcesContent":["import * as React from \"react\";\n\n/** Props for {@link ChartCenterLabel}. */\nexport interface ChartCenterLabelProps\n extends Omit<React.SVGAttributes<SVGTextElement>, \"viewBox\"> {\n /** Recharts viewBox with center coordinates. */\n viewBox?: { cx?: number; cy?: number; [key: string]: unknown };\n /** Primary value displayed in the center. */\n value: React.ReactNode;\n /** Secondary text below the value. */\n subtitle: React.ReactNode;\n /** Custom className for the value tspan. @default \"fill-foreground-default font-bold text-3xl\" */\n valueClassName?: string;\n}\n\n/**\n * Centered label for radial/pie charts, rendered inside a Recharts `<Label>`.\n *\n * @example\n * ```tsx\n * <PolarRadiusAxis tick={false} tickLine={false} axisLine={false}>\n * <Label content={({ viewBox }) => (\n * <ChartCenterLabel viewBox={viewBox} value=\"78%\" subtitle=\"Complete\" />\n * )} />\n * </PolarRadiusAxis>\n * ```\n */\nexport const ChartCenterLabel = React.forwardRef<SVGTextElement, ChartCenterLabelProps>(\n (\n {\n viewBox,\n value,\n subtitle,\n valueClassName = \"fill-foreground-default font-bold text-3xl\",\n ...props\n },\n ref,\n ) => {\n if (!viewBox || !(\"cx\" in viewBox) || !(\"cy\" in viewBox)) return null;\n\n return (\n <text\n ref={ref}\n x={viewBox.cx}\n y={viewBox.cy}\n textAnchor=\"middle\"\n dominantBaseline=\"middle\"\n {...props}\n >\n <tspan x={viewBox.cx} y={viewBox.cy} className={valueClassName}>\n {value}\n </tspan>\n <tspan x={viewBox.cx} y={(viewBox.cy || 0) + 24} className=\"fill-foreground-tertiary\">\n {subtitle}\n </tspan>\n </text>\n );\n },\n);\n\nChartCenterLabel.displayName = \"ChartCenterLabel\";\n"],"names":["React","jsxs","jsx"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AA2BO,MAAM,mBAAmBA,iBAAM;AAAA,EACpC,CACE;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,IACA,iBAAiB;AAAA,IACjB,GAAG;AAAA,EAAA,GAEL,QACG;AACH,QAAI,CAAC,WAAW,EAAE,QAAQ,YAAY,EAAE,QAAQ,SAAU,QAAO;AAEjE,WACEC,2BAAAA;AAAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA,GAAG,QAAQ;AAAA,QACX,GAAG,QAAQ;AAAA,QACX,YAAW;AAAA,QACX,kBAAiB;AAAA,QAChB,GAAG;AAAA,QAEJ,UAAA;AAAA,UAAAC,2BAAAA,IAAC,SAAA,EAAM,GAAG,QAAQ,IAAI,GAAG,QAAQ,IAAI,WAAW,gBAC7C,UAAA,MAAA,CACH;AAAA,UACAA,2BAAAA,IAAC,SAAA,EAAM,GAAG,QAAQ,IAAI,IAAI,QAAQ,MAAM,KAAK,IAAI,WAAU,4BACxD,UAAA,SAAA,CACH;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAGN;AACF;AAEA,iBAAiB,cAAc;;"}
@@ -0,0 +1,64 @@
1
+ "use client";
2
+ "use strict";
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
4
+ const jsxRuntime = require("react/jsx-runtime");
5
+ const React = require("react");
6
+ const recharts = require("recharts");
7
+ const cn = require("../../utils/cn.cjs");
8
+ const ChartStyle = require("./ChartStyle.cjs");
9
+ const useChart = require("./useChart.cjs");
10
+ function _interopNamespaceDefault(e) {
11
+ const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
12
+ if (e) {
13
+ for (const k in e) {
14
+ if (k !== "default") {
15
+ const d = Object.getOwnPropertyDescriptor(e, k);
16
+ Object.defineProperty(n, k, d.get ? d : {
17
+ enumerable: true,
18
+ get: () => e[k]
19
+ });
20
+ }
21
+ }
22
+ }
23
+ n.default = e;
24
+ return Object.freeze(n);
25
+ }
26
+ const React__namespace = /* @__PURE__ */ _interopNamespaceDefault(React);
27
+ const ChartContainer = React__namespace.forwardRef(
28
+ ({ id, className, children, config, ...props }, ref) => {
29
+ const uniqueId = React__namespace.useId();
30
+ const chartId = `chart-${id || uniqueId.replace(/:/g, "")}`;
31
+ return /* @__PURE__ */ jsxRuntime.jsx(useChart.ChartContext.Provider, { value: { config }, children: /* @__PURE__ */ jsxRuntime.jsxs(
32
+ "div",
33
+ {
34
+ ref,
35
+ "data-slot": "chart",
36
+ "data-chart": chartId,
37
+ className: cn.cn(
38
+ "flex aspect-video justify-center text-xs",
39
+ "[&_.recharts-cartesian-axis-tick_text]:fill-foreground-tertiary",
40
+ "[&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-neutral-200",
41
+ "[&_.recharts-curve.recharts-tooltip-cursor]:stroke-neutral-200",
42
+ "[&_.recharts-dot[stroke='#fff']]:stroke-transparent",
43
+ "[&_.recharts-layer]:outline-hidden",
44
+ "[&_.recharts-polar-grid_[stroke='#ccc']]:stroke-neutral-200",
45
+ "[&_.recharts-radial-bar-background-sector]:fill-neutral-100",
46
+ "[&_.recharts-rectangle.recharts-tooltip-cursor]:fill-neutral-100",
47
+ "[&_.recharts-reference-line_[stroke='#ccc']]:stroke-neutral-200",
48
+ "[&_.recharts-sector]:outline-hidden",
49
+ "[&_.recharts-sector[stroke='#fff']]:stroke-transparent",
50
+ "[&_.recharts-surface]:outline-hidden",
51
+ className
52
+ ),
53
+ ...props,
54
+ children: [
55
+ /* @__PURE__ */ jsxRuntime.jsx(ChartStyle.ChartStyle, { id: chartId, config }),
56
+ /* @__PURE__ */ jsxRuntime.jsx(recharts.ResponsiveContainer, { children })
57
+ ]
58
+ }
59
+ ) });
60
+ }
61
+ );
62
+ ChartContainer.displayName = "ChartContainer";
63
+ exports.ChartContainer = ChartContainer;
64
+ //# sourceMappingURL=ChartContainer.cjs.map