@opendata-ai/openchart-react 7.11.0 → 8.0.0-rc.10
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/index.d.ts +65 -5
- package/dist/index.js +298 -81
- package/dist/index.js.map +1 -1
- package/dist/styles.css +2 -1
- package/dist/styles.css.map +1 -0
- package/package.json +4 -4
- package/src/Chart.tsx +21 -0
- package/src/ChartStory.tsx +203 -0
- package/src/Map.tsx +130 -0
- package/src/Visualization.tsx +7 -0
- package/src/__tests__/ChartStory.test.tsx +92 -0
- package/src/index.ts +7 -0
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import * as _opendata_ai_openchart_core from '@opendata-ai/openchart-core';
|
|
2
|
-
import { BarListSpec, ThemeConfig, DarkMode, DataRow, ChartEventHandlers, ChartSpec, LayerSpec, GraphSpec, ElementRef, TableSpec, SortState, ChartLayout, SankeySpec, TileMapSpec, VizSpec } from '@opendata-ai/openchart-core';
|
|
2
|
+
import { BarListSpec, ThemeConfig, DarkMode, DataRow, ChartEventHandlers, ChartSpec, LayerSpec, GraphSpec, ElementRef, MapSpec, TableSpec, SortState, ChartLayout, SankeySpec, TileMapSpec, VizSpec } from '@opendata-ai/openchart-core';
|
|
3
3
|
export * from '@opendata-ai/openchart-core';
|
|
4
|
-
import { BarListInstance, ChartInstance,
|
|
4
|
+
import { BarListInstance, ChartInstance, MountOptions, GraphInstance, TableInstance, TableState, TableMountOptions, MapMarkEvent, MapInstance, SankeyInstance, TileMapInstance } from '@opendata-ai/openchart-vanilla';
|
|
5
5
|
export { JPGExportOptions, PNGExportOptions, SVGExportOptions, exportCSV, exportJPG, exportPNG, exportSVG, exportSVGWithFonts } from '@opendata-ai/openchart-vanilla';
|
|
6
|
-
export { ChartRenderer, CompileResult, CompiledGraphEdge, CompiledGraphNode, GraphCompilation, NormalizedBarListSpec, NormalizedChartSpec, NormalizedChrome, NormalizedGraphSpec, NormalizedSankeySpec, NormalizedSpec, NormalizedTableSpec, NormalizedTileMapSpec, SimulationConfig, ValidationError, ValidationErrorCode, ValidationResult, clearRenderers, compile, compileBarList, compileChart, compileGraph, compileSankey, compileTable, compileTileMap, getChartRenderer, normalizeSpec, registerChartRenderer, validateSpec } from '@opendata-ai/openchart-engine';
|
|
6
|
+
export { ChartRenderer, CompileResult, CompiledGraphEdge, CompiledGraphNode, GraphCompilation, NormalizedBarListSpec, NormalizedChartSpec, NormalizedChrome, NormalizedGraphSpec, NormalizedMapSpec, NormalizedSankeySpec, NormalizedSpec, NormalizedTableSpec, NormalizedTileMapSpec, SimulationConfig, ValidationError, ValidationErrorCode, ValidationResult, clearRenderers, compile, compileBarList, compileChart, compileGraph, compileMap, compileSankey, compileTable, compileTileMap, getChartRenderer, normalizeSpec, registerChartRenderer, validateSpec } from '@opendata-ai/openchart-engine';
|
|
7
7
|
import * as react from 'react';
|
|
8
|
-
import { CSSProperties, ReactNode } from 'react';
|
|
8
|
+
import { CSSProperties, ReactNode, Ref } from 'react';
|
|
9
9
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
10
|
+
import { ChartStoryOptions, ChartStoryInstance } from '@opendata-ai/openchart-vanilla/story';
|
|
10
11
|
|
|
11
12
|
interface BarListProps {
|
|
12
13
|
spec: BarListSpec;
|
|
@@ -81,6 +82,43 @@ declare const Chart: <TData extends DataRow = DataRow>(props: ChartProps<TData>
|
|
|
81
82
|
ref?: React.Ref<ChartHandle>;
|
|
82
83
|
}) => React.ReactElement | null;
|
|
83
84
|
|
|
85
|
+
interface ChartStoryHandle {
|
|
86
|
+
/** Jump the story to a step index (applies patches 0..n, animates the diff). */
|
|
87
|
+
goTo(index: number): void;
|
|
88
|
+
/** The underlying vanilla story instance, or null before mount. */
|
|
89
|
+
readonly instance: ChartStoryInstance | null;
|
|
90
|
+
}
|
|
91
|
+
interface ChartStoryProps<TData extends DataRow = DataRow> {
|
|
92
|
+
/** Base spec the story drives. */
|
|
93
|
+
spec: ChartSpec<TData> | LayerSpec<TData> | GraphSpec | MapSpec;
|
|
94
|
+
/** Ordered step patches. `steps[i]` is applied cumulatively onto the base. */
|
|
95
|
+
steps: ChartStoryOptions<TData>['steps'];
|
|
96
|
+
/**
|
|
97
|
+
* Narrative content per step: `narrative[i]` renders in the scrolling column
|
|
98
|
+
* beside the sticky chart and triggers step `i` when it crosses the trigger
|
|
99
|
+
* line. Length should match `steps`.
|
|
100
|
+
*/
|
|
101
|
+
narrative: ReactNode[];
|
|
102
|
+
/**
|
|
103
|
+
* Controlled step index. When provided, the built-in scroll driver is left
|
|
104
|
+
* in place but `goTo` is called on change so an external scroller can drive.
|
|
105
|
+
* Omit for self-driving scroll.
|
|
106
|
+
*/
|
|
107
|
+
step?: number;
|
|
108
|
+
/** Fraction of viewport height where the scroll trigger sits. Default 0.4. */
|
|
109
|
+
triggerPosition?: number;
|
|
110
|
+
/** Camera driving mode. Default 'step'. */
|
|
111
|
+
cameraMode?: 'step' | 'scrub';
|
|
112
|
+
/** Options forwarded to the underlying chart mount (theme, dark mode, etc.). */
|
|
113
|
+
mountOptions?: MountOptions;
|
|
114
|
+
/** Class on the outer section. */
|
|
115
|
+
className?: string;
|
|
116
|
+
/** Inline styles merged onto the outer section. */
|
|
117
|
+
style?: CSSProperties;
|
|
118
|
+
ref?: Ref<ChartStoryHandle>;
|
|
119
|
+
}
|
|
120
|
+
declare function ChartStory<TData extends DataRow = DataRow>({ spec, steps, narrative, step, triggerPosition, cameraMode, mountOptions, className, style, ref, }: ChartStoryProps<TData>): react_jsx_runtime.JSX.Element;
|
|
121
|
+
|
|
84
122
|
interface DataTableProps {
|
|
85
123
|
/** The table spec to render. */
|
|
86
124
|
spec: TableSpec;
|
|
@@ -311,6 +349,28 @@ interface UseTableStateOptions {
|
|
|
311
349
|
*/
|
|
312
350
|
declare function useTableState(initialState?: UseTableStateOptions): UseTableStateReturn;
|
|
313
351
|
|
|
352
|
+
interface MapProps {
|
|
353
|
+
/** The map spec to render. */
|
|
354
|
+
spec: MapSpec;
|
|
355
|
+
/** Theme overrides. */
|
|
356
|
+
theme?: ThemeConfig;
|
|
357
|
+
/** Dark mode: "auto", "force", or "off". */
|
|
358
|
+
darkMode?: DarkMode;
|
|
359
|
+
/** Callback when a map feature is clicked. */
|
|
360
|
+
onMarkClick?: (feature: MapMarkEvent) => void;
|
|
361
|
+
/** Callback when a map feature is hovered (null when hover ends). */
|
|
362
|
+
onMarkHover?: (feature: MapMarkEvent | null) => void;
|
|
363
|
+
/** CSS class name for the wrapper div. */
|
|
364
|
+
className?: string;
|
|
365
|
+
/** Inline styles for the wrapper div. */
|
|
366
|
+
style?: CSSProperties;
|
|
367
|
+
}
|
|
368
|
+
interface MapHandle {
|
|
369
|
+
/** The underlying map instance (null until mounted). */
|
|
370
|
+
readonly instance: MapInstance | null;
|
|
371
|
+
}
|
|
372
|
+
declare const GeoMap: react.ForwardRefExoticComponent<MapProps & react.RefAttributes<MapHandle>>;
|
|
373
|
+
|
|
314
374
|
interface SankeyProps {
|
|
315
375
|
/** The sankey spec to render. */
|
|
316
376
|
spec: SankeySpec;
|
|
@@ -417,4 +477,4 @@ interface VisualizationProps {
|
|
|
417
477
|
*/
|
|
418
478
|
declare function Visualization({ spec, theme, darkMode, className, style }: VisualizationProps): react_jsx_runtime.JSX.Element;
|
|
419
479
|
|
|
420
|
-
export { BarList, type BarListHandle, type BarListProps, Chart, type ChartHandle, type ChartProps, DataTable, type DataTableProps, Graph, type GraphHandle, type GraphProps, Sankey, type SankeyHandle, type SankeyProps, TileMap, type TileMapHandle, type TileMapProps, type UseChartOptions, type UseChartReturn, type UseGraphReturn, type UseTableReturn, type UseTableStateOptions, type UseTableStateReturn, Visualization, type VisualizationProps, VizThemeProvider, type VizThemeProviderProps, useChart, useDarkMode, useGraph, useTable, useTableState, useVizDarkMode, useVizTheme };
|
|
480
|
+
export { BarList, type BarListHandle, type BarListProps, Chart, type ChartHandle, type ChartProps, ChartStory, type ChartStoryHandle, type ChartStoryProps, DataTable, type DataTableProps, GeoMap, Graph, type GraphHandle, type GraphProps, type MapHandle, type MapProps, Sankey, type SankeyHandle, type SankeyProps, TileMap, type TileMapHandle, type TileMapProps, type UseChartOptions, type UseChartReturn, type UseGraphReturn, type UseTableReturn, type UseTableStateOptions, type UseTableStateReturn, Visualization, type VisualizationProps, VizThemeProvider, type VizThemeProviderProps, useChart, useDarkMode, useGraph, useTable, useTableState, useVizDarkMode, useVizTheme };
|