react-native-wagmi-charts 1.0.4 → 1.2.1

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.
Files changed (132) hide show
  1. package/.DS_Store +0 -0
  2. package/.prettierrc.js +5 -0
  3. package/README.md +171 -121
  4. package/example/.DS_Store +0 -0
  5. package/example/README.md +32 -0
  6. package/example/package.json +1 -1
  7. package/example/src/App.tsx +32 -7
  8. package/example/src/CandlestickChart.tsx +23 -11
  9. package/example/src/LineChart.tsx +51 -20
  10. package/example/src/{candlestick-data.json → data/candlestick-data.json} +0 -0
  11. package/example/src/{candlestick-data2.json → data/candlestick-data2.json} +0 -0
  12. package/example/src/{line-data.json → data/line-data.json} +0 -0
  13. package/example/src/{line-data2.json → data/line-data2.json} +0 -0
  14. package/example/yarn.lock +5 -5
  15. package/lib/commonjs/charts/candle/Crosshair.js +6 -17
  16. package/lib/commonjs/charts/candle/Crosshair.js.map +1 -1
  17. package/lib/commonjs/charts/candle/CrosshairTooltip.js +12 -8
  18. package/lib/commonjs/charts/candle/CrosshairTooltip.js.map +1 -1
  19. package/lib/commonjs/charts/candle/DatetimeText.js +7 -8
  20. package/lib/commonjs/charts/candle/DatetimeText.js.map +1 -1
  21. package/lib/commonjs/charts/candle/Line.js.map +1 -1
  22. package/lib/commonjs/charts/candle/PriceText.js +7 -8
  23. package/lib/commonjs/charts/candle/PriceText.js.map +1 -1
  24. package/lib/commonjs/charts/candle/useCandleData.js.map +1 -1
  25. package/lib/commonjs/charts/candle/useCandlestickChart.js.map +1 -1
  26. package/lib/commonjs/charts/candle/useDatetime.js.map +1 -1
  27. package/lib/commonjs/charts/candle/usePrice.js.map +1 -1
  28. package/lib/commonjs/charts/candle/utils.js.map +1 -1
  29. package/lib/commonjs/charts/line/Chart.js.map +1 -1
  30. package/lib/commonjs/charts/line/Cursor.js.map +1 -1
  31. package/lib/commonjs/charts/line/CursorCrosshair.js +4 -3
  32. package/lib/commonjs/charts/line/CursorCrosshair.js.map +1 -1
  33. package/lib/commonjs/charts/line/CursorLine.js +8 -1
  34. package/lib/commonjs/charts/line/CursorLine.js.map +1 -1
  35. package/lib/commonjs/charts/line/DatetimeText.js +7 -8
  36. package/lib/commonjs/charts/line/DatetimeText.js.map +1 -1
  37. package/lib/commonjs/charts/line/Path.js +13 -16
  38. package/lib/commonjs/charts/line/Path.js.map +1 -1
  39. package/lib/commonjs/charts/line/PriceText.js +7 -8
  40. package/lib/commonjs/charts/line/PriceText.js.map +1 -1
  41. package/lib/commonjs/charts/line/interpolatePath.js +600 -0
  42. package/lib/commonjs/charts/line/interpolatePath.js.map +1 -0
  43. package/lib/commonjs/charts/line/useDatetime.js.map +1 -1
  44. package/lib/commonjs/charts/line/usePrice.js.map +1 -1
  45. package/lib/commonjs/charts/line/utils.js +1 -70
  46. package/lib/commonjs/charts/line/utils.js.map +1 -1
  47. package/lib/commonjs/components/AnimatedText.js +63 -0
  48. package/lib/commonjs/components/AnimatedText.js.map +1 -0
  49. package/lib/commonjs/utils.js.map +1 -1
  50. package/lib/module/charts/candle/Crosshair.js +7 -16
  51. package/lib/module/charts/candle/Crosshair.js.map +1 -1
  52. package/lib/module/charts/candle/CrosshairTooltip.js +10 -8
  53. package/lib/module/charts/candle/CrosshairTooltip.js.map +1 -1
  54. package/lib/module/charts/candle/DatetimeText.js +6 -7
  55. package/lib/module/charts/candle/DatetimeText.js.map +1 -1
  56. package/lib/module/charts/candle/Line.js.map +1 -1
  57. package/lib/module/charts/candle/PriceText.js +6 -7
  58. package/lib/module/charts/candle/PriceText.js.map +1 -1
  59. package/lib/module/charts/candle/useCandleData.js.map +1 -1
  60. package/lib/module/charts/candle/useCandlestickChart.js.map +1 -1
  61. package/lib/module/charts/candle/useDatetime.js.map +1 -1
  62. package/lib/module/charts/candle/usePrice.js.map +1 -1
  63. package/lib/module/charts/candle/utils.js.map +1 -1
  64. package/lib/module/charts/line/Chart.js.map +1 -1
  65. package/lib/module/charts/line/Cursor.js.map +1 -1
  66. package/lib/module/charts/line/CursorCrosshair.js +4 -3
  67. package/lib/module/charts/line/CursorCrosshair.js.map +1 -1
  68. package/lib/module/charts/line/CursorLine.js +7 -1
  69. package/lib/module/charts/line/CursorLine.js.map +1 -1
  70. package/lib/module/charts/line/DatetimeText.js +6 -7
  71. package/lib/module/charts/line/DatetimeText.js.map +1 -1
  72. package/lib/module/charts/line/Path.js +11 -15
  73. package/lib/module/charts/line/Path.js.map +1 -1
  74. package/lib/module/charts/line/PriceText.js +6 -7
  75. package/lib/module/charts/line/PriceText.js.map +1 -1
  76. package/lib/module/charts/line/interpolatePath.js +587 -0
  77. package/lib/module/charts/line/interpolatePath.js.map +1 -0
  78. package/lib/module/charts/line/useDatetime.js.map +1 -1
  79. package/lib/module/charts/line/usePrice.js.map +1 -1
  80. package/lib/module/charts/line/utils.js +1 -66
  81. package/lib/module/charts/line/utils.js.map +1 -1
  82. package/lib/module/components/AnimatedText.js +43 -0
  83. package/lib/module/components/AnimatedText.js.map +1 -0
  84. package/lib/module/utils.js.map +1 -1
  85. package/lib/typescript/src/charts/candle/Crosshair.d.ts +4 -4
  86. package/lib/typescript/src/charts/candle/DatetimeText.d.ts +3 -2
  87. package/lib/typescript/src/charts/candle/Line.d.ts +1 -1
  88. package/lib/typescript/src/charts/candle/PriceText.d.ts +3 -3
  89. package/lib/typescript/src/charts/candle/types.d.ts +8 -3
  90. package/lib/typescript/src/charts/candle/useCandleData.d.ts +3 -3
  91. package/lib/typescript/src/charts/candle/useCandlestickChart.d.ts +2 -1
  92. package/lib/typescript/src/charts/candle/useDatetime.d.ts +5 -7
  93. package/lib/typescript/src/charts/candle/usePrice.d.ts +5 -8
  94. package/lib/typescript/src/charts/candle/utils.d.ts +1 -1
  95. package/lib/typescript/src/charts/line/Chart.d.ts +1 -1
  96. package/lib/typescript/src/charts/line/Cursor.d.ts +1 -2
  97. package/lib/typescript/src/charts/line/CursorCrosshair.d.ts +3 -2
  98. package/lib/typescript/src/charts/line/DatetimeText.d.ts +5 -6
  99. package/lib/typescript/src/charts/line/Path.d.ts +17 -1
  100. package/lib/typescript/src/charts/line/PriceText.d.ts +3 -2
  101. package/lib/typescript/src/charts/line/interpolatePath.d.ts +50 -0
  102. package/lib/typescript/src/charts/line/useDatetime.d.ts +4 -5
  103. package/lib/typescript/src/charts/line/usePrice.d.ts +3 -2
  104. package/lib/typescript/src/charts/line/utils.d.ts +0 -13
  105. package/lib/typescript/src/components/AnimatedText.d.ts +9 -0
  106. package/lib/typescript/src/utils.d.ts +2 -4
  107. package/package.json +4 -4
  108. package/src/charts/candle/Crosshair.tsx +20 -20
  109. package/src/charts/candle/CrosshairTooltip.tsx +11 -4
  110. package/src/charts/candle/DatetimeText.tsx +5 -4
  111. package/src/charts/candle/Line.tsx +1 -1
  112. package/src/charts/candle/PriceText.tsx +5 -5
  113. package/src/charts/candle/types.ts +11 -3
  114. package/src/charts/candle/useCandleData.ts +3 -2
  115. package/src/charts/candle/useCandlestickChart.ts +2 -1
  116. package/src/charts/candle/useDatetime.ts +7 -3
  117. package/src/charts/candle/usePrice.ts +10 -3
  118. package/src/charts/candle/utils.ts +1 -1
  119. package/src/charts/line/Chart.tsx +1 -1
  120. package/src/charts/line/Cursor.tsx +7 -3
  121. package/src/charts/line/CursorCrosshair.tsx +4 -3
  122. package/src/charts/line/CursorLine.tsx +9 -1
  123. package/src/charts/line/DatetimeText.tsx +8 -7
  124. package/src/charts/line/Path.tsx +25 -21
  125. package/src/charts/line/PriceText.tsx +5 -4
  126. package/src/charts/line/interpolatePath.ts +650 -0
  127. package/src/charts/line/useDatetime.ts +3 -2
  128. package/src/charts/line/usePrice.ts +2 -1
  129. package/src/charts/line/utils.ts +2 -79
  130. package/src/components/AnimatedText.tsx +53 -0
  131. package/src/utils.ts +3 -3
  132. package/yarn.lock +5 -5
@@ -28,7 +28,8 @@ function LineChartCursorCrosshair({
28
28
  outerSize = 32,
29
29
  crosshairWrapperProps = {},
30
30
  crosshairProps = {},
31
- crosshairOuterProps = {}
31
+ crosshairOuterProps = {},
32
+ ...props
32
33
  }) {
33
34
  const {
34
35
  currentX,
@@ -46,9 +47,9 @@ function LineChartCursorCrosshair({
46
47
  })
47
48
  }]
48
49
  }));
49
- return /*#__PURE__*/React.createElement(_Cursor.LineChartCursor, {
50
+ return /*#__PURE__*/React.createElement(_Cursor.LineChartCursor, _extends({
50
51
  type: "crosshair"
51
- }, /*#__PURE__*/React.createElement(_reactNativeReanimated.default.View, _extends({}, crosshairWrapperProps, {
52
+ }, props), /*#__PURE__*/React.createElement(_reactNativeReanimated.default.View, _extends({}, crosshairWrapperProps, {
52
53
  style: [{
53
54
  width: outerSize,
54
55
  height: outerSize,
@@ -1 +1 @@
1
- {"version":3,"sources":["CursorCrosshair.tsx"],"names":["LineChartCursorCrosshair","children","color","size","outerSize","crosshairWrapperProps","crosshairProps","crosshairOuterProps","currentX","currentY","isActive","animatedCursorStyle","transform","translateX","value","translateY","scale","damping","width","height","alignItems","justifyContent","style","backgroundColor","borderRadius","opacity","position"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AAKA;;AACA;;;;;;;;AAYO,SAASA,wBAAT,CAAkC;AACvCC,EAAAA,QADuC;AAEvCC,EAAAA,KAAK,GAAG,OAF+B;AAGvCC,EAAAA,IAAI,GAAG,CAHgC;AAIvCC,EAAAA,SAAS,GAAG,EAJ2B;AAKvCC,EAAAA,qBAAqB,GAAG,EALe;AAMvCC,EAAAA,cAAc,GAAG,EANsB;AAOvCC,EAAAA,mBAAmB,GAAG;AAPiB,CAAlC,EAQ2B;AAChC,QAAM;AAAEC,IAAAA,QAAF;AAAYC,IAAAA,QAAZ;AAAsBC,IAAAA;AAAtB,MAAmC,iCAAzC;AAEA,QAAMC,mBAAmB,GAAG,6CAAiB,OAAO;AAClDC,IAAAA,SAAS,EAAE,CACT;AAAEC,MAAAA,UAAU,EAAEL,QAAQ,CAACM,KAAT,GAAiBV,SAAS,GAAG;AAA3C,KADS,EAET;AAAEW,MAAAA,UAAU,EAAEN,QAAQ,CAACK,KAAT,GAAiBV,SAAS,GAAG;AAA3C,KAFS,EAGT;AACEY,MAAAA,KAAK,EAAE,uCAAWN,QAAQ,CAACI,KAAT,GAAiB,CAAjB,GAAqB,CAAhC,EAAmC;AACxCG,QAAAA,OAAO,EAAE;AAD+B,OAAnC;AADT,KAHS;AADuC,GAAP,CAAjB,CAA5B;AAYA,sBACE,oBAAC,uBAAD;AAAiB,IAAA,IAAI,EAAC;AAAtB,kBACE,oBAAC,8BAAD,CAAU,IAAV,eACMZ,qBADN;AAEE,IAAA,KAAK,EAAE,CACL;AACEa,MAAAA,KAAK,EAAEd,SADT;AAEEe,MAAAA,MAAM,EAAEf,SAFV;AAGEgB,MAAAA,UAAU,EAAE,QAHd;AAIEC,MAAAA,cAAc,EAAE;AAJlB,KADK,EAOLV,mBAPK,EAQLN,qBAAqB,CAACiB,KARjB;AAFT,mBAaE,oBAAC,iBAAD,eACMf,mBADN;AAEE,IAAA,KAAK,EAAE,CACL;AACEgB,MAAAA,eAAe,EAAErB,KADnB;AAEEgB,MAAAA,KAAK,EAAEd,SAFT;AAGEe,MAAAA,MAAM,EAAEf,SAHV;AAIEoB,MAAAA,YAAY,EAAEpB,SAJhB;AAKEqB,MAAAA,OAAO,EAAE,GALX;AAMEC,MAAAA,QAAQ,EAAE;AANZ,KADK,EASLnB,mBAAmB,CAACe,KATf;AAFT,KAbF,eA2BE,oBAAC,iBAAD,eACMhB,cADN;AAEE,IAAA,KAAK,EAAE,CACL;AACEiB,MAAAA,eAAe,EAAErB,KADnB;AAEEgB,MAAAA,KAAK,EAAEf,IAFT;AAGEgB,MAAAA,MAAM,EAAEhB,IAHV;AAIEqB,MAAAA,YAAY,EAAErB;AAJhB,KADK,EAOLG,cAAc,CAACgB,KAPV;AAFT,KA3BF,CADF,EAyCGrB,QAzCH,CADF;AA6CD","sourcesContent":["import * as React from 'react';\nimport { View, ViewProps } from 'react-native';\nimport Animated, {\n useAnimatedStyle,\n withSpring,\n} from 'react-native-reanimated';\n\nimport { LineChartCursor } from './Cursor';\nimport { useLineChart } from './useLineChart';\n\ntype LineChartCursorCrosshairProps = {\n children?: React.ReactNode;\n color?: string;\n size?: number;\n outerSize?: number;\n crosshairWrapperProps?: Animated.AnimateProps<ViewProps>;\n crosshairProps?: ViewProps;\n crosshairOuterProps?: ViewProps;\n};\n\nexport function LineChartCursorCrosshair({\n children,\n color = 'black',\n size = 8,\n outerSize = 32,\n crosshairWrapperProps = {},\n crosshairProps = {},\n crosshairOuterProps = {},\n}: LineChartCursorCrosshairProps) {\n const { currentX, currentY, isActive } = useLineChart();\n\n const animatedCursorStyle = useAnimatedStyle(() => ({\n transform: [\n { translateX: currentX.value - outerSize / 2 },\n { translateY: currentY.value - outerSize / 2 },\n {\n scale: withSpring(isActive.value ? 1 : 0, {\n damping: 10,\n }),\n },\n ],\n }));\n\n return (\n <LineChartCursor type=\"crosshair\">\n <Animated.View\n {...crosshairWrapperProps}\n style={[\n {\n width: outerSize,\n height: outerSize,\n alignItems: 'center',\n justifyContent: 'center',\n },\n animatedCursorStyle,\n crosshairWrapperProps.style,\n ]}\n >\n <View\n {...crosshairOuterProps}\n style={[\n {\n backgroundColor: color,\n width: outerSize,\n height: outerSize,\n borderRadius: outerSize,\n opacity: 0.1,\n position: 'absolute',\n },\n crosshairOuterProps.style,\n ]}\n />\n <View\n {...crosshairProps}\n style={[\n {\n backgroundColor: color,\n width: size,\n height: size,\n borderRadius: size,\n },\n crosshairProps.style,\n ]}\n />\n </Animated.View>\n {children}\n </LineChartCursor>\n );\n}\n"]}
1
+ {"version":3,"sources":["CursorCrosshair.tsx"],"names":["LineChartCursorCrosshair","children","color","size","outerSize","crosshairWrapperProps","crosshairProps","crosshairOuterProps","props","currentX","currentY","isActive","animatedCursorStyle","transform","translateX","value","translateY","scale","damping","width","height","alignItems","justifyContent","style","backgroundColor","borderRadius","opacity","position"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AAKA;;AACA;;;;;;;;AAYO,SAASA,wBAAT,CAAkC;AACvCC,EAAAA,QADuC;AAEvCC,EAAAA,KAAK,GAAG,OAF+B;AAGvCC,EAAAA,IAAI,GAAG,CAHgC;AAIvCC,EAAAA,SAAS,GAAG,EAJ2B;AAKvCC,EAAAA,qBAAqB,GAAG,EALe;AAMvCC,EAAAA,cAAc,GAAG,EANsB;AAOvCC,EAAAA,mBAAmB,GAAG,EAPiB;AAQvC,KAAGC;AARoC,CAAlC,EAS2B;AAChC,QAAM;AAAEC,IAAAA,QAAF;AAAYC,IAAAA,QAAZ;AAAsBC,IAAAA;AAAtB,MAAmC,iCAAzC;AAEA,QAAMC,mBAAmB,GAAG,6CAAiB,OAAO;AAClDC,IAAAA,SAAS,EAAE,CACT;AAAEC,MAAAA,UAAU,EAAEL,QAAQ,CAACM,KAAT,GAAiBX,SAAS,GAAG;AAA3C,KADS,EAET;AAAEY,MAAAA,UAAU,EAAEN,QAAQ,CAACK,KAAT,GAAiBX,SAAS,GAAG;AAA3C,KAFS,EAGT;AACEa,MAAAA,KAAK,EAAE,uCAAWN,QAAQ,CAACI,KAAT,GAAiB,CAAjB,GAAqB,CAAhC,EAAmC;AACxCG,QAAAA,OAAO,EAAE;AAD+B,OAAnC;AADT,KAHS;AADuC,GAAP,CAAjB,CAA5B;AAYA,sBACE,oBAAC,uBAAD;AAAiB,IAAA,IAAI,EAAC;AAAtB,KAAsCV,KAAtC,gBACE,oBAAC,8BAAD,CAAU,IAAV,eACMH,qBADN;AAEE,IAAA,KAAK,EAAE,CACL;AACEc,MAAAA,KAAK,EAAEf,SADT;AAEEgB,MAAAA,MAAM,EAAEhB,SAFV;AAGEiB,MAAAA,UAAU,EAAE,QAHd;AAIEC,MAAAA,cAAc,EAAE;AAJlB,KADK,EAOLV,mBAPK,EAQLP,qBAAqB,CAACkB,KARjB;AAFT,mBAaE,oBAAC,iBAAD,eACMhB,mBADN;AAEE,IAAA,KAAK,EAAE,CACL;AACEiB,MAAAA,eAAe,EAAEtB,KADnB;AAEEiB,MAAAA,KAAK,EAAEf,SAFT;AAGEgB,MAAAA,MAAM,EAAEhB,SAHV;AAIEqB,MAAAA,YAAY,EAAErB,SAJhB;AAKEsB,MAAAA,OAAO,EAAE,GALX;AAMEC,MAAAA,QAAQ,EAAE;AANZ,KADK,EASLpB,mBAAmB,CAACgB,KATf;AAFT,KAbF,eA2BE,oBAAC,iBAAD,eACMjB,cADN;AAEE,IAAA,KAAK,EAAE,CACL;AACEkB,MAAAA,eAAe,EAAEtB,KADnB;AAEEiB,MAAAA,KAAK,EAAEhB,IAFT;AAGEiB,MAAAA,MAAM,EAAEjB,IAHV;AAIEsB,MAAAA,YAAY,EAAEtB;AAJhB,KADK,EAOLG,cAAc,CAACiB,KAPV;AAFT,KA3BF,CADF,EAyCGtB,QAzCH,CADF;AA6CD","sourcesContent":["import * as React from 'react';\nimport { View, ViewProps } from 'react-native';\nimport Animated, {\n useAnimatedStyle,\n withSpring,\n} from 'react-native-reanimated';\n\nimport { LineChartCursor, LineChartCursorProps } from './Cursor';\nimport { useLineChart } from './useLineChart';\n\ntype LineChartCursorCrosshairProps = Omit<LineChartCursorProps, 'type'> & {\n children?: React.ReactNode;\n color?: string;\n size?: number;\n outerSize?: number;\n crosshairWrapperProps?: Animated.AnimateProps<ViewProps>;\n crosshairProps?: ViewProps;\n crosshairOuterProps?: ViewProps;\n};\n\nexport function LineChartCursorCrosshair({\n children,\n color = 'black',\n size = 8,\n outerSize = 32,\n crosshairWrapperProps = {},\n crosshairProps = {},\n crosshairOuterProps = {},\n ...props\n}: LineChartCursorCrosshairProps) {\n const { currentX, currentY, isActive } = useLineChart();\n\n const animatedCursorStyle = useAnimatedStyle(() => ({\n transform: [\n { translateX: currentX.value - outerSize / 2 },\n { translateY: currentY.value - outerSize / 2 },\n {\n scale: withSpring(isActive.value ? 1 : 0, {\n damping: 10,\n }),\n },\n ],\n }));\n\n return (\n <LineChartCursor type=\"crosshair\" {...props}>\n <Animated.View\n {...crosshairWrapperProps}\n style={[\n {\n width: outerSize,\n height: outerSize,\n alignItems: 'center',\n justifyContent: 'center',\n },\n animatedCursorStyle,\n crosshairWrapperProps.style,\n ]}\n >\n <View\n {...crosshairOuterProps}\n style={[\n {\n backgroundColor: color,\n width: outerSize,\n height: outerSize,\n borderRadius: outerSize,\n opacity: 0.1,\n position: 'absolute',\n },\n crosshairOuterProps.style,\n ]}\n />\n <View\n {...crosshairProps}\n style={[\n {\n backgroundColor: color,\n width: size,\n height: size,\n borderRadius: size,\n },\n crosshairProps.style,\n ]}\n />\n </Animated.View>\n {children}\n </LineChartCursor>\n );\n}\n"]}
@@ -52,7 +52,7 @@ const LineChartCursorLine = ({
52
52
  }, /*#__PURE__*/_react.default.createElement(_reactNativeReanimated.default.View, {
53
53
  style: vertical
54
54
  }, /*#__PURE__*/_react.default.createElement(_reactNativeSvg.default, {
55
- style: _reactNative.StyleSheet.absoluteFill
55
+ style: styles.svg
56
56
  }, /*#__PURE__*/_react.default.createElement(_reactNativeSvg.Line, _extends({
57
57
  x1: 0,
58
58
  y1: 0,
@@ -65,4 +65,11 @@ const LineChartCursorLine = ({
65
65
  };
66
66
 
67
67
  exports.LineChartCursorLine = LineChartCursorLine;
68
+
69
+ const styles = _reactNative.StyleSheet.create({
70
+ svg: { ..._reactNative.StyleSheet.absoluteFillObject,
71
+ // height: 100% is required for <svg /> on web
72
+ height: '100%'
73
+ }
74
+ });
68
75
  //# sourceMappingURL=CursorLine.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["CursorLine.tsx"],"names":["LineChartCursorLine","children","color","lineProps","height","React","useContext","LineChartDimensionsContext","currentX","isActive","vertical","opacity","value","transform","translateX","StyleSheet","absoluteFill"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AACA;;;;;;;;;;AAQO,MAAMA,mBAAmB,GAAG,CAAC;AAClCC,EAAAA,QADkC;AAElCC,EAAAA,KAAK,GAAG,MAF0B;AAGlCC,EAAAA,SAAS,GAAG;AAHsB,CAAD,KAIH;AAC9B,QAAM;AAAEC,IAAAA;AAAF,MAAaC,eAAMC,UAAN,CAAiBC,iCAAjB,CAAnB;;AACA,QAAM;AAAEC,IAAAA,QAAF;AAAYC,IAAAA;AAAZ,MAAyB,iCAA/B;AAEA,QAAMC,QAAQ,GAAG,6CAAiB,OAAO;AACvCC,IAAAA,OAAO,EAAEF,QAAQ,CAACG,KAAT,GAAiB,CAAjB,GAAqB,CADS;AAEvCR,IAAAA,MAAM,EAAE,MAF+B;AAGvCS,IAAAA,SAAS,EAAE,CAAC;AAAEC,MAAAA,UAAU,EAAEN,QAAQ,CAACI;AAAvB,KAAD;AAH4B,GAAP,CAAjB,CAAjB;AAMA,sBACE,6BAAC,uBAAD;AAAiB,IAAA,IAAI,EAAC;AAAtB,kBACE,6BAAC,8BAAD,CAAU,IAAV;AAAe,IAAA,KAAK,EAAEF;AAAtB,kBACE,6BAAC,uBAAD;AAAK,IAAA,KAAK,EAAEK,wBAAWC;AAAvB,kBACE,6BAAC,oBAAD;AACE,IAAA,EAAE,EAAE,CADN;AAEE,IAAA,EAAE,EAAE,CAFN;AAGE,IAAA,EAAE,EAAE,CAHN;AAIE,IAAA,EAAE,EAAEZ,MAJN;AAKE,IAAA,WAAW,EAAE,CALf;AAME,IAAA,MAAM,EAAEF,KANV;AAOE,IAAA,eAAe,EAAC;AAPlB,KAQMC,SARN,EADF,CADF,CADF,EAeGF,QAfH,CADF;AAmBD,CAjCM","sourcesContent":["import React from 'react';\nimport { StyleSheet } from 'react-native';\nimport Animated, { useAnimatedStyle } from 'react-native-reanimated';\nimport Svg, { Line as SVGLine, LineProps } from 'react-native-svg';\n\nimport { LineChartDimensionsContext } from './Chart';\nimport { LineChartCursor } from './Cursor';\nimport { useLineChart } from './useLineChart';\n\ntype LineChartCursorLineProps = {\n children?: React.ReactNode;\n color?: string;\n lineProps?: Partial<LineProps>;\n};\n\nexport const LineChartCursorLine = ({\n children,\n color = 'gray',\n lineProps = {},\n}: LineChartCursorLineProps) => {\n const { height } = React.useContext(LineChartDimensionsContext);\n const { currentX, isActive } = useLineChart();\n\n const vertical = useAnimatedStyle(() => ({\n opacity: isActive.value ? 1 : 0,\n height: '100%',\n transform: [{ translateX: currentX.value }],\n }));\n\n return (\n <LineChartCursor type=\"line\">\n <Animated.View style={vertical}>\n <Svg style={StyleSheet.absoluteFill}>\n <SVGLine\n x1={0}\n y1={0}\n x2={0}\n y2={height}\n strokeWidth={2}\n stroke={color}\n strokeDasharray=\"3 3\"\n {...lineProps}\n />\n </Svg>\n </Animated.View>\n {children}\n </LineChartCursor>\n );\n};\n"]}
1
+ {"version":3,"sources":["CursorLine.tsx"],"names":["LineChartCursorLine","children","color","lineProps","height","React","useContext","LineChartDimensionsContext","currentX","isActive","vertical","opacity","value","transform","translateX","styles","svg","StyleSheet","create","absoluteFillObject"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AACA;;;;;;;;;;AAQO,MAAMA,mBAAmB,GAAG,CAAC;AAClCC,EAAAA,QADkC;AAElCC,EAAAA,KAAK,GAAG,MAF0B;AAGlCC,EAAAA,SAAS,GAAG;AAHsB,CAAD,KAIH;AAC9B,QAAM;AAAEC,IAAAA;AAAF,MAAaC,eAAMC,UAAN,CAAiBC,iCAAjB,CAAnB;;AACA,QAAM;AAAEC,IAAAA,QAAF;AAAYC,IAAAA;AAAZ,MAAyB,iCAA/B;AAEA,QAAMC,QAAQ,GAAG,6CAAiB,OAAO;AACvCC,IAAAA,OAAO,EAAEF,QAAQ,CAACG,KAAT,GAAiB,CAAjB,GAAqB,CADS;AAEvCR,IAAAA,MAAM,EAAE,MAF+B;AAGvCS,IAAAA,SAAS,EAAE,CAAC;AAAEC,MAAAA,UAAU,EAAEN,QAAQ,CAACI;AAAvB,KAAD;AAH4B,GAAP,CAAjB,CAAjB;AAMA,sBACE,6BAAC,uBAAD;AAAiB,IAAA,IAAI,EAAC;AAAtB,kBACE,6BAAC,8BAAD,CAAU,IAAV;AAAe,IAAA,KAAK,EAAEF;AAAtB,kBACE,6BAAC,uBAAD;AAAK,IAAA,KAAK,EAAEK,MAAM,CAACC;AAAnB,kBACE,6BAAC,oBAAD;AACE,IAAA,EAAE,EAAE,CADN;AAEE,IAAA,EAAE,EAAE,CAFN;AAGE,IAAA,EAAE,EAAE,CAHN;AAIE,IAAA,EAAE,EAAEZ,MAJN;AAKE,IAAA,WAAW,EAAE,CALf;AAME,IAAA,MAAM,EAAEF,KANV;AAOE,IAAA,eAAe,EAAC;AAPlB,KAQMC,SARN,EADF,CADF,CADF,EAeGF,QAfH,CADF;AAmBD,CAjCM;;;;AAmCP,MAAMc,MAAM,GAAGE,wBAAWC,MAAX,CAAkB;AAC/BF,EAAAA,GAAG,EAAE,EACH,GAAGC,wBAAWE,kBADX;AAEH;AACAf,IAAAA,MAAM,EAAE;AAHL;AAD0B,CAAlB,CAAf","sourcesContent":["import React from 'react';\nimport { StyleSheet } from 'react-native';\nimport Animated, { useAnimatedStyle } from 'react-native-reanimated';\nimport Svg, { Line as SVGLine, LineProps } from 'react-native-svg';\n\nimport { LineChartDimensionsContext } from './Chart';\nimport { LineChartCursor } from './Cursor';\nimport { useLineChart } from './useLineChart';\n\ntype LineChartCursorLineProps = {\n children?: React.ReactNode;\n color?: string;\n lineProps?: Partial<LineProps>;\n};\n\nexport const LineChartCursorLine = ({\n children,\n color = 'gray',\n lineProps = {},\n}: LineChartCursorLineProps) => {\n const { height } = React.useContext(LineChartDimensionsContext);\n const { currentX, isActive } = useLineChart();\n\n const vertical = useAnimatedStyle(() => ({\n opacity: isActive.value ? 1 : 0,\n height: '100%',\n transform: [{ translateX: currentX.value }],\n }));\n\n return (\n <LineChartCursor type=\"line\">\n <Animated.View style={vertical}>\n <Svg style={styles.svg}>\n <SVGLine\n x1={0}\n y1={0}\n x2={0}\n y2={height}\n strokeWidth={2}\n stroke={color}\n strokeDasharray=\"3 3\"\n {...lineProps}\n />\n </Svg>\n </Animated.View>\n {children}\n </LineChartCursor>\n );\n};\n\nconst styles = StyleSheet.create({\n svg: {\n ...StyleSheet.absoluteFillObject,\n // height: 100% is required for <svg /> on web\n height: '100%',\n },\n});\n"]}
@@ -7,30 +7,29 @@ exports.LineChartDatetimeText = LineChartDatetimeText;
7
7
 
8
8
  var React = _interopRequireWildcard(require("react"));
9
9
 
10
- var _reactNativeRedash = require("react-native-redash");
11
-
12
10
  var _useDatetime = require("./useDatetime");
13
11
 
12
+ var _AnimatedText = require("../../components/AnimatedText");
13
+
14
14
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
15
15
 
16
16
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
17
17
 
18
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
19
-
20
18
  function LineChartDatetimeText({
21
19
  locale,
22
20
  options,
23
21
  format,
24
22
  variant = 'formatted',
25
- ...props
23
+ style
26
24
  }) {
27
25
  const datetime = (0, _useDatetime.useLineChartDatetime)({
28
26
  format,
29
27
  locale,
30
28
  options
31
29
  });
32
- return /*#__PURE__*/React.createElement(_reactNativeRedash.ReText, _extends({
33
- text: datetime[variant]
34
- }, props));
30
+ return /*#__PURE__*/React.createElement(_AnimatedText.AnimatedText, {
31
+ text: datetime[variant],
32
+ style: style
33
+ });
35
34
  }
36
35
  //# sourceMappingURL=DatetimeText.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["DatetimeText.tsx"],"names":["LineChartDatetimeText","locale","options","format","variant","props","datetime"],"mappings":";;;;;;;AAAA;;AACA;;AAIA;;;;;;;;AAUO,SAASA,qBAAT,CAA+B;AACpCC,EAAAA,MADoC;AAEpCC,EAAAA,OAFoC;AAGpCC,EAAAA,MAHoC;AAIpCC,EAAAA,OAAO,GAAG,WAJ0B;AAKpC,KAAGC;AALiC,CAA/B,EAMqB;AAC1B,QAAMC,QAAQ,GAAG,uCAAqB;AAAEH,IAAAA,MAAF;AAAUF,IAAAA,MAAV;AAAkBC,IAAAA;AAAlB,GAArB,CAAjB;AACA,sBAAO,oBAAC,yBAAD;AAAQ,IAAA,IAAI,EAAEI,QAAQ,CAACF,OAAD;AAAtB,KAAqCC,KAArC,EAAP;AACD","sourcesContent":["import * as React from 'react';\nimport { ReText } from 'react-native-redash';\nimport type { TextProps as RNTextProps } from 'react-native';\nimport type Animated from 'react-native-reanimated';\n\nimport { useLineChartDatetime } from './useDatetime';\n\ntype LineChartPriceTextProps = {\n locale?: string;\n options?: { [key: string]: any };\n format?: any;\n variant?: 'formatted' | 'value';\n style?: Animated.AnimateProps<RNTextProps>['style'];\n};\n\nexport function LineChartDatetimeText({\n locale,\n options,\n format,\n variant = 'formatted',\n ...props\n}: LineChartPriceTextProps) {\n const datetime = useLineChartDatetime({ format, locale, options });\n return <ReText text={datetime[variant]} {...props} />;\n}\n"]}
1
+ {"version":3,"sources":["DatetimeText.tsx"],"names":["LineChartDatetimeText","locale","options","format","variant","style","datetime"],"mappings":";;;;;;;AAAA;;AAIA;;AAEA;;;;;;AAUO,SAASA,qBAAT,CAA+B;AACpCC,EAAAA,MADoC;AAEpCC,EAAAA,OAFoC;AAGpCC,EAAAA,MAHoC;AAIpCC,EAAAA,OAAO,GAAG,WAJ0B;AAKpCC,EAAAA;AALoC,CAA/B,EAMoB;AACzB,QAAMC,QAAQ,GAAG,uCAAqB;AAAEH,IAAAA,MAAF;AAAUF,IAAAA,MAAV;AAAkBC,IAAAA;AAAlB,GAArB,CAAjB;AACA,sBAAO,oBAAC,0BAAD;AAAc,IAAA,IAAI,EAAEI,QAAQ,CAACF,OAAD,CAA5B;AAAuC,IAAA,KAAK,EAAEC;AAA9C,IAAP;AACD","sourcesContent":["import * as React from 'react';\nimport type { TextProps as RNTextProps } from 'react-native';\nimport type Animated from 'react-native-reanimated';\n\nimport { useLineChartDatetime } from './useDatetime';\nimport type { TFormatterFn } from 'react-native-wagmi-charts';\nimport { AnimatedText } from '../../components/AnimatedText';\n\ntype LineChartDatetimeProps = {\n locale?: string;\n options?: Intl.DateTimeFormatOptions;\n format?: TFormatterFn<number>;\n variant?: 'formatted' | 'value';\n style?: Animated.AnimateProps<RNTextProps>['style'];\n};\n\nexport function LineChartDatetimeText({\n locale,\n options,\n format,\n variant = 'formatted',\n style,\n}: LineChartDatetimeProps) {\n const datetime = useLineChartDatetime({ format, locale, options });\n return <AnimatedText text={datetime[variant]} style={style} />;\n}\n"]}
@@ -11,13 +11,13 @@ var _reactNativeReanimated = _interopRequireWildcard(require("react-native-reani
11
11
 
12
12
  var _reactNativeSvg = require("react-native-svg");
13
13
 
14
- var _reactNativeRedash = require("react-native-redash");
15
-
16
14
  var _Chart = require("./Chart");
17
15
 
16
+ var _interpolatePath = _interopRequireDefault(require("./interpolatePath"));
17
+
18
18
  var _utils = require("../../utils");
19
19
 
20
- var _utils2 = require("./utils");
20
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21
21
 
22
22
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
23
23
 
@@ -31,6 +31,7 @@ function LineChartPath({
31
31
  color = 'black',
32
32
  width = 3,
33
33
  isInactive,
34
+ isTransitionEnabled = true,
34
35
  ...props
35
36
  }) {
36
37
  const {
@@ -38,8 +39,7 @@ function LineChartPath({
38
39
  } = React.useContext(_Chart.LineChartDimensionsContext); ////////////////////////////////////////////////
39
40
 
40
41
  const transition = (0, _reactNativeReanimated.useSharedValue)(0);
41
- const parsedPath = React.useMemo(() => path ? (0, _reactNativeRedash.parse)(path) : undefined, [path]);
42
- const previousParsedPath = (0, _utils.usePrevious)(parsedPath);
42
+ const previousPath = (0, _utils.usePrevious)(path);
43
43
  (0, _reactNativeReanimated.useAnimatedReaction)(() => {
44
44
  return path;
45
45
  }, (_, previous) => {
@@ -49,18 +49,15 @@ function LineChartPath({
49
49
  }
50
50
  }, [path]);
51
51
  const animatedProps = (0, _reactNativeReanimated.useAnimatedProps)(() => {
52
- if (!parsedPath) return {
53
- d: ''
54
- };
55
- const {
56
- parsedPath: newParsedPath,
57
- previousParsedPath: newPreviousParsedPath
58
- } = (0, _utils2.syncPaths)({
59
- parsedPath,
60
- previousParsedPath
61
- });
52
+ let d = path || '';
53
+
54
+ if (previousPath && isTransitionEnabled) {
55
+ const pathInterpolator = (0, _interpolatePath.default)(previousPath, path, null);
56
+ d = pathInterpolator(transition.value);
57
+ }
58
+
62
59
  return {
63
- d: transition.value === 1 ? path : (0, _reactNativeRedash.mixPath)(transition.value, newPreviousParsedPath, newParsedPath)
60
+ d
64
61
  };
65
62
  }); ////////////////////////////////////////////////
66
63
 
@@ -1 +1 @@
1
- {"version":3,"sources":["Path.tsx"],"names":["AnimatedPath","Animated","createAnimatedComponent","Path","LineChartPath","color","width","isInactive","props","path","React","useContext","LineChartDimensionsContext","transition","parsedPath","useMemo","undefined","previousParsedPath","_","previous","value","animatedProps","d","newParsedPath","newPreviousParsedPath"],"mappings":";;;;;;;AAAA;;AACA;;AAMA;;AACA;;AAEA;;AACA;;AACA;;;;;;;;AAEA,MAAMA,YAAY,GAAGC,+BAASC,uBAAT,CAAiCC,oBAAjC,CAArB;;AAQO,SAASC,aAAT,CAAuB;AAC5BC,EAAAA,KAAK,GAAG,OADoB;AAE5BC,EAAAA,KAAK,GAAG,CAFoB;AAG5BC,EAAAA,UAH4B;AAI5B,KAAGC;AAJyB,CAAvB,EAKgB;AACrB,QAAM;AAAEC,IAAAA;AAAF,MAAWC,KAAK,CAACC,UAAN,CAAiBC,iCAAjB,CAAjB,CADqB,CAGrB;;AAEA,QAAMC,UAAU,GAAG,2CAAe,CAAf,CAAnB;AAEA,QAAMC,UAAU,GAAGJ,KAAK,CAACK,OAAN,CACjB,MAAON,IAAI,GAAG,8BAAMA,IAAN,CAAH,GAAiBO,SADX,EAEjB,CAACP,IAAD,CAFiB,CAAnB;AAIA,QAAMQ,kBAAkB,GAAG,wBAAYH,UAAZ,CAA3B;AAEA,kDACE,MAAM;AACJ,WAAOL,IAAP;AACD,GAHH,EAIE,CAACS,CAAD,EAAIC,QAAJ,KAAiB;AACf,QAAIA,QAAJ,EAAc;AACZN,MAAAA,UAAU,CAACO,KAAX,GAAmB,CAAnB;AACAP,MAAAA,UAAU,CAACO,KAAX,GAAmB,uCAAW,CAAX,CAAnB;AACD;AACF,GATH,EAUE,CAACX,IAAD,CAVF;AAaA,QAAMY,aAAa,GAAG,6CAAiB,MAAM;AAC3C,QAAI,CAACP,UAAL,EAAiB,OAAO;AAAEQ,MAAAA,CAAC,EAAE;AAAL,KAAP;AAEjB,UAAM;AACJR,MAAAA,UAAU,EAAES,aADR;AAEJN,MAAAA,kBAAkB,EAAEO;AAFhB,QAGF,uBAAU;AACZV,MAAAA,UADY;AAEZG,MAAAA;AAFY,KAAV,CAHJ;AAQA,WAAO;AACLK,MAAAA,CAAC,EACCT,UAAU,CAACO,KAAX,KAAqB,CAArB,GACIX,IADJ,GAEI,gCAAQI,UAAU,CAACO,KAAnB,EAA0BI,qBAA1B,EAAiDD,aAAjD;AAJD,KAAP;AAMD,GAjBqB,CAAtB,CA1BqB,CA6CrB;;AAEA,sBACE,uDACE,oBAAC,YAAD;AACE,IAAA,aAAa,EAAEF,aADjB;AAEE,IAAA,IAAI,EAAC,aAFP;AAGE,IAAA,MAAM,EAAEhB,KAHV;AAIE,IAAA,aAAa,EAAEE,UAAU,GAAG,GAAH,GAAS,CAJpC;AAKE,IAAA,WAAW,EAAED;AALf,KAMME,KANN,EADF,CADF;AAYD","sourcesContent":["import * as React from 'react';\nimport Animated, {\n useAnimatedProps,\n useAnimatedReaction,\n useSharedValue,\n withTiming,\n} from 'react-native-reanimated';\nimport { Path, PathProps } from 'react-native-svg';\nimport { mixPath, parse } from 'react-native-redash';\n\nimport { LineChartDimensionsContext } from './Chart';\nimport { usePrevious } from '../../utils';\nimport { syncPaths } from './utils';\n\nconst AnimatedPath = Animated.createAnimatedComponent(Path);\n\nexport type LineChartPathProps = Animated.AnimateProps<PathProps> & {\n color?: string;\n width?: number;\n isInactive?: boolean;\n};\n\nexport function LineChartPath({\n color = 'black',\n width = 3,\n isInactive,\n ...props\n}: LineChartPathProps) {\n const { path } = React.useContext(LineChartDimensionsContext);\n\n ////////////////////////////////////////////////\n\n const transition = useSharedValue(0);\n\n const parsedPath = React.useMemo(\n () => (path ? parse(path) : undefined),\n [path]\n );\n const previousParsedPath = usePrevious(parsedPath);\n\n useAnimatedReaction(\n () => {\n return path;\n },\n (_, previous) => {\n if (previous) {\n transition.value = 0;\n transition.value = withTiming(1);\n }\n },\n [path]\n );\n\n const animatedProps = useAnimatedProps(() => {\n if (!parsedPath) return { d: '' };\n\n const {\n parsedPath: newParsedPath,\n previousParsedPath: newPreviousParsedPath,\n } = syncPaths({\n parsedPath,\n previousParsedPath,\n });\n\n return {\n d:\n transition.value === 1\n ? path\n : mixPath(transition.value, newPreviousParsedPath, newParsedPath),\n };\n });\n\n ////////////////////////////////////////////////\n\n return (\n <>\n <AnimatedPath\n animatedProps={animatedProps}\n fill=\"transparent\"\n stroke={color}\n strokeOpacity={isInactive ? 0.2 : 1}\n strokeWidth={width}\n {...props}\n />\n </>\n );\n}\n"]}
1
+ {"version":3,"sources":["Path.tsx"],"names":["AnimatedPath","Animated","createAnimatedComponent","Path","LineChartPath","color","width","isInactive","isTransitionEnabled","props","path","React","useContext","LineChartDimensionsContext","transition","previousPath","_","previous","value","animatedProps","d","pathInterpolator"],"mappings":";;;;;;;AAAA;;AACA;;AAMA;;AAEA;;AACA;;AACA;;;;;;;;;;AAEA,MAAMA,YAAY,GAAGC,+BAASC,uBAAT,CAAiCC,oBAAjC,CAArB;;AAwBO,SAASC,aAAT,CAAuB;AAC5BC,EAAAA,KAAK,GAAG,OADoB;AAE5BC,EAAAA,KAAK,GAAG,CAFoB;AAG5BC,EAAAA,UAH4B;AAI5BC,EAAAA,mBAAmB,GAAG,IAJM;AAK5B,KAAGC;AALyB,CAAvB,EAMgB;AACrB,QAAM;AAAEC,IAAAA;AAAF,MAAWC,KAAK,CAACC,UAAN,CAAiBC,iCAAjB,CAAjB,CADqB,CAGrB;;AAEA,QAAMC,UAAU,GAAG,2CAAe,CAAf,CAAnB;AAEA,QAAMC,YAAY,GAAG,wBAAYL,IAAZ,CAArB;AAEA,kDACE,MAAM;AACJ,WAAOA,IAAP;AACD,GAHH,EAIE,CAACM,CAAD,EAAIC,QAAJ,KAAiB;AACf,QAAIA,QAAJ,EAAc;AACZH,MAAAA,UAAU,CAACI,KAAX,GAAmB,CAAnB;AACAJ,MAAAA,UAAU,CAACI,KAAX,GAAmB,uCAAW,CAAX,CAAnB;AACD;AACF,GATH,EAUE,CAACR,IAAD,CAVF;AAaA,QAAMS,aAAa,GAAG,6CAAiB,MAAM;AAC3C,QAAIC,CAAC,GAAGV,IAAI,IAAI,EAAhB;;AACA,QAAIK,YAAY,IAAIP,mBAApB,EAAyC;AACvC,YAAMa,gBAAgB,GAAG,8BAAgBN,YAAhB,EAA8BL,IAA9B,EAAoC,IAApC,CAAzB;AACAU,MAAAA,CAAC,GAAGC,gBAAgB,CAACP,UAAU,CAACI,KAAZ,CAApB;AACD;;AACD,WAAO;AACLE,MAAAA;AADK,KAAP;AAGD,GATqB,CAAtB,CAtBqB,CAiCrB;;AAEA,sBACE,uDACE,oBAAC,YAAD;AACE,IAAA,aAAa,EAAED,aADjB;AAEE,IAAA,IAAI,EAAC,aAFP;AAGE,IAAA,MAAM,EAAEd,KAHV;AAIE,IAAA,aAAa,EAAEE,UAAU,GAAG,GAAH,GAAS,CAJpC;AAKE,IAAA,WAAW,EAAED;AALf,KAMMG,KANN,EADF,CADF;AAYD","sourcesContent":["import * as React from 'react';\nimport Animated, {\n useAnimatedProps,\n useAnimatedReaction,\n useSharedValue,\n withTiming,\n} from 'react-native-reanimated';\nimport { Path, PathProps } from 'react-native-svg';\n\nimport { LineChartDimensionsContext } from './Chart';\nimport interpolatePath from './interpolatePath';\nimport { usePrevious } from '../../utils';\n\nconst AnimatedPath = Animated.createAnimatedComponent(Path);\n\nexport type LineChartPathProps = Animated.AnimateProps<PathProps> & {\n color?: string;\n width?: number;\n isInactive?: boolean;\n /**\n * Default: `true`.\n *\n * If `false`, changes in the chart's path will not animate.\n *\n * While this use case is rare, it may be useful on web, where animations might not work as well.\n *\n * **Example**\n *\n * ```tsx\n * <LineChart.Path\n * pathProps={{ isTransitionEnabled: Platform.OS !== 'web' }}\n * />\n * ```\n */\n isTransitionEnabled?: boolean;\n};\n\nexport function LineChartPath({\n color = 'black',\n width = 3,\n isInactive,\n isTransitionEnabled = true,\n ...props\n}: LineChartPathProps) {\n const { path } = React.useContext(LineChartDimensionsContext);\n\n ////////////////////////////////////////////////\n\n const transition = useSharedValue(0);\n\n const previousPath = usePrevious(path);\n\n useAnimatedReaction(\n () => {\n return path;\n },\n (_, previous) => {\n if (previous) {\n transition.value = 0;\n transition.value = withTiming(1);\n }\n },\n [path]\n );\n\n const animatedProps = useAnimatedProps(() => {\n let d = path || '';\n if (previousPath && isTransitionEnabled) {\n const pathInterpolator = interpolatePath(previousPath, path, null);\n d = pathInterpolator(transition.value);\n }\n return {\n d,\n };\n });\n\n ////////////////////////////////////////////////\n\n return (\n <>\n <AnimatedPath\n animatedProps={animatedProps}\n fill=\"transparent\"\n stroke={color}\n strokeOpacity={isInactive ? 0.2 : 1}\n strokeWidth={width}\n {...props}\n />\n </>\n );\n}\n"]}
@@ -7,28 +7,27 @@ exports.LineChartPriceText = LineChartPriceText;
7
7
 
8
8
  var React = _interopRequireWildcard(require("react"));
9
9
 
10
- var _reactNativeRedash = require("react-native-redash");
11
-
12
10
  var _usePrice = require("./usePrice");
13
11
 
12
+ var _AnimatedText = require("../../components/AnimatedText");
13
+
14
14
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
15
15
 
16
16
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
17
17
 
18
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
19
-
20
18
  function LineChartPriceText({
21
19
  format,
22
20
  precision = 2,
23
21
  variant = 'formatted',
24
- ...props
22
+ style
25
23
  }) {
26
24
  const price = (0, _usePrice.useLineChartPrice)({
27
25
  format,
28
26
  precision
29
27
  });
30
- return /*#__PURE__*/React.createElement(_reactNativeRedash.ReText, _extends({
31
- text: price[variant]
32
- }, props));
28
+ return /*#__PURE__*/React.createElement(_AnimatedText.AnimatedText, {
29
+ text: price[variant],
30
+ style: style
31
+ });
33
32
  }
34
33
  //# sourceMappingURL=PriceText.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["PriceText.tsx"],"names":["LineChartPriceText","format","precision","variant","props","price"],"mappings":";;;;;;;AAAA;;AACA;;AAIA;;;;;;;;AASO,SAASA,kBAAT,CAA4B;AACjCC,EAAAA,MADiC;AAEjCC,EAAAA,SAAS,GAAG,CAFqB;AAGjCC,EAAAA,OAAO,GAAG,WAHuB;AAIjC,KAAGC;AAJ8B,CAA5B,EAKqB;AAC1B,QAAMC,KAAK,GAAG,iCAAkB;AAAEJ,IAAAA,MAAF;AAAUC,IAAAA;AAAV,GAAlB,CAAd;AACA,sBAAO,oBAAC,yBAAD;AAAQ,IAAA,IAAI,EAAEG,KAAK,CAACF,OAAD;AAAnB,KAAkCC,KAAlC,EAAP;AACD","sourcesContent":["import * as React from 'react';\nimport { ReText } from 'react-native-redash';\nimport type { TextProps as RNTextProps } from 'react-native';\nimport type Animated from 'react-native-reanimated';\n\nimport { useLineChartPrice } from './usePrice';\n\nexport type LineChartPriceTextProps = {\n format?: any;\n precision?: number;\n variant?: 'formatted' | 'value';\n style?: Animated.AnimateProps<RNTextProps>['style'];\n};\n\nexport function LineChartPriceText({\n format,\n precision = 2,\n variant = 'formatted',\n ...props\n}: LineChartPriceTextProps) {\n const price = useLineChartPrice({ format, precision });\n return <ReText text={price[variant]} {...props} />;\n}\n"]}
1
+ {"version":3,"sources":["PriceText.tsx"],"names":["LineChartPriceText","format","precision","variant","style","price"],"mappings":";;;;;;;AAAA;;AAIA;;AAEA;;;;;;AASO,SAASA,kBAAT,CAA4B;AACjCC,EAAAA,MADiC;AAEjCC,EAAAA,SAAS,GAAG,CAFqB;AAGjCC,EAAAA,OAAO,GAAG,WAHuB;AAIjCC,EAAAA;AAJiC,CAA5B,EAKqB;AAC1B,QAAMC,KAAK,GAAG,iCAAkB;AAAEJ,IAAAA,MAAF;AAAUC,IAAAA;AAAV,GAAlB,CAAd;AACA,sBAAO,oBAAC,0BAAD;AAAc,IAAA,IAAI,EAAEG,KAAK,CAACF,OAAD,CAAzB;AAAoC,IAAA,KAAK,EAAEC;AAA3C,IAAP;AACD","sourcesContent":["import * as React from 'react';\nimport type { TextProps as RNTextProps } from 'react-native';\nimport type Animated from 'react-native-reanimated';\n\nimport { useLineChartPrice } from './usePrice';\nimport type { TFormatterFn } from '../candle/types';\nimport { AnimatedText } from '../../components/AnimatedText';\n\nexport type LineChartPriceTextProps = {\n format?: TFormatterFn<string>;\n precision?: number;\n variant?: 'formatted' | 'value';\n style?: Animated.AnimateProps<RNTextProps>['style'];\n};\n\nexport function LineChartPriceText({\n format,\n precision = 2,\n variant = 'formatted',\n style,\n}: LineChartPriceTextProps) {\n const price = useLineChartPrice({ format, precision });\n return <AnimatedText text={price[variant]} style={style} />;\n}\n"]}