@sproutsocial/seeds-react-data-viz 0.27.2 → 0.28.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/{annotations-CjFoRPXf.d.mts → annotations-YfJndb5S.d.mts} +2 -2
- package/dist/{annotations-CjFoRPXf.d.ts → annotations-YfJndb5S.d.ts} +2 -2
- package/dist/{axis-DVx6Mn1k.d.mts → axis-Byl9vNMR.d.mts} +9 -9
- package/dist/{axis-DQXvjzBs.d.ts → axis-Cn8NAgwb.d.ts} +9 -9
- package/dist/bar/index.d.mts +25 -47
- package/dist/bar/index.d.ts +25 -47
- package/dist/bar/index.js +14 -14
- package/dist/bar/index.js.map +1 -1
- package/dist/bubble/index.d.mts +29 -40
- package/dist/bubble/index.d.ts +29 -40
- package/dist/bubble/index.js +18 -20
- package/dist/bubble/index.js.map +1 -1
- package/dist/{chartExport-CKYpuhik.d.mts → chartExport-B0imEQ8Y.d.mts} +4 -4
- package/dist/{chartExport-CKYpuhik.d.ts → chartExport-B0imEQ8Y.d.ts} +4 -4
- package/dist/{chartBase-Cd405GIA.d.mts → chartProps-BgGx1GTo.d.mts} +67 -23
- package/dist/{chartBase-BYipK7MZ.d.ts → chartProps-C2Lxty-_.d.ts} +67 -23
- package/dist/{chunk-WMKO3RGT.js → chunk-2S7XMWJ4.js} +3 -3
- package/dist/chunk-2S7XMWJ4.js.map +1 -0
- package/dist/{chunk-6EIJCJCN.js → chunk-I72SSPMX.js} +1 -1
- package/dist/chunk-I72SSPMX.js.map +1 -0
- package/dist/{chunk-CV45MD47.js → chunk-RDS2VCPO.js} +3 -3
- package/dist/chunk-RDS2VCPO.js.map +1 -0
- package/dist/{chunk-5TWNMPQU.js → chunk-V5EXL244.js} +73 -63
- package/dist/chunk-V5EXL244.js.map +1 -0
- package/dist/{chunk-34OKRQET.js → chunk-XH7ZKGHD.js} +5 -5
- package/dist/{chunk-34OKRQET.js.map → chunk-XH7ZKGHD.js.map} +1 -1
- package/dist/donut/index.d.mts +21 -36
- package/dist/donut/index.d.ts +21 -36
- package/dist/donut/index.js +8 -8
- package/dist/donut/index.js.map +1 -1
- package/dist/esm/bar/index.js +5 -5
- package/dist/esm/bar/index.js.map +1 -1
- package/dist/esm/bubble/index.js +10 -12
- package/dist/esm/bubble/index.js.map +1 -1
- package/dist/esm/{chunk-P3MVYSHX.js → chunk-37QVUJXM.js} +1 -1
- package/dist/esm/chunk-37QVUJXM.js.map +1 -0
- package/dist/esm/{chunk-332X77M5.js → chunk-JNQC3ZRQ.js} +3 -3
- package/dist/esm/chunk-JNQC3ZRQ.js.map +1 -0
- package/dist/esm/{chunk-MVNO5UV6.js → chunk-NBMVFYDJ.js} +2 -2
- package/dist/esm/chunk-NBMVFYDJ.js.map +1 -0
- package/dist/esm/{chunk-AL3OTBTT.js → chunk-THDIQMFN.js} +2 -2
- package/dist/esm/chunk-THDIQMFN.js.map +1 -0
- package/dist/esm/{chunk-CYCKJ5ML.js → chunk-YCYACOQU.js} +34 -24
- package/dist/esm/chunk-YCYACOQU.js.map +1 -0
- package/dist/esm/donut/index.js +3 -3
- package/dist/esm/donut/index.js.map +1 -1
- package/dist/esm/export/index.js.map +1 -1
- package/dist/esm/index.js +4 -4
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/line-area/index.js +5 -5
- package/dist/esm/line-area/index.js.map +1 -1
- package/dist/esm/sparkline/index.js +3 -3
- package/dist/esm/sparkline/index.js.map +1 -1
- package/dist/esm/wordcloud/index.js +4 -3
- package/dist/esm/wordcloud/index.js.map +1 -1
- package/dist/export/index.d.mts +5 -5
- package/dist/export/index.d.ts +5 -5
- package/dist/export/index.js.map +1 -1
- package/dist/index.js +92 -92
- package/dist/index.js.map +1 -1
- package/dist/{interactions-pEXA1XxF.d.ts → interactions-D2a4O6iM.d.mts} +8 -8
- package/dist/{interactions-pEXA1XxF.d.mts → interactions-D2a4O6iM.d.ts} +8 -8
- package/dist/line-area/index.d.mts +22 -48
- package/dist/line-area/index.d.ts +22 -48
- package/dist/line-area/index.js +14 -14
- package/dist/line-area/index.js.map +1 -1
- package/dist/pointerClick-4LUDwS3L.d.mts +15 -0
- package/dist/pointerClick-4LUDwS3L.d.ts +15 -0
- package/dist/sparkline/index.d.mts +24 -33
- package/dist/sparkline/index.d.ts +24 -33
- package/dist/sparkline/index.js +7 -7
- package/dist/sparkline/index.js.map +1 -1
- package/dist/wordcloud/index.d.mts +22 -20
- package/dist/wordcloud/index.d.ts +22 -20
- package/dist/wordcloud/index.js +11 -10
- package/dist/wordcloud/index.js.map +1 -1
- package/package.json +11 -11
- package/dist/chunk-5TWNMPQU.js.map +0 -1
- package/dist/chunk-6EIJCJCN.js.map +0 -1
- package/dist/chunk-CV45MD47.js.map +0 -1
- package/dist/chunk-WMKO3RGT.js.map +0 -1
- package/dist/esm/chunk-332X77M5.js.map +0 -1
- package/dist/esm/chunk-AL3OTBTT.js.map +0 -1
- package/dist/esm/chunk-CYCKJ5ML.js.map +0 -1
- package/dist/esm/chunk-MVNO5UV6.js.map +0 -1
- package/dist/esm/chunk-P3MVYSHX.js.map +0 -1
|
@@ -4,7 +4,7 @@ import { TypeIconName } from '@sproutsocial/seeds-react-icon';
|
|
|
4
4
|
* Declarative annotation shape — the DS renders the marker and tooltip header
|
|
5
5
|
* internally; consumers don't supply render functions. See CE-7.
|
|
6
6
|
*/
|
|
7
|
-
interface
|
|
7
|
+
interface TypeChartAnnotation {
|
|
8
8
|
/** Numeric x-axis coordinate — a category index (category axes) or the raw coordinate (datetime/linear axes). */
|
|
9
9
|
position: number;
|
|
10
10
|
/** Icon shown above the chart at `position` and inline with `title` in the tooltip header. */
|
|
@@ -17,4 +17,4 @@ interface ChartAnnotation {
|
|
|
17
17
|
description?: string;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
export type {
|
|
20
|
+
export type { TypeChartAnnotation as T };
|
|
@@ -4,7 +4,7 @@ import { TypeIconName } from '@sproutsocial/seeds-react-icon';
|
|
|
4
4
|
* Declarative annotation shape — the DS renders the marker and tooltip header
|
|
5
5
|
* internally; consumers don't supply render functions. See CE-7.
|
|
6
6
|
*/
|
|
7
|
-
interface
|
|
7
|
+
interface TypeChartAnnotation {
|
|
8
8
|
/** Numeric x-axis coordinate — a category index (category axes) or the raw coordinate (datetime/linear axes). */
|
|
9
9
|
position: number;
|
|
10
10
|
/** Icon shown above the chart at `position` and inline with `title` in the tooltip header. */
|
|
@@ -17,4 +17,4 @@ interface ChartAnnotation {
|
|
|
17
17
|
description?: string;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
export type {
|
|
20
|
+
export type { TypeChartAnnotation as T };
|
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { g as TypeDatetimeTimeFormat } from './chartProps-BgGx1GTo.mjs';
|
|
2
2
|
|
|
3
3
|
/** A datetime data point: `[msSinceEpoch, value]` tuple or `{ x, y }` object. */
|
|
4
|
-
type
|
|
4
|
+
type TypeDatetimePoint = [number, number | null] | {
|
|
5
5
|
x: number;
|
|
6
6
|
y: number | null;
|
|
7
7
|
};
|
|
8
8
|
/** A value on a category axis, or a datetime point when the axis is `"datetime"`. */
|
|
9
|
-
type
|
|
9
|
+
type TypeChartDataPoint = number | null | TypeDatetimePoint;
|
|
10
10
|
/** Category axis — labels indexed parallel to `series.data`. The default axis type. */
|
|
11
|
-
interface
|
|
11
|
+
interface TypeCategoryAxis {
|
|
12
12
|
type?: "category";
|
|
13
13
|
/** Category labels, indexed parallel to `series.data`. */
|
|
14
|
-
categories:
|
|
14
|
+
categories: string[];
|
|
15
15
|
crosshair?: boolean;
|
|
16
16
|
}
|
|
17
17
|
/** Datetime axis — `series.data` carries timestamped points. */
|
|
18
|
-
interface
|
|
18
|
+
interface TypeDatetimeAxis {
|
|
19
19
|
type: "datetime";
|
|
20
20
|
crosshair?: boolean;
|
|
21
21
|
/**
|
|
22
22
|
* 12- or 24-hour clock for hour-granularity tick labels (e.g. `9 AM` vs
|
|
23
23
|
* `09:00`). Default `"12"`. Coarser granularities (day/month/year) ignore it.
|
|
24
24
|
*/
|
|
25
|
-
timeFormat?:
|
|
25
|
+
timeFormat?: TypeDatetimeTimeFormat;
|
|
26
26
|
}
|
|
27
27
|
/** The dimensional (non-value) axis of an X/Y chart: category or datetime. */
|
|
28
|
-
type
|
|
28
|
+
type TypeDimensionalAxis = TypeCategoryAxis | TypeDatetimeAxis;
|
|
29
29
|
|
|
30
|
-
export type {
|
|
30
|
+
export type { TypeChartDataPoint as T, TypeCategoryAxis as a, TypeDatetimeAxis as b, TypeDatetimePoint as c, TypeDimensionalAxis as d };
|
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { g as TypeDatetimeTimeFormat } from './chartProps-C2Lxty-_.js';
|
|
2
2
|
|
|
3
3
|
/** A datetime data point: `[msSinceEpoch, value]` tuple or `{ x, y }` object. */
|
|
4
|
-
type
|
|
4
|
+
type TypeDatetimePoint = [number, number | null] | {
|
|
5
5
|
x: number;
|
|
6
6
|
y: number | null;
|
|
7
7
|
};
|
|
8
8
|
/** A value on a category axis, or a datetime point when the axis is `"datetime"`. */
|
|
9
|
-
type
|
|
9
|
+
type TypeChartDataPoint = number | null | TypeDatetimePoint;
|
|
10
10
|
/** Category axis — labels indexed parallel to `series.data`. The default axis type. */
|
|
11
|
-
interface
|
|
11
|
+
interface TypeCategoryAxis {
|
|
12
12
|
type?: "category";
|
|
13
13
|
/** Category labels, indexed parallel to `series.data`. */
|
|
14
|
-
categories:
|
|
14
|
+
categories: string[];
|
|
15
15
|
crosshair?: boolean;
|
|
16
16
|
}
|
|
17
17
|
/** Datetime axis — `series.data` carries timestamped points. */
|
|
18
|
-
interface
|
|
18
|
+
interface TypeDatetimeAxis {
|
|
19
19
|
type: "datetime";
|
|
20
20
|
crosshair?: boolean;
|
|
21
21
|
/**
|
|
22
22
|
* 12- or 24-hour clock for hour-granularity tick labels (e.g. `9 AM` vs
|
|
23
23
|
* `09:00`). Default `"12"`. Coarser granularities (day/month/year) ignore it.
|
|
24
24
|
*/
|
|
25
|
-
timeFormat?:
|
|
25
|
+
timeFormat?: TypeDatetimeTimeFormat;
|
|
26
26
|
}
|
|
27
27
|
/** The dimensional (non-value) axis of an X/Y chart: category or datetime. */
|
|
28
|
-
type
|
|
28
|
+
type TypeDimensionalAxis = TypeCategoryAxis | TypeDatetimeAxis;
|
|
29
29
|
|
|
30
|
-
export type {
|
|
30
|
+
export type { TypeChartDataPoint as T, TypeCategoryAxis as a, TypeDatetimeAxis as b, TypeDatetimePoint as c, TypeDimensionalAxis as d };
|
package/dist/bar/index.d.mts
CHANGED
|
@@ -1,89 +1,67 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
import { C as ChartDataPoint, a as CategoryAxis, D as DatetimeAxis, b as DatetimePoint } from '../axis-DVx6Mn1k.mjs';
|
|
2
|
+
import { T as TypeChartAnnotation } from '../annotations-YfJndb5S.mjs';
|
|
3
|
+
import { T as TypeChartColorableEntity, a as TypeChartIconableEntity, b as TypeChartClickHandler, c as TypeChartHoverHandler } from '../interactions-D2a4O6iM.mjs';
|
|
4
|
+
export { d as TypeChartHoverSeries } from '../interactions-D2a4O6iM.mjs';
|
|
5
|
+
import { T as TypeChartBaseProps, a as TypeChartSizingProps, b as TypeChartTooltipDisplayProps, c as TypeChartTooltipClickFooterProps, d as TypeValueFormat } from '../chartProps-BgGx1GTo.mjs';
|
|
6
|
+
import { T as TypeChartDataPoint, a as TypeCategoryAxis, b as TypeDatetimeAxis, c as TypeDatetimePoint } from '../axis-Byl9vNMR.mjs';
|
|
7
|
+
export { T as TypeChartExportHandle } from '../chartExport-B0imEQ8Y.mjs';
|
|
9
8
|
import '@sproutsocial/seeds-react-icon';
|
|
10
9
|
import '../types-DxrhdAdn.mjs';
|
|
11
10
|
import 'highcharts';
|
|
12
11
|
|
|
13
|
-
type
|
|
14
|
-
type
|
|
15
|
-
interface
|
|
12
|
+
type TypeBarDatetimePoint = TypeDatetimePoint;
|
|
13
|
+
type TypeBarDataPoint = TypeChartDataPoint;
|
|
14
|
+
interface TypeBarSeries extends TypeChartColorableEntity, TypeChartIconableEntity {
|
|
16
15
|
/** Y-values for each category, or `[timestamp, value]` / `{ x, y }` points on a datetime axis. */
|
|
17
|
-
data:
|
|
16
|
+
data: TypeBarDataPoint[];
|
|
18
17
|
}
|
|
19
|
-
type
|
|
20
|
-
interface
|
|
18
|
+
type TypeBarXAxis = TypeCategoryAxis | TypeDatetimeAxis;
|
|
19
|
+
interface TypeBarYAxis {
|
|
21
20
|
min?: number;
|
|
22
21
|
max?: number;
|
|
23
22
|
/** Default: true. */
|
|
24
23
|
showGridLines?: boolean;
|
|
25
24
|
title?: string;
|
|
26
25
|
/** Declarative value formatting for axis tick labels and tooltip values. */
|
|
27
|
-
format?:
|
|
26
|
+
format?: TypeValueFormat;
|
|
28
27
|
/** Show y-axis tick labels. Default `true`. */
|
|
29
28
|
showLabels?: boolean;
|
|
30
29
|
}
|
|
31
|
-
type
|
|
32
|
-
interface
|
|
33
|
-
|
|
34
|
-
description: string;
|
|
35
|
-
series: Array<BarSeries>;
|
|
36
|
-
/** Tailwind / class passthrough appended to the container class chain. */
|
|
37
|
-
className?: string;
|
|
38
|
-
/** Chart height in pixels. Defaults to the time-series baseline (275). */
|
|
39
|
-
height?: number;
|
|
30
|
+
type TypeBarChartDirection = "vertical" | "horizontal";
|
|
31
|
+
interface TypeBarChartProps extends TypeChartBaseProps, TypeChartSizingProps, TypeChartTooltipDisplayProps, TypeChartTooltipClickFooterProps {
|
|
32
|
+
series: TypeBarSeries[];
|
|
40
33
|
/** Orientation of the bars. `"vertical"` (default) renders columns; `"horizontal"` renders bars. */
|
|
41
|
-
direction?:
|
|
34
|
+
direction?: TypeBarChartDirection;
|
|
42
35
|
/** Maximum number of series to display. Series beyond the limit are dropped. Default `10`. */
|
|
43
36
|
seriesLimit?: number;
|
|
44
37
|
/** Suppress the `console.warn` when series count exceeds the limit. The cap still applies. Default `false`. */
|
|
45
38
|
hideSeriesLimitWarning?: boolean;
|
|
46
|
-
xAxis:
|
|
47
|
-
yAxis?:
|
|
39
|
+
xAxis: TypeBarXAxis;
|
|
40
|
+
yAxis?: TypeBarYAxis;
|
|
48
41
|
/** IANA timezone for datetime-axis ticks and tooltips. Default `"UTC"`. Ignored for category axes. */
|
|
49
42
|
timezone?: string;
|
|
50
43
|
/** Stacking mode. `"normal"` stacks series (default); `"percent"` normalizes to 100%; `"grouped"` renders adjacent bars. */
|
|
51
44
|
stacking?: "normal" | "percent" | "grouped";
|
|
52
|
-
/** Override for the default tooltip content. */
|
|
53
|
-
tooltip?: (args: ChartTooltipProps) => ReactNode;
|
|
54
45
|
/** Declarative annotations rendered at positions on the chart. */
|
|
55
|
-
annotations?:
|
|
46
|
+
annotations?: TypeChartAnnotation[];
|
|
56
47
|
/** Click handler invoked with the category name or timestamp of the clicked bar. */
|
|
57
|
-
onClick?:
|
|
48
|
+
onClick?: TypeChartClickHandler;
|
|
58
49
|
/**
|
|
59
50
|
* Fired when the pointer enters a bar (also on keyboard focus), with the
|
|
60
51
|
* category name or timestamp of the bar as `position`. For a multi-series bar
|
|
61
52
|
* chart the payload also carries `series: { name, index }` identifying the
|
|
62
53
|
* hovered series; it is omitted for single-series charts.
|
|
63
54
|
*/
|
|
64
|
-
onMouseEnter?:
|
|
55
|
+
onMouseEnter?: TypeChartHoverHandler;
|
|
65
56
|
/**
|
|
66
57
|
* Fired when the pointer leaves a bar (also on keyboard blur), with the
|
|
67
58
|
* category name or timestamp of the bar as `position`. For a multi-series bar
|
|
68
59
|
* chart the payload also carries `series: { name, index }` identifying the
|
|
69
60
|
* hovered series; it is omitted for single-series charts.
|
|
70
61
|
*/
|
|
71
|
-
onMouseLeave?:
|
|
72
|
-
/** Footer content shown in the default tooltip when `onClick` is set. */
|
|
73
|
-
tooltipClickLabel?: ReactNode;
|
|
74
|
-
/** Override for the value shown when a data point is null. Defaults to an em-dash. */
|
|
75
|
-
invalidNumberLabel?: ReactNode;
|
|
76
|
-
/**
|
|
77
|
-
* Chart title included in the exported image (PNG/SVG/PDF) only — it does
|
|
78
|
-
* *not* render on screen. The on-screen title is a React sibling outside the
|
|
79
|
-
* chart SVG and can't be captured on export, so `exportTitle` is baked into
|
|
80
|
-
* the export clone as a themed native Highcharts title. Omit for no title.
|
|
81
|
-
*/
|
|
82
|
-
exportTitle?: string;
|
|
83
|
-
/** Fired once per chart instance with a handle for PNG/SVG/PDF/CSV downloads. Re-fires only on remount. */
|
|
84
|
-
onReady?: (handle: ChartExportHandle) => void;
|
|
62
|
+
onMouseLeave?: TypeChartHoverHandler;
|
|
85
63
|
}
|
|
86
64
|
|
|
87
|
-
declare const BarChart: react.NamedExoticComponent<
|
|
65
|
+
declare const BarChart: react.NamedExoticComponent<TypeBarChartProps>;
|
|
88
66
|
|
|
89
|
-
export { BarChart, type
|
|
67
|
+
export { BarChart, type TypeBarChartDirection, type TypeBarChartProps, type TypeBarDataPoint, type TypeBarDatetimePoint, type TypeBarSeries, type TypeBarXAxis, type TypeBarYAxis, TypeCategoryAxis, TypeChartClickHandler, TypeChartHoverHandler, TypeDatetimeAxis, TypeValueFormat };
|
package/dist/bar/index.d.ts
CHANGED
|
@@ -1,89 +1,67 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
import { C as ChartDataPoint, a as CategoryAxis, D as DatetimeAxis, b as DatetimePoint } from '../axis-DQXvjzBs.js';
|
|
2
|
+
import { T as TypeChartAnnotation } from '../annotations-YfJndb5S.js';
|
|
3
|
+
import { T as TypeChartColorableEntity, a as TypeChartIconableEntity, b as TypeChartClickHandler, c as TypeChartHoverHandler } from '../interactions-D2a4O6iM.js';
|
|
4
|
+
export { d as TypeChartHoverSeries } from '../interactions-D2a4O6iM.js';
|
|
5
|
+
import { T as TypeChartBaseProps, a as TypeChartSizingProps, b as TypeChartTooltipDisplayProps, c as TypeChartTooltipClickFooterProps, d as TypeValueFormat } from '../chartProps-C2Lxty-_.js';
|
|
6
|
+
import { T as TypeChartDataPoint, a as TypeCategoryAxis, b as TypeDatetimeAxis, c as TypeDatetimePoint } from '../axis-Cn8NAgwb.js';
|
|
7
|
+
export { T as TypeChartExportHandle } from '../chartExport-B0imEQ8Y.js';
|
|
9
8
|
import '@sproutsocial/seeds-react-icon';
|
|
10
9
|
import '../types-DxrhdAdn.js';
|
|
11
10
|
import 'highcharts';
|
|
12
11
|
|
|
13
|
-
type
|
|
14
|
-
type
|
|
15
|
-
interface
|
|
12
|
+
type TypeBarDatetimePoint = TypeDatetimePoint;
|
|
13
|
+
type TypeBarDataPoint = TypeChartDataPoint;
|
|
14
|
+
interface TypeBarSeries extends TypeChartColorableEntity, TypeChartIconableEntity {
|
|
16
15
|
/** Y-values for each category, or `[timestamp, value]` / `{ x, y }` points on a datetime axis. */
|
|
17
|
-
data:
|
|
16
|
+
data: TypeBarDataPoint[];
|
|
18
17
|
}
|
|
19
|
-
type
|
|
20
|
-
interface
|
|
18
|
+
type TypeBarXAxis = TypeCategoryAxis | TypeDatetimeAxis;
|
|
19
|
+
interface TypeBarYAxis {
|
|
21
20
|
min?: number;
|
|
22
21
|
max?: number;
|
|
23
22
|
/** Default: true. */
|
|
24
23
|
showGridLines?: boolean;
|
|
25
24
|
title?: string;
|
|
26
25
|
/** Declarative value formatting for axis tick labels and tooltip values. */
|
|
27
|
-
format?:
|
|
26
|
+
format?: TypeValueFormat;
|
|
28
27
|
/** Show y-axis tick labels. Default `true`. */
|
|
29
28
|
showLabels?: boolean;
|
|
30
29
|
}
|
|
31
|
-
type
|
|
32
|
-
interface
|
|
33
|
-
|
|
34
|
-
description: string;
|
|
35
|
-
series: Array<BarSeries>;
|
|
36
|
-
/** Tailwind / class passthrough appended to the container class chain. */
|
|
37
|
-
className?: string;
|
|
38
|
-
/** Chart height in pixels. Defaults to the time-series baseline (275). */
|
|
39
|
-
height?: number;
|
|
30
|
+
type TypeBarChartDirection = "vertical" | "horizontal";
|
|
31
|
+
interface TypeBarChartProps extends TypeChartBaseProps, TypeChartSizingProps, TypeChartTooltipDisplayProps, TypeChartTooltipClickFooterProps {
|
|
32
|
+
series: TypeBarSeries[];
|
|
40
33
|
/** Orientation of the bars. `"vertical"` (default) renders columns; `"horizontal"` renders bars. */
|
|
41
|
-
direction?:
|
|
34
|
+
direction?: TypeBarChartDirection;
|
|
42
35
|
/** Maximum number of series to display. Series beyond the limit are dropped. Default `10`. */
|
|
43
36
|
seriesLimit?: number;
|
|
44
37
|
/** Suppress the `console.warn` when series count exceeds the limit. The cap still applies. Default `false`. */
|
|
45
38
|
hideSeriesLimitWarning?: boolean;
|
|
46
|
-
xAxis:
|
|
47
|
-
yAxis?:
|
|
39
|
+
xAxis: TypeBarXAxis;
|
|
40
|
+
yAxis?: TypeBarYAxis;
|
|
48
41
|
/** IANA timezone for datetime-axis ticks and tooltips. Default `"UTC"`. Ignored for category axes. */
|
|
49
42
|
timezone?: string;
|
|
50
43
|
/** Stacking mode. `"normal"` stacks series (default); `"percent"` normalizes to 100%; `"grouped"` renders adjacent bars. */
|
|
51
44
|
stacking?: "normal" | "percent" | "grouped";
|
|
52
|
-
/** Override for the default tooltip content. */
|
|
53
|
-
tooltip?: (args: ChartTooltipProps) => ReactNode;
|
|
54
45
|
/** Declarative annotations rendered at positions on the chart. */
|
|
55
|
-
annotations?:
|
|
46
|
+
annotations?: TypeChartAnnotation[];
|
|
56
47
|
/** Click handler invoked with the category name or timestamp of the clicked bar. */
|
|
57
|
-
onClick?:
|
|
48
|
+
onClick?: TypeChartClickHandler;
|
|
58
49
|
/**
|
|
59
50
|
* Fired when the pointer enters a bar (also on keyboard focus), with the
|
|
60
51
|
* category name or timestamp of the bar as `position`. For a multi-series bar
|
|
61
52
|
* chart the payload also carries `series: { name, index }` identifying the
|
|
62
53
|
* hovered series; it is omitted for single-series charts.
|
|
63
54
|
*/
|
|
64
|
-
onMouseEnter?:
|
|
55
|
+
onMouseEnter?: TypeChartHoverHandler;
|
|
65
56
|
/**
|
|
66
57
|
* Fired when the pointer leaves a bar (also on keyboard blur), with the
|
|
67
58
|
* category name or timestamp of the bar as `position`. For a multi-series bar
|
|
68
59
|
* chart the payload also carries `series: { name, index }` identifying the
|
|
69
60
|
* hovered series; it is omitted for single-series charts.
|
|
70
61
|
*/
|
|
71
|
-
onMouseLeave?:
|
|
72
|
-
/** Footer content shown in the default tooltip when `onClick` is set. */
|
|
73
|
-
tooltipClickLabel?: ReactNode;
|
|
74
|
-
/** Override for the value shown when a data point is null. Defaults to an em-dash. */
|
|
75
|
-
invalidNumberLabel?: ReactNode;
|
|
76
|
-
/**
|
|
77
|
-
* Chart title included in the exported image (PNG/SVG/PDF) only — it does
|
|
78
|
-
* *not* render on screen. The on-screen title is a React sibling outside the
|
|
79
|
-
* chart SVG and can't be captured on export, so `exportTitle` is baked into
|
|
80
|
-
* the export clone as a themed native Highcharts title. Omit for no title.
|
|
81
|
-
*/
|
|
82
|
-
exportTitle?: string;
|
|
83
|
-
/** Fired once per chart instance with a handle for PNG/SVG/PDF/CSV downloads. Re-fires only on remount. */
|
|
84
|
-
onReady?: (handle: ChartExportHandle) => void;
|
|
62
|
+
onMouseLeave?: TypeChartHoverHandler;
|
|
85
63
|
}
|
|
86
64
|
|
|
87
|
-
declare const BarChart: react.NamedExoticComponent<
|
|
65
|
+
declare const BarChart: react.NamedExoticComponent<TypeBarChartProps>;
|
|
88
66
|
|
|
89
|
-
export { BarChart, type
|
|
67
|
+
export { BarChart, type TypeBarChartDirection, type TypeBarChartProps, type TypeBarDataPoint, type TypeBarDatetimePoint, type TypeBarSeries, type TypeBarXAxis, type TypeBarYAxis, TypeCategoryAxis, TypeChartClickHandler, TypeChartHoverHandler, TypeDatetimeAxis, TypeValueFormat };
|
package/dist/bar/index.js
CHANGED
|
@@ -2,22 +2,22 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var _chunk2S7XMWJ4js = require('../chunk-2S7XMWJ4.js');
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var _chunkRDS2VCPOjs = require('../chunk-RDS2VCPO.js');
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _chunkI72SSPMXjs = require('../chunk-I72SSPMX.js');
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
var
|
|
17
|
+
var _chunkV5EXL244js = require('../chunk-V5EXL244.js');
|
|
18
18
|
|
|
19
19
|
|
|
20
|
-
var
|
|
20
|
+
var _chunkXH7ZKGHDjs = require('../chunk-XH7ZKGHD.js');
|
|
21
21
|
|
|
22
22
|
// src/charts/bar/BarChart.tsx
|
|
23
23
|
var _react = require('react');
|
|
@@ -30,8 +30,8 @@ function buildBarChartOptions(props, direction, series = props.series) {
|
|
|
30
30
|
const chartType = highchartsType(direction);
|
|
31
31
|
const isDatetime = props.xAxis.type === "datetime";
|
|
32
32
|
const isMultiSeries = series.length > 1;
|
|
33
|
-
const tooltipOptions =
|
|
34
|
-
const { annotations, lookup: annotationLookup } =
|
|
33
|
+
const tooltipOptions = _chunkRDS2VCPOjs.resolveTooltipOptions.call(void 0, props);
|
|
34
|
+
const { annotations, lookup: annotationLookup } = _chunk2S7XMWJ4js.buildAnnotationConfig.call(void 0,
|
|
35
35
|
props.annotations
|
|
36
36
|
);
|
|
37
37
|
const barTypeConfig = {
|
|
@@ -91,7 +91,7 @@ function buildBarChartOptions(props, direction, series = props.series) {
|
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
93
|
};
|
|
94
|
-
const base =
|
|
94
|
+
const base = _chunkV5EXL244js.buildBaseChartOptions.call(void 0, {
|
|
95
95
|
type: chartType,
|
|
96
96
|
description: props.description,
|
|
97
97
|
reserveTopMargin: Boolean(annotations),
|
|
@@ -106,13 +106,13 @@ function buildBarChartOptions(props, direction, series = props.series) {
|
|
|
106
106
|
// Re-assert the definite `type` so spreading the optionally-typed
|
|
107
107
|
// `base.chart` doesn't widen the required `type` field to optional.
|
|
108
108
|
type: chartType,
|
|
109
|
-
height: _nullishCoalesce(props.height, () => (
|
|
109
|
+
height: _nullishCoalesce(props.height, () => ( _chunkXH7ZKGHDjs.TIME_SERIES_CHART_HEIGHT)),
|
|
110
110
|
// Tight time-series spacing (from constants/chartOptions.ts) so the plot
|
|
111
111
|
// area fills the 275px container; without it Highcharts' larger default
|
|
112
112
|
// spacing ([10, 10, 15, 10]) shrinks the plot area.
|
|
113
113
|
spacing: [5, 1, 0, 2]
|
|
114
114
|
},
|
|
115
|
-
xAxis:
|
|
115
|
+
xAxis: _chunkRDS2VCPOjs.buildDimensionalAxis.call(void 0, props.xAxis, _nullishCoalesce(tooltipOptions.timezone, () => ( "UTC"))),
|
|
116
116
|
yAxis: {
|
|
117
117
|
min: _optionalChain([props, 'access', _15 => _15.yAxis, 'optionalAccess', _16 => _16.min]),
|
|
118
118
|
max: _optionalChain([props, 'access', _17 => _17.yAxis, 'optionalAccess', _18 => _18.max]),
|
|
@@ -126,7 +126,7 @@ function buildBarChartOptions(props, direction, series = props.series) {
|
|
|
126
126
|
enabled: _optionalChain([props, 'access', _23 => _23.yAxis, 'optionalAccess', _24 => _24.showLabels]) !== false,
|
|
127
127
|
// A declarative `format` drives ticks through the shared valueFormatter;
|
|
128
128
|
// absent it, the zero-config decimal default (1.20K / 1.20M / 1.20B).
|
|
129
|
-
formatter: _optionalChain([props, 'access', _25 => _25.yAxis, 'optionalAccess', _26 => _26.format]) ?
|
|
129
|
+
formatter: _optionalChain([props, 'access', _25 => _25.yAxis, 'optionalAccess', _26 => _26.format]) ? _chunk2S7XMWJ4js.makeValueAxisLabelFormatter.call(void 0, props.yAxis.format) : _chunk2S7XMWJ4js.defaultValueAxisLabelFormatter
|
|
130
130
|
}
|
|
131
131
|
},
|
|
132
132
|
plotOptions: {
|
|
@@ -151,7 +151,7 @@ var BAR_CHART_DEFAULT_SERIES_LIMIT = 10;
|
|
|
151
151
|
var _jsxruntime = require('react/jsx-runtime');
|
|
152
152
|
var BarChart = _react.memo.call(void 0, function BarChart2(props) {
|
|
153
153
|
const seriesLimit = _nullishCoalesce(props.seriesLimit, () => ( BAR_CHART_DEFAULT_SERIES_LIMIT));
|
|
154
|
-
const { colors, series } =
|
|
154
|
+
const { colors, series } = _chunkV5EXL244js.useSeedsChartSetup.call(void 0, {
|
|
155
155
|
series: props.series,
|
|
156
156
|
seriesLimit,
|
|
157
157
|
isSeriesLimitOverridden: props.seriesLimit !== void 0,
|
|
@@ -164,14 +164,14 @@ var BarChart = _react.memo.call(void 0, function BarChart2(props) {
|
|
|
164
164
|
series
|
|
165
165
|
);
|
|
166
166
|
const hasOnClick = Boolean(props.onClick);
|
|
167
|
-
const containerProps =
|
|
167
|
+
const containerProps = _chunkI72SSPMXjs.getChartContainerProps.call(void 0, {
|
|
168
168
|
familyClasses: ["seeds-chart-time-series", "seeds-chart-bar"],
|
|
169
169
|
colors: series.map((s) => s.color),
|
|
170
170
|
hasOnClick,
|
|
171
171
|
className: props.className
|
|
172
172
|
});
|
|
173
173
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { ...containerProps, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
174
|
-
|
|
174
|
+
_chunkV5EXL244js.ChartRenderer,
|
|
175
175
|
{
|
|
176
176
|
options,
|
|
177
177
|
series,
|
package/dist/bar/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/_work/seeds/seeds/seeds-react/seeds-react-data-viz/dist/bar/index.js","../../src/charts/bar/BarChart.tsx","../../src/charts/bar/adapter.ts","../../src/charts/constants.ts"],"names":["BarChart"],"mappings":"AAAA;AACE;AACA;AACA;AACF,uDAA6B;AAC7B;AACE;AACA;AACF,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,iBAAA,EAAmB,KAAA,CAAM,iBAAA;AAAA,MACzB,cAAA;AAAA,MACA,kBAAA,EAAoB,KAAA,CAAM,kBAAA;AAAA,MAC1B,WAAA,kBAAa,KAAA,uBAAM,KAAA,+BAAO,QAAA;AAAA,MAC1B,WAAA,EAAa,KAAA,CAAM,WAAA;AAAA,MACnB,OAAA,EAAS,KAAA,CAAM;AAAA,IAAA;AAAA,EACjB,EAAA,CACF,CAAA;AAEJ,CAAC,CAAA;ADqID;AACE;AACF,4BAAC","file":"/home/runner/_work/seeds/seeds/seeds-react/seeds-react-data-viz/dist/bar/index.js","sourcesContent":[null,"import { memo } from \"react\";\nimport { useSeedsChartSetup, ChartRenderer } from \"../shared/chartBase\";\nimport { getChartContainerProps } from \"../shared/chartContainer\";\nimport { buildBarChartOptions } from \"./adapter\";\nimport type { BarChartProps } from \"./types\";\nimport { BAR_CHART_DEFAULT_SERIES_LIMIT } from \"../constants\";\n\nexport const BarChart = memo(function BarChart(props: BarChartProps) {\n // The shared hook caps the series to the limit (and warns once per render\n // when the default is exceeded without an explicit override) so the adapter\n // and renderer below all consume the capped data.\n const seriesLimit = props.seriesLimit ?? BAR_CHART_DEFAULT_SERIES_LIMIT;\n const { colors, series } = useSeedsChartSetup({\n series: props.series,\n seriesLimit,\n isSeriesLimitOverridden: props.seriesLimit !== undefined,\n hideSeriesLimitWarning: props.hideSeriesLimitWarning,\n componentName: \"BarChart\",\n });\n\n const { options, annotationLookup, tooltipOptions } = buildBarChartOptions(\n props,\n props.direction ?? \"vertical\",\n series\n );\n const hasOnClick = Boolean(props.onClick);\n\n // Plain <div> consuming the shared chart-styles.css contract via\n // getChartContainerProps. Colors are the RAW per-series colors (undefined when\n // unset, so only explicit overrides inline --highcharts-color-N), NOT the\n // palette-resolved `colors` passed to ChartRenderer. Neither stylesheet is\n // self-imported (consumers import both).\n const containerProps = getChartContainerProps({\n familyClasses: [\"seeds-chart-time-series\", \"seeds-chart-bar\"],\n colors: series.map((s) => s.color),\n hasOnClick,\n className: props.className,\n });\n\n return (\n <div {...containerProps}>\n <ChartRenderer\n options={options}\n series={series}\n colors={colors}\n tooltip={props.tooltip}\n annotationLookup={annotationLookup}\n hasOnClick={hasOnClick}\n tooltipClickLabel={props.tooltipClickLabel}\n tooltipOptions={tooltipOptions}\n invalidNumberLabel={props.invalidNumberLabel}\n valueFormat={props.yAxis?.format}\n exportTitle={props.exportTitle}\n onReady={props.onReady}\n />\n </div>\n );\n});\n","import { buildAnnotationConfig } from \"../shared/annotations\";\nimport type { ChartAnnotationLookup } from \"../shared/annotations\";\nimport type {\n ChartTooltipProps,\n SeedsChartColumnPlotOptions,\n SeedsChartOptions,\n} from \"../shared/chartBase\";\nimport { buildBaseChartOptions } from \"../shared/baseChartOptions\";\nimport { TIME_SERIES_CHART_HEIGHT } from \"../../constants/chartOptions\";\nimport {\n buildDimensionalAxis,\n resolveTooltipOptions,\n} from \"../shared/axisOptions\";\nimport {\n defaultValueAxisLabelFormatter,\n makeValueAxisLabelFormatter,\n} from \"../shared/valueAxisLabelFormatter\";\nimport type { BarChartDirection, BarChartProps } from \"./types\";\n\n// Maps the public `direction` to the Highcharts series/chart type. Highcharts\n// `bar` is a horizontally-oriented `column`: it performs the visual rotation\n// while keeping axis roles (xAxis = category, yAxis = value), so the rest of the\n// adapter is direction-agnostic.\nfunction highchartsType(direction: BarChartDirection): \"column\" | \"bar\" {\n return direction === \"horizontal\" ? \"bar\" : \"column\";\n}\n\nexport function buildBarChartOptions(\n props: BarChartProps,\n direction: BarChartDirection,\n // The (already-capped) series to render. Defaults to `props.series` so the\n // ~40 existing call sites keep working; the component passes the capped\n // series from `useSeedsChartSetup` explicitly.\n series: BarChartProps[\"series\"] = props.series\n): {\n options: SeedsChartOptions;\n annotationLookup: ChartAnnotationLookup | undefined;\n /** Resolved datetime-derived tooltip options (timezone / timeFormat / textLocale); all undefined on category axes. */\n tooltipOptions: Pick<\n ChartTooltipProps,\n \"timezone\" | \"timeFormat\" | \"textLocale\"\n >;\n} {\n const chartType = highchartsType(direction);\n const isDatetime = props.xAxis.type === \"datetime\";\n // Gate the `onMouseEnter`/`onMouseLeave` `series` field on the *rendered*\n // (already-capped) series count, not `props.series` — if `seriesLimit` caps a\n // multi-series input down to one rendered series the chart is effectively\n // single-series, and `series` must be absent per the \"present only for\n // multi-series bar\" contract.\n const isMultiSeries = series.length > 1;\n const tooltipOptions = resolveTooltipOptions(props);\n const { annotations, lookup: annotationLookup } = buildAnnotationConfig(\n props.annotations\n );\n // `column` (vertical) and `bar` (horizontal) take the same option shape, so a\n // single config is assigned under the active direction's key. Typed\n // explicitly so the `point.events` handlers below keep their `this`/`event`\n // contextual types (a computed `[chartType]` key would otherwise erase them).\n const barTypeConfig: SeedsChartColumnPlotOptions = {\n // \"grouped\" maps to omitting `stacking` — Highcharts renders multi-series\n // columns side-by-side when no stacking is set.\n ...(props.stacking === \"grouped\"\n ? {}\n : { stacking: props.stacking ?? \"normal\" }),\n // Horizontal bars are height-constrained (fixed chart height ÷ categories),\n // so the same padding fractions that work for columns produce hairline bars.\n pointPadding: direction === \"horizontal\" ? 0.05 : 0.25,\n groupPadding: direction === \"horizontal\" ? 0.1 : 0.25,\n // Fixed bar width on datetime axes. Sparse time-series otherwise size\n // columns from the (large) gap between points and balloon; a fixed\n // pointWidth: 20 gives a consistent time-series treatment. Dense datetime\n // data may instead want a maxPointWidth cap — revisit when Line/Area land.\n ...(isDatetime ? { pointWidth: 20 } : {}),\n borderRadius: 4,\n borderWidth: 0,\n // Pairs with the `:hover` dimming rule in `styles.ts`: while the cursor\n // is over the chart, all bars dim; these handlers restore opacity for\n // every bar at the hovered x (so stacked/grouped bars highlight together\n // rather than just the single hovered bar).\n point: {\n events: {\n click: props.onClick\n ? (event) => props.onClick!({ position: event.point.x })\n : undefined,\n mouseOver: function () {\n const x = this.x;\n props.onMouseEnter?.({\n position: x,\n // Omit the key entirely (not `series: undefined`) for single-series\n // so consumers testing `\"series\" in payload` see the contract.\n ...(isMultiSeries\n ? {\n series: { name: this.series.name, index: this.series.index },\n }\n : {}),\n });\n this.series.chart.series.forEach((s) => {\n if (s.type !== chartType) return;\n s.data.forEach((point) => {\n if (point.x !== x) return;\n point.graphic?.element?.classList.add(\"bar-point-hover\");\n });\n });\n },\n mouseOut: function () {\n props.onMouseLeave?.({\n position: this.x,\n ...(isMultiSeries\n ? {\n series: { name: this.series.name, index: this.series.index },\n }\n : {}),\n });\n this.series.chart.series.forEach((s) => {\n if (s.type !== chartType) return;\n s.data.forEach((point) => {\n point.graphic?.element?.classList.remove(\"bar-point-hover\");\n });\n });\n },\n },\n },\n };\n const base = buildBaseChartOptions({\n type: chartType,\n description: props.description,\n reserveTopMargin: Boolean(annotations),\n timezone: tooltipOptions.timezone,\n });\n\n const options: SeedsChartOptions = {\n ...base,\n // Default height baseline (overridable via `props.height`) so consumers\n // who don't configure sizing keep the design-reviewed default.\n chart: {\n ...base.chart,\n // Re-assert the definite `type` so spreading the optionally-typed\n // `base.chart` doesn't widen the required `type` field to optional.\n type: chartType,\n height: props.height ?? TIME_SERIES_CHART_HEIGHT,\n // Tight time-series spacing (from constants/chartOptions.ts) so the plot\n // area fills the 275px container; without it Highcharts' larger default\n // spacing ([10, 10, 15, 10]) shrinks the plot area.\n spacing: [5, 1, 0, 2],\n },\n xAxis: buildDimensionalAxis(props.xAxis, tooltipOptions.timezone ?? \"UTC\"),\n yAxis: {\n min: props.yAxis?.min,\n max: props.yAxis?.max,\n gridLineWidth: props.yAxis?.showGridLines === false ? 0 : 1,\n // A dedicated plotLine at 0, styled distinctly from regular gridlines\n // (see chartStyles.ts).\n plotLines: [{ value: 0, className: \"y-axis-zero-line\", zIndex: 3 }],\n title: { text: props.yAxis?.title ?? \"\" },\n labels: {\n // `showLabels` toggles tick-label visibility; defaults to shown.\n enabled: props.yAxis?.showLabels !== false,\n // A declarative `format` drives ticks through the shared valueFormatter;\n // absent it, the zero-config decimal default (1.20K / 1.20M / 1.20B).\n formatter: props.yAxis?.format\n ? makeValueAxisLabelFormatter(props.yAxis.format)\n : defaultValueAxisLabelFormatter,\n },\n },\n plotOptions: {\n series: { animation: false },\n [chartType]: barTypeConfig,\n },\n series: series.map((s) => ({\n type: chartType,\n name: s.name,\n data: [...s.data],\n color: s.color,\n })),\n ...(annotations ? { annotations } : {}),\n };\n\n return { options, annotationLookup, tooltipOptions };\n}\n","export const BAR_CHART_DEFAULT_SERIES_LIMIT = 10;\n"]}
|
|
1
|
+
{"version":3,"sources":["/home/runner/_work/seeds/seeds/seeds-react/seeds-react-data-viz/dist/bar/index.js","../../src/charts/bar/BarChart.tsx","../../src/charts/bar/adapter.ts","../../src/charts/constants.ts"],"names":["BarChart"],"mappings":"AAAA;AACE;AACA;AACA;AACF,uDAA6B;AAC7B;AACE;AACA;AACF,uDAA6B;AAC7B;AACE;AACF,uDAA6B;AAC7B;AACE;AACA;AACA;AACF,uDAA6B;AAC7B;AACE;AACF,uDAA6B;AAC7B;AACA;ACrBA,8BAAqB;ADuBrB;AACA;AEDA,SAAS,cAAA,CAAe,SAAA,EAAoD;AAC1E,EAAA,OAAO,UAAA,IAAc,aAAA,EAAe,MAAA,EAAQ,QAAA;AAC9C;AAEO,SAAS,oBAAA,CACd,KAAA,EACA,SAAA,EAIA,OAAA,EAAsC,KAAA,CAAM,MAAA,EAS5C;AACA,EAAA,MAAM,UAAA,EAAY,cAAA,CAAe,SAAS,CAAA;AAC1C,EAAA,MAAM,WAAA,EAAa,KAAA,CAAM,KAAA,CAAM,KAAA,IAAS,UAAA;AAMxC,EAAA,MAAM,cAAA,EAAgB,MAAA,CAAO,OAAA,EAAS,CAAA;AACtC,EAAA,MAAM,eAAA,EAAiB,oDAAA,KAA2B,CAAA;AAClD,EAAA,MAAM,EAAE,WAAA,EAAa,MAAA,EAAQ,iBAAiB,EAAA,EAAI,oDAAA;AAAA,IAChD,KAAA,CAAM;AAAA,EACR,CAAA;AAKA,EAAA,MAAM,cAAA,EAAiD;AAAA;AAAA;AAAA,IAGrD,GAAI,KAAA,C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uB,IAC5C,aAAA,EAAe,CAAC,yBAAA,EAA2B,iBAAiB,CAAA;AAAA,IAC5D,MAAA,EAAQ,MAAA,CAAO,GAAA,CAAI,CAAC,CAAA,EAAA,GAAM,CAAA,CAAE,KAAK,CAAA;AAAA,IACjC,UAAA;AAAA,IACA,SAAA,EAAW,KAAA,CAAM;AAAA,EACnB,CAAC,CAAA;AAED,EAAA,uBACE,6BAAA,KAAC,EAAA,EAAK,GAAG,cAAA,EACP,QAAA,kBAAA,6BAAA;AAAA,IAAC,8BAAA;AAAA,IAAA;AAAA,MACC,OAAA;AAAA,MACA,MAAA;AAAA,MACA,MAAA;AAAA,MACA,OAAA,EAAS,KAAA,CAAM,OAAA;AAAA,MACf,gBAAA;AAAA,MACA,UAAA;AAAA,MACA,iBAAA,EAAmB,KAAA,CAAM,iBAAA;AAAA,MACzB,cAAA;AAAA,MACA,kBAAA,EAAoB,KAAA,CAAM,kBAAA;AAAA,MAC1B,WAAA,kBAAa,KAAA,uBAAM,KAAA,+BAAO,QAAA;AAAA,MAC1B,WAAA,EAAa,KAAA,CAAM,WAAA;AAAA,MACnB,OAAA,EAAS,KAAA,CAAM;AAAA,IAAA;AAAA,EACjB,EAAA,CACF,CAAA;AAEJ,CAAC,CAAA;ADqID;AACE;AACF,4BAAC","file":"/home/runner/_work/seeds/seeds/seeds-react/seeds-react-data-viz/dist/bar/index.js","sourcesContent":[null,"import { memo } from \"react\";\nimport { useSeedsChartSetup, ChartRenderer } from \"../shared/chartBase\";\nimport { getChartContainerProps } from \"../shared/chartContainer\";\nimport { buildBarChartOptions } from \"./adapter\";\nimport type { TypeBarChartProps } from \"./types\";\nimport { BAR_CHART_DEFAULT_SERIES_LIMIT } from \"../constants\";\n\nexport const BarChart = memo(function BarChart(props: TypeBarChartProps) {\n // The shared hook caps the series to the limit (and warns once per render\n // when the default is exceeded without an explicit override) so the adapter\n // and renderer below all consume the capped data.\n const seriesLimit = props.seriesLimit ?? BAR_CHART_DEFAULT_SERIES_LIMIT;\n const { colors, series } = useSeedsChartSetup({\n series: props.series,\n seriesLimit,\n isSeriesLimitOverridden: props.seriesLimit !== undefined,\n hideSeriesLimitWarning: props.hideSeriesLimitWarning,\n componentName: \"BarChart\",\n });\n\n const { options, annotationLookup, tooltipOptions } = buildBarChartOptions(\n props,\n props.direction ?? \"vertical\",\n series\n );\n const hasOnClick = Boolean(props.onClick);\n\n // Plain <div> consuming the shared chart-styles.css contract via\n // getChartContainerProps. Colors are the RAW per-series colors (undefined when\n // unset, so only explicit overrides inline --highcharts-color-N), NOT the\n // palette-resolved `colors` passed to ChartRenderer. Neither stylesheet is\n // self-imported (consumers import both).\n const containerProps = getChartContainerProps({\n familyClasses: [\"seeds-chart-time-series\", \"seeds-chart-bar\"],\n colors: series.map((s) => s.color),\n hasOnClick,\n className: props.className,\n });\n\n return (\n <div {...containerProps}>\n <ChartRenderer\n options={options}\n series={series}\n colors={colors}\n tooltip={props.tooltip}\n annotationLookup={annotationLookup}\n hasOnClick={hasOnClick}\n tooltipClickLabel={props.tooltipClickLabel}\n tooltipOptions={tooltipOptions}\n invalidNumberLabel={props.invalidNumberLabel}\n valueFormat={props.yAxis?.format}\n exportTitle={props.exportTitle}\n onReady={props.onReady}\n />\n </div>\n );\n});\n","import { buildAnnotationConfig } from \"../shared/annotations\";\nimport type { TypeChartAnnotationLookup } from \"../shared/annotations\";\nimport type {\n TypeSeedsChartColumnPlotOptions,\n TypeSeedsChartOptions,\n} from \"../shared/chartBase\";\nimport type { TypeChartTooltipRenderProps } from \"../shared/chartTooltip\";\nimport { buildBaseChartOptions } from \"../shared/baseChartOptions\";\nimport { TIME_SERIES_CHART_HEIGHT } from \"../../constants/chartOptions\";\nimport {\n buildDimensionalAxis,\n resolveTooltipOptions,\n} from \"../shared/axisOptions\";\nimport {\n defaultValueAxisLabelFormatter,\n makeValueAxisLabelFormatter,\n} from \"../shared/valueAxisLabelFormatter\";\nimport type { TypeBarChartDirection, TypeBarChartProps } from \"./types\";\n\n// Maps the public `direction` to the Highcharts series/chart type. Highcharts\n// `bar` is a horizontally-oriented `column`: it performs the visual rotation\n// while keeping axis roles (xAxis = category, yAxis = value), so the rest of the\n// adapter is direction-agnostic.\nfunction highchartsType(direction: TypeBarChartDirection): \"column\" | \"bar\" {\n return direction === \"horizontal\" ? \"bar\" : \"column\";\n}\n\nexport function buildBarChartOptions(\n props: TypeBarChartProps,\n direction: TypeBarChartDirection,\n // The (already-capped) series to render. Defaults to `props.series` so the\n // ~40 existing call sites keep working; the component passes the capped\n // series from `useSeedsChartSetup` explicitly.\n series: TypeBarChartProps[\"series\"] = props.series\n): {\n options: TypeSeedsChartOptions;\n annotationLookup: TypeChartAnnotationLookup | undefined;\n /** Resolved datetime-derived tooltip options (timezone / timeFormat / textLocale); all undefined on category axes. */\n tooltipOptions: Pick<\n TypeChartTooltipRenderProps,\n \"timezone\" | \"timeFormat\" | \"textLocale\"\n >;\n} {\n const chartType = highchartsType(direction);\n const isDatetime = props.xAxis.type === \"datetime\";\n // Gate the `onMouseEnter`/`onMouseLeave` `series` field on the *rendered*\n // (already-capped) series count, not `props.series` — if `seriesLimit` caps a\n // multi-series input down to one rendered series the chart is effectively\n // single-series, and `series` must be absent per the \"present only for\n // multi-series bar\" contract.\n const isMultiSeries = series.length > 1;\n const tooltipOptions = resolveTooltipOptions(props);\n const { annotations, lookup: annotationLookup } = buildAnnotationConfig(\n props.annotations\n );\n // `column` (vertical) and `bar` (horizontal) take the same option shape, so a\n // single config is assigned under the active direction's key. Typed\n // explicitly so the `point.events` handlers below keep their `this`/`event`\n // contextual types (a computed `[chartType]` key would otherwise erase them).\n const barTypeConfig: TypeSeedsChartColumnPlotOptions = {\n // \"grouped\" maps to omitting `stacking` — Highcharts renders multi-series\n // columns side-by-side when no stacking is set.\n ...(props.stacking === \"grouped\"\n ? {}\n : { stacking: props.stacking ?? \"normal\" }),\n // Horizontal bars are height-constrained (fixed chart height ÷ categories),\n // so the same padding fractions that work for columns produce hairline bars.\n pointPadding: direction === \"horizontal\" ? 0.05 : 0.25,\n groupPadding: direction === \"horizontal\" ? 0.1 : 0.25,\n // Fixed bar width on datetime axes. Sparse time-series otherwise size\n // columns from the (large) gap between points and balloon; a fixed\n // pointWidth: 20 gives a consistent time-series treatment. Dense datetime\n // data may instead want a maxPointWidth cap — revisit when Line/Area land.\n ...(isDatetime ? { pointWidth: 20 } : {}),\n borderRadius: 4,\n borderWidth: 0,\n // Pairs with the `:hover` dimming rule in `styles.ts`: while the cursor\n // is over the chart, all bars dim; these handlers restore opacity for\n // every bar at the hovered x (so stacked/grouped bars highlight together\n // rather than just the single hovered bar).\n point: {\n events: {\n click: props.onClick\n ? (event) => props.onClick!({ position: event.point.x })\n : undefined,\n mouseOver: function () {\n const x = this.x;\n props.onMouseEnter?.({\n position: x,\n // Omit the key entirely (not `series: undefined`) for single-series\n // so consumers testing `\"series\" in payload` see the contract.\n ...(isMultiSeries\n ? {\n series: { name: this.series.name, index: this.series.index },\n }\n : {}),\n });\n this.series.chart.series.forEach((s) => {\n if (s.type !== chartType) return;\n s.data.forEach((point) => {\n if (point.x !== x) return;\n point.graphic?.element?.classList.add(\"bar-point-hover\");\n });\n });\n },\n mouseOut: function () {\n props.onMouseLeave?.({\n position: this.x,\n ...(isMultiSeries\n ? {\n series: { name: this.series.name, index: this.series.index },\n }\n : {}),\n });\n this.series.chart.series.forEach((s) => {\n if (s.type !== chartType) return;\n s.data.forEach((point) => {\n point.graphic?.element?.classList.remove(\"bar-point-hover\");\n });\n });\n },\n },\n },\n };\n const base = buildBaseChartOptions({\n type: chartType,\n description: props.description,\n reserveTopMargin: Boolean(annotations),\n timezone: tooltipOptions.timezone,\n });\n\n const options: TypeSeedsChartOptions = {\n ...base,\n // Default height baseline (overridable via `props.height`) so consumers\n // who don't configure sizing keep the design-reviewed default.\n chart: {\n ...base.chart,\n // Re-assert the definite `type` so spreading the optionally-typed\n // `base.chart` doesn't widen the required `type` field to optional.\n type: chartType,\n height: props.height ?? TIME_SERIES_CHART_HEIGHT,\n // Tight time-series spacing (from constants/chartOptions.ts) so the plot\n // area fills the 275px container; without it Highcharts' larger default\n // spacing ([10, 10, 15, 10]) shrinks the plot area.\n spacing: [5, 1, 0, 2],\n },\n xAxis: buildDimensionalAxis(props.xAxis, tooltipOptions.timezone ?? \"UTC\"),\n yAxis: {\n min: props.yAxis?.min,\n max: props.yAxis?.max,\n gridLineWidth: props.yAxis?.showGridLines === false ? 0 : 1,\n // A dedicated plotLine at 0, styled distinctly from regular gridlines\n // (see chartStyles.ts).\n plotLines: [{ value: 0, className: \"y-axis-zero-line\", zIndex: 3 }],\n title: { text: props.yAxis?.title ?? \"\" },\n labels: {\n // `showLabels` toggles tick-label visibility; defaults to shown.\n enabled: props.yAxis?.showLabels !== false,\n // A declarative `format` drives ticks through the shared valueFormatter;\n // absent it, the zero-config decimal default (1.20K / 1.20M / 1.20B).\n formatter: props.yAxis?.format\n ? makeValueAxisLabelFormatter(props.yAxis.format)\n : defaultValueAxisLabelFormatter,\n },\n },\n plotOptions: {\n series: { animation: false },\n [chartType]: barTypeConfig,\n },\n series: series.map((s) => ({\n type: chartType,\n name: s.name,\n data: [...s.data],\n color: s.color,\n })),\n ...(annotations ? { annotations } : {}),\n };\n\n return { options, annotationLookup, tooltipOptions };\n}\n","export const BAR_CHART_DEFAULT_SERIES_LIMIT = 10;\n"]}
|