@sproutsocial/seeds-react-data-viz 0.16.1 → 0.17.1

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 (56) hide show
  1. package/dist/annotations-CjFoRPXf.d.mts +20 -0
  2. package/dist/annotations-CjFoRPXf.d.ts +20 -0
  3. package/dist/axis-WOeYkTO1.d.mts +44 -0
  4. package/dist/axis-WOeYkTO1.d.ts +44 -0
  5. package/dist/bar/index.d.mts +3 -1
  6. package/dist/bar/index.d.ts +3 -1
  7. package/dist/bar/index.js +15 -8
  8. package/dist/bar/index.js.map +1 -1
  9. package/dist/{axis-BVPkC6iF.d.ts → chartBase-C-l7yYGx.d.ts} +5 -59
  10. package/dist/{axis-BjucJt39.d.mts → chartBase-Cn_5CUJi.d.mts} +5 -59
  11. package/dist/chunk-6D7P3IOT.js +150 -0
  12. package/dist/chunk-6D7P3IOT.js.map +1 -0
  13. package/dist/chunk-CYQXUAJC.js +169 -0
  14. package/dist/chunk-CYQXUAJC.js.map +1 -0
  15. package/dist/{chunk-EJYDQYLE.js → chunk-HDEKK4W4.js} +101 -248
  16. package/dist/chunk-HDEKK4W4.js.map +1 -0
  17. package/dist/chunk-QKH2ZO2D.js +68 -0
  18. package/dist/chunk-QKH2ZO2D.js.map +1 -0
  19. package/dist/donut/index.d.mts +48 -0
  20. package/dist/donut/index.d.ts +48 -0
  21. package/dist/donut/index.js +125 -0
  22. package/dist/donut/index.js.map +1 -0
  23. package/dist/esm/bar/index.js +13 -6
  24. package/dist/esm/bar/index.js.map +1 -1
  25. package/dist/esm/chunk-NAKJY5PA.js +150 -0
  26. package/dist/esm/chunk-NAKJY5PA.js.map +1 -0
  27. package/dist/esm/chunk-O5VJGGZY.js +68 -0
  28. package/dist/esm/chunk-O5VJGGZY.js.map +1 -0
  29. package/dist/esm/{chunk-DKTW56NJ.js → chunk-TKNWM7L3.js} +102 -249
  30. package/dist/esm/chunk-TKNWM7L3.js.map +1 -0
  31. package/dist/esm/chunk-XMYGML25.js +169 -0
  32. package/dist/esm/chunk-XMYGML25.js.map +1 -0
  33. package/dist/esm/donut/index.js +125 -0
  34. package/dist/esm/donut/index.js.map +1 -0
  35. package/dist/esm/index.js +13 -157
  36. package/dist/esm/index.js.map +1 -1
  37. package/dist/esm/line-area/index.js +14 -6
  38. package/dist/esm/line-area/index.js.map +1 -1
  39. package/dist/esm/sparkline/index.js +123 -0
  40. package/dist/esm/sparkline/index.js.map +1 -0
  41. package/dist/index.d.mts +3 -0
  42. package/dist/index.d.ts +3 -0
  43. package/dist/index.js +55 -199
  44. package/dist/index.js.map +1 -1
  45. package/dist/line-area/index.d.mts +6 -3
  46. package/dist/line-area/index.d.ts +6 -3
  47. package/dist/line-area/index.js +16 -8
  48. package/dist/line-area/index.js.map +1 -1
  49. package/dist/sparkline/index.d.mts +75 -0
  50. package/dist/sparkline/index.d.ts +75 -0
  51. package/dist/sparkline/index.js +123 -0
  52. package/dist/sparkline/index.js.map +1 -0
  53. package/dist/sparkline.css +76 -0
  54. package/package.json +22 -11
  55. package/dist/chunk-EJYDQYLE.js.map +0 -1
  56. package/dist/esm/chunk-DKTW56NJ.js.map +0 -1
@@ -0,0 +1 @@
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,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ACA;AACA,EAAA,OAAO,QAAA,CAAA,EAAwD;AAC7D,IAAA,MAAM,EAAE,OAAA,EAAS,UAAU,EAAA,EAAI,iBAAA,CAAkB;AAAA,MAC/C,KAAA,EAAO,IAAA,CAAK,KAAA;AAAA,MACZ,aAAA,mBAAe,IAAA,CAAK,IAAA,CAAK,aAAA,UAAiB,CAAC,GAAA;AAAA,MAC3C,QAAA;AAAA,MACA;AAAA,IACF,CAAC,CAAA;AACD,IAAA,OAAO,UAAA,EACH,CAAA,EAAA;AAEN,EAAA;AACF;AAOgB;AAII,EAAA;AACT,IAAA;AACC,MAAA;AACU,MAAA;AACR,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"]}
@@ -0,0 +1,169 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }// src/constants/chartOptions.ts
2
+ var _lodash = require('lodash'); var _lodash2 = _interopRequireDefault(_lodash);
3
+ var baseChartOptions = {
4
+ chart: {
5
+ animation: false,
6
+ styledMode: true
7
+ },
8
+ credits: {
9
+ enabled: false
10
+ },
11
+ exporting: {
12
+ enabled: false,
13
+ fallbackToExportServer: false
14
+ },
15
+ legend: {
16
+ enabled: false
17
+ },
18
+ title: {
19
+ text: void 0
20
+ },
21
+ tooltip: {
22
+ hideDelay: 0,
23
+ outside: true,
24
+ padding: 0,
25
+ shape: "rect",
26
+ shared: true,
27
+ useHTML: true
28
+ }
29
+ };
30
+ var TIME_SERIES_CHART_HEIGHT = 275;
31
+ var timeSeriesChartOptions = _lodash2.default.merge({}, baseChartOptions, {
32
+ annotations: [
33
+ {
34
+ draggable: "",
35
+ labelOptions: {
36
+ useHTML: true,
37
+ padding: 0
38
+ // removes "left" property padding created by highcharts so that label is centered
39
+ }
40
+ }
41
+ ],
42
+ chart: {
43
+ // events.click is set at the component level because of the optional onClick prop
44
+ height: TIME_SERIES_CHART_HEIGHT,
45
+ spacing: [5, 1, 0, 2]
46
+ },
47
+ plotOptions: {
48
+ series: {
49
+ animation: false,
50
+ clip: false,
51
+ marker: {
52
+ enabled: false,
53
+ states: {
54
+ hover: {
55
+ enabled: false
56
+ }
57
+ }
58
+ }
59
+ }
60
+ },
61
+ xAxis: {
62
+ crosshair: {
63
+ zIndex: 3
64
+ },
65
+ minPadding: 0,
66
+ // must be handled dynamically instead of css
67
+ maxPadding: 0,
68
+ // must be handled dynamically instead of css
69
+ type: "datetime",
70
+ labels: {
71
+ useHTML: true
72
+ // formatter is set at the component level because of the required text locale prop
73
+ }
74
+ },
75
+ yAxis: {
76
+ labels: {
77
+ useHTML: true
78
+ // formatter is set at the component level because of the optional yAxisLabelFormatter prop
79
+ },
80
+ softMax: 0,
81
+ softMin: 0,
82
+ title: {
83
+ text: void 0
84
+ },
85
+ plotLines: [
86
+ /* Adds a custom plotLine at y=0 to represent the chart baseline.
87
+ This approach allows full control over the line's appearance (e.g., color, z-index),
88
+ unlike relying on the default xAxis line, which always renders at the bottom of the chart
89
+ even when y=0 appears elsewhere (e.g., with negative values).
90
+ */
91
+ {
92
+ className: "y-axis-zero-line",
93
+ value: 0,
94
+ zIndex: 3
95
+ // ensures the line appears over the default y=0 line, which we can't seleect as specifically
96
+ }
97
+ ]
98
+ }
99
+ });
100
+ var lineChartOptions = _lodash2.default.merge({}, timeSeriesChartOptions, {
101
+ // plotOptions.spline.events.click is set at the component level because of the optional onClick prop
102
+ });
103
+ var areaChartOptions = _lodash2.default.merge({}, timeSeriesChartOptions, {
104
+ plotOptions: {
105
+ areaspline: {
106
+ // events.click is set at the component level because of the optional onClick prop
107
+ stacking: "normal"
108
+ }
109
+ }
110
+ });
111
+ var columnChartOptions = _lodash2.default.merge({}, timeSeriesChartOptions, {
112
+ plotOptions: {
113
+ column: {
114
+ stacking: "normal",
115
+ pointPadding: 0.25,
116
+ groupPadding: 0.25,
117
+ borderRadius: 4
118
+ }
119
+ },
120
+ xAxis: {
121
+ crosshair: false
122
+ },
123
+ yAxis: {
124
+ plotLines: [
125
+ {
126
+ // For stacked column charts with visible borders (e.g., white for contrast),
127
+ // we raise the zIndex of the y=0 plotLine to ensure it remains visible
128
+ // and isn't visually covered by overlapping column borders.
129
+ zIndex: 5
130
+ }
131
+ ]
132
+ }
133
+ });
134
+ var VERTICAL_BAR_CHART_DEFAULT_SERIES_LIMIT = 10;
135
+ var DONUT_CHART_HALO_SIZE = 10;
136
+ var DONUT_CHART_HEIGHT = 250 + DONUT_CHART_HALO_SIZE * 2;
137
+ var DONUT_CHART_WIDTH = DONUT_CHART_HEIGHT;
138
+ var donutChartOptions = _lodash2.default.merge({}, baseChartOptions, {
139
+ chart: {
140
+ height: DONUT_CHART_HEIGHT,
141
+ spacing: [0, 0, 0, 0]
142
+ },
143
+ plotOptions: {
144
+ pie: {
145
+ animation: false,
146
+ borderRadius: 0,
147
+ // must be handled here instead of css because of path rendering
148
+ dataLabels: {
149
+ enabled: false
150
+ },
151
+ innerSize: "50%"
152
+ }
153
+ }
154
+ });
155
+
156
+
157
+
158
+
159
+
160
+
161
+
162
+
163
+
164
+
165
+
166
+
167
+
168
+ exports.baseChartOptions = baseChartOptions; exports.TIME_SERIES_CHART_HEIGHT = TIME_SERIES_CHART_HEIGHT; exports.timeSeriesChartOptions = timeSeriesChartOptions; exports.lineChartOptions = lineChartOptions; exports.areaChartOptions = areaChartOptions; exports.columnChartOptions = columnChartOptions; exports.VERTICAL_BAR_CHART_DEFAULT_SERIES_LIMIT = VERTICAL_BAR_CHART_DEFAULT_SERIES_LIMIT; exports.DONUT_CHART_HALO_SIZE = DONUT_CHART_HALO_SIZE; exports.DONUT_CHART_HEIGHT = DONUT_CHART_HEIGHT; exports.DONUT_CHART_WIDTH = DONUT_CHART_WIDTH; exports.donutChartOptions = donutChartOptions;
169
+ //# sourceMappingURL=chunk-CYQXUAJC.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/home/runner/_work/seeds/seeds/seeds-react/seeds-react-data-viz/dist/chunk-CYQXUAJC.js","../src/constants/chartOptions.ts"],"names":[],"mappings":"AAAA;ACCA,gFAAc;AAKP,IAAM,iBAAA,EAA4B;AAAA,EACvC,KAAA,EAAO;AAAA,IACL,S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AA;AAAA,MACV,YAAA,EAAc,IAAA;AAAA,MACd,YAAA,EAAc,IAAA;AAAA,MACd,YAAA,EAAc;AAAA,IAChB;AAAA,EACF,CAAA;AAAA,EACA,KAAA,EAAO;AAAA,IACL,SAAA,EAAW;AAAA,EACb,CAAA;AAAA,EACA,KAAA,EAAO;AAAA,IACL,SAAA,EAAW;AAAA,MACT;AAAA;AAAA;AAAA;AAAA,QAIE,MAAA,EAAQ;AAAA,MACV;AAAA,IACF;AAAA,EACF;AACF,CAAC,CAAA;AAOM,IAAM,wCAAA,EAA0C,EAAA;AAGhD,IAAM,sBAAA,EAAwB,EAAA;AAC9B,IAAM,mBAAA,EAAqB,IAAA,EAAM,sBAAA,EAAwB,CAAA;AACzD,IAAM,kBAAA,EAAoB,kBAAA;AAC1B,IAAM,kBAAA,EAA6B,gBAAA,CAAE,KAAA,CAAM,CAAC,CAAA,EAAG,gBAAA,EAAkB;AAAA,EACtE,KAAA,EAAO;AAAA,IACL,MAAA,EAAQ,kBAAA;AAAA,IACR,OAAA,EAAS,CAAC,CAAA,EAAG,CAAA,EAAG,CAAA,EAAG,CAAC;AAAA,EACtB,CAAA;AAAA,EACA,WAAA,EAAa;AAAA,IACX,GAAA,EAAK;AAAA,MACH,SAAA,EAAW,KAAA;AAAA,MACX,YAAA,EAAc,CAAA;AAAA;AAAA,MACd,UAAA,EAAY;AAAA,QACV,OAAA,EAAS;AAAA,MACX,CAAA;AAAA,MACA,SAAA,EAAW;AAAA,IACb;AAAA,EACF;AACF,CAAC,CAAA;ADbD;AACA;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,8kBAAC","file":"/home/runner/_work/seeds/seeds/seeds-react/seeds-react-data-viz/dist/chunk-CYQXUAJC.js","sourcesContent":[null,"import type { Options } from \"highcharts\";\nimport _ from \"lodash\";\n\n// options that should apply to all charts\n// this is being exported because it's needed for the listening bubble chart component.\n// when that components gets moved into the data-viz package, we can remove the export here\nexport const baseChartOptions: Options = {\n chart: {\n animation: false,\n styledMode: true,\n },\n credits: {\n enabled: false,\n },\n exporting: {\n enabled: false,\n fallbackToExportServer: false,\n },\n legend: {\n enabled: false,\n },\n title: {\n text: undefined,\n },\n tooltip: {\n hideDelay: 0,\n outside: true,\n padding: 0,\n shape: \"rect\",\n shared: true,\n useHTML: true,\n },\n};\n\n// options that should apply to time series charts\nexport const TIME_SERIES_CHART_HEIGHT = 275;\nexport const timeSeriesChartOptions: Options = _.merge({}, baseChartOptions, {\n annotations: [\n {\n draggable: \"\",\n labelOptions: {\n useHTML: true,\n padding: 0, // removes \"left\" property padding created by highcharts so that label is centered\n },\n },\n ],\n chart: {\n // events.click is set at the component level because of the optional onClick prop\n height: TIME_SERIES_CHART_HEIGHT,\n spacing: [5, 1, 0, 2],\n },\n plotOptions: {\n series: {\n animation: false,\n clip: false,\n marker: {\n enabled: false,\n states: {\n hover: {\n enabled: false,\n },\n },\n },\n },\n },\n xAxis: {\n crosshair: {\n zIndex: 3,\n },\n minPadding: 0, // must be handled dynamically instead of css\n maxPadding: 0, // must be handled dynamically instead of css\n type: \"datetime\",\n labels: {\n useHTML: true,\n // formatter is set at the component level because of the required text locale prop\n },\n },\n yAxis: {\n labels: {\n useHTML: true,\n // formatter is set at the component level because of the optional yAxisLabelFormatter prop\n },\n softMax: 0,\n softMin: 0,\n title: {\n text: undefined,\n },\n plotLines: [\n /* Adds a custom plotLine at y=0 to represent the chart baseline.\n This approach allows full control over the line's appearance (e.g., color, z-index),\n unlike relying on the default xAxis line, which always renders at the bottom of the chart\n even when y=0 appears elsewhere (e.g., with negative values).\n */\n {\n className: \"y-axis-zero-line\",\n value: 0,\n zIndex: 3, // ensures the line appears over the default y=0 line, which we can't seleect as specifically\n },\n ],\n },\n});\n\n// options that should apply to LineChart\nexport const lineChartOptions: Options = _.merge({}, timeSeriesChartOptions, {\n // plotOptions.spline.events.click is set at the component level because of the optional onClick prop\n});\n\n// options that should apply to AreaChart\nexport const areaChartOptions: Options = _.merge({}, timeSeriesChartOptions, {\n plotOptions: {\n areaspline: {\n // events.click is set at the component level because of the optional onClick prop\n stacking: \"normal\",\n },\n },\n});\n\nexport const columnChartOptions: Options = _.merge({}, timeSeriesChartOptions, {\n plotOptions: {\n column: {\n stacking: \"normal\",\n pointPadding: 0.25,\n groupPadding: 0.25,\n borderRadius: 4,\n },\n },\n xAxis: {\n crosshair: false,\n },\n yAxis: {\n plotLines: [\n {\n // For stacked column charts with visible borders (e.g., white for contrast),\n // we raise the zIndex of the y=0 plotLine to ensure it remains visible\n // and isn't visually covered by overlapping column borders.\n zIndex: 5,\n },\n ],\n },\n});\n\n/**\n * The default series limit for VerticalBarChart.\n * This limit is recommended to maintain chart readability and accessibility.\n * @see {VerticalBarChart}\n */\nexport const VERTICAL_BAR_CHART_DEFAULT_SERIES_LIMIT = 10;\n\n// options that should apply to DonutChart\nexport const DONUT_CHART_HALO_SIZE = 10; // 10 is the default from highcharts\nexport const DONUT_CHART_HEIGHT = 250 + DONUT_CHART_HALO_SIZE * 2;\nexport const DONUT_CHART_WIDTH = DONUT_CHART_HEIGHT;\nexport const donutChartOptions: Options = _.merge({}, baseChartOptions, {\n chart: {\n height: DONUT_CHART_HEIGHT,\n spacing: [0, 0, 0, 0],\n },\n plotOptions: {\n pie: {\n animation: false,\n borderRadius: 0, // must be handled here instead of css because of path rendering\n dataLabels: {\n enabled: false,\n },\n innerSize: \"50%\",\n },\n },\n});\n"]}
@@ -210,27 +210,52 @@ function DefaultChartTooltip({
210
210
  tooltipClickLabel,
211
211
  timezone,
212
212
  invalidNumberLabel,
213
- valueFormat
213
+ valueFormat = {},
214
+ hideTitle,
215
+ hideTotal = false
214
216
  }) {
215
- const rows = data.map((d) => ({
216
- cells: [
217
- {
218
- content: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkWEKDYQ4Tjs.ChartLegendLabel, { color: d.color, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _seedsreacttext.Text, { "aria-label": `${d.name}: `, children: d.name }) })
219
- },
220
- {
221
- // Format non-null values through the shared formatter when a
222
- // `valueFormat` is supplied. Tooltip values are always full precision
223
- // (`abbreviate: false`) — the axis tick scan never applies here (v1
224
- // parity: the bar tooltip always passed `abbreviate={false}`).
225
- content: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _seedsreacttext.Text, { children: d.value == null ? _nullishCoalesce(invalidNumberLabel, () => ( "\u2014")) : valueFormat ? valueFormatter({
226
- ...valueFormat,
227
- value: d.value,
228
- abbreviate: false
229
- }) : d.value }),
230
- align: "right"
231
- }
232
- ]
233
- }));
217
+ const rows = data.map((d) => {
218
+ const formattedValue = d.value == null ? _nullishCoalesce(invalidNumberLabel, () => ( "\u2014")) : valueFormatter({ ...valueFormat, value: d.value, abbreviate: false });
219
+ const nameCell = {
220
+ content: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkWEKDYQ4Tjs.ChartLegendLabel, { color: d.color, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _seedsreacttext.Text, { "aria-label": `${d.name}: `, children: d.name }) })
221
+ };
222
+ return {
223
+ cells: [
224
+ nameCell,
225
+ {
226
+ content: d.percent != null && !isNaN(d.percent) ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _seedsreactbox.Box, { display: "inline-flex", alignItems: "center", gap: 350, children: [
227
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _seedsreacttext.Text, { children: [
228
+ Math.round(d.percent),
229
+ "%"
230
+ ] }),
231
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _seedsreacttext.Text, { fontWeight: "semibold", children: formattedValue })
232
+ ] }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _seedsreacttext.Text, { children: formattedValue }),
233
+ align: "right"
234
+ }
235
+ ]
236
+ };
237
+ });
238
+ const contributing = data.filter((d) => d.value != null);
239
+ const total = contributing.length > 0 ? contributing.reduce((sum, d) => sum + d.value, 0) : null;
240
+ const totalRow = data.length > 1 && !hideTotal ? [
241
+ {
242
+ isAppendedRow: true,
243
+ cells: [
244
+ {
245
+ content: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _seedsreacttext.Text, { fontWeight: "semibold", "aria-label": "Total: ", children: "Total" })
246
+ },
247
+ {
248
+ // Mirror the per-series value cell's formatting path exactly.
249
+ content: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _seedsreacttext.Text, { fontWeight: "bold", children: total == null ? _nullishCoalesce(invalidNumberLabel, () => ( "\u2014")) : valueFormatter({
250
+ ...valueFormat,
251
+ value: total,
252
+ abbreviate: false
253
+ }) }),
254
+ align: "right"
255
+ }
256
+ ]
257
+ }
258
+ ] : [];
234
259
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkWEKDYQ4Tjs.ChartTooltip, { children: [
235
260
  annotation ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
236
261
  AnnotationHeader,
@@ -240,8 +265,13 @@ function DefaultChartTooltip({
240
265
  description: annotation.description
241
266
  }
242
267
  ) : null,
243
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkWEKDYQ4Tjs.ChartTooltipTitle, { children: formatTitle(position, timezone) }),
244
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkWEKDYQ4Tjs.ChartTooltipTable, { rows }),
268
+ hideTitle ? null : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkWEKDYQ4Tjs.ChartTooltipTitle, { children: formatTitle(position, timezone) }),
269
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
270
+ _chunkWEKDYQ4Tjs.ChartTooltipTable,
271
+ {
272
+ rows: [...rows, ...totalRow]
273
+ }
274
+ ),
245
275
  hasOnClick && tooltipClickLabel ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkWEKDYQ4Tjs.ChartTooltipFooter, { children: typeof tooltipClickLabel === "string" ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _seedsreactbox.Box, { display: "flex", alignItems: "center", gap: 300, children: [
246
276
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _seedsreacticon.Icon, { name: "hand-pointer-clicking-outline", color: "icon.base" }),
247
277
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _seedsreacttext.Text, { color: "text.subtext", fontSize: 200, children: tooltipClickLabel })
@@ -286,6 +316,13 @@ _annotations2.default.call(void 0, _highcharts2.default);
286
316
  _exporting2.default.call(void 0, _highcharts2.default);
287
317
  _offlineexporting2.default.call(void 0, _highcharts2.default);
288
318
  _exportdata2.default.call(void 0, _highcharts2.default);
319
+ function isChartStacked(options) {
320
+ const plotOptions = options.plotOptions;
321
+ if (!plotOptions) return false;
322
+ return Object.values(plotOptions).some(
323
+ (slot) => slot != null && typeof slot === "object" && Boolean(slot.stacking)
324
+ );
325
+ }
289
326
  function useSeedsChartSetup({
290
327
  series,
291
328
  includePatterns = false,
@@ -377,9 +414,15 @@ function buildExportChartOptions(theme, colors) {
377
414
  width: 1
378
415
  }
379
416
  },
380
- // No zero-line: the `y-axis-zero-line` rule in chartStyles is a v1 leftover;
381
- // the v2 bar adapter never creates that plotLine.
382
- yAxis: axisOptions
417
+ yAxis: {
418
+ ...axisOptions,
419
+ // The live chart's plotLines (set by the adapter) merge with this by
420
+ // array index, so `className`/`value`/`zIndex` survive — this only adds
421
+ // the color the `y-axis-zero-line` CSS class can't reach in styledMode:false.
422
+ plotLines: [
423
+ { value: 0, color: theme.colors.container.border.decorative.neutral }
424
+ ]
425
+ }
383
426
  };
384
427
  }
385
428
  function createChartExportHandle(chart, getExportChartOptions) {
@@ -421,11 +464,13 @@ function ChartRenderer({
421
464
  timezone,
422
465
  invalidNumberLabel,
423
466
  valueFormat,
467
+ hideLegend = false,
424
468
  onReady
425
469
  }) {
426
470
  const [chart, setChart] = _react.useState.call(void 0, null);
427
471
  const [plotHeight, setPlotHeight] = _react.useState.call(void 0, 0);
428
- const renderTooltip = _nullishCoalesce(tooltip, () => ( DefaultChartTooltip));
472
+ const chartIsStacked = isChartStacked(options);
473
+ const renderTooltip = _nullishCoalesce(tooltip, () => ( ((args) => DefaultChartTooltip({ ...args, hideTotal: !chartIsStacked }))));
429
474
  const theme = _styledcomponents.useTheme.call(void 0, );
430
475
  const exportThemeRef = _react.useRef.call(void 0, { theme, colors });
431
476
  exportThemeRef.current = { theme, colors };
@@ -500,19 +545,32 @@ function ChartRenderer({
500
545
  {
501
546
  chart,
502
547
  renderContent: (context) => {
503
- const data = _chunkWEKDYQ4Tjs.transformTimeSeriesTooltipData.call(void 0, {
504
- context,
505
- data: series.map((s, i) => ({
506
- name: s.name,
507
- points: [],
508
- styles: { color: _nullishCoalesce(_nullishCoalesce(s.color, () => ( colors[i])), () => ( "")) }
548
+ const ctx = context;
549
+ const isPie = !ctx.points;
550
+ const data = isPie ? [
551
+ {
552
+ color: ctx.point.color,
553
+ name: ctx.point.name,
554
+ value: ctx.point.y,
555
+ percent: ctx.point.percentage
556
+ }
557
+ ] : (
558
+ // Drop v1's `readonly` array wrapper and `icon` field at the seam —
559
+ // the v2 surface is mutable and doesn't expose row-level icons.
560
+ _chunkWEKDYQ4Tjs.transformTimeSeriesTooltipData.call(void 0, {
561
+ context,
562
+ data: series.map((s, i) => ({
563
+ name: s.name,
564
+ points: [],
565
+ styles: { color: _nullishCoalesce(_nullishCoalesce(s.color, () => ( colors[i])), () => ( "")) }
566
+ }))
567
+ }).map((row) => ({
568
+ color: row.color,
569
+ name: row.name,
570
+ value: row.value
509
571
  }))
510
- }).map((row) => ({
511
- color: row.color,
512
- name: row.name,
513
- value: row.value
514
- }));
515
- const position = context.x;
572
+ );
573
+ const position = isPie ? _nullishCoalesce(ctx.key, () => ( ctx.point.name)) : context.x;
516
574
  const resolved = _optionalChain([annotationLookup, 'optionalAccess', _17 => _17.get, 'call', _18 => _18(context.point.x)]);
517
575
  const annotation = resolved ? {
518
576
  icon: resolved.icon,
@@ -523,6 +581,8 @@ function ChartRenderer({
523
581
  return renderTooltip({
524
582
  data,
525
583
  position,
584
+ // Pie has no x-axis position; its title would just repeat the slice name.
585
+ hideTitle: isPie,
526
586
  annotation,
527
587
  hasOnClick,
528
588
  tooltipClickLabel,
@@ -533,7 +593,7 @@ function ChartRenderer({
533
593
  }
534
594
  }
535
595
  ) : null,
536
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _seedsreactbox.Box, { mt: 350, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
596
+ hideLegend ? null : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _seedsreactbox.Box, { mt: 350, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
537
597
  SeriesLegend,
538
598
  {
539
599
  items: series.map((s, i) => ({
@@ -546,35 +606,6 @@ function ChartRenderer({
546
606
  ] });
547
607
  }
548
608
 
549
- // src/charts/shared/annotations.ts
550
- function buildAnnotationConfig(annotations) {
551
- if (!_optionalChain([annotations, 'optionalAccess', _19 => _19.length])) {
552
- return { annotations: void 0, lookup: void 0 };
553
- }
554
- const labels = [];
555
- const lookup = /* @__PURE__ */ new Map();
556
- for (const annotation of annotations) {
557
- const { position } = annotation;
558
- labels.push({
559
- // Highcharts anchor — always uses `x` regardless of chart orientation.
560
- point: { x: position, y: 0, xAxis: 0, yAxis: 0 },
561
- // Space (not empty) — Highcharts reverts to its built-in label text on empty string.
562
- text: " "
563
- });
564
- lookup.set(position, annotation);
565
- }
566
- if (labels.length === 0) {
567
- return { annotations: void 0, lookup: void 0 };
568
- }
569
- return {
570
- // `useHTML: true` makes Highcharts attach an HTML `graphic.div` to each
571
- // label, which the marker portal needs as its render target. `padding: 0`
572
- // removes Highcharts' default left padding so markers stay centered.
573
- annotations: [{ labels, labelOptions: { useHTML: true, padding: 0 } }],
574
- lookup
575
- };
576
- }
577
-
578
609
  // src/charts/shared/baseChartOptions.ts
579
610
  function buildBaseChartOptions({
580
611
  type,
@@ -609,188 +640,10 @@ function buildBaseChartOptions({
609
640
  };
610
641
  }
611
642
 
612
- // src/charts/shared/formatters/datetimeFormatter.ts
613
- var DAY_MS = 864e5;
614
- var WEEK_MS = 6048e5;
615
- var MIN_MONTH_MS = 24192e5;
616
- var MIN_YEAR_MS = 31536e6;
617
- var getDatePartsInTimezone = (date, timezone) => {
618
- const formatter = new Intl.DateTimeFormat("en-US", {
619
- year: "numeric",
620
- month: "numeric",
621
- day: "numeric",
622
- timeZone: timezone
623
- });
624
- const parts = formatter.formatToParts(date);
625
- return {
626
- day: parseInt(_nullishCoalesce(_optionalChain([parts, 'access', _20 => _20.find, 'call', _21 => _21((p) => p.type === "day"), 'optionalAccess', _22 => _22.value]), () => ( "0")), 10),
627
- month: parseInt(_nullishCoalesce(_optionalChain([parts, 'access', _23 => _23.find, 'call', _24 => _24((p) => p.type === "month"), 'optionalAccess', _25 => _25.value]), () => ( "0")), 10),
628
- year: parseInt(_nullishCoalesce(_optionalChain([parts, 'access', _26 => _26.find, 'call', _27 => _27((p) => p.type === "year"), 'optionalAccess', _28 => _28.value]), () => ( "0")), 10)
629
- };
630
- };
631
- var deriveGranularity = (tickPositions) => {
632
- if (tickPositions.length < 2) {
633
- return "day";
634
- }
635
- const deltas = [];
636
- for (let i = 1; i < tickPositions.length; i++) {
637
- const curr = tickPositions[i];
638
- const prev = tickPositions[i - 1];
639
- if (curr === void 0 || prev === void 0) {
640
- continue;
641
- }
642
- deltas.push(Math.abs(curr - prev));
643
- }
644
- deltas.sort((a, b) => a - b);
645
- const mid = Math.floor(deltas.length / 2);
646
- const upper = deltas[mid];
647
- const lower = deltas[mid - 1];
648
- const median = deltas.length % 2 === 0 && lower !== void 0 ? (lower + upper) / 2 : upper;
649
- if (median < DAY_MS) {
650
- return "hour";
651
- }
652
- if (median < WEEK_MS) {
653
- return "day";
654
- }
655
- if (median < MIN_MONTH_MS) {
656
- return "week";
657
- }
658
- if (median < MIN_YEAR_MS) {
659
- return "month";
660
- }
661
- return "year";
662
- };
663
- function datetimeFormatter({
664
- value,
665
- tickPositions = [],
666
- // optional
667
- timezone = "UTC",
668
- timeFormat = "12",
669
- textLocale = "en-US"
670
- }) {
671
- if (typeof value === "string" || !Number.isFinite(value)) {
672
- return { primary: String(value) };
673
- }
674
- const granularity = deriveGranularity(tickPositions);
675
- const tickIndex = tickPositions.indexOf(value);
676
- const isFirst = tickIndex === 0;
677
- const previousValue = tickPositions[tickIndex - 1];
678
- const valueDate = new Date(value);
679
- const valueParts = getDatePartsInTimezone(valueDate, timezone);
680
- const previousValueDate = previousValue ? new Date(previousValue) : void 0;
681
- const previousValueParts = previousValueDate ? getDatePartsInTimezone(previousValueDate, timezone) : void 0;
682
- let firstPartOptions = {};
683
- let secondPartOptions = {};
684
- switch (granularity) {
685
- case "hour":
686
- firstPartOptions = timeFormat === "24" ? { hour: "numeric", minute: "numeric", hour12: false } : { hour: "numeric" };
687
- if (isFirst || valueParts.day !== _optionalChain([previousValueParts, 'optionalAccess', _29 => _29.day])) {
688
- secondPartOptions = { day: "numeric", month: "short" };
689
- }
690
- break;
691
- case "day":
692
- case "week":
693
- firstPartOptions = { day: "numeric" };
694
- if (isFirst || valueParts.month !== _optionalChain([previousValueParts, 'optionalAccess', _30 => _30.month])) {
695
- secondPartOptions = { month: "short" };
696
- }
697
- break;
698
- case "month":
699
- firstPartOptions = { month: "short" };
700
- if (isFirst || valueParts.year !== _optionalChain([previousValueParts, 'optionalAccess', _31 => _31.year])) {
701
- secondPartOptions = { year: "numeric" };
702
- }
703
- break;
704
- case "year":
705
- firstPartOptions = { year: "numeric" };
706
- break;
707
- default:
708
- firstPartOptions = {};
709
- break;
710
- }
711
- const primary = new Intl.DateTimeFormat(textLocale, {
712
- ...firstPartOptions,
713
- timeZone: timezone
714
- }).format(valueDate);
715
- if (Object.keys(secondPartOptions).length > 0) {
716
- const secondary = new Intl.DateTimeFormat(textLocale, {
717
- ...secondPartOptions,
718
- timeZone: timezone
719
- }).format(valueDate);
720
- return { primary, secondary };
721
- }
722
- return { primary };
723
- }
724
-
725
- // src/charts/shared/axisOptions.ts
726
- function makeDatetimeAxisLabelFormatter(timezone, timeFormat) {
727
- return function() {
728
- const { primary, secondary } = datetimeFormatter({
729
- value: this.value,
730
- tickPositions: _nullishCoalesce(this.axis.tickPositions, () => ( [])),
731
- timezone,
732
- timeFormat
733
- });
734
- return secondary ? `${primary}<br/><span class="hc-axis-label-secondary">${secondary}</span>` : primary;
735
- };
736
- }
737
- function buildDimensionalAxis(axis, timezone) {
738
- if (axis.type === "datetime") {
739
- return {
740
- type: "datetime",
741
- crosshair: axis.crosshair,
742
- labels: {
743
- formatter: makeDatetimeAxisLabelFormatter(timezone, axis.timeFormat)
744
- }
745
- };
746
- }
747
- return {
748
- type: "category",
749
- categories: [...axis.categories],
750
- crosshair: axis.crosshair
751
- };
752
- }
753
- function resolveTooltipTimezone(axis, timezone) {
754
- return axis.type === "datetime" ? _nullishCoalesce(timezone, () => ( "UTC")) : void 0;
755
- }
756
-
757
- // src/charts/shared/valueAxisLabelFormatter.ts
758
-
759
- var FIXED_LOCALE = "en-US";
760
- function deriveAbbreviateFromTicks(context) {
761
- const tickPositions = context.axis.tickPositions;
762
- const maxValue = tickPositions && tickPositions.length > 0 ? tickPositions[tickPositions.length - 1] : void 0;
763
- return typeof maxValue === "number" && maxValue > 9999 ? 1e3 : true;
764
- }
765
- function defaultValueAxisLabelFormatter() {
766
- const numberValue = Number(this.value);
767
- if (numberValue === 0) {
768
- return _seedsreactnumeral.formatNumeral.call(void 0, { locale: FIXED_LOCALE, number: 0 });
769
- }
770
- const abbreviate = deriveAbbreviateFromTicks(this);
771
- return _seedsreactnumeral.formatNumeral.call(void 0, {
772
- abbreviate,
773
- format: "decimal",
774
- locale: FIXED_LOCALE,
775
- number: numberValue
776
- });
777
- }
778
- function makeValueAxisLabelFormatter(format) {
779
- return function() {
780
- const numberValue = Number(this.value);
781
- const abbreviate = format.abbreviate === false ? false : deriveAbbreviateFromTicks(this);
782
- return valueFormatter({ ...format, value: numberValue, abbreviate });
783
- };
784
- }
785
-
786
-
787
-
788
-
789
-
790
643
 
791
644
 
792
645
 
793
646
 
794
647
 
795
- exports.useSeedsChartSetup = useSeedsChartSetup; exports.ChartRenderer = ChartRenderer; exports.buildAnnotationConfig = buildAnnotationConfig; exports.buildBaseChartOptions = buildBaseChartOptions; exports.buildDimensionalAxis = buildDimensionalAxis; exports.resolveTooltipTimezone = resolveTooltipTimezone; exports.defaultValueAxisLabelFormatter = defaultValueAxisLabelFormatter; exports.makeValueAxisLabelFormatter = makeValueAxisLabelFormatter;
796
- //# sourceMappingURL=chunk-EJYDQYLE.js.map
648
+ exports.valueFormatter = valueFormatter; exports.useSeedsChartSetup = useSeedsChartSetup; exports.ChartRenderer = ChartRenderer; exports.buildBaseChartOptions = buildBaseChartOptions;
649
+ //# sourceMappingURL=chunk-HDEKK4W4.js.map