@sproutsocial/seeds-react-data-viz 0.27.3 → 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 +2 -2
- 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
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { TypeIconName } from '@sproutsocial/seeds-react-icon';
|
|
2
2
|
|
|
3
3
|
/** Base identity every chart data point or series carries. */
|
|
4
|
-
interface
|
|
4
|
+
interface TypeChartNamedEntity {
|
|
5
5
|
name: string;
|
|
6
6
|
}
|
|
7
7
|
/** A named entity with an optional per-entity color override — falls through to the shared data-viz palette when omitted. */
|
|
8
|
-
interface
|
|
8
|
+
interface TypeChartColorableEntity extends TypeChartNamedEntity {
|
|
9
9
|
color?: string;
|
|
10
10
|
}
|
|
11
11
|
/** A named entity with an optional Seeds icon or partner-logo name. */
|
|
12
|
-
interface
|
|
12
|
+
interface TypeChartIconableEntity extends TypeChartNamedEntity {
|
|
13
13
|
icon?: TypeIconName;
|
|
14
14
|
}
|
|
15
15
|
|
|
@@ -17,7 +17,7 @@ interface ChartIconableEntity extends ChartNamedEntity {
|
|
|
17
17
|
* Series identity attached to a multi-series bar hover. Absent for
|
|
18
18
|
* single-series bar and for line/area and donut.
|
|
19
19
|
*/
|
|
20
|
-
interface
|
|
20
|
+
interface TypeChartHoverSeries {
|
|
21
21
|
name: string;
|
|
22
22
|
index: number;
|
|
23
23
|
}
|
|
@@ -26,7 +26,7 @@ interface ChartHoverSeries {
|
|
|
26
26
|
* x-axis value (`number | string`) for bar and line/area, the slice `name`
|
|
27
27
|
* (`string`) for donut.
|
|
28
28
|
*/
|
|
29
|
-
type
|
|
29
|
+
type TypeChartClickHandler<P extends number | string = number | string> = ({ position }: {
|
|
30
30
|
position: P;
|
|
31
31
|
}) => void;
|
|
32
32
|
/**
|
|
@@ -36,9 +36,9 @@ type ChartClickHandler<P extends number | string = number | string> = ({ positio
|
|
|
36
36
|
* keyboard focus/blur, since Highcharts routes keyboard navigation through the
|
|
37
37
|
* same enter/leave events. `series` is present only for a multi-series bar.
|
|
38
38
|
*/
|
|
39
|
-
type
|
|
39
|
+
type TypeChartHoverHandler<P extends number | string = number | string> = ({ position, series, }: {
|
|
40
40
|
position: P;
|
|
41
|
-
series?:
|
|
41
|
+
series?: TypeChartHoverSeries;
|
|
42
42
|
}) => void;
|
|
43
43
|
|
|
44
|
-
export type {
|
|
44
|
+
export type { TypeChartColorableEntity as T, TypeChartIconableEntity as a, TypeChartClickHandler as b, TypeChartHoverHandler as c, TypeChartHoverSeries as d };
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { TypeIconName } from '@sproutsocial/seeds-react-icon';
|
|
2
2
|
|
|
3
3
|
/** Base identity every chart data point or series carries. */
|
|
4
|
-
interface
|
|
4
|
+
interface TypeChartNamedEntity {
|
|
5
5
|
name: string;
|
|
6
6
|
}
|
|
7
7
|
/** A named entity with an optional per-entity color override — falls through to the shared data-viz palette when omitted. */
|
|
8
|
-
interface
|
|
8
|
+
interface TypeChartColorableEntity extends TypeChartNamedEntity {
|
|
9
9
|
color?: string;
|
|
10
10
|
}
|
|
11
11
|
/** A named entity with an optional Seeds icon or partner-logo name. */
|
|
12
|
-
interface
|
|
12
|
+
interface TypeChartIconableEntity extends TypeChartNamedEntity {
|
|
13
13
|
icon?: TypeIconName;
|
|
14
14
|
}
|
|
15
15
|
|
|
@@ -17,7 +17,7 @@ interface ChartIconableEntity extends ChartNamedEntity {
|
|
|
17
17
|
* Series identity attached to a multi-series bar hover. Absent for
|
|
18
18
|
* single-series bar and for line/area and donut.
|
|
19
19
|
*/
|
|
20
|
-
interface
|
|
20
|
+
interface TypeChartHoverSeries {
|
|
21
21
|
name: string;
|
|
22
22
|
index: number;
|
|
23
23
|
}
|
|
@@ -26,7 +26,7 @@ interface ChartHoverSeries {
|
|
|
26
26
|
* x-axis value (`number | string`) for bar and line/area, the slice `name`
|
|
27
27
|
* (`string`) for donut.
|
|
28
28
|
*/
|
|
29
|
-
type
|
|
29
|
+
type TypeChartClickHandler<P extends number | string = number | string> = ({ position }: {
|
|
30
30
|
position: P;
|
|
31
31
|
}) => void;
|
|
32
32
|
/**
|
|
@@ -36,9 +36,9 @@ type ChartClickHandler<P extends number | string = number | string> = ({ positio
|
|
|
36
36
|
* keyboard focus/blur, since Highcharts routes keyboard navigation through the
|
|
37
37
|
* same enter/leave events. `series` is present only for a multi-series bar.
|
|
38
38
|
*/
|
|
39
|
-
type
|
|
39
|
+
type TypeChartHoverHandler<P extends number | string = number | string> = ({ position, series, }: {
|
|
40
40
|
position: P;
|
|
41
|
-
series?:
|
|
41
|
+
series?: TypeChartHoverSeries;
|
|
42
42
|
}) => void;
|
|
43
43
|
|
|
44
|
-
export type {
|
|
44
|
+
export type { TypeChartColorableEntity as T, TypeChartIconableEntity as a, TypeChartClickHandler as b, TypeChartHoverHandler as c, TypeChartHoverSeries as d };
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { C as ChartColorableEntity, a as ChartIconableEntity, b as ChartClickHandler, c as ChartHoverHandler } from '../interactions-pEXA1XxF.mjs';
|
|
7
|
-
import { C as ChartDataPoint, a as CategoryAxis, D as DatetimeAxis } 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
|
+
import { T as TypeChartBaseProps, a as TypeChartSizingProps, b as TypeChartTooltipDisplayProps, c as TypeChartTooltipClickFooterProps, d as TypeValueFormat } from '../chartProps-BgGx1GTo.mjs';
|
|
5
|
+
import { T as TypeChartDataPoint, a as TypeCategoryAxis, b as TypeDatetimeAxis } from '../axis-Byl9vNMR.mjs';
|
|
8
6
|
import { h as TypeChartStylePattern } from '../types-DxrhdAdn.mjs';
|
|
7
|
+
export { T as TypeChartExportHandle } from '../chartExport-B0imEQ8Y.mjs';
|
|
9
8
|
import '@sproutsocial/seeds-react-icon';
|
|
10
9
|
import 'highcharts';
|
|
11
10
|
|
|
@@ -14,18 +13,18 @@ import 'highcharts';
|
|
|
14
13
|
* `spline`/`areaspline` smooth them into curves; `area`/`areaspline` fill the
|
|
15
14
|
* region below the line. Maps directly to the Highcharts series type.
|
|
16
15
|
*/
|
|
17
|
-
type
|
|
18
|
-
interface
|
|
16
|
+
type TypeLineAreaVariant = "line" | "spline" | "area" | "areaspline";
|
|
17
|
+
interface TypeLineAreaSeries extends TypeChartColorableEntity, TypeChartIconableEntity {
|
|
19
18
|
/**
|
|
20
19
|
* Y-values indexed parallel to `xAxis.categories` on a category axis, or
|
|
21
20
|
* `[timestamp, value]` / `{ x, y }` points on a datetime axis.
|
|
22
21
|
*/
|
|
23
|
-
data:
|
|
22
|
+
data: TypeChartDataPoint[];
|
|
24
23
|
/** Line dash style. Applies to `line`/`spline` variants; a no-op on filled area variants. Default `"solid"`. */
|
|
25
24
|
pattern?: TypeChartStylePattern;
|
|
26
25
|
}
|
|
27
|
-
type
|
|
28
|
-
interface
|
|
26
|
+
type TypeLineAreaXAxis = TypeCategoryAxis | TypeDatetimeAxis;
|
|
27
|
+
interface TypeLineAreaYAxis {
|
|
29
28
|
min?: number;
|
|
30
29
|
max?: number;
|
|
31
30
|
/** Default: true. */
|
|
@@ -36,20 +35,14 @@ interface LineAreaYAxis {
|
|
|
36
35
|
* values (parity with the bar family). Omit for the zero-config decimal
|
|
37
36
|
* default (smart 1k/10k abbreviation).
|
|
38
37
|
*/
|
|
39
|
-
format?:
|
|
38
|
+
format?: TypeValueFormat;
|
|
40
39
|
}
|
|
41
|
-
interface
|
|
42
|
-
/** Wired into Highcharts' `accessibility.description`. */
|
|
43
|
-
description: string;
|
|
44
|
-
/** Applied to the chart's container element — e.g. Tailwind utility classes for sizing or spacing. */
|
|
45
|
-
className?: string;
|
|
46
|
-
/** Chart height in pixels. Defaults to the time-series baseline (275). */
|
|
47
|
-
height?: number;
|
|
40
|
+
interface TypeLineAreaChartProps extends TypeChartBaseProps, TypeChartSizingProps, TypeChartTooltipDisplayProps, TypeChartTooltipClickFooterProps {
|
|
48
41
|
/** Chart variant: `line` | `spline` | `area` | `areaspline`. */
|
|
49
|
-
variant:
|
|
50
|
-
series:
|
|
51
|
-
xAxis:
|
|
52
|
-
yAxis?:
|
|
42
|
+
variant: TypeLineAreaVariant;
|
|
43
|
+
series: TypeLineAreaSeries[];
|
|
44
|
+
xAxis: TypeLineAreaXAxis;
|
|
45
|
+
yAxis?: TypeLineAreaYAxis;
|
|
53
46
|
/** IANA timezone for datetime-axis ticks and tooltips. Default `"UTC"`. Ignored for category axes. */
|
|
54
47
|
timezone?: string;
|
|
55
48
|
/**
|
|
@@ -58,41 +51,22 @@ interface LineAreaChartProps {
|
|
|
58
51
|
* (a `stacked-area` chart); ignored on `line`/`spline`. Unstacked when omitted.
|
|
59
52
|
*/
|
|
60
53
|
stacking?: "normal" | "percent";
|
|
61
|
-
/** Override for the default tooltip content. */
|
|
62
|
-
tooltip?: (args: ChartTooltipProps) => ReactNode;
|
|
63
54
|
/** Declarative annotations rendered at positions on the chart. */
|
|
64
|
-
annotations?:
|
|
55
|
+
annotations?: TypeChartAnnotation[];
|
|
65
56
|
/** Click handler invoked with the x-axis value of the clicked point — the category name on a category axis, the numeric timestamp on a datetime axis. */
|
|
66
|
-
onClick?:
|
|
57
|
+
onClick?: TypeChartClickHandler;
|
|
67
58
|
/**
|
|
68
59
|
* Fired when the pointer enters a point (also on keyboard focus), with the
|
|
69
60
|
* x-axis value as `position` — the category name on a category axis, the
|
|
70
61
|
* numeric timestamp on a datetime axis.
|
|
71
62
|
*/
|
|
72
|
-
onMouseEnter?:
|
|
63
|
+
onMouseEnter?: TypeChartHoverHandler;
|
|
73
64
|
/**
|
|
74
65
|
* Fired when the pointer leaves a point (also on keyboard blur), with the
|
|
75
66
|
* x-axis value as `position` — the category name on a category axis, the
|
|
76
67
|
* numeric timestamp on a datetime axis.
|
|
77
68
|
*/
|
|
78
|
-
onMouseLeave?:
|
|
79
|
-
/** Footer content shown in the default tooltip when `onClick` is set. */
|
|
80
|
-
tooltipClickLabel?: ReactNode;
|
|
81
|
-
/** Override for the value shown when a data point is invalid/missing (null). Defaults to an em-dash. */
|
|
82
|
-
invalidNumberLabel?: ReactNode;
|
|
83
|
-
/**
|
|
84
|
-
* Chart title included in the exported image (PNG/SVG/PDF) only — it does
|
|
85
|
-
* *not* render on screen. The on-screen title is a React sibling outside the
|
|
86
|
-
* chart SVG and can't be captured on export, so `exportTitle` is baked into
|
|
87
|
-
* the export clone as a themed native Highcharts title. Omit for no title.
|
|
88
|
-
*/
|
|
89
|
-
exportTitle?: string;
|
|
90
|
-
/**
|
|
91
|
-
* Fired once per chart instance with an opaque {@link ChartExportHandle} for
|
|
92
|
-
* triggering PNG/SVG/PDF/CSV downloads. Re-fires only on a genuine remount,
|
|
93
|
-
* never on data or prop updates.
|
|
94
|
-
*/
|
|
95
|
-
onReady?: (handle: ChartExportHandle) => void;
|
|
69
|
+
onMouseLeave?: TypeChartHoverHandler;
|
|
96
70
|
}
|
|
97
71
|
|
|
98
72
|
/**
|
|
@@ -110,6 +84,6 @@ interface LineAreaChartProps {
|
|
|
110
84
|
* self-imports its stylesheet; consumers import both explicitly (see
|
|
111
85
|
* charts/README.md).
|
|
112
86
|
*/
|
|
113
|
-
declare const LineAreaChart: react.NamedExoticComponent<
|
|
87
|
+
declare const LineAreaChart: react.NamedExoticComponent<TypeLineAreaChartProps>;
|
|
114
88
|
|
|
115
|
-
export {
|
|
89
|
+
export { LineAreaChart, TypeCategoryAxis, TypeChartClickHandler, TypeChartHoverHandler, TypeDatetimeAxis, type TypeLineAreaChartProps, type TypeLineAreaSeries, type TypeLineAreaVariant, type TypeLineAreaXAxis, type TypeLineAreaYAxis };
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { C as ChartColorableEntity, a as ChartIconableEntity, b as ChartClickHandler, c as ChartHoverHandler } from '../interactions-pEXA1XxF.js';
|
|
7
|
-
import { C as ChartDataPoint, a as CategoryAxis, D as DatetimeAxis } 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
|
+
import { T as TypeChartBaseProps, a as TypeChartSizingProps, b as TypeChartTooltipDisplayProps, c as TypeChartTooltipClickFooterProps, d as TypeValueFormat } from '../chartProps-C2Lxty-_.js';
|
|
5
|
+
import { T as TypeChartDataPoint, a as TypeCategoryAxis, b as TypeDatetimeAxis } from '../axis-Cn8NAgwb.js';
|
|
8
6
|
import { h as TypeChartStylePattern } from '../types-DxrhdAdn.js';
|
|
7
|
+
export { T as TypeChartExportHandle } from '../chartExport-B0imEQ8Y.js';
|
|
9
8
|
import '@sproutsocial/seeds-react-icon';
|
|
10
9
|
import 'highcharts';
|
|
11
10
|
|
|
@@ -14,18 +13,18 @@ import 'highcharts';
|
|
|
14
13
|
* `spline`/`areaspline` smooth them into curves; `area`/`areaspline` fill the
|
|
15
14
|
* region below the line. Maps directly to the Highcharts series type.
|
|
16
15
|
*/
|
|
17
|
-
type
|
|
18
|
-
interface
|
|
16
|
+
type TypeLineAreaVariant = "line" | "spline" | "area" | "areaspline";
|
|
17
|
+
interface TypeLineAreaSeries extends TypeChartColorableEntity, TypeChartIconableEntity {
|
|
19
18
|
/**
|
|
20
19
|
* Y-values indexed parallel to `xAxis.categories` on a category axis, or
|
|
21
20
|
* `[timestamp, value]` / `{ x, y }` points on a datetime axis.
|
|
22
21
|
*/
|
|
23
|
-
data:
|
|
22
|
+
data: TypeChartDataPoint[];
|
|
24
23
|
/** Line dash style. Applies to `line`/`spline` variants; a no-op on filled area variants. Default `"solid"`. */
|
|
25
24
|
pattern?: TypeChartStylePattern;
|
|
26
25
|
}
|
|
27
|
-
type
|
|
28
|
-
interface
|
|
26
|
+
type TypeLineAreaXAxis = TypeCategoryAxis | TypeDatetimeAxis;
|
|
27
|
+
interface TypeLineAreaYAxis {
|
|
29
28
|
min?: number;
|
|
30
29
|
max?: number;
|
|
31
30
|
/** Default: true. */
|
|
@@ -36,20 +35,14 @@ interface LineAreaYAxis {
|
|
|
36
35
|
* values (parity with the bar family). Omit for the zero-config decimal
|
|
37
36
|
* default (smart 1k/10k abbreviation).
|
|
38
37
|
*/
|
|
39
|
-
format?:
|
|
38
|
+
format?: TypeValueFormat;
|
|
40
39
|
}
|
|
41
|
-
interface
|
|
42
|
-
/** Wired into Highcharts' `accessibility.description`. */
|
|
43
|
-
description: string;
|
|
44
|
-
/** Applied to the chart's container element — e.g. Tailwind utility classes for sizing or spacing. */
|
|
45
|
-
className?: string;
|
|
46
|
-
/** Chart height in pixels. Defaults to the time-series baseline (275). */
|
|
47
|
-
height?: number;
|
|
40
|
+
interface TypeLineAreaChartProps extends TypeChartBaseProps, TypeChartSizingProps, TypeChartTooltipDisplayProps, TypeChartTooltipClickFooterProps {
|
|
48
41
|
/** Chart variant: `line` | `spline` | `area` | `areaspline`. */
|
|
49
|
-
variant:
|
|
50
|
-
series:
|
|
51
|
-
xAxis:
|
|
52
|
-
yAxis?:
|
|
42
|
+
variant: TypeLineAreaVariant;
|
|
43
|
+
series: TypeLineAreaSeries[];
|
|
44
|
+
xAxis: TypeLineAreaXAxis;
|
|
45
|
+
yAxis?: TypeLineAreaYAxis;
|
|
53
46
|
/** IANA timezone for datetime-axis ticks and tooltips. Default `"UTC"`. Ignored for category axes. */
|
|
54
47
|
timezone?: string;
|
|
55
48
|
/**
|
|
@@ -58,41 +51,22 @@ interface LineAreaChartProps {
|
|
|
58
51
|
* (a `stacked-area` chart); ignored on `line`/`spline`. Unstacked when omitted.
|
|
59
52
|
*/
|
|
60
53
|
stacking?: "normal" | "percent";
|
|
61
|
-
/** Override for the default tooltip content. */
|
|
62
|
-
tooltip?: (args: ChartTooltipProps) => ReactNode;
|
|
63
54
|
/** Declarative annotations rendered at positions on the chart. */
|
|
64
|
-
annotations?:
|
|
55
|
+
annotations?: TypeChartAnnotation[];
|
|
65
56
|
/** Click handler invoked with the x-axis value of the clicked point — the category name on a category axis, the numeric timestamp on a datetime axis. */
|
|
66
|
-
onClick?:
|
|
57
|
+
onClick?: TypeChartClickHandler;
|
|
67
58
|
/**
|
|
68
59
|
* Fired when the pointer enters a point (also on keyboard focus), with the
|
|
69
60
|
* x-axis value as `position` — the category name on a category axis, the
|
|
70
61
|
* numeric timestamp on a datetime axis.
|
|
71
62
|
*/
|
|
72
|
-
onMouseEnter?:
|
|
63
|
+
onMouseEnter?: TypeChartHoverHandler;
|
|
73
64
|
/**
|
|
74
65
|
* Fired when the pointer leaves a point (also on keyboard blur), with the
|
|
75
66
|
* x-axis value as `position` — the category name on a category axis, the
|
|
76
67
|
* numeric timestamp on a datetime axis.
|
|
77
68
|
*/
|
|
78
|
-
onMouseLeave?:
|
|
79
|
-
/** Footer content shown in the default tooltip when `onClick` is set. */
|
|
80
|
-
tooltipClickLabel?: ReactNode;
|
|
81
|
-
/** Override for the value shown when a data point is invalid/missing (null). Defaults to an em-dash. */
|
|
82
|
-
invalidNumberLabel?: ReactNode;
|
|
83
|
-
/**
|
|
84
|
-
* Chart title included in the exported image (PNG/SVG/PDF) only — it does
|
|
85
|
-
* *not* render on screen. The on-screen title is a React sibling outside the
|
|
86
|
-
* chart SVG and can't be captured on export, so `exportTitle` is baked into
|
|
87
|
-
* the export clone as a themed native Highcharts title. Omit for no title.
|
|
88
|
-
*/
|
|
89
|
-
exportTitle?: string;
|
|
90
|
-
/**
|
|
91
|
-
* Fired once per chart instance with an opaque {@link ChartExportHandle} for
|
|
92
|
-
* triggering PNG/SVG/PDF/CSV downloads. Re-fires only on a genuine remount,
|
|
93
|
-
* never on data or prop updates.
|
|
94
|
-
*/
|
|
95
|
-
onReady?: (handle: ChartExportHandle) => void;
|
|
69
|
+
onMouseLeave?: TypeChartHoverHandler;
|
|
96
70
|
}
|
|
97
71
|
|
|
98
72
|
/**
|
|
@@ -110,6 +84,6 @@ interface LineAreaChartProps {
|
|
|
110
84
|
* self-imports its stylesheet; consumers import both explicitly (see
|
|
111
85
|
* charts/README.md).
|
|
112
86
|
*/
|
|
113
|
-
declare const LineAreaChart: react.NamedExoticComponent<
|
|
87
|
+
declare const LineAreaChart: react.NamedExoticComponent<TypeLineAreaChartProps>;
|
|
114
88
|
|
|
115
|
-
export {
|
|
89
|
+
export { LineAreaChart, TypeCategoryAxis, TypeChartClickHandler, TypeChartHoverHandler, TypeDatetimeAxis, type TypeLineAreaChartProps, type TypeLineAreaSeries, type TypeLineAreaVariant, type TypeLineAreaXAxis, type TypeLineAreaYAxis };
|
package/dist/line-area/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/line-area/LineAreaChart.tsx
|
|
23
23
|
var _react = require('react');
|
|
@@ -44,12 +44,12 @@ function withIsolatedPointMarkers(data) {
|
|
|
44
44
|
});
|
|
45
45
|
}
|
|
46
46
|
function buildLineAreaChartOptions(props) {
|
|
47
|
-
const tooltipOptions =
|
|
47
|
+
const tooltipOptions = _chunkRDS2VCPOjs.resolveTooltipOptions.call(void 0, props);
|
|
48
48
|
const isStacked = AREA_VARIANTS.has(props.variant) && Boolean(props.stacking);
|
|
49
|
-
const { annotations, lookup: annotationLookup } =
|
|
49
|
+
const { annotations, lookup: annotationLookup } = _chunk2S7XMWJ4js.buildAnnotationConfig.call(void 0,
|
|
50
50
|
props.annotations
|
|
51
51
|
);
|
|
52
|
-
const base =
|
|
52
|
+
const base = _chunkV5EXL244js.buildBaseChartOptions.call(void 0, {
|
|
53
53
|
type: props.variant,
|
|
54
54
|
description: props.description,
|
|
55
55
|
reserveTopMargin: Boolean(annotations),
|
|
@@ -64,13 +64,13 @@ function buildLineAreaChartOptions(props) {
|
|
|
64
64
|
// Re-assert the definite `type` so spreading the optionally-typed
|
|
65
65
|
// `base.chart` doesn't widen the required `type` field to optional.
|
|
66
66
|
type: props.variant,
|
|
67
|
-
height: _nullishCoalesce(props.height, () => (
|
|
67
|
+
height: _nullishCoalesce(props.height, () => ( _chunkXH7ZKGHDjs.TIME_SERIES_CHART_HEIGHT)),
|
|
68
68
|
// Tight time-series spacing (from constants/chartOptions.ts) so the plot
|
|
69
69
|
// area fills the 275px container; without it Highcharts' larger default
|
|
70
70
|
// spacing ([10, 10, 15, 10]) shrinks the plot area.
|
|
71
71
|
spacing: [5, 1, 0, 2]
|
|
72
72
|
},
|
|
73
|
-
xAxis:
|
|
73
|
+
xAxis: _chunkRDS2VCPOjs.buildDimensionalAxis.call(void 0, props.xAxis, _nullishCoalesce(tooltipOptions.timezone, () => ( "UTC"))),
|
|
74
74
|
yAxis: {
|
|
75
75
|
min: _optionalChain([props, 'access', _ => _.yAxis, 'optionalAccess', _2 => _2.min]),
|
|
76
76
|
max: _optionalChain([props, 'access', _3 => _3.yAxis, 'optionalAccess', _4 => _4.max]),
|
|
@@ -88,7 +88,7 @@ function buildLineAreaChartOptions(props) {
|
|
|
88
88
|
labels: {
|
|
89
89
|
// A declarative `format` drives ticks through the shared valueFormatter;
|
|
90
90
|
// absent it, the zero-config decimal default (1.20K / 1.20M / 1.20B).
|
|
91
|
-
formatter: _optionalChain([props, 'access', _9 => _9.yAxis, 'optionalAccess', _10 => _10.format]) ?
|
|
91
|
+
formatter: _optionalChain([props, 'access', _9 => _9.yAxis, 'optionalAccess', _10 => _10.format]) ? _chunk2S7XMWJ4js.makeValueAxisLabelFormatter.call(void 0, props.yAxis.format) : _chunk2S7XMWJ4js.defaultValueAxisLabelFormatter
|
|
92
92
|
}
|
|
93
93
|
},
|
|
94
94
|
plotOptions: {
|
|
@@ -131,7 +131,7 @@ function buildLineAreaChartOptions(props) {
|
|
|
131
131
|
var _jsxruntime = require('react/jsx-runtime');
|
|
132
132
|
var AREA_VARIANTS2 = /* @__PURE__ */ new Set(["area", "areaspline"]);
|
|
133
133
|
var LineAreaChart = _react.memo.call(void 0, function LineAreaChart2(props) {
|
|
134
|
-
const { colors, patterns } =
|
|
134
|
+
const { colors, patterns } = _chunkV5EXL244js.useSeedsChartSetup.call(void 0, {
|
|
135
135
|
series: props.series,
|
|
136
136
|
includePatterns: true
|
|
137
137
|
});
|
|
@@ -144,7 +144,7 @@ var LineAreaChart = _react.memo.call(void 0, function LineAreaChart2(props) {
|
|
|
144
144
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
145
145
|
"div",
|
|
146
146
|
{
|
|
147
|
-
...
|
|
147
|
+
..._chunkI72SSPMXjs.getChartContainerProps.call(void 0, {
|
|
148
148
|
familyClasses: [
|
|
149
149
|
"seeds-chart-time-series",
|
|
150
150
|
isArea ? "seeds-chart-area" : "seeds-chart-line"
|
|
@@ -159,7 +159,7 @@ var LineAreaChart = _react.memo.call(void 0, function LineAreaChart2(props) {
|
|
|
159
159
|
className: props.className
|
|
160
160
|
}),
|
|
161
161
|
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
162
|
-
|
|
162
|
+
_chunkV5EXL244js.ChartRenderer,
|
|
163
163
|
{
|
|
164
164
|
options,
|
|
165
165
|
series: props.series,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/_work/seeds/seeds/seeds-react/seeds-react-data-viz/dist/line-area/index.js","../../src/charts/line-area/LineAreaChart.tsx","../../src/charts/line-area/adapter.ts"],"names":["AREA_VARIANTS","LineAreaChart"],"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,8BAA8B;ADuB9B;AACA;AEFA,IAAM,cAAA,kBAAgB,IAAI,GAAA,CAAqB,CAAC,MAAA,EAAQ,YAAY,CAAC,CAAA;AAQrE,SAAS,MAAA,CAAO,KAAA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_work/seeds/seeds/seeds-react/seeds-react-data-viz/dist/line-area/index.js","sourcesContent":[null,"import { memo, useMemo } from \"react\";\nimport { useSeedsChartSetup, ChartRenderer } from \"../shared/chartBase\";\nimport { getChartContainerProps } from \"../shared/chartContainer\";\nimport { buildLineAreaChartOptions } from \"./adapter\";\nimport type { LineAreaChartProps, LineAreaVariant } from \"./types\";\n\nconst AREA_VARIANTS = new Set<LineAreaVariant>([\"area\", \"areaspline\"]);\n\n/**\n * LineAreaChart — the v2 time-series line/area family.\n *\n * Like SparklineChart, the wrapper carries no styled-components: it is a plain\n * <div> whose className / inline custom properties / data-attributes come from\n * the shared getChartContainerProps contract (CE-164), and its Highcharts\n * styling ships as a static line-area.css. chart-styles.css owns the shared\n * base (background, per-series color fallback, click cursor, tooltip, legend)\n * AND the shared cross-family .seeds-chart-time-series layer (crosshair,\n * grid/axis lines, ticks, zero line, axis-label typography) that bar also uses;\n * line-area.css owns only the .seeds-chart-line / .seeds-chart-area selectors.\n * Neither is imported here — matching the Sparkline/bar convention, the component never\n * self-imports its stylesheet; consumers import both explicitly (see\n * charts/README.md).\n */\nexport const LineAreaChart = memo(function LineAreaChart(\n props: LineAreaChartProps\n) {\n const { colors, patterns } = useSeedsChartSetup({\n series: props.series,\n includePatterns: true,\n });\n const { options, annotationLookup, tooltipOptions } = useMemo(\n () => buildLineAreaChartOptions(props),\n [props]\n );\n const hasOnClick = Boolean(props.onClick);\n const isArea = AREA_VARIANTS.has(props.variant);\n\n return (\n <div\n {...getChartContainerProps({\n familyClasses: [\n \"seeds-chart-time-series\",\n isArea ? \"seeds-chart-area\" : \"seeds-chart-line\",\n ],\n // RAW per-series colors: only an explicit consumer override is inlined\n // as --highcharts-color-N; an unset series falls through to the DS\n // palette default in chart-styles.css. ChartRenderer below still gets\n // the palette-RESOLVED `colors` for its own styled-components engine.\n colors: props.series.map((s) => s.color),\n patterns,\n hasOnClick,\n className: props.className,\n })}\n >\n <ChartRenderer\n options={options}\n series={props.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 SeedsChartDataPoint,\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 { ChartDataPoint } from \"../shared/axis\";\nimport type { LineAreaChartProps, LineAreaVariant } from \"./types\";\n\n// `stacking` is meaningful only for filled variants; on `line`/`spline` it's a\n// no-op, so the adapter drops it rather than emitting a misleading option.\nconst AREA_VARIANTS = new Set<LineAreaVariant>([\"area\", \"areaspline\"]);\n\ntype SeriesPoint =\n | number\n | null\n | [number, number | null]\n | SeedsChartDataPoint;\n\nfunction pointY(point: ChartDataPoint): number | null {\n if (point === null) return null;\n if (typeof point === \"number\") return point;\n if (Array.isArray(point)) return point[1];\n return point.y;\n}\n\n// Point markers are hidden by default (set on `plotOptions.series`), but an\n// *isolated* non-null point — one with a null (or the chart edge) on both\n// sides — gets a circle marker so a point with no connecting line segment\n// stays visible. Connected points pass through unchanged so the line/area\n// renders dot-free, matching the designs.\nfunction withIsolatedPointMarkers(\n data: ReadonlyArray<ChartDataPoint>\n): SeriesPoint[] {\n return data.map((point, i): SeriesPoint => {\n if (point === null) return null; // explicit gap\n if (pointY(point) === null) return point; // tuple/object with null y — a gap\n const prevY = i === 0 ? null : pointY(data[i - 1]!);\n const nextY = i === data.length - 1 ? null : pointY(data[i + 1]!);\n if (prevY !== null || nextY !== null) return point; // connected → no marker\n const marker = { enabled: true, symbol: \"circle\" as const };\n if (typeof point === \"number\") return { y: point, marker };\n if (Array.isArray(point)) return { x: point[0], y: point[1], marker };\n return { ...point, marker };\n });\n}\n\nexport function buildLineAreaChartOptions(props: LineAreaChartProps): {\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 tooltipOptions = resolveTooltipOptions(props);\n const isStacked = AREA_VARIANTS.has(props.variant) && Boolean(props.stacking);\n const { annotations, lookup: annotationLookup } = buildAnnotationConfig(\n props.annotations\n );\n\n const base = buildBaseChartOptions({\n type: props.variant,\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: props.variant,\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 // Anchor the value axis to 0 (as the bar/area families do): line/spline otherwise\n // auto-scale above 0, which truncates the axis and pushes the annotation\n // anchor (y: 0) out of range. `soft` still extends for negative data.\n softMin: 0,\n softMax: 0,\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 // Zero-config default: abbreviate value-axis ticks (1.20K / 1.20M / 1.20B).\n labels: {\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: {\n animation: false,\n // Hide point markers by default (per the designs); isolated points\n // re-enable their own marker via `withIsolatedPointMarkers`.\n marker: { enabled: false },\n ...(props.onClick || props.onMouseEnter || props.onMouseLeave\n ? {\n point: {\n events: {\n click: props.onClick\n ? (event) => props.onClick!({ position: event.point.x })\n : undefined,\n mouseOver: props.onMouseEnter\n ? function (this: { x: number | string }) {\n props.onMouseEnter!({ position: this.x });\n }\n : undefined,\n mouseOut: props.onMouseLeave\n ? function (this: { x: number | string }) {\n props.onMouseLeave!({ position: this.x });\n }\n : undefined,\n },\n },\n }\n : {}),\n },\n // Type-scoped stacking: only the (area) variant stacks. `isStacked` already\n // guarantees `props.variant` is an area variant here, so the computed key is\n // always a valid plotOptions slot. Matches bar's per-type placement and keeps\n // line/spline unstacked.\n ...(isStacked ? { [props.variant]: { stacking: props.stacking } } : {}),\n },\n series: props.series.map((s) => ({\n type: props.variant,\n name: s.name,\n data: withIsolatedPointMarkers(s.data),\n })),\n ...(annotations ? { annotations } : {}),\n };\n\n return { options, annotationLookup, tooltipOptions };\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["/home/runner/_work/seeds/seeds/seeds-react/seeds-react-data-viz/dist/line-area/index.js","../../src/charts/line-area/LineAreaChart.tsx","../../src/charts/line-area/adapter.ts"],"names":["AREA_VARIANTS","LineAreaChart"],"mappings":"AAAA;AACE;AACA;AACA;AACF,uDAA6B;AAC7B;AACE;AAC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M,kBAAA;AAAA,UAC1B,WAAA,kBAAa,KAAA,uBAAM,KAAA,+BAAO,QAAA;AAAA,UAC1B,WAAA,EAAa,KAAA,CAAM,WAAA;AAAA,UACnB,OAAA,EAAS,KAAA,CAAM;AAAA,QAAA;AAAA,MACjB;AAAA,IAAA;AAAA,EACF,CAAA;AAEJ,CAAC,CAAA;AD8GD;AACE;AACF,sCAAC","file":"/home/runner/_work/seeds/seeds/seeds-react/seeds-react-data-viz/dist/line-area/index.js","sourcesContent":[null,"import { memo, useMemo } from \"react\";\nimport { useSeedsChartSetup, ChartRenderer } from \"../shared/chartBase\";\nimport { getChartContainerProps } from \"../shared/chartContainer\";\nimport { buildLineAreaChartOptions } from \"./adapter\";\nimport type { TypeLineAreaChartProps, TypeLineAreaVariant } from \"./types\";\n\nconst AREA_VARIANTS = new Set<TypeLineAreaVariant>([\"area\", \"areaspline\"]);\n\n/**\n * LineAreaChart — the v2 time-series line/area family.\n *\n * Like SparklineChart, the wrapper carries no styled-components: it is a plain\n * <div> whose className / inline custom properties / data-attributes come from\n * the shared getChartContainerProps contract (CE-164), and its Highcharts\n * styling ships as a static line-area.css. chart-styles.css owns the shared\n * base (background, per-series color fallback, click cursor, tooltip, legend)\n * AND the shared cross-family .seeds-chart-time-series layer (crosshair,\n * grid/axis lines, ticks, zero line, axis-label typography) that bar also uses;\n * line-area.css owns only the .seeds-chart-line / .seeds-chart-area selectors.\n * Neither is imported here — matching the Sparkline/bar convention, the component never\n * self-imports its stylesheet; consumers import both explicitly (see\n * charts/README.md).\n */\nexport const LineAreaChart = memo(function LineAreaChart(\n props: TypeLineAreaChartProps\n) {\n const { colors, patterns } = useSeedsChartSetup({\n series: props.series,\n includePatterns: true,\n });\n const { options, annotationLookup, tooltipOptions } = useMemo(\n () => buildLineAreaChartOptions(props),\n [props]\n );\n const hasOnClick = Boolean(props.onClick);\n const isArea = AREA_VARIANTS.has(props.variant);\n\n return (\n <div\n {...getChartContainerProps({\n familyClasses: [\n \"seeds-chart-time-series\",\n isArea ? \"seeds-chart-area\" : \"seeds-chart-line\",\n ],\n // RAW per-series colors: only an explicit consumer override is inlined\n // as --highcharts-color-N; an unset series falls through to the DS\n // palette default in chart-styles.css. ChartRenderer below still gets\n // the palette-RESOLVED `colors` for its own styled-components engine.\n colors: props.series.map((s) => s.color),\n patterns,\n hasOnClick,\n className: props.className,\n })}\n >\n <ChartRenderer\n options={options}\n series={props.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 TypeSeedsChartDataPoint,\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 { TypeChartDataPoint } from \"../shared/axis\";\nimport type { TypeLineAreaChartProps, TypeLineAreaVariant } from \"./types\";\n\n// `stacking` is meaningful only for filled variants; on `line`/`spline` it's a\n// no-op, so the adapter drops it rather than emitting a misleading option.\nconst AREA_VARIANTS = new Set<TypeLineAreaVariant>([\"area\", \"areaspline\"]);\n\ntype SeriesPoint =\n | number\n | null\n | [number, number | null]\n | TypeSeedsChartDataPoint;\n\nfunction pointY(point: TypeChartDataPoint): number | null {\n if (point === null) return null;\n if (typeof point === \"number\") return point;\n if (Array.isArray(point)) return point[1];\n return point.y;\n}\n\n// Point markers are hidden by default (set on `plotOptions.series`), but an\n// *isolated* non-null point — one with a null (or the chart edge) on both\n// sides — gets a circle marker so a point with no connecting line segment\n// stays visible. Connected points pass through unchanged so the line/area\n// renders dot-free, matching the designs.\nfunction withIsolatedPointMarkers(\n data: readonly TypeChartDataPoint[]\n): SeriesPoint[] {\n return data.map((point, i): SeriesPoint => {\n if (point === null) return null; // explicit gap\n if (pointY(point) === null) return point; // tuple/object with null y — a gap\n const prevY = i === 0 ? null : pointY(data[i - 1]!);\n const nextY = i === data.length - 1 ? null : pointY(data[i + 1]!);\n if (prevY !== null || nextY !== null) return point; // connected → no marker\n const marker = { enabled: true, symbol: \"circle\" as const };\n if (typeof point === \"number\") return { y: point, marker };\n if (Array.isArray(point)) return { x: point[0], y: point[1], marker };\n return { ...point, marker };\n });\n}\n\nexport function buildLineAreaChartOptions(props: TypeLineAreaChartProps): {\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 tooltipOptions = resolveTooltipOptions(props);\n const isStacked = AREA_VARIANTS.has(props.variant) && Boolean(props.stacking);\n const { annotations, lookup: annotationLookup } = buildAnnotationConfig(\n props.annotations\n );\n\n const base = buildBaseChartOptions({\n type: props.variant,\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: props.variant,\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 // Anchor the value axis to 0 (as the bar/area families do): line/spline otherwise\n // auto-scale above 0, which truncates the axis and pushes the annotation\n // anchor (y: 0) out of range. `soft` still extends for negative data.\n softMin: 0,\n softMax: 0,\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 // Zero-config default: abbreviate value-axis ticks (1.20K / 1.20M / 1.20B).\n labels: {\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: {\n animation: false,\n // Hide point markers by default (per the designs); isolated points\n // re-enable their own marker via `withIsolatedPointMarkers`.\n marker: { enabled: false },\n ...(props.onClick || props.onMouseEnter || props.onMouseLeave\n ? {\n point: {\n events: {\n click: props.onClick\n ? (event) => props.onClick!({ position: event.point.x })\n : undefined,\n mouseOver: props.onMouseEnter\n ? function (this: { x: number | string }) {\n props.onMouseEnter!({ position: this.x });\n }\n : undefined,\n mouseOut: props.onMouseLeave\n ? function (this: { x: number | string }) {\n props.onMouseLeave!({ position: this.x });\n }\n : undefined,\n },\n },\n }\n : {}),\n },\n // Type-scoped stacking: only the (area) variant stacks. `isStacked` already\n // guarantees `props.variant` is an area variant here, so the computed key is\n // always a valid plotOptions slot. Matches bar's per-type placement and keeps\n // line/spline unstacked.\n ...(isStacked ? { [props.variant]: { stacking: props.stacking } } : {}),\n },\n series: props.series.map((s) => ({\n type: props.variant,\n name: s.name,\n data: withIsolatedPointMarkers(s.data),\n })),\n ...(annotations ? { annotations } : {}),\n };\n\n return { options, annotationLookup, tooltipOptions };\n}\n"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The coordinates and index a pointer-click payload carries regardless of
|
|
3
|
+
* family. Each family adds its own identity fields (bubble: `name`/`value`/
|
|
4
|
+
* `seriesIndex`; wordcloud: `name`/`weight`/`groupId`).
|
|
5
|
+
*/
|
|
6
|
+
interface TypeChartPointerClickData {
|
|
7
|
+
/** Index of the clicked point within its series. */
|
|
8
|
+
pointIndex: number;
|
|
9
|
+
/** Page-relative x of the click, or of the point's top-left for keyboard activation. */
|
|
10
|
+
pageX: number;
|
|
11
|
+
/** Page-relative y of the click, or of the point's top-left for keyboard activation. */
|
|
12
|
+
pageY: number;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export type { TypeChartPointerClickData as T };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The coordinates and index a pointer-click payload carries regardless of
|
|
3
|
+
* family. Each family adds its own identity fields (bubble: `name`/`value`/
|
|
4
|
+
* `seriesIndex`; wordcloud: `name`/`weight`/`groupId`).
|
|
5
|
+
*/
|
|
6
|
+
interface TypeChartPointerClickData {
|
|
7
|
+
/** Index of the clicked point within its series. */
|
|
8
|
+
pointIndex: number;
|
|
9
|
+
/** Page-relative x of the click, or of the point's top-left for keyboard activation. */
|
|
10
|
+
pageX: number;
|
|
11
|
+
/** Page-relative y of the click, or of the point's top-left for keyboard activation. */
|
|
12
|
+
pageY: number;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export type { TypeChartPointerClickData as T };
|