@sproutsocial/seeds-react-data-viz 0.7.32 → 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.
Files changed (47) hide show
  1. package/dist/axis-DXzufRRj.d.mts +116 -0
  2. package/dist/axis-PJwu5Xmo.d.ts +116 -0
  3. package/dist/bar/index.d.mts +98 -0
  4. package/dist/bar/index.d.ts +98 -0
  5. package/dist/bar/index.js +186 -0
  6. package/dist/bar/index.js.map +1 -0
  7. package/dist/chartExport-CKYpuhik.d.mts +28 -0
  8. package/dist/chartExport-CKYpuhik.d.ts +28 -0
  9. package/dist/chunk-EEVKTTT3.js +968 -0
  10. package/dist/chunk-EEVKTTT3.js.map +1 -0
  11. package/dist/chunk-JXARPHQE.js +193 -0
  12. package/dist/chunk-JXARPHQE.js.map +1 -0
  13. package/dist/chunk-VSZSIN34.js +796 -0
  14. package/dist/chunk-VSZSIN34.js.map +1 -0
  15. package/dist/esm/bar/index.js +186 -0
  16. package/dist/esm/bar/index.js.map +1 -0
  17. package/dist/esm/chunk-HQM3EIZW.js +193 -0
  18. package/dist/esm/chunk-HQM3EIZW.js.map +1 -0
  19. package/dist/esm/chunk-LC3HGWDD.js +968 -0
  20. package/dist/esm/chunk-LC3HGWDD.js.map +1 -0
  21. package/dist/esm/chunk-OAN5VC7M.js +796 -0
  22. package/dist/esm/chunk-OAN5VC7M.js.map +1 -0
  23. package/dist/esm/export/index.js +41 -0
  24. package/dist/esm/export/index.js.map +1 -0
  25. package/dist/esm/index.js +262 -1315
  26. package/dist/esm/index.js.map +1 -1
  27. package/dist/esm/line-area/index.js +151 -0
  28. package/dist/esm/line-area/index.js.map +1 -0
  29. package/dist/esm/pdfExportLibs-NWLZH5KL.js +10 -0
  30. package/dist/esm/pdfExportLibs-NWLZH5KL.js.map +1 -0
  31. package/dist/export/index.d.mts +25 -0
  32. package/dist/export/index.d.ts +25 -0
  33. package/dist/export/index.js +41 -0
  34. package/dist/export/index.js.map +1 -0
  35. package/dist/index.d.mts +56 -93
  36. package/dist/index.d.ts +56 -93
  37. package/dist/index.js +407 -1544
  38. package/dist/index.js.map +1 -1
  39. package/dist/line-area/index.d.mts +83 -0
  40. package/dist/line-area/index.d.ts +83 -0
  41. package/dist/line-area/index.js +151 -0
  42. package/dist/line-area/index.js.map +1 -0
  43. package/dist/pdfExportLibs-BZR2D3RA.js +10 -0
  44. package/dist/pdfExportLibs-BZR2D3RA.js.map +1 -0
  45. package/dist/types-B7ILUQ6_.d.mts +99 -0
  46. package/dist/types-B7ILUQ6_.d.ts +99 -0
  47. package/package.json +37 -11
@@ -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 };
@@ -0,0 +1,98 @@
1
+ import * as react from 'react';
2
+ import { ReactNode } from 'react';
3
+ import { TypeIconName } from '@sproutsocial/seeds-react-icon';
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
+ import { C as ChartExportHandle } from '../chartExport-CKYpuhik.mjs';
6
+ import '../types-B7ILUQ6_.mjs';
7
+ import 'highcharts';
8
+
9
+ /** A datetime data point: `[msSinceEpoch, value]` tuple or `{ x, y }` object. */
10
+ type BarDatetimePoint = DatetimePoint;
11
+ /** A category y-value, or a datetime point when the dimensional axis is `"datetime"`. */
12
+ type BarDataPoint = ChartDataPoint;
13
+ interface BarSeries {
14
+ name: string;
15
+ /**
16
+ * Y-values indexed parallel to `xAxis.categories` on a category axis, or
17
+ * `[timestamp, value]` / `{ x, y }` points on a datetime axis.
18
+ */
19
+ data: Array<BarDataPoint>;
20
+ color?: string;
21
+ /** Seeds icon or partner-logo name rendered before the series name in the legend. */
22
+ icon?: TypeIconName;
23
+ }
24
+ type BarXAxis = CategoryAxis | DatetimeAxis;
25
+ interface BarYAxis {
26
+ min?: number;
27
+ max?: number;
28
+ /** Default: true. */
29
+ showGridLines?: boolean;
30
+ title?: string;
31
+ /**
32
+ * Declarative value formatting applied to y-axis tick labels and the default
33
+ * tooltip value. Omit for the zero-config decimal default (smart 1k/10k
34
+ * abbreviation on the axis, raw values in the tooltip).
35
+ */
36
+ format?: ValueFormat;
37
+ /**
38
+ * Show y-axis tick labels. Default `true`. `false` hides them (maps to
39
+ * Highcharts' `labels.enabled`, replacing v1's `() => ""` formatter trick).
40
+ */
41
+ showLabels?: boolean;
42
+ }
43
+ /**
44
+ * Direction in which bars are drawn. Single-member union for now; expands to
45
+ * `"vertical" | "horizontal"` when `HorizontalBarChart` ships.
46
+ */
47
+ type BarChartDirection = "vertical";
48
+ interface BarChartProps {
49
+ /** Wired into Highcharts' `accessibility.description`. */
50
+ description: string;
51
+ series: Array<BarSeries>;
52
+ /**
53
+ * Maximum number of series to display. Series beyond the limit are dropped to
54
+ * keep the chart readable and accessible. Default `10`.
55
+ */
56
+ seriesLimit?: number;
57
+ /**
58
+ * Suppress the `console.warn` emitted when the series count exceeds the limit.
59
+ * The cap still applies. Default `false`.
60
+ */
61
+ hideSeriesLimitWarning?: boolean;
62
+ xAxis: BarXAxis;
63
+ yAxis?: BarYAxis;
64
+ /** IANA timezone for datetime-axis ticks and tooltips. Default `"UTC"`. Ignored for category axes. */
65
+ timezone?: string;
66
+ /**
67
+ * Stacking mode for multi-series charts. Defaults to `"normal"` — the
68
+ * canonical design-system spec renders multi-series bar charts as a single
69
+ * stacked column per category. `"percent"` normalizes each column to 100%.
70
+ * `"grouped"` renders series as adjacent bars per category; not part of the
71
+ * canonical spec, but available for non-standard use cases.
72
+ */
73
+ stacking?: "normal" | "percent" | "grouped";
74
+ /** Appended to each tooltip value (e.g., `" MT"`, `"%"`). */
75
+ valueSuffix?: string;
76
+ /** Override for the default tooltip content. */
77
+ tooltip?: (args: ChartTooltipProps) => ReactNode;
78
+ /** Declarative annotations rendered at positions on the chart. */
79
+ annotations?: ChartAnnotation[];
80
+ /** Click handler invoked with the dimensional-axis value of the clicked column — the category name on a category axis, the numeric timestamp on a datetime axis. `position` is direction-agnostic: the x-axis value on `VerticalBarChart`, the y-axis value on `HorizontalBarChart`. */
81
+ onClick?: ({ position }: {
82
+ position: number | string;
83
+ }) => void;
84
+ /** Footer content shown in the default tooltip when `onClick` is set. */
85
+ tooltipClickLabel?: ReactNode;
86
+ /** Override for the value shown when a data point is invalid/missing (null). Defaults to an em-dash. */
87
+ invalidNumberLabel?: ReactNode;
88
+ /**
89
+ * Fired once per chart instance with an opaque {@link ChartExportHandle} for
90
+ * triggering PNG/SVG/PDF/CSV downloads. Re-fires only on a genuine remount,
91
+ * never on data or prop updates.
92
+ */
93
+ onReady?: (handle: ChartExportHandle) => void;
94
+ }
95
+
96
+ declare const VerticalBarChart: react.NamedExoticComponent<BarChartProps>;
97
+
98
+ export { type BarChartDirection, type BarChartProps, type BarDataPoint, type BarDatetimePoint, type BarSeries, type BarXAxis, type BarYAxis, CategoryAxis, ChartExportHandle, DatetimeAxis, ValueFormat, VerticalBarChart };
@@ -0,0 +1,98 @@
1
+ import * as react from 'react';
2
+ import { ReactNode } from 'react';
3
+ import { TypeIconName } from '@sproutsocial/seeds-react-icon';
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
+ import { C as ChartExportHandle } from '../chartExport-CKYpuhik.js';
6
+ import '../types-B7ILUQ6_.js';
7
+ import 'highcharts';
8
+
9
+ /** A datetime data point: `[msSinceEpoch, value]` tuple or `{ x, y }` object. */
10
+ type BarDatetimePoint = DatetimePoint;
11
+ /** A category y-value, or a datetime point when the dimensional axis is `"datetime"`. */
12
+ type BarDataPoint = ChartDataPoint;
13
+ interface BarSeries {
14
+ name: string;
15
+ /**
16
+ * Y-values indexed parallel to `xAxis.categories` on a category axis, or
17
+ * `[timestamp, value]` / `{ x, y }` points on a datetime axis.
18
+ */
19
+ data: Array<BarDataPoint>;
20
+ color?: string;
21
+ /** Seeds icon or partner-logo name rendered before the series name in the legend. */
22
+ icon?: TypeIconName;
23
+ }
24
+ type BarXAxis = CategoryAxis | DatetimeAxis;
25
+ interface BarYAxis {
26
+ min?: number;
27
+ max?: number;
28
+ /** Default: true. */
29
+ showGridLines?: boolean;
30
+ title?: string;
31
+ /**
32
+ * Declarative value formatting applied to y-axis tick labels and the default
33
+ * tooltip value. Omit for the zero-config decimal default (smart 1k/10k
34
+ * abbreviation on the axis, raw values in the tooltip).
35
+ */
36
+ format?: ValueFormat;
37
+ /**
38
+ * Show y-axis tick labels. Default `true`. `false` hides them (maps to
39
+ * Highcharts' `labels.enabled`, replacing v1's `() => ""` formatter trick).
40
+ */
41
+ showLabels?: boolean;
42
+ }
43
+ /**
44
+ * Direction in which bars are drawn. Single-member union for now; expands to
45
+ * `"vertical" | "horizontal"` when `HorizontalBarChart` ships.
46
+ */
47
+ type BarChartDirection = "vertical";
48
+ interface BarChartProps {
49
+ /** Wired into Highcharts' `accessibility.description`. */
50
+ description: string;
51
+ series: Array<BarSeries>;
52
+ /**
53
+ * Maximum number of series to display. Series beyond the limit are dropped to
54
+ * keep the chart readable and accessible. Default `10`.
55
+ */
56
+ seriesLimit?: number;
57
+ /**
58
+ * Suppress the `console.warn` emitted when the series count exceeds the limit.
59
+ * The cap still applies. Default `false`.
60
+ */
61
+ hideSeriesLimitWarning?: boolean;
62
+ xAxis: BarXAxis;
63
+ yAxis?: BarYAxis;
64
+ /** IANA timezone for datetime-axis ticks and tooltips. Default `"UTC"`. Ignored for category axes. */
65
+ timezone?: string;
66
+ /**
67
+ * Stacking mode for multi-series charts. Defaults to `"normal"` — the
68
+ * canonical design-system spec renders multi-series bar charts as a single
69
+ * stacked column per category. `"percent"` normalizes each column to 100%.
70
+ * `"grouped"` renders series as adjacent bars per category; not part of the
71
+ * canonical spec, but available for non-standard use cases.
72
+ */
73
+ stacking?: "normal" | "percent" | "grouped";
74
+ /** Appended to each tooltip value (e.g., `" MT"`, `"%"`). */
75
+ valueSuffix?: string;
76
+ /** Override for the default tooltip content. */
77
+ tooltip?: (args: ChartTooltipProps) => ReactNode;
78
+ /** Declarative annotations rendered at positions on the chart. */
79
+ annotations?: ChartAnnotation[];
80
+ /** Click handler invoked with the dimensional-axis value of the clicked column — the category name on a category axis, the numeric timestamp on a datetime axis. `position` is direction-agnostic: the x-axis value on `VerticalBarChart`, the y-axis value on `HorizontalBarChart`. */
81
+ onClick?: ({ position }: {
82
+ position: number | string;
83
+ }) => void;
84
+ /** Footer content shown in the default tooltip when `onClick` is set. */
85
+ tooltipClickLabel?: ReactNode;
86
+ /** Override for the value shown when a data point is invalid/missing (null). Defaults to an em-dash. */
87
+ invalidNumberLabel?: ReactNode;
88
+ /**
89
+ * Fired once per chart instance with an opaque {@link ChartExportHandle} for
90
+ * triggering PNG/SVG/PDF/CSV downloads. Re-fires only on a genuine remount,
91
+ * never on data or prop updates.
92
+ */
93
+ onReady?: (handle: ChartExportHandle) => void;
94
+ }
95
+
96
+ declare const VerticalBarChart: react.NamedExoticComponent<BarChartProps>;
97
+
98
+ export { type BarChartDirection, type BarChartProps, type BarDataPoint, type BarDatetimePoint, type BarSeries, type BarXAxis, type BarYAxis, CategoryAxis, ChartExportHandle, DatetimeAxis, ValueFormat, VerticalBarChart };
@@ -0,0 +1,186 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
+
3
+
4
+ var _chunkJXARPHQEjs = require('../chunk-JXARPHQE.js');
5
+
6
+
7
+
8
+
9
+
10
+
11
+
12
+
13
+
14
+ var _chunkVSZSIN34js = require('../chunk-VSZSIN34.js');
15
+ require('../chunk-EEVKTTT3.js');
16
+
17
+ // src/charts/bar/VerticalBarChart.tsx
18
+ var _react = require('react');
19
+
20
+ // src/charts/bar/adapter.ts
21
+ function highchartsType(direction) {
22
+ switch (direction) {
23
+ case "vertical":
24
+ return "column";
25
+ }
26
+ }
27
+ function buildBarChartOptions(props, direction, series = props.series) {
28
+ const chartType = highchartsType(direction);
29
+ const isDatetime = props.xAxis.type === "datetime";
30
+ const tooltipTimezone = _chunkVSZSIN34js.resolveTooltipTimezone.call(void 0, props.xAxis, props.timezone);
31
+ const { annotations, lookup: annotationLookup } = _chunkVSZSIN34js.buildAnnotationConfig.call(void 0,
32
+ props.annotations
33
+ );
34
+ const options = {
35
+ ..._chunkVSZSIN34js.buildBaseChartOptions.call(void 0, {
36
+ type: chartType,
37
+ description: props.description,
38
+ valueSuffix: props.valueSuffix,
39
+ reserveTopMargin: Boolean(annotations),
40
+ timezone: tooltipTimezone
41
+ }),
42
+ xAxis: _chunkVSZSIN34js.buildDimensionalAxis.call(void 0, props.xAxis, _nullishCoalesce(tooltipTimezone, () => ( "UTC"))),
43
+ yAxis: {
44
+ min: _optionalChain([props, 'access', _ => _.yAxis, 'optionalAccess', _2 => _2.min]),
45
+ max: _optionalChain([props, 'access', _3 => _3.yAxis, 'optionalAccess', _4 => _4.max]),
46
+ gridLineWidth: _optionalChain([props, 'access', _5 => _5.yAxis, 'optionalAccess', _6 => _6.showGridLines]) === false ? 0 : 1,
47
+ title: { text: _nullishCoalesce(_optionalChain([props, 'access', _7 => _7.yAxis, 'optionalAccess', _8 => _8.title]), () => ( "")) },
48
+ labels: {
49
+ // `showLabels` toggles tick-label visibility; defaults to shown.
50
+ enabled: _optionalChain([props, 'access', _9 => _9.yAxis, 'optionalAccess', _10 => _10.showLabels]) !== false,
51
+ // A declarative `format` drives ticks through the shared valueFormatter;
52
+ // absent it, the zero-config decimal default (1.20K / 1.20M / 1.20B).
53
+ formatter: _optionalChain([props, 'access', _11 => _11.yAxis, 'optionalAccess', _12 => _12.format]) ? _chunkVSZSIN34js.makeValueAxisLabelFormatter.call(void 0, props.yAxis.format) : _chunkVSZSIN34js.defaultValueAxisLabelFormatter
54
+ }
55
+ },
56
+ plotOptions: {
57
+ series: { animation: false },
58
+ column: {
59
+ // "grouped" maps to omitting `stacking` — Highcharts renders multi-series
60
+ // columns side-by-side when no stacking is set.
61
+ ...props.stacking === "grouped" ? {} : { stacking: _nullishCoalesce(props.stacking, () => ( "normal")) },
62
+ pointPadding: 0.25,
63
+ groupPadding: 0.25,
64
+ // Fixed bar width on datetime axes. Sparse time-series otherwise size
65
+ // columns from the (large) gap between points and balloon; this mirrors
66
+ // v1's `pointWidth: 20` time-series treatment. Dense datetime data may
67
+ // instead want a `maxPointWidth` cap — revisit when Line/Area land.
68
+ ...isDatetime ? { pointWidth: 20 } : {},
69
+ borderRadius: 4,
70
+ borderWidth: 0,
71
+ // Pairs with the `:hover` dimming rule in `styles.ts`: while the cursor
72
+ // is over the chart, all bars dim; these handlers restore opacity for
73
+ // every bar at the hovered x (so stacked/grouped columns highlight
74
+ // together rather than just the single hovered bar).
75
+ point: {
76
+ events: {
77
+ click: props.onClick ? (event) => props.onClick({ position: event.point.x }) : void 0,
78
+ mouseOver: function() {
79
+ const x = this.x;
80
+ this.series.chart.series.forEach((s) => {
81
+ if (s.type !== "column") return;
82
+ s.data.forEach((point) => {
83
+ if (point.x !== x) return;
84
+ _optionalChain([point, 'access', _13 => _13.graphic, 'optionalAccess', _14 => _14.element, 'optionalAccess', _15 => _15.classList, 'access', _16 => _16.add, 'call', _17 => _17("column-hover")]);
85
+ });
86
+ });
87
+ },
88
+ mouseOut: function() {
89
+ this.series.chart.series.forEach((s) => {
90
+ if (s.type !== "column") return;
91
+ s.data.forEach((point) => {
92
+ _optionalChain([point, 'access', _18 => _18.graphic, 'optionalAccess', _19 => _19.element, 'optionalAccess', _20 => _20.classList, 'access', _21 => _21.remove, 'call', _22 => _22("column-hover")]);
93
+ });
94
+ });
95
+ }
96
+ }
97
+ }
98
+ }
99
+ },
100
+ series: series.map((s) => ({
101
+ type: chartType,
102
+ name: s.name,
103
+ data: [...s.data],
104
+ color: s.color
105
+ })),
106
+ ...annotations ? { annotations } : {}
107
+ };
108
+ return { options, annotationLookup, tooltipTimezone };
109
+ }
110
+
111
+ // src/charts/bar/styles.ts
112
+ var _styledcomponents = require('styled-components'); var _styledcomponents2 = _interopRequireDefault(_styledcomponents);
113
+ var _seedsreactbox = require('@sproutsocial/seeds-react-box');
114
+
115
+ // src/charts/shared/styles.ts
116
+
117
+ var axisLabelV2Styles = _styledcomponents.css`
118
+ .highcharts-xaxis-labels,
119
+ .highcharts-yaxis-labels {
120
+ // SVG labels (styledMode): fill is the SVG text colour; color has no effect.
121
+ text {
122
+ font-family: ${({ theme }) => theme.fontFamily};
123
+ ${({ theme }) => theme.typography[100]};
124
+ font-weight: ${({ theme }) => theme.fontWeights.normal};
125
+ fill: ${({ theme }) => theme.colors.text.subtext};
126
+ }
127
+ }
128
+ // Two-line stacked datetime label: the boundary token is an
129
+ // hc-axis-label-secondary tspan on a second line, rendered semibold.
130
+ .highcharts-xaxis-labels text tspan.hc-axis-label-secondary {
131
+ font-weight: ${({ theme }) => theme.fontWeights.semibold};
132
+ }
133
+ `;
134
+
135
+ // src/charts/bar/styles.ts
136
+ var VerticalBarStyledBox = _styledcomponents2.default.call(void 0, _seedsreactbox.Box)`
137
+ ${_chunkJXARPHQEjs.verticalBarChartStyles}
138
+ ${axisLabelV2Styles}
139
+ `;
140
+
141
+ // src/charts/bar/VerticalBarChart.tsx
142
+ var _jsxruntime = require('react/jsx-runtime');
143
+ var VerticalBarChart = _react.memo.call(void 0, function VerticalBarChart2(props) {
144
+ const seriesLimit = _nullishCoalesce(props.seriesLimit, () => ( _chunkJXARPHQEjs.VERTICAL_BAR_CHART_DEFAULT_SERIES_LIMIT));
145
+ const { colors, series } = _chunkVSZSIN34js.useSeedsChartSetup.call(void 0, {
146
+ series: props.series,
147
+ seriesLimit,
148
+ isSeriesLimitOverridden: props.seriesLimit !== void 0,
149
+ hideSeriesLimitWarning: props.hideSeriesLimitWarning,
150
+ componentName: "VerticalBarChart"
151
+ });
152
+ const { options, annotationLookup, tooltipTimezone } = buildBarChartOptions(
153
+ props,
154
+ "vertical",
155
+ series
156
+ );
157
+ const hasOnClick = Boolean(props.onClick);
158
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
159
+ VerticalBarStyledBox,
160
+ {
161
+ $colors: colors,
162
+ $hasOnClick: hasOnClick,
163
+ bg: "container.background.base",
164
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
165
+ _chunkVSZSIN34js.ChartRenderer,
166
+ {
167
+ options,
168
+ series,
169
+ colors,
170
+ tooltip: props.tooltip,
171
+ annotationLookup,
172
+ hasOnClick,
173
+ tooltipClickLabel: props.tooltipClickLabel,
174
+ timezone: tooltipTimezone,
175
+ invalidNumberLabel: props.invalidNumberLabel,
176
+ valueFormat: _optionalChain([props, 'access', _23 => _23.yAxis, 'optionalAccess', _24 => _24.format]),
177
+ onReady: props.onReady
178
+ }
179
+ )
180
+ }
181
+ );
182
+ });
183
+
184
+
185
+ exports.VerticalBarChart = VerticalBarChart;
186
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/home/runner/_work/seeds/seeds/seeds-react/seeds-react-data-viz/dist/bar/index.js","../../src/charts/bar/VerticalBarChart.tsx","../../src/charts/bar/adapter.ts","../../src/charts/bar/styles.ts","../../src/charts/shared/styles.ts"],"names":["VerticalBarChart"],"mappings":"AAAA;AACE;AACA;AACF,uDAA6B;AAC7B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,uDAA6B;AAC7B,gCAA6B;AAC7B;AACA;AChBA,8BAAqB;ADkBrB;AACA;AEFA,SAAS,cAAA,CAAe,SAAA,EAAwC;AAC9D,EAAA,OAAA,CAAQ,SAAA,EAAW;AAAA,IACjB,KAAK,UAAA;AACH,MAAA,OAAO,QAAA;AAAA,EACX;AACF;AAEO,SAAS,oBAAA,CACd,KAAA,EACA,SAAA,EAIA,OAAA,EAAkC,KAAA,CAAM,MAAA,EAMxC;AACA,EAAA,MAAM,UAAA,EAAY,cAAA,CAAe,SAAS,CAAA;AAC1C,EAAA,MAAM,WAA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EAAG,2BAAA;AAAA,MAEH,QAAA,kBAAA,6BAAA;AAAA,QAAC,8BAAA;AAAA,QAAA;AAAA,UACC,OAAA;AAAA,UACA,MAAA;AAAA,UACA,MAAA;AAAA,UACA,OAAA,EAAS,KAAA,CAAM,OAAA;AAAA,UACf,gBAAA;AAAA,UACA,UAAA;AAAA,UACA,iBAAA,EAAmB,KAAA,CAAM,iBAAA;AAAA,UACzB,QAAA,EAAU,eAAA;AAAA,UACV,kBAAA,EAAoB,KAAA,CAAM,kBAAA;AAAA,UAC1B,WAAA,kBAAa,KAAA,uBAAM,KAAA,+BAAO,QAAA;AAAA,UAC1B,OAAA,EAAS,KAAA,CAAM;AAAA,QAAA;AAAA,MACjB;AAAA,IAAA;AAAA,EACF,CAAA;AAEJ,CAAC,CAAA;ADmID;AACE;AACF,4CAAC","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 { buildBarChartOptions } from \"./adapter\";\nimport { VerticalBarStyledBox } from \"./styles\";\nimport type { BarChartProps } from \"./types\";\nimport { VERTICAL_BAR_CHART_DEFAULT_SERIES_LIMIT } from \"../../constants\";\n\nexport const VerticalBarChart = memo(function VerticalBarChart(\n props: BarChartProps\n) {\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 =\n props.seriesLimit ?? VERTICAL_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: \"VerticalBarChart\",\n });\n\n const { options, annotationLookup, tooltipTimezone } = buildBarChartOptions(\n props,\n \"vertical\",\n series\n );\n const hasOnClick = Boolean(props.onClick);\n\n return (\n <VerticalBarStyledBox\n $colors={colors}\n $hasOnClick={hasOnClick}\n bg=\"container.background.base\"\n >\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 timezone={tooltipTimezone}\n invalidNumberLabel={props.invalidNumberLabel}\n valueFormat={props.yAxis?.format}\n onReady={props.onReady}\n />\n </VerticalBarStyledBox>\n );\n});\n","import { buildAnnotationConfig } from \"../shared/annotations\";\nimport type { ChartAnnotationLookup } from \"../shared/annotations\";\nimport type { SeedsChartOptions } from \"../shared/chartBase\";\nimport { buildBaseChartOptions } from \"../shared/baseChartOptions\";\nimport {\n buildDimensionalAxis,\n resolveTooltipTimezone,\n} from \"../shared/axisOptions\";\nimport {\n defaultValueAxisLabelFormatter,\n makeValueAxisLabelFormatter,\n} from \"../shared/valueAxisLabelFormatter\";\nimport type { BarChartDirection, BarChartProps } from \"./types\";\n\n// `direction` is a single-member union for now (`\"vertical\"`). When\n// `HorizontalBarChart` ships, the union expands and this switch fails to\n// compile until the `\"horizontal\"` case is added.\nfunction highchartsType(direction: BarChartDirection): \"column\" {\n switch (direction) {\n case \"vertical\":\n return \"column\";\n }\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 timezone for the tooltip date formatter; undefined on category axes. */\n tooltipTimezone: string | undefined;\n} {\n const chartType = highchartsType(direction);\n const isDatetime = props.xAxis.type === \"datetime\";\n const tooltipTimezone = resolveTooltipTimezone(props.xAxis, props.timezone);\n const { annotations, lookup: annotationLookup } = buildAnnotationConfig(\n props.annotations\n );\n const options: SeedsChartOptions = {\n ...buildBaseChartOptions({\n type: chartType,\n description: props.description,\n valueSuffix: props.valueSuffix,\n reserveTopMargin: Boolean(annotations),\n timezone: tooltipTimezone,\n }),\n xAxis: buildDimensionalAxis(props.xAxis, tooltipTimezone ?? \"UTC\"),\n yAxis: {\n min: props.yAxis?.min,\n max: props.yAxis?.max,\n gridLineWidth: props.yAxis?.showGridLines === false ? 0 : 1,\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 column: {\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 pointPadding: 0.25,\n groupPadding: 0.25,\n // Fixed bar width on datetime axes. Sparse time-series otherwise size\n // columns from the (large) gap between points and balloon; this mirrors\n // v1's `pointWidth: 20` time-series treatment. Dense datetime data may\n // 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 columns highlight\n // together 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 this.series.chart.series.forEach((s) => {\n if (s.type !== \"column\") return;\n s.data.forEach((point) => {\n if (point.x !== x) return;\n point.graphic?.element?.classList.add(\"column-hover\");\n });\n });\n },\n mouseOut: function () {\n this.series.chart.series.forEach((s) => {\n if (s.type !== \"column\") return;\n s.data.forEach((point) => {\n point.graphic?.element?.classList.remove(\"column-hover\");\n });\n });\n },\n },\n },\n },\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, tooltipTimezone };\n}\n","import styled from \"styled-components\";\nimport { Box } from \"@sproutsocial/seeds-react-box\";\nimport { verticalBarChartStyles } from \"../../components/VerticalBarChart/styles\";\nimport { axisLabelV2Styles } from \"../shared/styles\";\nimport type {\n TypeChartStyleColor,\n TypeChartStyleHasOnClick,\n} from \"../../types\";\n\ntype StyleProps = Readonly<{\n $colors: ReadonlyArray<TypeChartStyleColor>;\n $hasOnClick: TypeChartStyleHasOnClick;\n}>;\n\nexport const VerticalBarStyledBox = styled(Box)<StyleProps>`\n ${verticalBarChartStyles}\n ${axisLabelV2Styles}\n`;\n","import { css } from \"styled-components\";\n\n/**\n * v2 chart axis-label styles. v2 charts render in `styledMode` with\n * `useHTML: false`, so axis labels are SVG `<text>` / `<tspan>` rather than the\n * HTML `<span>`s v1 uses; these mirror the v1 HTML label rules in\n * `styles/chartStyles.ts` for the SVG element type.\n *\n * Kept here, separate from v1's `timeSeriesChartStyles`: v2 may *consume* the v1\n * styles, but v2-specific rules must not accrete into the v1 files — that keeps\n * the eventual v1 → v2 port clean and avoids coupling. Compose this into each v2\n * chart family's styled wrapper.\n */\nexport const axisLabelV2Styles = css`\n .highcharts-xaxis-labels,\n .highcharts-yaxis-labels {\n // SVG labels (styledMode): fill is the SVG text colour; color has no effect.\n text {\n font-family: ${({ theme }) => theme.fontFamily};\n ${({ theme }) => theme.typography[100]};\n font-weight: ${({ theme }) => theme.fontWeights.normal};\n fill: ${({ theme }) => theme.colors.text.subtext};\n }\n }\n // Two-line stacked datetime label: the boundary token is an\n // hc-axis-label-secondary tspan on a second line, rendered semibold.\n .highcharts-xaxis-labels text tspan.hc-axis-label-secondary {\n font-weight: ${({ theme }) => theme.fontWeights.semibold};\n }\n`;\n"]}