@sproutsocial/seeds-react-data-viz 0.19.0 → 0.21.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 (46) hide show
  1. package/dist/bar/index.d.mts +20 -4
  2. package/dist/bar/index.d.ts +20 -4
  3. package/dist/bar/index.js +56 -24
  4. package/dist/bar/index.js.map +1 -1
  5. package/dist/charts.css +583 -0
  6. package/dist/{chunk-DLO4WZLT.js → chunk-27M4FDNK.js} +14 -14
  7. package/dist/chunk-27M4FDNK.js.map +1 -0
  8. package/dist/chunk-46L4YBLC.js +544 -0
  9. package/dist/chunk-46L4YBLC.js.map +1 -0
  10. package/dist/{chunk-4IOYAUAK.js → chunk-XYE6O77Z.js} +3 -3
  11. package/dist/{chunk-4IOYAUAK.js.map → chunk-XYE6O77Z.js.map} +1 -1
  12. package/dist/donut/index.d.mts +16 -5
  13. package/dist/donut/index.d.ts +16 -5
  14. package/dist/donut/index.js +22 -16
  15. package/dist/donut/index.js.map +1 -1
  16. package/dist/esm/bar/index.js +44 -12
  17. package/dist/esm/bar/index.js.map +1 -1
  18. package/dist/esm/{chunk-J5QE7VCW.js → chunk-KMFRRUTY.js} +2 -2
  19. package/dist/esm/{chunk-U6ZOSXK7.js → chunk-QSSYSKRP.js} +2 -2
  20. package/dist/esm/chunk-QSSYSKRP.js.map +1 -0
  21. package/dist/esm/chunk-XEKQTAUH.js +544 -0
  22. package/dist/esm/chunk-XEKQTAUH.js.map +1 -0
  23. package/dist/esm/donut/index.js +19 -13
  24. package/dist/esm/donut/index.js.map +1 -1
  25. package/dist/esm/index.js +536 -134
  26. package/dist/esm/index.js.map +1 -1
  27. package/dist/esm/line-area/index.js +36 -13
  28. package/dist/esm/line-area/index.js.map +1 -1
  29. package/dist/esm/sparkline/index.js +2 -2
  30. package/dist/index.js +497 -95
  31. package/dist/index.js.map +1 -1
  32. package/dist/interactions-DoWoL7bu.d.mts +29 -0
  33. package/dist/interactions-DoWoL7bu.d.ts +29 -0
  34. package/dist/line-area/index.d.mts +17 -4
  35. package/dist/line-area/index.d.ts +17 -4
  36. package/dist/line-area/index.js +40 -17
  37. package/dist/line-area/index.js.map +1 -1
  38. package/dist/sparkline/index.js +4 -4
  39. package/package.json +16 -11
  40. package/dist/chunk-DLO4WZLT.js.map +0 -1
  41. package/dist/chunk-WEKDYQ4T.js +0 -968
  42. package/dist/chunk-WEKDYQ4T.js.map +0 -1
  43. package/dist/esm/chunk-U6ZOSXK7.js.map +0 -1
  44. package/dist/esm/chunk-Z4LOM4OZ.js +0 -968
  45. package/dist/esm/chunk-Z4LOM4OZ.js.map +0 -1
  46. /package/dist/esm/{chunk-J5QE7VCW.js.map → chunk-KMFRRUTY.js.map} +0 -0
@@ -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';
@@ -37,6 +39,8 @@ interface BarChartProps {
37
39
  series: Array<BarSeries>;
38
40
  /** Tailwind / class passthrough appended to the container class chain. */
39
41
  className?: string;
42
+ /** Chart height in pixels. Defaults to the time-series baseline (275). */
43
+ height?: number;
40
44
  /** Orientation of the bars. `"vertical"` (default) renders columns; `"horizontal"` renders bars. */
41
45
  direction?: BarChartDirection;
42
46
  /** Maximum number of series to display. Series beyond the limit are dropped. Default `10`. */
@@ -56,9 +60,21 @@ interface BarChartProps {
56
60
  /** Declarative annotations rendered at positions on the chart. */
57
61
  annotations?: ChartAnnotation[];
58
62
  /** Click handler invoked with the category name or timestamp of the clicked bar. */
59
- onClick?: ({ position }: {
60
- position: number | string;
61
- }) => void;
63
+ onClick?: ChartClickHandler;
64
+ /**
65
+ * Fired when the pointer enters a bar (also on keyboard focus), with the
66
+ * category name or timestamp of the bar as `position`. For a multi-series bar
67
+ * chart the payload also carries `series: { name, index }` identifying the
68
+ * hovered series; it is omitted for single-series charts.
69
+ */
70
+ onMouseEnter?: ChartHoverHandler;
71
+ /**
72
+ * Fired when the pointer leaves a bar (also on keyboard blur), with the
73
+ * category name or timestamp of the bar as `position`. For a multi-series bar
74
+ * chart the payload also carries `series: { name, index }` identifying the
75
+ * hovered series; it is omitted for single-series charts.
76
+ */
77
+ onMouseLeave?: ChartHoverHandler;
62
78
  /** Footer content shown in the default tooltip when `onClick` is set. */
63
79
  tooltipClickLabel?: ReactNode;
64
80
  /** Override for the value shown when a data point is null. Defaults to an em-dash. */
@@ -76,4 +92,4 @@ interface BarChartProps {
76
92
 
77
93
  declare const BarChart: react.NamedExoticComponent<BarChartProps>;
78
94
 
79
- export { BarChart, type BarChartDirection, type BarChartProps, type BarDataPoint, type BarDatetimePoint, type BarSeries, type BarXAxis, type BarYAxis, CategoryAxis, ChartExportHandle, DatetimeAxis, ValueFormat };
95
+ export { BarChart, type BarChartDirection, type BarChartProps, type BarDataPoint, type BarDatetimePoint, type BarSeries, type BarXAxis, type BarYAxis, CategoryAxis, ChartClickHandler, ChartExportHandle, ChartHoverHandler, DatetimeAxis, ValueFormat };
@@ -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';
@@ -37,6 +39,8 @@ interface BarChartProps {
37
39
  series: Array<BarSeries>;
38
40
  /** Tailwind / class passthrough appended to the container class chain. */
39
41
  className?: string;
42
+ /** Chart height in pixels. Defaults to the time-series baseline (275). */
43
+ height?: number;
40
44
  /** Orientation of the bars. `"vertical"` (default) renders columns; `"horizontal"` renders bars. */
41
45
  direction?: BarChartDirection;
42
46
  /** Maximum number of series to display. Series beyond the limit are dropped. Default `10`. */
@@ -56,9 +60,21 @@ interface BarChartProps {
56
60
  /** Declarative annotations rendered at positions on the chart. */
57
61
  annotations?: ChartAnnotation[];
58
62
  /** Click handler invoked with the category name or timestamp of the clicked bar. */
59
- onClick?: ({ position }: {
60
- position: number | string;
61
- }) => void;
63
+ onClick?: ChartClickHandler;
64
+ /**
65
+ * Fired when the pointer enters a bar (also on keyboard focus), with the
66
+ * category name or timestamp of the bar as `position`. For a multi-series bar
67
+ * chart the payload also carries `series: { name, index }` identifying the
68
+ * hovered series; it is omitted for single-series charts.
69
+ */
70
+ onMouseEnter?: ChartHoverHandler;
71
+ /**
72
+ * Fired when the pointer leaves a bar (also on keyboard blur), with the
73
+ * category name or timestamp of the bar as `position`. For a multi-series bar
74
+ * chart the payload also carries `series: { name, index }` identifying the
75
+ * hovered series; it is omitted for single-series charts.
76
+ */
77
+ onMouseLeave?: ChartHoverHandler;
62
78
  /** Footer content shown in the default tooltip when `onClick` is set. */
63
79
  tooltipClickLabel?: ReactNode;
64
80
  /** Override for the value shown when a data point is null. Defaults to an em-dash. */
@@ -76,4 +92,4 @@ interface BarChartProps {
76
92
 
77
93
  declare const BarChart: react.NamedExoticComponent<BarChartProps>;
78
94
 
79
- export { BarChart, type BarChartDirection, type BarChartProps, type BarDataPoint, type BarDatetimePoint, type BarSeries, type BarXAxis, type BarYAxis, CategoryAxis, ChartExportHandle, DatetimeAxis, ValueFormat };
95
+ 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,20 +2,23 @@
2
2
 
3
3
 
4
4
 
5
- var _chunk4IOYAUAKjs = require('../chunk-4IOYAUAK.js');
5
+ var _chunkXYE6O77Zjs = require('../chunk-XYE6O77Z.js');
6
6
 
7
7
 
8
8
  var _chunk6EIJCJCNjs = require('../chunk-6EIJCJCN.js');
9
9
 
10
10
 
11
+ var _chunkCYQXUAJCjs = require('../chunk-CYQXUAJC.js');
12
+
13
+
11
14
 
12
15
  var _chunk6D7P3IOTjs = require('../chunk-6D7P3IOT.js');
13
16
 
14
17
 
15
18
 
16
19
 
17
- var _chunkDLO4WZLTjs = require('../chunk-DLO4WZLT.js');
18
- require('../chunk-WEKDYQ4T.js');
20
+ var _chunk27M4FDNKjs = require('../chunk-27M4FDNK.js');
21
+ require('../chunk-46L4YBLC.js');
19
22
 
20
23
  // src/charts/bar/BarChart.tsx
21
24
  var _react = require('react');
@@ -27,8 +30,9 @@ function highchartsType(direction) {
27
30
  function buildBarChartOptions(props, direction, series = props.series) {
28
31
  const chartType = highchartsType(direction);
29
32
  const isDatetime = props.xAxis.type === "datetime";
33
+ const isMultiSeries = series.length > 1;
30
34
  const tooltipTimezone = _chunk6D7P3IOTjs.resolveTooltipTimezone.call(void 0, props.xAxis, props.timezone);
31
- const { annotations, lookup: annotationLookup } = _chunk4IOYAUAKjs.buildAnnotationConfig.call(void 0,
35
+ const { annotations, lookup: annotationLookup } = _chunkXYE6O77Zjs.buildAnnotationConfig.call(void 0,
32
36
  props.annotations
33
37
  );
34
38
  const barTypeConfig = {
@@ -40,9 +44,9 @@ function buildBarChartOptions(props, direction, series = props.series) {
40
44
  pointPadding: direction === "horizontal" ? 0.05 : 0.25,
41
45
  groupPadding: direction === "horizontal" ? 0.1 : 0.25,
42
46
  // Fixed bar width on datetime axes. Sparse time-series otherwise size
43
- // columns from the (large) gap between points and balloon; this mirrors
44
- // v1's `pointWidth: 20` time-series treatment. Dense datetime data may
45
- // instead want a `maxPointWidth` cap — revisit when Line/Area land.
47
+ // columns from the (large) gap between points and balloon; a fixed
48
+ // pointWidth: 20 gives a consistent time-series treatment. Dense datetime
49
+ // data may instead want a maxPointWidth cap — revisit when Line/Area land.
46
50
  ...isDatetime ? { pointWidth: 20 } : {},
47
51
  borderRadius: 4,
48
52
  borderWidth: 0,
@@ -55,48 +59,76 @@ function buildBarChartOptions(props, direction, series = props.series) {
55
59
  click: props.onClick ? (event) => props.onClick({ position: event.point.x }) : void 0,
56
60
  mouseOver: function() {
57
61
  const x = this.x;
62
+ _optionalChain([props, 'access', _ => _.onMouseEnter, 'optionalCall', _2 => _2({
63
+ position: x,
64
+ // Omit the key entirely (not `series: undefined`) for single-series
65
+ // so consumers testing `"series" in payload` see the contract.
66
+ ...isMultiSeries ? {
67
+ series: { name: this.series.name, index: this.series.index }
68
+ } : {}
69
+ })]);
58
70
  this.series.chart.series.forEach((s) => {
59
71
  if (s.type !== chartType) return;
60
72
  s.data.forEach((point) => {
61
73
  if (point.x !== x) return;
62
- _optionalChain([point, 'access', _ => _.graphic, 'optionalAccess', _2 => _2.element, 'optionalAccess', _3 => _3.classList, 'access', _4 => _4.add, 'call', _5 => _5("bar-point-hover")]);
74
+ _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
75
  });
64
76
  });
65
77
  },
66
78
  mouseOut: function() {
79
+ _optionalChain([props, 'access', _8 => _8.onMouseLeave, 'optionalCall', _9 => _9({
80
+ position: this.x,
81
+ ...isMultiSeries ? {
82
+ series: { name: this.series.name, index: this.series.index }
83
+ } : {}
84
+ })]);
67
85
  this.series.chart.series.forEach((s) => {
68
86
  if (s.type !== chartType) return;
69
87
  s.data.forEach((point) => {
70
- _optionalChain([point, 'access', _6 => _6.graphic, 'optionalAccess', _7 => _7.element, 'optionalAccess', _8 => _8.classList, 'access', _9 => _9.remove, 'call', _10 => _10("bar-point-hover")]);
88
+ _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
89
  });
72
90
  });
73
91
  }
74
92
  }
75
93
  }
76
94
  };
95
+ const base = _chunk27M4FDNKjs.buildBaseChartOptions.call(void 0, {
96
+ type: chartType,
97
+ description: props.description,
98
+ valueSuffix: props.valueSuffix,
99
+ reserveTopMargin: Boolean(annotations),
100
+ timezone: tooltipTimezone
101
+ });
77
102
  const options = {
78
- ..._chunkDLO4WZLTjs.buildBaseChartOptions.call(void 0, {
103
+ ...base,
104
+ // Default height baseline (overridable via `props.height`) so consumers
105
+ // who don't configure sizing keep the design-reviewed default.
106
+ chart: {
107
+ ...base.chart,
108
+ // Re-assert the definite `type` so spreading the optionally-typed
109
+ // `base.chart` doesn't widen the required `type` field to optional.
79
110
  type: chartType,
80
- description: props.description,
81
- valueSuffix: props.valueSuffix,
82
- reserveTopMargin: Boolean(annotations),
83
- timezone: tooltipTimezone
84
- }),
111
+ height: _nullishCoalesce(props.height, () => ( _chunkCYQXUAJCjs.TIME_SERIES_CHART_HEIGHT)),
112
+ // Tight time-series spacing (from constants/chartOptions.ts) so the plot
113
+ // area fills the 275px container; without it Highcharts' larger default
114
+ // spacing ([10, 10, 15, 10]) shrinks the plot area.
115
+ spacing: [5, 1, 0, 2]
116
+ },
85
117
  xAxis: _chunk6D7P3IOTjs.buildDimensionalAxis.call(void 0, props.xAxis, _nullishCoalesce(tooltipTimezone, () => ( "UTC"))),
86
118
  yAxis: {
87
- min: _optionalChain([props, 'access', _11 => _11.yAxis, 'optionalAccess', _12 => _12.min]),
88
- max: _optionalChain([props, 'access', _13 => _13.yAxis, 'optionalAccess', _14 => _14.max]),
89
- gridLineWidth: _optionalChain([props, 'access', _15 => _15.yAxis, 'optionalAccess', _16 => _16.showGridLines]) === false ? 0 : 1,
119
+ min: _optionalChain([props, 'access', _15 => _15.yAxis, 'optionalAccess', _16 => _16.min]),
120
+ max: _optionalChain([props, 'access', _17 => _17.yAxis, 'optionalAccess', _18 => _18.max]),
121
+ gridLineWidth: _optionalChain([props, 'access', _19 => _19.yAxis, 'optionalAccess', _20 => _20.showGridLines]) === false ? 0 : 1,
90
122
  // A dedicated plotLine at 0, styled distinctly from regular gridlines
91
123
  // (see chartStyles.ts).
92
124
  plotLines: [{ value: 0, className: "y-axis-zero-line", zIndex: 3 }],
93
- title: { text: _nullishCoalesce(_optionalChain([props, 'access', _17 => _17.yAxis, 'optionalAccess', _18 => _18.title]), () => ( "")) },
125
+ title: { text: _nullishCoalesce(_optionalChain([props, 'access', _21 => _21.yAxis, 'optionalAccess', _22 => _22.title]), () => ( "")) },
94
126
  labels: {
95
127
  // `showLabels` toggles tick-label visibility; defaults to shown.
96
- enabled: _optionalChain([props, 'access', _19 => _19.yAxis, 'optionalAccess', _20 => _20.showLabels]) !== false,
128
+ enabled: _optionalChain([props, 'access', _23 => _23.yAxis, 'optionalAccess', _24 => _24.showLabels]) !== false,
97
129
  // A declarative `format` drives ticks through the shared valueFormatter;
98
130
  // absent it, the zero-config decimal default (1.20K / 1.20M / 1.20B).
99
- formatter: _optionalChain([props, 'access', _21 => _21.yAxis, 'optionalAccess', _22 => _22.format]) ? _chunk4IOYAUAKjs.makeValueAxisLabelFormatter.call(void 0, props.yAxis.format) : _chunk4IOYAUAKjs.defaultValueAxisLabelFormatter
131
+ formatter: _optionalChain([props, 'access', _25 => _25.yAxis, 'optionalAccess', _26 => _26.format]) ? _chunkXYE6O77Zjs.makeValueAxisLabelFormatter.call(void 0, props.yAxis.format) : _chunkXYE6O77Zjs.defaultValueAxisLabelFormatter
100
132
  }
101
133
  },
102
134
  plotOptions: {
@@ -121,7 +153,7 @@ var BAR_CHART_DEFAULT_SERIES_LIMIT = 10;
121
153
  var _jsxruntime = require('react/jsx-runtime');
122
154
  var BarChart = _react.memo.call(void 0, function BarChart2(props) {
123
155
  const seriesLimit = _nullishCoalesce(props.seriesLimit, () => ( BAR_CHART_DEFAULT_SERIES_LIMIT));
124
- const { colors, series } = _chunkDLO4WZLTjs.useSeedsChartSetup.call(void 0, {
156
+ const { colors, series } = _chunk27M4FDNKjs.useSeedsChartSetup.call(void 0, {
125
157
  series: props.series,
126
158
  seriesLimit,
127
159
  isSeriesLimitOverridden: props.seriesLimit !== void 0,
@@ -141,7 +173,7 @@ var BarChart = _react.memo.call(void 0, function BarChart2(props) {
141
173
  className: props.className
142
174
  });
143
175
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { ...containerProps, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
144
- _chunkDLO4WZLTjs.ChartRenderer,
176
+ _chunk27M4FDNKjs.ChartRenderer,
145
177
  {
146
178
  options,
147
179
  series,
@@ -152,7 +184,7 @@ var BarChart = _react.memo.call(void 0, function BarChart2(props) {
152
184
  tooltipClickLabel: props.tooltipClickLabel,
153
185
  timezone: tooltipTimezone,
154
186
  invalidNumberLabel: props.invalidNumberLabel,
155
- valueFormat: _optionalChain([props, 'access', _23 => _23.yAxis, 'optionalAccess', _24 => _24.format]),
187
+ valueFormat: _optionalChain([props, 'access', _27 => _27.yAxis, 'optionalAccess', _28 => _28.format]),
156
188
  exportTitle: props.exportTitle,
157
189
  onReady: props.onReady
158
190
  }
@@ -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;AAC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M,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;AA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A,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;ADuID;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 { TIME_SERIES_CHART_HEIGHT } from \"../../constants/chartOptions\";\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; a fixed\n // pointWidth: 20 gives a consistent time-series treatment. Dense datetime\n // data may instead want a maxPointWidth cap — revisit when Line/Area land.\n ...(isDatetime ? { pointWidth: 20 } : {}),\n borderRadius: 4,\n borderWidth: 0,\n // Pairs with the `:hover` dimming rule in `styles.ts`: while the cursor\n // is over the chart, all bars dim; these handlers restore opacity for\n // every bar at the hovered x (so stacked/grouped bars highlight together\n // rather than just the single hovered bar).\n point: {\n events: {\n click: props.onClick\n ? (event) => props.onClick!({ position: event.point.x })\n : undefined,\n mouseOver: function () {\n const x = this.x;\n props.onMouseEnter?.({\n position: x,\n // Omit the key entirely (not `series: undefined`) for single-series\n // so consumers testing `\"series\" in payload` see the contract.\n ...(isMultiSeries\n ? {\n series: { name: this.series.name, index: this.series.index },\n }\n : {}),\n });\n this.series.chart.series.forEach((s) => {\n if (s.type !== chartType) return;\n s.data.forEach((point) => {\n if (point.x !== x) return;\n point.graphic?.element?.classList.add(\"bar-point-hover\");\n });\n });\n },\n mouseOut: function () {\n props.onMouseLeave?.({\n position: this.x,\n ...(isMultiSeries\n ? {\n series: { name: this.series.name, index: this.series.index },\n }\n : {}),\n });\n this.series.chart.series.forEach((s) => {\n if (s.type !== chartType) return;\n s.data.forEach((point) => {\n point.graphic?.element?.classList.remove(\"bar-point-hover\");\n });\n });\n },\n },\n },\n };\n const base = buildBaseChartOptions({\n type: chartType,\n description: props.description,\n valueSuffix: props.valueSuffix,\n reserveTopMargin: Boolean(annotations),\n timezone: tooltipTimezone,\n });\n\n const options: SeedsChartOptions = {\n ...base,\n // Default height baseline (overridable via `props.height`) so consumers\n // who don't configure sizing keep the design-reviewed default.\n chart: {\n ...base.chart,\n // Re-assert the definite `type` so spreading the optionally-typed\n // `base.chart` doesn't widen the required `type` field to optional.\n type: chartType,\n height: props.height ?? TIME_SERIES_CHART_HEIGHT,\n // Tight time-series spacing (from constants/chartOptions.ts) so the plot\n // area fills the 275px container; without it Highcharts' larger default\n // spacing ([10, 10, 15, 10]) shrinks the plot area.\n spacing: [5, 1, 0, 2],\n },\n xAxis: buildDimensionalAxis(props.xAxis, 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"]}