@sproutsocial/seeds-react-data-viz 0.7.31 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bar/index.d.mts +208 -0
- package/dist/bar/index.d.ts +208 -0
- package/dist/bar/index.js +929 -0
- package/dist/bar/index.js.map +1 -0
- package/dist/chartExport-CKYpuhik.d.mts +28 -0
- package/dist/chartExport-CKYpuhik.d.ts +28 -0
- package/dist/chunk-VFBZ7FNK.js +1154 -0
- package/dist/chunk-VFBZ7FNK.js.map +1 -0
- package/dist/esm/bar/index.js +929 -0
- package/dist/esm/bar/index.js.map +1 -0
- package/dist/esm/chunk-CDBW4SOR.js +1154 -0
- package/dist/esm/chunk-CDBW4SOR.js.map +1 -0
- package/dist/esm/export/index.js +41 -0
- package/dist/esm/export/index.js.map +1 -0
- package/dist/esm/index.js +260 -1315
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/pdfExportLibs-NWLZH5KL.js +10 -0
- package/dist/esm/pdfExportLibs-NWLZH5KL.js.map +1 -0
- package/dist/export/index.d.mts +25 -0
- package/dist/export/index.d.ts +25 -0
- package/dist/export/index.js +41 -0
- package/dist/export/index.js.map +1 -0
- package/dist/index.d.mts +30 -93
- package/dist/index.d.ts +30 -93
- package/dist/index.js +405 -1544
- package/dist/index.js.map +1 -1
- package/dist/pdfExportLibs-BZR2D3RA.js +10 -0
- package/dist/pdfExportLibs-BZR2D3RA.js.map +1 -0
- package/dist/types-B7ILUQ6_.d.mts +99 -0
- package/dist/types-B7ILUQ6_.d.ts +99 -0
- package/package.json +32 -11
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/charts/shared/pdfExportLibs.ts"],"sourcesContent":["// Lazily-loaded PDF export dependencies. This module is imported via a dynamic\n// `import(\"./pdfExportLibs\")` from `chartBase` so jspdf + svg2pdf.js land in a\n// deferred chunk (tsup `splitting: true`) and are fetched only when a consumer\n// actually exports a PDF — they stay out of the main bundle.\n//\n// It is Highcharts-free (imports jspdf/svg2pdf, never \"highcharts\"), so it does\n// not touch the engine-boundary invariant.\nimport { jsPDF } from \"jspdf\";\n// Side-effect import: svg2pdf.js patches `jsPDF.API.svg`, the method Highcharts'\n// offline-exporting calls (`pdfDoc.svg(...)`) to render the chart SVG into the PDF.\nimport \"svg2pdf.js\";\n\ninterface JsPdfGlobal {\n jspdf?: { jsPDF: typeof jsPDF };\n}\n\n/**\n * Expose jsPDF on `window.jspdf` so Highcharts' offline-exporting resolves PDF\n * support locally instead of fetching jspdf/svg2pdf from its CDN\n * (`exporting.libURL`). Highcharts checks `window.jspdf.jsPDF` and constructs\n * `new window.jspdf.jsPDF(...)`. Idempotent — safe to call before every export.\n */\nexport function loadPdfExportLibs(): void {\n (window as unknown as JsPdfGlobal).jspdf = { jsPDF };\n}\n"],"mappings":";AAOA,SAAS,aAAa;AAGtB,OAAO;AAYA,SAAS,oBAA0B;AACxC,EAAC,OAAkC,QAAQ,EAAE,MAAM;AACrD;","names":[]}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { C as ChartExportHandle, a as ChartExportFormat } from '../chartExport-CKYpuhik.mjs';
|
|
3
|
+
|
|
4
|
+
interface ChartExportMenuProps {
|
|
5
|
+
/** The opaque export handle surfaced by a v2 chart's `onReady` callback. */
|
|
6
|
+
exportHandle: ChartExportHandle;
|
|
7
|
+
/**
|
|
8
|
+
* Visible labels per format. Only formats with a non-empty label render an
|
|
9
|
+
* item; an empty object (or all-falsy labels) renders nothing — no dead
|
|
10
|
+
* trigger. Items always render in canonical order, never in key-insertion
|
|
11
|
+
* order.
|
|
12
|
+
*/
|
|
13
|
+
labels: Partial<Record<ChartExportFormat, string>>;
|
|
14
|
+
/** Accessible name for the icon-only trigger button. */
|
|
15
|
+
triggerAriaLabel: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Icon-only overflow button that opens a dropdown of chart export actions
|
|
19
|
+
* (PNG/SVG/PDF/CSV) for greenfield consumers, so they don't have to wire up
|
|
20
|
+
* their own menu around the `ChartExportHandle` from `onReady`. Consumes only
|
|
21
|
+
* the opaque handle — no Highcharts type crosses this boundary.
|
|
22
|
+
*/
|
|
23
|
+
declare function ChartExportMenu({ exportHandle, labels, triggerAriaLabel, }: ChartExportMenuProps): react_jsx_runtime.JSX.Element | null;
|
|
24
|
+
|
|
25
|
+
export { ChartExportFormat, ChartExportHandle, ChartExportMenu, type ChartExportMenuProps };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { C as ChartExportHandle, a as ChartExportFormat } from '../chartExport-CKYpuhik.js';
|
|
3
|
+
|
|
4
|
+
interface ChartExportMenuProps {
|
|
5
|
+
/** The opaque export handle surfaced by a v2 chart's `onReady` callback. */
|
|
6
|
+
exportHandle: ChartExportHandle;
|
|
7
|
+
/**
|
|
8
|
+
* Visible labels per format. Only formats with a non-empty label render an
|
|
9
|
+
* item; an empty object (or all-falsy labels) renders nothing — no dead
|
|
10
|
+
* trigger. Items always render in canonical order, never in key-insertion
|
|
11
|
+
* order.
|
|
12
|
+
*/
|
|
13
|
+
labels: Partial<Record<ChartExportFormat, string>>;
|
|
14
|
+
/** Accessible name for the icon-only trigger button. */
|
|
15
|
+
triggerAriaLabel: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Icon-only overflow button that opens a dropdown of chart export actions
|
|
19
|
+
* (PNG/SVG/PDF/CSV) for greenfield consumers, so they don't have to wire up
|
|
20
|
+
* their own menu around the `ChartExportHandle` from `onReady`. Consumes only
|
|
21
|
+
* the opaque handle — no Highcharts type crosses this boundary.
|
|
22
|
+
*/
|
|
23
|
+
declare function ChartExportMenu({ exportHandle, labels, triggerAriaLabel, }: ChartExportMenuProps): react_jsx_runtime.JSX.Element | null;
|
|
24
|
+
|
|
25
|
+
export { ChartExportFormat, ChartExportHandle, ChartExportMenu, type ChartExportMenuProps };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/export/ChartExportMenu.tsx
|
|
2
|
+
var _base = require('@sproutsocial/seeds-react-menu/base');
|
|
3
|
+
var _seedsreactbutton = require('@sproutsocial/seeds-react-button');
|
|
4
|
+
var _seedsreacticon = require('@sproutsocial/seeds-react-icon');
|
|
5
|
+
var _jsxruntime = require('react/jsx-runtime');
|
|
6
|
+
var ORDER = ["png", "svg", "pdf", "csv"];
|
|
7
|
+
var METHOD = {
|
|
8
|
+
png: "exportPNG",
|
|
9
|
+
svg: "exportSVG",
|
|
10
|
+
pdf: "exportPDF",
|
|
11
|
+
csv: "exportCSV"
|
|
12
|
+
};
|
|
13
|
+
function ChartExportMenu({
|
|
14
|
+
exportHandle,
|
|
15
|
+
labels,
|
|
16
|
+
triggerAriaLabel
|
|
17
|
+
}) {
|
|
18
|
+
const formats = ORDER.filter((format) => labels[format]);
|
|
19
|
+
if (formats.length === 0) return null;
|
|
20
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
21
|
+
_base.ActionMenu,
|
|
22
|
+
{
|
|
23
|
+
trigger: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _seedsreactbutton.Button, { appearance: "secondary", ariaLabel: triggerAriaLabel, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _seedsreacticon.Icon, { name: "arrow-down-to-bracket-outline", fixedWidth: true, "aria-hidden": true }) }),
|
|
24
|
+
children: formats.map((format) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
25
|
+
_base.MenuItem,
|
|
26
|
+
{
|
|
27
|
+
onClick: () => {
|
|
28
|
+
void exportHandle[METHOD[format]]().catch(() => {
|
|
29
|
+
});
|
|
30
|
+
},
|
|
31
|
+
children: labels[format]
|
|
32
|
+
},
|
|
33
|
+
format
|
|
34
|
+
))
|
|
35
|
+
}
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
exports.ChartExportMenu = ChartExportMenu;
|
|
41
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/home/runner/_work/seeds/seeds/seeds-react/seeds-react-data-viz/dist/export/index.js","../../src/export/ChartExportMenu.tsx"],"names":[],"mappings":"AAAA;ACAA,2DAAqC;AACrC,oEAAuB;AACvB,gEAAqB;AAiDX,+CAAA;AA5BV,IAAM,MAAA,EAA6B,CAAC,KAAA,EAAO,KAAA,EAAO,KAAA,EAAO,KAAK,CAAA;AAG9D,IAAM,OAAA,EAA6D;AAAA,EACjE,GAAA,EAAK,WAAA;AAAA,EACL,GAAA,EAAK,WAAA;AAAA,EACL,GAAA,EAAK,WAAA;AAAA,EACL,GAAA,EAAK;AACP,CAAA;AAQO,SAAS,eAAA,CAAgB;AAAA,EAC9B,YAAA;AAAA,EACA,MAAA;AAAA,EACA;AACF,CAAA,EAAyB;AACvB,EAAA,MAAM,QAAA,EAAU,KAAA,CAAM,MAAA,CAAO,CAAC,MAAA,EAAA,GAAW,MAAA,CAAO,MAAM,CAAC,CAAA;AACvD,EAAA,GAAA,CAAI,OAAA,CAAQ,OAAA,IAAW,CAAA,EAAG,OAAO,IAAA;AAEjC,EAAA,uBACE,6BAAA;AAAA,IAAC,gBAAA;AAAA,IAAA;AAAA,MACC,OAAA,kBACE,6BAAA,wBAAC,EAAA,EAAO,UAAA,EAAW,WAAA,EAAY,SAAA,EAAW,gBAAA,EACxC,QAAA,kBAAA,6BAAA,oBAAC,EAAA,EAAK,IAAA,EAAK,+BAAA,EAAgC,UAAA,EAAU,IAAA,EAAC,aAAA,EAAW,KAAA,CAAC,EAAA,CACpE,CAAA;AAAA,MAGD,QAAA,EAAA,OAAA,CAAQ,GAAA,CAAI,CAAC,MAAA,EAAA,mBACZ,6BAAA;AAAA,QAAC,cAAA;AAAA,QAAA;AAAA,UAEC,OAAA,EAAS,CAAA,EAAA,GAAM;AAKb,YAAA,KAAK,YAAA,CAAa,MAAA,CAAO,MAAM,CAAC,CAAA,CAAE,CAAA,CAAE,KAAA,CAAM,CAAA,EAAA,GAAM;AAAA,YAAC,CAAC,CAAA;AAAA,UACpD,CAAA;AAAA,UAEC,QAAA,EAAA,MAAA,CAAO,MAAM;AAAA,QAAA,CAAA;AAAA,QATT;AAAA,MAUP,CACD;AAAA,IAAA;AAAA,EACH,CAAA;AAEJ;ADlCA;AACE;AACF,0CAAC","file":"/home/runner/_work/seeds/seeds/seeds-react/seeds-react-data-viz/dist/export/index.js","sourcesContent":[null,"import { ActionMenu, MenuItem } from \"@sproutsocial/seeds-react-menu/base\";\nimport { Button } from \"@sproutsocial/seeds-react-button\";\nimport { Icon } from \"@sproutsocial/seeds-react-icon\";\nimport type {\n ChartExportFormat,\n ChartExportHandle,\n} from \"../charts/shared/chartExport\";\n\nexport interface ChartExportMenuProps {\n /** The opaque export handle surfaced by a v2 chart's `onReady` callback. */\n exportHandle: ChartExportHandle;\n /**\n * Visible labels per format. Only formats with a non-empty label render an\n * item; an empty object (or all-falsy labels) renders nothing — no dead\n * trigger. Items always render in canonical order, never in key-insertion\n * order.\n */\n labels: Partial<Record<ChartExportFormat, string>>;\n /** Accessible name for the icon-only trigger button. */\n triggerAriaLabel: string;\n}\n\n// Canonical render order, independent of `labels` key order.\nconst ORDER: ChartExportFormat[] = [\"png\", \"svg\", \"pdf\", \"csv\"];\n\n// Maps each format to the matching handle callable.\nconst METHOD: Record<ChartExportFormat, keyof ChartExportHandle> = {\n png: \"exportPNG\",\n svg: \"exportSVG\",\n pdf: \"exportPDF\",\n csv: \"exportCSV\",\n};\n\n/**\n * Icon-only overflow button that opens a dropdown of chart export actions\n * (PNG/SVG/PDF/CSV) for greenfield consumers, so they don't have to wire up\n * their own menu around the `ChartExportHandle` from `onReady`. Consumes only\n * the opaque handle — no Highcharts type crosses this boundary.\n */\nexport function ChartExportMenu({\n exportHandle,\n labels,\n triggerAriaLabel,\n}: ChartExportMenuProps) {\n const formats = ORDER.filter((format) => labels[format]);\n if (formats.length === 0) return null;\n\n return (\n <ActionMenu\n trigger={\n <Button appearance=\"secondary\" ariaLabel={triggerAriaLabel}>\n <Icon name=\"arrow-down-to-bracket-outline\" fixedWidth aria-hidden />\n </Button>\n }\n >\n {formats.map((format) => (\n <MenuItem\n key={format}\n onClick={() => {\n // The handle is fire-and-forget by design (opaque, consumer owns no\n // UI here). Attach a no-op catch so a rejected export (e.g. a PDF\n // dynamic-import failure) is a deliberate swallow, not an unhandled\n // promise rejection.\n void exportHandle[METHOD[format]]().catch(() => {});\n }}\n >\n {labels[format]}\n </MenuItem>\n ))}\n </ActionMenu>\n );\n}\n"]}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,104 +1,15 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { T as TypeChartDataPoint, a as TypeChartDataStyles, b as TypeChartTooltipDateFormatter, c as TypeChartNumberFormat, d as TypeChartTooltipProps, e as TypeChartYAxisLabelFormatter, f as TypeChartTimeFormat, g as TypeChartXAnnotations, h as TypeChartStylePattern, i as TypeVerticalBarChartProps, j as TypeSeriesType, E as ExtendedTimeTicksInfoObject, k as TypeChartStyleColor, l as TypeChartStyleHasOnClick } from './types-B7ILUQ6_.mjs';
|
|
4
|
+
export { m as ExtendedAxisLabelsFormatterContextObject, n as TypeChartXAnnotationsDetails, o as TypeExtendedChart } from './types-B7ILUQ6_.mjs';
|
|
4
5
|
import * as _sproutsocial_seeds_react_box from '@sproutsocial/seeds-react-box';
|
|
5
6
|
import { TypeBoxProps } from '@sproutsocial/seeds-react-box';
|
|
6
7
|
import { Table } from '@sproutsocial/seeds-react-table';
|
|
8
|
+
import { Chart, TooltipFormatterContextObject, Options, SeriesSplineOptions, SeriesAreasplineOptions, SeriesColumnOptions, AxisTickPositionsArray, AxisLabelsFormatterContextObject } from 'highcharts';
|
|
7
9
|
import { TypeIconName } from '@sproutsocial/seeds-react-icon';
|
|
8
10
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
9
11
|
import * as styled_components from 'styled-components';
|
|
10
12
|
|
|
11
|
-
/**
|
|
12
|
-
* Type of series to render. See {@link https://api.highcharts.com/highcharts/series} for detailed series configuration options.
|
|
13
|
-
*/
|
|
14
|
-
type TypeSeriesType = "areaspline" | "spline" | "column";
|
|
15
|
-
interface ExtendedTimeTicksInfoObject extends TimeTicksInfoObject {
|
|
16
|
-
unitName: "hour" | "day" | "week" | "month" | "year";
|
|
17
|
-
}
|
|
18
|
-
interface ExtendedAxisLabelsFormatterContextObject extends AxisLabelsFormatterContextObject {
|
|
19
|
-
tickPositionInfo: ExtendedTimeTicksInfoObject;
|
|
20
|
-
}
|
|
21
|
-
type TypeChartDataPoint = Readonly<{
|
|
22
|
-
x: number | string;
|
|
23
|
-
y: number | null;
|
|
24
|
-
}>;
|
|
25
|
-
type TypeChartDataStyles = Readonly<{
|
|
26
|
-
color?: TypeChartStyleColor;
|
|
27
|
-
}>;
|
|
28
|
-
type TypeChartNumberFormat = "decimal" | "percent" | "currency" | "duration";
|
|
29
|
-
type TypeChartTimeFormat = "12" | "24";
|
|
30
|
-
type TypeChartTooltipDateFormatter = ({ x, }: {
|
|
31
|
-
x: number | string;
|
|
32
|
-
}) => ReactNode;
|
|
33
|
-
type TypeChartTooltipProps = Readonly<{
|
|
34
|
-
data: ReadonlyArray<Readonly<{
|
|
35
|
-
color: TypeChartStyleColor;
|
|
36
|
-
name: string;
|
|
37
|
-
value: number | null;
|
|
38
|
-
icon?: ReactNode;
|
|
39
|
-
}>>;
|
|
40
|
-
x: number | string;
|
|
41
|
-
}>;
|
|
42
|
-
type TypeChartYAxisLabelFormatter = ({ y, yValues, }: Readonly<{
|
|
43
|
-
y: number;
|
|
44
|
-
yValues: ReadonlyArray<number>;
|
|
45
|
-
}>) => string;
|
|
46
|
-
type TypeChartXAnnotationsDetails = () => ReactNode;
|
|
47
|
-
type TypeChartXAnnotations = Readonly<{
|
|
48
|
-
[x: number]: Readonly<{
|
|
49
|
-
marker: () => ReactNode;
|
|
50
|
-
details: TypeChartXAnnotationsDetails;
|
|
51
|
-
}>;
|
|
52
|
-
}> | undefined;
|
|
53
|
-
type TypeChartStyleColor = string;
|
|
54
|
-
type TypeChartStylePattern = "solid" | "dashed";
|
|
55
|
-
type TypeChartStyleHasOnClick = boolean;
|
|
56
|
-
type TypeVerticalBarChartProps = Readonly<{
|
|
57
|
-
data: ReadonlyArray<Readonly<{
|
|
58
|
-
name: string;
|
|
59
|
-
points: ReadonlyArray<TypeChartDataPoint>;
|
|
60
|
-
icon?: ReactNode;
|
|
61
|
-
styles?: TypeChartDataStyles & Readonly<{
|
|
62
|
-
pattern?: TypeChartStylePattern;
|
|
63
|
-
}>;
|
|
64
|
-
}>>;
|
|
65
|
-
invalidNumberLabel: ReactNode;
|
|
66
|
-
numberLocale: Intl.LocalesArgument;
|
|
67
|
-
textLocale: Intl.LocalesArgument;
|
|
68
|
-
tooltipDateFormatter: TypeChartTooltipDateFormatter;
|
|
69
|
-
currency?: string;
|
|
70
|
-
numberFormat?: TypeChartNumberFormat;
|
|
71
|
-
/**
|
|
72
|
-
* The maximum number of series to display.
|
|
73
|
-
* @default 10
|
|
74
|
-
* @description We recommend limiting the number of series to 10 to maintain chart readability and accessibility.
|
|
75
|
-
*/
|
|
76
|
-
seriesLimit?: number;
|
|
77
|
-
/**
|
|
78
|
-
* If false, disables the warning when the number of series exceeds the seriesLimit.
|
|
79
|
-
* @default true
|
|
80
|
-
*/
|
|
81
|
-
showSeriesLimitWarning?: boolean;
|
|
82
|
-
tooltip?: ({ data, x }: TypeChartTooltipProps) => ReactNode;
|
|
83
|
-
yAxisLabelFormatter?: TypeChartYAxisLabelFormatter;
|
|
84
|
-
onClick?: ({ x }: Readonly<{
|
|
85
|
-
x: number;
|
|
86
|
-
}>) => void;
|
|
87
|
-
tooltipClickLabel?: ReactNode;
|
|
88
|
-
timeFormat?: TypeChartTimeFormat;
|
|
89
|
-
xAnnotations?: TypeChartXAnnotations;
|
|
90
|
-
xAxisLabelFormatter?: (params: {
|
|
91
|
-
textLocale: Intl.LocalesArgument;
|
|
92
|
-
tickPositions: number[];
|
|
93
|
-
unitName: string;
|
|
94
|
-
value: string | number;
|
|
95
|
-
timeFormat?: string;
|
|
96
|
-
}) => string;
|
|
97
|
-
}>;
|
|
98
|
-
interface TypeExtendedChart extends Chart {
|
|
99
|
-
annotations?: Annotation[];
|
|
100
|
-
}
|
|
101
|
-
|
|
102
13
|
type TypeAreaChartProps = Readonly<{
|
|
103
14
|
data: ReadonlyArray<Readonly<{
|
|
104
15
|
name: string;
|
|
@@ -401,6 +312,22 @@ declare const LineChart: react.NamedExoticComponent<Readonly<{
|
|
|
401
312
|
}) => string;
|
|
402
313
|
}>>;
|
|
403
314
|
|
|
315
|
+
/**
|
|
316
|
+
* @deprecated Use the v2 component instead:
|
|
317
|
+
*
|
|
318
|
+
* ```ts
|
|
319
|
+
* import { VerticalBarChart } from "@sproutsocial/seeds-react-data-viz/bar";
|
|
320
|
+
* ```
|
|
321
|
+
*
|
|
322
|
+
* The v2 component is built on the shared chart base. See `charts/README.md`
|
|
323
|
+
* for the architecture. The v2 prop shape differs from this legacy component
|
|
324
|
+
* and v2 does not yet cover every legacy feature (locale-aware tooltips,
|
|
325
|
+
* formatters, interactions, annotations, legend). Use the Claude-assisted
|
|
326
|
+
* migration skill at
|
|
327
|
+
* `seeds-tooling/seeds-codemod-cli/src/usage-patterns/VERTICALBARCHARTV1_PATTERNS.md`
|
|
328
|
+
* — it documents the prop mapping and tells you when to wait rather than
|
|
329
|
+
* force-migrate.
|
|
330
|
+
*/
|
|
404
331
|
declare const VerticalBarChart: react.NamedExoticComponent<Readonly<{
|
|
405
332
|
data: ReadonlyArray<Readonly<{
|
|
406
333
|
name: string;
|
|
@@ -488,6 +415,11 @@ declare const xAxisLabelFormatter: ({ textLocale, tickPositions, unitName, value
|
|
|
488
415
|
* Helper to detect if data is hourly time data (all x values are hours of the same day)
|
|
489
416
|
* @param data - Array of series data with points containing x values
|
|
490
417
|
* @returns boolean indicating if all x values are hours of the same day
|
|
418
|
+
* @deprecated Auto-detection of hourly data is deprecated. v2 is declarative:
|
|
419
|
+
* use `xAxis={{ type: "datetime", timeFormat: "12" | "24" }}` + a top-level
|
|
420
|
+
* `timezone` instead of relying on implicit detection. See
|
|
421
|
+
* `seeds-tooling/seeds-codemod-cli/src/usage-patterns/VERTICALBARCHARTV1_PATTERNS.md`
|
|
422
|
+
* (CE-8).
|
|
491
423
|
*/
|
|
492
424
|
declare function isHourlyTimeData(data: ReadonlyArray<Readonly<{
|
|
493
425
|
points: ReadonlyArray<{
|
|
@@ -500,6 +432,11 @@ declare function isHourlyTimeData(data: ReadonlyArray<Readonly<{
|
|
|
500
432
|
* Supports both 12-hour format ("12 AM", "1 PM") and 24-hour format ("00:00", "13:00", "23:00")
|
|
501
433
|
* @param data - Array of series data with points containing x values
|
|
502
434
|
* @returns boolean indicating if all x values are hour strings
|
|
435
|
+
* @deprecated Auto-detection of hourly data is deprecated. v2 is declarative:
|
|
436
|
+
* use `xAxis={{ type: "datetime", timeFormat: "12" | "24" }}` + a top-level
|
|
437
|
+
* `timezone` instead of relying on implicit detection. See
|
|
438
|
+
* `seeds-tooling/seeds-codemod-cli/src/usage-patterns/VERTICALBARCHARTV1_PATTERNS.md`
|
|
439
|
+
* (CE-8).
|
|
503
440
|
*/
|
|
504
441
|
declare function isCategoricalHourData(data: ReadonlyArray<Readonly<{
|
|
505
442
|
points: ReadonlyArray<{
|
|
@@ -570,4 +507,4 @@ declare const donutChartStyles: styled_components.FlattenInterpolation<styled_co
|
|
|
570
507
|
$hasOnClick: TypeChartStyleHasOnClick;
|
|
571
508
|
}>, any>>;
|
|
572
509
|
|
|
573
|
-
export { AreaChart, ChartLegend, ChartLegendLabel, ChartTable, ChartTooltip, ChartTooltipFooter, ChartTooltipHeader, ChartTooltipPortal, ChartTooltipTable, ChartTooltipTitle, ChartXAnnotationDetails, ChartXAnnotationMarker, ColorBox, DONUT_CHART_HALO_SIZE, DONUT_CHART_HEIGHT, DONUT_CHART_WIDTH, DatavizColorBox, DonutChart, DonutChartLegendTable,
|
|
510
|
+
export { AreaChart, ChartLegend, ChartLegendLabel, ChartTable, ChartTooltip, ChartTooltipFooter, ChartTooltipHeader, ChartTooltipPortal, ChartTooltipTable, ChartTooltipTitle, ChartXAnnotationDetails, ChartXAnnotationMarker, ColorBox, DONUT_CHART_HALO_SIZE, DONUT_CHART_HEIGHT, DONUT_CHART_WIDTH, DatavizColorBox, DonutChart, DonutChartLegendTable, ExtendedTimeTicksInfoObject, GlobalChartStyleOverrides, LineChart, NetworkColorBox, TIME_SERIES_CHART_HEIGHT, type TypeAreaChartProps, TypeChartDataPoint, TypeChartDataStyles, type TypeChartLegendLabelProps, type TypeChartLegendProps, TypeChartNumberFormat, TypeChartStyleColor, TypeChartStyleHasOnClick, TypeChartStylePattern, type TypeChartTableProps, TypeChartTimeFormat, TypeChartTooltipDateFormatter, TypeChartTooltipProps, type TypeChartTooltipTableProps, TypeChartXAnnotations, TypeChartYAxisLabelFormatter, type TypeColorBoxProps, type TypeDatavizColorBox, type TypeDatavizColorBoxProps, type TypeDonutChartDataItem, type TypeDonutChartLegendTableProps, type TypeDonutChartProps, type TypeDonutChartTooltipProps, type TypeLegendLabel, type TypeLineChartProps, TypeSeriesType, TypeVerticalBarChartProps, VERTICAL_BAR_CHART_DEFAULT_SERIES_LIMIT, VerticalBarChart, areaChartOptions, areaChartStyles, baseChartOptions, baseChartStyles, columnChartOptions, donutChartOptions, donutChartStyles, generateChartTooltipPortalId, getDatavizColor, getDatavizColorWithAlpha, getDatavizOpacity, getStorybookCategoricalData, getStorybookSparseTimelineData, isCategoricalHourData, isHourlyTimeData, lineChartOptions, lineChartStyles, timeSeriesChartOptions, timeSeriesChartStyles, transformDataToSeries, transformTimeSeriesTooltipData, xAxisLabelFormatter, yAxisLabelFormatter };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,104 +1,15 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { T as TypeChartDataPoint, a as TypeChartDataStyles, b as TypeChartTooltipDateFormatter, c as TypeChartNumberFormat, d as TypeChartTooltipProps, e as TypeChartYAxisLabelFormatter, f as TypeChartTimeFormat, g as TypeChartXAnnotations, h as TypeChartStylePattern, i as TypeVerticalBarChartProps, j as TypeSeriesType, E as ExtendedTimeTicksInfoObject, k as TypeChartStyleColor, l as TypeChartStyleHasOnClick } from './types-B7ILUQ6_.js';
|
|
4
|
+
export { m as ExtendedAxisLabelsFormatterContextObject, n as TypeChartXAnnotationsDetails, o as TypeExtendedChart } from './types-B7ILUQ6_.js';
|
|
4
5
|
import * as _sproutsocial_seeds_react_box from '@sproutsocial/seeds-react-box';
|
|
5
6
|
import { TypeBoxProps } from '@sproutsocial/seeds-react-box';
|
|
6
7
|
import { Table } from '@sproutsocial/seeds-react-table';
|
|
8
|
+
import { Chart, TooltipFormatterContextObject, Options, SeriesSplineOptions, SeriesAreasplineOptions, SeriesColumnOptions, AxisTickPositionsArray, AxisLabelsFormatterContextObject } from 'highcharts';
|
|
7
9
|
import { TypeIconName } from '@sproutsocial/seeds-react-icon';
|
|
8
10
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
9
11
|
import * as styled_components from 'styled-components';
|
|
10
12
|
|
|
11
|
-
/**
|
|
12
|
-
* Type of series to render. See {@link https://api.highcharts.com/highcharts/series} for detailed series configuration options.
|
|
13
|
-
*/
|
|
14
|
-
type TypeSeriesType = "areaspline" | "spline" | "column";
|
|
15
|
-
interface ExtendedTimeTicksInfoObject extends TimeTicksInfoObject {
|
|
16
|
-
unitName: "hour" | "day" | "week" | "month" | "year";
|
|
17
|
-
}
|
|
18
|
-
interface ExtendedAxisLabelsFormatterContextObject extends AxisLabelsFormatterContextObject {
|
|
19
|
-
tickPositionInfo: ExtendedTimeTicksInfoObject;
|
|
20
|
-
}
|
|
21
|
-
type TypeChartDataPoint = Readonly<{
|
|
22
|
-
x: number | string;
|
|
23
|
-
y: number | null;
|
|
24
|
-
}>;
|
|
25
|
-
type TypeChartDataStyles = Readonly<{
|
|
26
|
-
color?: TypeChartStyleColor;
|
|
27
|
-
}>;
|
|
28
|
-
type TypeChartNumberFormat = "decimal" | "percent" | "currency" | "duration";
|
|
29
|
-
type TypeChartTimeFormat = "12" | "24";
|
|
30
|
-
type TypeChartTooltipDateFormatter = ({ x, }: {
|
|
31
|
-
x: number | string;
|
|
32
|
-
}) => ReactNode;
|
|
33
|
-
type TypeChartTooltipProps = Readonly<{
|
|
34
|
-
data: ReadonlyArray<Readonly<{
|
|
35
|
-
color: TypeChartStyleColor;
|
|
36
|
-
name: string;
|
|
37
|
-
value: number | null;
|
|
38
|
-
icon?: ReactNode;
|
|
39
|
-
}>>;
|
|
40
|
-
x: number | string;
|
|
41
|
-
}>;
|
|
42
|
-
type TypeChartYAxisLabelFormatter = ({ y, yValues, }: Readonly<{
|
|
43
|
-
y: number;
|
|
44
|
-
yValues: ReadonlyArray<number>;
|
|
45
|
-
}>) => string;
|
|
46
|
-
type TypeChartXAnnotationsDetails = () => ReactNode;
|
|
47
|
-
type TypeChartXAnnotations = Readonly<{
|
|
48
|
-
[x: number]: Readonly<{
|
|
49
|
-
marker: () => ReactNode;
|
|
50
|
-
details: TypeChartXAnnotationsDetails;
|
|
51
|
-
}>;
|
|
52
|
-
}> | undefined;
|
|
53
|
-
type TypeChartStyleColor = string;
|
|
54
|
-
type TypeChartStylePattern = "solid" | "dashed";
|
|
55
|
-
type TypeChartStyleHasOnClick = boolean;
|
|
56
|
-
type TypeVerticalBarChartProps = Readonly<{
|
|
57
|
-
data: ReadonlyArray<Readonly<{
|
|
58
|
-
name: string;
|
|
59
|
-
points: ReadonlyArray<TypeChartDataPoint>;
|
|
60
|
-
icon?: ReactNode;
|
|
61
|
-
styles?: TypeChartDataStyles & Readonly<{
|
|
62
|
-
pattern?: TypeChartStylePattern;
|
|
63
|
-
}>;
|
|
64
|
-
}>>;
|
|
65
|
-
invalidNumberLabel: ReactNode;
|
|
66
|
-
numberLocale: Intl.LocalesArgument;
|
|
67
|
-
textLocale: Intl.LocalesArgument;
|
|
68
|
-
tooltipDateFormatter: TypeChartTooltipDateFormatter;
|
|
69
|
-
currency?: string;
|
|
70
|
-
numberFormat?: TypeChartNumberFormat;
|
|
71
|
-
/**
|
|
72
|
-
* The maximum number of series to display.
|
|
73
|
-
* @default 10
|
|
74
|
-
* @description We recommend limiting the number of series to 10 to maintain chart readability and accessibility.
|
|
75
|
-
*/
|
|
76
|
-
seriesLimit?: number;
|
|
77
|
-
/**
|
|
78
|
-
* If false, disables the warning when the number of series exceeds the seriesLimit.
|
|
79
|
-
* @default true
|
|
80
|
-
*/
|
|
81
|
-
showSeriesLimitWarning?: boolean;
|
|
82
|
-
tooltip?: ({ data, x }: TypeChartTooltipProps) => ReactNode;
|
|
83
|
-
yAxisLabelFormatter?: TypeChartYAxisLabelFormatter;
|
|
84
|
-
onClick?: ({ x }: Readonly<{
|
|
85
|
-
x: number;
|
|
86
|
-
}>) => void;
|
|
87
|
-
tooltipClickLabel?: ReactNode;
|
|
88
|
-
timeFormat?: TypeChartTimeFormat;
|
|
89
|
-
xAnnotations?: TypeChartXAnnotations;
|
|
90
|
-
xAxisLabelFormatter?: (params: {
|
|
91
|
-
textLocale: Intl.LocalesArgument;
|
|
92
|
-
tickPositions: number[];
|
|
93
|
-
unitName: string;
|
|
94
|
-
value: string | number;
|
|
95
|
-
timeFormat?: string;
|
|
96
|
-
}) => string;
|
|
97
|
-
}>;
|
|
98
|
-
interface TypeExtendedChart extends Chart {
|
|
99
|
-
annotations?: Annotation[];
|
|
100
|
-
}
|
|
101
|
-
|
|
102
13
|
type TypeAreaChartProps = Readonly<{
|
|
103
14
|
data: ReadonlyArray<Readonly<{
|
|
104
15
|
name: string;
|
|
@@ -401,6 +312,22 @@ declare const LineChart: react.NamedExoticComponent<Readonly<{
|
|
|
401
312
|
}) => string;
|
|
402
313
|
}>>;
|
|
403
314
|
|
|
315
|
+
/**
|
|
316
|
+
* @deprecated Use the v2 component instead:
|
|
317
|
+
*
|
|
318
|
+
* ```ts
|
|
319
|
+
* import { VerticalBarChart } from "@sproutsocial/seeds-react-data-viz/bar";
|
|
320
|
+
* ```
|
|
321
|
+
*
|
|
322
|
+
* The v2 component is built on the shared chart base. See `charts/README.md`
|
|
323
|
+
* for the architecture. The v2 prop shape differs from this legacy component
|
|
324
|
+
* and v2 does not yet cover every legacy feature (locale-aware tooltips,
|
|
325
|
+
* formatters, interactions, annotations, legend). Use the Claude-assisted
|
|
326
|
+
* migration skill at
|
|
327
|
+
* `seeds-tooling/seeds-codemod-cli/src/usage-patterns/VERTICALBARCHARTV1_PATTERNS.md`
|
|
328
|
+
* — it documents the prop mapping and tells you when to wait rather than
|
|
329
|
+
* force-migrate.
|
|
330
|
+
*/
|
|
404
331
|
declare const VerticalBarChart: react.NamedExoticComponent<Readonly<{
|
|
405
332
|
data: ReadonlyArray<Readonly<{
|
|
406
333
|
name: string;
|
|
@@ -488,6 +415,11 @@ declare const xAxisLabelFormatter: ({ textLocale, tickPositions, unitName, value
|
|
|
488
415
|
* Helper to detect if data is hourly time data (all x values are hours of the same day)
|
|
489
416
|
* @param data - Array of series data with points containing x values
|
|
490
417
|
* @returns boolean indicating if all x values are hours of the same day
|
|
418
|
+
* @deprecated Auto-detection of hourly data is deprecated. v2 is declarative:
|
|
419
|
+
* use `xAxis={{ type: "datetime", timeFormat: "12" | "24" }}` + a top-level
|
|
420
|
+
* `timezone` instead of relying on implicit detection. See
|
|
421
|
+
* `seeds-tooling/seeds-codemod-cli/src/usage-patterns/VERTICALBARCHARTV1_PATTERNS.md`
|
|
422
|
+
* (CE-8).
|
|
491
423
|
*/
|
|
492
424
|
declare function isHourlyTimeData(data: ReadonlyArray<Readonly<{
|
|
493
425
|
points: ReadonlyArray<{
|
|
@@ -500,6 +432,11 @@ declare function isHourlyTimeData(data: ReadonlyArray<Readonly<{
|
|
|
500
432
|
* Supports both 12-hour format ("12 AM", "1 PM") and 24-hour format ("00:00", "13:00", "23:00")
|
|
501
433
|
* @param data - Array of series data with points containing x values
|
|
502
434
|
* @returns boolean indicating if all x values are hour strings
|
|
435
|
+
* @deprecated Auto-detection of hourly data is deprecated. v2 is declarative:
|
|
436
|
+
* use `xAxis={{ type: "datetime", timeFormat: "12" | "24" }}` + a top-level
|
|
437
|
+
* `timezone` instead of relying on implicit detection. See
|
|
438
|
+
* `seeds-tooling/seeds-codemod-cli/src/usage-patterns/VERTICALBARCHARTV1_PATTERNS.md`
|
|
439
|
+
* (CE-8).
|
|
503
440
|
*/
|
|
504
441
|
declare function isCategoricalHourData(data: ReadonlyArray<Readonly<{
|
|
505
442
|
points: ReadonlyArray<{
|
|
@@ -570,4 +507,4 @@ declare const donutChartStyles: styled_components.FlattenInterpolation<styled_co
|
|
|
570
507
|
$hasOnClick: TypeChartStyleHasOnClick;
|
|
571
508
|
}>, any>>;
|
|
572
509
|
|
|
573
|
-
export { AreaChart, ChartLegend, ChartLegendLabel, ChartTable, ChartTooltip, ChartTooltipFooter, ChartTooltipHeader, ChartTooltipPortal, ChartTooltipTable, ChartTooltipTitle, ChartXAnnotationDetails, ChartXAnnotationMarker, ColorBox, DONUT_CHART_HALO_SIZE, DONUT_CHART_HEIGHT, DONUT_CHART_WIDTH, DatavizColorBox, DonutChart, DonutChartLegendTable,
|
|
510
|
+
export { AreaChart, ChartLegend, ChartLegendLabel, ChartTable, ChartTooltip, ChartTooltipFooter, ChartTooltipHeader, ChartTooltipPortal, ChartTooltipTable, ChartTooltipTitle, ChartXAnnotationDetails, ChartXAnnotationMarker, ColorBox, DONUT_CHART_HALO_SIZE, DONUT_CHART_HEIGHT, DONUT_CHART_WIDTH, DatavizColorBox, DonutChart, DonutChartLegendTable, ExtendedTimeTicksInfoObject, GlobalChartStyleOverrides, LineChart, NetworkColorBox, TIME_SERIES_CHART_HEIGHT, type TypeAreaChartProps, TypeChartDataPoint, TypeChartDataStyles, type TypeChartLegendLabelProps, type TypeChartLegendProps, TypeChartNumberFormat, TypeChartStyleColor, TypeChartStyleHasOnClick, TypeChartStylePattern, type TypeChartTableProps, TypeChartTimeFormat, TypeChartTooltipDateFormatter, TypeChartTooltipProps, type TypeChartTooltipTableProps, TypeChartXAnnotations, TypeChartYAxisLabelFormatter, type TypeColorBoxProps, type TypeDatavizColorBox, type TypeDatavizColorBoxProps, type TypeDonutChartDataItem, type TypeDonutChartLegendTableProps, type TypeDonutChartProps, type TypeDonutChartTooltipProps, type TypeLegendLabel, type TypeLineChartProps, TypeSeriesType, TypeVerticalBarChartProps, VERTICAL_BAR_CHART_DEFAULT_SERIES_LIMIT, VerticalBarChart, areaChartOptions, areaChartStyles, baseChartOptions, baseChartStyles, columnChartOptions, donutChartOptions, donutChartStyles, generateChartTooltipPortalId, getDatavizColor, getDatavizColorWithAlpha, getDatavizOpacity, getStorybookCategoricalData, getStorybookSparseTimelineData, isCategoricalHourData, isHourlyTimeData, lineChartOptions, lineChartStyles, timeSeriesChartOptions, timeSeriesChartStyles, transformDataToSeries, transformTimeSeriesTooltipData, xAxisLabelFormatter, yAxisLabelFormatter };
|