@sproutsocial/seeds-react-data-viz 0.19.0 → 0.20.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/bar/index.d.mts +18 -4
- package/dist/bar/index.d.ts +18 -4
- package/dist/bar/index.js +31 -16
- package/dist/bar/index.js.map +1 -1
- package/dist/charts.css +583 -0
- package/dist/{chunk-DLO4WZLT.js → chunk-27M4FDNK.js} +14 -14
- package/dist/chunk-27M4FDNK.js.map +1 -0
- package/dist/chunk-46L4YBLC.js +544 -0
- package/dist/chunk-46L4YBLC.js.map +1 -0
- package/dist/{chunk-4IOYAUAK.js → chunk-XYE6O77Z.js} +3 -3
- package/dist/{chunk-4IOYAUAK.js.map → chunk-XYE6O77Z.js.map} +1 -1
- package/dist/donut/index.d.mts +13 -4
- package/dist/donut/index.d.ts +13 -4
- package/dist/donut/index.js +16 -10
- package/dist/donut/index.js.map +1 -1
- package/dist/esm/bar/index.js +18 -3
- package/dist/esm/bar/index.js.map +1 -1
- package/dist/esm/{chunk-J5QE7VCW.js → chunk-KMFRRUTY.js} +2 -2
- package/dist/esm/{chunk-U6ZOSXK7.js → chunk-QSSYSKRP.js} +2 -2
- package/dist/esm/chunk-QSSYSKRP.js.map +1 -0
- package/dist/esm/chunk-XEKQTAUH.js +544 -0
- package/dist/esm/chunk-XEKQTAUH.js.map +1 -0
- package/dist/esm/donut/index.js +12 -6
- package/dist/esm/donut/index.js.map +1 -1
- package/dist/esm/index.js +536 -134
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/line-area/index.js +11 -5
- package/dist/esm/line-area/index.js.map +1 -1
- package/dist/esm/sparkline/index.js +2 -2
- package/dist/index.js +497 -95
- package/dist/index.js.map +1 -1
- package/dist/interactions-DoWoL7bu.d.mts +29 -0
- package/dist/interactions-DoWoL7bu.d.ts +29 -0
- package/dist/line-area/index.d.mts +15 -4
- package/dist/line-area/index.d.ts +15 -4
- package/dist/line-area/index.js +16 -10
- package/dist/line-area/index.js.map +1 -1
- package/dist/sparkline/index.js +4 -4
- package/package.json +7 -2
- package/dist/chunk-DLO4WZLT.js.map +0 -1
- package/dist/chunk-WEKDYQ4T.js +0 -968
- package/dist/chunk-WEKDYQ4T.js.map +0 -1
- package/dist/esm/chunk-U6ZOSXK7.js.map +0 -1
- package/dist/esm/chunk-Z4LOM4OZ.js +0 -968
- package/dist/esm/chunk-Z4LOM4OZ.js.map +0 -1
- /package/dist/esm/{chunk-J5QE7VCW.js.map → chunk-KMFRRUTY.js.map} +0 -0
package/dist/bar/index.d.mts
CHANGED
|
@@ -4,6 +4,8 @@ import { TypeIconName } from '@sproutsocial/seeds-react-icon';
|
|
|
4
4
|
import { C as ChartAnnotation } from '../annotations-CjFoRPXf.mjs';
|
|
5
5
|
import { V as ValueFormat, C as ChartTooltipProps } from '../chartBase-Cn_5CUJi.mjs';
|
|
6
6
|
import { C as ChartExportHandle } from '../chartExport-CKYpuhik.mjs';
|
|
7
|
+
import { C as ChartClickHandler, a as ChartHoverHandler } from '../interactions-DoWoL7bu.mjs';
|
|
8
|
+
export { b as ChartHoverSeries } from '../interactions-DoWoL7bu.mjs';
|
|
7
9
|
import { C as ChartDataPoint, a as CategoryAxis, D as DatetimeAxis, b as DatetimePoint } from '../axis-WOeYkTO1.mjs';
|
|
8
10
|
import '../types-DxrhdAdn.mjs';
|
|
9
11
|
import 'highcharts';
|
|
@@ -56,9 +58,21 @@ interface BarChartProps {
|
|
|
56
58
|
/** Declarative annotations rendered at positions on the chart. */
|
|
57
59
|
annotations?: ChartAnnotation[];
|
|
58
60
|
/** Click handler invoked with the category name or timestamp of the clicked bar. */
|
|
59
|
-
onClick?:
|
|
60
|
-
|
|
61
|
-
|
|
61
|
+
onClick?: ChartClickHandler;
|
|
62
|
+
/**
|
|
63
|
+
* Fired when the pointer enters a bar (also on keyboard focus), with the
|
|
64
|
+
* category name or timestamp of the bar as `position`. For a multi-series bar
|
|
65
|
+
* chart the payload also carries `series: { name, index }` identifying the
|
|
66
|
+
* hovered series; it is omitted for single-series charts.
|
|
67
|
+
*/
|
|
68
|
+
onMouseEnter?: ChartHoverHandler;
|
|
69
|
+
/**
|
|
70
|
+
* Fired when the pointer leaves a bar (also on keyboard blur), with the
|
|
71
|
+
* category name or timestamp of the bar as `position`. For a multi-series bar
|
|
72
|
+
* chart the payload also carries `series: { name, index }` identifying the
|
|
73
|
+
* hovered series; it is omitted for single-series charts.
|
|
74
|
+
*/
|
|
75
|
+
onMouseLeave?: ChartHoverHandler;
|
|
62
76
|
/** Footer content shown in the default tooltip when `onClick` is set. */
|
|
63
77
|
tooltipClickLabel?: ReactNode;
|
|
64
78
|
/** Override for the value shown when a data point is null. Defaults to an em-dash. */
|
|
@@ -76,4 +90,4 @@ interface BarChartProps {
|
|
|
76
90
|
|
|
77
91
|
declare const BarChart: react.NamedExoticComponent<BarChartProps>;
|
|
78
92
|
|
|
79
|
-
export { BarChart, type BarChartDirection, type BarChartProps, type BarDataPoint, type BarDatetimePoint, type BarSeries, type BarXAxis, type BarYAxis, CategoryAxis, ChartExportHandle, DatetimeAxis, ValueFormat };
|
|
93
|
+
export { BarChart, type BarChartDirection, type BarChartProps, type BarDataPoint, type BarDatetimePoint, type BarSeries, type BarXAxis, type BarYAxis, CategoryAxis, ChartClickHandler, ChartExportHandle, ChartHoverHandler, DatetimeAxis, ValueFormat };
|
package/dist/bar/index.d.ts
CHANGED
|
@@ -4,6 +4,8 @@ import { TypeIconName } from '@sproutsocial/seeds-react-icon';
|
|
|
4
4
|
import { C as ChartAnnotation } from '../annotations-CjFoRPXf.js';
|
|
5
5
|
import { V as ValueFormat, C as ChartTooltipProps } from '../chartBase-C-l7yYGx.js';
|
|
6
6
|
import { C as ChartExportHandle } from '../chartExport-CKYpuhik.js';
|
|
7
|
+
import { C as ChartClickHandler, a as ChartHoverHandler } from '../interactions-DoWoL7bu.js';
|
|
8
|
+
export { b as ChartHoverSeries } from '../interactions-DoWoL7bu.js';
|
|
7
9
|
import { C as ChartDataPoint, a as CategoryAxis, D as DatetimeAxis, b as DatetimePoint } from '../axis-WOeYkTO1.js';
|
|
8
10
|
import '../types-DxrhdAdn.js';
|
|
9
11
|
import 'highcharts';
|
|
@@ -56,9 +58,21 @@ interface BarChartProps {
|
|
|
56
58
|
/** Declarative annotations rendered at positions on the chart. */
|
|
57
59
|
annotations?: ChartAnnotation[];
|
|
58
60
|
/** Click handler invoked with the category name or timestamp of the clicked bar. */
|
|
59
|
-
onClick?:
|
|
60
|
-
|
|
61
|
-
|
|
61
|
+
onClick?: ChartClickHandler;
|
|
62
|
+
/**
|
|
63
|
+
* Fired when the pointer enters a bar (also on keyboard focus), with the
|
|
64
|
+
* category name or timestamp of the bar as `position`. For a multi-series bar
|
|
65
|
+
* chart the payload also carries `series: { name, index }` identifying the
|
|
66
|
+
* hovered series; it is omitted for single-series charts.
|
|
67
|
+
*/
|
|
68
|
+
onMouseEnter?: ChartHoverHandler;
|
|
69
|
+
/**
|
|
70
|
+
* Fired when the pointer leaves a bar (also on keyboard blur), with the
|
|
71
|
+
* category name or timestamp of the bar as `position`. For a multi-series bar
|
|
72
|
+
* chart the payload also carries `series: { name, index }` identifying the
|
|
73
|
+
* hovered series; it is omitted for single-series charts.
|
|
74
|
+
*/
|
|
75
|
+
onMouseLeave?: ChartHoverHandler;
|
|
62
76
|
/** Footer content shown in the default tooltip when `onClick` is set. */
|
|
63
77
|
tooltipClickLabel?: ReactNode;
|
|
64
78
|
/** Override for the value shown when a data point is null. Defaults to an em-dash. */
|
|
@@ -76,4 +90,4 @@ interface BarChartProps {
|
|
|
76
90
|
|
|
77
91
|
declare const BarChart: react.NamedExoticComponent<BarChartProps>;
|
|
78
92
|
|
|
79
|
-
export { BarChart, type BarChartDirection, type BarChartProps, type BarDataPoint, type BarDatetimePoint, type BarSeries, type BarXAxis, type BarYAxis, CategoryAxis, ChartExportHandle, DatetimeAxis, ValueFormat };
|
|
93
|
+
export { BarChart, type BarChartDirection, type BarChartProps, type BarDataPoint, type BarDatetimePoint, type BarSeries, type BarXAxis, type BarYAxis, CategoryAxis, ChartClickHandler, ChartExportHandle, ChartHoverHandler, DatetimeAxis, ValueFormat };
|
package/dist/bar/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var _chunkXYE6O77Zjs = require('../chunk-XYE6O77Z.js');
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
var _chunk6EIJCJCNjs = require('../chunk-6EIJCJCN.js');
|
|
@@ -14,8 +14,8 @@ var _chunk6D7P3IOTjs = require('../chunk-6D7P3IOT.js');
|
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
var
|
|
18
|
-
require('../chunk-
|
|
17
|
+
var _chunk27M4FDNKjs = require('../chunk-27M4FDNK.js');
|
|
18
|
+
require('../chunk-46L4YBLC.js');
|
|
19
19
|
|
|
20
20
|
// src/charts/bar/BarChart.tsx
|
|
21
21
|
var _react = require('react');
|
|
@@ -27,8 +27,9 @@ function highchartsType(direction) {
|
|
|
27
27
|
function buildBarChartOptions(props, direction, series = props.series) {
|
|
28
28
|
const chartType = highchartsType(direction);
|
|
29
29
|
const isDatetime = props.xAxis.type === "datetime";
|
|
30
|
+
const isMultiSeries = series.length > 1;
|
|
30
31
|
const tooltipTimezone = _chunk6D7P3IOTjs.resolveTooltipTimezone.call(void 0, props.xAxis, props.timezone);
|
|
31
|
-
const { annotations, lookup: annotationLookup } =
|
|
32
|
+
const { annotations, lookup: annotationLookup } = _chunkXYE6O77Zjs.buildAnnotationConfig.call(void 0,
|
|
32
33
|
props.annotations
|
|
33
34
|
);
|
|
34
35
|
const barTypeConfig = {
|
|
@@ -55,19 +56,33 @@ function buildBarChartOptions(props, direction, series = props.series) {
|
|
|
55
56
|
click: props.onClick ? (event) => props.onClick({ position: event.point.x }) : void 0,
|
|
56
57
|
mouseOver: function() {
|
|
57
58
|
const x = this.x;
|
|
59
|
+
_optionalChain([props, 'access', _ => _.onMouseEnter, 'optionalCall', _2 => _2({
|
|
60
|
+
position: x,
|
|
61
|
+
// Omit the key entirely (not `series: undefined`) for single-series
|
|
62
|
+
// so consumers testing `"series" in payload` see the contract.
|
|
63
|
+
...isMultiSeries ? {
|
|
64
|
+
series: { name: this.series.name, index: this.series.index }
|
|
65
|
+
} : {}
|
|
66
|
+
})]);
|
|
58
67
|
this.series.chart.series.forEach((s) => {
|
|
59
68
|
if (s.type !== chartType) return;
|
|
60
69
|
s.data.forEach((point) => {
|
|
61
70
|
if (point.x !== x) return;
|
|
62
|
-
_optionalChain([point, 'access',
|
|
71
|
+
_optionalChain([point, 'access', _3 => _3.graphic, 'optionalAccess', _4 => _4.element, 'optionalAccess', _5 => _5.classList, 'access', _6 => _6.add, 'call', _7 => _7("bar-point-hover")]);
|
|
63
72
|
});
|
|
64
73
|
});
|
|
65
74
|
},
|
|
66
75
|
mouseOut: function() {
|
|
76
|
+
_optionalChain([props, 'access', _8 => _8.onMouseLeave, 'optionalCall', _9 => _9({
|
|
77
|
+
position: this.x,
|
|
78
|
+
...isMultiSeries ? {
|
|
79
|
+
series: { name: this.series.name, index: this.series.index }
|
|
80
|
+
} : {}
|
|
81
|
+
})]);
|
|
67
82
|
this.series.chart.series.forEach((s) => {
|
|
68
83
|
if (s.type !== chartType) return;
|
|
69
84
|
s.data.forEach((point) => {
|
|
70
|
-
_optionalChain([point, 'access',
|
|
85
|
+
_optionalChain([point, 'access', _10 => _10.graphic, 'optionalAccess', _11 => _11.element, 'optionalAccess', _12 => _12.classList, 'access', _13 => _13.remove, 'call', _14 => _14("bar-point-hover")]);
|
|
71
86
|
});
|
|
72
87
|
});
|
|
73
88
|
}
|
|
@@ -75,7 +90,7 @@ function buildBarChartOptions(props, direction, series = props.series) {
|
|
|
75
90
|
}
|
|
76
91
|
};
|
|
77
92
|
const options = {
|
|
78
|
-
...
|
|
93
|
+
..._chunk27M4FDNKjs.buildBaseChartOptions.call(void 0, {
|
|
79
94
|
type: chartType,
|
|
80
95
|
description: props.description,
|
|
81
96
|
valueSuffix: props.valueSuffix,
|
|
@@ -84,19 +99,19 @@ function buildBarChartOptions(props, direction, series = props.series) {
|
|
|
84
99
|
}),
|
|
85
100
|
xAxis: _chunk6D7P3IOTjs.buildDimensionalAxis.call(void 0, props.xAxis, _nullishCoalesce(tooltipTimezone, () => ( "UTC"))),
|
|
86
101
|
yAxis: {
|
|
87
|
-
min: _optionalChain([props, 'access',
|
|
88
|
-
max: _optionalChain([props, 'access',
|
|
89
|
-
gridLineWidth: _optionalChain([props, 'access',
|
|
102
|
+
min: _optionalChain([props, 'access', _15 => _15.yAxis, 'optionalAccess', _16 => _16.min]),
|
|
103
|
+
max: _optionalChain([props, 'access', _17 => _17.yAxis, 'optionalAccess', _18 => _18.max]),
|
|
104
|
+
gridLineWidth: _optionalChain([props, 'access', _19 => _19.yAxis, 'optionalAccess', _20 => _20.showGridLines]) === false ? 0 : 1,
|
|
90
105
|
// A dedicated plotLine at 0, styled distinctly from regular gridlines
|
|
91
106
|
// (see chartStyles.ts).
|
|
92
107
|
plotLines: [{ value: 0, className: "y-axis-zero-line", zIndex: 3 }],
|
|
93
|
-
title: { text: _nullishCoalesce(_optionalChain([props, 'access',
|
|
108
|
+
title: { text: _nullishCoalesce(_optionalChain([props, 'access', _21 => _21.yAxis, 'optionalAccess', _22 => _22.title]), () => ( "")) },
|
|
94
109
|
labels: {
|
|
95
110
|
// `showLabels` toggles tick-label visibility; defaults to shown.
|
|
96
|
-
enabled: _optionalChain([props, 'access',
|
|
111
|
+
enabled: _optionalChain([props, 'access', _23 => _23.yAxis, 'optionalAccess', _24 => _24.showLabels]) !== false,
|
|
97
112
|
// A declarative `format` drives ticks through the shared valueFormatter;
|
|
98
113
|
// absent it, the zero-config decimal default (1.20K / 1.20M / 1.20B).
|
|
99
|
-
formatter: _optionalChain([props, 'access',
|
|
114
|
+
formatter: _optionalChain([props, 'access', _25 => _25.yAxis, 'optionalAccess', _26 => _26.format]) ? _chunkXYE6O77Zjs.makeValueAxisLabelFormatter.call(void 0, props.yAxis.format) : _chunkXYE6O77Zjs.defaultValueAxisLabelFormatter
|
|
100
115
|
}
|
|
101
116
|
},
|
|
102
117
|
plotOptions: {
|
|
@@ -121,7 +136,7 @@ var BAR_CHART_DEFAULT_SERIES_LIMIT = 10;
|
|
|
121
136
|
var _jsxruntime = require('react/jsx-runtime');
|
|
122
137
|
var BarChart = _react.memo.call(void 0, function BarChart2(props) {
|
|
123
138
|
const seriesLimit = _nullishCoalesce(props.seriesLimit, () => ( BAR_CHART_DEFAULT_SERIES_LIMIT));
|
|
124
|
-
const { colors, series } =
|
|
139
|
+
const { colors, series } = _chunk27M4FDNKjs.useSeedsChartSetup.call(void 0, {
|
|
125
140
|
series: props.series,
|
|
126
141
|
seriesLimit,
|
|
127
142
|
isSeriesLimitOverridden: props.seriesLimit !== void 0,
|
|
@@ -141,7 +156,7 @@ var BarChart = _react.memo.call(void 0, function BarChart2(props) {
|
|
|
141
156
|
className: props.className
|
|
142
157
|
});
|
|
143
158
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { ...containerProps, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
144
|
-
|
|
159
|
+
_chunk27M4FDNKjs.ChartRenderer,
|
|
145
160
|
{
|
|
146
161
|
options,
|
|
147
162
|
series,
|
|
@@ -152,7 +167,7 @@ var BarChart = _react.memo.call(void 0, function BarChart2(props) {
|
|
|
152
167
|
tooltipClickLabel: props.tooltipClickLabel,
|
|
153
168
|
timezone: tooltipTimezone,
|
|
154
169
|
invalidNumberLabel: props.invalidNumberLabel,
|
|
155
|
-
valueFormat: _optionalChain([props, 'access',
|
|
170
|
+
valueFormat: _optionalChain([props, 'access', _27 => _27.yAxis, 'optionalAccess', _28 => _28.format]),
|
|
156
171
|
exportTitle: props.exportTitle,
|
|
157
172
|
onReady: props.onReady
|
|
158
173
|
}
|
package/dist/bar/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/_work/seeds/seeds/seeds-react/seeds-react-data-viz/dist/bar/index.js","../../src/charts/bar/BarChart.tsx","../../src/charts/bar/adapter.ts","../../src/charts/constants.ts"],"names":["BarChart"],"mappings":"AAAA;AACE;AACA;AACA;AACF,uDAA6B;AAC7B;AACE;AACF,uDAA6B;AAC7B;AACE;AACA;AACF,uDAA6B;AAC7B;AACE;AACA;AACA;AACF,uDAA6B;AAC7B,gCAA6B;AAC7B;AACA;ACnBA,8BAAqB;ADqBrB;AACA;AEDA,SAAS,cAAA,CAAe,SAAA,EAAgD;AACtE,EAAA,OAAO,UAAA,IAAc,aAAA,EAAe,MAAA,EAAQ,QAAA;AAC9C;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,WAAA,EAAa,KAAA,CAAM,KAAA,CAAM,KAAA,IAAS,UAAA;AACxC,EAAA,MAAM,gBAAA,EAAkB,qDAAA,KAAuB,CAAM,KAAA,EAAO,KAAA,CAAM,QAAQ,CAAA;AAC1E,EAAA,MAAM,EAAE,WAAA,EAAa,MAAA,EAAQ,iBAAiB,EAAA,EAAI,oDAAA;AAAA,IAChD,KAAA,CAAM;AAAA,EACR,CAAA;AAKA,EAAA,MAAM,cAAA,EAA6C;AAAA;AAAA;AAAA,IAGjD,GAAI,KAAA,CAAM,SAAA,IAAa,UAAA,EACnB,CAAC,EAAA,EACD,EAAE,QAAA,mBAAU,KAAA,CAAM,QAAA,UAAY,WAAS,CAAA;AAAA;AAAA;AAAA,IAG3C,YAAA,EAAc,UAAA,IAAc,aAAA,EAAe,KAAA,EAAO,IAAA;AAAA,IAClD,YAAA,EAAc,UAAA,IAAc,aAAA,EAAe,IAAA,EAAM,IAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAKjD,GAAI,WAAA,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AAA,CAAM,OAAO,CAAA;AAOxC,EAAA,MAAM,eAAA,EAAiB,qDAAA;AAAuB,IAC5C,aAAA,EAAe,CAAC,yBAAA,EAA2B,iBAAiB,CAAA;AAAA,IAC5D,MAAA,EAAQ,MAAA,CAAO,GAAA,CAAI,CAAC,CAAA,EAAA,GAAM,CAAA,CAAE,KAAK,CAAA;AAAA,IACjC,UAAA;AAAA,IACA,SAAA,EAAW,KAAA,CAAM;AAAA,EACnB,CAAC,CAAA;AAED,EAAA,uBACE,6BAAA,KAAC,EAAA,EAAK,GAAG,cAAA,EACP,QAAA,kBAAA,6BAAA;AAAA,IAAC,8BAAA;AAAA,IAAA;AAAA,MACC,OAAA;AAAA,MACA,MAAA;AAAA,MACA,MAAA;AAAA,MACA,OAAA,EAAS,KAAA,CAAM,OAAA;AAAA,MACf,gBAAA;AAAA,MACA,UAAA;AAAA,MACA,iBAAA,EAAmB,KAAA,CAAM,iBAAA;AAAA,MACzB,QAAA,EAAU,eAAA;AAAA,MACV,kBAAA,EAAoB,KAAA,CAAM,kBAAA;AAAA,MAC1B,WAAA,kBAAa,KAAA,uBAAM,KAAA,+BAAO,QAAA;AAAA,MAC1B,WAAA,EAAa,KAAA,CAAM,WAAA;AAAA,MACnB,OAAA,EAAS,KAAA,CAAM;AAAA,IAAA;AAAA,EACjB,EAAA,CACF,CAAA;AAEJ,CAAC,CAAA;ADuGD;AACE;AACF,4BAAC","file":"/home/runner/_work/seeds/seeds/seeds-react/seeds-react-data-viz/dist/bar/index.js","sourcesContent":[null,"import { memo } from \"react\";\nimport { useSeedsChartSetup, ChartRenderer } from \"../shared/chartBase\";\nimport { getChartContainerProps } from \"../shared/chartContainer\";\nimport { buildBarChartOptions } from \"./adapter\";\nimport type { BarChartProps } from \"./types\";\nimport { BAR_CHART_DEFAULT_SERIES_LIMIT } from \"../constants\";\n\nexport const BarChart = memo(function BarChart(props: BarChartProps) {\n // The shared hook caps the series to the limit (and warns once per render\n // when the default is exceeded without an explicit override) so the adapter\n // and renderer below all consume the capped data.\n const seriesLimit = props.seriesLimit ?? BAR_CHART_DEFAULT_SERIES_LIMIT;\n const { colors, series } = useSeedsChartSetup({\n series: props.series,\n seriesLimit,\n isSeriesLimitOverridden: props.seriesLimit !== undefined,\n hideSeriesLimitWarning: props.hideSeriesLimitWarning,\n componentName: \"BarChart\",\n });\n\n const { options, annotationLookup, tooltipTimezone } = buildBarChartOptions(\n props,\n props.direction ?? \"vertical\",\n series\n );\n const hasOnClick = Boolean(props.onClick);\n\n // Plain <div> consuming the shared chart-styles.css contract via\n // getChartContainerProps. Colors are the RAW per-series colors (undefined when\n // unset, so only explicit overrides inline --highcharts-color-N), NOT the\n // palette-resolved `colors` passed to ChartRenderer. Neither stylesheet is\n // self-imported (consumers import both).\n const containerProps = getChartContainerProps({\n familyClasses: [\"seeds-chart-time-series\", \"seeds-chart-bar\"],\n colors: series.map((s) => s.color),\n hasOnClick,\n className: props.className,\n });\n\n return (\n <div {...containerProps}>\n <ChartRenderer\n options={options}\n series={series}\n colors={colors}\n tooltip={props.tooltip}\n annotationLookup={annotationLookup}\n hasOnClick={hasOnClick}\n tooltipClickLabel={props.tooltipClickLabel}\n timezone={tooltipTimezone}\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 SeedsChartColumnPlotOptions,\n SeedsChartOptions,\n} 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// Maps the public `direction` to the Highcharts series/chart type. Highcharts\n// `bar` is a horizontally-oriented `column`: it performs the visual rotation\n// while keeping axis roles (xAxis = category, yAxis = value), so the rest of the\n// adapter is direction-agnostic.\nfunction highchartsType(direction: BarChartDirection): \"column\" | \"bar\" {\n return direction === \"horizontal\" ? \"bar\" : \"column\";\n}\n\nexport function buildBarChartOptions(\n props: BarChartProps,\n direction: BarChartDirection,\n // The (already-capped) series to render. Defaults to `props.series` so the\n // ~40 existing call sites keep working; the component passes the capped\n // series from `useSeedsChartSetup` explicitly.\n series: BarChartProps[\"series\"] = props.series\n): {\n options: SeedsChartOptions;\n annotationLookup: ChartAnnotationLookup | undefined;\n /** Resolved 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 // `column` (vertical) and `bar` (horizontal) take the same option shape, so a\n // single config is assigned under the active direction's key. Typed\n // explicitly so the `point.events` handlers below keep their `this`/`event`\n // contextual types (a computed `[chartType]` key would otherwise erase them).\n const barTypeConfig: SeedsChartColumnPlotOptions = {\n // \"grouped\" maps to omitting `stacking` — Highcharts renders multi-series\n // columns side-by-side when no stacking is set.\n ...(props.stacking === \"grouped\"\n ? {}\n : { stacking: props.stacking ?? \"normal\" }),\n // Horizontal bars are height-constrained (fixed chart height ÷ categories),\n // so the same padding fractions that work for columns produce hairline bars.\n pointPadding: direction === \"horizontal\" ? 0.05 : 0.25,\n groupPadding: direction === \"horizontal\" ? 0.1 : 0.25,\n // Fixed bar width on datetime axes. Sparse time-series otherwise size\n // columns from the (large) gap between points and balloon; 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 bars highlight together\n // rather than just the single hovered bar).\n point: {\n events: {\n click: props.onClick\n ? (event) => props.onClick!({ position: event.point.x })\n : undefined,\n mouseOver: function () {\n const x = this.x;\n this.series.chart.series.forEach((s) => {\n if (s.type !== chartType) return;\n s.data.forEach((point) => {\n if (point.x !== x) return;\n point.graphic?.element?.classList.add(\"bar-point-hover\");\n });\n });\n },\n mouseOut: function () {\n this.series.chart.series.forEach((s) => {\n if (s.type !== chartType) return;\n s.data.forEach((point) => {\n point.graphic?.element?.classList.remove(\"bar-point-hover\");\n });\n });\n },\n },\n },\n };\n const 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 // A dedicated plotLine at 0, styled distinctly from regular gridlines\n // (see chartStyles.ts).\n plotLines: [{ value: 0, className: \"y-axis-zero-line\", zIndex: 3 }],\n title: { text: props.yAxis?.title ?? \"\" },\n labels: {\n // `showLabels` toggles tick-label visibility; defaults to shown.\n enabled: props.yAxis?.showLabels !== false,\n // A declarative `format` drives ticks through the shared valueFormatter;\n // absent it, the zero-config decimal default (1.20K / 1.20M / 1.20B).\n formatter: props.yAxis?.format\n ? makeValueAxisLabelFormatter(props.yAxis.format)\n : defaultValueAxisLabelFormatter,\n },\n },\n plotOptions: {\n series: { animation: false },\n [chartType]: barTypeConfig,\n },\n series: series.map((s) => ({\n type: chartType,\n name: s.name,\n data: [...s.data],\n color: s.color,\n })),\n ...(annotations ? { annotations } : {}),\n };\n\n return { options, annotationLookup, tooltipTimezone };\n}\n","export const BAR_CHART_DEFAULT_SERIES_LIMIT = 10;\n"]}
|
|
1
|
+
{"version":3,"sources":["/home/runner/_work/seeds/seeds/seeds-react/seeds-react-data-viz/dist/bar/index.js","../../src/charts/bar/BarChart.tsx","../../src/charts/bar/adapter.ts","../../src/charts/constants.ts"],"names":["BarChart"],"mappings":"AAAA;AACE;AACA;AACA;AACF,uDAA6B;AAC7B;AACE;AACF,uDAA6B;AAC7B;AACE;AACA;AACF,uDAA6B;AAC7B;AACE;AACA;AACA;AACF,uDAA6B;AAC7B,gCAA6B;AAC7B;AACA;ACnBA,8BAAqB;ADqBrB;AACA;AEDA,SAAS,cAAA,CAAe,SAAA,EAAgD;AACtE,EAAA,OAAO,UAAA,IAAc,aAAA,EAAe,MAAA,EAAQ,QAAA;AAC9C;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,WAAA,EAAa,KAAA,CAAM,KAAA,CAAM,KAAA,IAAS,UAAA;AAMxC,EAAA,MAAM,cAAA,EAAgB,MAAA,CAAO,OAAA,EAAS,CAAA;AACtC,EAAA,MAAM,gBAAA,EAAkB,qDAAA,KAAuB,CAAM,KAAA,EAAO,KAAA,CAAM,QAAQ,CAAA;AAC1E,EAAA,MAAM,EAAE,WAAA,EAAa,MAAA,EAAQ,iBAAiB,EAAA,EAAI,oDAAA;AAAA,IAChD,KAAA,CAAM;AAAA,EACR,CAAA;AAKA,EAAA,MAAM,cAAA,EAA6C;AAAA;AAAA;AAAA,IAGjD,GAAI,KAAA,CAAM,SAAA,IAAa,UAAA,EACnB,CAAC,EAAA,EACD,EAAE,QAAA,mBAAU,KAAA,CAAM,QAAA,UAAY,WAAS,CAAA;AAAA;AAAA;AAAA,IAG3C,YAAA,EAAc,UAAA,IAAc,aAAA,EAAe,KAAA,EAAO,IAAA;AAAA,IAClD,YAAA,EAAc,UAAA,IAAc,aAAA,EA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A,MACzB,QAAA,EAAU,eAAA;AAAA,MACV,kBAAA,EAAoB,KAAA,CAAM,kBAAA;AAAA,MAC1B,WAAA,kBAAa,KAAA,uBAAM,KAAA,+BAAO,QAAA;AAAA,MAC1B,WAAA,EAAa,KAAA,CAAM,WAAA;AAAA,MACnB,OAAA,EAAS,KAAA,CAAM;AAAA,IAAA;AAAA,EACjB,EAAA,CACF,CAAA;AAEJ,CAAC,CAAA;ADsHD;AACE;AACF,4BAAC","file":"/home/runner/_work/seeds/seeds/seeds-react/seeds-react-data-viz/dist/bar/index.js","sourcesContent":[null,"import { memo } from \"react\";\nimport { useSeedsChartSetup, ChartRenderer } from \"../shared/chartBase\";\nimport { getChartContainerProps } from \"../shared/chartContainer\";\nimport { buildBarChartOptions } from \"./adapter\";\nimport type { BarChartProps } from \"./types\";\nimport { BAR_CHART_DEFAULT_SERIES_LIMIT } from \"../constants\";\n\nexport const BarChart = memo(function BarChart(props: BarChartProps) {\n // The shared hook caps the series to the limit (and warns once per render\n // when the default is exceeded without an explicit override) so the adapter\n // and renderer below all consume the capped data.\n const seriesLimit = props.seriesLimit ?? BAR_CHART_DEFAULT_SERIES_LIMIT;\n const { colors, series } = useSeedsChartSetup({\n series: props.series,\n seriesLimit,\n isSeriesLimitOverridden: props.seriesLimit !== undefined,\n hideSeriesLimitWarning: props.hideSeriesLimitWarning,\n componentName: \"BarChart\",\n });\n\n const { options, annotationLookup, tooltipTimezone } = buildBarChartOptions(\n props,\n props.direction ?? \"vertical\",\n series\n );\n const hasOnClick = Boolean(props.onClick);\n\n // Plain <div> consuming the shared chart-styles.css contract via\n // getChartContainerProps. Colors are the RAW per-series colors (undefined when\n // unset, so only explicit overrides inline --highcharts-color-N), NOT the\n // palette-resolved `colors` passed to ChartRenderer. Neither stylesheet is\n // self-imported (consumers import both).\n const containerProps = getChartContainerProps({\n familyClasses: [\"seeds-chart-time-series\", \"seeds-chart-bar\"],\n colors: series.map((s) => s.color),\n hasOnClick,\n className: props.className,\n });\n\n return (\n <div {...containerProps}>\n <ChartRenderer\n options={options}\n series={series}\n colors={colors}\n tooltip={props.tooltip}\n annotationLookup={annotationLookup}\n hasOnClick={hasOnClick}\n tooltipClickLabel={props.tooltipClickLabel}\n timezone={tooltipTimezone}\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 SeedsChartColumnPlotOptions,\n SeedsChartOptions,\n} 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// Maps the public `direction` to the Highcharts series/chart type. Highcharts\n// `bar` is a horizontally-oriented `column`: it performs the visual rotation\n// while keeping axis roles (xAxis = category, yAxis = value), so the rest of the\n// adapter is direction-agnostic.\nfunction highchartsType(direction: BarChartDirection): \"column\" | \"bar\" {\n return direction === \"horizontal\" ? \"bar\" : \"column\";\n}\n\nexport function buildBarChartOptions(\n props: BarChartProps,\n direction: BarChartDirection,\n // The (already-capped) series to render. Defaults to `props.series` so the\n // ~40 existing call sites keep working; the component passes the capped\n // series from `useSeedsChartSetup` explicitly.\n series: BarChartProps[\"series\"] = props.series\n): {\n options: SeedsChartOptions;\n annotationLookup: ChartAnnotationLookup | undefined;\n /** Resolved 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 // Gate the `onMouseEnter`/`onMouseLeave` `series` field on the *rendered*\n // (already-capped) series count, not `props.series` — if `seriesLimit` caps a\n // multi-series input down to one rendered series the chart is effectively\n // single-series, and `series` must be absent per the \"present only for\n // multi-series bar\" contract.\n const isMultiSeries = series.length > 1;\n const tooltipTimezone = resolveTooltipTimezone(props.xAxis, props.timezone);\n const { annotations, lookup: annotationLookup } = buildAnnotationConfig(\n props.annotations\n );\n // `column` (vertical) and `bar` (horizontal) take the same option shape, so a\n // single config is assigned under the active direction's key. Typed\n // explicitly so the `point.events` handlers below keep their `this`/`event`\n // contextual types (a computed `[chartType]` key would otherwise erase them).\n const barTypeConfig: SeedsChartColumnPlotOptions = {\n // \"grouped\" maps to omitting `stacking` — Highcharts renders multi-series\n // columns side-by-side when no stacking is set.\n ...(props.stacking === \"grouped\"\n ? {}\n : { stacking: props.stacking ?? \"normal\" }),\n // Horizontal bars are height-constrained (fixed chart height ÷ categories),\n // so the same padding fractions that work for columns produce hairline bars.\n pointPadding: direction === \"horizontal\" ? 0.05 : 0.25,\n groupPadding: direction === \"horizontal\" ? 0.1 : 0.25,\n // Fixed bar width on datetime axes. Sparse time-series otherwise size\n // columns from the (large) gap between points and balloon; 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 bars highlight together\n // rather than just the single hovered bar).\n point: {\n events: {\n click: props.onClick\n ? (event) => props.onClick!({ position: event.point.x })\n : undefined,\n mouseOver: function () {\n const x = this.x;\n props.onMouseEnter?.({\n position: x,\n // Omit the key entirely (not `series: undefined`) for single-series\n // so consumers testing `\"series\" in payload` see the contract.\n ...(isMultiSeries\n ? {\n series: { name: this.series.name, index: this.series.index },\n }\n : {}),\n });\n this.series.chart.series.forEach((s) => {\n if (s.type !== chartType) return;\n s.data.forEach((point) => {\n if (point.x !== x) return;\n point.graphic?.element?.classList.add(\"bar-point-hover\");\n });\n });\n },\n mouseOut: function () {\n props.onMouseLeave?.({\n position: this.x,\n ...(isMultiSeries\n ? {\n series: { name: this.series.name, index: this.series.index },\n }\n : {}),\n });\n this.series.chart.series.forEach((s) => {\n if (s.type !== chartType) return;\n s.data.forEach((point) => {\n point.graphic?.element?.classList.remove(\"bar-point-hover\");\n });\n });\n },\n },\n },\n };\n const 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 // A dedicated plotLine at 0, styled distinctly from regular gridlines\n // (see chartStyles.ts).\n plotLines: [{ value: 0, className: \"y-axis-zero-line\", zIndex: 3 }],\n title: { text: props.yAxis?.title ?? \"\" },\n labels: {\n // `showLabels` toggles tick-label visibility; defaults to shown.\n enabled: props.yAxis?.showLabels !== false,\n // A declarative `format` drives ticks through the shared valueFormatter;\n // absent it, the zero-config decimal default (1.20K / 1.20M / 1.20B).\n formatter: props.yAxis?.format\n ? makeValueAxisLabelFormatter(props.yAxis.format)\n : defaultValueAxisLabelFormatter,\n },\n },\n plotOptions: {\n series: { animation: false },\n [chartType]: barTypeConfig,\n },\n series: series.map((s) => ({\n type: chartType,\n name: s.name,\n data: [...s.data],\n color: s.color,\n })),\n ...(annotations ? { annotations } : {}),\n };\n\n return { options, annotationLookup, tooltipTimezone };\n}\n","export const BAR_CHART_DEFAULT_SERIES_LIMIT = 10;\n"]}
|