@ember-joinery/chart 0.0.0-stage → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (121) hide show
  1. package/CHANGELOG.md +189 -0
  2. package/LICENSE.md +9 -0
  3. package/NOTICE +532 -0
  4. package/README.md +69 -2
  5. package/addon-main.cjs +4 -0
  6. package/declarations/-private/cartesian-chart.d.ts +413 -0
  7. package/declarations/-private/cartesian-chart.d.ts.map +1 -0
  8. package/declarations/-private/cartesian.d.ts +236 -0
  9. package/declarations/-private/cartesian.d.ts.map +1 -0
  10. package/declarations/-private/config.d.ts +13 -0
  11. package/declarations/-private/config.d.ts.map +1 -0
  12. package/declarations/-private/dots.d.ts +27 -0
  13. package/declarations/-private/dots.d.ts.map +1 -0
  14. package/declarations/-private/nice-ticks.d.ts +17 -0
  15. package/declarations/-private/nice-ticks.d.ts.map +1 -0
  16. package/declarations/-private/parts.d.ts +596 -0
  17. package/declarations/-private/parts.d.ts.map +1 -0
  18. package/declarations/-private/paths.d.ts +26 -0
  19. package/declarations/-private/paths.d.ts.map +1 -0
  20. package/declarations/-private/pie-chart.d.ts +244 -0
  21. package/declarations/-private/pie-chart.d.ts.map +1 -0
  22. package/declarations/-private/polar-chart.d.ts +423 -0
  23. package/declarations/-private/polar-chart.d.ts.map +1 -0
  24. package/declarations/-private/polar-geometry.d.ts +230 -0
  25. package/declarations/-private/polar-geometry.d.ts.map +1 -0
  26. package/declarations/-private/polar-parts.d.ts +315 -0
  27. package/declarations/-private/polar-parts.d.ts.map +1 -0
  28. package/declarations/-private/polar.d.ts +156 -0
  29. package/declarations/-private/polar.d.ts.map +1 -0
  30. package/declarations/-private/registry.d.ts +9 -0
  31. package/declarations/-private/registry.d.ts.map +1 -0
  32. package/declarations/-private/text-size.d.ts +13 -0
  33. package/declarations/-private/text-size.d.ts.map +1 -0
  34. package/declarations/-private/tick-interval.d.ts +35 -0
  35. package/declarations/-private/tick-interval.d.ts.map +1 -0
  36. package/declarations/components/area-chart.d.ts +16 -0
  37. package/declarations/components/area-chart.d.ts.map +1 -0
  38. package/declarations/components/bar-chart.d.ts +16 -0
  39. package/declarations/components/bar-chart.d.ts.map +1 -0
  40. package/declarations/components/chart-container.d.ts +66 -0
  41. package/declarations/components/chart-container.d.ts.map +1 -0
  42. package/declarations/components/chart-legend-content.d.ts +42 -0
  43. package/declarations/components/chart-legend-content.d.ts.map +1 -0
  44. package/declarations/components/chart-style.d.ts +19 -0
  45. package/declarations/components/chart-style.d.ts.map +1 -0
  46. package/declarations/components/chart-tooltip-content.d.ts +94 -0
  47. package/declarations/components/chart-tooltip-content.d.ts.map +1 -0
  48. package/declarations/components/dot.d.ts +22 -0
  49. package/declarations/components/dot.d.ts.map +1 -0
  50. package/declarations/components/line-chart.d.ts +16 -0
  51. package/declarations/components/line-chart.d.ts.map +1 -0
  52. package/declarations/components/pie-chart.d.ts +13 -0
  53. package/declarations/components/pie-chart.d.ts.map +1 -0
  54. package/declarations/components/radar-chart.d.ts +21 -0
  55. package/declarations/components/radar-chart.d.ts.map +1 -0
  56. package/declarations/components/radial-bar-chart.d.ts +17 -0
  57. package/declarations/components/radial-bar-chart.d.ts.map +1 -0
  58. package/declarations/components/rectangle.d.ts +32 -0
  59. package/declarations/components/rectangle.d.ts.map +1 -0
  60. package/declarations/components/sector.d.ts +47 -0
  61. package/declarations/components/sector.d.ts.map +1 -0
  62. package/declarations/index.d.ts +24 -0
  63. package/declarations/index.d.ts.map +1 -0
  64. package/declarations/test-support/chart.d.ts +162 -0
  65. package/declarations/test-support/chart.d.ts.map +1 -0
  66. package/declarations/test-support/index.d.ts +3 -0
  67. package/declarations/test-support/index.d.ts.map +1 -0
  68. package/declarations/test-support/polar-chart.d.ts +62 -0
  69. package/declarations/test-support/polar-chart.d.ts.map +1 -0
  70. package/declarations/test-support.d.ts +2 -0
  71. package/declarations/types.d.ts +138 -0
  72. package/declarations/types.d.ts.map +1 -0
  73. package/dist/cartesian-D9hWDamz.js +1217 -0
  74. package/dist/cartesian-D9hWDamz.js.map +1 -0
  75. package/dist/cartesian-chart-BLj6Q_OB.js +1123 -0
  76. package/dist/cartesian-chart-BLj6Q_OB.js.map +1 -0
  77. package/dist/components/area-chart.js +20 -0
  78. package/dist/components/area-chart.js.map +1 -0
  79. package/dist/components/bar-chart.js +20 -0
  80. package/dist/components/bar-chart.js.map +1 -0
  81. package/dist/components/chart-container.js +54 -0
  82. package/dist/components/chart-container.js.map +1 -0
  83. package/dist/components/chart-legend-content.js +48 -0
  84. package/dist/components/chart-legend-content.js.map +1 -0
  85. package/dist/components/chart-style.js +35 -0
  86. package/dist/components/chart-style.js.map +1 -0
  87. package/dist/components/chart-tooltip-content.js +131 -0
  88. package/dist/components/chart-tooltip-content.js.map +1 -0
  89. package/dist/components/dot.js +18 -0
  90. package/dist/components/dot.js.map +1 -0
  91. package/dist/components/line-chart.js +20 -0
  92. package/dist/components/line-chart.js.map +1 -0
  93. package/dist/components/pie-chart.js +6 -0
  94. package/dist/components/pie-chart.js.map +1 -0
  95. package/dist/components/radar-chart.js +22 -0
  96. package/dist/components/radar-chart.js.map +1 -0
  97. package/dist/components/radial-bar-chart.js +20 -0
  98. package/dist/components/radial-bar-chart.js.map +1 -0
  99. package/dist/components/rectangle.js +5 -0
  100. package/dist/components/rectangle.js.map +1 -0
  101. package/dist/components/sector.js +5 -0
  102. package/dist/components/sector.js.map +1 -0
  103. package/dist/config-DnsUmxOT.js +35 -0
  104. package/dist/config-DnsUmxOT.js.map +1 -0
  105. package/dist/index.js +15 -0
  106. package/dist/index.js.map +1 -0
  107. package/dist/parts-BWLhFFjB.js +355 -0
  108. package/dist/parts-BWLhFFjB.js.map +1 -0
  109. package/dist/pie-chart-CmDtW_Ge.js +646 -0
  110. package/dist/pie-chart-CmDtW_Ge.js.map +1 -0
  111. package/dist/polar-chart-GhgOSsH9.js +2242 -0
  112. package/dist/polar-chart-GhgOSsH9.js.map +1 -0
  113. package/dist/rectangle-Cl7tbXuZ.js +166 -0
  114. package/dist/rectangle-Cl7tbXuZ.js.map +1 -0
  115. package/dist/sector-7shQPJuQ.js +565 -0
  116. package/dist/sector-7shQPJuQ.js.map +1 -0
  117. package/dist/test-support.js +470 -0
  118. package/dist/test-support.js.map +1 -0
  119. package/dist/types.js +56 -0
  120. package/dist/types.js.map +1 -0
  121. package/package.json +117 -3
@@ -0,0 +1,13 @@
1
+ import type { ChartConfig, ChartConfigItem } from '../types.ts';
2
+ /**
3
+ * shadcn's `getPayloadConfigFromPayload`: the config entry for a tooltip or legend item. The
4
+ * entry is found by `key`, or by the string at `key` in the item or in its row (so
5
+ * `nameKey="browser"` finds `chrome` in `{ browser: 'chrome' }`).
6
+ */
7
+ export declare function payloadConfig(config: ChartConfig | undefined, payload: unknown, key: string): ChartConfigItem | undefined;
8
+ /**
9
+ * A colour safe to write into a `style` attribute or a style sheet: one value, with nothing
10
+ * that could end the declaration or the rule.
11
+ */
12
+ export declare function cssValue(value: unknown): string | undefined;
13
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/-private/config.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAE/D;;;;GAIG;AACH,wBAAgB,aAAa,CAC3B,MAAM,EAAE,WAAW,GAAG,SAAS,EAC/B,OAAO,EAAE,OAAO,EAChB,GAAG,EAAE,MAAM,GACV,eAAe,GAAG,SAAS,CAc7B;AAED;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAI3D"}
@@ -0,0 +1,27 @@
1
+ import type { DotArgs, DotOption } from './parts';
2
+ export interface CircleDot {
3
+ kind: 'circle';
4
+ component?: undefined;
5
+ attrs: {
6
+ r: number;
7
+ fill: string;
8
+ stroke: string;
9
+ strokeWidth: string;
10
+ class?: string;
11
+ };
12
+ args: DotArgs;
13
+ }
14
+ export interface ComponentDot {
15
+ kind: 'component';
16
+ component: Exclude<DotOption, boolean | Record<string, unknown>>;
17
+ args: DotArgs;
18
+ }
19
+ export type DotRender = CircleDot | ComponentDot;
20
+ /** A plain object of attributes, as opposed to a component (a class, or a curried definition). */
21
+ export declare function isPlainObject(value: unknown): value is Record<string, unknown>;
22
+ /**
23
+ * The dot to draw for `option`, or null for none. `defaults` are the series' own: a line's dot
24
+ * is a white circle in its stroke, an active dot a filled one with a white ring.
25
+ */
26
+ export declare function dotFor(option: DotOption | undefined, fallback: boolean, defaults: CircleDot['attrs'], args: DotArgs): DotRender | null;
27
+ //# sourceMappingURL=dots.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dots.d.ts","sourceRoot":"","sources":["../../src/-private/dots.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAErD,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,QAAQ,CAAA;IACd,SAAS,CAAC,EAAE,SAAS,CAAA;IACrB,KAAK,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;IACvF,IAAI,EAAE,OAAO,CAAA;CACd;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,WAAW,CAAA;IACjB,SAAS,EAAE,OAAO,CAAC,SAAS,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAA;IAChE,IAAI,EAAE,OAAO,CAAA;CACd;AAED,MAAM,MAAM,SAAS,GAAG,SAAS,GAAG,YAAY,CAAA;AAEhD,kGAAkG;AAClG,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAI9E;AAED;;;GAGG;AACH,wBAAgB,MAAM,CACpB,MAAM,EAAE,SAAS,GAAG,SAAS,EAC7B,QAAQ,EAAE,OAAO,EACjB,QAAQ,EAAE,SAAS,CAAC,OAAO,CAAC,EAC5B,IAAI,EAAE,OAAO,GACZ,SAAS,GAAG,IAAI,CAgBlB"}
@@ -0,0 +1,17 @@
1
+ /** The number of digits before the decimal point (1 for 0). */
2
+ export declare function getDigitCount(value: number): number;
3
+ /** The adaptive step: the rough step rounded up to a multiple of 0.05 (or 0.1) of its magnitude. */
4
+ export declare function getAdaptiveStep(roughStep: number, allowDecimals: boolean, correctionFactor: number): number;
5
+ /** Ticks around a single value. */
6
+ export declare function getTickOfSingleValue(value: number, tickCount: number, allowDecimals: boolean): number[];
7
+ /**
8
+ * The ticks of `[min, max]`, `tickCount` of them, rounded to nice values: `[0, 305]` with five
9
+ * ticks gives `[0, 80, 160, 240, 320]`. The ticks can reach past the interval.
10
+ */
11
+ export declare function getNiceTickValues([min, max]: readonly [number, number], tickCount?: number, allowDecimals?: boolean): number[];
12
+ /**
13
+ * The ticks of a fixed `[min, max]`, kept inside it: for an axis whose domain is given as
14
+ * numbers.
15
+ */
16
+ export declare function getTickValuesFixedDomain([min, max]: readonly [number, number], tickCount: number, allowDecimals?: boolean): number[];
17
+ //# sourceMappingURL=nice-ticks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nice-ticks.d.ts","sourceRoot":"","sources":["../../src/-private/nice-ticks.ts"],"names":[],"mappings":"AAgBA,+DAA+D;AAC/D,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAGnD;AAED,oGAAoG;AACpG,wBAAgB,eAAe,CAC7B,SAAS,EAAE,MAAM,EACjB,aAAa,EAAE,OAAO,EACtB,gBAAgB,EAAE,MAAM,GACvB,MAAM,CAWR;AAED,mCAAmC;AACnC,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,MAAM,EACjB,aAAa,EAAE,OAAO,GACrB,MAAM,EAAE,CAkBV;AAuDD;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,EACrC,SAAS,SAAI,EACb,aAAa,UAAO,GACnB,MAAM,EAAE,CAcV;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CACtC,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,EACrC,SAAS,EAAE,MAAM,EACjB,aAAa,UAAO,GACnB,MAAM,EAAE,CASV"}
@@ -0,0 +1,596 @@
1
+ import Component from '@glimmer/component';
2
+ import type Owner from '@ember/owner';
3
+ import type { ComponentLike, WithBoundArgs } from '@glint/template';
4
+ import { Registry } from './registry.ts';
5
+ import type { CurveType } from './paths.ts';
6
+ import type { DataKey, DomainBound } from './cartesian.ts';
7
+ import type { PolarLabelPosition, PolarViewBox } from './polar.ts';
8
+ import type { TickInterval } from './tick-interval.ts';
9
+ import type { ChartLegendContentArgs, ChartTooltipContentArgs, LabelFormatter, TooltipFormatter } from '../types.ts';
10
+ /** What a part needs of its chart: somewhere to register. */
11
+ export interface ChartRegistrar {
12
+ register(part: ChartPart): void;
13
+ unregister(part: ChartPart): void;
14
+ }
15
+ /** Every part a chart reads. */
16
+ export type ChartPart = XAxis | YAxis | CartesianGrid | Area | Line | Bar | Pie | ChartTooltip | ChartLegend;
17
+ interface PartArgs {
18
+ /** The chart it belongs to; the chart's yield passes it. */
19
+ chart: ChartRegistrar;
20
+ }
21
+ /** A part that registers with its chart while it is rendered. */
22
+ declare abstract class Part<S extends {
23
+ Args: PartArgs;
24
+ }> extends Component<S> {
25
+ abstract readonly kind: string;
26
+ constructor(owner: Owner, args: S['Args']);
27
+ willDestroy(): void;
28
+ }
29
+ /** The arguments an axis shares with recharts' `XAxis` and `YAxis`. */
30
+ export interface AxisArgs extends PartArgs {
31
+ /** The key (or function) of each row's value on this axis. A category axis without one numbers the rows. */
32
+ dataKey?: DataKey;
33
+ /** `category` (the x-axis's default) or `number` (the y-axis's). */
34
+ type?: 'category' | 'number';
35
+ /** Lays the axis out but doesn't draw it. */
36
+ hide?: boolean;
37
+ /** Draws the axis inside the plot area instead of beside it. */
38
+ mirror?: boolean;
39
+ /** Runs the axis the other way: right to left, or top to bottom. */
40
+ reversed?: boolean;
41
+ /** The value range, as `[min, max]`: numbers, `auto`, `dataMin`, `dataMax` or functions. */
42
+ domain?: readonly [DomainBound, DomainBound];
43
+ /** Lets the domain cut the data off instead of growing to fit it. */
44
+ allowDataOverflow?: boolean;
45
+ /** Whether nice ticks may be fractions. Default true. */
46
+ allowDecimals?: boolean;
47
+ /** How many ticks a number axis aims for. Default 5. */
48
+ tickCount?: number;
49
+ /** The ticks to draw, instead of computed ones. */
50
+ ticks?: readonly unknown[];
51
+ /** Whether to draw tick labels. Default true. */
52
+ tick?: boolean;
53
+ /** Whether to draw the tick marks. Default true. */
54
+ tickLine?: boolean;
55
+ /** Whether to draw the axis line. Default true. */
56
+ axisLine?: boolean;
57
+ /** The tick marks' length. Default 6. */
58
+ tickSize?: number;
59
+ /** The space between a tick mark and its label. Default 2. */
60
+ tickMargin?: number;
61
+ /** The least space between two labels before one is dropped. Default 5. */
62
+ minTickGap?: number;
63
+ /** Which ticks to keep when labels would overlap: recharts' `interval`. Default `preserveEnd`. */
64
+ interval?: TickInterval;
65
+ /** Formats each tick's label. */
66
+ tickFormatter?: (value: never, index: number) => unknown;
67
+ /** A unit appended to each label. */
68
+ unit?: string;
69
+ /** The labels' rotation, in degrees. */
70
+ angle?: number;
71
+ /** The axis line's and labels' colour. Default `#666` (the chart's CSS greys the labels). */
72
+ stroke?: string;
73
+ /** `auto` (by chart and type), or a scale: `linear`, `band` or `point`. */
74
+ scale?: 'auto' | 'linear' | 'band' | 'point';
75
+ }
76
+ export interface XAxisSignature {
77
+ Args: AxisArgs & {
78
+ /** The axis's height. Default 30. */
79
+ height?: number;
80
+ /** `bottom` (default) or `top`. */
81
+ orientation?: 'bottom' | 'top';
82
+ /** Space before the first and after the last category, in pixels. */
83
+ padding?: {
84
+ left?: number;
85
+ right?: number;
86
+ };
87
+ };
88
+ }
89
+ /** The chart's x-axis: recharts' `XAxis`. */
90
+ export declare class XAxis extends Part<XAxisSignature> {
91
+ readonly kind = "xAxis";
92
+ }
93
+ export interface YAxisSignature {
94
+ Args: AxisArgs & {
95
+ /** The axis's width. Default 60. */
96
+ width?: number;
97
+ /** `left` (default) or `right`. */
98
+ orientation?: 'left' | 'right';
99
+ /** Space above the top and below the bottom value, in pixels. */
100
+ padding?: {
101
+ top?: number;
102
+ bottom?: number;
103
+ };
104
+ };
105
+ }
106
+ /** The chart's y-axis: recharts' `YAxis`. */
107
+ export declare class YAxis extends Part<YAxisSignature> {
108
+ readonly kind = "yAxis";
109
+ }
110
+ export interface CartesianGridSignature {
111
+ Args: PartArgs & {
112
+ /** Whether to draw lines across, at the y-axis's ticks. Default true. */
113
+ horizontal?: boolean;
114
+ /** Whether to draw lines down, at the x-axis's ticks. Default true. */
115
+ vertical?: boolean;
116
+ /** The lines' colour. Default `#ccc`, which the chart's CSS turns into `--border`. */
117
+ stroke?: string;
118
+ strokeDasharray?: string;
119
+ /** Recharts' `orientation`, taken as upstream's examples pass it; it doesn't change the grid. */
120
+ orientation?: string;
121
+ };
122
+ }
123
+ /** Grid lines behind the chart: recharts' `CartesianGrid`. */
124
+ export declare class CartesianGrid extends Part<CartesianGridSignature> {
125
+ readonly kind = "grid";
126
+ }
127
+ /** What a series' dot (or active dot) component is handed. */
128
+ export interface DotArgs {
129
+ cx: number;
130
+ cy: number;
131
+ r: number;
132
+ index: number;
133
+ value: unknown;
134
+ /** The row the point came from. */
135
+ payload: Record<string, string | number | null | undefined>;
136
+ dataKey: DataKey;
137
+ stroke?: string;
138
+ strokeWidth?: number | string;
139
+ fill?: string;
140
+ }
141
+ /** A dot's look: false for none, true for the default, its attributes, or a component. */
142
+ export type DotOption = boolean | {
143
+ r?: number;
144
+ fill?: string;
145
+ stroke?: string;
146
+ strokeWidth?: number | string;
147
+ class?: string;
148
+ } | ComponentLike<{
149
+ Args: DotArgs;
150
+ Element: Element;
151
+ }>;
152
+ /** The arguments every series shares. */
153
+ export interface SeriesArgs extends PartArgs {
154
+ /** The key (or function) of each row's value. */
155
+ dataKey: DataKey;
156
+ /** The series' name in the tooltip and legend. Default: its data key. */
157
+ name?: string;
158
+ /** Series with the same stack id stack on each other. */
159
+ stackId?: string | number;
160
+ /** Lays the series out but doesn't draw it. */
161
+ hide?: boolean;
162
+ /** The legend's icon type; `none` leaves the series out of the legend. */
163
+ legendType?: string;
164
+ /** `none` leaves the series out of the tooltip. */
165
+ tooltipType?: string;
166
+ /** A unit for its tooltip values. */
167
+ unit?: string;
168
+ }
169
+ /** What a series yields: its label list. */
170
+ export interface SeriesParts {
171
+ /** Labels at each point (or bar): recharts' `LabelList`. */
172
+ LabelList: WithBoundArgs<typeof LabelList, 'series'>;
173
+ }
174
+ /** What a bar series yields: its label list, and a `Cell` per bar. */
175
+ export interface BarParts extends SeriesParts {
176
+ /** One bar's attributes (its `@fill`), in the order of the rows: recharts' `Cell`. */
177
+ Cell: WithBoundArgs<typeof Cell, 'series'>;
178
+ }
179
+ declare abstract class Series<S extends {
180
+ Args: SeriesArgs;
181
+ }> extends Part<S> {
182
+ readonly labels: Registry<LabelList>;
183
+ readonly cells: Registry<Cell>;
184
+ registerLabel: (label: LabelList) => void;
185
+ unregisterLabel: (label: LabelList) => void;
186
+ registerCell: (cell: Cell) => void;
187
+ unregisterCell: (cell: Cell) => void;
188
+ }
189
+ export interface AreaSignature {
190
+ Args: SeriesArgs & {
191
+ /** How the line joins the points: `linear` (default), `natural`, `monotone`, `step`… */
192
+ type?: CurveType;
193
+ fill?: string;
194
+ fillOpacity?: number | string;
195
+ stroke?: string;
196
+ strokeWidth?: number | string;
197
+ strokeDasharray?: string;
198
+ /** The dot at each point. Default none. */
199
+ dot?: DotOption;
200
+ /** The dot at the active row, while the tooltip shows. Default true. */
201
+ activeDot?: DotOption;
202
+ /** Joins the line over missing values. */
203
+ connectNulls?: boolean;
204
+ /** Where the area starts: a number, `dataMin` or `dataMax`. Default the axis's 0. */
205
+ baseValue?: number | 'dataMin' | 'dataMax';
206
+ };
207
+ Blocks: {
208
+ default: [SeriesParts];
209
+ };
210
+ }
211
+ /** A filled area under a line: recharts' `Area`. */
212
+ export declare class Area extends Series<AreaSignature> {
213
+ readonly kind = "area";
214
+ }
215
+ export interface LineSignature {
216
+ Args: SeriesArgs & {
217
+ /** How the line joins the points: `linear` (default), `natural`, `monotone`, `step`… */
218
+ type?: CurveType;
219
+ stroke?: string;
220
+ strokeWidth?: number | string;
221
+ strokeDasharray?: string;
222
+ /** The default dot's fill. Default `#fff`. */
223
+ fill?: string;
224
+ /** The dot at each point. Default true. */
225
+ dot?: DotOption;
226
+ /** The dot at the active row, while the tooltip shows. Default true. */
227
+ activeDot?: DotOption;
228
+ /** Joins the line over missing values. */
229
+ connectNulls?: boolean;
230
+ };
231
+ Blocks: {
232
+ default: [SeriesParts];
233
+ };
234
+ }
235
+ /** A line through the points: recharts' `Line`. */
236
+ export declare class Line extends Series<LineSignature> {
237
+ readonly kind = "line";
238
+ }
239
+ /**
240
+ * What a bar's `@shape` is handed as `@props`, as recharts hands its `shape` function: the
241
+ * bar's rectangle, its attributes, and the row it came from. Pass it on to `Rectangle`.
242
+ */
243
+ export interface RectangleProps {
244
+ x: number;
245
+ y: number;
246
+ width: number;
247
+ height: number;
248
+ /** The corners' radius: one for all four, or `[topLeft, topRight, bottomRight, bottomLeft]`. */
249
+ radius?: number | readonly number[];
250
+ fill?: string;
251
+ fillOpacity?: number | string;
252
+ stroke?: string;
253
+ strokeWidth?: number | string;
254
+ /** The bar's row. */
255
+ index: number;
256
+ /** Its value. */
257
+ value: unknown;
258
+ /** The row it came from (with its `Cell`'s attributes over it). */
259
+ payload: Record<string, string | number | null | undefined>;
260
+ dataKey: DataKey;
261
+ /** Whether the tooltip shows its row. */
262
+ isActive: boolean;
263
+ }
264
+ /** A bar's `@shape`: a component that draws each bar, handed its `@props` and `@index`. */
265
+ export interface BarShapeSignature {
266
+ Args: {
267
+ props: RectangleProps;
268
+ index: number;
269
+ };
270
+ Element: Element;
271
+ }
272
+ export interface BarSignature {
273
+ Args: SeriesArgs & {
274
+ fill?: string;
275
+ fillOpacity?: number | string;
276
+ stroke?: string;
277
+ strokeWidth?: number | string;
278
+ /** The corners' radius: one for all four, or `[topLeft, topRight, bottomRight, bottomLeft]`. */
279
+ radius?: number | readonly number[];
280
+ /** The bar's width, instead of an equal share of the band. */
281
+ barSize?: number;
282
+ maxBarSize?: number;
283
+ /**
284
+ * Draws each bar: a component handed `@props` (its rectangle, attributes and row) and
285
+ * `@index`, as recharts' `shape` function is. `Rectangle` draws one. Default a `Rectangle`.
286
+ */
287
+ shape?: ComponentLike<BarShapeSignature>;
288
+ };
289
+ Blocks: {
290
+ default: [BarParts];
291
+ };
292
+ }
293
+ /** A bar for each row: recharts' `Bar`. */
294
+ export declare class Bar extends Series<BarSignature> {
295
+ readonly kind = "bar";
296
+ }
297
+ /**
298
+ * Where a label sits against its point or bar, or (in a pie) its sector: `outside`, `center`,
299
+ * `centerTop`, `centerBottom`, or `middle` (the default), in the middle of the sector's ring.
300
+ */
301
+ export type LabelPosition = 'top' | 'bottom' | 'left' | 'right' | 'center' | 'inside' | 'insideLeft' | 'insideRight' | 'insideTop' | 'insideBottom' | PolarLabelPosition;
302
+ export interface LabelListSignature {
303
+ Args: {
304
+ /** The series it labels; the series' yield passes it. */
305
+ series: {
306
+ registerLabel(label: LabelList): void;
307
+ unregisterLabel(label: LabelList): void;
308
+ };
309
+ /** The key of each label's value in the row. Default: the series' own value. */
310
+ dataKey?: DataKey;
311
+ /**
312
+ * Where each label sits. Default `top` for a line or area, `center` for a bar, `middle`
313
+ * for a pie's sector.
314
+ */
315
+ position?: LabelPosition;
316
+ /** The space between a label and its point. Default 5. */
317
+ offset?: number;
318
+ /** Formats each label's value. */
319
+ formatter?: (value: never) => unknown;
320
+ /** The labels' fill. Default the bar's or sector's own fill (its row's or `Cell`'s), else grey. */
321
+ fill?: string;
322
+ fillOpacity?: number | string;
323
+ stroke?: string;
324
+ fontSize?: number | string;
325
+ /** Classes for each label's `<text>`, such as `fill-foreground`. */
326
+ class?: string;
327
+ };
328
+ }
329
+ /** A label at each point of a series: recharts' `LabelList`. */
330
+ export declare class LabelList extends Component<LabelListSignature> {
331
+ constructor(owner: Owner, args: LabelListSignature['Args']);
332
+ willDestroy(): void;
333
+ }
334
+ export interface CellSignature {
335
+ Args: {
336
+ /** The bar or pie it belongs to; the series' yield passes it. */
337
+ series: {
338
+ registerCell(cell: Cell): void;
339
+ unregisterCell(cell: Cell): void;
340
+ };
341
+ fill?: string;
342
+ fillOpacity?: number | string;
343
+ stroke?: string;
344
+ strokeWidth?: number | string;
345
+ };
346
+ }
347
+ /**
348
+ * One bar's or sector's attributes, over its series': recharts' `Cell`. Write one per row, in
349
+ * the rows' order:
350
+ *
351
+ * {{#each chartData as |row|}}
352
+ * <bar.Cell @fill={{if (isPositive row.visitors) "var(--chart-1)" "var(--chart-2)"}} />
353
+ * {{/each}}
354
+ */
355
+ export declare class Cell extends Component<CellSignature> {
356
+ constructor(owner: Owner, args: CellSignature['Args']);
357
+ willDestroy(): void;
358
+ /** The attributes it lays over its bar or sector's row. */
359
+ get attributes(): Record<string, unknown>;
360
+ }
361
+ /**
362
+ * What a pie's `@shape` is handed as `@props`, as recharts hands its `shape` function: the
363
+ * sector's geometry, its attributes and its row. Pass it on to `Sector`.
364
+ */
365
+ export interface SectorProps {
366
+ cx: number;
367
+ cy: number;
368
+ innerRadius: number;
369
+ outerRadius: number;
370
+ startAngle: number;
371
+ endAngle: number;
372
+ midAngle: number;
373
+ cornerRadius?: number | string;
374
+ fill?: string;
375
+ fillOpacity?: number | string;
376
+ stroke?: string;
377
+ strokeWidth?: number | string;
378
+ /** The sector's row. */
379
+ index: number;
380
+ value: number;
381
+ /** The row's name (the pie's `@nameKey`), or its index. */
382
+ name: unknown;
383
+ /** Its share of the pie, from 0 to 1. */
384
+ percent: number;
385
+ /** The row it came from (with its `Cell`'s attributes over it). */
386
+ payload: Record<string, string | number | null | undefined>;
387
+ dataKey: DataKey;
388
+ /** Whether the tooltip shows it. */
389
+ isActive: boolean;
390
+ }
391
+ /** A pie's `@shape`: a component that draws each sector, handed its `@props` and `@index`. */
392
+ export interface PieShapeSignature {
393
+ Args: {
394
+ props: SectorProps;
395
+ index: number;
396
+ };
397
+ Element: Element;
398
+ }
399
+ /** What a pie's `@label` component is handed as `@props`: where the label goes, and its sector. */
400
+ export interface PieLabelProps extends Omit<SectorProps, 'isActive'> {
401
+ /** Where the text goes, past the sector's edge. */
402
+ x: number;
403
+ y: number;
404
+ /** `start` on the right of the pie, `end` on its left. */
405
+ textAnchor: 'start' | 'middle' | 'end';
406
+ /** recharts' label props have none; here for upstream's examples, which pass it on. */
407
+ dominantBaseline?: string;
408
+ }
409
+ /** A pie's `@label` component: draws a sector's label, handed its `@props` and `@index`. */
410
+ export interface PieLabelSignature {
411
+ Args: {
412
+ props: PieLabelProps;
413
+ index: number;
414
+ };
415
+ Element: Element;
416
+ }
417
+ /** What a pie yields: labels for its sectors, a label for the pie, and a `Cell` per sector. */
418
+ export interface PieParts {
419
+ /** Labels on each sector: recharts' `LabelList`. */
420
+ LabelList: WithBoundArgs<typeof LabelList, 'series'>;
421
+ /** A label for the pie, such as the total in a donut's hole: recharts' `Label`. */
422
+ Label: WithBoundArgs<typeof Label, 'pie'>;
423
+ /** One sector's attributes (its `@fill`), in the order of the rows: recharts' `Cell`. */
424
+ Cell: WithBoundArgs<typeof Cell, 'series'>;
425
+ }
426
+ export interface PieSignature {
427
+ Args: PartArgs & {
428
+ /** The rows, one sector each. Default the chart's `@data`. */
429
+ data?: readonly unknown[];
430
+ /** The key (or function) of each row's value. Default `value`. */
431
+ dataKey?: DataKey;
432
+ /** The key (or function) of each row's name, for the tooltip and legend. Default `name`. */
433
+ nameKey?: DataKey;
434
+ /** The pie's name, where a row has none. */
435
+ name?: string;
436
+ /** The centre, in pixels or a percentage of the plot area. Default `50%`. */
437
+ cx?: number | string;
438
+ cy?: number | string;
439
+ /** The hole's radius (a donut), in pixels or a percentage of the largest. Default 0. */
440
+ innerRadius?: number | string;
441
+ /** The pie's radius, in pixels or a percentage of the largest. Default `80%`. */
442
+ outerRadius?: number | string;
443
+ /** The angles it starts and ends at, in degrees counter-clockwise from 3 o'clock. Default 0 and 360. */
444
+ startAngle?: number;
445
+ endAngle?: number;
446
+ /** The gap between sectors, in degrees. Default 0. */
447
+ paddingAngle?: number;
448
+ /** The smallest angle a sector with a value gets. Default 0. */
449
+ minAngle?: number;
450
+ /** Rounds the sectors' corners. */
451
+ cornerRadius?: number | string;
452
+ /** The sectors' fill where the row and its `Cell` give none. Default `#808080`. */
453
+ fill?: string;
454
+ fillOpacity?: number | string;
455
+ /** The line between sectors. Default `#fff` (the chart's CSS makes it transparent). */
456
+ stroke?: string;
457
+ strokeWidth?: number | string;
458
+ /**
459
+ * A label past each sector's edge, with a line to it: true for its value, or a component
460
+ * handed `@props` (where the label goes, and the sector) and `@index`. Default none.
461
+ */
462
+ label?: boolean | ComponentLike<PieLabelSignature>;
463
+ /** Whether each label has a line to its sector. Default true. */
464
+ labelLine?: boolean;
465
+ /** Draws each sector: a component handed `@props` and `@index`. `Sector` draws one. */
466
+ shape?: ComponentLike<PieShapeSignature>;
467
+ /** The legend's icon type; `none` leaves the pie out of the legend. Default `rect`. */
468
+ legendType?: string;
469
+ /** `none` leaves the pie out of the tooltip. */
470
+ tooltipType?: string;
471
+ /** Lays the pie out but doesn't draw it. */
472
+ hide?: boolean;
473
+ };
474
+ Blocks: {
475
+ default: [PieParts];
476
+ };
477
+ }
478
+ /** A pie, a sector for each row: recharts' `Pie`. */
479
+ export declare class Pie extends Part<PieSignature> {
480
+ readonly kind = "pie";
481
+ readonly labels: Registry<LabelList>;
482
+ readonly cells: Registry<Cell>;
483
+ readonly textLabels: Registry<Label>;
484
+ registerLabel: (label: LabelList) => void;
485
+ unregisterLabel: (label: LabelList) => void;
486
+ registerCell: (cell: Cell) => void;
487
+ unregisterCell: (cell: Cell) => void;
488
+ registerTextLabel: (label: Label) => void;
489
+ unregisterTextLabel: (label: Label) => void;
490
+ }
491
+ /** What a `Label`'s `@content` is handed. */
492
+ export interface LabelContentSignature {
493
+ Args: {
494
+ /** The chart's ring: its centre (`cx`, `cy`), radii and angles. */
495
+ viewBox: PolarViewBox;
496
+ /** The label's `@value`. */
497
+ value?: unknown;
498
+ /** The label's `@offset`. */
499
+ offset: number;
500
+ /** The label's `@position`. */
501
+ position: PolarLabelPosition;
502
+ };
503
+ Element: Element;
504
+ }
505
+ export interface LabelSignature {
506
+ Args: {
507
+ /** The pie it belongs to; the pie's yield passes it. */
508
+ pie: {
509
+ registerTextLabel(label: Label): void;
510
+ unregisterTextLabel(label: Label): void;
511
+ };
512
+ /** The text to show. */
513
+ value?: string | number;
514
+ /**
515
+ * Draws the label instead: a component handed `@viewBox` (the chart's ring, its centre at
516
+ * `cx`, `cy`), as recharts' `content` function is handed it. It draws inside the pie.
517
+ */
518
+ content?: ComponentLike<LabelContentSignature>;
519
+ /** Where `@value` sits against the chart's ring. Default `middle`, as recharts'. */
520
+ position?: PolarLabelPosition;
521
+ /** The space between the label and the ring's edge, for `outside`. Default 5. */
522
+ offset?: number;
523
+ /** Classes for the text. */
524
+ class?: string;
525
+ /** The text's fill. Default grey (`#808080`). */
526
+ fill?: string;
527
+ fontSize?: number | string;
528
+ };
529
+ }
530
+ /** A label for a pie, such as the total in a donut's hole: recharts' `Label`. */
531
+ export declare class Label extends Component<LabelSignature> {
532
+ constructor(owner: Owner, args: LabelSignature['Args']);
533
+ willDestroy(): void;
534
+ }
535
+ export interface ChartTooltipSignature {
536
+ Args: PartArgs & {
537
+ /**
538
+ * What the tooltip shows: a component, handed `@active`, `@payload`, `@label` and the
539
+ * chart's `@config`. Default `ChartTooltipContent`. Curry its own arguments:
540
+ * `@content={{component ChartTooltipContent indicator="line"}}`.
541
+ */
542
+ content?: ComponentLike<{
543
+ Args: ChartTooltipContentArgs;
544
+ }>;
545
+ /** The line (or band) under the pointer. Default true; false draws none. */
546
+ cursor?: boolean | {
547
+ stroke?: string;
548
+ strokeWidth?: number | string;
549
+ fill?: string;
550
+ };
551
+ /** Shows the tooltip whatever the pointer does (true), or never (false). */
552
+ active?: boolean;
553
+ /** The row the tooltip shows before the pointer moves. */
554
+ defaultIndex?: number;
555
+ /** The space between the pointer and the tooltip. Default 10. */
556
+ offset?: number;
557
+ /** Passed to the content, for its label. */
558
+ labelClassName?: string;
559
+ labelFormatter?: LabelFormatter;
560
+ /** Formats each entry: a function returning its text, or a component that draws it. */
561
+ formatter?: TooltipFormatter;
562
+ /** Leaves out entries whose value is null. Default true. */
563
+ filterNull?: boolean;
564
+ /**
565
+ * Moves the tooltip box smoothly: `'auto'` (the default) unless the user prefers reduced
566
+ * motion, `true` always, `false` never.
567
+ */
568
+ isAnimationActive?: boolean | 'auto';
569
+ };
570
+ }
571
+ /** The chart's tooltip: shadcn's `ChartTooltip` (recharts' `Tooltip`). */
572
+ export declare class ChartTooltip extends Part<ChartTooltipSignature> {
573
+ readonly kind = "tooltip";
574
+ }
575
+ export interface ChartLegendSignature {
576
+ Args: PartArgs & {
577
+ /** What the legend shows: a component, handed `@payload` and the chart's `@config`. Default `ChartLegendContent`. */
578
+ content?: ComponentLike<{
579
+ Args: ChartLegendContentArgs;
580
+ }>;
581
+ /** `bottom` (default), `top` or `middle`. */
582
+ verticalAlign?: 'top' | 'middle' | 'bottom';
583
+ /** `center` (default), `left` or `right`. */
584
+ align?: 'left' | 'center' | 'right';
585
+ /** `horizontal` (default) or `vertical`. */
586
+ layout?: 'horizontal' | 'vertical';
587
+ /** Classes for the legend, handed to its content as `@class`, as recharts' `className`. */
588
+ class?: string;
589
+ };
590
+ }
591
+ /** The chart's legend: shadcn's `ChartLegend` (recharts' `Legend`). */
592
+ export declare class ChartLegend extends Part<ChartLegendSignature> {
593
+ readonly kind = "legend";
594
+ }
595
+ export {};
596
+ //# sourceMappingURL=parts.d.ts.map