@sproutsocial/seeds-react-data-viz 0.23.0 → 0.24.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 (49) hide show
  1. package/dist/{axis-WOeYkTO1.d.mts → axis-B61qI-nm.d.mts} +1 -15
  2. package/dist/{axis-WOeYkTO1.d.ts → axis-B78FtYLh.d.ts} +1 -15
  3. package/dist/bar/index.d.mts +2 -2
  4. package/dist/bar/index.d.ts +2 -2
  5. package/dist/bar/index.js +14 -14
  6. package/dist/bar/index.js.map +1 -1
  7. package/dist/bubble/index.d.mts +1 -1
  8. package/dist/bubble/index.d.ts +1 -1
  9. package/dist/bubble/index.js +4 -4
  10. package/dist/{chartBase-BClSc5EN.d.mts → chartBase-CptOt3V0.d.mts} +23 -1
  11. package/dist/{chartBase-CycEw2vy.d.ts → chartBase-Nl6mcTB7.d.ts} +23 -1
  12. package/dist/{chunk-GQOKCB3M.js → chunk-3P6MPBSZ.js} +212 -27
  13. package/dist/chunk-3P6MPBSZ.js.map +1 -0
  14. package/dist/{chunk-6SF6OYQA.js → chunk-MTGYEUZN.js} +3 -3
  15. package/dist/{chunk-6SF6OYQA.js.map → chunk-MTGYEUZN.js.map} +1 -1
  16. package/dist/chunk-OP6K5NDR.js +52 -0
  17. package/dist/chunk-OP6K5NDR.js.map +1 -0
  18. package/dist/donut/index.d.mts +1 -1
  19. package/dist/donut/index.d.ts +1 -1
  20. package/dist/donut/index.js +4 -4
  21. package/dist/esm/bar/index.js +10 -10
  22. package/dist/esm/bar/index.js.map +1 -1
  23. package/dist/esm/bubble/index.js +1 -1
  24. package/dist/esm/{chunk-EHKGDOMK.js → chunk-ISP4A622.js} +196 -11
  25. package/dist/esm/chunk-ISP4A622.js.map +1 -0
  26. package/dist/esm/{chunk-AEBP4NCY.js → chunk-MQDI7D54.js} +2 -2
  27. package/dist/esm/chunk-Y4RJJBJQ.js +52 -0
  28. package/dist/esm/chunk-Y4RJJBJQ.js.map +1 -0
  29. package/dist/esm/donut/index.js +1 -1
  30. package/dist/esm/line-area/index.js +10 -10
  31. package/dist/esm/line-area/index.js.map +1 -1
  32. package/dist/esm/sparkline/index.js +9 -9
  33. package/dist/esm/sparkline/index.js.map +1 -1
  34. package/dist/line-area/index.d.mts +2 -2
  35. package/dist/line-area/index.d.ts +2 -2
  36. package/dist/line-area/index.js +14 -14
  37. package/dist/line-area/index.js.map +1 -1
  38. package/dist/sparkline/index.d.mts +3 -3
  39. package/dist/sparkline/index.d.ts +3 -3
  40. package/dist/sparkline/index.js +10 -10
  41. package/dist/sparkline/index.js.map +1 -1
  42. package/package.json +6 -6
  43. package/dist/chunk-6D7P3IOT.js +0 -150
  44. package/dist/chunk-6D7P3IOT.js.map +0 -1
  45. package/dist/chunk-GQOKCB3M.js.map +0 -1
  46. package/dist/esm/chunk-EHKGDOMK.js.map +0 -1
  47. package/dist/esm/chunk-NAKJY5PA.js +0 -150
  48. package/dist/esm/chunk-NAKJY5PA.js.map +0 -1
  49. /package/dist/esm/{chunk-AEBP4NCY.js.map → chunk-MQDI7D54.js.map} +0 -0
@@ -1,10 +1,10 @@
1
1
  import * as react from 'react';
2
2
  import { ReactNode } from 'react';
3
3
  import { C as ChartAnnotation } from '../annotations-CjFoRPXf.js';
4
- import { V as ValueFormat, C as ChartTooltipProps } from '../chartBase-CycEw2vy.js';
4
+ import { V as ValueFormat, C as ChartTooltipProps } from '../chartBase-Nl6mcTB7.js';
5
5
  import { C as ChartExportHandle } from '../chartExport-CKYpuhik.js';
6
6
  import { C as ChartColorableEntity, a as ChartIconableEntity, b as ChartClickHandler, c as ChartHoverHandler } from '../interactions-pEXA1XxF.js';
7
- import { C as ChartDataPoint, a as CategoryAxis, D as DatetimeAxis } from '../axis-WOeYkTO1.js';
7
+ import { C as ChartDataPoint, a as CategoryAxis, D as DatetimeAxis } from '../axis-B78FtYLh.js';
8
8
  import { h as TypeChartStylePattern } from '../types-DxrhdAdn.js';
9
9
  import '@sproutsocial/seeds-react-icon';
10
10
  import 'highcharts';
@@ -2,11 +2,11 @@
2
2
 
3
3
 
4
4
 
5
- var _chunk6SF6OYQAjs = require('../chunk-6SF6OYQA.js');
5
+ var _chunkMTGYEUZNjs = require('../chunk-MTGYEUZN.js');
6
6
 
7
7
 
8
8
 
9
- var _chunk6D7P3IOTjs = require('../chunk-6D7P3IOT.js');
9
+ var _chunkOP6K5NDRjs = require('../chunk-OP6K5NDR.js');
10
10
 
11
11
 
12
12
  var _chunk6EIJCJCNjs = require('../chunk-6EIJCJCN.js');
@@ -17,7 +17,7 @@ var _chunk33Y5FZTTjs = require('../chunk-33Y5FZTT.js');
17
17
 
18
18
 
19
19
 
20
- var _chunkGQOKCB3Mjs = require('../chunk-GQOKCB3M.js');
20
+ var _chunk3P6MPBSZjs = require('../chunk-3P6MPBSZ.js');
21
21
  require('../chunk-2H2Z7PKZ.js');
22
22
 
23
23
  // src/charts/line-area/LineAreaChart.tsx
@@ -45,16 +45,16 @@ function withIsolatedPointMarkers(data) {
45
45
  });
46
46
  }
47
47
  function buildLineAreaChartOptions(props) {
48
- const tooltipTimezone = _chunk6D7P3IOTjs.resolveTooltipTimezone.call(void 0, props.xAxis, props.timezone);
48
+ const tooltipOptions = _chunkOP6K5NDRjs.resolveTooltipOptions.call(void 0, props);
49
49
  const isStacked = AREA_VARIANTS.has(props.variant) && Boolean(props.stacking);
50
- const { annotations, lookup: annotationLookup } = _chunk6SF6OYQAjs.buildAnnotationConfig.call(void 0,
50
+ const { annotations, lookup: annotationLookup } = _chunkMTGYEUZNjs.buildAnnotationConfig.call(void 0,
51
51
  props.annotations
52
52
  );
53
- const base = _chunkGQOKCB3Mjs.buildBaseChartOptions.call(void 0, {
53
+ const base = _chunk3P6MPBSZjs.buildBaseChartOptions.call(void 0, {
54
54
  type: props.variant,
55
55
  description: props.description,
56
56
  reserveTopMargin: Boolean(annotations),
57
- timezone: tooltipTimezone
57
+ timezone: tooltipOptions.timezone
58
58
  });
59
59
  const options = {
60
60
  ...base,
@@ -71,7 +71,7 @@ function buildLineAreaChartOptions(props) {
71
71
  // spacing ([10, 10, 15, 10]) shrinks the plot area.
72
72
  spacing: [5, 1, 0, 2]
73
73
  },
74
- xAxis: _chunk6D7P3IOTjs.buildDimensionalAxis.call(void 0, props.xAxis, _nullishCoalesce(tooltipTimezone, () => ( "UTC"))),
74
+ xAxis: _chunkOP6K5NDRjs.buildDimensionalAxis.call(void 0, props.xAxis, _nullishCoalesce(tooltipOptions.timezone, () => ( "UTC"))),
75
75
  yAxis: {
76
76
  min: _optionalChain([props, 'access', _ => _.yAxis, 'optionalAccess', _2 => _2.min]),
77
77
  max: _optionalChain([props, 'access', _3 => _3.yAxis, 'optionalAccess', _4 => _4.max]),
@@ -89,7 +89,7 @@ function buildLineAreaChartOptions(props) {
89
89
  labels: {
90
90
  // A declarative `format` drives ticks through the shared valueFormatter;
91
91
  // absent it, the zero-config decimal default (1.20K / 1.20M / 1.20B).
92
- formatter: _optionalChain([props, 'access', _9 => _9.yAxis, 'optionalAccess', _10 => _10.format]) ? _chunk6SF6OYQAjs.makeValueAxisLabelFormatter.call(void 0, props.yAxis.format) : _chunk6SF6OYQAjs.defaultValueAxisLabelFormatter
92
+ formatter: _optionalChain([props, 'access', _9 => _9.yAxis, 'optionalAccess', _10 => _10.format]) ? _chunkMTGYEUZNjs.makeValueAxisLabelFormatter.call(void 0, props.yAxis.format) : _chunkMTGYEUZNjs.defaultValueAxisLabelFormatter
93
93
  }
94
94
  },
95
95
  plotOptions: {
@@ -125,18 +125,18 @@ function buildLineAreaChartOptions(props) {
125
125
  })),
126
126
  ...annotations ? { annotations } : {}
127
127
  };
128
- return { options, annotationLookup, tooltipTimezone };
128
+ return { options, annotationLookup, tooltipOptions };
129
129
  }
130
130
 
131
131
  // src/charts/line-area/LineAreaChart.tsx
132
132
  var _jsxruntime = require('react/jsx-runtime');
133
133
  var AREA_VARIANTS2 = /* @__PURE__ */ new Set(["area", "areaspline"]);
134
134
  var LineAreaChart = _react.memo.call(void 0, function LineAreaChart2(props) {
135
- const { colors, patterns } = _chunkGQOKCB3Mjs.useSeedsChartSetup.call(void 0, {
135
+ const { colors, patterns } = _chunk3P6MPBSZjs.useSeedsChartSetup.call(void 0, {
136
136
  series: props.series,
137
137
  includePatterns: true
138
138
  });
139
- const { options, annotationLookup, tooltipTimezone } = _react.useMemo.call(void 0,
139
+ const { options, annotationLookup, tooltipOptions } = _react.useMemo.call(void 0,
140
140
  () => buildLineAreaChartOptions(props),
141
141
  [props]
142
142
  );
@@ -160,7 +160,7 @@ var LineAreaChart = _react.memo.call(void 0, function LineAreaChart2(props) {
160
160
  className: props.className
161
161
  }),
162
162
  children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
163
- _chunkGQOKCB3Mjs.ChartRenderer,
163
+ _chunk3P6MPBSZjs.ChartRenderer,
164
164
  {
165
165
  options,
166
166
  series: props.series,
@@ -169,7 +169,7 @@ var LineAreaChart = _react.memo.call(void 0, function LineAreaChart2(props) {
169
169
  annotationLookup,
170
170
  hasOnClick,
171
171
  tooltipClickLabel: props.tooltipClickLabel,
172
- timezone: tooltipTimezone,
172
+ tooltipOptions,
173
173
  invalidNumberLabel: props.invalidNumberLabel,
174
174
  valueFormat: _optionalChain([props, 'access', _11 => _11.yAxis, 'optionalAccess', _12 => _12.format]),
175
175
  exportTitle: props.exportTitle,
@@ -1 +1 @@
1
- {"version":3,"sources":["/home/runner/_work/seeds/seeds/seeds-react/seeds-react-data-viz/dist/line-area/index.js","../../src/charts/line-area/LineAreaChart.tsx","../../src/charts/line-area/adapter.ts"],"names":["AREA_VARIANTS","LineAreaChart"],"mappings":"AAAA;AACE;AACA;AACA;AACF,uDAA6B;AAC7B;AACE;AACA;AACF,uDAA6B;AAC7B;AACE;AACF,uDAA6B;AAC7B;AACE;AACF,uDAA6B;AAC7B;AACE;AACA;AACA;AACF,uDAA6B;AAC7B,gCAA6B;AAC7B;AACA;ACtBA,8BAA8B;ADwB9B;AACA;AEJA,IAAM,cAAA,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A,EAAS,KAAA,CAAM;AAAA,QAAA;AAAA,MACjB;AAAA,IAAA;AAAA,EACF,CAAA;AAEJ,CAAC,CAAA;AD+GD;AACE;AACF,sCAAC","file":"/home/runner/_work/seeds/seeds/seeds-react/seeds-react-data-viz/dist/line-area/index.js","sourcesContent":[null,"import { memo, useMemo } from \"react\";\nimport { useSeedsChartSetup, ChartRenderer } from \"../shared/chartBase\";\nimport { getChartContainerProps } from \"../shared/chartContainer\";\nimport { buildLineAreaChartOptions } from \"./adapter\";\nimport type { LineAreaChartProps, LineAreaVariant } from \"./types\";\n\nconst AREA_VARIANTS = new Set<LineAreaVariant>([\"area\", \"areaspline\"]);\n\n/**\n * LineAreaChart — the v2 time-series line/area family.\n *\n * Like SparklineChart, the wrapper carries no styled-components: it is a plain\n * <div> whose className / inline custom properties / data-attributes come from\n * the shared getChartContainerProps contract (CE-164), and its Highcharts\n * styling ships as a static line-area.css. chart-styles.css owns the shared\n * base (background, per-series color fallback, click cursor, tooltip, legend)\n * AND the shared cross-family .seeds-chart-time-series layer (crosshair,\n * grid/axis lines, ticks, zero line, axis-label typography) that bar also uses;\n * line-area.css owns only the .seeds-chart-line / .seeds-chart-area selectors.\n * Neither is imported here — matching the Sparkline/bar convention, the component never\n * self-imports its stylesheet; consumers import both explicitly (see\n * charts/README.md).\n */\nexport const LineAreaChart = memo(function LineAreaChart(\n props: LineAreaChartProps\n) {\n const { colors, patterns } = useSeedsChartSetup({\n series: props.series,\n includePatterns: true,\n });\n const { options, annotationLookup, tooltipTimezone } = useMemo(\n () => buildLineAreaChartOptions(props),\n [props]\n );\n const hasOnClick = Boolean(props.onClick);\n const isArea = AREA_VARIANTS.has(props.variant);\n\n return (\n <div\n {...getChartContainerProps({\n familyClasses: [\n \"seeds-chart-time-series\",\n isArea ? \"seeds-chart-area\" : \"seeds-chart-line\",\n ],\n // RAW per-series colors: only an explicit consumer override is inlined\n // as --highcharts-color-N; an unset series falls through to the DS\n // palette default in chart-styles.css. ChartRenderer below still gets\n // the palette-RESOLVED `colors` for its own styled-components engine.\n colors: props.series.map((s) => s.color),\n patterns,\n hasOnClick,\n className: props.className,\n })}\n >\n <ChartRenderer\n options={options}\n series={props.series}\n colors={colors}\n tooltip={props.tooltip}\n annotationLookup={annotationLookup}\n hasOnClick={hasOnClick}\n tooltipClickLabel={props.tooltipClickLabel}\n 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 SeedsChartDataPoint,\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 { ChartDataPoint } from \"../shared/axis\";\nimport type { LineAreaChartProps, LineAreaVariant } from \"./types\";\n\n// `stacking` is meaningful only for filled variants; on `line`/`spline` it's a\n// no-op, so the adapter drops it rather than emitting a misleading option.\nconst AREA_VARIANTS = new Set<LineAreaVariant>([\"area\", \"areaspline\"]);\n\ntype SeriesPoint =\n | number\n | null\n | [number, number | null]\n | SeedsChartDataPoint;\n\nfunction pointY(point: ChartDataPoint): number | null {\n if (point === null) return null;\n if (typeof point === \"number\") return point;\n if (Array.isArray(point)) return point[1];\n return point.y;\n}\n\n// Point markers are hidden by default (set on `plotOptions.series`), but an\n// *isolated* non-null point — one with a null (or the chart edge) on both\n// sides — gets a circle marker so a point with no connecting line segment\n// stays visible. Connected points pass through unchanged so the line/area\n// renders dot-free, matching the designs.\nfunction withIsolatedPointMarkers(\n data: ReadonlyArray<ChartDataPoint>\n): SeriesPoint[] {\n return data.map((point, i): SeriesPoint => {\n if (point === null) return null; // explicit gap\n if (pointY(point) === null) return point; // tuple/object with null y — a gap\n const prevY = i === 0 ? null : pointY(data[i - 1]!);\n const nextY = i === data.length - 1 ? null : pointY(data[i + 1]!);\n if (prevY !== null || nextY !== null) return point; // connected → no marker\n const marker = { enabled: true, symbol: \"circle\" as const };\n if (typeof point === \"number\") return { y: point, marker };\n if (Array.isArray(point)) return { x: point[0], y: point[1], marker };\n return { ...point, marker };\n });\n}\n\nexport function buildLineAreaChartOptions(props: LineAreaChartProps): {\n options: SeedsChartOptions;\n annotationLookup: ChartAnnotationLookup | undefined;\n /** Resolved timezone for the tooltip date formatter; undefined on category axes. */\n tooltipTimezone: string | undefined;\n} {\n const tooltipTimezone = resolveTooltipTimezone(props.xAxis, props.timezone);\n const isStacked = AREA_VARIANTS.has(props.variant) && Boolean(props.stacking);\n const { annotations, lookup: annotationLookup } = buildAnnotationConfig(\n props.annotations\n );\n\n const base = buildBaseChartOptions({\n type: props.variant,\n description: props.description,\n reserveTopMargin: Boolean(annotations),\n timezone: 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: props.variant,\n height: props.height ?? TIME_SERIES_CHART_HEIGHT,\n // Tight time-series spacing (from constants/chartOptions.ts) so the plot\n // area fills the 275px container; without it Highcharts' larger default\n // spacing ([10, 10, 15, 10]) shrinks the plot area.\n spacing: [5, 1, 0, 2],\n },\n xAxis: buildDimensionalAxis(props.xAxis, tooltipTimezone ?? \"UTC\"),\n yAxis: {\n min: props.yAxis?.min,\n max: props.yAxis?.max,\n // Anchor the value axis to 0 (as the bar/area families do): line/spline otherwise\n // auto-scale above 0, which truncates the axis and pushes the annotation\n // anchor (y: 0) out of range. `soft` still extends for negative data.\n softMin: 0,\n softMax: 0,\n gridLineWidth: props.yAxis?.showGridLines === false ? 0 : 1,\n // A dedicated plotLine at 0, styled distinctly from regular gridlines\n // (see chartStyles.ts).\n plotLines: [{ value: 0, className: \"y-axis-zero-line\", zIndex: 3 }],\n title: { text: props.yAxis?.title ?? \"\" },\n // Zero-config default: abbreviate value-axis ticks (1.20K / 1.20M / 1.20B).\n labels: {\n // A declarative `format` drives ticks through the shared valueFormatter;\n // absent it, the zero-config decimal default (1.20K / 1.20M / 1.20B).\n formatter: props.yAxis?.format\n ? makeValueAxisLabelFormatter(props.yAxis.format)\n : defaultValueAxisLabelFormatter,\n },\n },\n plotOptions: {\n series: {\n animation: false,\n // Hide point markers by default (per the designs); isolated points\n // re-enable their own marker via `withIsolatedPointMarkers`.\n marker: { enabled: false },\n ...(props.onClick || props.onMouseEnter || props.onMouseLeave\n ? {\n point: {\n events: {\n click: props.onClick\n ? (event) => props.onClick!({ position: event.point.x })\n : undefined,\n mouseOver: props.onMouseEnter\n ? function (this: { x: number | string }) {\n props.onMouseEnter!({ position: this.x });\n }\n : undefined,\n mouseOut: props.onMouseLeave\n ? function (this: { x: number | string }) {\n props.onMouseLeave!({ position: this.x });\n }\n : undefined,\n },\n },\n }\n : {}),\n },\n // Type-scoped stacking: only the (area) variant stacks. `isStacked` already\n // guarantees `props.variant` is an area variant here, so the computed key is\n // always a valid plotOptions slot. Matches bar's per-type placement and keeps\n // line/spline unstacked.\n ...(isStacked ? { [props.variant]: { stacking: props.stacking } } : {}),\n },\n series: props.series.map((s) => ({\n type: props.variant,\n name: s.name,\n data: withIsolatedPointMarkers(s.data),\n })),\n ...(annotations ? { annotations } : {}),\n };\n\n return { options, annotationLookup, tooltipTimezone };\n}\n"]}
1
+ {"version":3,"sources":["/home/runner/_work/seeds/seeds/seeds-react/seeds-react-data-viz/dist/line-area/index.js","../../src/charts/line-area/LineAreaChart.tsx","../../src/charts/line-area/adapter.ts"],"names":["AREA_VARIANTS","LineAreaChart"],"mappings":"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AM,iBAAA;AAAA,UACzB,cAAA;AAAA,UACA,kBAAA,EAAoB,KAAA,CAAM,kBAAA;AAAA,UAC1B,WAAA,kBAAa,KAAA,uBAAM,KAAA,+BAAO,QAAA;AAAA,UAC1B,WAAA,EAAa,KAAA,CAAM,WAAA;AAAA,UACnB,OAAA,EAAS,KAAA,CAAM;AAAA,QAAA;AAAA,MACjB;AAAA,IAAA;AAAA,EACF,CAAA;AAEJ,CAAC,CAAA;AD+GD;AACE;AACF,sCAAC","file":"/home/runner/_work/seeds/seeds/seeds-react/seeds-react-data-viz/dist/line-area/index.js","sourcesContent":[null,"import { memo, useMemo } from \"react\";\nimport { useSeedsChartSetup, ChartRenderer } from \"../shared/chartBase\";\nimport { getChartContainerProps } from \"../shared/chartContainer\";\nimport { buildLineAreaChartOptions } from \"./adapter\";\nimport type { LineAreaChartProps, LineAreaVariant } from \"./types\";\n\nconst AREA_VARIANTS = new Set<LineAreaVariant>([\"area\", \"areaspline\"]);\n\n/**\n * LineAreaChart — the v2 time-series line/area family.\n *\n * Like SparklineChart, the wrapper carries no styled-components: it is a plain\n * <div> whose className / inline custom properties / data-attributes come from\n * the shared getChartContainerProps contract (CE-164), and its Highcharts\n * styling ships as a static line-area.css. chart-styles.css owns the shared\n * base (background, per-series color fallback, click cursor, tooltip, legend)\n * AND the shared cross-family .seeds-chart-time-series layer (crosshair,\n * grid/axis lines, ticks, zero line, axis-label typography) that bar also uses;\n * line-area.css owns only the .seeds-chart-line / .seeds-chart-area selectors.\n * Neither is imported here — matching the Sparkline/bar convention, the component never\n * self-imports its stylesheet; consumers import both explicitly (see\n * charts/README.md).\n */\nexport const LineAreaChart = memo(function LineAreaChart(\n props: LineAreaChartProps\n) {\n const { colors, patterns } = useSeedsChartSetup({\n series: props.series,\n includePatterns: true,\n });\n const { options, annotationLookup, tooltipOptions } = useMemo(\n () => buildLineAreaChartOptions(props),\n [props]\n );\n const hasOnClick = Boolean(props.onClick);\n const isArea = AREA_VARIANTS.has(props.variant);\n\n return (\n <div\n {...getChartContainerProps({\n familyClasses: [\n \"seeds-chart-time-series\",\n isArea ? \"seeds-chart-area\" : \"seeds-chart-line\",\n ],\n // RAW per-series colors: only an explicit consumer override is inlined\n // as --highcharts-color-N; an unset series falls through to the DS\n // palette default in chart-styles.css. ChartRenderer below still gets\n // the palette-RESOLVED `colors` for its own styled-components engine.\n colors: props.series.map((s) => s.color),\n patterns,\n hasOnClick,\n className: props.className,\n })}\n >\n <ChartRenderer\n options={options}\n series={props.series}\n colors={colors}\n tooltip={props.tooltip}\n annotationLookup={annotationLookup}\n hasOnClick={hasOnClick}\n tooltipClickLabel={props.tooltipClickLabel}\n tooltipOptions={tooltipOptions}\n invalidNumberLabel={props.invalidNumberLabel}\n valueFormat={props.yAxis?.format}\n exportTitle={props.exportTitle}\n onReady={props.onReady}\n />\n </div>\n );\n});\n","import { buildAnnotationConfig } from \"../shared/annotations\";\nimport type { ChartAnnotationLookup } from \"../shared/annotations\";\nimport type {\n ChartTooltipProps,\n SeedsChartDataPoint,\n SeedsChartOptions,\n} from \"../shared/chartBase\";\nimport { buildBaseChartOptions } from \"../shared/baseChartOptions\";\nimport { TIME_SERIES_CHART_HEIGHT } from \"../../constants/chartOptions\";\nimport {\n buildDimensionalAxis,\n resolveTooltipOptions,\n} from \"../shared/axisOptions\";\nimport {\n defaultValueAxisLabelFormatter,\n makeValueAxisLabelFormatter,\n} from \"../shared/valueAxisLabelFormatter\";\nimport type { ChartDataPoint } from \"../shared/axis\";\nimport type { LineAreaChartProps, LineAreaVariant } from \"./types\";\n\n// `stacking` is meaningful only for filled variants; on `line`/`spline` it's a\n// no-op, so the adapter drops it rather than emitting a misleading option.\nconst AREA_VARIANTS = new Set<LineAreaVariant>([\"area\", \"areaspline\"]);\n\ntype SeriesPoint =\n | number\n | null\n | [number, number | null]\n | SeedsChartDataPoint;\n\nfunction pointY(point: ChartDataPoint): number | null {\n if (point === null) return null;\n if (typeof point === \"number\") return point;\n if (Array.isArray(point)) return point[1];\n return point.y;\n}\n\n// Point markers are hidden by default (set on `plotOptions.series`), but an\n// *isolated* non-null point — one with a null (or the chart edge) on both\n// sides — gets a circle marker so a point with no connecting line segment\n// stays visible. Connected points pass through unchanged so the line/area\n// renders dot-free, matching the designs.\nfunction withIsolatedPointMarkers(\n data: ReadonlyArray<ChartDataPoint>\n): SeriesPoint[] {\n return data.map((point, i): SeriesPoint => {\n if (point === null) return null; // explicit gap\n if (pointY(point) === null) return point; // tuple/object with null y — a gap\n const prevY = i === 0 ? null : pointY(data[i - 1]!);\n const nextY = i === data.length - 1 ? null : pointY(data[i + 1]!);\n if (prevY !== null || nextY !== null) return point; // connected → no marker\n const marker = { enabled: true, symbol: \"circle\" as const };\n if (typeof point === \"number\") return { y: point, marker };\n if (Array.isArray(point)) return { x: point[0], y: point[1], marker };\n return { ...point, marker };\n });\n}\n\nexport function buildLineAreaChartOptions(props: LineAreaChartProps): {\n options: SeedsChartOptions;\n annotationLookup: ChartAnnotationLookup | undefined;\n /** Resolved datetime-derived tooltip options (timezone / timeFormat / textLocale); all undefined on category axes. */\n tooltipOptions: Pick<\n ChartTooltipProps,\n \"timezone\" | \"timeFormat\" | \"textLocale\"\n >;\n} {\n const tooltipOptions = resolveTooltipOptions(props);\n const isStacked = AREA_VARIANTS.has(props.variant) && Boolean(props.stacking);\n const { annotations, lookup: annotationLookup } = buildAnnotationConfig(\n props.annotations\n );\n\n const base = buildBaseChartOptions({\n type: props.variant,\n description: props.description,\n reserveTopMargin: Boolean(annotations),\n timezone: tooltipOptions.timezone,\n });\n\n const options: SeedsChartOptions = {\n ...base,\n // Default height baseline (overridable via `props.height`) so consumers\n // who don't configure sizing keep the design-reviewed default.\n chart: {\n ...base.chart,\n // Re-assert the definite `type` so spreading the optionally-typed\n // `base.chart` doesn't widen the required `type` field to optional.\n type: props.variant,\n height: props.height ?? TIME_SERIES_CHART_HEIGHT,\n // Tight time-series spacing (from constants/chartOptions.ts) so the plot\n // area fills the 275px container; without it Highcharts' larger default\n // spacing ([10, 10, 15, 10]) shrinks the plot area.\n spacing: [5, 1, 0, 2],\n },\n xAxis: buildDimensionalAxis(props.xAxis, tooltipOptions.timezone ?? \"UTC\"),\n yAxis: {\n min: props.yAxis?.min,\n max: props.yAxis?.max,\n // Anchor the value axis to 0 (as the bar/area families do): line/spline otherwise\n // auto-scale above 0, which truncates the axis and pushes the annotation\n // anchor (y: 0) out of range. `soft` still extends for negative data.\n softMin: 0,\n softMax: 0,\n gridLineWidth: props.yAxis?.showGridLines === false ? 0 : 1,\n // A dedicated plotLine at 0, styled distinctly from regular gridlines\n // (see chartStyles.ts).\n plotLines: [{ value: 0, className: \"y-axis-zero-line\", zIndex: 3 }],\n title: { text: props.yAxis?.title ?? \"\" },\n // Zero-config default: abbreviate value-axis ticks (1.20K / 1.20M / 1.20B).\n labels: {\n // A declarative `format` drives ticks through the shared valueFormatter;\n // absent it, the zero-config decimal default (1.20K / 1.20M / 1.20B).\n formatter: props.yAxis?.format\n ? makeValueAxisLabelFormatter(props.yAxis.format)\n : defaultValueAxisLabelFormatter,\n },\n },\n plotOptions: {\n series: {\n animation: false,\n // Hide point markers by default (per the designs); isolated points\n // re-enable their own marker via `withIsolatedPointMarkers`.\n marker: { enabled: false },\n ...(props.onClick || props.onMouseEnter || props.onMouseLeave\n ? {\n point: {\n events: {\n click: props.onClick\n ? (event) => props.onClick!({ position: event.point.x })\n : undefined,\n mouseOver: props.onMouseEnter\n ? function (this: { x: number | string }) {\n props.onMouseEnter!({ position: this.x });\n }\n : undefined,\n mouseOut: props.onMouseLeave\n ? function (this: { x: number | string }) {\n props.onMouseLeave!({ position: this.x });\n }\n : undefined,\n },\n },\n }\n : {}),\n },\n // Type-scoped stacking: only the (area) variant stacks. `isStacked` already\n // guarantees `props.variant` is an area variant here, so the computed key is\n // always a valid plotOptions slot. Matches bar's per-type placement and keeps\n // line/spline unstacked.\n ...(isStacked ? { [props.variant]: { stacking: props.stacking } } : {}),\n },\n series: props.series.map((s) => ({\n type: props.variant,\n name: s.name,\n data: withIsolatedPointMarkers(s.data),\n })),\n ...(annotations ? { annotations } : {}),\n };\n\n return { options, annotationLookup, tooltipOptions };\n}\n"]}
@@ -1,9 +1,9 @@
1
1
  import * as react from 'react';
2
2
  import { ReactNode } from 'react';
3
- import { C as ChartTooltipProps } from '../chartBase-BClSc5EN.mjs';
3
+ import { C as ChartTooltipProps } from '../chartBase-CptOt3V0.mjs';
4
4
  import { C as ChartExportHandle } from '../chartExport-CKYpuhik.mjs';
5
- import { C as ChartDataPoint, c as DimensionalAxis } from '../axis-WOeYkTO1.mjs';
6
- export { a as CategoryAxis, D as DatetimeAxis } from '../axis-WOeYkTO1.mjs';
5
+ import { C as ChartDataPoint, c as DimensionalAxis } from '../axis-B61qI-nm.mjs';
6
+ export { a as CategoryAxis, D as DatetimeAxis } from '../axis-B61qI-nm.mjs';
7
7
  import '@sproutsocial/seeds-react-icon';
8
8
  import '../types-DxrhdAdn.mjs';
9
9
  import 'highcharts';
@@ -1,9 +1,9 @@
1
1
  import * as react from 'react';
2
2
  import { ReactNode } from 'react';
3
- import { C as ChartTooltipProps } from '../chartBase-CycEw2vy.js';
3
+ import { C as ChartTooltipProps } from '../chartBase-Nl6mcTB7.js';
4
4
  import { C as ChartExportHandle } from '../chartExport-CKYpuhik.js';
5
- import { C as ChartDataPoint, c as DimensionalAxis } from '../axis-WOeYkTO1.js';
6
- export { a as CategoryAxis, D as DatetimeAxis } from '../axis-WOeYkTO1.js';
5
+ import { C as ChartDataPoint, c as DimensionalAxis } from '../axis-B78FtYLh.js';
6
+ export { a as CategoryAxis, D as DatetimeAxis } from '../axis-B78FtYLh.js';
7
7
  import '@sproutsocial/seeds-react-icon';
8
8
  import '../types-DxrhdAdn.js';
9
9
  import 'highcharts';
@@ -1,11 +1,11 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
2
2
 
3
3
 
4
- var _chunk6D7P3IOTjs = require('../chunk-6D7P3IOT.js');
4
+ var _chunkOP6K5NDRjs = require('../chunk-OP6K5NDR.js');
5
5
 
6
6
 
7
7
 
8
- var _chunkGQOKCB3Mjs = require('../chunk-GQOKCB3M.js');
8
+ var _chunk3P6MPBSZjs = require('../chunk-3P6MPBSZ.js');
9
9
  require('../chunk-2H2Z7PKZ.js');
10
10
 
11
11
  // src/charts/sparkline/SparklineChart.tsx
@@ -19,15 +19,15 @@ function highchartsType(variant) {
19
19
  var SPARKLINE_SERIES_NAME = "sparkline";
20
20
  function buildSparklineChartOptions(props) {
21
21
  const type = highchartsType(props.variant);
22
- const tooltipTimezone = props.xAxis ? _chunk6D7P3IOTjs.resolveTooltipTimezone.call(void 0, props.xAxis, props.timezone) : void 0;
22
+ const tooltipOptions = _chunkOP6K5NDRjs.resolveTooltipOptions.call(void 0, props);
23
23
  const xAxis = props.xAxis ? {
24
- ..._chunk6D7P3IOTjs.buildDimensionalAxis.call(void 0, props.xAxis, _nullishCoalesce(tooltipTimezone, () => ( "UTC"))),
24
+ ..._chunkOP6K5NDRjs.buildDimensionalAxis.call(void 0, props.xAxis, _nullishCoalesce(tooltipOptions.timezone, () => ( "UTC"))),
25
25
  visible: false
26
26
  } : { type: "linear", visible: false };
27
- const base = _chunkGQOKCB3Mjs.buildBaseChartOptions.call(void 0, {
27
+ const base = _chunk3P6MPBSZjs.buildBaseChartOptions.call(void 0, {
28
28
  type,
29
29
  description: props.description,
30
- timezone: tooltipTimezone
30
+ timezone: tooltipOptions.timezone
31
31
  });
32
32
  const options = {
33
33
  ...base,
@@ -57,7 +57,7 @@ function buildSparklineChartOptions(props) {
57
57
  }
58
58
  ]
59
59
  };
60
- return { options, tooltipTimezone };
60
+ return { options, tooltipOptions };
61
61
  }
62
62
 
63
63
  // src/charts/shared/trend.ts
@@ -89,7 +89,7 @@ var SparklineChart = _react.memo.call(void 0, function SparklineChart2(props) {
89
89
  const theme = _styledcomponents.useTheme.call(void 0, );
90
90
  const trend = computeTrend(props.data);
91
91
  const trendColor = resolveTrendColor(theme, trend);
92
- const { options, tooltipTimezone } = buildSparklineChartOptions(props);
92
+ const { options, tooltipOptions } = buildSparklineChartOptions(props);
93
93
  const className = [
94
94
  "seeds-sparkline",
95
95
  `seeds-sparkline-${props.variant}`,
@@ -101,13 +101,13 @@ var SparklineChart = _react.memo.call(void 0, function SparklineChart2(props) {
101
101
  className,
102
102
  style: { "--seeds-sparkline-color": trendColor },
103
103
  children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
104
- _chunkGQOKCB3Mjs.ChartRenderer,
104
+ _chunk3P6MPBSZjs.ChartRenderer,
105
105
  {
106
106
  options,
107
107
  series: [{ name: SPARKLINE_SERIES_NAME, color: trendColor }],
108
108
  colors: [trendColor],
109
109
  tooltip: props.tooltip,
110
- timezone: tooltipTimezone,
110
+ tooltipOptions,
111
111
  invalidNumberLabel: props.invalidNumberLabel,
112
112
  hideLegend: true,
113
113
  exportTitle: props.exportTitle,
@@ -1 +1 @@
1
- {"version":3,"sources":["/home/runner/_work/seeds/seeds/seeds-react/seeds-react-data-viz/dist/sparkline/index.js","../../src/charts/sparkline/SparklineChart.tsx","../../src/charts/sparkline/adapter.ts","../../src/charts/shared/trend.ts"],"names":["SparklineChart"],"mappings":"AAAA;AACE;AACA;AACF,uDAA6B;AAC7B;AACE;AACA;AACF,uDAA6B;AAC7B,gCAA6B;AAC7B;AACA;ACVA,8BAAyC;AACzC,qDAAyB;ADYzB;AACA;AELA,SAAS,cAAA,CAAe,OAAA,EAA2C;AACjE,EAAA,OAAO,QAAA,IAAY,MAAA,EAAQ,SAAA,EAAW,MAAA;AACxC;AAEA,IAAM,sBAAA,EAAwB,WAAA;AAEvB,SAAS,0BAAA,CAA2B,KAAA,EAIzC;AACA,EAAA,MAAM,KAAA,EAAO,cAAA,CAAe,KAAA,CAAM,OAAO,CAAA;AACzC,EAAA,MAAM,gBAAA,EAAkB,KAAA,CAAM,MAAA,EAC1B,qDAAA,KAAuB,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EAAA,OAAO,UAAA,CAAW,OAAA;AACpB;AH+BA;AACA;ACnCM,+CAAA;AA7BC,IAAM,eAAA,EAAiB,yBAAA,SAAcA,eAAAA,CAC1C,KAAA,EACA;AAOA,EAAA,MAAM,MAAA,EAAQ,wCAAA,CAAS;AAEvB,EAAA,MAAM,MAAA,EAAQ,YAAA,CAAa,KAAA,CAAM,IAAI,CAAA;AACrC,EAAA,MAAM,WAAA,EAAa,iBAAA,CAAkB,KAAA,EAAO,KAAK,CAAA;AAEjD,EAAA,MAAM,EAAE,OAAA,EAAS,gBAAgB,EAAA,EAAI,0BAAA,CAA2B,KAAK,CAAA;AAErE,EAAA,MAAM,UAAA,EAAY;AAAA,IAChB,iBAAA;AAAA,IACA,CAAA,gBAAA,EAAmB,KAAA,CAAM,OAAO,CAAA,CAAA;AAC1B,IAAA;AAGG,EAAA;AAGT,EAAA;AAAC,IAAA;AAAA,IAAA;AACC,MAAA;AACS,MAAA;AAET,MAAA;AAAC,QAAA;AAAA,QAAA;AACC,UAAA;AACiB,UAAA;AACE,UAAA;AACJ,UAAA;AACL,UAAA;AACgB,UAAA;AAChB,UAAA;AACS,UAAA;AACJ,UAAA;AAAA,QAAA;AACjB,MAAA;AAAA,IAAA;AACF,EAAA;AAEH;ADwDoC;AACA;AACA","file":"/home/runner/_work/seeds/seeds/seeds-react/seeds-react-data-viz/dist/sparkline/index.js","sourcesContent":[null,"import { memo, type CSSProperties } from \"react\";\nimport { useTheme } from \"styled-components\";\nimport type { TypeTheme } from \"@sproutsocial/seeds-react-theme\";\nimport { ChartRenderer } from \"../shared/chartBase\";\nimport { buildSparklineChartOptions, SPARKLINE_SERIES_NAME } from \"./adapter\";\nimport { computeTrend, resolveTrendColor } from \"./trend\";\nimport type { SparklineChartProps } from \"./types\";\n\n/**\n * SparklineChart — a compact, axis-less inline micro-chart in a `\"line\"` or\n * `\"bar\"` variant. The whole sparkline is colored by trend (auto-computed from\n * the data): green when rising, red when falling, neutral-gray when flat.\n *\n * Unlike the other v2 chart families this one carries no `styled-components`:\n * the wrapper is a plain `<div>` that accepts `className` (Tailwind sizing), and\n * the Highcharts styling lives in `sparkline.css`. Consumers must import\n * `@sproutsocial/seeds-react-data-viz/sparkline.css` once. The single trend\n * color is resolved from the JS theme and passed down as the\n * `--seeds-sparkline-color` CSS variable, so light/dark works without depending\n * on the theme's CSS-variable stylesheet.\n */\nexport const SparklineChart = memo(function SparklineChart(\n props: SparklineChartProps\n) {\n // The active theme resolves the single trend color. We read it directly rather\n // than via useSeedsChartSetup — the sparkline has no categorical palette or\n // series-limit concerns, so the hook's series machinery (and its dummy series\n // input) would be dead weight. ChartRenderer below is itself a styled-\n // component, so this adds no new dependency; the \"no styled-components\" trait\n // of this family is about the wrapper being a plain <div> + static CSS.\n const theme = useTheme() as TypeTheme;\n\n const trend = computeTrend(props.data);\n const trendColor = resolveTrendColor(theme, trend);\n\n const { options, tooltipTimezone } = buildSparklineChartOptions(props);\n\n const className = [\n \"seeds-sparkline\",\n `seeds-sparkline-${props.variant}`,\n props.className,\n ]\n .filter(Boolean)\n .join(\" \");\n\n return (\n <div\n className={className}\n style={{ \"--seeds-sparkline-color\": trendColor } as CSSProperties}\n >\n <ChartRenderer\n options={options}\n series={[{ name: SPARKLINE_SERIES_NAME, color: trendColor }]}\n colors={[trendColor]}\n tooltip={props.tooltip}\n timezone={tooltipTimezone}\n invalidNumberLabel={props.invalidNumberLabel}\n hideLegend\n exportTitle={props.exportTitle}\n onReady={props.onReady}\n />\n </div>\n );\n});\n","import type { SeedsChartOptions, SeedsChartType } from \"../shared/chartBase\";\nimport { buildBaseChartOptions } from \"../shared/baseChartOptions\";\nimport {\n buildDimensionalAxis,\n resolveTooltipTimezone,\n} from \"../shared/axisOptions\";\nimport type { SparklineChartProps, SparklineVariant } from \"./types\";\n\n// A sparkline line is a `line`; a sparkline bar is a `column` (vertical bars).\nfunction highchartsType(variant: SparklineVariant): SeedsChartType {\n return variant === \"bar\" ? \"column\" : \"line\";\n}\n\nconst SPARKLINE_SERIES_NAME = \"sparkline\";\n\nexport function buildSparklineChartOptions(props: SparklineChartProps): {\n options: SeedsChartOptions;\n /** Resolved timezone for the tooltip date formatter; undefined without a datetime axis. */\n tooltipTimezone: string | undefined;\n} {\n const type = highchartsType(props.variant);\n const tooltipTimezone = props.xAxis\n ? resolveTooltipTimezone(props.xAxis, props.timezone)\n : undefined;\n\n // A configured axis is placed but hidden (labels/line/ticks off). Without one\n // we fall back to a hidden linear index axis.\n const xAxis = props.xAxis\n ? {\n ...buildDimensionalAxis(props.xAxis, tooltipTimezone ?? \"UTC\"),\n visible: false,\n }\n : { type: \"linear\" as const, visible: false };\n\n const base = buildBaseChartOptions({\n type,\n description: props.description,\n timezone: tooltipTimezone,\n });\n\n const options: SeedsChartOptions = {\n ...base,\n // Zero the outer spacing so the plot fills the (consumer-sized) wrapper.\n chart: { type, styledMode: true, animation: false, spacing: [0, 0, 0, 0] },\n xAxis,\n yAxis: { visible: false },\n plotOptions: {\n series: {\n animation: false,\n // Decorative micro-chart: no per-point markers on the line.\n marker: { enabled: false },\n },\n // Tight padding so bars read as a compact cluster.\n column: {\n pointPadding: 0.05,\n groupPadding: 0.05,\n borderWidth: 0,\n borderRadius: 3,\n },\n },\n series: [\n {\n type,\n name: SPARKLINE_SERIES_NAME,\n data: [...props.data],\n },\n ],\n };\n\n return { options, tooltipTimezone };\n}\n\nexport { SPARKLINE_SERIES_NAME };\n","import type { TypeTheme } from \"@sproutsocial/seeds-react-theme\";\nimport type { ChartDataPoint } from \"./axis\";\n\n// Family-agnostic trend helpers, shared across chart families. First used by the\n// sparkline (colored entirely by its trend direction); reusable by any chart\n// that wants a sentiment/directional color from a single series (e.g. a\n// sentiment chart).\n\n/**\n * Trend direction derived from a series (first vs. last finite value): rising →\n * `\"positive\"`, falling → `\"negative\"`, flat → `\"neutral\"`.\n */\nexport type Trend = \"positive\" | \"negative\" | \"neutral\";\n\n/** Extract the numeric y-value from a bare number, tuple, or `{ x, y }` point. */\nfunction yValue(point: ChartDataPoint): number | null {\n if (point == null) return null;\n if (typeof point === \"number\") return point;\n if (Array.isArray(point)) return point[1];\n return point.y;\n}\n\n/**\n * Derive the trend from the series by comparing the first finite value to the\n * last finite value: rising → `\"positive\"`, falling → `\"negative\"`, equal (or\n * fewer than two finite values) → `\"neutral\"`.\n */\nexport function computeTrend(data: ReadonlyArray<ChartDataPoint>): Trend {\n const finite = data\n .map(yValue)\n .filter((v): v is number => v != null && Number.isFinite(v));\n\n if (finite.length < 2) return \"neutral\";\n\n const first = finite[0]!;\n const last = finite[finite.length - 1]!;\n\n if (last > first) return \"positive\";\n if (last < first) return \"negative\";\n return \"neutral\";\n}\n\n/**\n * Resolve the trend to a Seeds decorative highlight/accent color: positive →\n * vibrant green (green-500), negative → vibrant red (red-600), neutral → middle\n * gray (neutral-600). These highlight tones are theme-stable — the same value in\n * light and dark — and are designed to read as accents on either surface.\n */\nexport function resolveTrendColor(theme: TypeTheme, trend: Trend): string {\n const decorative = theme.colors.container.border.decorative;\n if (trend === \"positive\") return decorative.green;\n if (trend === \"negative\") return decorative.red;\n return decorative.neutral;\n}\n"]}
1
+ {"version":3,"sources":["/home/runner/_work/seeds/seeds/seeds-react/seeds-react-data-viz/dist/sparkline/index.js","../../src/charts/sparkline/SparklineChart.tsx","../../src/charts/sparkline/adapter.ts","../../src/charts/shared/trend.ts"],"names":["SparklineChart"],"mappings":"AAAA;AACE;AACA;AACF,uDAA6B;AAC7B;AACE;AACA;AACF,uDAA6B;AAC7B,gCAA6B;AAC7B;AACA;ACVA,8BAAyC;AACzC,qDAAyB;ADYzB;AACA;AEDA,SAAS,cAAA,CAAe,OAAA,EAA2C;AACjE,EAAA,OAAO,QAAA,IAAY,MAAA,EAAQ,SAAA,EAAW,MAAA;AACxC;AAEA,IAAM,sBAAA,EAAwB,WAAA;AAEvB,SAAS,0BAAA,CAA2B,KAAA,EAOzC;AACA,EAAA,MAAM,KAAA,EAAO,cAAA,CAAe,KAAA,CAAM,OAAO,CAAA;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GAAA;AAC5C,EAAA,OAAO,UAAA,CAAW,OAAA;AACpB;AH+BA;AACA;ACnCM,+CAAA;AA7BC,IAAM,eAAA,EAAiB,yBAAA,SAAcA,eAAAA,CAC1C,KAAA,EACA;AAOA,EAAA,MAAM,MAAA,EAAQ,wCAAA,CAAS;AAEvB,EAAA,MAAM,MAAA,EAAQ,YAAA,CAAa,KAAA,CAAM,IAAI,CAAA;AACrC,EAAA,MAAM,WAAA,EAAa,iBAAA,CAAkB,KAAA,EAAO,KAAK,CAAA;AAEjD,EAAA,MAAM,EAAE,OAAA,EAAS,eAAe,EAAA,EAAI,0BAAA,CAA2B,KAAK,CAAA;AAEpE,EAAA,MAAM,UAAA,EAAY;AAAA,IAChB,iBAAA;AAAA,IACA,CAAA,gBAAA,EAAmB,KAAA,CAAM,OAAO,CAAA,CAAA;AAC1B,IAAA;AAGG,EAAA;AAGT,EAAA;AAAC,IAAA;AAAA,IAAA;AACC,MAAA;AACS,MAAA;AAET,MAAA;AAAC,QAAA;AAAA,QAAA;AACC,UAAA;AACiB,UAAA;AACE,UAAA;AACJ,UAAA;AACf,UAAA;AAC0B,UAAA;AAChB,UAAA;AACS,UAAA;AACJ,UAAA;AAAA,QAAA;AACjB,MAAA;AAAA,IAAA;AACF,EAAA;AAEH;ADwDoC;AACA;AACA","file":"/home/runner/_work/seeds/seeds/seeds-react/seeds-react-data-viz/dist/sparkline/index.js","sourcesContent":[null,"import { memo, type CSSProperties } from \"react\";\nimport { useTheme } from \"styled-components\";\nimport type { TypeTheme } from \"@sproutsocial/seeds-react-theme\";\nimport { ChartRenderer } from \"../shared/chartBase\";\nimport { buildSparklineChartOptions, SPARKLINE_SERIES_NAME } from \"./adapter\";\nimport { computeTrend, resolveTrendColor } from \"./trend\";\nimport type { SparklineChartProps } from \"./types\";\n\n/**\n * SparklineChart — a compact, axis-less inline micro-chart in a `\"line\"` or\n * `\"bar\"` variant. The whole sparkline is colored by trend (auto-computed from\n * the data): green when rising, red when falling, neutral-gray when flat.\n *\n * Unlike the other v2 chart families this one carries no `styled-components`:\n * the wrapper is a plain `<div>` that accepts `className` (Tailwind sizing), and\n * the Highcharts styling lives in `sparkline.css`. Consumers must import\n * `@sproutsocial/seeds-react-data-viz/sparkline.css` once. The single trend\n * color is resolved from the JS theme and passed down as the\n * `--seeds-sparkline-color` CSS variable, so light/dark works without depending\n * on the theme's CSS-variable stylesheet.\n */\nexport const SparklineChart = memo(function SparklineChart(\n props: SparklineChartProps\n) {\n // The active theme resolves the single trend color. We read it directly rather\n // than via useSeedsChartSetup — the sparkline has no categorical palette or\n // series-limit concerns, so the hook's series machinery (and its dummy series\n // input) would be dead weight. ChartRenderer below is itself a styled-\n // component, so this adds no new dependency; the \"no styled-components\" trait\n // of this family is about the wrapper being a plain <div> + static CSS.\n const theme = useTheme() as TypeTheme;\n\n const trend = computeTrend(props.data);\n const trendColor = resolveTrendColor(theme, trend);\n\n const { options, tooltipOptions } = buildSparklineChartOptions(props);\n\n const className = [\n \"seeds-sparkline\",\n `seeds-sparkline-${props.variant}`,\n props.className,\n ]\n .filter(Boolean)\n .join(\" \");\n\n return (\n <div\n className={className}\n style={{ \"--seeds-sparkline-color\": trendColor } as CSSProperties}\n >\n <ChartRenderer\n options={options}\n series={[{ name: SPARKLINE_SERIES_NAME, color: trendColor }]}\n colors={[trendColor]}\n tooltip={props.tooltip}\n tooltipOptions={tooltipOptions}\n invalidNumberLabel={props.invalidNumberLabel}\n hideLegend\n exportTitle={props.exportTitle}\n onReady={props.onReady}\n />\n </div>\n );\n});\n","import type {\n ChartTooltipProps,\n SeedsChartOptions,\n SeedsChartType,\n} from \"../shared/chartBase\";\nimport { buildBaseChartOptions } from \"../shared/baseChartOptions\";\nimport {\n buildDimensionalAxis,\n resolveTooltipOptions,\n} from \"../shared/axisOptions\";\nimport type { SparklineChartProps, SparklineVariant } from \"./types\";\n\n// A sparkline line is a `line`; a sparkline bar is a `column` (vertical bars).\nfunction highchartsType(variant: SparklineVariant): SeedsChartType {\n return variant === \"bar\" ? \"column\" : \"line\";\n}\n\nconst SPARKLINE_SERIES_NAME = \"sparkline\";\n\nexport function buildSparklineChartOptions(props: SparklineChartProps): {\n options: SeedsChartOptions;\n /** Resolved datetime-derived tooltip options (timezone / timeFormat / textLocale); all undefined without a datetime axis. */\n tooltipOptions: Pick<\n ChartTooltipProps,\n \"timezone\" | \"timeFormat\" | \"textLocale\"\n >;\n} {\n const type = highchartsType(props.variant);\n // `resolveTooltipOptions` handles the optional `xAxis` internally (all-undefined\n // when absent), so the sparkline passes its props straight in like the other\n // families.\n const tooltipOptions = resolveTooltipOptions(props);\n\n // A configured axis is placed but hidden (labels/line/ticks off). Without one\n // we fall back to a hidden linear index axis.\n const xAxis = props.xAxis\n ? {\n ...buildDimensionalAxis(props.xAxis, tooltipOptions.timezone ?? \"UTC\"),\n visible: false,\n }\n : { type: \"linear\" as const, visible: false };\n\n const base = buildBaseChartOptions({\n type,\n description: props.description,\n timezone: tooltipOptions.timezone,\n });\n\n const options: SeedsChartOptions = {\n ...base,\n // Zero the outer spacing so the plot fills the (consumer-sized) wrapper.\n chart: { type, styledMode: true, animation: false, spacing: [0, 0, 0, 0] },\n xAxis,\n yAxis: { visible: false },\n plotOptions: {\n series: {\n animation: false,\n // Decorative micro-chart: no per-point markers on the line.\n marker: { enabled: false },\n },\n // Tight padding so bars read as a compact cluster.\n column: {\n pointPadding: 0.05,\n groupPadding: 0.05,\n borderWidth: 0,\n borderRadius: 3,\n },\n },\n series: [\n {\n type,\n name: SPARKLINE_SERIES_NAME,\n data: [...props.data],\n },\n ],\n };\n\n return { options, tooltipOptions };\n}\n\nexport { SPARKLINE_SERIES_NAME };\n","import type { TypeTheme } from \"@sproutsocial/seeds-react-theme\";\nimport type { ChartDataPoint } from \"./axis\";\n\n// Family-agnostic trend helpers, shared across chart families. First used by the\n// sparkline (colored entirely by its trend direction); reusable by any chart\n// that wants a sentiment/directional color from a single series (e.g. a\n// sentiment chart).\n\n/**\n * Trend direction derived from a series (first vs. last finite value): rising →\n * `\"positive\"`, falling → `\"negative\"`, flat → `\"neutral\"`.\n */\nexport type Trend = \"positive\" | \"negative\" | \"neutral\";\n\n/** Extract the numeric y-value from a bare number, tuple, or `{ x, y }` point. */\nfunction yValue(point: ChartDataPoint): number | null {\n if (point == null) return null;\n if (typeof point === \"number\") return point;\n if (Array.isArray(point)) return point[1];\n return point.y;\n}\n\n/**\n * Derive the trend from the series by comparing the first finite value to the\n * last finite value: rising → `\"positive\"`, falling → `\"negative\"`, equal (or\n * fewer than two finite values) → `\"neutral\"`.\n */\nexport function computeTrend(data: ReadonlyArray<ChartDataPoint>): Trend {\n const finite = data\n .map(yValue)\n .filter((v): v is number => v != null && Number.isFinite(v));\n\n if (finite.length < 2) return \"neutral\";\n\n const first = finite[0]!;\n const last = finite[finite.length - 1]!;\n\n if (last > first) return \"positive\";\n if (last < first) return \"negative\";\n return \"neutral\";\n}\n\n/**\n * Resolve the trend to a Seeds decorative highlight/accent color: positive →\n * vibrant green (green-500), negative → vibrant red (red-600), neutral → middle\n * gray (neutral-600). These highlight tones are theme-stable — the same value in\n * light and dark — and are designed to read as accents on either surface.\n */\nexport function resolveTrendColor(theme: TypeTheme, trend: Trend): string {\n const decorative = theme.colors.container.border.decorative;\n if (trend === \"positive\") return decorative.green;\n if (trend === \"negative\") return decorative.red;\n return decorative.neutral;\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sproutsocial/seeds-react-data-viz",
3
- "version": "0.23.0",
3
+ "version": "0.24.0",
4
4
  "description": "Seeds React Data Viz Components",
5
5
  "author": "Sprout Social, Inc.",
6
6
  "license": "MIT",
@@ -72,14 +72,14 @@
72
72
  "@sproutsocial/seeds-dataviz": "^0.7.3",
73
73
  "@sproutsocial/seeds-networkcolor": "^2.22.0",
74
74
  "@sproutsocial/seeds-react-box": "^1.1.27",
75
- "@sproutsocial/seeds-react-button": "^2.3.1",
75
+ "@sproutsocial/seeds-react-button": "^2.3.3",
76
76
  "@sproutsocial/seeds-react-duration": "^1.0.30",
77
- "@sproutsocial/seeds-react-icon": "^2.4.6",
78
- "@sproutsocial/seeds-react-menu": "^1.16.9",
79
- "@sproutsocial/seeds-react-numeral": "^1.0.54",
77
+ "@sproutsocial/seeds-react-icon": "^2.4.7",
78
+ "@sproutsocial/seeds-react-menu": "^1.16.11",
79
+ "@sproutsocial/seeds-react-numeral": "^1.0.55",
80
80
  "@sproutsocial/seeds-react-partner-logo": "^1.7.19",
81
81
  "@sproutsocial/seeds-react-system-props": "^3.1.3",
82
- "@sproutsocial/seeds-react-table": "^1.0.48",
82
+ "@sproutsocial/seeds-react-table": "^1.0.49",
83
83
  "@sproutsocial/seeds-react-text": "^1.5.2",
84
84
  "@sproutsocial/seeds-react-theme": "^4.3.1",
85
85
  "highcharts": "^11.4.3",
@@ -1,150 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); 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; }// src/charts/shared/formatters/datetimeFormatter.ts
2
- var DAY_MS = 864e5;
3
- var WEEK_MS = 6048e5;
4
- var MIN_MONTH_MS = 24192e5;
5
- var MIN_YEAR_MS = 31536e6;
6
- var getDatePartsInTimezone = (date, timezone) => {
7
- const formatter = new Intl.DateTimeFormat("en-US", {
8
- year: "numeric",
9
- month: "numeric",
10
- day: "numeric",
11
- timeZone: timezone
12
- });
13
- const parts = formatter.formatToParts(date);
14
- return {
15
- day: parseInt(_nullishCoalesce(_optionalChain([parts, 'access', _ => _.find, 'call', _2 => _2((p) => p.type === "day"), 'optionalAccess', _3 => _3.value]), () => ( "0")), 10),
16
- month: parseInt(_nullishCoalesce(_optionalChain([parts, 'access', _4 => _4.find, 'call', _5 => _5((p) => p.type === "month"), 'optionalAccess', _6 => _6.value]), () => ( "0")), 10),
17
- year: parseInt(_nullishCoalesce(_optionalChain([parts, 'access', _7 => _7.find, 'call', _8 => _8((p) => p.type === "year"), 'optionalAccess', _9 => _9.value]), () => ( "0")), 10)
18
- };
19
- };
20
- var deriveGranularity = (tickPositions) => {
21
- if (tickPositions.length < 2) {
22
- return "day";
23
- }
24
- const deltas = [];
25
- for (let i = 1; i < tickPositions.length; i++) {
26
- const curr = tickPositions[i];
27
- const prev = tickPositions[i - 1];
28
- if (curr === void 0 || prev === void 0) {
29
- continue;
30
- }
31
- deltas.push(Math.abs(curr - prev));
32
- }
33
- deltas.sort((a, b) => a - b);
34
- const mid = Math.floor(deltas.length / 2);
35
- const upper = deltas[mid];
36
- const lower = deltas[mid - 1];
37
- const median = deltas.length % 2 === 0 && lower !== void 0 ? (lower + upper) / 2 : upper;
38
- if (median < DAY_MS) {
39
- return "hour";
40
- }
41
- if (median < WEEK_MS) {
42
- return "day";
43
- }
44
- if (median < MIN_MONTH_MS) {
45
- return "week";
46
- }
47
- if (median < MIN_YEAR_MS) {
48
- return "month";
49
- }
50
- return "year";
51
- };
52
- function datetimeFormatter({
53
- value,
54
- tickPositions = [],
55
- // optional
56
- timezone = "UTC",
57
- timeFormat = "12",
58
- textLocale = "en-US"
59
- }) {
60
- if (typeof value === "string" || !Number.isFinite(value)) {
61
- return { primary: String(value) };
62
- }
63
- const granularity = deriveGranularity(tickPositions);
64
- const tickIndex = tickPositions.indexOf(value);
65
- const isFirst = tickIndex === 0;
66
- const previousValue = tickPositions[tickIndex - 1];
67
- const valueDate = new Date(value);
68
- const valueParts = getDatePartsInTimezone(valueDate, timezone);
69
- const previousValueDate = previousValue ? new Date(previousValue) : void 0;
70
- const previousValueParts = previousValueDate ? getDatePartsInTimezone(previousValueDate, timezone) : void 0;
71
- let firstPartOptions = {};
72
- let secondPartOptions = {};
73
- switch (granularity) {
74
- case "hour":
75
- firstPartOptions = timeFormat === "24" ? { hour: "numeric", minute: "numeric", hour12: false } : { hour: "numeric" };
76
- if (isFirst || valueParts.day !== _optionalChain([previousValueParts, 'optionalAccess', _10 => _10.day])) {
77
- secondPartOptions = { day: "numeric", month: "short" };
78
- }
79
- break;
80
- case "day":
81
- case "week":
82
- firstPartOptions = { day: "numeric" };
83
- if (isFirst || valueParts.month !== _optionalChain([previousValueParts, 'optionalAccess', _11 => _11.month])) {
84
- secondPartOptions = { month: "short" };
85
- }
86
- break;
87
- case "month":
88
- firstPartOptions = { month: "short" };
89
- if (isFirst || valueParts.year !== _optionalChain([previousValueParts, 'optionalAccess', _12 => _12.year])) {
90
- secondPartOptions = { year: "numeric" };
91
- }
92
- break;
93
- case "year":
94
- firstPartOptions = { year: "numeric" };
95
- break;
96
- default:
97
- firstPartOptions = {};
98
- break;
99
- }
100
- const primary = new Intl.DateTimeFormat(textLocale, {
101
- ...firstPartOptions,
102
- timeZone: timezone
103
- }).format(valueDate);
104
- if (Object.keys(secondPartOptions).length > 0) {
105
- const secondary = new Intl.DateTimeFormat(textLocale, {
106
- ...secondPartOptions,
107
- timeZone: timezone
108
- }).format(valueDate);
109
- return { primary, secondary };
110
- }
111
- return { primary };
112
- }
113
-
114
- // src/charts/shared/axisOptions.ts
115
- function makeDatetimeAxisLabelFormatter(timezone, timeFormat) {
116
- return function() {
117
- const { primary, secondary } = datetimeFormatter({
118
- value: this.value,
119
- tickPositions: _nullishCoalesce(this.axis.tickPositions, () => ( [])),
120
- timezone,
121
- timeFormat
122
- });
123
- return secondary ? `${primary}<br/><span class="hc-axis-label-secondary">${secondary}</span>` : primary;
124
- };
125
- }
126
- function buildDimensionalAxis(axis, timezone) {
127
- if (axis.type === "datetime") {
128
- return {
129
- type: "datetime",
130
- crosshair: axis.crosshair,
131
- labels: {
132
- formatter: makeDatetimeAxisLabelFormatter(timezone, axis.timeFormat)
133
- }
134
- };
135
- }
136
- return {
137
- type: "category",
138
- categories: [...axis.categories],
139
- crosshair: axis.crosshair
140
- };
141
- }
142
- function resolveTooltipTimezone(axis, timezone) {
143
- return axis.type === "datetime" ? _nullishCoalesce(timezone, () => ( "UTC")) : void 0;
144
- }
145
-
146
-
147
-
148
-
149
- exports.buildDimensionalAxis = buildDimensionalAxis; exports.resolveTooltipTimezone = resolveTooltipTimezone;
150
- //# sourceMappingURL=chunk-6D7P3IOT.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["/home/runner/_work/seeds/seeds/seeds-react/seeds-react-data-viz/dist/chunk-6D7P3IOT.js","../src/charts/shared/formatters/datetimeFormatter.ts","../src/charts/shared/axisOptions.ts"],"names":[],"mappings":"AAAA;AC2CA,IAAM,OAAA,EAAS,KAAA;AACf,IAAM,QAAA,EAAU,MAAA;AAQhB,IAAM,aAAA,EAAe,OAAA;AACrB,IAAM,YAAA,EAAc,OAAA;AAQpB,IAAM,uBAAA,EAAyB,CAAC,IAAA,EAAY,QAAA,EAAA,GAAqB;AAC/D,EAAA,MAAM,UAAA,EAAY,IAAI,IAAA,CAAK,cAAA,CAAe,OAAA,EAAS;AAAA,IACjD,IAAA,EAAM,SAAA;AAAA,IACN,KAAA,EAAO,SAAA;AAAA,IACP,GAAA,EAAK,SAAA;AAAA,IACL,QAAA,EAAU;AAAA,EACZ,CAAC,CAAA;AACD,EAAA,MAAM,MAAA,EAAQ,SAAA,CAAU,aAAA,CAAc,IAAI,CAAA;AAC1C,EAAA,OAAO;AAAA,IACL,GAAA,EAAK,QAAA,kCAAS,KAAA,mBAAM,IAAA,mBAAK,CAAC,CAAA,EAAA,GAAM,CAAA,CAAE,KAAA,IAAS,KAAK,CAAA,6BAAG,OAAA,UAAS,KAAA,EAAK,EAAE,CAAA;AAAA,IACnE,KAAA,EAAO,QAAA,kCAAS,KAAA,qBAAM,IAAA,mBAAK,CAAC,CAAA,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MAAA;AACK,QAAA;AACb,MAAA;AACF,IAAA;AACF,EAAA;AACO,EAAA;AACC,IAAA;AACU,IAAA;AACA,IAAA;AAClB,EAAA;AACF;AAOgB;AAIO,EAAA;AACvB;AFoEwB;AACA;AACA;AACA;AACA","file":"/home/runner/_work/seeds/seeds/seeds-react/seeds-react-data-viz/dist/chunk-6D7P3IOT.js","sourcesContent":[null,"/**\n * Pure, Highcharts-free datetime axis label formatter for v2 chart families.\n *\n * Ports v1's `helpers/xAxisLabelFormatter` into a rendering-agnostic shape: it\n * returns a `{ primary, secondary? }` object instead of an HTML string, leaving\n * SVG rendering to the caller. The timezone- and DST-correct boundary detection\n * (calendar parts read in the target timezone) and the per-granularity\n * `Intl.DateTimeFormat` option sets are a near-verbatim port of v1.\n *\n * The one net-new piece versus v1 is granularity derivation: v1 receives\n * `unitName` from Highcharts, but `charts/` may not depend on Highcharts types\n * (see `charts/README.md` invariants), so granularity is derived from the\n * spacing of `tickPositions`.\n */\n\n// Local types — defined here rather than imported from the Highcharts package\n// or v1's src/types.ts, to keep charts/ self-contained per the README invariant.\nexport type DatetimeTimeFormat = \"12\" | \"24\";\n\nexport type DatetimeLabel = Readonly<{\n primary: string;\n /** Omitted (undefined) when the tick is not on a unit boundary. */\n secondary?: string;\n}>;\n\ntype DatetimeGranularity = \"hour\" | \"day\" | \"week\" | \"month\" | \"year\";\n\ntype DatetimeFormatterInput = Readonly<{\n /** ms-epoch tick value, or a categorical string passed through verbatim. */\n value: number | string;\n /** Full tick array — used for boundary lookup and granularity derivation. */\n tickPositions: readonly number[];\n // optional\n /** IANA timezone. Defaults to \"UTC\". */\n timezone?: string;\n /** \"12\" | \"24\" hour clock for the hour granularity. Defaults to \"12\". */\n timeFormat?: DatetimeTimeFormat;\n /** Locale for Intl formatting. Defaults to \"en-US\". */\n textLocale?: Intl.LocalesArgument;\n}>;\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars -- kept alongside DAY_MS/WEEK_MS for upcoming duration formatting; stable numeric constant unlikely to drift\nconst HOUR_MS = 3_600_000;\nconst DAY_MS = 86_400_000;\nconst WEEK_MS = 604_800_000;\n// Granularity cutoffs use the *minimum* month/year length, not the average, so\n// calendar-aligned axes classify correctly: a real Highcharts month-unit axis\n// sits 28–31d apart and a year-unit axis 365–366d apart. Comparing the median\n// tick delta against the *average* month (30.44d) / year (365.25d) length\n// misclassified a 28-day February month gap as \"week\" and a 365-day non-leap\n// year as \"month\". Bias to the minimum so the shortest real span still reads as\n// \"month\" / \"year\".\nconst MIN_MONTH_MS = 2_419_200_000; // 28 days (shortest month, non-leap Feb)\nconst MIN_YEAR_MS = 31_536_000_000; // 365 days (shortest, non-leap year)\n\n/**\n * Reads the calendar day/month/year of a date *in the target timezone* via\n * `Intl.DateTimeFormat(...).formatToParts`. This is what makes boundary\n * detection timezone- and DST-correct (a 25-hour \"fall back\" day still rolls\n * the day over on the correct local-midnight tick). Ported verbatim from v1.\n */\nconst getDatePartsInTimezone = (date: Date, timezone: string) => {\n const formatter = new Intl.DateTimeFormat(\"en-US\", {\n year: \"numeric\",\n month: \"numeric\",\n day: \"numeric\",\n timeZone: timezone,\n });\n const parts = formatter.formatToParts(date);\n return {\n day: parseInt(parts.find((p) => p.type === \"day\")?.value ?? \"0\", 10),\n month: parseInt(parts.find((p) => p.type === \"month\")?.value ?? \"0\", 10),\n year: parseInt(parts.find((p) => p.type === \"year\")?.value ?? \"0\", 10),\n };\n};\n\n/**\n * Derives the axis granularity from the median delta between consecutive\n * `tickPositions`. Median (not mean) so an irregular first/last gap does not\n * skew the result. With fewer than two ticks there is no spacing to measure, so\n * we default to \"day\".\n *\n * Note: \"day\" and \"week\" produce identical output (same primary/secondary\n * option sets), so the day/week threshold is cosmetic and never changes a label.\n * The week↔month and month↔year cutoffs do change output, so they compare\n * against the *minimum* month/year length (not the average); see MIN_MONTH_MS /\n * MIN_YEAR_MS for why calendar-aligned axes would otherwise be misclassified.\n */\nconst deriveGranularity = (\n tickPositions: readonly number[]\n): DatetimeGranularity => {\n if (tickPositions.length < 2) {\n return \"day\";\n }\n\n const deltas: number[] = [];\n for (let i = 1; i < tickPositions.length; i++) {\n const curr = tickPositions[i];\n const prev = tickPositions[i - 1];\n // Both reads are in range by the loop bounds (1 <= i < length); the guard\n // only satisfies noUncheckedIndexedAccess and is unreachable at runtime.\n if (curr === undefined || prev === undefined) {\n continue;\n }\n deltas.push(Math.abs(curr - prev));\n }\n deltas.sort((a, b) => a - b);\n\n const mid = Math.floor(deltas.length / 2);\n // `length >= 2` is guaranteed by the early return above, so `deltas` has at\n // least one element and `deltas[mid]` is always defined; `deltas[mid - 1]` is\n // only read on the even-length branch, where it is guaranteed in range too.\n const upper = deltas[mid]!;\n const lower = deltas[mid - 1];\n const median =\n deltas.length % 2 === 0 && lower !== undefined\n ? (lower + upper) / 2\n : upper;\n\n if (median < DAY_MS) {\n return \"hour\";\n }\n if (median < WEEK_MS) {\n return \"day\";\n }\n if (median < MIN_MONTH_MS) {\n return \"week\";\n }\n if (median < MIN_YEAR_MS) {\n return \"month\";\n }\n return \"year\";\n};\n\n/**\n * Derives a datetime tick's two-line stacked label as a rendering-agnostic\n * `{ primary, secondary? }` object. `secondary` is emitted only on a unit\n * boundary (the first tick, or when the relevant calendar part changes versus\n * the previous tick), matching v1's two-line semantics.\n *\n * Categorical (string) values and non-finite numbers are passed through as\n * `{ primary: String(value) }` with no secondary, so callers always get a\n * stable, markup-free string rather than \"Invalid Date\".\n */\nexport function datetimeFormatter({\n value,\n tickPositions = [],\n // optional\n timezone = \"UTC\",\n timeFormat = \"12\",\n textLocale = \"en-US\",\n}: DatetimeFormatterInput): DatetimeLabel {\n // Categorical (string) data, and non-finite timestamps, pass through.\n if (typeof value === \"string\" || !Number.isFinite(value)) {\n return { primary: String(value) };\n }\n\n const granularity = deriveGranularity(tickPositions);\n\n const tickIndex = tickPositions.indexOf(value);\n const isFirst = tickIndex === 0;\n const previousValue = tickPositions[tickIndex - 1];\n\n const valueDate = new Date(value);\n const valueParts = getDatePartsInTimezone(valueDate, timezone);\n const previousValueDate = previousValue ? new Date(previousValue) : undefined;\n const previousValueParts = previousValueDate\n ? getDatePartsInTimezone(previousValueDate, timezone)\n : undefined;\n\n let firstPartOptions: Intl.DateTimeFormatOptions = {};\n let secondPartOptions: Intl.DateTimeFormatOptions = {};\n\n switch (granularity) {\n case \"hour\":\n firstPartOptions =\n timeFormat === \"24\"\n ? { hour: \"numeric\", minute: \"numeric\", hour12: false }\n : { hour: \"numeric\" };\n if (isFirst || valueParts.day !== previousValueParts?.day) {\n secondPartOptions = { day: \"numeric\", month: \"short\" };\n }\n break;\n case \"day\":\n case \"week\":\n firstPartOptions = { day: \"numeric\" };\n if (isFirst || valueParts.month !== previousValueParts?.month) {\n secondPartOptions = { month: \"short\" };\n }\n break;\n case \"month\":\n firstPartOptions = { month: \"short\" };\n if (isFirst || valueParts.year !== previousValueParts?.year) {\n secondPartOptions = { year: \"numeric\" };\n }\n break;\n case \"year\":\n firstPartOptions = { year: \"numeric\" };\n break;\n default:\n firstPartOptions = {};\n break;\n }\n\n const primary = new Intl.DateTimeFormat(textLocale, {\n ...firstPartOptions,\n timeZone: timezone,\n }).format(valueDate);\n\n if (Object.keys(secondPartOptions).length > 0) {\n const secondary = new Intl.DateTimeFormat(textLocale, {\n ...secondPartOptions,\n timeZone: timezone,\n }).format(valueDate);\n return { primary, secondary };\n }\n\n return { primary };\n}\n","// Shared adapter helpers for the X/Y chart families (bar, line-area, …). Each\n// family's adapter still owns its `chart.type`, `plotOptions`, `series`, and\n// value (y) axis; these utilities cover the dimensional-axis + timezone wiring\n// that is identical across families, so it lives in one place.\n//\n// Deliberately granular (one concern per function) rather than a single base-\n// options builder, so a non-X/Y family like donut can reuse the subset that\n// applies to it. The broader shared-shell + value-axis sharing is left to the\n// X/Y pattern-sharing spike — the value axis in particular diverges per family\n// today (e.g. bar's declarative `format` from CE-41), so it stays per-family.\n\nimport type { DimensionalAxis } from \"./axis\";\nimport type {\n SeedsAxisLabelFormatterContext,\n SeedsChartXAxisOptions,\n} from \"./chartBase\";\nimport { datetimeFormatter } from \"./formatters/datetimeFormatter\";\nimport type { DatetimeTimeFormat } from \"./formatters/datetimeFormatter\";\n\n// Datetime tick labels: a granularity-aware, timezone/DST-correct two-line\n// stacked label via the shared `datetimeFormatter`, rendered as SVG. `<br/>` is a\n// line break in Highcharts' SVG text (styledMode, useHTML: false); the secondary\n// token is wrapped in a <span> — rendered as a <tspan> — styled by the\n// `.highcharts-xaxis-labels` rule in `styles/chartStyles.ts`.\nfunction makeDatetimeAxisLabelFormatter(\n timezone: string,\n timeFormat: DatetimeTimeFormat | undefined\n) {\n return function (this: SeedsAxisLabelFormatterContext): string {\n const { primary, secondary } = datetimeFormatter({\n value: this.value,\n tickPositions: this.axis.tickPositions ?? [],\n timezone,\n timeFormat,\n });\n return secondary\n ? `${primary}<br/><span class=\"hc-axis-label-secondary\">${secondary}</span>`\n : primary;\n };\n}\n\n/**\n * Builds the dimensional (x) axis options shared by the X/Y chart families.\n * Category axes pass their labels through; datetime axes get the granularity-\n * aware two-line label formatter. `timezone` is only consulted for datetime.\n */\nexport function buildDimensionalAxis(\n axis: DimensionalAxis,\n timezone: string\n): SeedsChartXAxisOptions {\n if (axis.type === \"datetime\") {\n return {\n type: \"datetime\",\n crosshair: axis.crosshair,\n labels: {\n formatter: makeDatetimeAxisLabelFormatter(timezone, axis.timeFormat),\n },\n };\n }\n return {\n type: \"category\",\n categories: [...axis.categories],\n crosshair: axis.crosshair,\n };\n}\n\n/**\n * The timezone shared by datetime-axis ticks (`time.timezone`) and the tooltip\n * date formatter, so they can never disagree about the day. Defaults to `\"UTC\"`\n * on a datetime axis; `undefined` on a category axis (timezone is meaningless).\n */\nexport function resolveTooltipTimezone(\n axis: DimensionalAxis,\n timezone?: string\n): string | undefined {\n return axis.type === \"datetime\" ? timezone ?? \"UTC\" : undefined;\n}\n"]}