@ledgerhq/lumen-ui-rnative-visualization 0.1.10 → 0.1.12
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/module/lib/Components/Axis/XAxis/XAxis.js +1 -1
- package/dist/module/lib/Components/Axis/XAxis/XAxis.js.map +1 -1
- package/dist/module/lib/Components/Axis/YAxis/YAxis.js +1 -1
- package/dist/module/lib/Components/Axis/YAxis/YAxis.js.map +1 -1
- package/dist/module/lib/Components/CartesianChart/CartesianChart.js +31 -28
- package/dist/module/lib/Components/CartesianChart/CartesianChart.js.map +1 -1
- package/dist/module/lib/Components/CartesianChart/RevealClip/RevealClipDefs.js +58 -0
- package/dist/module/lib/Components/CartesianChart/RevealClip/RevealClipDefs.js.map +1 -0
- package/dist/module/lib/Components/CartesianChart/RevealClip/RevealClipDefs.test.js +144 -0
- package/dist/module/lib/Components/CartesianChart/RevealClip/RevealClipDefs.test.js.map +1 -0
- package/dist/module/lib/Components/CartesianChart/RevealClip/context.js +8 -0
- package/dist/module/lib/Components/CartesianChart/RevealClip/context.js.map +1 -0
- package/dist/module/lib/Components/CartesianChart/RevealClip/index.js +5 -0
- package/dist/module/lib/Components/CartesianChart/RevealClip/index.js.map +1 -0
- package/dist/module/lib/Components/CartesianChart/RevealClip/types.js +4 -0
- package/dist/module/lib/Components/CartesianChart/RevealClip/types.js.map +1 -0
- package/dist/module/lib/Components/CartesianChart/RevealClip/utils.js +32 -0
- package/dist/module/lib/Components/CartesianChart/RevealClip/utils.js.map +1 -0
- package/dist/module/lib/Components/CartesianChart/utils.js +4 -4
- package/dist/module/lib/Components/Line/Line.js +5 -2
- package/dist/module/lib/Components/Line/Line.js.map +1 -1
- package/dist/module/lib/Components/LineChart/LineChart.js +7 -1
- package/dist/module/lib/Components/LineChart/LineChart.js.map +1 -1
- package/dist/module/lib/Components/LineChart/LineChart.test.js +25 -0
- package/dist/module/lib/Components/LineChart/LineChart.test.js.map +1 -1
- package/dist/module/lib/Components/Point/Point.js +3 -0
- package/dist/module/lib/Components/Point/Point.js.map +1 -1
- package/dist/module/lib/Components/ReferenceLine/ReferenceLine.js +125 -0
- package/dist/module/lib/Components/ReferenceLine/ReferenceLine.js.map +1 -0
- package/dist/module/lib/Components/ReferenceLine/ReferenceLine.stories.js +111 -0
- package/dist/module/lib/Components/ReferenceLine/ReferenceLine.stories.js.map +1 -0
- package/dist/module/lib/Components/ReferenceLine/ReferenceLine.test.js +338 -0
- package/dist/module/lib/Components/ReferenceLine/ReferenceLine.test.js.map +1 -0
- package/dist/module/lib/Components/ReferenceLine/constants.js +5 -0
- package/dist/module/lib/Components/ReferenceLine/constants.js.map +1 -0
- package/dist/module/lib/Components/ReferenceLine/index.js +5 -0
- package/dist/module/lib/Components/ReferenceLine/index.js.map +1 -0
- package/dist/module/lib/Components/ReferenceLine/types.js +2 -0
- package/dist/module/lib/Components/ReferenceLine/types.js.map +1 -0
- package/dist/module/lib/Components/ReferenceLine/utils.js +121 -0
- package/dist/module/lib/Components/ReferenceLine/utils.js.map +1 -0
- package/dist/module/lib/Components/ReferenceLine/utils.test.js +297 -0
- package/dist/module/lib/Components/ReferenceLine/utils.test.js.map +1 -0
- package/dist/module/lib/Components/Scrubber/Scrubber.js +152 -0
- package/dist/module/lib/Components/Scrubber/Scrubber.js.map +1 -0
- package/dist/module/lib/Components/Scrubber/Scrubber.stories.js +113 -0
- package/dist/module/lib/Components/Scrubber/Scrubber.stories.js.map +1 -0
- package/dist/module/lib/Components/Scrubber/Scrubber.test.js +132 -0
- package/dist/module/lib/Components/Scrubber/Scrubber.test.js.map +1 -0
- package/dist/module/lib/Components/Scrubber/ScrubberProvider.js +105 -0
- package/dist/module/lib/Components/Scrubber/ScrubberProvider.js.map +1 -0
- package/dist/module/lib/Components/Scrubber/ScrubberProvider.test.js +217 -0
- package/dist/module/lib/Components/Scrubber/ScrubberProvider.test.js.map +1 -0
- package/dist/module/lib/Components/Scrubber/constants.js +10 -0
- package/dist/module/lib/Components/Scrubber/constants.js.map +1 -0
- package/dist/module/lib/Components/Scrubber/context/index.js +4 -0
- package/dist/module/lib/Components/Scrubber/context/index.js.map +1 -0
- package/dist/module/lib/Components/Scrubber/context/scrubberContext.js +10 -0
- package/dist/module/lib/Components/Scrubber/context/scrubberContext.js.map +1 -0
- package/dist/module/lib/Components/Scrubber/index.js +5 -0
- package/dist/module/lib/Components/Scrubber/index.js.map +1 -0
- package/dist/module/lib/Components/Scrubber/types.js +4 -0
- package/dist/module/lib/Components/Scrubber/types.js.map +1 -0
- package/dist/module/lib/Components/Scrubber/utils.js +83 -0
- package/dist/module/lib/Components/Scrubber/utils.js.map +1 -0
- package/dist/module/lib/Components/Scrubber/utils.test.js +192 -0
- package/dist/module/lib/Components/Scrubber/utils.test.js.map +1 -0
- package/dist/module/lib/Components/index.js +2 -0
- package/dist/module/lib/Components/index.js.map +1 -1
- package/dist/module/lib/utils/scales/scales.js +16 -8
- package/dist/module/lib/utils/scales/scales.js.map +1 -1
- package/dist/module/lib/utils/scales/scales.test.js +32 -1
- package/dist/module/lib/utils/scales/scales.test.js.map +1 -1
- package/dist/typescript/src/lib/Components/CartesianChart/CartesianChart.d.ts +1 -1
- package/dist/typescript/src/lib/Components/CartesianChart/CartesianChart.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/CartesianChart/RevealClip/RevealClipDefs.d.ts +3 -0
- package/dist/typescript/src/lib/Components/CartesianChart/RevealClip/RevealClipDefs.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/CartesianChart/RevealClip/context.d.ts +7 -0
- package/dist/typescript/src/lib/Components/CartesianChart/RevealClip/context.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/CartesianChart/RevealClip/index.d.ts +3 -0
- package/dist/typescript/src/lib/Components/CartesianChart/RevealClip/index.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/CartesianChart/RevealClip/types.d.ts +38 -0
- package/dist/typescript/src/lib/Components/CartesianChart/RevealClip/types.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/CartesianChart/RevealClip/utils.d.ts +17 -0
- package/dist/typescript/src/lib/Components/CartesianChart/RevealClip/utils.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/CartesianChart/types.d.ts +17 -0
- package/dist/typescript/src/lib/Components/CartesianChart/types.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/Line/Line.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/LineChart/LineChart.d.ts +1 -1
- package/dist/typescript/src/lib/Components/LineChart/LineChart.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/LineChart/types.d.ts +16 -0
- package/dist/typescript/src/lib/Components/LineChart/types.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/Point/Point.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/ReferenceLine/ReferenceLine.d.ts +3 -0
- package/dist/typescript/src/lib/Components/ReferenceLine/ReferenceLine.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/ReferenceLine/constants.d.ts +3 -0
- package/dist/typescript/src/lib/Components/ReferenceLine/constants.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/ReferenceLine/index.d.ts +3 -0
- package/dist/typescript/src/lib/Components/ReferenceLine/index.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/ReferenceLine/types.d.ts +74 -0
- package/dist/typescript/src/lib/Components/ReferenceLine/types.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/ReferenceLine/utils.d.ts +55 -0
- package/dist/typescript/src/lib/Components/ReferenceLine/utils.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/Scrubber/Scrubber.d.ts +17 -0
- package/dist/typescript/src/lib/Components/Scrubber/Scrubber.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/Scrubber/ScrubberProvider.d.ts +16 -0
- package/dist/typescript/src/lib/Components/Scrubber/ScrubberProvider.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/Scrubber/constants.d.ts +8 -0
- package/dist/typescript/src/lib/Components/Scrubber/constants.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/Scrubber/context/index.d.ts +2 -0
- package/dist/typescript/src/lib/Components/Scrubber/context/index.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/Scrubber/context/scrubberContext.d.ts +8 -0
- package/dist/typescript/src/lib/Components/Scrubber/context/scrubberContext.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/Scrubber/index.d.ts +4 -0
- package/dist/typescript/src/lib/Components/Scrubber/index.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/Scrubber/types.d.ts +57 -0
- package/dist/typescript/src/lib/Components/Scrubber/types.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/Scrubber/utils.d.ts +22 -0
- package/dist/typescript/src/lib/Components/Scrubber/utils.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/index.d.ts +2 -0
- package/dist/typescript/src/lib/Components/index.d.ts.map +1 -1
- package/dist/typescript/src/lib/utils/scales/scales.d.ts +6 -0
- package/dist/typescript/src/lib/utils/scales/scales.d.ts.map +1 -1
- package/package.json +6 -3
- package/src/lib/Components/Axis/XAxis/XAxis.tsx +1 -1
- package/src/lib/Components/Axis/YAxis/YAxis.tsx +1 -1
- package/src/lib/Components/CartesianChart/CartesianChart.tsx +32 -32
- package/src/lib/Components/CartesianChart/RevealClip/RevealClipDefs.test.tsx +129 -0
- package/src/lib/Components/CartesianChart/RevealClip/RevealClipDefs.tsx +65 -0
- package/src/lib/Components/CartesianChart/RevealClip/context.ts +13 -0
- package/src/lib/Components/CartesianChart/RevealClip/index.ts +2 -0
- package/src/lib/Components/CartesianChart/RevealClip/types.ts +38 -0
- package/src/lib/Components/CartesianChart/RevealClip/utils.ts +51 -0
- package/src/lib/Components/CartesianChart/types.ts +17 -0
- package/src/lib/Components/CartesianChart/utils.ts +4 -4
- package/src/lib/Components/Line/Line.tsx +5 -3
- package/src/lib/Components/LineChart/LineChart.test.tsx +23 -0
- package/src/lib/Components/LineChart/LineChart.tsx +6 -0
- package/src/lib/Components/LineChart/types.ts +16 -0
- package/src/lib/Components/Point/Point.tsx +3 -1
- package/src/lib/Components/ReferenceLine/ReferenceLine.stories.tsx +109 -0
- package/src/lib/Components/ReferenceLine/ReferenceLine.test.tsx +269 -0
- package/src/lib/Components/ReferenceLine/ReferenceLine.tsx +149 -0
- package/src/lib/Components/ReferenceLine/constants.ts +2 -0
- package/src/lib/Components/ReferenceLine/index.ts +2 -0
- package/src/lib/Components/ReferenceLine/types.ts +79 -0
- package/src/lib/Components/ReferenceLine/utils.test.ts +332 -0
- package/src/lib/Components/ReferenceLine/utils.ts +175 -0
- package/src/lib/Components/Scrubber/Scrubber.stories.tsx +122 -0
- package/src/lib/Components/Scrubber/Scrubber.test.tsx +110 -0
- package/src/lib/Components/Scrubber/Scrubber.tsx +189 -0
- package/src/lib/Components/Scrubber/ScrubberProvider.test.tsx +223 -0
- package/src/lib/Components/Scrubber/ScrubberProvider.tsx +132 -0
- package/src/lib/Components/Scrubber/constants.ts +7 -0
- package/src/lib/Components/Scrubber/context/index.ts +1 -0
- package/src/lib/Components/Scrubber/context/scrubberContext.ts +14 -0
- package/src/lib/Components/Scrubber/index.ts +3 -0
- package/src/lib/Components/Scrubber/types.ts +59 -0
- package/src/lib/Components/Scrubber/utils.test.ts +172 -0
- package/src/lib/Components/Scrubber/utils.ts +126 -0
- package/src/lib/Components/index.ts +2 -0
- package/src/lib/utils/scales/scales.test.ts +22 -0
- package/src/lib/utils/scales/scales.ts +19 -9
|
@@ -58,5 +58,21 @@ export type LineChartProps = {
|
|
|
58
58
|
* Additional SVG content rendered inside the chart after lines and axes.
|
|
59
59
|
*/
|
|
60
60
|
children?: ReactNode;
|
|
61
|
+
/**
|
|
62
|
+
* Enables scrubbing (pan gesture) interactions on the chart.
|
|
63
|
+
* When true, add a `<Scrubber>` as a child to visualise the interaction.
|
|
64
|
+
* @default false
|
|
65
|
+
*/
|
|
66
|
+
enableScrubbing?: boolean;
|
|
67
|
+
/**
|
|
68
|
+
* Callback fired whenever the scrubber moves to a new data index or is cleared.
|
|
69
|
+
* Receives `undefined` when the scrub gesture ends or the scrubber position is otherwise cleared.
|
|
70
|
+
*/
|
|
71
|
+
onScrubberPositionChange?: (index: number | undefined) => void;
|
|
72
|
+
/**
|
|
73
|
+
* Whether to animate the chart on mount and data changes.
|
|
74
|
+
* @default true
|
|
75
|
+
*/
|
|
76
|
+
animate?: boolean;
|
|
61
77
|
};
|
|
62
78
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/Components/LineChart/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC7E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEhD,MAAM,MAAM,cAAc,GAAG;IAC3B;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,UAAU,CAAC;IACtB;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;OAGG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,GAAG,UAAU,CAAC;IAC9C;;;OAGG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,GAAG,UAAU,CAAC;IAC9C;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IACrC;;OAEG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/Components/LineChart/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC7E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEhD,MAAM,MAAM,cAAc,GAAG;IAC3B;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,UAAU,CAAC;IACtB;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;OAGG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,GAAG,UAAU,CAAC;IAC9C;;;OAGG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,GAAG,UAAU,CAAC;IAC9C;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IACrC;;OAEG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB;;;;OAIG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B;;;OAGG;IACH,wBAAwB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,KAAK,IAAI,CAAC;IAC/D;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Point.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/Components/Point/Point.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Point.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/Components/Point/Point.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAU3D,wBAAgB,UAAU,CAAC,EACzB,UAAqB,EACrB,GAAG,KAAK,EACT,EAAE,QAAQ,CAAC,eAAe,CAAC,2CAa3B;AAED,wBAAgB,KAAK,CAAC,EACpB,KAAK,EACL,KAAK,EACL,KAAK,EACL,KAAK,EACL,cAAc,EACd,aAAqB,EACrB,SAAiB,EACjB,cAAqB,EACrB,IAAmB,EACnB,OAAO,GACR,EAAE,QAAQ,CAAC,UAAU,CAAC,kDAsDtB"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { ReferenceLineProps } from './types';
|
|
2
|
+
export declare function ReferenceLine({ label, labelDx, labelDy, labelHorizontalAlignment, labelVerticalAlignment, labelPosition, stroke, lineStyle, ...props }: Readonly<ReferenceLineProps>): import("react/jsx-runtime").JSX.Element | null;
|
|
3
|
+
//# sourceMappingURL=ReferenceLine.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ReferenceLine.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/Components/ReferenceLine/ReferenceLine.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAQlD,wBAAgB,aAAa,CAAC,EAC5B,KAAK,EACL,OAAW,EACX,OAAW,EACX,wBAAwB,EACxB,sBAAsB,EACtB,aAAqB,EACrB,MAAM,EACN,SAAoB,EACpB,GAAG,KAAK,EACT,EAAE,QAAQ,CAAC,kBAAkB,CAAC,kDA4H9B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/Components/ReferenceLine/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,IAAI,CAAC;AAC9B,eAAO,MAAM,UAAU,UAAU,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/Components/ReferenceLine/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
export type LabelAlignment = 'start' | 'center' | 'end';
|
|
2
|
+
export type LabelPosition = 'start' | 'center' | 'end';
|
|
3
|
+
export type ReferenceLineBaseProps = {
|
|
4
|
+
/**
|
|
5
|
+
* Label text displayed near the reference line.
|
|
6
|
+
*/
|
|
7
|
+
label?: string;
|
|
8
|
+
/**
|
|
9
|
+
* Horizontal pixel offset applied to the label position.
|
|
10
|
+
* @default 0
|
|
11
|
+
*/
|
|
12
|
+
labelDx?: number;
|
|
13
|
+
/**
|
|
14
|
+
* Vertical pixel offset applied to the label position.
|
|
15
|
+
* @default 0
|
|
16
|
+
*/
|
|
17
|
+
labelDy?: number;
|
|
18
|
+
/**
|
|
19
|
+
* Position of the label along the line.
|
|
20
|
+
* @default 'end'
|
|
21
|
+
*/
|
|
22
|
+
labelPosition?: LabelPosition;
|
|
23
|
+
/**
|
|
24
|
+
* Controls the direction the label text extends from its position.
|
|
25
|
+
* - `'start'`: text extends toward the start of the axis (left)
|
|
26
|
+
* - `'center'`: text is centered on the position
|
|
27
|
+
* - `'end'`: text extends toward the end of the axis (right)
|
|
28
|
+
*
|
|
29
|
+
* Defaults: `'center'` for vertical lines, inferred from `labelPosition` for horizontal lines.
|
|
30
|
+
*/
|
|
31
|
+
labelHorizontalAlignment?: LabelAlignment;
|
|
32
|
+
/**
|
|
33
|
+
* Controls the direction the label text extends from its position.
|
|
34
|
+
* - `'start'`: text extends toward the start of the axis (up)
|
|
35
|
+
* - `'center'`: text is vertically centered on the position
|
|
36
|
+
* - `'end'`: text extends toward the end of the axis (down)
|
|
37
|
+
*
|
|
38
|
+
* Defaults: `'end'` for horizontal lines, inferred from `labelPosition` for vertical lines.
|
|
39
|
+
*/
|
|
40
|
+
labelVerticalAlignment?: LabelAlignment;
|
|
41
|
+
/**
|
|
42
|
+
* Line color.
|
|
43
|
+
* @default theme.colors.border.muted
|
|
44
|
+
*/
|
|
45
|
+
stroke?: string;
|
|
46
|
+
/**
|
|
47
|
+
* Line dash style.
|
|
48
|
+
* - `'dashed'`: rounded dots with `strokeDasharray="0.1 6"`
|
|
49
|
+
* - `'solid'`: continuous line
|
|
50
|
+
* @default 'dashed'
|
|
51
|
+
*/
|
|
52
|
+
lineStyle?: 'solid' | 'dashed';
|
|
53
|
+
};
|
|
54
|
+
export type HorizontalReferenceLineProps = ReferenceLineBaseProps & {
|
|
55
|
+
/**
|
|
56
|
+
* Y-axis value in data space where the horizontal line is drawn.
|
|
57
|
+
* The horizontal line is rendered at this Y position spanning the full
|
|
58
|
+
* width of the drawing area.
|
|
59
|
+
*/
|
|
60
|
+
dataY: number;
|
|
61
|
+
dataX?: never;
|
|
62
|
+
};
|
|
63
|
+
export type VerticalReferenceLineProps = ReferenceLineBaseProps & {
|
|
64
|
+
/**
|
|
65
|
+
* Data index along the X axis. When `xAxis.data` contains numeric values,
|
|
66
|
+
* the index is mapped to the corresponding axis value automatically.
|
|
67
|
+
* The vertical line is drawn at this position spanning the full height
|
|
68
|
+
* of the drawing area.
|
|
69
|
+
*/
|
|
70
|
+
dataX: number;
|
|
71
|
+
dataY?: never;
|
|
72
|
+
};
|
|
73
|
+
export type ReferenceLineProps = HorizontalReferenceLineProps | VerticalReferenceLineProps;
|
|
74
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/Components/ReferenceLine/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAC;AACxD,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAC;AAEvD,MAAM,MAAM,sBAAsB,GAAG;IACnC;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B;;;;;;;OAOG;IACH,wBAAwB,CAAC,EAAE,cAAc,CAAC;IAC1C;;;;;;;OAOG;IACH,sBAAsB,CAAC,EAAE,cAAc,CAAC;IACxC;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;;OAKG;IACH,SAAS,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC;CAChC,CAAC;AAEF,MAAM,MAAM,4BAA4B,GAAG,sBAAsB,GAAG;IAClE;;;;OAIG;IACH,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,KAAK,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,0BAA0B,GAAG,sBAAsB,GAAG;IAChE;;;;;OAKG;IACH,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,KAAK,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAC1B,4BAA4B,GAC5B,0BAA0B,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { AxisConfigProps, ChartScaleFunction, DrawingArea } from '../../utils/types';
|
|
2
|
+
import type { LabelAlignment, LabelPosition } from './types';
|
|
3
|
+
type LabelCoordinates = {
|
|
4
|
+
x: number;
|
|
5
|
+
y: number;
|
|
6
|
+
textAnchor: 'start' | 'middle' | 'end';
|
|
7
|
+
dominantBaseline: 'hanging' | 'central' | 'auto';
|
|
8
|
+
};
|
|
9
|
+
type ResolvePixelParams = {
|
|
10
|
+
dataValue: number;
|
|
11
|
+
scale: ChartScaleFunction | undefined;
|
|
12
|
+
axis: 'x' | 'y';
|
|
13
|
+
drawingArea: DrawingArea;
|
|
14
|
+
axisConfig?: AxisConfigProps;
|
|
15
|
+
};
|
|
16
|
+
type LabelParams = {
|
|
17
|
+
pixel: number;
|
|
18
|
+
labelPosition: LabelPosition;
|
|
19
|
+
drawingArea: DrawingArea;
|
|
20
|
+
dx?: number;
|
|
21
|
+
dy?: number;
|
|
22
|
+
horizontalAlignment?: LabelAlignment;
|
|
23
|
+
verticalAlignment?: LabelAlignment;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Converts a `dominantBaseline` value to a `dy` pixel offset.
|
|
27
|
+
* react-native-svg doesn't support `dominantBaseline`, so we emulate it
|
|
28
|
+
* with a font-relative `dy` shift — same approach used by Axis components.
|
|
29
|
+
*/
|
|
30
|
+
export declare const dominantBaselineToDy: (baseline: LabelCoordinates["dominantBaseline"], fontSize: number) => number;
|
|
31
|
+
/**
|
|
32
|
+
* Checks whether a pixel coordinate falls within the drawing area
|
|
33
|
+
* along a single axis.
|
|
34
|
+
*/
|
|
35
|
+
export declare const isPixelWithinDrawingArea: (pixel: number, axis: "x" | "y", drawingArea: DrawingArea) => boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Resolves a data-space value to a validated pixel coordinate.
|
|
38
|
+
* When `axisConfig` is provided, the data value is first translated
|
|
39
|
+
* through the axis data array before being projected onto the scale.
|
|
40
|
+
* Returns `undefined` if the value is out of bounds, the scale is missing,
|
|
41
|
+
* the result is not finite, or the pixel falls outside the drawing area.
|
|
42
|
+
*/
|
|
43
|
+
export declare const resolvePixel: ({ dataValue, scale, axis, drawingArea, axisConfig, }: ResolvePixelParams) => number | undefined;
|
|
44
|
+
/**
|
|
45
|
+
* Computes the label pixel coordinates and text alignment attributes
|
|
46
|
+
* for a horizontal reference line.
|
|
47
|
+
*/
|
|
48
|
+
export declare const computeHorizontalLabelCoordinates: ({ pixel, labelPosition, drawingArea, dx, dy, horizontalAlignment, verticalAlignment, }: LabelParams) => LabelCoordinates;
|
|
49
|
+
/**
|
|
50
|
+
* Computes the label pixel coordinates and text alignment attributes
|
|
51
|
+
* for a vertical reference line.
|
|
52
|
+
*/
|
|
53
|
+
export declare const computeVerticalLabelCoordinates: ({ pixel, labelPosition, drawingArea, dx, dy, horizontalAlignment, verticalAlignment, }: LabelParams) => LabelCoordinates;
|
|
54
|
+
export {};
|
|
55
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/Components/ReferenceLine/utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,eAAe,EACf,kBAAkB,EAClB,WAAW,EACZ,MAAM,mBAAmB,CAAC;AAE3B,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAK7D,KAAK,gBAAgB,GAAG;IACtB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,UAAU,EAAE,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAC;IACvC,gBAAgB,EAAE,SAAS,GAAG,SAAS,GAAG,MAAM,CAAC;CAClD,CAAC;AAQF,KAAK,kBAAkB,GAAG;IACxB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,kBAAkB,GAAG,SAAS,CAAC;IACtC,IAAI,EAAE,GAAG,GAAG,GAAG,CAAC;IAChB,WAAW,EAAE,WAAW,CAAC;IACzB,UAAU,CAAC,EAAE,eAAe,CAAC;CAC9B,CAAC;AAEF,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,aAAa,CAAC;IAC7B,WAAW,EAAE,WAAW,CAAC;IACzB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,mBAAmB,CAAC,EAAE,cAAc,CAAC;IACrC,iBAAiB,CAAC,EAAE,cAAc,CAAC;CACpC,CAAC;AAuBF;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,GAC/B,UAAU,gBAAgB,CAAC,kBAAkB,CAAC,EAC9C,UAAU,MAAM,KACf,MAAuC,CAAC;AAE3C;;;GAGG;AACH,eAAO,MAAM,wBAAwB,GACnC,OAAO,MAAM,EACb,MAAM,GAAG,GAAG,GAAG,EACf,aAAa,WAAW,KACvB,OAKF,CAAC;AAqBF;;;;;;GAMG;AACH,eAAO,MAAM,YAAY,GAAI,sDAM1B,kBAAkB,KAAG,MAAM,GAAG,SAehC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,iCAAiC,GAAI,wFAQ/C,WAAW,KAAG,gBAKf,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,+BAA+B,GAAI,wFAQ7C,WAAW,KAAG,gBAKf,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ScrubberProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Renders the scrubber visuals: vertical reference line, future-data overlay
|
|
4
|
+
* rect, per-series beacon dots, and an optional formatted label above the line.
|
|
5
|
+
*
|
|
6
|
+
* Must be used as a child of `LineChart` (or `CartesianChart`) with
|
|
7
|
+
* `enableScrubbing` enabled. Renders nothing when no scrubber position is active.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```tsx
|
|
11
|
+
* <LineChart series={data} enableScrubbing>
|
|
12
|
+
* <Scrubber label={(i) => data[i].date} />
|
|
13
|
+
* </LineChart>
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
export declare function Scrubber({ label, hideLine, hideOverlay, showBeacons, }: Readonly<ScrubberProps>): import("react/jsx-runtime").JSX.Element | null;
|
|
17
|
+
//# sourceMappingURL=Scrubber.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Scrubber.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/Components/Scrubber/Scrubber.tsx"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAG7C;;;;;;;;;;;;;GAaG;AACH,wBAAgB,QAAQ,CAAC,EACvB,KAAK,EACL,QAAgB,EAChB,WAAmB,EACnB,WAAmB,GACpB,EAAE,QAAQ,CAAC,aAAa,CAAC,kDA8IzB"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ScrubberProviderProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Provides scrubbing interaction for a chart.
|
|
4
|
+
*
|
|
5
|
+
* Must be placed as a child of `CartesianChartProvider` (so it can access the
|
|
6
|
+
* x-scale) but outside the `<Svg>` element (so it can render a transparent
|
|
7
|
+
* gesture-capture `View` overlay). `CartesianChart` handles this positioning
|
|
8
|
+
* automatically when `enableScrubbing` is true.
|
|
9
|
+
*
|
|
10
|
+
* Activation requires a 50 ms long press before panning begins. This prevents
|
|
11
|
+
* accidental scrubbing when the user is scrolling a parent `ScrollView` or
|
|
12
|
+
* `FlatList`. The `isScrubbing` shared value gates the pan via manual activation
|
|
13
|
+
* so scroll and scrub gestures never compete.
|
|
14
|
+
*/
|
|
15
|
+
export declare function ScrubberProvider({ children, width, height, enableScrubbing, onScrubberPositionChange, }: Readonly<ScrubberProviderProps>): import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
//# sourceMappingURL=ScrubberProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ScrubberProvider.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/Components/Scrubber/ScrubberProvider.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAGrD;;;;;;;;;;;;GAYG;AACH,wBAAgB,gBAAgB,CAAC,EAC/B,QAAQ,EACR,KAAK,EACL,MAAM,EACN,eAAe,EACf,wBAAwB,GACzB,EAAE,QAAQ,CAAC,qBAAqB,CAAC,2CAqGjC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const BEACON_RADIUS = 5;
|
|
2
|
+
export declare const BEACON_STROKE_WIDTH = 2;
|
|
3
|
+
export declare const LABEL_OFFSET_Y = 12;
|
|
4
|
+
export declare const OVERLAY_OFFSET = 2;
|
|
5
|
+
export declare const OVERLAY_LINE_INSET = 0.5;
|
|
6
|
+
export declare const OVERLAY_OPACITY = 0.8;
|
|
7
|
+
export declare const LINE_GRADIENT_EDGE_OPACITY = 0.1;
|
|
8
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/Components/Scrubber/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa,IAAI,CAAC;AAC/B,eAAO,MAAM,mBAAmB,IAAI,CAAC;AACrC,eAAO,MAAM,cAAc,KAAK,CAAC;AACjC,eAAO,MAAM,cAAc,IAAI,CAAC;AAChC,eAAO,MAAM,kBAAkB,MAAM,CAAC;AACtC,eAAO,MAAM,eAAe,MAAM,CAAC;AACnC,eAAO,MAAM,0BAA0B,MAAM,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/lib/Components/Scrubber/context/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ScrubberContextValue } from '../types';
|
|
2
|
+
declare const ScrubberContextProvider: import("react").FC<{
|
|
3
|
+
children: import("react").ReactNode;
|
|
4
|
+
value: ScrubberContextValue;
|
|
5
|
+
}>;
|
|
6
|
+
export declare const useScrubberContext: () => ScrubberContextValue;
|
|
7
|
+
export { ScrubberContextProvider };
|
|
8
|
+
//# sourceMappingURL=scrubberContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scrubberContext.d.ts","sourceRoot":"","sources":["../../../../../../../src/lib/Components/Scrubber/context/scrubberContext.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAErD,QAAA,MAAO,uBAAuB;;;EACuB,CAAC;AAEtD,eAAO,MAAM,kBAAkB,QAAO,oBAIlC,CAAC;AAEL,OAAO,EAAE,uBAAuB,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/Components/Scrubber/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAC/C,YAAY,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
export type ScrubberContextValue = {
|
|
3
|
+
/**
|
|
4
|
+
* Whether scrubbing interactions are enabled.
|
|
5
|
+
*/
|
|
6
|
+
enableScrubbing: boolean;
|
|
7
|
+
/**
|
|
8
|
+
* The current data index of the scrubber, or undefined when idle.
|
|
9
|
+
*/
|
|
10
|
+
scrubberPosition: number | undefined;
|
|
11
|
+
/**
|
|
12
|
+
* Callback to update the scrubber position.
|
|
13
|
+
*/
|
|
14
|
+
onScrubberPositionChange: (index: number | undefined) => void;
|
|
15
|
+
};
|
|
16
|
+
export type ScrubberProviderProps = {
|
|
17
|
+
children: ReactNode;
|
|
18
|
+
/**
|
|
19
|
+
* Width of the chart in pixels. Used to bound gesture detection.
|
|
20
|
+
*/
|
|
21
|
+
width: number;
|
|
22
|
+
/**
|
|
23
|
+
* Height of the chart in pixels. Used to bound gesture detection.
|
|
24
|
+
*/
|
|
25
|
+
height: number;
|
|
26
|
+
/**
|
|
27
|
+
* Whether scrubbing is enabled.
|
|
28
|
+
*/
|
|
29
|
+
enableScrubbing: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Optional external callback fired whenever the scrubber position changes.
|
|
32
|
+
*/
|
|
33
|
+
onScrubberPositionChange?: (index: number | undefined) => void;
|
|
34
|
+
};
|
|
35
|
+
export type ScrubberProps = {
|
|
36
|
+
/**
|
|
37
|
+
* Formats a label string shown above the reference line for a given data index.
|
|
38
|
+
* When omitted, no label is rendered.
|
|
39
|
+
*/
|
|
40
|
+
label?: (dataIndex: number) => string;
|
|
41
|
+
/**
|
|
42
|
+
* Hides the vertical reference line.
|
|
43
|
+
* @default false
|
|
44
|
+
*/
|
|
45
|
+
hideLine?: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Hides the semi-transparent overlay that dims data after the scrubber position.
|
|
48
|
+
* @default false
|
|
49
|
+
*/
|
|
50
|
+
hideOverlay?: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Shows the beacon dots on each series at the scrubbed data index.
|
|
53
|
+
* @default false
|
|
54
|
+
*/
|
|
55
|
+
showBeacons?: boolean;
|
|
56
|
+
};
|
|
57
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/Components/Scrubber/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,MAAM,MAAM,oBAAoB,GAAG;IACjC;;OAEG;IACH,eAAe,EAAE,OAAO,CAAC;IACzB;;OAEG;IACH,gBAAgB,EAAE,MAAM,GAAG,SAAS,CAAC;IACrC;;OAEG;IACH,wBAAwB,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,KAAK,IAAI,CAAC;CAC/D,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC,QAAQ,EAAE,SAAS,CAAC;IACpB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,eAAe,EAAE,OAAO,CAAC;IACzB;;OAEG;IACH,wBAAwB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,KAAK,IAAI,CAAC;CAChE,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B;;;OAGG;IACH,KAAK,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,MAAM,CAAC;IACtC;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { AxisConfigProps, CartesianChartContextValue, ChartScaleFunction } from '../../utils/types';
|
|
2
|
+
/**
|
|
3
|
+
* Converts a pixel position along the x-axis into the nearest data index.
|
|
4
|
+
*
|
|
5
|
+
* For band (categorical) scales, finds the band whose center is closest to
|
|
6
|
+
* `pixelX`. For numeric scales, uses `scale.invert()` and rounds to the
|
|
7
|
+
* nearest integer, clamped to the valid index range.
|
|
8
|
+
*/
|
|
9
|
+
export declare const getDataIndexFromPosition: (pixelX: number, scale: ChartScaleFunction, axisConfig: Partial<AxisConfigProps> | undefined, dataLength: number) => number;
|
|
10
|
+
/**
|
|
11
|
+
* Resolves the pixel y-coordinate for a given series data point at a data index.
|
|
12
|
+
* Returns undefined when the value is null/missing or the scale is unavailable.
|
|
13
|
+
*/
|
|
14
|
+
export declare const resolvePixelY: (dataIndex: number, seriesData: (number | null)[] | undefined, getYScale: CartesianChartContextValue["getYScale"]) => number | undefined;
|
|
15
|
+
/**
|
|
16
|
+
* Resolves the pixel x-coordinate for a given data index using the x-scale.
|
|
17
|
+
* When numeric x-axis data is provided, the corresponding axis value is used;
|
|
18
|
+
* otherwise the data index is used as the x input.
|
|
19
|
+
* Returns undefined only when the scale is unavailable.
|
|
20
|
+
*/
|
|
21
|
+
export declare const resolvePixelX: (dataIndex: number, getXScale: CartesianChartContextValue["getXScale"], axisConfig?: AxisConfigProps) => number | undefined;
|
|
22
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/Components/Scrubber/utils.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,eAAe,EACf,0BAA0B,EAC1B,kBAAkB,EACnB,MAAM,mBAAmB,CAAC;AAgC3B;;;;;;GAMG;AACH,eAAO,MAAM,wBAAwB,GACnC,QAAQ,MAAM,EACd,OAAO,kBAAkB,EACzB,YAAY,OAAO,CAAC,eAAe,CAAC,GAAG,SAAS,EAChD,YAAY,MAAM,KACjB,MAmCF,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,aAAa,GACxB,WAAW,MAAM,EACjB,YAAY,CAAC,MAAM,GAAG,IAAI,CAAC,EAAE,GAAG,SAAS,EACzC,WAAW,0BAA0B,CAAC,WAAW,CAAC,KACjD,MAAM,GAAG,SASX,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,aAAa,GACxB,WAAW,MAAM,EACjB,WAAW,0BAA0B,CAAC,WAAW,CAAC,EAClD,aAAa,eAAe,KAC3B,MAAM,GAAG,SAMX,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,iBAAiB,CAAC;AAChC,cAAc,YAAY,CAAC"}
|
|
@@ -25,6 +25,12 @@ export declare const isCategoricalScale: (scale: ChartScaleFunction) => scale is
|
|
|
25
25
|
* Checks if a scale is a numeric scale.
|
|
26
26
|
*/
|
|
27
27
|
export declare const isNumericScale: (scale: ChartScaleFunction) => scale is NumericScale;
|
|
28
|
+
/**
|
|
29
|
+
* Returns the pixel coordinate at the center of the given data index on the scale.
|
|
30
|
+
* For band (categorical) scales, centers on the bandwidth.
|
|
31
|
+
* For numeric scales, calls the scale directly.
|
|
32
|
+
*/
|
|
33
|
+
export declare const getPointOnScale: (dataIndex: number, scale: ChartScaleFunction) => number;
|
|
28
34
|
/**
|
|
29
35
|
* Projects a single data-space coordinate pair to pixel-space
|
|
30
36
|
* using the provided x and y scale functions.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scales.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/utils/scales/scales.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,UAAU,EACV,eAAe,EACf,gBAAgB,EAChB,kBAAkB,EAClB,YAAY,EACb,MAAM,UAAU,CAAC;AAElB;;;GAGG;AACH,eAAO,MAAM,eAAe,GAAI,+BAI7B;IACD,SAAS,EAAE,QAAQ,GAAG,KAAK,CAAC;IAC5B,MAAM,EAAE,UAAU,CAAC;IACnB,KAAK,EAAE,UAAU,CAAC;CACnB,KAAG,YAMH,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAAI,6BAIjC;IACD,MAAM,EAAE,UAAU,CAAC;IACnB,KAAK,EAAE,UAAU,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,KAAG,gBAUH,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,eAAe,GAC1B,WAAW,eAAe,CAAC,WAAW,CAAC,KACtC,SAAS,IAAI,MAA8B,CAAC;AAE/C;;GAEG;AACH,eAAO,MAAM,kBAAkB,GAC7B,OAAO,kBAAkB,KACxB,KAAK,IAAI,gBAEX,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,cAAc,GACzB,OAAO,kBAAkB,KACxB,KAAK,IAAI,YAEX,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,YAAY,GACvB,OAAO,MAAM,EACb,OAAO,MAAM,EACb,QAAQ,kBAAkB,EAC1B,QAAQ,kBAAkB,KACzB;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"scales.d.ts","sourceRoot":"","sources":["../../../../../../src/lib/utils/scales/scales.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,UAAU,EACV,eAAe,EACf,gBAAgB,EAChB,kBAAkB,EAClB,YAAY,EACb,MAAM,UAAU,CAAC;AAElB;;;GAGG;AACH,eAAO,MAAM,eAAe,GAAI,+BAI7B;IACD,SAAS,EAAE,QAAQ,GAAG,KAAK,CAAC;IAC5B,MAAM,EAAE,UAAU,CAAC;IACnB,KAAK,EAAE,UAAU,CAAC;CACnB,KAAG,YAMH,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAAI,6BAIjC;IACD,MAAM,EAAE,UAAU,CAAC;IACnB,KAAK,EAAE,UAAU,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,KAAG,gBAUH,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,eAAe,GAC1B,WAAW,eAAe,CAAC,WAAW,CAAC,KACtC,SAAS,IAAI,MAA8B,CAAC;AAE/C;;GAEG;AACH,eAAO,MAAM,kBAAkB,GAC7B,OAAO,kBAAkB,KACxB,KAAK,IAAI,gBAEX,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,cAAc,GACzB,OAAO,kBAAkB,KACxB,KAAK,IAAI,YAEX,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,eAAe,GAC1B,WAAW,MAAM,EACjB,OAAO,kBAAkB,KACxB,MAKF,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,YAAY,GACvB,OAAO,MAAM,EACb,OAAO,MAAM,EACb,QAAQ,kBAAkB,EAC1B,QAAQ,kBAAkB,KACzB;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAGvB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ledgerhq/lumen-ui-rnative-visualization",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.12",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"keywords": [
|
|
@@ -45,10 +45,13 @@
|
|
|
45
45
|
"peerDependencies": {
|
|
46
46
|
"@types/react": "^19.0.0",
|
|
47
47
|
"@ledgerhq/lumen-design-core": "0.1.14",
|
|
48
|
-
"@ledgerhq/lumen-ui-rnative": "0.1.
|
|
48
|
+
"@ledgerhq/lumen-ui-rnative": "0.1.35",
|
|
49
49
|
"react": "^19.0.0",
|
|
50
50
|
"react-native": "~0.79.7",
|
|
51
|
-
"react-native-svg": "^15.0.0"
|
|
51
|
+
"react-native-svg": "^15.0.0",
|
|
52
|
+
"react-native-gesture-handler": ">=2.0.0",
|
|
53
|
+
"react-native-reanimated": ">=4.0.0",
|
|
54
|
+
"react-native-worklets": ">=0.5.0"
|
|
52
55
|
},
|
|
53
56
|
"nx": {
|
|
54
57
|
"tags": [
|
|
@@ -50,7 +50,7 @@ export const XAxis = ({
|
|
|
50
50
|
const labelY = axisY + tickDirection * (TICK_MARK_SIZE + TICK_LABEL_OFFSET);
|
|
51
51
|
const labelDy = isTop ? 0 : fontSize * 0.8;
|
|
52
52
|
|
|
53
|
-
const gridStroke = theme.colors.border.
|
|
53
|
+
const gridStroke = theme.colors.border.mutedSubtleTransparent;
|
|
54
54
|
const lineStroke = theme.colors.border.muted;
|
|
55
55
|
const textFill = theme.colors.text.muted;
|
|
56
56
|
|
|
@@ -49,7 +49,7 @@ export const YAxis = ({
|
|
|
49
49
|
const fontSize = theme.typographies.body4.fontSize;
|
|
50
50
|
const labelDy = fontSize * 0.35;
|
|
51
51
|
|
|
52
|
-
const gridStroke = theme.colors.border.
|
|
52
|
+
const gridStroke = theme.colors.border.mutedSubtleTransparent;
|
|
53
53
|
const lineStroke = theme.colors.border.muted;
|
|
54
54
|
const textFill = theme.colors.text.muted;
|
|
55
55
|
|
|
@@ -2,7 +2,9 @@ import { useCallback, useMemo, useState } from 'react';
|
|
|
2
2
|
import { View, type LayoutChangeEvent } from 'react-native';
|
|
3
3
|
import { Svg } from 'react-native-svg';
|
|
4
4
|
|
|
5
|
+
import { ScrubberProvider } from '../Scrubber/ScrubberProvider';
|
|
5
6
|
import { CartesianChartProvider, useBuildChartContext } from './context';
|
|
7
|
+
import { RevealClipDefs } from './RevealClip';
|
|
6
8
|
import type { CartesianChartProps } from './types';
|
|
7
9
|
import {
|
|
8
10
|
DEFAULT_HEIGHT,
|
|
@@ -21,6 +23,9 @@ export function CartesianChart({
|
|
|
21
23
|
axisPadding,
|
|
22
24
|
ariaLabel = 'Chart',
|
|
23
25
|
children,
|
|
26
|
+
enableScrubbing = false,
|
|
27
|
+
onScrubberPositionChange,
|
|
28
|
+
animate = true,
|
|
24
29
|
}: Readonly<CartesianChartProps>) {
|
|
25
30
|
const [measuredWidth, setMeasuredWidth] = useState<number | undefined>(width);
|
|
26
31
|
|
|
@@ -53,48 +58,43 @@ export function CartesianChart({
|
|
|
53
58
|
axisPadding: resolvedAxisPadding,
|
|
54
59
|
});
|
|
55
60
|
|
|
56
|
-
const svgContent = resolvedWidth > 0 && (
|
|
57
|
-
<Svg
|
|
58
|
-
testID='chart-svg'
|
|
59
|
-
width={resolvedWidth}
|
|
60
|
-
height={height}
|
|
61
|
-
style={{ overflow: 'visible' }}
|
|
62
|
-
>
|
|
63
|
-
<CartesianChartProvider value={contextValue}>
|
|
64
|
-
{children}
|
|
65
|
-
</CartesianChartProvider>
|
|
66
|
-
</Svg>
|
|
67
|
-
);
|
|
68
|
-
|
|
69
|
-
if (needsMeasurement) {
|
|
70
|
-
return (
|
|
71
|
-
<View
|
|
72
|
-
testID='chart-container'
|
|
73
|
-
onLayout={handleLayout}
|
|
74
|
-
style={{
|
|
75
|
-
height,
|
|
76
|
-
...OVERFLOW_NEGATIVE_MARGIN,
|
|
77
|
-
}}
|
|
78
|
-
accessibilityRole='image'
|
|
79
|
-
accessibilityLabel={ariaLabel}
|
|
80
|
-
>
|
|
81
|
-
{svgContent}
|
|
82
|
-
</View>
|
|
83
|
-
);
|
|
84
|
-
}
|
|
85
|
-
|
|
86
61
|
return (
|
|
87
62
|
<View
|
|
88
63
|
testID='chart-container'
|
|
64
|
+
onLayout={needsMeasurement ? handleLayout : undefined}
|
|
89
65
|
accessibilityRole='image'
|
|
90
66
|
accessibilityLabel={ariaLabel}
|
|
91
67
|
style={{
|
|
92
|
-
width: resolvedWidth,
|
|
68
|
+
width: needsMeasurement ? undefined : resolvedWidth,
|
|
93
69
|
height,
|
|
94
70
|
...OVERFLOW_NEGATIVE_MARGIN,
|
|
95
71
|
}}
|
|
96
72
|
>
|
|
97
|
-
{
|
|
73
|
+
{resolvedWidth > 0 && (
|
|
74
|
+
<CartesianChartProvider value={contextValue}>
|
|
75
|
+
<ScrubberProvider
|
|
76
|
+
width={resolvedWidth}
|
|
77
|
+
height={height}
|
|
78
|
+
enableScrubbing={enableScrubbing}
|
|
79
|
+
onScrubberPositionChange={onScrubberPositionChange}
|
|
80
|
+
>
|
|
81
|
+
<Svg
|
|
82
|
+
testID='chart-svg'
|
|
83
|
+
width={resolvedWidth}
|
|
84
|
+
height={height}
|
|
85
|
+
style={{ overflow: 'visible' }}
|
|
86
|
+
>
|
|
87
|
+
<RevealClipDefs
|
|
88
|
+
drawingArea={contextValue.drawingArea}
|
|
89
|
+
series={series}
|
|
90
|
+
animate={animate}
|
|
91
|
+
>
|
|
92
|
+
{children}
|
|
93
|
+
</RevealClipDefs>
|
|
94
|
+
</Svg>
|
|
95
|
+
</ScrubberProvider>
|
|
96
|
+
</CartesianChartProvider>
|
|
97
|
+
)}
|
|
98
98
|
</View>
|
|
99
99
|
);
|
|
100
100
|
}
|