@sproutsocial/seeds-react-data-viz 0.24.3 → 0.25.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bar/index.js +12 -13
- package/dist/bar/index.js.map +1 -1
- package/dist/bubble/index.d.mts +1 -1
- package/dist/bubble/index.d.ts +1 -1
- package/dist/bubble/index.js +9 -10
- package/dist/bubble/index.js.map +1 -1
- package/dist/{chartOptions-DHzoGRdG.d.mts → chartOptions-D6MzNjbB.d.mts} +3 -1
- package/dist/{chartOptions-DHzoGRdG.d.ts → chartOptions-D6MzNjbB.d.ts} +3 -1
- package/dist/charts.css +80 -0
- package/dist/{chunk-LKUL4EFZ.js → chunk-2A3KLUIF.js} +3 -3
- package/dist/{chunk-LKUL4EFZ.js.map → chunk-2A3KLUIF.js.map} +1 -1
- package/dist/{chunk-GHZHRFE6.js → chunk-CWKFNAXF.js} +3 -3
- package/dist/{chunk-GHZHRFE6.js.map → chunk-CWKFNAXF.js.map} +1 -1
- package/dist/{chunk-W57R2V23.js → chunk-LWDHU4QK.js} +183 -7
- package/dist/chunk-LWDHU4QK.js.map +1 -0
- package/dist/{chunk-5JQXDK23.js → chunk-TNZNBMSZ.js} +292 -73
- package/dist/chunk-TNZNBMSZ.js.map +1 -0
- package/dist/donut/index.js +6 -7
- package/dist/donut/index.js.map +1 -1
- package/dist/esm/bar/index.js +6 -7
- package/dist/esm/bar/index.js.map +1 -1
- package/dist/esm/bubble/index.js +6 -7
- package/dist/esm/bubble/index.js.map +1 -1
- package/dist/esm/{chunk-AUU3KROF.js → chunk-AJGRGRI6.js} +2 -2
- package/dist/esm/{chunk-DF5PVRXT.js → chunk-CIG5NERD.js} +2 -2
- package/dist/esm/{chunk-EWAD675C.js → chunk-V63L6753.js} +257 -38
- package/dist/esm/chunk-V63L6753.js.map +1 -0
- package/dist/esm/{chunk-32QLJDP2.js → chunk-VCTZWYEM.js} +177 -1
- package/dist/esm/chunk-VCTZWYEM.js.map +1 -0
- package/dist/esm/donut/index.js +4 -5
- package/dist/esm/donut/index.js.map +1 -1
- package/dist/esm/index.js +15 -15
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/line-area/index.js +6 -7
- package/dist/esm/line-area/index.js.map +1 -1
- package/dist/esm/sparkline/index.js +3 -3
- package/dist/esm/wordcloud/index.js +82 -0
- package/dist/esm/wordcloud/index.js.map +1 -0
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +54 -54
- package/dist/index.js.map +1 -1
- package/dist/line-area/index.js +12 -13
- package/dist/line-area/index.js.map +1 -1
- package/dist/sparkline/index.js +7 -7
- package/dist/wordcloud/index.d.mts +62 -0
- package/dist/wordcloud/index.d.ts +62 -0
- package/dist/wordcloud/index.js +82 -0
- package/dist/wordcloud/index.js.map +1 -0
- package/dist/wordcloud.css +79 -0
- package/package.json +19 -12
- package/dist/chunk-33Y5FZTT.js +0 -177
- package/dist/chunk-33Y5FZTT.js.map +0 -1
- package/dist/chunk-5JQXDK23.js.map +0 -1
- package/dist/chunk-W57R2V23.js.map +0 -1
- package/dist/esm/chunk-32QLJDP2.js.map +0 -1
- package/dist/esm/chunk-EWAD675C.js.map +0 -1
- package/dist/esm/chunk-XRZJACCB.js +0 -177
- package/dist/esm/chunk-XRZJACCB.js.map +0 -1
- /package/dist/esm/{chunk-AUU3KROF.js.map → chunk-AJGRGRI6.js.map} +0 -0
- /package/dist/esm/{chunk-DF5PVRXT.js.map → chunk-CIG5NERD.js.map} +0 -0
package/dist/line-area/index.js
CHANGED
|
@@ -2,23 +2,22 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var _chunkCWKFNAXFjs = require('../chunk-CWKFNAXF.js');
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var _chunk2A3KLUIFjs = require('../chunk-2A3KLUIF.js');
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
var _chunk6EIJCJCNjs = require('../chunk-6EIJCJCN.js');
|
|
13
13
|
|
|
14
14
|
|
|
15
|
-
var _chunk33Y5FZTTjs = require('../chunk-33Y5FZTT.js');
|
|
16
15
|
|
|
17
16
|
|
|
17
|
+
var _chunkTNZNBMSZjs = require('../chunk-TNZNBMSZ.js');
|
|
18
18
|
|
|
19
19
|
|
|
20
|
-
var
|
|
21
|
-
require('../chunk-W57R2V23.js');
|
|
20
|
+
var _chunkLWDHU4QKjs = require('../chunk-LWDHU4QK.js');
|
|
22
21
|
|
|
23
22
|
// src/charts/line-area/LineAreaChart.tsx
|
|
24
23
|
var _react = require('react');
|
|
@@ -45,12 +44,12 @@ function withIsolatedPointMarkers(data) {
|
|
|
45
44
|
});
|
|
46
45
|
}
|
|
47
46
|
function buildLineAreaChartOptions(props) {
|
|
48
|
-
const tooltipOptions =
|
|
47
|
+
const tooltipOptions = _chunk2A3KLUIFjs.resolveTooltipOptions.call(void 0, props);
|
|
49
48
|
const isStacked = AREA_VARIANTS.has(props.variant) && Boolean(props.stacking);
|
|
50
|
-
const { annotations, lookup: annotationLookup } =
|
|
49
|
+
const { annotations, lookup: annotationLookup } = _chunkCWKFNAXFjs.buildAnnotationConfig.call(void 0,
|
|
51
50
|
props.annotations
|
|
52
51
|
);
|
|
53
|
-
const base =
|
|
52
|
+
const base = _chunkTNZNBMSZjs.buildBaseChartOptions.call(void 0, {
|
|
54
53
|
type: props.variant,
|
|
55
54
|
description: props.description,
|
|
56
55
|
reserveTopMargin: Boolean(annotations),
|
|
@@ -65,13 +64,13 @@ function buildLineAreaChartOptions(props) {
|
|
|
65
64
|
// Re-assert the definite `type` so spreading the optionally-typed
|
|
66
65
|
// `base.chart` doesn't widen the required `type` field to optional.
|
|
67
66
|
type: props.variant,
|
|
68
|
-
height: _nullishCoalesce(props.height, () => (
|
|
67
|
+
height: _nullishCoalesce(props.height, () => ( _chunkLWDHU4QKjs.TIME_SERIES_CHART_HEIGHT)),
|
|
69
68
|
// Tight time-series spacing (from constants/chartOptions.ts) so the plot
|
|
70
69
|
// area fills the 275px container; without it Highcharts' larger default
|
|
71
70
|
// spacing ([10, 10, 15, 10]) shrinks the plot area.
|
|
72
71
|
spacing: [5, 1, 0, 2]
|
|
73
72
|
},
|
|
74
|
-
xAxis:
|
|
73
|
+
xAxis: _chunk2A3KLUIFjs.buildDimensionalAxis.call(void 0, props.xAxis, _nullishCoalesce(tooltipOptions.timezone, () => ( "UTC"))),
|
|
75
74
|
yAxis: {
|
|
76
75
|
min: _optionalChain([props, 'access', _ => _.yAxis, 'optionalAccess', _2 => _2.min]),
|
|
77
76
|
max: _optionalChain([props, 'access', _3 => _3.yAxis, 'optionalAccess', _4 => _4.max]),
|
|
@@ -89,7 +88,7 @@ function buildLineAreaChartOptions(props) {
|
|
|
89
88
|
labels: {
|
|
90
89
|
// A declarative `format` drives ticks through the shared valueFormatter;
|
|
91
90
|
// 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]) ?
|
|
91
|
+
formatter: _optionalChain([props, 'access', _9 => _9.yAxis, 'optionalAccess', _10 => _10.format]) ? _chunkCWKFNAXFjs.makeValueAxisLabelFormatter.call(void 0, props.yAxis.format) : _chunkCWKFNAXFjs.defaultValueAxisLabelFormatter
|
|
93
92
|
}
|
|
94
93
|
},
|
|
95
94
|
plotOptions: {
|
|
@@ -132,7 +131,7 @@ function buildLineAreaChartOptions(props) {
|
|
|
132
131
|
var _jsxruntime = require('react/jsx-runtime');
|
|
133
132
|
var AREA_VARIANTS2 = /* @__PURE__ */ new Set(["area", "areaspline"]);
|
|
134
133
|
var LineAreaChart = _react.memo.call(void 0, function LineAreaChart2(props) {
|
|
135
|
-
const { colors, patterns } =
|
|
134
|
+
const { colors, patterns } = _chunkTNZNBMSZjs.useSeedsChartSetup.call(void 0, {
|
|
136
135
|
series: props.series,
|
|
137
136
|
includePatterns: true
|
|
138
137
|
});
|
|
@@ -160,7 +159,7 @@ var LineAreaChart = _react.memo.call(void 0, function LineAreaChart2(props) {
|
|
|
160
159
|
className: props.className
|
|
161
160
|
}),
|
|
162
161
|
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
163
|
-
|
|
162
|
+
_chunkTNZNBMSZjs.ChartRenderer,
|
|
164
163
|
{
|
|
165
164
|
options,
|
|
166
165
|
series: props.series,
|
|
@@ -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;AEHA,IAAM,cAAA,kBAAgB,IAAI,GAAA,CAAqB,CAAC,MAAA,EAAQ,YAAY,CAAC,CAAA;AAQrE,SAAS,MAAA,CAAO,KAAA,EAAsC;AACpD,EAAA,GAAA,CAAI,MAAA,IAAU,IAAA,EAAM,OAAO,IAAA;AAC3B,EAAA,GAAA,CAAI,OAAO,MAAA,IAAU,QAAA,EAAU,OAAO,KAAA;AACtC,EAAA,GAAA,CAAI,KAAA,CAAM,OAAA,CAAQ,KAAK,CAAA,EAAG,OAAO,KAAA,CAAM,CAAC,CAAA;AACxC,EAAA,OAAO,KAAA,CAAM,CAAA;AACf;AAOA,SAAS,wBAAA,CACP,IAAA,EACe;AACf,EAAA,OAAO,IAAA,CAAK,GAAA,CAAI,CAAC,KAAA,EAAO,CAAA,EAAA,GAAmB;AACzC,IAAA,GAAA,CAAI,MAAA,IAAU,IAAA,EAAM,OAAO,IAAA;AAC3B,IA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AAA;AAAA,QAKA,MAAA,EAAQ,KAAA,CAAM,MAAA,CAAO,GAAA,CAAI,CAAC,CAAA,EAAA,GAAM,CAAA,CAAE,KAAK,CAAA;AAAA,QACvC,QAAA;AAAA,QACA,UAAA;AAAA,QACA,SAAA,EAAW,KAAA,CAAM;AAAA,MACnB,CAAC,CAAA;AAAA,MAED,QAAA,kBAAA,6BAAA;AAAA,QAAC,8BAAA;AAAA,QAAA;AAAA,UACC,OAAA;AAAA,UACA,MAAA,EAAQ,KAAA,CAAM,MAAA;AAAA,UACd,MAAA;AAAA,UACA,OAAA,EAAS,KAAA,CAAM,OAAA;AAAA,UACf,gBAAA;AAAA,UACA,UAAA;AAAA,UACA,iBAAA,EAAmB,KAAA,CAAM,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
|
+
{"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;AACA;AACA;AACF,uDAA6B;AAC7B;AACE;AACF,uDAA6B;AAC7B;AACA;ACrBA,8BAA8B;ADuB9B;AACA;AEFA,IAAM,cAAA,kBAAgB,IAAI,GAAA,CAAqB,CAAC,MAAA,EAAQ,YAAY,CAAC,CAAA;AAQrE,SAAS,MAAA,CAAO,KAAA,EAAsC;AACpD,EAAA,GAAA,CAAI,MAAA,IAAU,IAAA,EAAM,OAAO,IAAA;AAC3B,EAAA,GAAA,CAAI,OAAO,MAAA,IAAU,QAAA,EAAU,OAAO,KAAA;AACtC,EAAA,GAAA,CAAI,KAAA,CAAM,OAAA,CAAQ,KAAK,CAAA,EAAG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,EAASD,cAAAA,CAAc,GAAA,CAAI,KAAA,CAAM,OAAO,CAAA;AAE9C,EAAA,uBACE,6BAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACE,GAAG,qDAAA;AAAuB,QACzB,aAAA,EAAe;AAAA,UACb,yBAAA;AAAA,UACA,OAAA,EAAS,mBAAA,EAAqB;AAAA,QAChC,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA,QAKA,MAAA,EAAQ,KAAA,CAAM,MAAA,CAAO,GAAA,CAAI,CAAC,CAAA,EAAA,GAAM,CAAA,CAAE,KAAK,CAAA;AAAA,QACvC,QAAA;AAAA,QACA,UAAA;AAAA,QACA,SAAA,EAAW,KAAA,CAAM;AAAA,MACnB,CAAC,CAAA;AAAA,MAED,QAAA,kBAAA,6BAAA;AAAA,QAAC,8BAAA;AAAA,QAAA;AAAA,UACC,OAAA;AAAA,UACA,MAAA,EAAQ,KAAA,CAAM,MAAA;AAAA,UACd,MAAA;AAAA,UACA,OAAA,EAAS,KAAA,CAAM,OAAA;AAAA,UACf,gBAAA;AAAA,UACA,UAAA;AAAA,UACA,iBAAA,EAAmB,KAAA,CAAM,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;AD8GD;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"]}
|
package/dist/sparkline/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
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
|
|
4
|
+
var _chunk2A3KLUIFjs = require('../chunk-2A3KLUIF.js');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var
|
|
9
|
-
require('../chunk-
|
|
8
|
+
var _chunkTNZNBMSZjs = require('../chunk-TNZNBMSZ.js');
|
|
9
|
+
require('../chunk-LWDHU4QK.js');
|
|
10
10
|
|
|
11
11
|
// src/charts/sparkline/SparklineChart.tsx
|
|
12
12
|
var _react = require('react');
|
|
@@ -19,12 +19,12 @@ function highchartsType(variant) {
|
|
|
19
19
|
var SPARKLINE_SERIES_NAME = "sparkline";
|
|
20
20
|
function buildSparklineChartOptions(props) {
|
|
21
21
|
const type = highchartsType(props.variant);
|
|
22
|
-
const tooltipOptions =
|
|
22
|
+
const tooltipOptions = _chunk2A3KLUIFjs.resolveTooltipOptions.call(void 0, props);
|
|
23
23
|
const xAxis = props.xAxis ? {
|
|
24
|
-
...
|
|
24
|
+
..._chunk2A3KLUIFjs.buildDimensionalAxis.call(void 0, props.xAxis, _nullishCoalesce(tooltipOptions.timezone, () => ( "UTC"))),
|
|
25
25
|
visible: false
|
|
26
26
|
} : { type: "linear", visible: false };
|
|
27
|
-
const base =
|
|
27
|
+
const base = _chunkTNZNBMSZjs.buildBaseChartOptions.call(void 0, {
|
|
28
28
|
type,
|
|
29
29
|
description: props.description,
|
|
30
30
|
timezone: tooltipOptions.timezone
|
|
@@ -101,7 +101,7 @@ 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
|
-
|
|
104
|
+
_chunkTNZNBMSZjs.ChartRenderer,
|
|
105
105
|
{
|
|
106
106
|
options,
|
|
107
107
|
series: [{ name: SPARKLINE_SERIES_NAME, color: trendColor }],
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { C as ChartExportHandle } from '../chartExport-CKYpuhik.mjs';
|
|
3
|
+
|
|
4
|
+
/** A single word in the cloud. `weight` drives both font size and (absent `groups`) opacity. */
|
|
5
|
+
interface WordCloudDataPoint {
|
|
6
|
+
/** The word as rendered. */
|
|
7
|
+
name: string;
|
|
8
|
+
/** Relative size driver; larger renders bigger. */
|
|
9
|
+
weight: number;
|
|
10
|
+
/** Links this word to a WordCloudGroup for coloring and dimming. */
|
|
11
|
+
groupId?: string;
|
|
12
|
+
}
|
|
13
|
+
/** A competitive/category grouping. Presence of `groups` switches the cloud into competitive mode. */
|
|
14
|
+
interface WordCloudGroup {
|
|
15
|
+
id: string;
|
|
16
|
+
name: string;
|
|
17
|
+
/** Overrides this group's palette slot. Tenant-specific competitor colors go here. */
|
|
18
|
+
color?: string;
|
|
19
|
+
}
|
|
20
|
+
interface WordCloudClickData {
|
|
21
|
+
name: string;
|
|
22
|
+
weight: number;
|
|
23
|
+
groupId?: string;
|
|
24
|
+
pointIndex: number;
|
|
25
|
+
pageX: number;
|
|
26
|
+
pageY: number;
|
|
27
|
+
}
|
|
28
|
+
interface WordCloudProps {
|
|
29
|
+
data: Array<WordCloudDataPoint>;
|
|
30
|
+
/** Competitive mode. Omit for a single-color cloud. */
|
|
31
|
+
groups?: Array<WordCloudGroup>;
|
|
32
|
+
/** Dims every word outside this group. Null or undefined means no dimming. */
|
|
33
|
+
activeGroupId?: string | null;
|
|
34
|
+
minFontSize?: number;
|
|
35
|
+
maxFontSize?: number;
|
|
36
|
+
/** [min, max] weight-driven opacity ramp. Defaults to [0.6, 1]; pass [1, 1] to disable. */
|
|
37
|
+
opacityRange?: [number, number];
|
|
38
|
+
/** Approximate spacing between words, in pixels. Defaults to a value derived from container width (1-4px, narrower containers get less). Larger values shrink the rendered font size. */
|
|
39
|
+
wordPadding?: number;
|
|
40
|
+
/** Skips internal container measurement — pass the container's known pixel width directly. Useful in tests (no `ResizeObserver` mocking needed) and anywhere the width is already known. */
|
|
41
|
+
width?: number;
|
|
42
|
+
height?: number;
|
|
43
|
+
/** Accessibility description (Highcharts `accessibility.description`) — required, matching every sibling v2 family. */
|
|
44
|
+
description: string;
|
|
45
|
+
className?: string;
|
|
46
|
+
onClick?: (data: WordCloudClickData) => void;
|
|
47
|
+
onReady?: (handle: ChartExportHandle) => void;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* WordCloud renders a Highcharts wordcloud chart from a flat list of weighted
|
|
52
|
+
* words, optionally grouped (competitive coloring + externally-driven dimming
|
|
53
|
+
* via `activeGroupId`).
|
|
54
|
+
*
|
|
55
|
+
* Like BubbleChart/DonutChart, it carries no `styled-components`: the wrapper
|
|
56
|
+
* is a plain `<div>` and the Highcharts styling ships as static CSS. Consumers
|
|
57
|
+
* import both `@sproutsocial/seeds-react-data-viz/chart-styles.css` and
|
|
58
|
+
* `.../wordcloud.css` once (the component never self-imports its CSS).
|
|
59
|
+
*/
|
|
60
|
+
declare const WordCloud: react.NamedExoticComponent<WordCloudProps>;
|
|
61
|
+
|
|
62
|
+
export { ChartExportHandle, WordCloud, type WordCloudClickData, type WordCloudDataPoint, type WordCloudGroup, type WordCloudProps };
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { C as ChartExportHandle } from '../chartExport-CKYpuhik.js';
|
|
3
|
+
|
|
4
|
+
/** A single word in the cloud. `weight` drives both font size and (absent `groups`) opacity. */
|
|
5
|
+
interface WordCloudDataPoint {
|
|
6
|
+
/** The word as rendered. */
|
|
7
|
+
name: string;
|
|
8
|
+
/** Relative size driver; larger renders bigger. */
|
|
9
|
+
weight: number;
|
|
10
|
+
/** Links this word to a WordCloudGroup for coloring and dimming. */
|
|
11
|
+
groupId?: string;
|
|
12
|
+
}
|
|
13
|
+
/** A competitive/category grouping. Presence of `groups` switches the cloud into competitive mode. */
|
|
14
|
+
interface WordCloudGroup {
|
|
15
|
+
id: string;
|
|
16
|
+
name: string;
|
|
17
|
+
/** Overrides this group's palette slot. Tenant-specific competitor colors go here. */
|
|
18
|
+
color?: string;
|
|
19
|
+
}
|
|
20
|
+
interface WordCloudClickData {
|
|
21
|
+
name: string;
|
|
22
|
+
weight: number;
|
|
23
|
+
groupId?: string;
|
|
24
|
+
pointIndex: number;
|
|
25
|
+
pageX: number;
|
|
26
|
+
pageY: number;
|
|
27
|
+
}
|
|
28
|
+
interface WordCloudProps {
|
|
29
|
+
data: Array<WordCloudDataPoint>;
|
|
30
|
+
/** Competitive mode. Omit for a single-color cloud. */
|
|
31
|
+
groups?: Array<WordCloudGroup>;
|
|
32
|
+
/** Dims every word outside this group. Null or undefined means no dimming. */
|
|
33
|
+
activeGroupId?: string | null;
|
|
34
|
+
minFontSize?: number;
|
|
35
|
+
maxFontSize?: number;
|
|
36
|
+
/** [min, max] weight-driven opacity ramp. Defaults to [0.6, 1]; pass [1, 1] to disable. */
|
|
37
|
+
opacityRange?: [number, number];
|
|
38
|
+
/** Approximate spacing between words, in pixels. Defaults to a value derived from container width (1-4px, narrower containers get less). Larger values shrink the rendered font size. */
|
|
39
|
+
wordPadding?: number;
|
|
40
|
+
/** Skips internal container measurement — pass the container's known pixel width directly. Useful in tests (no `ResizeObserver` mocking needed) and anywhere the width is already known. */
|
|
41
|
+
width?: number;
|
|
42
|
+
height?: number;
|
|
43
|
+
/** Accessibility description (Highcharts `accessibility.description`) — required, matching every sibling v2 family. */
|
|
44
|
+
description: string;
|
|
45
|
+
className?: string;
|
|
46
|
+
onClick?: (data: WordCloudClickData) => void;
|
|
47
|
+
onReady?: (handle: ChartExportHandle) => void;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* WordCloud renders a Highcharts wordcloud chart from a flat list of weighted
|
|
52
|
+
* words, optionally grouped (competitive coloring + externally-driven dimming
|
|
53
|
+
* via `activeGroupId`).
|
|
54
|
+
*
|
|
55
|
+
* Like BubbleChart/DonutChart, it carries no `styled-components`: the wrapper
|
|
56
|
+
* is a plain `<div>` and the Highcharts styling ships as static CSS. Consumers
|
|
57
|
+
* import both `@sproutsocial/seeds-react-data-viz/chart-styles.css` and
|
|
58
|
+
* `.../wordcloud.css` once (the component never self-imports its CSS).
|
|
59
|
+
*/
|
|
60
|
+
declare const WordCloud: react.NamedExoticComponent<WordCloudProps>;
|
|
61
|
+
|
|
62
|
+
export { ChartExportHandle, WordCloud, type WordCloudClickData, type WordCloudDataPoint, type WordCloudGroup, type WordCloudProps };
|
|
@@ -0,0 +1,82 @@
|
|
|
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; }
|
|
2
|
+
|
|
3
|
+
var _chunk6EIJCJCNjs = require('../chunk-6EIJCJCN.js');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
var _chunkTNZNBMSZjs = require('../chunk-TNZNBMSZ.js');
|
|
12
|
+
require('../chunk-LWDHU4QK.js');
|
|
13
|
+
|
|
14
|
+
// src/charts/wordcloud/WordCloud.tsx
|
|
15
|
+
var _react = require('react');
|
|
16
|
+
var _seedsreacthooks = require('@sproutsocial/seeds-react-hooks');
|
|
17
|
+
var _jsxruntime = require('react/jsx-runtime');
|
|
18
|
+
function resolveActiveGroupIndex(activeGroupId, groups) {
|
|
19
|
+
if (activeGroupId == null || !_optionalChain([groups, 'optionalAccess', _ => _.length])) return void 0;
|
|
20
|
+
const index = groups.findIndex((group) => group.id === activeGroupId);
|
|
21
|
+
return index === -1 ? void 0 : index;
|
|
22
|
+
}
|
|
23
|
+
var WordCloud = _react.memo.call(void 0, function WordCloud2(props) {
|
|
24
|
+
const { colors } = _chunkTNZNBMSZjs.useSeedsChartSetup.call(void 0, {
|
|
25
|
+
series: _optionalChain([props, 'access', _2 => _2.groups, 'optionalAccess', _3 => _3.length]) ? props.groups.map((group) => ({ color: group.color })) : [{ color: void 0 }]
|
|
26
|
+
});
|
|
27
|
+
const containerRef = _react.useRef.call(void 0, null);
|
|
28
|
+
const { width: measuredWidth } = _seedsreacthooks.useMeasure.call(void 0, containerRef, true);
|
|
29
|
+
const width = _nullishCoalesce(props.width, () => ( measuredWidth));
|
|
30
|
+
const derivedMaxFontSize = _chunkTNZNBMSZjs.deriveMaxFontSize.call(void 0, width);
|
|
31
|
+
const derivedMaxWordCount = _chunkTNZNBMSZjs.deriveMaxWordCount.call(void 0, width);
|
|
32
|
+
const derivedWordPadding = _chunkTNZNBMSZjs.deriveWordPadding.call(void 0, width);
|
|
33
|
+
const options = _react.useMemo.call(void 0,
|
|
34
|
+
() => _chunkTNZNBMSZjs.buildWordCloudOptions.call(void 0, props, width),
|
|
35
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps -- `width` is intentionally excluded; see the comment above `derivedMaxFontSize`.
|
|
36
|
+
[props, derivedMaxFontSize, derivedMaxWordCount, derivedWordPadding]
|
|
37
|
+
);
|
|
38
|
+
const activeGroupIndex = resolveActiveGroupIndex(
|
|
39
|
+
props.activeGroupId,
|
|
40
|
+
props.groups
|
|
41
|
+
);
|
|
42
|
+
const containerProps = _chunk6EIJCJCNjs.getChartContainerProps.call(void 0, {
|
|
43
|
+
familyClasses: ["seeds-chart-wordcloud"],
|
|
44
|
+
// RAW per-group colors only — an unset group falls through to
|
|
45
|
+
// chart-styles.css's --highcharts-color-N default, matching the
|
|
46
|
+
// bubble/bar convention. Only an explicit consumer override is inlined.
|
|
47
|
+
colors: _nullishCoalesce(_optionalChain([props, 'access', _4 => _4.groups, 'optionalAccess', _5 => _5.map, 'call', _6 => _6((group) => group.color)]), () => ( [])),
|
|
48
|
+
hasOnClick: Boolean(props.onClick),
|
|
49
|
+
className: props.className
|
|
50
|
+
});
|
|
51
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
52
|
+
"div",
|
|
53
|
+
{
|
|
54
|
+
ref: containerRef,
|
|
55
|
+
...containerProps,
|
|
56
|
+
...activeGroupIndex !== void 0 ? { "data-active-group-index": activeGroupIndex } : {},
|
|
57
|
+
// Gate the chart's one-and-only real mount on a genuinely measured
|
|
58
|
+
// width. This container `<div>` still always renders (measuring it
|
|
59
|
+
// is what produces `measuredWidth` in the first place) — but a
|
|
60
|
+
// `width` of 0 means "no room to lay out yet," not "assume the
|
|
61
|
+
// widest case," so nothing else renders until it's positive. This
|
|
62
|
+
// is also what makes Highcharts' native center-burst entrance
|
|
63
|
+
// animation (plotOptions.wordcloud.animation, above) fire on first
|
|
64
|
+
// paint: `chart.hasRendered` never gets set by a wrong-then-corrected
|
|
65
|
+
// double render.
|
|
66
|
+
children: width > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
67
|
+
_chunkTNZNBMSZjs.ChartRenderer,
|
|
68
|
+
{
|
|
69
|
+
options,
|
|
70
|
+
series: _optionalChain([options, 'access', _7 => _7.series, 'optionalAccess', _8 => _8.length]) ? [{ name: "Word Cloud" }] : [],
|
|
71
|
+
colors,
|
|
72
|
+
hideLegend: true,
|
|
73
|
+
onReady: props.onReady
|
|
74
|
+
}
|
|
75
|
+
)
|
|
76
|
+
}
|
|
77
|
+
);
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
exports.WordCloud = WordCloud;
|
|
82
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/home/runner/_work/seeds/seeds/seeds-react/seeds-react-data-viz/dist/wordcloud/index.js","../../src/charts/wordcloud/WordCloud.tsx"],"names":["WordCloud"],"mappings":"AAAA;AACE;AACF,uDAA6B;AAC7B;AACE;AACA;AACA;AACA;AACA;AACA;AACF,uDAA6B;AAC7B,gCAA6B;AAC7B;AACA;ACbA,8BAAsC;AACtC,kEAA2B;AA0GjB,+CAAA;AAxFV,SAAS,uBAAA,CACP,aAAA,EACA,MAAA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Ref } from \"react\";\nimport { useMeasure } from \"@sproutsocial/seeds-react-hooks\";\nimport { useSeedsChartSetup, ChartRenderer } from \"../shared/chartBase\";\nimport { getChartContainerProps } from \"../shared/chartContainer\";\nimport {\n buildWordCloudOptions,\n deriveMaxFontSize,\n deriveMaxWordCount,\n deriveWordPadding,\n} from \"./adapter\";\nimport type { WordCloudGroup, WordCloudProps } from \"./types\";\n\n/**\n * Resolves `activeGroupId` to its index in `groups` for the container's\n * `data-active-group-index` attribute (layer 2 CSS dimming, wordcloud.css).\n * An unresolvable id (unknown, or no `groups`) is treated the same as\n * null/undefined — no dimming — rather than falling back to group 0, which\n * would incorrectly mark group 0 as \"active\" and dim everything else.\n */\nfunction resolveActiveGroupIndex(\n activeGroupId: string | null | undefined,\n groups: ReadonlyArray<WordCloudGroup> | undefined\n): number | undefined {\n if (activeGroupId == null || !groups?.length) return undefined;\n const index = groups.findIndex((group) => group.id === activeGroupId);\n return index === -1 ? undefined : index;\n}\n\n/**\n * WordCloud renders a Highcharts wordcloud chart from a flat list of weighted\n * words, optionally grouped (competitive coloring + externally-driven dimming\n * via `activeGroupId`).\n *\n * Like BubbleChart/DonutChart, it carries no `styled-components`: the wrapper\n * is a plain `<div>` and the Highcharts styling ships as static CSS. Consumers\n * import both `@sproutsocial/seeds-react-data-viz/chart-styles.css` and\n * `.../wordcloud.css` once (the component never self-imports its CSS).\n */\nexport const WordCloud = memo(function WordCloud(props: WordCloudProps) {\n // One \"series\" input per group (or a single default entry when ungrouped),\n // matching bubble/donut's convention: colorIndex slots map 1:1 to entries\n // here, so the resolved `colors` array sizes and resolves correctly for\n // both the live chart and the styledMode:false export clone.\n const { colors } = useSeedsChartSetup({\n series: props.groups?.length\n ? props.groups.map((group) => ({ color: group.color }))\n : [{ color: undefined }],\n });\n\n const containerRef = useRef<HTMLDivElement>(null);\n // `synchronous: true` reads the container's bounds before first paint\n // instead of waiting on ResizeObserver's own (always-async) first\n // callback — otherwise every derive* below sees a false `width: 0` on\n // mount and renders the widest-case guess before snapping to the real\n // layout a tick later (the flash this family shipped with through Slice\n // 8). An explicit `props.width` skips measurement entirely.\n const { width: measuredWidth } = useMeasure(containerRef, true);\n const width = props.width ?? measuredWidth;\n // These derived values, not raw `width`, drive the memo dependency below.\n // Each is a step function of width (`deriveMaxFontSize`/`deriveMaxWordCount`/\n // `deriveWordPadding` in adapter.ts), so a resize tick that lands in the\n // same bucket for all three — most of them, during a drag-resize — leaves\n // the dependency array unchanged and the options object keeps its identity\n // instead of forcing Highcharts to re-lay out the cloud on every\n // ResizeObserver callback.\n const derivedMaxFontSize = deriveMaxFontSize(width);\n const derivedMaxWordCount = deriveMaxWordCount(width);\n const derivedWordPadding = deriveWordPadding(width);\n const options = useMemo(\n () => buildWordCloudOptions(props, width),\n // eslint-disable-next-line react-hooks/exhaustive-deps -- `width` is intentionally excluded; see the comment above `derivedMaxFontSize`.\n [props, derivedMaxFontSize, derivedMaxWordCount, derivedWordPadding]\n );\n const activeGroupIndex = resolveActiveGroupIndex(\n props.activeGroupId,\n props.groups\n );\n\n const containerProps = getChartContainerProps({\n familyClasses: [\"seeds-chart-wordcloud\"],\n // RAW per-group colors only — an unset group falls through to\n // chart-styles.css's --highcharts-color-N default, matching the\n // bubble/bar convention. Only an explicit consumer override is inlined.\n colors: props.groups?.map((group) => group.color) ?? [],\n hasOnClick: Boolean(props.onClick),\n className: props.className,\n });\n\n return (\n <div\n ref={containerRef}\n {...containerProps}\n {...(activeGroupIndex !== undefined\n ? { \"data-active-group-index\": activeGroupIndex }\n : {})}\n >\n {\n // Gate the chart's one-and-only real mount on a genuinely measured\n // width. This container `<div>` still always renders (measuring it\n // is what produces `measuredWidth` in the first place) — but a\n // `width` of 0 means \"no room to lay out yet,\" not \"assume the\n // widest case,\" so nothing else renders until it's positive. This\n // is also what makes Highcharts' native center-burst entrance\n // animation (plotOptions.wordcloud.animation, above) fire on first\n // paint: `chart.hasRendered` never gets set by a wrong-then-corrected\n // double render.\n width > 0 && (\n <ChartRenderer\n options={options}\n // A single Highcharts series (all words), so a single entry here —\n // its only job is satisfying ChartRenderer's non-empty-series check,\n // since hideLegend suppresses the legend this would otherwise feed.\n series={options.series?.length ? [{ name: \"Word Cloud\" }] : []}\n colors={colors}\n hideLegend\n onReady={props.onReady}\n />\n )\n }\n </div>\n );\n});\n"]}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Seeds WordCloud family styles.
|
|
3
|
+
*
|
|
4
|
+
* The wordcloud-specific layer on top of the shared `chart-styles.css`
|
|
5
|
+
* foundation, implementing a three-layer opacity model:
|
|
6
|
+
*
|
|
7
|
+
* 1. Weight ramp — per-point `opacity` set once in the adapter's series
|
|
8
|
+
* data (wordcloud/adapter.ts), landing as an SVG
|
|
9
|
+
* presentation attribute (Highcharts' `WordcloudSeries`
|
|
10
|
+
* applies it with no styledMode guard).
|
|
11
|
+
* 2. Group dim — below. Gated on the wrapper's `data-active-group-index`
|
|
12
|
+
* attribute (set from `activeGroupId`, resolved against
|
|
13
|
+
* `groups`), scoped per adapter-assigned
|
|
14
|
+
* `.seeds-wordcloud-word--group-{n}` class.
|
|
15
|
+
* 3. Hover — below. Highcharts' native `.highcharts-point-hover`/
|
|
16
|
+
* `.highcharts-point-inactive`, inherited from
|
|
17
|
+
* ColumnSeries state handling.
|
|
18
|
+
*
|
|
19
|
+
* All three layers write the CSS `opacity` *property*, never `fill-opacity`:
|
|
20
|
+
* a presentation attribute (layer 1) resolves in the author origin at
|
|
21
|
+
* specificity 0, so any author `opacity` declaration here replaces it
|
|
22
|
+
* outright rather than multiplying with it. This matches `donut/donut.css`'s
|
|
23
|
+
* existing opacity-property dimming.
|
|
24
|
+
*
|
|
25
|
+
* Layers 2 and 3 can coexist (hovering a word while `activeGroupId` is set),
|
|
26
|
+
* and layer 3 must always win. The layer 2 rules below exclude
|
|
27
|
+
* `.highcharts-point-hover`/`.highcharts-point-inactive` from their selector
|
|
28
|
+
* for exactly this: the moment any point is hovered, every point in the
|
|
29
|
+
* series carries one of those two classes (`inactiveOtherPoints: true`), so
|
|
30
|
+
* layer 2 stops matching anything and layer 3 takes over completely, with no
|
|
31
|
+
* `!important` needed.
|
|
32
|
+
*
|
|
33
|
+
* Consumers import BOTH stylesheets once (the component never self-imports):
|
|
34
|
+
*
|
|
35
|
+
* import "@sproutsocial/seeds-react-data-viz/chart-styles.css";
|
|
36
|
+
* import "@sproutsocial/seeds-react-data-viz/wordcloud.css";
|
|
37
|
+
*/
|
|
38
|
+
|
|
39
|
+
/* Layer 3: hover. The hovered word lifts to full opacity; every other word
|
|
40
|
+
drops to a flat 0.6, discarding its own weight-ramp value for the
|
|
41
|
+
duration of the hover. */
|
|
42
|
+
.seeds-chart-wordcloud .highcharts-point-hover {
|
|
43
|
+
opacity: 1;
|
|
44
|
+
transition: opacity 0s;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.seeds-chart-wordcloud .highcharts-point-inactive {
|
|
48
|
+
opacity: 0.6;
|
|
49
|
+
transition: opacity 0s;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/* Layer 2: group dim. Only active when the wrapper sets
|
|
53
|
+
`data-active-group-index` (a resolved `activeGroupId`); bounded by the DS
|
|
54
|
+
data-viz palette length (20 slots — chart-styles.css's --highcharts-color-0
|
|
55
|
+
through -19). Excludes hover-state classes so layer 3 always wins during a
|
|
56
|
+
hover (see the file header). One shared declaration: every group index
|
|
57
|
+
dims to the same 0.4, only the selector differs. */
|
|
58
|
+
.seeds-chart-wordcloud[data-active-group-index]:not([data-active-group-index="0"]) .seeds-wordcloud-word--group-0:not(.highcharts-point-hover):not(.highcharts-point-inactive),
|
|
59
|
+
.seeds-chart-wordcloud[data-active-group-index]:not([data-active-group-index="1"]) .seeds-wordcloud-word--group-1:not(.highcharts-point-hover):not(.highcharts-point-inactive),
|
|
60
|
+
.seeds-chart-wordcloud[data-active-group-index]:not([data-active-group-index="2"]) .seeds-wordcloud-word--group-2:not(.highcharts-point-hover):not(.highcharts-point-inactive),
|
|
61
|
+
.seeds-chart-wordcloud[data-active-group-index]:not([data-active-group-index="3"]) .seeds-wordcloud-word--group-3:not(.highcharts-point-hover):not(.highcharts-point-inactive),
|
|
62
|
+
.seeds-chart-wordcloud[data-active-group-index]:not([data-active-group-index="4"]) .seeds-wordcloud-word--group-4:not(.highcharts-point-hover):not(.highcharts-point-inactive),
|
|
63
|
+
.seeds-chart-wordcloud[data-active-group-index]:not([data-active-group-index="5"]) .seeds-wordcloud-word--group-5:not(.highcharts-point-hover):not(.highcharts-point-inactive),
|
|
64
|
+
.seeds-chart-wordcloud[data-active-group-index]:not([data-active-group-index="6"]) .seeds-wordcloud-word--group-6:not(.highcharts-point-hover):not(.highcharts-point-inactive),
|
|
65
|
+
.seeds-chart-wordcloud[data-active-group-index]:not([data-active-group-index="7"]) .seeds-wordcloud-word--group-7:not(.highcharts-point-hover):not(.highcharts-point-inactive),
|
|
66
|
+
.seeds-chart-wordcloud[data-active-group-index]:not([data-active-group-index="8"]) .seeds-wordcloud-word--group-8:not(.highcharts-point-hover):not(.highcharts-point-inactive),
|
|
67
|
+
.seeds-chart-wordcloud[data-active-group-index]:not([data-active-group-index="9"]) .seeds-wordcloud-word--group-9:not(.highcharts-point-hover):not(.highcharts-point-inactive),
|
|
68
|
+
.seeds-chart-wordcloud[data-active-group-index]:not([data-active-group-index="10"]) .seeds-wordcloud-word--group-10:not(.highcharts-point-hover):not(.highcharts-point-inactive),
|
|
69
|
+
.seeds-chart-wordcloud[data-active-group-index]:not([data-active-group-index="11"]) .seeds-wordcloud-word--group-11:not(.highcharts-point-hover):not(.highcharts-point-inactive),
|
|
70
|
+
.seeds-chart-wordcloud[data-active-group-index]:not([data-active-group-index="12"]) .seeds-wordcloud-word--group-12:not(.highcharts-point-hover):not(.highcharts-point-inactive),
|
|
71
|
+
.seeds-chart-wordcloud[data-active-group-index]:not([data-active-group-index="13"]) .seeds-wordcloud-word--group-13:not(.highcharts-point-hover):not(.highcharts-point-inactive),
|
|
72
|
+
.seeds-chart-wordcloud[data-active-group-index]:not([data-active-group-index="14"]) .seeds-wordcloud-word--group-14:not(.highcharts-point-hover):not(.highcharts-point-inactive),
|
|
73
|
+
.seeds-chart-wordcloud[data-active-group-index]:not([data-active-group-index="15"]) .seeds-wordcloud-word--group-15:not(.highcharts-point-hover):not(.highcharts-point-inactive),
|
|
74
|
+
.seeds-chart-wordcloud[data-active-group-index]:not([data-active-group-index="16"]) .seeds-wordcloud-word--group-16:not(.highcharts-point-hover):not(.highcharts-point-inactive),
|
|
75
|
+
.seeds-chart-wordcloud[data-active-group-index]:not([data-active-group-index="17"]) .seeds-wordcloud-word--group-17:not(.highcharts-point-hover):not(.highcharts-point-inactive),
|
|
76
|
+
.seeds-chart-wordcloud[data-active-group-index]:not([data-active-group-index="18"]) .seeds-wordcloud-word--group-18:not(.highcharts-point-hover):not(.highcharts-point-inactive),
|
|
77
|
+
.seeds-chart-wordcloud[data-active-group-index]:not([data-active-group-index="19"]) .seeds-wordcloud-word--group-19:not(.highcharts-point-hover):not(.highcharts-point-inactive) {
|
|
78
|
+
opacity: 0.4;
|
|
79
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sproutsocial/seeds-react-data-viz",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.25.0",
|
|
4
4
|
"description": "Seeds React Data Viz Components",
|
|
5
5
|
"author": "Sprout Social, Inc.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -38,12 +38,18 @@
|
|
|
38
38
|
"import": "./dist/esm/bubble/index.js",
|
|
39
39
|
"require": "./dist/bubble/index.js"
|
|
40
40
|
},
|
|
41
|
+
"./wordcloud": {
|
|
42
|
+
"types": "./dist/wordcloud/index.d.ts",
|
|
43
|
+
"import": "./dist/esm/wordcloud/index.js",
|
|
44
|
+
"require": "./dist/wordcloud/index.js"
|
|
45
|
+
},
|
|
41
46
|
"./sparkline.css": "./dist/sparkline.css",
|
|
42
47
|
"./chart-styles.css": "./dist/chart-styles.css",
|
|
43
48
|
"./bar.css": "./dist/bar.css",
|
|
44
49
|
"./donut.css": "./dist/donut.css",
|
|
45
50
|
"./line-area.css": "./dist/line-area.css",
|
|
46
51
|
"./bubble.css": "./dist/bubble.css",
|
|
52
|
+
"./wordcloud.css": "./dist/wordcloud.css",
|
|
47
53
|
"./charts.css": "./dist/charts.css",
|
|
48
54
|
"./export": {
|
|
49
55
|
"types": "./dist/export/index.d.ts",
|
|
@@ -71,17 +77,18 @@
|
|
|
71
77
|
"dependencies": {
|
|
72
78
|
"@sproutsocial/seeds-dataviz": "^0.7.3",
|
|
73
79
|
"@sproutsocial/seeds-networkcolor": "^2.22.0",
|
|
74
|
-
"@sproutsocial/seeds-react-box": "^1.1.
|
|
75
|
-
"@sproutsocial/seeds-react-button": "^2.3.
|
|
76
|
-
"@sproutsocial/seeds-react-duration": "^1.0.
|
|
77
|
-
"@sproutsocial/seeds-react-
|
|
78
|
-
"@sproutsocial/seeds-react-
|
|
79
|
-
"@sproutsocial/seeds-react-
|
|
80
|
-
"@sproutsocial/seeds-react-
|
|
81
|
-
"@sproutsocial/seeds-react-
|
|
82
|
-
"@sproutsocial/seeds-react-
|
|
83
|
-
"@sproutsocial/seeds-react-
|
|
84
|
-
"@sproutsocial/seeds-react-
|
|
80
|
+
"@sproutsocial/seeds-react-box": "^1.1.30",
|
|
81
|
+
"@sproutsocial/seeds-react-button": "^2.3.7",
|
|
82
|
+
"@sproutsocial/seeds-react-duration": "^1.0.34",
|
|
83
|
+
"@sproutsocial/seeds-react-hooks": "^3.3.0",
|
|
84
|
+
"@sproutsocial/seeds-react-icon": "^2.5.0",
|
|
85
|
+
"@sproutsocial/seeds-react-menu": "^1.16.15",
|
|
86
|
+
"@sproutsocial/seeds-react-numeral": "^1.0.58",
|
|
87
|
+
"@sproutsocial/seeds-react-partner-logo": "^1.7.22",
|
|
88
|
+
"@sproutsocial/seeds-react-system-props": "^3.2.0",
|
|
89
|
+
"@sproutsocial/seeds-react-table": "^1.0.53",
|
|
90
|
+
"@sproutsocial/seeds-react-text": "^1.5.4",
|
|
91
|
+
"@sproutsocial/seeds-react-theme": "^4.4.0",
|
|
85
92
|
"highcharts": "^11.4.3",
|
|
86
93
|
"highcharts-react-official": "^3.2.1",
|
|
87
94
|
"jspdf": "^4.2.1",
|