@bison-lab/ui 5.9.1 → 5.12.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/dist/charts.d.mts +157 -4
- package/dist/charts.d.mts.map +1 -1
- package/dist/charts.mjs +751 -149
- package/dist/charts.mjs.map +1 -1
- package/dist/index.d.mts +161 -20
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +535 -269
- package/dist/index.mjs.map +1 -1
- package/dist/validators.d.mts +33 -1
- package/dist/validators.d.mts.map +1 -1
- package/dist/validators.mjs +47 -1
- package/dist/validators.mjs.map +1 -1
- package/package.json +2 -2
package/dist/charts.d.mts
CHANGED
|
@@ -64,10 +64,15 @@ interface AreaChartProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "chi
|
|
|
64
64
|
curveType?: "monotone" | "linear" | "step" | "natural";
|
|
65
65
|
/** Stack areas. Default: false */
|
|
66
66
|
stacked?: boolean;
|
|
67
|
+
/** Text summary for screen readers: the chart region's accessible name. Default: `title`, else "Area chart" */
|
|
68
|
+
summary?: string;
|
|
69
|
+
/** Formats values in the tooltip and the screen reader table */
|
|
70
|
+
valueFormatter?: (value: number) => string;
|
|
67
71
|
}
|
|
68
72
|
declare const AreaChart: React.ForwardRefExoticComponent<AreaChartProps & React.RefAttributes<HTMLDivElement>>;
|
|
69
73
|
//#endregion
|
|
70
74
|
//#region src/components/bar-chart.d.ts
|
|
75
|
+
type Radius = [number, number, number, number];
|
|
71
76
|
interface BarChartSeries {
|
|
72
77
|
/** Data key corresponding to a field in the data array */
|
|
73
78
|
dataKey: string;
|
|
@@ -75,8 +80,12 @@ interface BarChartSeries {
|
|
|
75
80
|
name?: string;
|
|
76
81
|
/** Override color (any CSS color string) */
|
|
77
82
|
color?: string;
|
|
78
|
-
/**
|
|
79
|
-
|
|
83
|
+
/**
|
|
84
|
+
* Corner radius of the bar's outer end. Default: rounded outer end
|
|
85
|
+
* (`[4, 4, 0, 0]` upright, `[0, 4, 4, 0]` horizontal). In a stack only the
|
|
86
|
+
* outermost segment gets it.
|
|
87
|
+
*/
|
|
88
|
+
radius?: Radius;
|
|
80
89
|
}
|
|
81
90
|
interface BarChartProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "children"> {
|
|
82
91
|
/** Chart data — array of objects with keys matching `categories`/`series` */
|
|
@@ -101,12 +110,23 @@ interface BarChartProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "chil
|
|
|
101
110
|
showTooltip?: boolean;
|
|
102
111
|
/** Show Y-axis. Default: true */
|
|
103
112
|
showYAxis?: boolean;
|
|
104
|
-
/** Stack bars. Default: false */
|
|
113
|
+
/** Stack bars. Same as `stackMode="normal"`. Default: false */
|
|
105
114
|
stacked?: boolean;
|
|
115
|
+
/**
|
|
116
|
+
* `"normal"` stacks the raw values; `"percent"` stacks each category's
|
|
117
|
+
* share so every bar sums to 100%. Default: unstacked unless `stacked`.
|
|
118
|
+
*/
|
|
119
|
+
stackMode?: "normal" | "percent";
|
|
106
120
|
/** Horizontal layout (bars go left-to-right). Default: false */
|
|
107
121
|
horizontal?: boolean;
|
|
122
|
+
/** Width in px of the category axis in the horizontal layout. Default: 80 */
|
|
123
|
+
categoryAxisWidth?: number;
|
|
108
124
|
/** Clamp the numeric axis to [0, maxValue] instead of auto-scaling */
|
|
109
125
|
maxValue?: number;
|
|
126
|
+
/** Text summary for screen readers: the chart region's accessible name. Default: `title`, else "Bar chart" */
|
|
127
|
+
summary?: string;
|
|
128
|
+
/** Formats values in the tooltip and the screen reader table. Percent mode defaults to "n%" */
|
|
129
|
+
valueFormatter?: (value: number) => string;
|
|
110
130
|
}
|
|
111
131
|
declare const BarChart: React.ForwardRefExoticComponent<BarChartProps & React.RefAttributes<HTMLDivElement>>;
|
|
112
132
|
//#endregion
|
|
@@ -138,8 +158,141 @@ interface DonutChartProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "ch
|
|
|
138
158
|
paddingAngle?: number;
|
|
139
159
|
/** Center label content */
|
|
140
160
|
centerLabel?: React.ReactNode;
|
|
161
|
+
/** Text summary for screen readers: the chart region's accessible name. Default: `title`, else "Donut chart" */
|
|
162
|
+
summary?: string;
|
|
163
|
+
/** Formats values in the tooltip and the screen reader table */
|
|
164
|
+
valueFormatter?: (value: number) => string;
|
|
141
165
|
}
|
|
142
166
|
declare const DonutChart: React.ForwardRefExoticComponent<DonutChartProps & React.RefAttributes<HTMLDivElement>>;
|
|
143
167
|
//#endregion
|
|
144
|
-
|
|
168
|
+
//#region src/components/line-chart.d.ts
|
|
169
|
+
interface LineChartSeries {
|
|
170
|
+
/** Data key corresponding to a field in the data array */
|
|
171
|
+
dataKey: string;
|
|
172
|
+
/** Display name for legend/tooltip */
|
|
173
|
+
name?: string;
|
|
174
|
+
/** Override color (any CSS color string) */
|
|
175
|
+
color?: string;
|
|
176
|
+
/** Draw the line dashed (e.g. a comparison or a target). Default: false */
|
|
177
|
+
dashed?: boolean;
|
|
178
|
+
/** Show point markers on this series. Default: the chart's `showDots` */
|
|
179
|
+
showDots?: boolean;
|
|
180
|
+
}
|
|
181
|
+
interface LineChartReferenceLine {
|
|
182
|
+
/** Value on the numeric axis where the line sits */
|
|
183
|
+
value: number;
|
|
184
|
+
/** Text drawn beside the line, e.g. "Average" */
|
|
185
|
+
label?: string;
|
|
186
|
+
/** Override color (any CSS color string). Default: muted foreground */
|
|
187
|
+
color?: string;
|
|
188
|
+
}
|
|
189
|
+
interface LineChartProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "children"> {
|
|
190
|
+
/** Chart data — array of objects with keys matching `categories`/`series` */
|
|
191
|
+
data: Record<string, unknown>[];
|
|
192
|
+
/** Key used for the X-axis category labels */
|
|
193
|
+
index: string;
|
|
194
|
+
/** Quick setup: data keys to render as line series (uses theme colors) */
|
|
195
|
+
categories?: string[];
|
|
196
|
+
/** Advanced setup: full series config (takes precedence over `categories`) */
|
|
197
|
+
series?: LineChartSeries[];
|
|
198
|
+
/** Override theme colors (applied in order to series) */
|
|
199
|
+
colors?: string[];
|
|
200
|
+
/** Chart height preset */
|
|
201
|
+
size?: ChartSize;
|
|
202
|
+
/** Explicit height in px (overrides `size`) */
|
|
203
|
+
height?: number;
|
|
204
|
+
/** Show cartesian grid. Default: true */
|
|
205
|
+
showGrid?: boolean;
|
|
206
|
+
/** Show legend. Default: false */
|
|
207
|
+
showLegend?: boolean;
|
|
208
|
+
/** Show tooltip. Default: true */
|
|
209
|
+
showTooltip?: boolean;
|
|
210
|
+
/** Show Y-axis. Default: true */
|
|
211
|
+
showYAxis?: boolean;
|
|
212
|
+
/** Show point markers on every series. Default: false */
|
|
213
|
+
showDots?: boolean;
|
|
214
|
+
/** Line curve type. Default: "monotone" */
|
|
215
|
+
curveType?: "monotone" | "linear" | "step" | "natural";
|
|
216
|
+
/** A dashed horizontal line across the plot, e.g. an average */
|
|
217
|
+
referenceLine?: LineChartReferenceLine;
|
|
218
|
+
/** Numeric axis range. Default: recharts' automatic range */
|
|
219
|
+
yDomain?: [number, number];
|
|
220
|
+
/** Text summary for screen readers: the chart region's accessible name. Default: `title`, else "Line chart" */
|
|
221
|
+
summary?: string;
|
|
222
|
+
/** Formats values in the tooltip and the screen reader table */
|
|
223
|
+
valueFormatter?: (value: number) => string;
|
|
224
|
+
}
|
|
225
|
+
declare const LineChart: React.ForwardRefExoticComponent<LineChartProps & React.RefAttributes<HTMLDivElement>>;
|
|
226
|
+
//#endregion
|
|
227
|
+
//#region src/components/radar-chart.d.ts
|
|
228
|
+
interface RadarChartSeries {
|
|
229
|
+
/** Data key corresponding to a field in the data array */
|
|
230
|
+
dataKey: string;
|
|
231
|
+
/** Display name for legend/tooltip */
|
|
232
|
+
name?: string;
|
|
233
|
+
/** Override color (any CSS color string) */
|
|
234
|
+
color?: string;
|
|
235
|
+
/** Draw the outline dashed, e.g. a comparison. Default: false */
|
|
236
|
+
dashed?: boolean;
|
|
237
|
+
/** Fill opacity of the polygon (0–1). Default: 0.2, or 0 when dashed */
|
|
238
|
+
fillOpacity?: number;
|
|
239
|
+
}
|
|
240
|
+
interface RadarChartProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "children"> {
|
|
241
|
+
/** Chart data — one object per axis (spoke), with a value per series */
|
|
242
|
+
data: Record<string, unknown>[];
|
|
243
|
+
/** Key used for the axis (spoke) labels */
|
|
244
|
+
index: string;
|
|
245
|
+
/** Quick setup: data keys to render as polygons (uses theme colors) */
|
|
246
|
+
categories?: string[];
|
|
247
|
+
/** Advanced setup: full series config (takes precedence over `categories`) */
|
|
248
|
+
series?: RadarChartSeries[];
|
|
249
|
+
/** Override theme colors (applied in order to series) */
|
|
250
|
+
colors?: string[];
|
|
251
|
+
/** Chart height preset */
|
|
252
|
+
size?: ChartSize;
|
|
253
|
+
/** Explicit height in px (overrides `size`) */
|
|
254
|
+
height?: number;
|
|
255
|
+
/** Show the polar grid. Default: true */
|
|
256
|
+
showGrid?: boolean;
|
|
257
|
+
/** Show legend. Default: false */
|
|
258
|
+
showLegend?: boolean;
|
|
259
|
+
/** Show tooltip. Default: true */
|
|
260
|
+
showTooltip?: boolean;
|
|
261
|
+
/** Fix the outer ring at this value instead of auto-scaling (e.g. 100) */
|
|
262
|
+
maxValue?: number;
|
|
263
|
+
/** Text summary for screen readers: the chart region's accessible name. Default: `title`, else "Radar chart" */
|
|
264
|
+
summary?: string;
|
|
265
|
+
/** Formats values in the tooltip and the screen reader table */
|
|
266
|
+
valueFormatter?: (value: number) => string;
|
|
267
|
+
}
|
|
268
|
+
declare const RadarChart: React.ForwardRefExoticComponent<RadarChartProps & React.RefAttributes<HTMLDivElement>>;
|
|
269
|
+
//#endregion
|
|
270
|
+
//#region src/components/heatmap-grid.d.ts
|
|
271
|
+
interface HeatmapGridRow {
|
|
272
|
+
/** Row header text */
|
|
273
|
+
label: string;
|
|
274
|
+
/** One value per column (0 to `max`); `null` is a cell with no data */
|
|
275
|
+
values: ReadonlyArray<number | null | undefined>;
|
|
276
|
+
/** Override the row's color (hex, `rgb()` or `hsl()`) */
|
|
277
|
+
color?: string;
|
|
278
|
+
}
|
|
279
|
+
interface HeatmapGridProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "children"> {
|
|
280
|
+
/** Column headers, in order */
|
|
281
|
+
columns: ReadonlyArray<string>;
|
|
282
|
+
/** One row per series; each is tinted in its own color */
|
|
283
|
+
rows: ReadonlyArray<HeatmapGridRow>;
|
|
284
|
+
/** Override theme colors (applied in order to rows; hex, `rgb()` or `hsl()`) */
|
|
285
|
+
colors?: string[];
|
|
286
|
+
/** The value that gets the deepest tint. Default: 100 */
|
|
287
|
+
max?: number;
|
|
288
|
+
/** Header of the row-label column, read by screen readers. Default: "Row" */
|
|
289
|
+
rowHeader?: string;
|
|
290
|
+
/** Text summary for screen readers: the table's accessible name. Default: `title`, else "Heatmap" */
|
|
291
|
+
summary?: string;
|
|
292
|
+
/** Formats each printed value. Default: rounded percent, "42%" */
|
|
293
|
+
valueFormatter?: (value: number) => string;
|
|
294
|
+
}
|
|
295
|
+
declare const HeatmapGrid: React.ForwardRefExoticComponent<HeatmapGridProps & React.RefAttributes<HTMLDivElement>>;
|
|
296
|
+
//#endregion
|
|
297
|
+
export { AreaChart, type AreaChartProps, type AreaChartSeries, BarChart, type BarChartProps, type BarChartSeries, type ChartSize, DonutChart, type DonutChartProps, HeatmapGrid, type HeatmapGridProps, type HeatmapGridRow, LineChart, type LineChartProps, type LineChartReferenceLine, type LineChartSeries, RadarChart, type RadarChartProps, type RadarChartSeries, chartColorTokens, chartSizeMap, getThemeColors, resolveHslToken };
|
|
145
298
|
//# sourceMappingURL=charts.d.mts.map
|
package/dist/charts.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"charts.d.mts","names":[],"sources":["../src/lib/chart-utils.ts","../src/components/area-chart.tsx","../src/components/bar-chart.tsx","../src/components/donut-chart.tsx"],"mappings":";;;;;;;AAMA;;cAAa,gBAAA;;;AAYb;;iBAAgB,eAAA,CAAgB,KAAA,UAAe,EAAA,GAAK,OAAA;;;;;iBAepC,cAAA,CAAe,EAAA,GAAK,OAAA;;cAKvB,YAAA;EAAA;;;;KAMD,SAAA,gBAAyB,YAAA;;;
|
|
1
|
+
{"version":3,"file":"charts.d.mts","names":[],"sources":["../src/lib/chart-utils.ts","../src/components/area-chart.tsx","../src/components/bar-chart.tsx","../src/components/donut-chart.tsx","../src/components/line-chart.tsx","../src/components/radar-chart.tsx","../src/components/heatmap-grid.tsx"],"mappings":";;;;;;;AAMA;;cAAa,gBAAA;;;AAYb;;iBAAgB,eAAA,CAAgB,KAAA,UAAe,EAAA,GAAK,OAAA;;;;;iBAepC,cAAA,CAAe,EAAA,GAAK,OAAA;;cAKvB,YAAA;EAAA;;;;KAMD,SAAA,gBAAyB,YAAA;;;UCjBpB,eAAA;EDrBJ;ECuBX,OAAA;;EAEA,IAAA;EDnBQ;ECqBR,KAAA;EDf6B;ECiB7B,WAAA;AAAA;AAAA,UAGe,cAAA,SACP,IAAA,CAAK,KAAA,CAAM,cAAA,CAAe,cAAA;EDrBgB;ECuBlD,IAAA,EAAM,MAAA;EDvB0D;ECyBhE,KAAA;EDVc;ECYd,UAAA;;EAEA,MAAA,GAAS,eAAA;EDduC;ECgBhD,MAAA;EDPQ;ECSR,IAAA,GAAO,SAAA;EDTC;ECWR,MAAA;;EAEA,QAAA;;EAEA,UAAA;EDbU;ECeV,WAAA;;EAEA,SAAA;EDjB+C;ECmB/C,SAAA;;EAEA,OAAA;EAtCe;EAwCf,OAAA;;EAEA,cAAA,IAAkB,KAAA;AAAA;AAAA,cAGd,SAAA,EAAS,KAAA,CAAA,yBAAA,CAAA,cAAA,GAAA,KAAA,CAAA,aAAA,CAAA,cAAA;;;KC5CV,MAAA;AAAA,UAEY,cAAA;EFlBP;EEoBR,OAAA;EFpBQ;EEsBR,IAAA;EFhBc;EEkBd,KAAA;;;;;;EAMA,MAAA,GAAS,MAAA;AAAA;AAAA,UAGM,aAAA,SAAsB,IAAA,CACrC,KAAA,CAAM,cAAA,CAAe,cAA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