@sproutsocial/seeds-react-data-viz 0.14.0 → 0.15.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/axis-DXzufRRj.d.mts +116 -0
- package/dist/axis-PJwu5Xmo.d.ts +116 -0
- package/dist/bar/index.d.mts +3 -113
- package/dist/bar/index.d.ts +3 -113
- package/dist/bar/index.js +29 -772
- package/dist/bar/index.js.map +1 -1
- package/dist/{chunk-VFBZ7FNK.js → chunk-EEVKTTT3.js} +13 -199
- package/dist/chunk-EEVKTTT3.js.map +1 -0
- package/dist/chunk-JXARPHQE.js +193 -0
- package/dist/chunk-JXARPHQE.js.map +1 -0
- package/dist/chunk-VSZSIN34.js +796 -0
- package/dist/chunk-VSZSIN34.js.map +1 -0
- package/dist/esm/bar/index.js +27 -770
- package/dist/esm/bar/index.js.map +1 -1
- package/dist/esm/chunk-HQM3EIZW.js +193 -0
- package/dist/esm/chunk-HQM3EIZW.js.map +1 -0
- package/dist/esm/{chunk-CDBW4SOR.js → chunk-LC3HGWDD.js} +2 -188
- package/dist/esm/chunk-LC3HGWDD.js.map +1 -0
- package/dist/esm/chunk-OAN5VC7M.js +796 -0
- package/dist/esm/chunk-OAN5VC7M.js.map +1 -0
- package/dist/esm/index.js +15 -13
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/line-area/index.js +151 -0
- package/dist/esm/line-area/index.js.map +1 -0
- package/dist/index.d.mts +26 -0
- package/dist/index.d.ts +26 -0
- package/dist/index.js +61 -59
- package/dist/index.js.map +1 -1
- package/dist/line-area/index.d.mts +83 -0
- package/dist/line-area/index.d.ts +83 -0
- package/dist/line-area/index.js +151 -0
- package/dist/line-area/index.js.map +1 -0
- package/package.json +6 -1
- package/dist/chunk-VFBZ7FNK.js.map +0 -1
- package/dist/esm/chunk-CDBW4SOR.js.map +0 -1
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { TypeIconName } from '@sproutsocial/seeds-react-icon';
|
|
3
|
+
import { c as TypeChartNumberFormat, k as TypeChartStyleColor } from './types-B7ILUQ6_.mjs';
|
|
4
|
+
|
|
5
|
+
type TypeValuePercentInput = "decimal" | "whole";
|
|
6
|
+
type TypeValueFormatterOptions = Readonly<{
|
|
7
|
+
/** The raw numeric value. For duration, milliseconds. */
|
|
8
|
+
value: number;
|
|
9
|
+
/** default "decimal" */
|
|
10
|
+
numberFormat?: TypeChartNumberFormat;
|
|
11
|
+
/** Only used when numberFormat === "currency". default "USD" */
|
|
12
|
+
currency?: string;
|
|
13
|
+
/** true → 10k threshold; number → max(1000, abs(n)); false → never. default true */
|
|
14
|
+
abbreviate?: boolean | number;
|
|
15
|
+
/** "decimal" scales 0.42 → "42%"; "whole" treats 42 → "42%". default "decimal" */
|
|
16
|
+
percentInput?: TypeValuePercentInput;
|
|
17
|
+
/** locale for decimal/currency/percent (formatNumeral) */
|
|
18
|
+
numberLocale?: Intl.LocalesArgument;
|
|
19
|
+
/** locale for duration (formatDuration) */
|
|
20
|
+
textLocale?: Intl.LocalesArgument;
|
|
21
|
+
}>;
|
|
22
|
+
/**
|
|
23
|
+
* Declarative value-format config for axis ticks and the default tooltip — the
|
|
24
|
+
* full {@link TypeValueFormatterOptions} surface minus `value`, which is
|
|
25
|
+
* supplied per-tick / per-row by the caller (the adapter and tooltip).
|
|
26
|
+
*/
|
|
27
|
+
type ValueFormat = Omit<TypeValueFormatterOptions, "value">;
|
|
28
|
+
|
|
29
|
+
interface ChartTooltipDataRow {
|
|
30
|
+
color: TypeChartStyleColor;
|
|
31
|
+
name: string;
|
|
32
|
+
value: number | null;
|
|
33
|
+
}
|
|
34
|
+
/** Tooltip render-prop signature for v2 charts. */
|
|
35
|
+
interface ChartTooltipProps {
|
|
36
|
+
data: ChartTooltipDataRow[];
|
|
37
|
+
/** Resolved x-axis position. Category name for category axes, numeric for time/linear. */
|
|
38
|
+
position: number | string;
|
|
39
|
+
/** Resolved chart timezone — pass to date formatters when `position` is a numeric timestamp. Undefined on category axes. */
|
|
40
|
+
timezone?: string;
|
|
41
|
+
/** Declarative annotation anchored at this position, if any. Rendered in the tooltip header. */
|
|
42
|
+
annotation?: {
|
|
43
|
+
icon?: TypeIconName;
|
|
44
|
+
color?: string;
|
|
45
|
+
title?: string;
|
|
46
|
+
description?: string;
|
|
47
|
+
};
|
|
48
|
+
/** True when the chart has an `onClick` handler — used by the default tooltip to render the click-label footer. */
|
|
49
|
+
hasOnClick?: boolean;
|
|
50
|
+
/** Footer content shown in the default tooltip when the chart is clickable. */
|
|
51
|
+
tooltipClickLabel?: ReactNode;
|
|
52
|
+
/** Content shown in place of a row's value when the value is null. Defaults to an em-dash. */
|
|
53
|
+
invalidNumberLabel?: ReactNode;
|
|
54
|
+
/** Declarative value format for the tooltip value cell. Omit for raw rendering. Applied at full precision (abbreviation off). */
|
|
55
|
+
valueFormat?: ValueFormat;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Declarative annotation shape — the DS renders the marker and tooltip header
|
|
60
|
+
* internally; consumers don't supply render functions. See CE-7.
|
|
61
|
+
*/
|
|
62
|
+
interface ChartAnnotation {
|
|
63
|
+
/** Numeric x-axis coordinate — a category index (category axes) or the raw coordinate (datetime/linear axes). */
|
|
64
|
+
position: number;
|
|
65
|
+
/** Icon shown above the chart at `position` and inline with `title` in the tooltip header. */
|
|
66
|
+
icon?: TypeIconName;
|
|
67
|
+
/** Color applied to the marker's vertical line. */
|
|
68
|
+
color?: string;
|
|
69
|
+
/** Tooltip header line 1. */
|
|
70
|
+
title?: string;
|
|
71
|
+
/** Tooltip header line 2. */
|
|
72
|
+
description?: string;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Pure, Highcharts-free datetime axis label formatter for v2 chart families.
|
|
77
|
+
*
|
|
78
|
+
* Ports v1's `helpers/xAxisLabelFormatter` into a rendering-agnostic shape: it
|
|
79
|
+
* returns a `{ primary, secondary? }` object instead of an HTML string, leaving
|
|
80
|
+
* SVG rendering to the caller. The timezone- and DST-correct boundary detection
|
|
81
|
+
* (calendar parts read in the target timezone) and the per-granularity
|
|
82
|
+
* `Intl.DateTimeFormat` option sets are a near-verbatim port of v1.
|
|
83
|
+
*
|
|
84
|
+
* The one net-new piece versus v1 is granularity derivation: v1 receives
|
|
85
|
+
* `unitName` from Highcharts, but `charts/` may not depend on Highcharts types
|
|
86
|
+
* (see `charts/README.md` invariants), so granularity is derived from the
|
|
87
|
+
* spacing of `tickPositions`.
|
|
88
|
+
*/
|
|
89
|
+
type DatetimeTimeFormat = "12" | "24";
|
|
90
|
+
|
|
91
|
+
/** A datetime data point: `[msSinceEpoch, value]` tuple or `{ x, y }` object. */
|
|
92
|
+
type DatetimePoint = [number, number | null] | {
|
|
93
|
+
x: number;
|
|
94
|
+
y: number | null;
|
|
95
|
+
};
|
|
96
|
+
/** A value on a category axis, or a datetime point when the axis is `"datetime"`. */
|
|
97
|
+
type ChartDataPoint = number | null | DatetimePoint;
|
|
98
|
+
/** Category axis — labels indexed parallel to `series.data`. The default axis type. */
|
|
99
|
+
interface CategoryAxis {
|
|
100
|
+
type?: "category";
|
|
101
|
+
/** Category labels, indexed parallel to `series.data`. */
|
|
102
|
+
categories: Array<string>;
|
|
103
|
+
crosshair?: boolean;
|
|
104
|
+
}
|
|
105
|
+
/** Datetime axis — `series.data` carries timestamped points. */
|
|
106
|
+
interface DatetimeAxis {
|
|
107
|
+
type: "datetime";
|
|
108
|
+
crosshair?: boolean;
|
|
109
|
+
/**
|
|
110
|
+
* 12- or 24-hour clock for hour-granularity tick labels (e.g. `9 AM` vs
|
|
111
|
+
* `09:00`). Default `"12"`. Coarser granularities (day/month/year) ignore it.
|
|
112
|
+
*/
|
|
113
|
+
timeFormat?: DatetimeTimeFormat;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export type { ChartDataPoint as C, DatetimeAxis as D, ValueFormat as V, CategoryAxis as a, ChartTooltipProps as b, ChartAnnotation as c, DatetimePoint as d };
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { TypeIconName } from '@sproutsocial/seeds-react-icon';
|
|
3
|
+
import { c as TypeChartNumberFormat, k as TypeChartStyleColor } from './types-B7ILUQ6_.js';
|
|
4
|
+
|
|
5
|
+
type TypeValuePercentInput = "decimal" | "whole";
|
|
6
|
+
type TypeValueFormatterOptions = Readonly<{
|
|
7
|
+
/** The raw numeric value. For duration, milliseconds. */
|
|
8
|
+
value: number;
|
|
9
|
+
/** default "decimal" */
|
|
10
|
+
numberFormat?: TypeChartNumberFormat;
|
|
11
|
+
/** Only used when numberFormat === "currency". default "USD" */
|
|
12
|
+
currency?: string;
|
|
13
|
+
/** true → 10k threshold; number → max(1000, abs(n)); false → never. default true */
|
|
14
|
+
abbreviate?: boolean | number;
|
|
15
|
+
/** "decimal" scales 0.42 → "42%"; "whole" treats 42 → "42%". default "decimal" */
|
|
16
|
+
percentInput?: TypeValuePercentInput;
|
|
17
|
+
/** locale for decimal/currency/percent (formatNumeral) */
|
|
18
|
+
numberLocale?: Intl.LocalesArgument;
|
|
19
|
+
/** locale for duration (formatDuration) */
|
|
20
|
+
textLocale?: Intl.LocalesArgument;
|
|
21
|
+
}>;
|
|
22
|
+
/**
|
|
23
|
+
* Declarative value-format config for axis ticks and the default tooltip — the
|
|
24
|
+
* full {@link TypeValueFormatterOptions} surface minus `value`, which is
|
|
25
|
+
* supplied per-tick / per-row by the caller (the adapter and tooltip).
|
|
26
|
+
*/
|
|
27
|
+
type ValueFormat = Omit<TypeValueFormatterOptions, "value">;
|
|
28
|
+
|
|
29
|
+
interface ChartTooltipDataRow {
|
|
30
|
+
color: TypeChartStyleColor;
|
|
31
|
+
name: string;
|
|
32
|
+
value: number | null;
|
|
33
|
+
}
|
|
34
|
+
/** Tooltip render-prop signature for v2 charts. */
|
|
35
|
+
interface ChartTooltipProps {
|
|
36
|
+
data: ChartTooltipDataRow[];
|
|
37
|
+
/** Resolved x-axis position. Category name for category axes, numeric for time/linear. */
|
|
38
|
+
position: number | string;
|
|
39
|
+
/** Resolved chart timezone — pass to date formatters when `position` is a numeric timestamp. Undefined on category axes. */
|
|
40
|
+
timezone?: string;
|
|
41
|
+
/** Declarative annotation anchored at this position, if any. Rendered in the tooltip header. */
|
|
42
|
+
annotation?: {
|
|
43
|
+
icon?: TypeIconName;
|
|
44
|
+
color?: string;
|
|
45
|
+
title?: string;
|
|
46
|
+
description?: string;
|
|
47
|
+
};
|
|
48
|
+
/** True when the chart has an `onClick` handler — used by the default tooltip to render the click-label footer. */
|
|
49
|
+
hasOnClick?: boolean;
|
|
50
|
+
/** Footer content shown in the default tooltip when the chart is clickable. */
|
|
51
|
+
tooltipClickLabel?: ReactNode;
|
|
52
|
+
/** Content shown in place of a row's value when the value is null. Defaults to an em-dash. */
|
|
53
|
+
invalidNumberLabel?: ReactNode;
|
|
54
|
+
/** Declarative value format for the tooltip value cell. Omit for raw rendering. Applied at full precision (abbreviation off). */
|
|
55
|
+
valueFormat?: ValueFormat;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Declarative annotation shape — the DS renders the marker and tooltip header
|
|
60
|
+
* internally; consumers don't supply render functions. See CE-7.
|
|
61
|
+
*/
|
|
62
|
+
interface ChartAnnotation {
|
|
63
|
+
/** Numeric x-axis coordinate — a category index (category axes) or the raw coordinate (datetime/linear axes). */
|
|
64
|
+
position: number;
|
|
65
|
+
/** Icon shown above the chart at `position` and inline with `title` in the tooltip header. */
|
|
66
|
+
icon?: TypeIconName;
|
|
67
|
+
/** Color applied to the marker's vertical line. */
|
|
68
|
+
color?: string;
|
|
69
|
+
/** Tooltip header line 1. */
|
|
70
|
+
title?: string;
|
|
71
|
+
/** Tooltip header line 2. */
|
|
72
|
+
description?: string;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Pure, Highcharts-free datetime axis label formatter for v2 chart families.
|
|
77
|
+
*
|
|
78
|
+
* Ports v1's `helpers/xAxisLabelFormatter` into a rendering-agnostic shape: it
|
|
79
|
+
* returns a `{ primary, secondary? }` object instead of an HTML string, leaving
|
|
80
|
+
* SVG rendering to the caller. The timezone- and DST-correct boundary detection
|
|
81
|
+
* (calendar parts read in the target timezone) and the per-granularity
|
|
82
|
+
* `Intl.DateTimeFormat` option sets are a near-verbatim port of v1.
|
|
83
|
+
*
|
|
84
|
+
* The one net-new piece versus v1 is granularity derivation: v1 receives
|
|
85
|
+
* `unitName` from Highcharts, but `charts/` may not depend on Highcharts types
|
|
86
|
+
* (see `charts/README.md` invariants), so granularity is derived from the
|
|
87
|
+
* spacing of `tickPositions`.
|
|
88
|
+
*/
|
|
89
|
+
type DatetimeTimeFormat = "12" | "24";
|
|
90
|
+
|
|
91
|
+
/** A datetime data point: `[msSinceEpoch, value]` tuple or `{ x, y }` object. */
|
|
92
|
+
type DatetimePoint = [number, number | null] | {
|
|
93
|
+
x: number;
|
|
94
|
+
y: number | null;
|
|
95
|
+
};
|
|
96
|
+
/** A value on a category axis, or a datetime point when the axis is `"datetime"`. */
|
|
97
|
+
type ChartDataPoint = number | null | DatetimePoint;
|
|
98
|
+
/** Category axis — labels indexed parallel to `series.data`. The default axis type. */
|
|
99
|
+
interface CategoryAxis {
|
|
100
|
+
type?: "category";
|
|
101
|
+
/** Category labels, indexed parallel to `series.data`. */
|
|
102
|
+
categories: Array<string>;
|
|
103
|
+
crosshair?: boolean;
|
|
104
|
+
}
|
|
105
|
+
/** Datetime axis — `series.data` carries timestamped points. */
|
|
106
|
+
interface DatetimeAxis {
|
|
107
|
+
type: "datetime";
|
|
108
|
+
crosshair?: boolean;
|
|
109
|
+
/**
|
|
110
|
+
* 12- or 24-hour clock for hour-granularity tick labels (e.g. `9 AM` vs
|
|
111
|
+
* `09:00`). Default `"12"`. Coarser granularities (day/month/year) ignore it.
|
|
112
|
+
*/
|
|
113
|
+
timeFormat?: DatetimeTimeFormat;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export type { ChartDataPoint as C, DatetimeAxis as D, ValueFormat as V, CategoryAxis as a, ChartTooltipProps as b, ChartAnnotation as c, DatetimePoint as d };
|
package/dist/bar/index.d.mts
CHANGED
|
@@ -1,121 +1,11 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
3
|
import { TypeIconName } from '@sproutsocial/seeds-react-icon';
|
|
4
|
-
import { c as
|
|
4
|
+
import { C as ChartDataPoint, a as CategoryAxis, D as DatetimeAxis, V as ValueFormat, b as ChartTooltipProps, c as ChartAnnotation, d as DatetimePoint } from '../axis-DXzufRRj.mjs';
|
|
5
5
|
import { C as ChartExportHandle } from '../chartExport-CKYpuhik.mjs';
|
|
6
|
+
import '../types-B7ILUQ6_.mjs';
|
|
6
7
|
import 'highcharts';
|
|
7
8
|
|
|
8
|
-
type TypeValuePercentInput = "decimal" | "whole";
|
|
9
|
-
type TypeValueFormatterOptions = Readonly<{
|
|
10
|
-
/** The raw numeric value. For duration, milliseconds. */
|
|
11
|
-
value: number;
|
|
12
|
-
/** default "decimal" */
|
|
13
|
-
numberFormat?: TypeChartNumberFormat;
|
|
14
|
-
/** Only used when numberFormat === "currency". default "USD" */
|
|
15
|
-
currency?: string;
|
|
16
|
-
/** true → 10k threshold; number → max(1000, abs(n)); false → never. default true */
|
|
17
|
-
abbreviate?: boolean | number;
|
|
18
|
-
/** "decimal" scales 0.42 → "42%"; "whole" treats 42 → "42%". default "decimal" */
|
|
19
|
-
percentInput?: TypeValuePercentInput;
|
|
20
|
-
/** locale for decimal/currency/percent (formatNumeral) */
|
|
21
|
-
numberLocale?: Intl.LocalesArgument;
|
|
22
|
-
/** locale for duration (formatDuration) */
|
|
23
|
-
textLocale?: Intl.LocalesArgument;
|
|
24
|
-
}>;
|
|
25
|
-
/**
|
|
26
|
-
* Declarative value-format config for axis ticks and the default tooltip — the
|
|
27
|
-
* full {@link TypeValueFormatterOptions} surface minus `value`, which is
|
|
28
|
-
* supplied per-tick / per-row by the caller (the adapter and tooltip).
|
|
29
|
-
*/
|
|
30
|
-
type ValueFormat = Omit<TypeValueFormatterOptions, "value">;
|
|
31
|
-
|
|
32
|
-
interface ChartTooltipDataRow {
|
|
33
|
-
color: TypeChartStyleColor;
|
|
34
|
-
name: string;
|
|
35
|
-
value: number | null;
|
|
36
|
-
}
|
|
37
|
-
/** Tooltip render-prop signature for v2 charts. */
|
|
38
|
-
interface ChartTooltipProps {
|
|
39
|
-
data: ChartTooltipDataRow[];
|
|
40
|
-
/** Resolved x-axis position. Category name for category axes, numeric for time/linear. */
|
|
41
|
-
position: number | string;
|
|
42
|
-
/** Resolved chart timezone — pass to date formatters when `position` is a numeric timestamp. Undefined on category axes. */
|
|
43
|
-
timezone?: string;
|
|
44
|
-
/** Declarative annotation anchored at this position, if any. Rendered in the tooltip header. */
|
|
45
|
-
annotation?: {
|
|
46
|
-
icon?: TypeIconName;
|
|
47
|
-
color?: string;
|
|
48
|
-
title?: string;
|
|
49
|
-
description?: string;
|
|
50
|
-
};
|
|
51
|
-
/** True when the chart has an `onClick` handler — used by the default tooltip to render the click-label footer. */
|
|
52
|
-
hasOnClick?: boolean;
|
|
53
|
-
/** Footer content shown in the default tooltip when the chart is clickable. */
|
|
54
|
-
tooltipClickLabel?: ReactNode;
|
|
55
|
-
/** Content shown in place of a row's value when the value is null. Defaults to an em-dash. */
|
|
56
|
-
invalidNumberLabel?: ReactNode;
|
|
57
|
-
/** Declarative value format for the tooltip value cell. Omit for raw rendering. Applied at full precision (abbreviation off). */
|
|
58
|
-
valueFormat?: ValueFormat;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* Declarative annotation shape — the DS renders the marker and tooltip header
|
|
63
|
-
* internally; consumers don't supply render functions. See CE-7.
|
|
64
|
-
*/
|
|
65
|
-
interface ChartAnnotation {
|
|
66
|
-
/** Numeric x-axis coordinate — a category index (category axes) or the raw coordinate (datetime/linear axes). */
|
|
67
|
-
position: number;
|
|
68
|
-
/** Icon shown above the chart at `position` and inline with `title` in the tooltip header. */
|
|
69
|
-
icon?: TypeIconName;
|
|
70
|
-
/** Color applied to the marker's vertical line. */
|
|
71
|
-
color?: string;
|
|
72
|
-
/** Tooltip header line 1. */
|
|
73
|
-
title?: string;
|
|
74
|
-
/** Tooltip header line 2. */
|
|
75
|
-
description?: string;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* Pure, Highcharts-free datetime axis label formatter for v2 chart families.
|
|
80
|
-
*
|
|
81
|
-
* Ports v1's `helpers/xAxisLabelFormatter` into a rendering-agnostic shape: it
|
|
82
|
-
* returns a `{ primary, secondary? }` object instead of an HTML string, leaving
|
|
83
|
-
* SVG rendering to the caller. The timezone- and DST-correct boundary detection
|
|
84
|
-
* (calendar parts read in the target timezone) and the per-granularity
|
|
85
|
-
* `Intl.DateTimeFormat` option sets are a near-verbatim port of v1.
|
|
86
|
-
*
|
|
87
|
-
* The one net-new piece versus v1 is granularity derivation: v1 receives
|
|
88
|
-
* `unitName` from Highcharts, but `charts/` may not depend on Highcharts types
|
|
89
|
-
* (see `charts/README.md` invariants), so granularity is derived from the
|
|
90
|
-
* spacing of `tickPositions`.
|
|
91
|
-
*/
|
|
92
|
-
type DatetimeTimeFormat = "12" | "24";
|
|
93
|
-
|
|
94
|
-
/** A datetime data point: `[msSinceEpoch, value]` tuple or `{ x, y }` object. */
|
|
95
|
-
type DatetimePoint = [number, number | null] | {
|
|
96
|
-
x: number;
|
|
97
|
-
y: number | null;
|
|
98
|
-
};
|
|
99
|
-
/** A value on a category axis, or a datetime point when the axis is `"datetime"`. */
|
|
100
|
-
type ChartDataPoint = number | null | DatetimePoint;
|
|
101
|
-
/** Category axis — labels indexed parallel to `series.data`. The default axis type. */
|
|
102
|
-
interface CategoryAxis {
|
|
103
|
-
type?: "category";
|
|
104
|
-
/** Category labels, indexed parallel to `series.data`. */
|
|
105
|
-
categories: Array<string>;
|
|
106
|
-
crosshair?: boolean;
|
|
107
|
-
}
|
|
108
|
-
/** Datetime axis — `series.data` carries timestamped points. */
|
|
109
|
-
interface DatetimeAxis {
|
|
110
|
-
type: "datetime";
|
|
111
|
-
crosshair?: boolean;
|
|
112
|
-
/**
|
|
113
|
-
* 12- or 24-hour clock for hour-granularity tick labels (e.g. `9 AM` vs
|
|
114
|
-
* `09:00`). Default `"12"`. Coarser granularities (day/month/year) ignore it.
|
|
115
|
-
*/
|
|
116
|
-
timeFormat?: DatetimeTimeFormat;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
9
|
/** A datetime data point: `[msSinceEpoch, value]` tuple or `{ x, y }` object. */
|
|
120
10
|
type BarDatetimePoint = DatetimePoint;
|
|
121
11
|
/** A category y-value, or a datetime point when the dimensional axis is `"datetime"`. */
|
|
@@ -205,4 +95,4 @@ interface BarChartProps {
|
|
|
205
95
|
|
|
206
96
|
declare const VerticalBarChart: react.NamedExoticComponent<BarChartProps>;
|
|
207
97
|
|
|
208
|
-
export { type BarChartDirection, type BarChartProps, type BarDataPoint, type BarDatetimePoint, type BarSeries, type BarXAxis, type BarYAxis,
|
|
98
|
+
export { type BarChartDirection, type BarChartProps, type BarDataPoint, type BarDatetimePoint, type BarSeries, type BarXAxis, type BarYAxis, CategoryAxis, ChartExportHandle, DatetimeAxis, ValueFormat, VerticalBarChart };
|
package/dist/bar/index.d.ts
CHANGED
|
@@ -1,121 +1,11 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
3
|
import { TypeIconName } from '@sproutsocial/seeds-react-icon';
|
|
4
|
-
import { c as
|
|
4
|
+
import { C as ChartDataPoint, a as CategoryAxis, D as DatetimeAxis, V as ValueFormat, b as ChartTooltipProps, c as ChartAnnotation, d as DatetimePoint } from '../axis-PJwu5Xmo.js';
|
|
5
5
|
import { C as ChartExportHandle } from '../chartExport-CKYpuhik.js';
|
|
6
|
+
import '../types-B7ILUQ6_.js';
|
|
6
7
|
import 'highcharts';
|
|
7
8
|
|
|
8
|
-
type TypeValuePercentInput = "decimal" | "whole";
|
|
9
|
-
type TypeValueFormatterOptions = Readonly<{
|
|
10
|
-
/** The raw numeric value. For duration, milliseconds. */
|
|
11
|
-
value: number;
|
|
12
|
-
/** default "decimal" */
|
|
13
|
-
numberFormat?: TypeChartNumberFormat;
|
|
14
|
-
/** Only used when numberFormat === "currency". default "USD" */
|
|
15
|
-
currency?: string;
|
|
16
|
-
/** true → 10k threshold; number → max(1000, abs(n)); false → never. default true */
|
|
17
|
-
abbreviate?: boolean | number;
|
|
18
|
-
/** "decimal" scales 0.42 → "42%"; "whole" treats 42 → "42%". default "decimal" */
|
|
19
|
-
percentInput?: TypeValuePercentInput;
|
|
20
|
-
/** locale for decimal/currency/percent (formatNumeral) */
|
|
21
|
-
numberLocale?: Intl.LocalesArgument;
|
|
22
|
-
/** locale for duration (formatDuration) */
|
|
23
|
-
textLocale?: Intl.LocalesArgument;
|
|
24
|
-
}>;
|
|
25
|
-
/**
|
|
26
|
-
* Declarative value-format config for axis ticks and the default tooltip — the
|
|
27
|
-
* full {@link TypeValueFormatterOptions} surface minus `value`, which is
|
|
28
|
-
* supplied per-tick / per-row by the caller (the adapter and tooltip).
|
|
29
|
-
*/
|
|
30
|
-
type ValueFormat = Omit<TypeValueFormatterOptions, "value">;
|
|
31
|
-
|
|
32
|
-
interface ChartTooltipDataRow {
|
|
33
|
-
color: TypeChartStyleColor;
|
|
34
|
-
name: string;
|
|
35
|
-
value: number | null;
|
|
36
|
-
}
|
|
37
|
-
/** Tooltip render-prop signature for v2 charts. */
|
|
38
|
-
interface ChartTooltipProps {
|
|
39
|
-
data: ChartTooltipDataRow[];
|
|
40
|
-
/** Resolved x-axis position. Category name for category axes, numeric for time/linear. */
|
|
41
|
-
position: number | string;
|
|
42
|
-
/** Resolved chart timezone — pass to date formatters when `position` is a numeric timestamp. Undefined on category axes. */
|
|
43
|
-
timezone?: string;
|
|
44
|
-
/** Declarative annotation anchored at this position, if any. Rendered in the tooltip header. */
|
|
45
|
-
annotation?: {
|
|
46
|
-
icon?: TypeIconName;
|
|
47
|
-
color?: string;
|
|
48
|
-
title?: string;
|
|
49
|
-
description?: string;
|
|
50
|
-
};
|
|
51
|
-
/** True when the chart has an `onClick` handler — used by the default tooltip to render the click-label footer. */
|
|
52
|
-
hasOnClick?: boolean;
|
|
53
|
-
/** Footer content shown in the default tooltip when the chart is clickable. */
|
|
54
|
-
tooltipClickLabel?: ReactNode;
|
|
55
|
-
/** Content shown in place of a row's value when the value is null. Defaults to an em-dash. */
|
|
56
|
-
invalidNumberLabel?: ReactNode;
|
|
57
|
-
/** Declarative value format for the tooltip value cell. Omit for raw rendering. Applied at full precision (abbreviation off). */
|
|
58
|
-
valueFormat?: ValueFormat;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* Declarative annotation shape — the DS renders the marker and tooltip header
|
|
63
|
-
* internally; consumers don't supply render functions. See CE-7.
|
|
64
|
-
*/
|
|
65
|
-
interface ChartAnnotation {
|
|
66
|
-
/** Numeric x-axis coordinate — a category index (category axes) or the raw coordinate (datetime/linear axes). */
|
|
67
|
-
position: number;
|
|
68
|
-
/** Icon shown above the chart at `position` and inline with `title` in the tooltip header. */
|
|
69
|
-
icon?: TypeIconName;
|
|
70
|
-
/** Color applied to the marker's vertical line. */
|
|
71
|
-
color?: string;
|
|
72
|
-
/** Tooltip header line 1. */
|
|
73
|
-
title?: string;
|
|
74
|
-
/** Tooltip header line 2. */
|
|
75
|
-
description?: string;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* Pure, Highcharts-free datetime axis label formatter for v2 chart families.
|
|
80
|
-
*
|
|
81
|
-
* Ports v1's `helpers/xAxisLabelFormatter` into a rendering-agnostic shape: it
|
|
82
|
-
* returns a `{ primary, secondary? }` object instead of an HTML string, leaving
|
|
83
|
-
* SVG rendering to the caller. The timezone- and DST-correct boundary detection
|
|
84
|
-
* (calendar parts read in the target timezone) and the per-granularity
|
|
85
|
-
* `Intl.DateTimeFormat` option sets are a near-verbatim port of v1.
|
|
86
|
-
*
|
|
87
|
-
* The one net-new piece versus v1 is granularity derivation: v1 receives
|
|
88
|
-
* `unitName` from Highcharts, but `charts/` may not depend on Highcharts types
|
|
89
|
-
* (see `charts/README.md` invariants), so granularity is derived from the
|
|
90
|
-
* spacing of `tickPositions`.
|
|
91
|
-
*/
|
|
92
|
-
type DatetimeTimeFormat = "12" | "24";
|
|
93
|
-
|
|
94
|
-
/** A datetime data point: `[msSinceEpoch, value]` tuple or `{ x, y }` object. */
|
|
95
|
-
type DatetimePoint = [number, number | null] | {
|
|
96
|
-
x: number;
|
|
97
|
-
y: number | null;
|
|
98
|
-
};
|
|
99
|
-
/** A value on a category axis, or a datetime point when the axis is `"datetime"`. */
|
|
100
|
-
type ChartDataPoint = number | null | DatetimePoint;
|
|
101
|
-
/** Category axis — labels indexed parallel to `series.data`. The default axis type. */
|
|
102
|
-
interface CategoryAxis {
|
|
103
|
-
type?: "category";
|
|
104
|
-
/** Category labels, indexed parallel to `series.data`. */
|
|
105
|
-
categories: Array<string>;
|
|
106
|
-
crosshair?: boolean;
|
|
107
|
-
}
|
|
108
|
-
/** Datetime axis — `series.data` carries timestamped points. */
|
|
109
|
-
interface DatetimeAxis {
|
|
110
|
-
type: "datetime";
|
|
111
|
-
crosshair?: boolean;
|
|
112
|
-
/**
|
|
113
|
-
* 12- or 24-hour clock for hour-granularity tick labels (e.g. `9 AM` vs
|
|
114
|
-
* `09:00`). Default `"12"`. Coarser granularities (day/month/year) ignore it.
|
|
115
|
-
*/
|
|
116
|
-
timeFormat?: DatetimeTimeFormat;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
9
|
/** A datetime data point: `[msSinceEpoch, value]` tuple or `{ x, y }` object. */
|
|
120
10
|
type BarDatetimePoint = DatetimePoint;
|
|
121
11
|
/** A category y-value, or a datetime point when the dimensional axis is `"datetime"`. */
|
|
@@ -205,4 +95,4 @@ interface BarChartProps {
|
|
|
205
95
|
|
|
206
96
|
declare const VerticalBarChart: react.NamedExoticComponent<BarChartProps>;
|
|
207
97
|
|
|
208
|
-
export { type BarChartDirection, type BarChartProps, type BarDataPoint, type BarDatetimePoint, type BarSeries, type BarXAxis, type BarYAxis,
|
|
98
|
+
export { type BarChartDirection, type BarChartProps, type BarDataPoint, type BarDatetimePoint, type BarSeries, type BarXAxis, type BarYAxis, CategoryAxis, ChartExportHandle, DatetimeAxis, ValueFormat, VerticalBarChart };
|