@ledgerhq/lumen-ui-rnative-visualization 0.1.10 → 0.1.11
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 +53 -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 +59 -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
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { useState } from 'react';
|
|
4
|
+
import { Text, View } from 'react-native';
|
|
5
|
+
import { StoryDecorator } from "../../../../.storybook/StoryDecorator.js";
|
|
6
|
+
import { LineChart } from "../LineChart/index.js";
|
|
7
|
+
import { Scrubber } from "./Scrubber.js";
|
|
8
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
|
+
const meta = {
|
|
10
|
+
component: Scrubber,
|
|
11
|
+
title: 'Visualization/Scrubber',
|
|
12
|
+
tags: ['experimental'],
|
|
13
|
+
decorators: [(Story, context) => /*#__PURE__*/_jsx(StoryDecorator, {
|
|
14
|
+
context: context,
|
|
15
|
+
children: /*#__PURE__*/_jsx(Story, {})
|
|
16
|
+
})]
|
|
17
|
+
};
|
|
18
|
+
export default meta;
|
|
19
|
+
const dates = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
|
20
|
+
const singleSeries = [{
|
|
21
|
+
id: 'prices',
|
|
22
|
+
stroke: '#7B61FF',
|
|
23
|
+
data: [10, 22, 29, 45, 98, 45, 22, 52, 21, 4, 68, 20]
|
|
24
|
+
}];
|
|
25
|
+
const multiSeries = [{
|
|
26
|
+
id: 'lineA',
|
|
27
|
+
label: 'Line A',
|
|
28
|
+
stroke: '#7B61FF',
|
|
29
|
+
data: [5, 15, 10, 90, 85, 70, 30, 25, 25, 40, 60, 80]
|
|
30
|
+
}, {
|
|
31
|
+
id: 'lineB',
|
|
32
|
+
label: 'Line B',
|
|
33
|
+
stroke: '#44D7B6',
|
|
34
|
+
data: [90, 85, 70, 25, 23, 40, 45, 40, 50, 30, 20, 10]
|
|
35
|
+
}];
|
|
36
|
+
export const Base = {
|
|
37
|
+
render: args => /*#__PURE__*/_jsx(LineChart, {
|
|
38
|
+
series: singleSeries,
|
|
39
|
+
height: 200,
|
|
40
|
+
showArea: true,
|
|
41
|
+
enableScrubbing: true,
|
|
42
|
+
children: /*#__PURE__*/_jsx(Scrubber, {
|
|
43
|
+
...args
|
|
44
|
+
})
|
|
45
|
+
}),
|
|
46
|
+
args: {}
|
|
47
|
+
};
|
|
48
|
+
export const WithLabel = {
|
|
49
|
+
render: args => {
|
|
50
|
+
const [activeIndex, setActiveIndex] = useState();
|
|
51
|
+
const displayIndex = activeIndex ?? singleSeries[0].data.length - 1;
|
|
52
|
+
return /*#__PURE__*/_jsxs(View, {
|
|
53
|
+
children: [/*#__PURE__*/_jsxs(Text, {
|
|
54
|
+
style: {
|
|
55
|
+
marginBottom: 8,
|
|
56
|
+
fontSize: 14
|
|
57
|
+
},
|
|
58
|
+
children: [dates[displayIndex], " \u2014 $", singleSeries[0].data[displayIndex]]
|
|
59
|
+
}), /*#__PURE__*/_jsx(LineChart, {
|
|
60
|
+
series: singleSeries,
|
|
61
|
+
height: 200,
|
|
62
|
+
showArea: true,
|
|
63
|
+
enableScrubbing: true,
|
|
64
|
+
onScrubberPositionChange: setActiveIndex,
|
|
65
|
+
children: /*#__PURE__*/_jsx(Scrubber, {
|
|
66
|
+
...args,
|
|
67
|
+
label: i => dates[i] ?? ''
|
|
68
|
+
})
|
|
69
|
+
})]
|
|
70
|
+
});
|
|
71
|
+
},
|
|
72
|
+
args: {}
|
|
73
|
+
};
|
|
74
|
+
export const MultiSeries = {
|
|
75
|
+
render: args => /*#__PURE__*/_jsx(LineChart, {
|
|
76
|
+
series: multiSeries,
|
|
77
|
+
height: 200,
|
|
78
|
+
enableScrubbing: true,
|
|
79
|
+
children: /*#__PURE__*/_jsx(Scrubber, {
|
|
80
|
+
...args,
|
|
81
|
+
label: i => dates[i] ?? '',
|
|
82
|
+
showBeacons: true
|
|
83
|
+
})
|
|
84
|
+
}),
|
|
85
|
+
args: {}
|
|
86
|
+
};
|
|
87
|
+
export const HiddenLine = {
|
|
88
|
+
render: args => /*#__PURE__*/_jsx(LineChart, {
|
|
89
|
+
series: singleSeries,
|
|
90
|
+
height: 200,
|
|
91
|
+
showArea: true,
|
|
92
|
+
enableScrubbing: true,
|
|
93
|
+
children: /*#__PURE__*/_jsx(Scrubber, {
|
|
94
|
+
...args,
|
|
95
|
+
hideLine: true
|
|
96
|
+
})
|
|
97
|
+
}),
|
|
98
|
+
args: {}
|
|
99
|
+
};
|
|
100
|
+
export const HiddenOverlay = {
|
|
101
|
+
render: args => /*#__PURE__*/_jsx(LineChart, {
|
|
102
|
+
series: singleSeries,
|
|
103
|
+
height: 200,
|
|
104
|
+
showArea: true,
|
|
105
|
+
enableScrubbing: true,
|
|
106
|
+
children: /*#__PURE__*/_jsx(Scrubber, {
|
|
107
|
+
...args,
|
|
108
|
+
hideOverlay: true
|
|
109
|
+
})
|
|
110
|
+
}),
|
|
111
|
+
args: {}
|
|
112
|
+
};
|
|
113
|
+
//# sourceMappingURL=Scrubber.stories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useState","Text","View","StoryDecorator","LineChart","Scrubber","jsx","_jsx","jsxs","_jsxs","meta","component","title","tags","decorators","Story","context","children","dates","singleSeries","id","stroke","data","multiSeries","label","Base","render","args","series","height","showArea","enableScrubbing","WithLabel","activeIndex","setActiveIndex","displayIndex","length","style","marginBottom","fontSize","onScrubberPositionChange","i","MultiSeries","showBeacons","HiddenLine","hideLine","HiddenOverlay","hideOverlay"],"sourceRoot":"../../../../../src","sources":["lib/Components/Scrubber/Scrubber.stories.tsx"],"mappings":";;AACA,SAASA,QAAQ,QAAQ,OAAO;AAChC,SAASC,IAAI,EAAEC,IAAI,QAAQ,cAAc;AAEzC,SAASC,cAAc,QAAQ,0CAA2C;AAC1E,SAASC,SAAS,QAAQ,uBAAc;AACxC,SAASC,QAAQ,QAAQ,eAAY;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAGtC,MAAMC,IAAI,GAAG;EACXC,SAAS,EAAEN,QAAQ;EACnBO,KAAK,EAAE,wBAAwB;EAC/BC,IAAI,EAAE,CAAC,cAAc,CAAC;EACtBC,UAAU,EAAE,CACV,CAACC,KAAK,EAAEC,OAAO,kBACbT,IAAA,CAACJ,cAAc;IAACa,OAAO,EAAEA,OAAQ;IAAAC,QAAA,eAC/BV,IAAA,CAACQ,KAAK,IAAE;EAAC,CACK,CACjB;AAEL,CAAiC;AAEjC,eAAeL,IAAI;AAGnB,MAAMQ,KAAK,GAAG,CACZ,KAAK,EACL,KAAK,EACL,K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/BlB,MAAM,EAAGC,IAAmB,iBAC1BpB,IAAA,CAACH,SAAS;IAACwB,MAAM,EAAET,YAAa;IAACU,MAAM,EAAE,GAAI;IAACC,QAAQ;IAACC,eAAe;IAAAd,QAAA,eACpEV,IAAA,CAACF,QAAQ;MAAA,GAAKsB,IAAI;MAAEkB,QAAQ;IAAA,CAAE;EAAC,CACtB,CACZ;EACDlB,IAAI,EAAE,CAAC;AACT,CAAC;AAED,OAAO,MAAMmB,aAAoB,GAAG;EAClCpB,MAAM,EAAGC,IAAmB,iBAC1BpB,IAAA,CAACH,SAAS;IAACwB,MAAM,EAAET,YAAa;IAACU,MAAM,EAAE,GAAI;IAACC,QAAQ;IAACC,eAAe;IAAAd,QAAA,eACpEV,IAAA,CAACF,QAAQ;MAAA,GAAKsB,IAAI;MAAEoB,WAAW;IAAA,CAAE;EAAC,CACzB,CACZ;EACDpB,IAAI,EAAE,CAAC;AACT,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { describe, expect, it } from '@jest/globals';
|
|
4
|
+
import { ledgerLiveThemes } from '@ledgerhq/lumen-design-core';
|
|
5
|
+
import { ThemeProvider } from '@ledgerhq/lumen-ui-rnative';
|
|
6
|
+
import { render } from '@testing-library/react-native';
|
|
7
|
+
import { CartesianChart } from "../CartesianChart/index.js";
|
|
8
|
+
import { ScrubberContextProvider } from "./context/index.js";
|
|
9
|
+
import { Scrubber } from "./Scrubber.js";
|
|
10
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
|
+
const sampleSeries = [{
|
|
12
|
+
id: 's1',
|
|
13
|
+
stroke: '#7B61FF',
|
|
14
|
+
data: [10, 20, 30, 40, 50]
|
|
15
|
+
}, {
|
|
16
|
+
id: 's2',
|
|
17
|
+
stroke: '#44D7B6',
|
|
18
|
+
data: [50, 40, 30, 20, 10]
|
|
19
|
+
}];
|
|
20
|
+
const Wrapper = ({
|
|
21
|
+
children
|
|
22
|
+
}) => /*#__PURE__*/_jsx(ThemeProvider, {
|
|
23
|
+
themes: ledgerLiveThemes,
|
|
24
|
+
colorScheme: "light",
|
|
25
|
+
children: children
|
|
26
|
+
});
|
|
27
|
+
const activeScrubberContext = {
|
|
28
|
+
enableScrubbing: true,
|
|
29
|
+
scrubberPosition: 2,
|
|
30
|
+
onScrubberPositionChange: () => undefined
|
|
31
|
+
};
|
|
32
|
+
const renderScrubber = ({
|
|
33
|
+
scrubberProps = {},
|
|
34
|
+
scrubberContext = activeScrubberContext
|
|
35
|
+
} = {}) => render(/*#__PURE__*/_jsx(Wrapper, {
|
|
36
|
+
children: /*#__PURE__*/_jsx(CartesianChart, {
|
|
37
|
+
series: sampleSeries,
|
|
38
|
+
width: 400,
|
|
39
|
+
height: 200,
|
|
40
|
+
children: /*#__PURE__*/_jsx(ScrubberContextProvider, {
|
|
41
|
+
value: scrubberContext,
|
|
42
|
+
children: /*#__PURE__*/_jsx(Scrubber, {
|
|
43
|
+
...scrubberProps
|
|
44
|
+
})
|
|
45
|
+
})
|
|
46
|
+
})
|
|
47
|
+
}));
|
|
48
|
+
describe('Scrubber', () => {
|
|
49
|
+
it('renders nothing when no scrubber position is active', () => {
|
|
50
|
+
const {
|
|
51
|
+
queryByTestId
|
|
52
|
+
} = renderScrubber({
|
|
53
|
+
scrubberContext: {
|
|
54
|
+
enableScrubbing: true,
|
|
55
|
+
scrubberPosition: undefined,
|
|
56
|
+
onScrubberPositionChange: () => undefined
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
expect(queryByTestId('scrubber')).toBeNull();
|
|
60
|
+
});
|
|
61
|
+
it('renders the scrubber group when a position is active', () => {
|
|
62
|
+
const {
|
|
63
|
+
getByTestId
|
|
64
|
+
} = renderScrubber();
|
|
65
|
+
expect(getByTestId('scrubber')).toBeTruthy();
|
|
66
|
+
});
|
|
67
|
+
it('renders the reference line by default', () => {
|
|
68
|
+
const {
|
|
69
|
+
getByTestId
|
|
70
|
+
} = renderScrubber();
|
|
71
|
+
expect(getByTestId('scrubber-line')).toBeTruthy();
|
|
72
|
+
});
|
|
73
|
+
it('hides the reference line when hideLine is true', () => {
|
|
74
|
+
const {
|
|
75
|
+
queryByTestId
|
|
76
|
+
} = renderScrubber({
|
|
77
|
+
scrubberProps: {
|
|
78
|
+
hideLine: true
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
expect(queryByTestId('scrubber-line')).toBeNull();
|
|
82
|
+
});
|
|
83
|
+
it('renders the overlay by default', () => {
|
|
84
|
+
const {
|
|
85
|
+
getByTestId
|
|
86
|
+
} = renderScrubber();
|
|
87
|
+
expect(getByTestId('scrubber-overlay')).toBeTruthy();
|
|
88
|
+
});
|
|
89
|
+
it('hides the overlay when hideOverlay is true', () => {
|
|
90
|
+
const {
|
|
91
|
+
queryByTestId
|
|
92
|
+
} = renderScrubber({
|
|
93
|
+
scrubberProps: {
|
|
94
|
+
hideOverlay: true
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
expect(queryByTestId('scrubber-overlay')).toBeNull();
|
|
98
|
+
});
|
|
99
|
+
it('does not render beacons by default', () => {
|
|
100
|
+
const {
|
|
101
|
+
queryAllByTestId
|
|
102
|
+
} = renderScrubber();
|
|
103
|
+
expect(queryAllByTestId(/scrubber-beacon-/)).toHaveLength(0);
|
|
104
|
+
});
|
|
105
|
+
it('renders one beacon per series when showBeacons is true', () => {
|
|
106
|
+
const {
|
|
107
|
+
getAllByTestId
|
|
108
|
+
} = renderScrubber({
|
|
109
|
+
scrubberProps: {
|
|
110
|
+
showBeacons: true
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
expect(getAllByTestId(/scrubber-beacon-/)).toHaveLength(2);
|
|
114
|
+
});
|
|
115
|
+
it('renders a label when a label function is provided', () => {
|
|
116
|
+
const {
|
|
117
|
+
getByTestId
|
|
118
|
+
} = renderScrubber({
|
|
119
|
+
scrubberProps: {
|
|
120
|
+
label: i => `Index ${i}`
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
expect(getByTestId('scrubber-label')).toBeTruthy();
|
|
124
|
+
});
|
|
125
|
+
it('does not render a label when no label function is provided', () => {
|
|
126
|
+
const {
|
|
127
|
+
queryByTestId
|
|
128
|
+
} = renderScrubber();
|
|
129
|
+
expect(queryByTestId('scrubber-label')).toBeNull();
|
|
130
|
+
});
|
|
131
|
+
});
|
|
132
|
+
//# sourceMappingURL=Scrubber.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["describe","expect","it","ledgerLiveThemes","ThemeProvider","render","CartesianChart","ScrubberContextProvider","Scrubber","jsx","_jsx","sampleSeries","id","stroke","data","Wrapper","children","themes","colorScheme","activeScrubberContext","enableScrubbing","scrubberPosition","onScrubberPositionChange","undefined","renderScrubber","scrubberProps","scrubberContext","series","width","height","value","queryByTestId","toBeNull","getByTestId","toBeTruthy","hideLine","hideOverlay","queryAllByTestId","toHaveLength","getAllByTestId","showBeacons","label","i"],"sourceRoot":"../../../../../src","sources":["lib/Components/Scrubber/Scrubber.test.tsx"],"mappings":";;AAAA,SAASA,QAAQ,EAAEC,MAAM,EAAEC,EAAE,QAAQ,eAAe;AACpD,SAASC,gBAAgB,QAAQ,6BAA6B;AAC9D,SAASC,aAAa,QAAQ,4BAA4B;AAC1D,SAASC,MAAM,QAAQ,+BAA+B;AAGtD,SAASC,cAAc,QAAQ,4BAAmB;AAClD,SAASC,uBAAuB,QAAQ,oBAAW;AACnD,SAASC,QAAQ,QAAQ,eAAY;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAGtC,MAAMC,YAAY,GAAG,CACnB;EAAEC,EAAE,EAAE,IAAI;EAAEC,MAAM,EAAE,SAAS;EAAEC,IAAI,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE;AAAE,CAAC,EAC3D;EAAEF,EAAE,EAAE,IAAI;EAAEC,MAAM,EAAE,SAAS;EAAEC,IAAI,EAAE,C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9D,CAAC,CAAC;EAEFpC,EAAE,CAAC,wDAAwD,EAAE,MAAM;IACjE,MAAM;MAAEqC;IAAe,CAAC,GAAGf,cAAc,CAAC;MACxCC,aAAa,EAAE;QAAEe,WAAW,EAAE;MAAK;IACrC,CAAC,CAAC;IACFvC,MAAM,CAACsC,cAAc,CAAC,kBAAkB,CAAC,CAAC,CAACD,YAAY,CAAC,CAAC,CAAC;EAC5D,CAAC,CAAC;EAEFpC,EAAE,CAAC,mDAAmD,EAAE,MAAM;IAC5D,MAAM;MAAE+B;IAAY,CAAC,GAAGT,cAAc,CAAC;MACrCC,aAAa,EAAE;QAAEgB,KAAK,EAAGC,CAAS,IAAK,SAASA,CAAC;MAAG;IACtD,CAAC,CAAC;IACFzC,MAAM,CAACgC,WAAW,CAAC,gBAAgB,CAAC,CAAC,CAACC,UAAU,CAAC,CAAC;EACpD,CAAC,CAAC;EAEFhC,EAAE,CAAC,4DAA4D,EAAE,MAAM;IACrE,MAAM;MAAE6B;IAAc,CAAC,GAAGP,cAAc,CAAC,CAAC;IAC1CvB,MAAM,CAAC8B,aAAa,CAAC,gBAAgB,CAAC,CAAC,CAACC,QAAQ,CAAC,CAAC;EACpD,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { useCallback, useMemo, useRef, useState } from 'react';
|
|
4
|
+
import { StyleSheet, View } from 'react-native';
|
|
5
|
+
import { Gesture, GestureDetector } from 'react-native-gesture-handler';
|
|
6
|
+
import Animated, { useSharedValue } from 'react-native-reanimated';
|
|
7
|
+
import { scheduleOnRN } from 'react-native-worklets';
|
|
8
|
+
import { useCartesianChartContext } from "../CartesianChart/context/index.js";
|
|
9
|
+
import { ScrubberContextProvider } from "./context/index.js";
|
|
10
|
+
import { getDataIndexFromPosition } from "./utils.js";
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Provides scrubbing interaction for a chart.
|
|
14
|
+
*
|
|
15
|
+
* Must be placed as a child of `CartesianChartProvider` (so it can access the
|
|
16
|
+
* x-scale) but outside the `<Svg>` element (so it can render a transparent
|
|
17
|
+
* gesture-capture `View` overlay). `CartesianChart` handles this positioning
|
|
18
|
+
* automatically when `enableScrubbing` is true.
|
|
19
|
+
*
|
|
20
|
+
* Activation requires a 50 ms long press before panning begins. This prevents
|
|
21
|
+
* accidental scrubbing when the user is scrolling a parent `ScrollView` or
|
|
22
|
+
* `FlatList`. The `isScrubbing` shared value gates the pan via manual activation
|
|
23
|
+
* so scroll and scrub gestures never compete.
|
|
24
|
+
*/
|
|
25
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
26
|
+
export function ScrubberProvider({
|
|
27
|
+
children,
|
|
28
|
+
width,
|
|
29
|
+
height,
|
|
30
|
+
enableScrubbing,
|
|
31
|
+
onScrubberPositionChange
|
|
32
|
+
}) {
|
|
33
|
+
const [scrubberPosition, setScrubberPosition] = useState();
|
|
34
|
+
const lastPositionRef = useRef(undefined);
|
|
35
|
+
const {
|
|
36
|
+
getXScale,
|
|
37
|
+
getXAxisConfig,
|
|
38
|
+
dataLength
|
|
39
|
+
} = useCartesianChartContext();
|
|
40
|
+
const isScrubbing = useSharedValue(false);
|
|
41
|
+
const setScrubberPositionAndNotify = useCallback(index => {
|
|
42
|
+
const clamped = index === undefined || dataLength <= 0 ? undefined : Math.max(0, Math.min(index, dataLength - 1));
|
|
43
|
+
if (clamped === lastPositionRef.current) return;
|
|
44
|
+
lastPositionRef.current = clamped;
|
|
45
|
+
setScrubberPosition(clamped);
|
|
46
|
+
onScrubberPositionChange?.(clamped);
|
|
47
|
+
}, [dataLength, onScrubberPositionChange]);
|
|
48
|
+
const handlePositionChange = useCallback(pixelX => {
|
|
49
|
+
if (pixelX === null) {
|
|
50
|
+
setScrubberPositionAndNotify(undefined);
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
const scale = getXScale();
|
|
54
|
+
if (!scale || dataLength <= 0) return;
|
|
55
|
+
const axisConfig = getXAxisConfig();
|
|
56
|
+
const index = getDataIndexFromPosition(pixelX, scale, axisConfig, dataLength);
|
|
57
|
+
setScrubberPositionAndNotify(index);
|
|
58
|
+
}, [getXScale, getXAxisConfig, dataLength, setScrubberPositionAndNotify]);
|
|
59
|
+
const resetScrubber = useCallback(() => {
|
|
60
|
+
'worklet';
|
|
61
|
+
|
|
62
|
+
isScrubbing.value = false;
|
|
63
|
+
scheduleOnRN(handlePositionChange, null);
|
|
64
|
+
}, [isScrubbing, handlePositionChange]);
|
|
65
|
+
const composed = useMemo(() => {
|
|
66
|
+
const longPress = Gesture.LongPress().minDuration(50).onStart(e => {
|
|
67
|
+
'worklet';
|
|
68
|
+
|
|
69
|
+
isScrubbing.value = true;
|
|
70
|
+
scheduleOnRN(handlePositionChange, e.x);
|
|
71
|
+
});
|
|
72
|
+
const pan = Gesture.Pan().manualActivation(true).onTouchesMove((_, manager) => {
|
|
73
|
+
'worklet';
|
|
74
|
+
|
|
75
|
+
if (isScrubbing.value) manager.activate();
|
|
76
|
+
}).onUpdate(e => {
|
|
77
|
+
'worklet';
|
|
78
|
+
|
|
79
|
+
scheduleOnRN(handlePositionChange, e.x);
|
|
80
|
+
}).onEnd(resetScrubber).onFinalize(resetScrubber);
|
|
81
|
+
return Gesture.Simultaneous(longPress, pan);
|
|
82
|
+
}, [isScrubbing, handlePositionChange, resetScrubber]);
|
|
83
|
+
const contextValue = useMemo(() => ({
|
|
84
|
+
enableScrubbing,
|
|
85
|
+
scrubberPosition,
|
|
86
|
+
onScrubberPositionChange: setScrubberPositionAndNotify
|
|
87
|
+
}), [enableScrubbing, scrubberPosition, setScrubberPositionAndNotify]);
|
|
88
|
+
return /*#__PURE__*/_jsx(ScrubberContextProvider, {
|
|
89
|
+
value: contextValue,
|
|
90
|
+
children: /*#__PURE__*/_jsxs(View, {
|
|
91
|
+
style: {
|
|
92
|
+
width,
|
|
93
|
+
height
|
|
94
|
+
},
|
|
95
|
+
children: [children, enableScrubbing && /*#__PURE__*/_jsx(GestureDetector, {
|
|
96
|
+
gesture: composed,
|
|
97
|
+
children: /*#__PURE__*/_jsx(Animated.View, {
|
|
98
|
+
testID: "scrubber-gesture-overlay",
|
|
99
|
+
style: StyleSheet.absoluteFill
|
|
100
|
+
})
|
|
101
|
+
})]
|
|
102
|
+
})
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
//# sourceMappingURL=ScrubberProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useCallback","useMemo","useRef","useState","StyleSheet","View","Gesture","GestureDetector","Animated","useSharedValue","scheduleOnRN","useCartesianChartContext","ScrubberContextProvider","getDataIndexFromPosition","jsx","_jsx","jsxs","_jsxs","ScrubberProvider","children","width","height","enableScrubbing","onScrubberPositionChange","scrubberPosition","setScrubberPosition","lastPositionRef","undefined","getXScale","getXAxisConfig","dataLength","isScrubbing","setScrubberPositionAndNotify","index","clamped","Math","max","min","current","handlePositionChange","pixelX","scale","axisConfig","resetScrubber","value","composed","longPress","LongPress","minDuration","onStart","e","x","pan","Pan","manualActivation","onTouchesMove","_","manager","activate","onUpdate","onEnd","onFinalize","Simultaneous","contextValue","style","gesture","testID","absoluteFill"],"sourceRoot":"../../../../../src","sources":["lib/Components/Scrubber/ScrubberProvider.tsx"],"mappings":";;AAAA,SAASA,WAAW,EAAEC,OAAO,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AAC9D,SAASC,UAAU,EAAEC,IAAI,QAAQ,cAAc;AAC/C,SAASC,OAAO,EAAEC,eAAe,QAAQ,8BAA8B;AACvE,OAAOC,QAAQ,IAAIC,cAAc,QAAQ,yBAAyB;AAClE,SAASC,YAAY,QAAQ,uBAAuB;AAEpD,SAASC,wBAAwB,QAAQ,oCAA2B;AACpE,SAASC,uBAAuB,QAAQ,oBAAW;AAEnD,SAASC,wBAAwB,QAAQ,YAAS;;AAElD;AACA;AACA;AACA;AACA;A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7C,CAAC,EAAE,CAACrB,WAAW,EAAEQ,oBAAoB,EAAEI,aAAa,CAAC,CAAC;EAEtD,MAAMoB,YAAY,GAAG9D,OAAO,CAC1B,OAAO;IACLqB,eAAe;IACfE,gBAAgB;IAChBD,wBAAwB,EAAES;EAC5B,CAAC,CAAC,EACF,CAACV,eAAe,EAAEE,gBAAgB,EAAEQ,4BAA4B,CAClE,CAAC;EAED,oBACEjB,IAAA,CAACH,uBAAuB;IAACgC,KAAK,EAAEmB,YAAa;IAAA5C,QAAA,eAC3CF,KAAA,CAACZ,IAAI;MAAC2D,KAAK,EAAE;QAAE5C,KAAK;QAAEC;MAAO,CAAE;MAAAF,QAAA,GAC5BA,QAAQ,EACRG,eAAe,iBACdP,IAAA,CAACR,eAAe;QAAC0D,OAAO,EAAEpB,QAAS;QAAA1B,QAAA,eACjCJ,IAAA,CAACP,QAAQ,CAACH,IAAI;UACZ6D,MAAM,EAAC,0BAA0B;UACjCF,KAAK,EAAE5D,UAAU,CAAC+D;QAAa,CAChC;MAAC,CACa,CAClB;IAAA,CACG;EAAC,CACgB,CAAC;AAE9B","ignoreList":[]}
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { describe, expect, it, jest } from '@jest/globals';
|
|
4
|
+
import { ledgerLiveThemes } from '@ledgerhq/lumen-design-core';
|
|
5
|
+
import { ThemeProvider } from '@ledgerhq/lumen-ui-rnative';
|
|
6
|
+
import { fireEvent, render } from '@testing-library/react-native';
|
|
7
|
+
import { Pressable, Text } from 'react-native';
|
|
8
|
+
import { CartesianChart } from "../CartesianChart/index.js";
|
|
9
|
+
import { useScrubberContext } from "./context/index.js";
|
|
10
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
|
+
const sampleSeries = [{
|
|
12
|
+
id: 's1',
|
|
13
|
+
stroke: '#7B61FF',
|
|
14
|
+
data: [10, 20, 30, 40, 50]
|
|
15
|
+
}];
|
|
16
|
+
const Wrapper = ({
|
|
17
|
+
children
|
|
18
|
+
}) => /*#__PURE__*/_jsx(ThemeProvider, {
|
|
19
|
+
themes: ledgerLiveThemes,
|
|
20
|
+
colorScheme: "light",
|
|
21
|
+
children: children
|
|
22
|
+
});
|
|
23
|
+
const ContextConsumer = () => {
|
|
24
|
+
const {
|
|
25
|
+
scrubberPosition,
|
|
26
|
+
enableScrubbing
|
|
27
|
+
} = useScrubberContext();
|
|
28
|
+
return /*#__PURE__*/_jsx(Text, {
|
|
29
|
+
testID: "context-output",
|
|
30
|
+
children: `enabled:${enableScrubbing},pos:${scrubberPosition ?? 'none'}`
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
describe('ScrubberProvider', () => {
|
|
34
|
+
it('renders children', () => {
|
|
35
|
+
const {
|
|
36
|
+
getByTestId
|
|
37
|
+
} = render(/*#__PURE__*/_jsx(Wrapper, {
|
|
38
|
+
children: /*#__PURE__*/_jsx(CartesianChart, {
|
|
39
|
+
series: sampleSeries,
|
|
40
|
+
width: 400,
|
|
41
|
+
height: 200,
|
|
42
|
+
enableScrubbing: true,
|
|
43
|
+
children: /*#__PURE__*/_jsx(Text, {
|
|
44
|
+
testID: "child",
|
|
45
|
+
children: "hello"
|
|
46
|
+
})
|
|
47
|
+
})
|
|
48
|
+
}));
|
|
49
|
+
expect(getByTestId('child')).toBeTruthy();
|
|
50
|
+
});
|
|
51
|
+
it('renders the long-press + pan gesture overlay when enableScrubbing is true', () => {
|
|
52
|
+
const {
|
|
53
|
+
getByTestId
|
|
54
|
+
} = render(/*#__PURE__*/_jsx(Wrapper, {
|
|
55
|
+
children: /*#__PURE__*/_jsx(CartesianChart, {
|
|
56
|
+
series: sampleSeries,
|
|
57
|
+
width: 400,
|
|
58
|
+
height: 200,
|
|
59
|
+
enableScrubbing: true,
|
|
60
|
+
children: /*#__PURE__*/_jsx(Text, {
|
|
61
|
+
children: "child"
|
|
62
|
+
})
|
|
63
|
+
})
|
|
64
|
+
}));
|
|
65
|
+
expect(getByTestId('scrubber-gesture-overlay')).toBeTruthy();
|
|
66
|
+
});
|
|
67
|
+
it('does not render the gesture overlay when enableScrubbing is false', () => {
|
|
68
|
+
const {
|
|
69
|
+
queryByTestId
|
|
70
|
+
} = render(/*#__PURE__*/_jsx(Wrapper, {
|
|
71
|
+
children: /*#__PURE__*/_jsx(CartesianChart, {
|
|
72
|
+
series: sampleSeries,
|
|
73
|
+
width: 400,
|
|
74
|
+
height: 200,
|
|
75
|
+
enableScrubbing: false,
|
|
76
|
+
children: /*#__PURE__*/_jsx(Text, {
|
|
77
|
+
children: "child"
|
|
78
|
+
})
|
|
79
|
+
})
|
|
80
|
+
}));
|
|
81
|
+
expect(queryByTestId('scrubber-gesture-overlay')).toBeNull();
|
|
82
|
+
});
|
|
83
|
+
it('provides initial scrubberPosition as undefined via context', () => {
|
|
84
|
+
const {
|
|
85
|
+
getByTestId
|
|
86
|
+
} = render(/*#__PURE__*/_jsx(Wrapper, {
|
|
87
|
+
children: /*#__PURE__*/_jsx(CartesianChart, {
|
|
88
|
+
series: sampleSeries,
|
|
89
|
+
width: 400,
|
|
90
|
+
height: 200,
|
|
91
|
+
enableScrubbing: true,
|
|
92
|
+
children: /*#__PURE__*/_jsx(ContextConsumer, {})
|
|
93
|
+
})
|
|
94
|
+
}));
|
|
95
|
+
expect(getByTestId('context-output').props.children).toBe('enabled:true,pos:none');
|
|
96
|
+
});
|
|
97
|
+
it('calls onScrubberPositionChange when position is updated via context', () => {
|
|
98
|
+
const onScrubberPositionChange = jest.fn();
|
|
99
|
+
const ContextTrigger = () => {
|
|
100
|
+
const {
|
|
101
|
+
onScrubberPositionChange: updatePosition
|
|
102
|
+
} = useScrubberContext();
|
|
103
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
104
|
+
children: [/*#__PURE__*/_jsx(Pressable, {
|
|
105
|
+
testID: "set-position",
|
|
106
|
+
onPress: () => updatePosition(2)
|
|
107
|
+
}), /*#__PURE__*/_jsx(Pressable, {
|
|
108
|
+
testID: "clear-position",
|
|
109
|
+
onPress: () => updatePosition(undefined)
|
|
110
|
+
})]
|
|
111
|
+
});
|
|
112
|
+
};
|
|
113
|
+
const {
|
|
114
|
+
getByTestId
|
|
115
|
+
} = render(/*#__PURE__*/_jsx(Wrapper, {
|
|
116
|
+
children: /*#__PURE__*/_jsx(CartesianChart, {
|
|
117
|
+
series: sampleSeries,
|
|
118
|
+
width: 400,
|
|
119
|
+
height: 200,
|
|
120
|
+
enableScrubbing: true,
|
|
121
|
+
onScrubberPositionChange: onScrubberPositionChange,
|
|
122
|
+
children: /*#__PURE__*/_jsx(ContextTrigger, {})
|
|
123
|
+
})
|
|
124
|
+
}));
|
|
125
|
+
fireEvent.press(getByTestId('set-position'));
|
|
126
|
+
expect(onScrubberPositionChange).toHaveBeenCalledWith(2);
|
|
127
|
+
fireEvent.press(getByTestId('clear-position'));
|
|
128
|
+
expect(onScrubberPositionChange).toHaveBeenCalledWith(undefined);
|
|
129
|
+
expect(onScrubberPositionChange).toHaveBeenCalledTimes(2);
|
|
130
|
+
});
|
|
131
|
+
it('does not fire onScrubberPositionChange when the index is unchanged', () => {
|
|
132
|
+
const onScrubberPositionChange = jest.fn();
|
|
133
|
+
const ContextTrigger = () => {
|
|
134
|
+
const {
|
|
135
|
+
onScrubberPositionChange: updatePosition
|
|
136
|
+
} = useScrubberContext();
|
|
137
|
+
return /*#__PURE__*/_jsx(Pressable, {
|
|
138
|
+
testID: "set-position",
|
|
139
|
+
onPress: () => updatePosition(2)
|
|
140
|
+
});
|
|
141
|
+
};
|
|
142
|
+
const {
|
|
143
|
+
getByTestId
|
|
144
|
+
} = render(/*#__PURE__*/_jsx(Wrapper, {
|
|
145
|
+
children: /*#__PURE__*/_jsx(CartesianChart, {
|
|
146
|
+
series: sampleSeries,
|
|
147
|
+
width: 400,
|
|
148
|
+
height: 200,
|
|
149
|
+
enableScrubbing: true,
|
|
150
|
+
onScrubberPositionChange: onScrubberPositionChange,
|
|
151
|
+
children: /*#__PURE__*/_jsx(ContextTrigger, {})
|
|
152
|
+
})
|
|
153
|
+
}));
|
|
154
|
+
fireEvent.press(getByTestId('set-position'));
|
|
155
|
+
fireEvent.press(getByTestId('set-position'));
|
|
156
|
+
fireEvent.press(getByTestId('set-position'));
|
|
157
|
+
expect(onScrubberPositionChange).toHaveBeenCalledTimes(1);
|
|
158
|
+
});
|
|
159
|
+
it('clamps out-of-range index set via context', () => {
|
|
160
|
+
const onScrubberPositionChange = jest.fn();
|
|
161
|
+
const ContextTrigger = () => {
|
|
162
|
+
const {
|
|
163
|
+
onScrubberPositionChange: updatePosition
|
|
164
|
+
} = useScrubberContext();
|
|
165
|
+
return /*#__PURE__*/_jsx(Pressable, {
|
|
166
|
+
testID: "set-position",
|
|
167
|
+
onPress: () => updatePosition(999)
|
|
168
|
+
});
|
|
169
|
+
};
|
|
170
|
+
const {
|
|
171
|
+
getByTestId
|
|
172
|
+
} = render(/*#__PURE__*/_jsx(Wrapper, {
|
|
173
|
+
children: /*#__PURE__*/_jsx(CartesianChart, {
|
|
174
|
+
series: sampleSeries,
|
|
175
|
+
width: 400,
|
|
176
|
+
height: 200,
|
|
177
|
+
enableScrubbing: true,
|
|
178
|
+
onScrubberPositionChange: onScrubberPositionChange,
|
|
179
|
+
children: /*#__PURE__*/_jsx(ContextTrigger, {})
|
|
180
|
+
})
|
|
181
|
+
}));
|
|
182
|
+
fireEvent.press(getByTestId('set-position'));
|
|
183
|
+
expect(onScrubberPositionChange).toHaveBeenCalledWith(sampleSeries[0].data.length - 1);
|
|
184
|
+
});
|
|
185
|
+
it('does not fire callback when dataLength is 0', () => {
|
|
186
|
+
const onScrubberPositionChange = jest.fn();
|
|
187
|
+
const emptySeries = [{
|
|
188
|
+
id: 's1',
|
|
189
|
+
stroke: '#7B61FF',
|
|
190
|
+
data: []
|
|
191
|
+
}];
|
|
192
|
+
const ContextTrigger = () => {
|
|
193
|
+
const {
|
|
194
|
+
onScrubberPositionChange: updatePosition
|
|
195
|
+
} = useScrubberContext();
|
|
196
|
+
return /*#__PURE__*/_jsx(Pressable, {
|
|
197
|
+
testID: "set-position",
|
|
198
|
+
onPress: () => updatePosition(0)
|
|
199
|
+
});
|
|
200
|
+
};
|
|
201
|
+
const {
|
|
202
|
+
getByTestId
|
|
203
|
+
} = render(/*#__PURE__*/_jsx(Wrapper, {
|
|
204
|
+
children: /*#__PURE__*/_jsx(CartesianChart, {
|
|
205
|
+
series: emptySeries,
|
|
206
|
+
width: 400,
|
|
207
|
+
height: 200,
|
|
208
|
+
enableScrubbing: true,
|
|
209
|
+
onScrubberPositionChange: onScrubberPositionChange,
|
|
210
|
+
children: /*#__PURE__*/_jsx(ContextTrigger, {})
|
|
211
|
+
})
|
|
212
|
+
}));
|
|
213
|
+
fireEvent.press(getByTestId('set-position'));
|
|
214
|
+
expect(onScrubberPositionChange).not.toHaveBeenCalled();
|
|
215
|
+
});
|
|
216
|
+
});
|
|
217
|
+
//# sourceMappingURL=ScrubberProvider.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["describe","expect","it","jest","ledgerLiveThemes","ThemeProvider","fireEvent","render","Pressable","Text","CartesianChart","useScrubberContext","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","sampleSeries","id","stroke","data","Wrapper","children","themes","colorScheme","ContextConsumer","scrubberPosition","enableScrubbing","testID","getByTestId","series","width","height","toBeTruthy","queryByTestId","toBeNull","props","toBe","onScrubberPositionChange","fn","ContextTrigger","updatePosition","onPress","undefined","press","toHaveBeenCalledWith","toHaveBeenCalledTimes","length","emptySeries","not","toHaveBeenCalled"],"sourceRoot":"../../../../../src","sources":["lib/Components/Scrubber/ScrubberProvider.test.tsx"],"mappings":";;AAAA,SAASA,QAAQ,EAAEC,MAAM,EAAEC,EAAE,EAAEC,IAAI,QAAQ,eAAe;AAC1D,SAASC,gBAAgB,QAAQ,6BAA6B;AAC9D,SAASC,aAAa,QAAQ,4BAA4B;AAC1D,SAASC,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,CAAC;MACzE,oBACEE,IAAA,CAACL,SAAS;QAACqB,MAAM,EAAC,cAAc;QAACc,OAAO,EAAEA,CAAA,KAAMD,cAAc,CAAC,CAAC;MAAE,CAAE,CAAC;IAEzE,CAAC;IAED,MAAM;MAAEZ;IAAY,CAAC,GAAGvB,MAAM,cAC5BM,IAAA,CAACS,OAAO;MAAAC,QAAA,eACNV,IAAA,CAACH,cAAc;QACbqB,MAAM,EAAEkB,WAAY;QACpBjB,KAAK,EAAE,GAAI;QACXC,MAAM,EAAE,GAAI;QACZL,eAAe,EAAE,IAAK;QACtBW,wBAAwB,EAAEA,wBAAyB;QAAAhB,QAAA,eAEnDV,IAAA,CAAC4B,cAAc,IAAE;MAAC,CACJ;IAAC,CACV,CACX,CAAC;IAEDnC,SAAS,CAACuC,KAAK,CAACf,WAAW,CAAC,cAAc,CAAC,CAAC;IAC5C7B,MAAM,CAACsC,wBAAwB,CAAC,CAACW,GAAG,CAACC,gBAAgB,CAAC,CAAC;EACzD,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
export const BEACON_RADIUS = 5;
|
|
4
|
+
export const BEACON_STROKE_WIDTH = 2;
|
|
5
|
+
export const LABEL_OFFSET_Y = 12;
|
|
6
|
+
export const OVERLAY_OFFSET = 2;
|
|
7
|
+
export const OVERLAY_LINE_INSET = 0.5;
|
|
8
|
+
export const OVERLAY_OPACITY = 0.8;
|
|
9
|
+
export const LINE_GRADIENT_EDGE_OPACITY = 0.1;
|
|
10
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["BEACON_RADIUS","BEACON_STROKE_WIDTH","LABEL_OFFSET_Y","OVERLAY_OFFSET","OVERLAY_LINE_INSET","OVERLAY_OPACITY","LINE_GRADIENT_EDGE_OPACITY"],"sourceRoot":"../../../../../src","sources":["lib/Components/Scrubber/constants.ts"],"mappings":";;AAAA,OAAO,MAAMA,aAAa,GAAG,CAAC;AAC9B,OAAO,MAAMC,mBAAmB,GAAG,CAAC;AACpC,OAAO,MAAMC,cAAc,GAAG,EAAE;AAChC,OAAO,MAAMC,cAAc,GAAG,CAAC;AAC/B,OAAO,MAAMC,kBAAkB,GAAG,GAAG;AACrC,OAAO,MAAMC,eAAe,GAAG,GAAG;AAClC,OAAO,MAAMC,0BAA0B,GAAG,GAAG","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["ScrubberContextProvider","useScrubberContext"],"sourceRoot":"../../../../../../src","sources":["lib/Components/Scrubber/context/index.ts"],"mappings":";;AAAA,SAASA,uBAAuB,EAAEC,kBAAkB,QAAQ,sBAAmB","ignoreList":[]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { createSafeContext } from '@ledgerhq/lumen-utils-shared';
|
|
4
|
+
const [ScrubberContextProvider, _useScrubberSafeContext] = createSafeContext('Scrubber');
|
|
5
|
+
export const useScrubberContext = () => _useScrubberSafeContext({
|
|
6
|
+
consumerName: 'useScrubberContext',
|
|
7
|
+
contextRequired: true
|
|
8
|
+
});
|
|
9
|
+
export { ScrubberContextProvider };
|
|
10
|
+
//# sourceMappingURL=scrubberContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createSafeContext","ScrubberContextProvider","_useScrubberSafeContext","useScrubberContext","consumerName","contextRequired"],"sourceRoot":"../../../../../../src","sources":["lib/Components/Scrubber/context/scrubberContext.ts"],"mappings":";;AAAA,SAASA,iBAAiB,QAAQ,8BAA8B;AAIhE,MAAM,CAACC,uBAAuB,EAAEC,uBAAuB,CAAC,GACtDF,iBAAiB,CAAuB,UAAU,CAAC;AAErD,OAAO,MAAMG,kBAAkB,GAAGA,CAAA,KAChCD,uBAAuB,CAAC;EACtBE,YAAY,EAAE,oBAAoB;EAClCC,eAAe,EAAE;AACnB,CAAC,CAAC;AAEJ,SAASJ,uBAAuB","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Scrubber","useScrubberContext"],"sourceRoot":"../../../../../src","sources":["lib/Components/Scrubber/index.ts"],"mappings":";;AAAA,SAASA,QAAQ,QAAQ,eAAY;AACrC,SAASC,kBAAkB,QAAQ,oBAAW","ignoreList":[]}
|