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
@@ -1 +1 @@
1
- {"version":3,"sources":["Cursor.tsx"],"names":["React","StyleSheet","LongPressGestureHandler","Animated","useAnimatedGestureHandler","getYForX","parse","LineChartDimensionsContext","useLineChart","CursorContext","createContext","type","LineChartCursor","children","props","width","path","useContext","currentX","currentY","currentIndex","isActive","data","parsedPath","useMemo","undefined","onGestureEvent","onActive","x","boundedX","value","Math","round","length","onEnd","absoluteFill"],"mappings":";;AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,SAASC,UAAT,QAA2B,cAA3B;AACA,SACEC,uBADF,QAGO,8BAHP;AAIA,OAAOC,QAAP,IAAmBC,yBAAnB,QAAoD,yBAApD;AACA,SAASC,QAAT,EAAmBC,KAAnB,QAAgC,qBAAhC;AAEA,SAASC,0BAAT,QAA2C,SAA3C;AACA,SAASC,YAAT,QAA6B,gBAA7B;AAOA,OAAO,MAAMC,aAAa,gBAAGT,KAAK,CAACU,aAAN,CAAoB;AAAEC,EAAAA,IAAI,EAAE;AAAR,CAApB,CAAtB;AAEP,OAAO,SAASC,eAAT,CAAyB;AAC9BC,EAAAA,QAD8B;AAE9BF,EAAAA,IAF8B;AAG9B,KAAGG;AAH2B,CAAzB,EAIkB;AACvB,QAAM;AAAEC,IAAAA,KAAF;AAASC,IAAAA;AAAT,MAAkBhB,KAAK,CAACiB,UAAN,CAAiBV,0BAAjB,CAAxB;AACA,QAAM;AAAEW,IAAAA,QAAF;AAAYC,IAAAA,QAAZ;AAAsBC,IAAAA,YAAtB;AAAoCC,IAAAA,QAApC;AAA8CC,IAAAA;AAA9C,MAAuDd,YAAY,EAAzE;AAEA,QAAMe,UAAU,GAAGvB,KAAK,CAACwB,OAAN,CACjB,MAAOR,IAAI,GAAGV,KAAK,CAACU,IAAD,CAAR,GAAiBS,SADX,EAEjB,CAACT,IAAD,CAFiB,CAAnB;AAKA,QAAMU,cAAc,GAAGtB,yBAAyB,CAAC;AAC/CuB,IAAAA,QAAQ,EAAE,CAAC;AAAEC,MAAAA;AAAF,KAAD,KAAW;AACnB,UAAIL,UAAJ,EAAgB;AACd,cAAMM,QAAQ,GAAGD,CAAC,IAAIb,KAAL,GAAaa,CAAb,GAAiBb,KAAlC;AACAM,QAAAA,QAAQ,CAACS,KAAT,GAAiB,IAAjB;AACAZ,QAAAA,QAAQ,CAACY,KAAT,GAAiBD,QAAjB;AACAV,QAAAA,QAAQ,CAACW,KAAT,GAAiBzB,QAAQ,CAACkB,UAAD,EAAaM,QAAb,CAAR,IAAkC,CAAnD;AACAT,QAAAA,YAAY,CAACU,KAAb,GAAqBC,IAAI,CAACC,KAAL,CACnBH,QAAQ,GAAGd,KAAX,IAAoB,KAAKO,IAAI,CAACW,MAAL,GAAc,CAAnB,CAApB,CADmB,CAArB;AAGD;AACF,KAX8C;AAY/CC,IAAAA,KAAK,EAAE,MAAM;AACXb,MAAAA,QAAQ,CAACS,KAAT,GAAiB,KAAjB;AACAV,MAAAA,YAAY,CAACU,KAAb,GAAqB,CAAC,CAAtB;AACD;AAf8C,GAAD,CAAhD;AAkBA,sBACE,oBAAC,aAAD,CAAe,QAAf;AAAwB,IAAA,KAAK,EAAE;AAAEnB,MAAAA;AAAF;AAA/B,kBACE,oBAAC,uBAAD;AACE,IAAA,aAAa,EAAE,CADjB;AAEE,IAAA,cAAc,EAAEe;AAFlB,KAGMZ,KAHN,gBAKE,oBAAC,QAAD,CAAU,IAAV;AAAe,IAAA,KAAK,EAAEb,UAAU,CAACkC;AAAjC,KACGtB,QADH,CALF,CADF,CADF;AAaD","sourcesContent":["import * as React from 'react';\nimport { StyleSheet } from 'react-native';\nimport {\n LongPressGestureHandler,\n LongPressGestureHandlerProps,\n} from 'react-native-gesture-handler';\nimport Animated, { useAnimatedGestureHandler } from 'react-native-reanimated';\nimport { getYForX, parse } from 'react-native-redash';\n\nimport { LineChartDimensionsContext } from './Chart';\nimport { useLineChart } from './useLineChart';\n\ntype LineChartCursorProps = LongPressGestureHandlerProps & {\n children: React.ReactNode;\n type: 'line' | 'crosshair';\n};\n\nexport const CursorContext = React.createContext({ type: '' });\n\nexport function LineChartCursor({\n children,\n type,\n ...props\n}: LineChartCursorProps) {\n const { width, path } = React.useContext(LineChartDimensionsContext);\n const { currentX, currentY, currentIndex, isActive, data } = useLineChart();\n\n const parsedPath = React.useMemo(\n () => (path ? parse(path) : undefined),\n [path]\n );\n\n const onGestureEvent = useAnimatedGestureHandler({\n onActive: ({ x }) => {\n if (parsedPath) {\n const boundedX = x <= width ? x : width;\n isActive.value = true;\n currentX.value = boundedX;\n currentY.value = getYForX(parsedPath, boundedX) || 0;\n currentIndex.value = Math.round(\n boundedX / width / (1 / (data.length - 1))\n );\n }\n },\n onEnd: () => {\n isActive.value = false;\n currentIndex.value = -1;\n },\n });\n\n return (\n <CursorContext.Provider value={{ type }}>\n <LongPressGestureHandler\n minDurationMs={0}\n onGestureEvent={onGestureEvent as any}\n {...props}\n >\n <Animated.View style={StyleSheet.absoluteFill}>\n {children}\n </Animated.View>\n </LongPressGestureHandler>\n </CursorContext.Provider>\n );\n}\n"]}
1
+ {"version":3,"sources":["Cursor.tsx"],"names":["React","StyleSheet","LongPressGestureHandler","Animated","useAnimatedGestureHandler","getYForX","parse","LineChartDimensionsContext","useLineChart","CursorContext","createContext","type","LineChartCursor","children","props","width","path","useContext","currentX","currentY","currentIndex","isActive","data","parsedPath","useMemo","undefined","onGestureEvent","onActive","x","boundedX","value","Math","round","length","onEnd","absoluteFill"],"mappings":";;AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,SAASC,UAAT,QAA2B,cAA3B;AACA,SAEEC,uBAFF,QAKO,8BALP;AAMA,OAAOC,QAAP,IAAmBC,yBAAnB,QAAoD,yBAApD;AACA,SAASC,QAAT,EAAmBC,KAAnB,QAAgC,qBAAhC;AAEA,SAASC,0BAAT,QAA2C,SAA3C;AACA,SAASC,YAAT,QAA6B,gBAA7B;AAOA,OAAO,MAAMC,aAAa,gBAAGT,KAAK,CAACU,aAAN,CAAoB;AAAEC,EAAAA,IAAI,EAAE;AAAR,CAApB,CAAtB;AAEP,OAAO,SAASC,eAAT,CAAyB;AAC9BC,EAAAA,QAD8B;AAE9BF,EAAAA,IAF8B;AAG9B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;AAA/B,kBACE,oBAAC,uBAAD;AACE,IAAA,aAAa,EAAE,CADjB;AAEE,IAAA,cAAc,EAAEe;AAFlB,KAGMZ,KAHN,gBAKE,oBAAC,QAAD,CAAU,IAAV;AAAe,IAAA,KAAK,EAAEb,UAAU,CAACkC;AAAjC,KACGtB,QADH,CALF,CADF,CADF;AAaD","sourcesContent":["import * as React from 'react';\nimport { StyleSheet } from 'react-native';\nimport {\n GestureEvent,\n LongPressGestureHandler,\n LongPressGestureHandlerEventPayload,\n LongPressGestureHandlerProps,\n} from 'react-native-gesture-handler';\nimport Animated, { useAnimatedGestureHandler } from 'react-native-reanimated';\nimport { getYForX, parse } from 'react-native-redash';\n\nimport { LineChartDimensionsContext } from './Chart';\nimport { useLineChart } from './useLineChart';\n\nexport type LineChartCursorProps = LongPressGestureHandlerProps & {\n children: React.ReactNode;\n type: 'line' | 'crosshair';\n};\n\nexport const CursorContext = React.createContext({ type: '' });\n\nexport function LineChartCursor({\n children,\n type,\n ...props\n}: LineChartCursorProps) {\n const { width, path } = React.useContext(LineChartDimensionsContext);\n const { currentX, currentY, currentIndex, isActive, data } = useLineChart();\n\n const parsedPath = React.useMemo(\n () => (path ? parse(path) : undefined),\n [path]\n );\n\n const onGestureEvent = useAnimatedGestureHandler<\n GestureEvent<LongPressGestureHandlerEventPayload>\n >({\n onActive: ({ x }) => {\n if (parsedPath) {\n const boundedX = x <= width ? x : width;\n isActive.value = true;\n currentX.value = boundedX;\n currentY.value = getYForX(parsedPath, boundedX) || 0;\n currentIndex.value = Math.round(\n boundedX / width / (1 / (data.length - 1))\n );\n }\n },\n onEnd: () => {\n isActive.value = false;\n currentIndex.value = -1;\n },\n });\n\n return (\n <CursorContext.Provider value={{ type }}>\n <LongPressGestureHandler\n minDurationMs={0}\n onGestureEvent={onGestureEvent}\n {...props}\n >\n <Animated.View style={StyleSheet.absoluteFill}>\n {children}\n </Animated.View>\n </LongPressGestureHandler>\n </CursorContext.Provider>\n );\n}\n"]}
@@ -12,7 +12,8 @@ export function LineChartCursorCrosshair({
12
12
  outerSize = 32,
13
13
  crosshairWrapperProps = {},
14
14
  crosshairProps = {},
15
- crosshairOuterProps = {}
15
+ crosshairOuterProps = {},
16
+ ...props
16
17
  }) {
17
18
  const {
18
19
  currentX,
@@ -30,9 +31,9 @@ export function LineChartCursorCrosshair({
30
31
  })
31
32
  }]
32
33
  }));
33
- return /*#__PURE__*/React.createElement(LineChartCursor, {
34
+ return /*#__PURE__*/React.createElement(LineChartCursor, _extends({
34
35
  type: "crosshair"
35
- }, /*#__PURE__*/React.createElement(Animated.View, _extends({}, crosshairWrapperProps, {
36
+ }, props), /*#__PURE__*/React.createElement(Animated.View, _extends({}, crosshairWrapperProps, {
36
37
  style: [{
37
38
  width: outerSize,
38
39
  height: outerSize,
@@ -1 +1 @@
1
- {"version":3,"sources":["CursorCrosshair.tsx"],"names":["React","View","Animated","useAnimatedStyle","withSpring","LineChartCursor","useLineChart","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,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,SAASC,IAAT,QAAgC,cAAhC;AACA,OAAOC,QAAP,IACEC,gBADF,EAEEC,UAFF,QAGO,yBAHP;AAKA,SAASC,eAAT,QAAgC,UAAhC;AACA,SAASC,YAAT,QAA6B,gBAA7B;AAYA,OAAO,SAASC,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,QA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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":["React","View","Animated","useAnimatedStyle","withSpring","LineChartCursor","useLineChart","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,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,SAASC,IAAT,QAAgC,cAAhC;AACA,OAAOC,QAAP,IACEC,gBADF,EAEEC,UAFF,QAGO,yBAHP;AAKA,SAASC,eAAT,QAAsD,UAAtD;AACA,SAASC,YAAT,QAA6B,gBAA7B;AAYA,OAAO,SAASC,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,MAAmCZ,YAAY,EAArD;AAEA,QAAMa,mBAAmB,GAAGhB,gBAAgB,CAAC,OAAO;AAClDiB,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,EAAEpB,UAAU,CAACc,QAAQ,CAACI,KAAT,GAAiB,CAAjB,GAAqB,CAAtB,EAAyB;AACxCG,QAAAA,OAAO,EAAE;AAD+B,OAAzB;AADnB,KAHS;AADuC,GAAP,CAAD,CAA5C;AAYA,sBACE,oBAAC,eAAD;AAAiB,IAAA,IAAI,EAAC;AAAtB,KAAsCV,KAAtC,gBACE,oBAAC,QAAD,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,IAAD,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,IAAD,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"]}
@@ -31,7 +31,7 @@ export const LineChartCursorLine = ({
31
31
  }, /*#__PURE__*/React.createElement(Animated.View, {
32
32
  style: vertical
33
33
  }, /*#__PURE__*/React.createElement(Svg, {
34
- style: StyleSheet.absoluteFill
34
+ style: styles.svg
35
35
  }, /*#__PURE__*/React.createElement(SVGLine, _extends({
36
36
  x1: 0,
37
37
  y1: 0,
@@ -42,4 +42,10 @@ export const LineChartCursorLine = ({
42
42
  strokeDasharray: "3 3"
43
43
  }, lineProps)))), children);
44
44
  };
45
+ const styles = StyleSheet.create({
46
+ svg: { ...StyleSheet.absoluteFillObject,
47
+ // height: 100% is required for <svg /> on web
48
+ height: '100%'
49
+ }
50
+ });
45
51
  //# sourceMappingURL=CursorLine.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["CursorLine.tsx"],"names":["React","StyleSheet","Animated","useAnimatedStyle","Svg","Line","SVGLine","LineChartDimensionsContext","LineChartCursor","useLineChart","LineChartCursorLine","children","color","lineProps","height","useContext","currentX","isActive","vertical","opacity","value","transform","translateX","absoluteFill"],"mappings":";;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SAASC,UAAT,QAA2B,cAA3B;AACA,OAAOC,QAAP,IAAmBC,gBAAnB,QAA2C,yBAA3C;AACA,OAAOC,GAAP,IAAcC,IAAI,IAAIC,OAAtB,QAAgD,kBAAhD;AAEA,SAASC,0BAAT,QAA2C,SAA3C;AACA,SAASC,eAAT,QAAgC,UAAhC;AACA,SAASC,YAAT,QAA6B,gBAA7B;AAQA,OAAO,MAAMC,mBAAmB,GAAG,CAAC;AAClCC,EAAAA,QADkC;AAElCC,EAAAA,KAAK,GAAG,MAF0B;AAGlCC,EAAAA,SAAS,GAAG;AAHsB,CAAD,KAIH;AAC9B,QAAM;AAAEC,IAAAA;AAAF,MAAad,KAAK,CAACe,UAAN,CAAiBR,0BAAjB,CAAnB;AACA,QAAM;AAAES,IAAAA,QAAF;AAAYC,IAAAA;AAAZ,MAAyBR,YAAY,EAA3C;AAEA,QAAMS,QAAQ,GAAGf,gBAAgB,CAAC,OAAO;AACvCgB,IAAAA,OAAO,EAAEF,QAAQ,CAACG,KAAT,GAAiB,CAAjB,GAAqB,CADS;AAEvCN,IAAAA,MAAM,EAAE,MAF+B;AAGvCO,IAAAA,SAAS,EAAE,CAAC;AAAEC,MAAAA,UAAU,EAAEN,QAAQ,CAACI;AAAvB,KAAD;AAH4B,GAAP,CAAD,CAAjC;AAMA,sBACE,oBAAC,eAAD;AAAiB,IAAA,IAAI,EAAC;AAAtB,kBACE,oBAAC,QAAD,CAAU,IAAV;AAAe,IAAA,KAAK,EAAEF;AAAtB,kBACE,oBAAC,GAAD;AAAK,IAAA,KAAK,EAAEjB,UAAU,CAACsB;AAAvB,kBACE,oBAAC,OAAD;AACE,IAAA,EAAE,EAAE,CADN;AAEE,IAAA,EAAE,EAAE,CAFN;AAGE,IAAA,EAAE,EAAE,CAHN;AAIE,IAAA,EAAE,EAAET,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":["React","StyleSheet","Animated","useAnimatedStyle","Svg","Line","SVGLine","LineChartDimensionsContext","LineChartCursor","useLineChart","LineChartCursorLine","children","color","lineProps","height","useContext","currentX","isActive","vertical","op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E,CALf;AAME,IAAA,MAAM,EAAEF,KANV;AAOE,IAAA,eAAe,EAAC;AAPlB,KAQMC,SARN,EADF,CADF,CADF,EAeGF,QAfH,CADF;AAmBD,CAjCM;AAmCP,MAAMY,MAAM,GAAGtB,UAAU,CAACwB,MAAX,CAAkB;AAC/BD,EAAAA,GAAG,EAAE,EACH,GAAGvB,UAAU,CAACyB,kBADX;AAEH;AACAZ,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"]}
@@ -1,22 +1,21 @@
1
- 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); }
2
-
3
1
  import * as React from 'react';
4
- import { ReText } from 'react-native-redash';
5
2
  import { useLineChartDatetime } from './useDatetime';
3
+ import { AnimatedText } from '../../components/AnimatedText';
6
4
  export function LineChartDatetimeText({
7
5
  locale,
8
6
  options,
9
7
  format,
10
8
  variant = 'formatted',
11
- ...props
9
+ style
12
10
  }) {
13
11
  const datetime = useLineChartDatetime({
14
12
  format,
15
13
  locale,
16
14
  options
17
15
  });
18
- return /*#__PURE__*/React.createElement(ReText, _extends({
19
- text: datetime[variant]
20
- }, props));
16
+ return /*#__PURE__*/React.createElement(AnimatedText, {
17
+ text: datetime[variant],
18
+ style: style
19
+ });
21
20
  }
22
21
  //# sourceMappingURL=DatetimeText.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["DatetimeText.tsx"],"names":["React","ReText","useLineChartDatetime","LineChartDatetimeText","locale","options","format","variant","props","datetime"],"mappings":";;AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,SAASC,MAAT,QAAuB,qBAAvB;AAIA,SAASC,oBAAT,QAAqC,eAArC;AAUA,OAAO,SAASC,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,GAAGP,oBAAoB,CAAC;AAAEI,IAAAA,MAAF;AAAUF,IAAAA,MAAV;AAAkBC,IAAAA;AAAlB,GAAD,CAArC;AACA,sBAAO,oBAAC,MAAD;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":["React","useLineChartDatetime","AnimatedText","LineChartDatetimeText","locale","options","format","variant","style","datetime"],"mappings":"AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AAIA,SAASC,oBAAT,QAAqC,eAArC;AAEA,SAASC,YAAT,QAA6B,+BAA7B;AAUA,OAAO,SAASC,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,GAAGR,oBAAoB,CAAC;AAAEK,IAAAA,MAAF;AAAUF,IAAAA,MAAV;AAAkBC,IAAAA;AAAlB,GAAD,CAArC;AACA,sBAAO,oBAAC,YAAD;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"]}
@@ -3,15 +3,15 @@ function _extends() { _extends = Object.assign || function (target) { for (var i
3
3
  import * as React from 'react';
4
4
  import Animated, { useAnimatedProps, useAnimatedReaction, useSharedValue, withTiming } from 'react-native-reanimated';
5
5
  import { Path } from 'react-native-svg';
6
- import { mixPath, parse } from 'react-native-redash';
7
6
  import { LineChartDimensionsContext } from './Chart';
7
+ import interpolatePath from './interpolatePath';
8
8
  import { usePrevious } from '../../utils';
9
- import { syncPaths } from './utils';
10
9
  const AnimatedPath = Animated.createAnimatedComponent(Path);
11
10
  export function LineChartPath({
12
11
  color = 'black',
13
12
  width = 3,
14
13
  isInactive,
14
+ isTransitionEnabled = true,
15
15
  ...props
16
16
  }) {
17
17
  const {
@@ -19,8 +19,7 @@ export function LineChartPath({
19
19
  } = React.useContext(LineChartDimensionsContext); ////////////////////////////////////////////////
20
20
 
21
21
  const transition = useSharedValue(0);
22
- const parsedPath = React.useMemo(() => path ? parse(path) : undefined, [path]);
23
- const previousParsedPath = usePrevious(parsedPath);
22
+ const previousPath = usePrevious(path);
24
23
  useAnimatedReaction(() => {
25
24
  return path;
26
25
  }, (_, previous) => {
@@ -30,18 +29,15 @@ export function LineChartPath({
30
29
  }
31
30
  }, [path]);
32
31
  const animatedProps = useAnimatedProps(() => {
33
- if (!parsedPath) return {
34
- d: ''
35
- };
36
- const {
37
- parsedPath: newParsedPath,
38
- previousParsedPath: newPreviousParsedPath
39
- } = syncPaths({
40
- parsedPath,
41
- previousParsedPath
42
- });
32
+ let d = path || '';
33
+
34
+ if (previousPath && isTransitionEnabled) {
35
+ const pathInterpolator = interpolatePath(previousPath, path, null);
36
+ d = pathInterpolator(transition.value);
37
+ }
38
+
43
39
  return {
44
- d: transition.value === 1 ? path : mixPath(transition.value, newPreviousParsedPath, newParsedPath)
40
+ d
45
41
  };
46
42
  }); ////////////////////////////////////////////////
47
43
 
@@ -1 +1 @@
1
- {"version":3,"sources":["Path.tsx"],"names":["React","Animated","useAnimatedProps","useAnimatedReaction","useSharedValue","withTiming","Path","mixPath","parse","LineChartDimensionsContext","usePrevious","syncPaths","AnimatedPath","createAnimatedComponent","LineChartPath","color","width","isInactive","props","path","useContext","transition","parsedPath","useMemo","undefined","previousParsedPath","_","previous","value","animatedProps","d","newParsedPath","newPreviousParsedPath"],"mappings":";;AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,OAAOC,QAAP,IACEC,gBADF,EAEEC,mBAFF,EAGEC,cAHF,EAIEC,UAJF,QAKO,yBALP;AAMA,SAASC,IAAT,QAAgC,kBAAhC;AACA,SAASC,OAAT,EAAkBC,KAAlB,QAA+B,qBAA/B;AAEA,SAASC,0BAAT,QAA2C,SAA3C;AACA,SAASC,WAAT,QAA4B,aAA5B;AACA,SAASC,SAAT,QAA0B,SAA1B;AAEA,MAAMC,YAAY,GAAGX,QAAQ,CAACY,uBAAT,CAAiCP,IAAjC,CAArB;AAQA,OAAO,SAASQ,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,MAAWnB,KAAK,CAACoB,UAAN,CAAiBX,0BAAjB,CAAjB,CADqB,CAGrB;;AAEA,QAAMY,UAAU,GAAGjB,cAAc,CAAC,CAAD,CAAjC;AAEA,QAAMkB,UAAU,GAAGtB,KAAK,CAACuB,OAAN,CACjB,MAAOJ,IAAI,GAAGX,KAAK,CAACW,IAAD,CAAR,GAAiBK,SADX,EAEjB,CAACL,IAAD,CAFiB,CAAnB;AAIA,QAAMM,kBAAkB,GAAGf,WAAW,CAACY,UAAD,CAAtC;AAEAnB,EAAAA,mBAAmB,CACjB,MAAM;AACJ,WAAOgB,IAAP;AACD,GAHgB,EAIjB,CAACO,CAAD,EAAIC,QAAJ,KAAiB;AACf,QAAIA,QAAJ,EAAc;AACZN,MAAAA,UAAU,CAACO,KAAX,GAAmB,CAAnB;AACAP,MAAAA,UAAU,CAACO,KAAX,GAAmBvB,UAAU,CAAC,CAAD,CAA7B;AACD;AACF,GATgB,EAUjB,CAACc,IAAD,CAViB,CAAnB;AAaA,QAAMU,aAAa,GAAG3B,gBAAgB,CAAC,MAAM;AAC3C,QAAI,CAACoB,UAAL,EAAiB,OAAO;AAAEQ,MAAAA,CAAC,EAAE;AAAL,KAAP;AAEjB,UAAM;AACJR,MAAAA,UAAU,EAAES,aADR;AAEJN,MAAAA,kBAAkB,EAAEO;AAFhB,QAGFrB,SAAS,CAAC;AACZW,MAAAA,UADY;AAEZG,MAAAA;AAFY,KAAD,CAHb;AAQA,WAAO;AACLK,MAAAA,CAAC,EACCT,UAAU,CAACO,KAAX,KAAqB,CAArB,GACIT,IADJ,GAEIZ,OAAO,CAACc,UAAU,CAACO,KAAZ,EAAmBI,qBAAnB,EAA0CD,aAA1C;AAJR,KAAP;AAMD,GAjBqC,CAAtC,CA1BqB,CA6CrB;;AAEA,sBACE,uDACE,oBAAC,YAAD;AACE,IAAA,aAAa,EAAEF,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,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":["React","Animated","useAnimatedProps","useAnimatedReaction","useSharedValue","withTiming","Path","LineChartDimensionsContext","interpolatePath","usePrevious","AnimatedPath","createAnimatedComponent","LineChartPath","color","width","isInactive","isTransitionEnabled","props","path","useContext","transition","previousPath","_","previous","value","animatedProps","d","pathInterpolator"],"mappings":";;AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,OAAOC,QAAP,IACEC,gBADF,EAEEC,mBAFF,EAGEC,cAHF,EAIEC,UAJF,QAKO,yBALP;AAMA,SAASC,IAAT,QAAgC,kBAAhC;AAEA,SAASC,0BAAT,QAA2C,SAA3C;AACA,OAAOC,eAAP,MAA4B,mBAA5B;AACA,SAASC,WAAT,QAA4B,aAA5B;AAEA,MAAMC,YAAY,GAAGT,QAAQ,CAACU,uBAAT,CAAi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AAG,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"]}
@@ -1,20 +1,19 @@
1
- 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); }
2
-
3
1
  import * as React from 'react';
4
- import { ReText } from 'react-native-redash';
5
2
  import { useLineChartPrice } from './usePrice';
3
+ import { AnimatedText } from '../../components/AnimatedText';
6
4
  export function LineChartPriceText({
7
5
  format,
8
6
  precision = 2,
9
7
  variant = 'formatted',
10
- ...props
8
+ style
11
9
  }) {
12
10
  const price = useLineChartPrice({
13
11
  format,
14
12
  precision
15
13
  });
16
- return /*#__PURE__*/React.createElement(ReText, _extends({
17
- text: price[variant]
18
- }, props));
14
+ return /*#__PURE__*/React.createElement(AnimatedText, {
15
+ text: price[variant],
16
+ style: style
17
+ });
19
18
  }
20
19
  //# sourceMappingURL=PriceText.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["PriceText.tsx"],"names":["React","ReText","useLineChartPrice","LineChartPriceText","format","precision","variant","props","price"],"mappings":";;AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,SAASC,MAAT,QAAuB,qBAAvB;AAIA,SAASC,iBAAT,QAAkC,YAAlC;AASA,OAAO,SAASC,kBAAT,CAA4B;AACjCC,EAAAA,MADiC;AAEjCC,EAAAA,SAAS,GAAG,CAFqB;AAGjCC,EAAAA,OAAO,GAAG,WAHuB;AAIjC,KAAGC;AAJ8B,CAA5B,EAKqB;AAC1B,QAAMC,KAAK,GAAGN,iBAAiB,CAAC;AAAEE,IAAAA,MAAF;AAAUC,IAAAA;AAAV,GAAD,CAA/B;AACA,sBAAO,oBAAC,MAAD;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":["React","useLineChartPrice","AnimatedText","LineChartPriceText","format","precision","variant","style","price"],"mappings":"AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AAIA,SAASC,iBAAT,QAAkC,YAAlC;AAEA,SAASC,YAAT,QAA6B,+BAA7B;AASA,OAAO,SAASC,kBAAT,CAA4B;AACjCC,EAAAA,MADiC;AAEjCC,EAAAA,SAAS,GAAG,CAFqB;AAGjCC,EAAAA,OAAO,GAAG,WAHuB;AAIjCC,EAAAA;AAJiC,CAA5B,EAKqB;AAC1B,QAAMC,KAAK,GAAGP,iBAAiB,CAAC;AAAEG,IAAAA,MAAF;AAAUC,IAAAA;AAAV,GAAD,CAA/B;AACA,sBAAO,oBAAC,YAAD;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"]}