@wick-charts/react 0.1.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/LICENSE +21 -0
- package/dist/index.cjs +1 -0
- package/dist/index.d.ts +419 -0
- package/dist/index.js +3807 -0
- package/package.json +31 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,419 @@
|
|
|
1
|
+
import { andromeda } from '@wick-charts/core';
|
|
2
|
+
import { AxisBound } from '@wick-charts/core';
|
|
3
|
+
import { AxisConfig } from '@wick-charts/core';
|
|
4
|
+
import { ayuMirage } from '@wick-charts/core';
|
|
5
|
+
import { BarSeriesOptions } from '@wick-charts/core';
|
|
6
|
+
import { BarStacking } from '@wick-charts/core';
|
|
7
|
+
import { buildTheme } from '@wick-charts/core';
|
|
8
|
+
import { CandlestickSeriesOptions } from '@wick-charts/core';
|
|
9
|
+
import { catppuccin } from '@wick-charts/core';
|
|
10
|
+
import { ChartInstance } from '@wick-charts/core';
|
|
11
|
+
import { ChartLayout } from '@wick-charts/core';
|
|
12
|
+
import { ChartOptions } from '@wick-charts/core';
|
|
13
|
+
import { ChartTheme } from '@wick-charts/core';
|
|
14
|
+
import { createTheme } from '@wick-charts/core';
|
|
15
|
+
import { CrosshairPosition } from '@wick-charts/core';
|
|
16
|
+
import { CSSProperties } from 'react';
|
|
17
|
+
import { darkTheme } from '@wick-charts/core';
|
|
18
|
+
import { detectInterval } from '@wick-charts/core';
|
|
19
|
+
import { dracula } from '@wick-charts/core';
|
|
20
|
+
import { formatDate } from '@wick-charts/core';
|
|
21
|
+
import { formatTime } from '@wick-charts/core';
|
|
22
|
+
import { githubLight } from '@wick-charts/core';
|
|
23
|
+
import { gruvbox } from '@wick-charts/core';
|
|
24
|
+
import { handwritten } from '@wick-charts/core';
|
|
25
|
+
import { highContrast } from '@wick-charts/core';
|
|
26
|
+
import { JSX as JSX_2 } from 'react/jsx-runtime';
|
|
27
|
+
import { lavenderMist } from '@wick-charts/core';
|
|
28
|
+
import { lightPink } from '@wick-charts/core';
|
|
29
|
+
import { lightTheme } from '@wick-charts/core';
|
|
30
|
+
import { LineData } from '@wick-charts/core';
|
|
31
|
+
import { LineSeriesOptions } from '@wick-charts/core';
|
|
32
|
+
import { materialPalenight } from '@wick-charts/core';
|
|
33
|
+
import { minimalLight } from '@wick-charts/core';
|
|
34
|
+
import { mintBreeze } from '@wick-charts/core';
|
|
35
|
+
import { monokaiPro } from '@wick-charts/core';
|
|
36
|
+
import { nightOwl } from '@wick-charts/core';
|
|
37
|
+
import { normalizeTime } from '@wick-charts/core';
|
|
38
|
+
import { OHLCData } from '@wick-charts/core';
|
|
39
|
+
import { OHLCInput } from '@wick-charts/core';
|
|
40
|
+
import { oneDarkPro } from '@wick-charts/core';
|
|
41
|
+
import { panda } from '@wick-charts/core';
|
|
42
|
+
import { peachCream } from '@wick-charts/core';
|
|
43
|
+
import { PieSeriesOptions } from '@wick-charts/core';
|
|
44
|
+
import { PieSliceData } from '@wick-charts/core';
|
|
45
|
+
import { Provider } from 'react';
|
|
46
|
+
import { quietLight } from '@wick-charts/core';
|
|
47
|
+
import { ReactNode } from 'react';
|
|
48
|
+
import { rosePineDawn } from '@wick-charts/core';
|
|
49
|
+
import { sandDune } from '@wick-charts/core';
|
|
50
|
+
import { SeriesType } from '@wick-charts/core';
|
|
51
|
+
import { solarizedLight } from '@wick-charts/core';
|
|
52
|
+
import { StackingMode } from '@wick-charts/core';
|
|
53
|
+
import { ThemeConfig } from '@wick-charts/core';
|
|
54
|
+
import { ThemePreset } from '@wick-charts/core';
|
|
55
|
+
import { themes } from '@wick-charts/core';
|
|
56
|
+
import { TimePoint } from '@wick-charts/core';
|
|
57
|
+
import { TimePointInput } from '@wick-charts/core';
|
|
58
|
+
import { TimeValue } from '@wick-charts/core';
|
|
59
|
+
import { Typography } from '@wick-charts/core';
|
|
60
|
+
import { VisibleRange } from '@wick-charts/core';
|
|
61
|
+
import { XAxisConfig } from '@wick-charts/core';
|
|
62
|
+
import { YAxisConfig } from '@wick-charts/core';
|
|
63
|
+
import { YRange } from '@wick-charts/core';
|
|
64
|
+
|
|
65
|
+
export { andromeda }
|
|
66
|
+
|
|
67
|
+
export { AxisBound }
|
|
68
|
+
|
|
69
|
+
export { AxisConfig }
|
|
70
|
+
|
|
71
|
+
export { ayuMirage }
|
|
72
|
+
|
|
73
|
+
export declare function BarSeries({ data, options, label, id: idProp, onSeriesId }: BarSeriesProps): null;
|
|
74
|
+
|
|
75
|
+
export { BarSeriesOptions }
|
|
76
|
+
|
|
77
|
+
declare interface BarSeriesProps {
|
|
78
|
+
/** Array of datasets — one per layer. A single-layer bar chart uses `[data]`. */
|
|
79
|
+
data: TimePoint[][];
|
|
80
|
+
options?: Partial<BarSeriesOptions>;
|
|
81
|
+
/** Display label shown in the tooltip. */
|
|
82
|
+
label?: string;
|
|
83
|
+
/** Stable series ID. Prefer this over `onSeriesId` — same value across remounts. */
|
|
84
|
+
id?: string;
|
|
85
|
+
/** @deprecated Use the `id` prop instead. */
|
|
86
|
+
onSeriesId?: (id: string) => void;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export { BarStacking }
|
|
90
|
+
|
|
91
|
+
export { buildTheme }
|
|
92
|
+
|
|
93
|
+
export declare function CandlestickSeries({ data, options, id: idProp, onSeriesId }: CandlestickSeriesProps): null;
|
|
94
|
+
|
|
95
|
+
export { CandlestickSeriesOptions }
|
|
96
|
+
|
|
97
|
+
declare interface CandlestickSeriesProps {
|
|
98
|
+
data: OHLCData[];
|
|
99
|
+
options?: Partial<CandlestickSeriesOptions>;
|
|
100
|
+
/** Stable series ID. Prefer this over `onSeriesId` — same value across remounts. */
|
|
101
|
+
id?: string;
|
|
102
|
+
/** @deprecated Use the `id` prop instead. */
|
|
103
|
+
onSeriesId?: (id: string) => void;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export { catppuccin }
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Top-level React wrapper that creates a {@link ChartInstance} and provides it to children via context.
|
|
110
|
+
* Owns the DOM container and canvas lifecycle; renders children as an overlay layer.
|
|
111
|
+
* Detects `<Legend>` children and renders them outside the chart area.
|
|
112
|
+
*/
|
|
113
|
+
export declare function ChartContainer({ children, theme, axis, padding, gradient, interactive, grid, style, className }: ChartContainerProps): JSX_2.Element;
|
|
114
|
+
|
|
115
|
+
/** Props for the {@link ChartContainer} component. */
|
|
116
|
+
declare interface ChartContainerProps {
|
|
117
|
+
/** Series components and UI overlays (Tooltip, TimeAxis, etc.) rendered inside the chart. */
|
|
118
|
+
children?: ReactNode;
|
|
119
|
+
/** Visual theme. Changing this at runtime will update all themed elements. */
|
|
120
|
+
theme?: ChartTheme;
|
|
121
|
+
/** Grouped axis configuration (Y/X visibility, bounds, sizing). */
|
|
122
|
+
axis?: AxisConfig;
|
|
123
|
+
/**
|
|
124
|
+
* Viewport padding. `top`/`bottom` are in pixels. `left`/`right` accept either pixels (`50`)
|
|
125
|
+
* or data intervals (`{ intervals: 3 }`). Set to 0 for edge-to-edge sparklines. Applied on mount only.
|
|
126
|
+
* Defaults: `{ top: 20, bottom: 20, right: { intervals: 3 }, left: { intervals: 0 } }`.
|
|
127
|
+
*/
|
|
128
|
+
padding?: {
|
|
129
|
+
top?: number;
|
|
130
|
+
bottom?: number;
|
|
131
|
+
right?: number | {
|
|
132
|
+
intervals: number;
|
|
133
|
+
};
|
|
134
|
+
left?: number | {
|
|
135
|
+
intervals: number;
|
|
136
|
+
};
|
|
137
|
+
};
|
|
138
|
+
/** Show the chart background gradient. Defaults to true. */
|
|
139
|
+
gradient?: boolean;
|
|
140
|
+
/** Enable zoom, pan, and crosshair interactions. Defaults to true. */
|
|
141
|
+
interactive?: boolean;
|
|
142
|
+
/** Show the background grid. Defaults to true. */
|
|
143
|
+
grid?: boolean;
|
|
144
|
+
style?: CSSProperties;
|
|
145
|
+
className?: string;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
export { ChartInstance }
|
|
149
|
+
|
|
150
|
+
export { ChartLayout }
|
|
151
|
+
|
|
152
|
+
export { ChartOptions }
|
|
153
|
+
|
|
154
|
+
export { ChartTheme }
|
|
155
|
+
|
|
156
|
+
export { createTheme }
|
|
157
|
+
|
|
158
|
+
export declare function Crosshair(): JSX_2.Element | null;
|
|
159
|
+
|
|
160
|
+
export { CrosshairPosition }
|
|
161
|
+
|
|
162
|
+
export { darkTheme }
|
|
163
|
+
|
|
164
|
+
export { detectInterval }
|
|
165
|
+
|
|
166
|
+
export { dracula }
|
|
167
|
+
|
|
168
|
+
export { formatDate }
|
|
169
|
+
|
|
170
|
+
export { formatTime }
|
|
171
|
+
|
|
172
|
+
export { githubLight }
|
|
173
|
+
|
|
174
|
+
export { gruvbox }
|
|
175
|
+
|
|
176
|
+
export { handwritten }
|
|
177
|
+
|
|
178
|
+
export { highContrast }
|
|
179
|
+
|
|
180
|
+
export { lavenderMist }
|
|
181
|
+
|
|
182
|
+
export declare function Legend({ items, position, mode }: LegendProps): JSX_2.Element | null;
|
|
183
|
+
|
|
184
|
+
export declare interface LegendItem {
|
|
185
|
+
label: string;
|
|
186
|
+
color: string;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
export declare interface LegendProps {
|
|
190
|
+
/** Override auto-detected items. When omitted, derived from series layers. */
|
|
191
|
+
items?: LegendItem[];
|
|
192
|
+
/** Layout position. Default: 'bottom'. */
|
|
193
|
+
position?: 'bottom' | 'right';
|
|
194
|
+
/**
|
|
195
|
+
* Click behavior:
|
|
196
|
+
* - `'toggle'` — click toggles individual items on/off (default)
|
|
197
|
+
* - `'solo'` — click shows only that item; click again shows all
|
|
198
|
+
*/
|
|
199
|
+
mode?: 'toggle' | 'solo';
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
export { lightPink }
|
|
203
|
+
|
|
204
|
+
export { lightTheme }
|
|
205
|
+
|
|
206
|
+
export { LineData }
|
|
207
|
+
|
|
208
|
+
export declare function LineSeries({ data, options, label, id: idProp, onSeriesId }: LineSeriesProps): null;
|
|
209
|
+
|
|
210
|
+
export { LineSeriesOptions }
|
|
211
|
+
|
|
212
|
+
declare interface LineSeriesProps {
|
|
213
|
+
/** Array of datasets — one per layer. A single line uses `[data]`. */
|
|
214
|
+
data: TimePoint[][];
|
|
215
|
+
options?: Partial<LineSeriesOptions>;
|
|
216
|
+
label?: string;
|
|
217
|
+
/** Stable series ID. Prefer this over `onSeriesId` — same value across remounts. */
|
|
218
|
+
id?: string;
|
|
219
|
+
/** @deprecated Use the `id` prop instead. */
|
|
220
|
+
onSeriesId?: (id: string) => void;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
export { materialPalenight }
|
|
224
|
+
|
|
225
|
+
export { minimalLight }
|
|
226
|
+
|
|
227
|
+
export { mintBreeze }
|
|
228
|
+
|
|
229
|
+
export { monokaiPro }
|
|
230
|
+
|
|
231
|
+
export { nightOwl }
|
|
232
|
+
|
|
233
|
+
export { normalizeTime }
|
|
234
|
+
|
|
235
|
+
export declare function NumberFlow({ value, format, locale, spinDuration, className, style }: NumberFlowProps): JSX_2.Element;
|
|
236
|
+
|
|
237
|
+
declare interface NumberFlowProps {
|
|
238
|
+
value: number;
|
|
239
|
+
format?: Intl.NumberFormatOptions;
|
|
240
|
+
locale?: string;
|
|
241
|
+
spinDuration?: number;
|
|
242
|
+
className?: string;
|
|
243
|
+
style?: CSSProperties;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
export { OHLCData }
|
|
247
|
+
|
|
248
|
+
export { OHLCInput }
|
|
249
|
+
|
|
250
|
+
export { oneDarkPro }
|
|
251
|
+
|
|
252
|
+
export { panda }
|
|
253
|
+
|
|
254
|
+
export { peachCream }
|
|
255
|
+
|
|
256
|
+
export declare function PieLegend({ seriesId, format }: PieLegendProps): JSX_2.Element | null;
|
|
257
|
+
|
|
258
|
+
export declare type PieLegendFormat = 'value' | 'percent';
|
|
259
|
+
|
|
260
|
+
export declare interface PieLegendProps {
|
|
261
|
+
seriesId: string;
|
|
262
|
+
/** Display format: 'value' shows absolute + percent, 'percent' shows only percent. Default: 'value'. */
|
|
263
|
+
format?: PieLegendFormat;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
/** Pie chart series. Set `options.innerRadiusRatio` > 0 for donut. */
|
|
267
|
+
export declare function PieSeries({ data, options, id: idProp, onSeriesId }: PieSeriesProps): null;
|
|
268
|
+
|
|
269
|
+
export { PieSeriesOptions }
|
|
270
|
+
|
|
271
|
+
declare interface PieSeriesProps {
|
|
272
|
+
data: PieSliceData[];
|
|
273
|
+
options?: Partial<PieSeriesOptions>;
|
|
274
|
+
/** Stable series ID. Prefer this over `onSeriesId` — same value across remounts. */
|
|
275
|
+
id?: string;
|
|
276
|
+
/** @deprecated Use the `id` prop instead. */
|
|
277
|
+
onSeriesId?: (id: string) => void;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
export { PieSliceData }
|
|
281
|
+
|
|
282
|
+
/** Tooltip for pie/donut charts. Shows hovered slice label, value, and percentage. */
|
|
283
|
+
export declare function PieTooltip({ seriesId }: PieTooltipProps): JSX_2.Element | null;
|
|
284
|
+
|
|
285
|
+
declare interface PieTooltipProps {
|
|
286
|
+
seriesId: string;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
export { quietLight }
|
|
290
|
+
|
|
291
|
+
export { rosePineDawn }
|
|
292
|
+
|
|
293
|
+
export { sandDune }
|
|
294
|
+
|
|
295
|
+
export { SeriesType }
|
|
296
|
+
|
|
297
|
+
export { solarizedLight }
|
|
298
|
+
|
|
299
|
+
export declare function Sparkline({ data, theme, variant, valuePosition, formatValue, label, sublabel, color, negativeColor, areaFill, width, height, lineWidth, gradient, style, }: SparklineProps): JSX_2.Element;
|
|
300
|
+
|
|
301
|
+
export declare interface SparklineProps {
|
|
302
|
+
data: TimePoint[];
|
|
303
|
+
theme: ChartTheme;
|
|
304
|
+
/** 'line' (default) or 'bar' */
|
|
305
|
+
variant?: SparklineVariant;
|
|
306
|
+
/** Where to show the value label */
|
|
307
|
+
valuePosition?: SparklineValuePosition;
|
|
308
|
+
/** Custom format for the value */
|
|
309
|
+
formatValue?: (value: number) => string;
|
|
310
|
+
/** Label text above the value */
|
|
311
|
+
label?: string;
|
|
312
|
+
/** Sublabel text below the value (defaults to the change %) */
|
|
313
|
+
sublabel?: string;
|
|
314
|
+
/** Line/bar color override (defaults to theme) */
|
|
315
|
+
color?: string;
|
|
316
|
+
/** Secondary color for negative bars */
|
|
317
|
+
negativeColor?: string;
|
|
318
|
+
/** Show area fill under line */
|
|
319
|
+
areaFill?: boolean;
|
|
320
|
+
/** Chart width (default: 140) */
|
|
321
|
+
width?: number;
|
|
322
|
+
/** Overall height (default: 48) */
|
|
323
|
+
height?: number;
|
|
324
|
+
/** Line width (default: 1.5) */
|
|
325
|
+
lineWidth?: number;
|
|
326
|
+
/** Show chart background gradient (default: true) */
|
|
327
|
+
gradient?: boolean;
|
|
328
|
+
/** Container style override */
|
|
329
|
+
style?: CSSProperties;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
export declare type SparklineValuePosition = 'left' | 'right' | 'none';
|
|
333
|
+
|
|
334
|
+
export declare type SparklineVariant = 'line' | 'bar';
|
|
335
|
+
|
|
336
|
+
export { StackingMode }
|
|
337
|
+
|
|
338
|
+
export { ThemeConfig }
|
|
339
|
+
|
|
340
|
+
export { ThemePreset }
|
|
341
|
+
|
|
342
|
+
export declare const ThemeProvider: Provider<ChartTheme | null>;
|
|
343
|
+
|
|
344
|
+
export { themes }
|
|
345
|
+
|
|
346
|
+
declare function TimeAxis(): JSX_2.Element;
|
|
347
|
+
export { TimeAxis }
|
|
348
|
+
export { TimeAxis as XAxis }
|
|
349
|
+
|
|
350
|
+
export { TimePoint }
|
|
351
|
+
|
|
352
|
+
export { TimePointInput }
|
|
353
|
+
|
|
354
|
+
export { TimeValue }
|
|
355
|
+
|
|
356
|
+
/**
|
|
357
|
+
* Two-part tooltip:
|
|
358
|
+
* 1. Compact legend always visible in top-left
|
|
359
|
+
* 2. Floating glass tooltip near cursor on hover
|
|
360
|
+
*/
|
|
361
|
+
export declare function Tooltip({ seriesId, sort, showLegend, legend }: TooltipProps): JSX_2.Element | null;
|
|
362
|
+
|
|
363
|
+
/**
|
|
364
|
+
* Props for the {@link Tooltip} component.
|
|
365
|
+
* By default shows all series. Use `seriesId` to show one, or `sort` to order values.
|
|
366
|
+
*/
|
|
367
|
+
declare interface TooltipProps {
|
|
368
|
+
/** Show only this series. When omitted, show all series. */
|
|
369
|
+
seriesId?: string;
|
|
370
|
+
/** Sort order for line values when showing all series (default: 'none'). */
|
|
371
|
+
sort?: TooltipSort;
|
|
372
|
+
/** Show the compact legend strip in the top-left corner (default: true). */
|
|
373
|
+
showLegend?: boolean;
|
|
374
|
+
/** @deprecated Use `showLegend` instead. */
|
|
375
|
+
legend?: boolean;
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
/** Sort order for multi-series tooltip values. */
|
|
379
|
+
export declare type TooltipSort = 'none' | 'asc' | 'desc';
|
|
380
|
+
|
|
381
|
+
export { Typography }
|
|
382
|
+
|
|
383
|
+
export declare function useChartInstance(): ChartInstance;
|
|
384
|
+
|
|
385
|
+
export declare function useCrosshairPosition(chart: ChartInstance): CrosshairPosition | null;
|
|
386
|
+
|
|
387
|
+
export declare function useLastYValue(chart: ChartInstance, seriesId: string): {
|
|
388
|
+
value: number;
|
|
389
|
+
isLive: boolean;
|
|
390
|
+
} | null;
|
|
391
|
+
|
|
392
|
+
export declare function usePreviousClose(chart: ChartInstance, seriesId: string): number | null;
|
|
393
|
+
|
|
394
|
+
/** Read the current chart theme from context. Must be inside a ThemeProvider. */
|
|
395
|
+
export declare function useTheme(): ChartTheme;
|
|
396
|
+
|
|
397
|
+
export declare function useVisibleRange(chart: ChartInstance): VisibleRange;
|
|
398
|
+
|
|
399
|
+
export declare function useYRange(chart: ChartInstance): YRange;
|
|
400
|
+
|
|
401
|
+
export { VisibleRange }
|
|
402
|
+
|
|
403
|
+
export { XAxisConfig }
|
|
404
|
+
|
|
405
|
+
export declare function YAxis(): JSX_2.Element;
|
|
406
|
+
|
|
407
|
+
export { YAxisConfig }
|
|
408
|
+
|
|
409
|
+
export declare function YLabel({ seriesId, color }: YLabelProps): JSX_2.Element | null;
|
|
410
|
+
|
|
411
|
+
declare interface YLabelProps {
|
|
412
|
+
seriesId: string;
|
|
413
|
+
/** Override badge color (e.g. line color). If not set, uses up/down/neutral from theme. */
|
|
414
|
+
color?: string;
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
export { YRange }
|
|
418
|
+
|
|
419
|
+
export { }
|