@sproutsocial/seeds-react-data-viz 0.7.32 → 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.
@@ -0,0 +1,10 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/charts/shared/pdfExportLibs.ts
2
+ var _jspdf = require('jspdf');
3
+ require('svg2pdf.js');
4
+ function loadPdfExportLibs() {
5
+ window.jspdf = { jsPDF: _jspdf.jsPDF };
6
+ }
7
+
8
+
9
+ exports.loadPdfExportLibs = loadPdfExportLibs;
10
+ //# sourceMappingURL=pdfExportLibs-BZR2D3RA.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/home/runner/_work/seeds/seeds/seeds-react/seeds-react-data-viz/dist/pdfExportLibs-BZR2D3RA.js","../src/charts/shared/pdfExportLibs.ts"],"names":[],"mappings":"AAAA;ACOA,8BAAsB;AAGtB,sBAAO;AAYA,SAAS,iBAAA,CAAA,EAA0B;AACxC,EAAC,MAAA,CAAkC,MAAA,EAAQ,EAAE,oBAAM,CAAA;AACrD;ADlBA;AACE;AACF,8CAAC","file":"/home/runner/_work/seeds/seeds/seeds-react/seeds-react-data-viz/dist/pdfExportLibs-BZR2D3RA.js","sourcesContent":[null,"// 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"]}
@@ -0,0 +1,99 @@
1
+ import { ReactNode } from 'react';
2
+ import { AxisLabelsFormatterContextObject, TimeTicksInfoObject, Chart, Annotation } from 'highcharts';
3
+
4
+ /**
5
+ * Type of series to render. See {@link https://api.highcharts.com/highcharts/series} for detailed series configuration options.
6
+ */
7
+ type TypeSeriesType = "areaspline" | "spline" | "column";
8
+ interface ExtendedTimeTicksInfoObject extends TimeTicksInfoObject {
9
+ unitName: "hour" | "day" | "week" | "month" | "year";
10
+ }
11
+ interface ExtendedAxisLabelsFormatterContextObject extends AxisLabelsFormatterContextObject {
12
+ tickPositionInfo: ExtendedTimeTicksInfoObject;
13
+ }
14
+ type TypeChartDataPoint = Readonly<{
15
+ x: number | string;
16
+ y: number | null;
17
+ }>;
18
+ type TypeChartDataStyles = Readonly<{
19
+ color?: TypeChartStyleColor;
20
+ }>;
21
+ type TypeChartNumberFormat = "decimal" | "percent" | "currency" | "duration";
22
+ type TypeChartTimeFormat = "12" | "24";
23
+ type TypeChartTooltipDateFormatter = ({ x, }: {
24
+ x: number | string;
25
+ }) => ReactNode;
26
+ type TypeChartTooltipProps = Readonly<{
27
+ data: ReadonlyArray<Readonly<{
28
+ color: TypeChartStyleColor;
29
+ name: string;
30
+ value: number | null;
31
+ icon?: ReactNode;
32
+ }>>;
33
+ x: number | string;
34
+ /** True when the chart has an `onClick` handler — used by the default tooltip to render the click-label footer. */
35
+ hasOnClick?: boolean;
36
+ /** Footer content shown in the default tooltip when the chart is clickable. */
37
+ tooltipClickLabel?: ReactNode;
38
+ }>;
39
+ type TypeChartYAxisLabelFormatter = ({ y, yValues, }: Readonly<{
40
+ y: number;
41
+ yValues: ReadonlyArray<number>;
42
+ }>) => string;
43
+ type TypeChartXAnnotationsDetails = () => ReactNode;
44
+ type TypeChartXAnnotations = Readonly<{
45
+ [x: number]: Readonly<{
46
+ marker: () => ReactNode;
47
+ details: TypeChartXAnnotationsDetails;
48
+ }>;
49
+ }> | undefined;
50
+ type TypeChartStyleColor = string;
51
+ type TypeChartStylePattern = "solid" | "dashed";
52
+ type TypeChartStyleHasOnClick = boolean;
53
+ type TypeVerticalBarChartProps = Readonly<{
54
+ data: ReadonlyArray<Readonly<{
55
+ name: string;
56
+ points: ReadonlyArray<TypeChartDataPoint>;
57
+ icon?: ReactNode;
58
+ styles?: TypeChartDataStyles & Readonly<{
59
+ pattern?: TypeChartStylePattern;
60
+ }>;
61
+ }>>;
62
+ invalidNumberLabel: ReactNode;
63
+ numberLocale: Intl.LocalesArgument;
64
+ textLocale: Intl.LocalesArgument;
65
+ tooltipDateFormatter: TypeChartTooltipDateFormatter;
66
+ currency?: string;
67
+ numberFormat?: TypeChartNumberFormat;
68
+ /**
69
+ * The maximum number of series to display.
70
+ * @default 10
71
+ * @description We recommend limiting the number of series to 10 to maintain chart readability and accessibility.
72
+ */
73
+ seriesLimit?: number;
74
+ /**
75
+ * If false, disables the warning when the number of series exceeds the seriesLimit.
76
+ * @default true
77
+ */
78
+ showSeriesLimitWarning?: boolean;
79
+ tooltip?: ({ data, x }: TypeChartTooltipProps) => ReactNode;
80
+ yAxisLabelFormatter?: TypeChartYAxisLabelFormatter;
81
+ onClick?: ({ x }: Readonly<{
82
+ x: number;
83
+ }>) => void;
84
+ tooltipClickLabel?: ReactNode;
85
+ timeFormat?: TypeChartTimeFormat;
86
+ xAnnotations?: TypeChartXAnnotations;
87
+ xAxisLabelFormatter?: (params: {
88
+ textLocale: Intl.LocalesArgument;
89
+ tickPositions: number[];
90
+ unitName: string;
91
+ value: string | number;
92
+ timeFormat?: string;
93
+ }) => string;
94
+ }>;
95
+ interface TypeExtendedChart extends Chart {
96
+ annotations?: Annotation[];
97
+ }
98
+
99
+ export type { ExtendedTimeTicksInfoObject as E, TypeChartDataPoint as T, TypeChartDataStyles as a, TypeChartTooltipDateFormatter as b, TypeChartNumberFormat as c, TypeChartTooltipProps as d, TypeChartYAxisLabelFormatter as e, TypeChartTimeFormat as f, TypeChartXAnnotations as g, TypeChartStylePattern as h, TypeVerticalBarChartProps as i, TypeSeriesType as j, TypeChartStyleColor as k, TypeChartStyleHasOnClick as l, ExtendedAxisLabelsFormatterContextObject as m, TypeChartXAnnotationsDetails as n, TypeExtendedChart as o };
@@ -0,0 +1,99 @@
1
+ import { ReactNode } from 'react';
2
+ import { AxisLabelsFormatterContextObject, TimeTicksInfoObject, Chart, Annotation } from 'highcharts';
3
+
4
+ /**
5
+ * Type of series to render. See {@link https://api.highcharts.com/highcharts/series} for detailed series configuration options.
6
+ */
7
+ type TypeSeriesType = "areaspline" | "spline" | "column";
8
+ interface ExtendedTimeTicksInfoObject extends TimeTicksInfoObject {
9
+ unitName: "hour" | "day" | "week" | "month" | "year";
10
+ }
11
+ interface ExtendedAxisLabelsFormatterContextObject extends AxisLabelsFormatterContextObject {
12
+ tickPositionInfo: ExtendedTimeTicksInfoObject;
13
+ }
14
+ type TypeChartDataPoint = Readonly<{
15
+ x: number | string;
16
+ y: number | null;
17
+ }>;
18
+ type TypeChartDataStyles = Readonly<{
19
+ color?: TypeChartStyleColor;
20
+ }>;
21
+ type TypeChartNumberFormat = "decimal" | "percent" | "currency" | "duration";
22
+ type TypeChartTimeFormat = "12" | "24";
23
+ type TypeChartTooltipDateFormatter = ({ x, }: {
24
+ x: number | string;
25
+ }) => ReactNode;
26
+ type TypeChartTooltipProps = Readonly<{
27
+ data: ReadonlyArray<Readonly<{
28
+ color: TypeChartStyleColor;
29
+ name: string;
30
+ value: number | null;
31
+ icon?: ReactNode;
32
+ }>>;
33
+ x: number | string;
34
+ /** True when the chart has an `onClick` handler — used by the default tooltip to render the click-label footer. */
35
+ hasOnClick?: boolean;
36
+ /** Footer content shown in the default tooltip when the chart is clickable. */
37
+ tooltipClickLabel?: ReactNode;
38
+ }>;
39
+ type TypeChartYAxisLabelFormatter = ({ y, yValues, }: Readonly<{
40
+ y: number;
41
+ yValues: ReadonlyArray<number>;
42
+ }>) => string;
43
+ type TypeChartXAnnotationsDetails = () => ReactNode;
44
+ type TypeChartXAnnotations = Readonly<{
45
+ [x: number]: Readonly<{
46
+ marker: () => ReactNode;
47
+ details: TypeChartXAnnotationsDetails;
48
+ }>;
49
+ }> | undefined;
50
+ type TypeChartStyleColor = string;
51
+ type TypeChartStylePattern = "solid" | "dashed";
52
+ type TypeChartStyleHasOnClick = boolean;
53
+ type TypeVerticalBarChartProps = Readonly<{
54
+ data: ReadonlyArray<Readonly<{
55
+ name: string;
56
+ points: ReadonlyArray<TypeChartDataPoint>;
57
+ icon?: ReactNode;
58
+ styles?: TypeChartDataStyles & Readonly<{
59
+ pattern?: TypeChartStylePattern;
60
+ }>;
61
+ }>>;
62
+ invalidNumberLabel: ReactNode;
63
+ numberLocale: Intl.LocalesArgument;
64
+ textLocale: Intl.LocalesArgument;
65
+ tooltipDateFormatter: TypeChartTooltipDateFormatter;
66
+ currency?: string;
67
+ numberFormat?: TypeChartNumberFormat;
68
+ /**
69
+ * The maximum number of series to display.
70
+ * @default 10
71
+ * @description We recommend limiting the number of series to 10 to maintain chart readability and accessibility.
72
+ */
73
+ seriesLimit?: number;
74
+ /**
75
+ * If false, disables the warning when the number of series exceeds the seriesLimit.
76
+ * @default true
77
+ */
78
+ showSeriesLimitWarning?: boolean;
79
+ tooltip?: ({ data, x }: TypeChartTooltipProps) => ReactNode;
80
+ yAxisLabelFormatter?: TypeChartYAxisLabelFormatter;
81
+ onClick?: ({ x }: Readonly<{
82
+ x: number;
83
+ }>) => void;
84
+ tooltipClickLabel?: ReactNode;
85
+ timeFormat?: TypeChartTimeFormat;
86
+ xAnnotations?: TypeChartXAnnotations;
87
+ xAxisLabelFormatter?: (params: {
88
+ textLocale: Intl.LocalesArgument;
89
+ tickPositions: number[];
90
+ unitName: string;
91
+ value: string | number;
92
+ timeFormat?: string;
93
+ }) => string;
94
+ }>;
95
+ interface TypeExtendedChart extends Chart {
96
+ annotations?: Annotation[];
97
+ }
98
+
99
+ export type { ExtendedTimeTicksInfoObject as E, TypeChartDataPoint as T, TypeChartDataStyles as a, TypeChartTooltipDateFormatter as b, TypeChartNumberFormat as c, TypeChartTooltipProps as d, TypeChartYAxisLabelFormatter as e, TypeChartTimeFormat as f, TypeChartXAnnotations as g, TypeChartStylePattern as h, TypeVerticalBarChartProps as i, TypeSeriesType as j, TypeChartStyleColor as k, TypeChartStyleHasOnClick as l, ExtendedAxisLabelsFormatterContextObject as m, TypeChartXAnnotationsDetails as n, TypeExtendedChart as o };
package/package.json CHANGED
@@ -1,12 +1,29 @@
1
1
  {
2
2
  "name": "@sproutsocial/seeds-react-data-viz",
3
- "version": "0.7.32",
3
+ "version": "0.14.0",
4
4
  "description": "Seeds React Data Viz Components",
5
5
  "author": "Sprout Social, Inc.",
6
6
  "license": "MIT",
7
7
  "main": "dist/index.js",
8
8
  "module": "dist/esm/index.js",
9
9
  "types": "dist/index.d.ts",
10
+ "exports": {
11
+ ".": {
12
+ "types": "./dist/index.d.ts",
13
+ "import": "./dist/esm/index.js",
14
+ "require": "./dist/index.js"
15
+ },
16
+ "./bar": {
17
+ "types": "./dist/bar/index.d.ts",
18
+ "import": "./dist/esm/bar/index.js",
19
+ "require": "./dist/bar/index.js"
20
+ },
21
+ "./export": {
22
+ "types": "./dist/export/index.d.ts",
23
+ "import": "./dist/esm/export/index.js",
24
+ "require": "./dist/export/index.js"
25
+ }
26
+ },
10
27
  "files": [
11
28
  "dist"
12
29
  ],
@@ -23,18 +40,22 @@
23
40
  "dependencies": {
24
41
  "@sproutsocial/seeds-dataviz": "^0.7.3",
25
42
  "@sproutsocial/seeds-networkcolor": "^2.22.0",
26
- "@sproutsocial/seeds-react-box": "^1.1.16",
27
- "@sproutsocial/seeds-react-duration": "^1.0.17",
28
- "@sproutsocial/seeds-react-icon": "^2.3.7",
29
- "@sproutsocial/seeds-react-numeral": "^1.0.39",
30
- "@sproutsocial/seeds-react-partner-logo": "^1.7.8",
31
- "@sproutsocial/seeds-react-system-props": "^3.0.1",
32
- "@sproutsocial/seeds-react-table": "^1.0.33",
33
- "@sproutsocial/seeds-react-text": "^1.4.0",
34
- "@sproutsocial/seeds-react-theme": "^3.6.2",
43
+ "@sproutsocial/seeds-react-box": "^1.1.21",
44
+ "@sproutsocial/seeds-react-button": "^2.2.1",
45
+ "@sproutsocial/seeds-react-duration": "^1.0.23",
46
+ "@sproutsocial/seeds-react-icon": "^2.4.0",
47
+ "@sproutsocial/seeds-react-menu": "^1.15.10",
48
+ "@sproutsocial/seeds-react-numeral": "^1.0.47",
49
+ "@sproutsocial/seeds-react-partner-logo": "^1.7.13",
50
+ "@sproutsocial/seeds-react-system-props": "^3.1.1",
51
+ "@sproutsocial/seeds-react-table": "^1.0.41",
52
+ "@sproutsocial/seeds-react-text": "^1.4.3",
53
+ "@sproutsocial/seeds-react-theme": "^4.1.0",
35
54
  "highcharts": "^11.4.3",
36
55
  "highcharts-react-official": "^3.2.1",
37
- "lodash": "^4.17.23"
56
+ "jspdf": "^4.2.1",
57
+ "lodash": "^4.17.23",
58
+ "svg2pdf.js": "^2.7.0"
38
59
  },
39
60
  "devDependencies": {
40
61
  "@sproutsocial/seeds-react-testing-library": "*",