@overdoser/react-toolkit 0.0.13 → 0.0.15
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/components/Chart/TradingChart.d.ts +33 -4
- package/components/Chart/trading/period.d.ts +3 -0
- package/components/Chart/trading/types.d.ts +5 -1
- package/index.js +2044 -1952
- package/llms.txt +5 -2
- package/manifest.json +4 -1
- package/package.json +1 -1
|
@@ -5,9 +5,14 @@ export interface TradingChartProps {
|
|
|
5
5
|
symbol: string;
|
|
6
6
|
resolution: Resolution;
|
|
7
7
|
/**
|
|
8
|
-
* Visible time-range window (e.g. `'1D'`, `'5D'`, `'1M'`, `'1Y'`, `'5Y'
|
|
9
|
-
* When set, the chart fetches bars for the last `period` of time
|
|
10
|
-
* initial visible range covers the whole window. Overrides
|
|
8
|
+
* Visible time-range window (e.g. `'1D'`, `'5D'`, `'1M'`, `'1Y'`, `'5Y'`,
|
|
9
|
+
* `'10Y'`, `'20Y'`, `'MAX'`). When set, the chart fetches bars for the last `period` of time
|
|
10
|
+
* and the initial visible range covers the whole window. Overrides
|
|
11
|
+
* `initialLookback`.
|
|
12
|
+
*
|
|
13
|
+
* `'MAX'` requests `from: 0` (epoch) — the chart renders whatever the
|
|
14
|
+
* datafeed returns. Pair with a coarse `resolution` (`'W'` or `'M'`) so the
|
|
15
|
+
* bar count stays manageable.
|
|
11
16
|
*
|
|
12
17
|
* The chart does not auto-adjust `resolution` when `period` changes — use
|
|
13
18
|
* `suggestResolutionForPeriod()` / `suggestPeriodForResolution()` if you
|
|
@@ -47,6 +52,30 @@ export interface TradingChartProps {
|
|
|
47
52
|
* here in the future. @default true
|
|
48
53
|
*/
|
|
49
54
|
showConfigPanel?: boolean;
|
|
55
|
+
/**
|
|
56
|
+
* When `true`, the top cursor-value badge is tinted by bar direction
|
|
57
|
+
* (`upColor` for `close >= open`, `downColor` otherwise) with white text.
|
|
58
|
+
* When `false`, the badge uses the same neutral palette as the bottom
|
|
59
|
+
* datetime badge. @default false
|
|
60
|
+
*/
|
|
61
|
+
priceBadgeColorByDirection?: boolean;
|
|
62
|
+
/**
|
|
63
|
+
* When `true`, the top cursor-value badge appends a date (for `'D'` /
|
|
64
|
+
* `'W'` / `'M'` resolutions) or a weekday+date+time (for intraday
|
|
65
|
+
* resolutions) after the price, separated by ` · `. Honours `timezone`.
|
|
66
|
+
* Default formats:
|
|
67
|
+
* - D / W / M → `17 Sep 2025`
|
|
68
|
+
* - intraday → `Wed 17 Sep 14:30`
|
|
69
|
+
* @default false
|
|
70
|
+
*/
|
|
71
|
+
priceBadgeShowTime?: boolean;
|
|
72
|
+
/**
|
|
73
|
+
* Optional override for the time portion when `priceBadgeShowTime` is on.
|
|
74
|
+
* Receives the bar's unix-seconds time, the current `resolution`, and the
|
|
75
|
+
* chart's `timezone`. Return whatever string you want appended after the
|
|
76
|
+
* price. Returning an empty string suppresses the suffix for that hover.
|
|
77
|
+
*/
|
|
78
|
+
priceBadgeTimeFormat?: (unixSec: number, resolution: Resolution, timezone: Timezone) => string;
|
|
50
79
|
/** Fired when the crosshair moves (`null` when leaving the chart). */
|
|
51
80
|
onCrosshair?: (info: CrosshairInfo | null) => void;
|
|
52
81
|
/** Fired after pan / zoom / data updates. */
|
|
@@ -78,7 +107,7 @@ export interface TradingChartProps {
|
|
|
78
107
|
* ]}
|
|
79
108
|
* />
|
|
80
109
|
*/
|
|
81
|
-
export declare function TradingChart({ datafeed, symbol, resolution, period, seriesType, indicators, precision, initialLookback, height, upColor, downColor, lineColor, timezone, defaultTimezone, onTimezoneChange, showConfigPanel, onCrosshair, onVisibleRangeChange, className, style, }: TradingChartProps): import("react/jsx-runtime").JSX.Element;
|
|
110
|
+
export declare function TradingChart({ datafeed, symbol, resolution, period, seriesType, indicators, precision, initialLookback, height, upColor, downColor, lineColor, timezone, defaultTimezone, onTimezoneChange, showConfigPanel, priceBadgeColorByDirection, priceBadgeShowTime, priceBadgeTimeFormat, onCrosshair, onVisibleRangeChange, className, style, }: TradingChartProps): import("react/jsx-runtime").JSX.Element;
|
|
82
111
|
/**
|
|
83
112
|
* Full crosshair date/time label with a timezone tag.
|
|
84
113
|
* Format: `YYYY-MM-DD HH:MM:SS <tz>` — `<tz>` is `+HH:MM` for local,
|
|
@@ -3,6 +3,9 @@ import { Period, Resolution } from './types';
|
|
|
3
3
|
* Convert a `Period` string to seconds. Accepts the typed presets as well as
|
|
4
4
|
* any `<n><unit>` string where unit is `h` / `d` / `w` / `m` / `y`
|
|
5
5
|
* (case-insensitive). Falls back to 30 days on unparseable input.
|
|
6
|
+
*
|
|
7
|
+
* `'MAX'` is reported as 100 years — large enough to cover any realistic
|
|
8
|
+
* asset history. The chart special-cases it to fetch `from: 0` (epoch).
|
|
6
9
|
*/
|
|
7
10
|
export declare function periodToSeconds(period: Period): number;
|
|
8
11
|
/**
|
|
@@ -26,8 +26,12 @@ export type Resolution = '1' | '3' | '5' | '15' | '30' | '60' | '120' | '240' |
|
|
|
26
26
|
* Visible time-range window. Drives the initial X-axis span of the chart.
|
|
27
27
|
* Common presets are typed; any other `<n><unit>` string (`'30d'`, `'2y'`,
|
|
28
28
|
* `'48h'`, …) is accepted and parsed.
|
|
29
|
+
*
|
|
30
|
+
* `'MAX'` is a special preset: the chart requests bars `from: 0` (epoch) to
|
|
31
|
+
* now and renders whatever range the datafeed supplies. Best paired with a
|
|
32
|
+
* coarse `resolution` ('W' or 'M') so the bar count stays reasonable.
|
|
29
33
|
*/
|
|
30
|
-
export type Period = '1D' | '5D' | '1M' | '3M' | '6M' | '1Y' | '5Y' | (string & {});
|
|
34
|
+
export type Period = '1D' | '5D' | '1M' | '3M' | '6M' | '1Y' | '5Y' | '10Y' | '20Y' | 'MAX' | (string & {});
|
|
31
35
|
/**
|
|
32
36
|
* Timezone used to render the crosshair date/time label.
|
|
33
37
|
* - `'local'` — the user's local timezone (offset shown as `+HH:MM`).
|