@coinbase/cds-mobile-visualization 3.8.1 → 4.0.0

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 (303) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dts/chart/index.d.ts +1 -15
  3. package/dts/chart/index.d.ts.map +1 -1
  4. package/dts/index.d.ts.map +1 -1
  5. package/dts/sparkline/index.d.ts +1 -5
  6. package/dts/sparkline/index.d.ts.map +1 -1
  7. package/esm/chart/index.js +1 -17
  8. package/esm/index.js +1 -3
  9. package/esm/sparkline/index.js +1 -5
  10. package/package.json +26 -20
  11. package/dts/chart/CartesianChart.d.ts +0 -206
  12. package/dts/chart/CartesianChart.d.ts.map +0 -1
  13. package/dts/chart/ChartContextBridge.d.ts +0 -28
  14. package/dts/chart/ChartContextBridge.d.ts.map +0 -1
  15. package/dts/chart/ChartProvider.d.ts +0 -9
  16. package/dts/chart/ChartProvider.d.ts.map +0 -1
  17. package/dts/chart/Path.d.ts +0 -121
  18. package/dts/chart/Path.d.ts.map +0 -1
  19. package/dts/chart/PeriodSelector.d.ts +0 -100
  20. package/dts/chart/PeriodSelector.d.ts.map +0 -1
  21. package/dts/chart/area/Area.d.ts +0 -83
  22. package/dts/chart/area/Area.d.ts.map +0 -1
  23. package/dts/chart/area/AreaChart.d.ts +0 -155
  24. package/dts/chart/area/AreaChart.d.ts.map +0 -1
  25. package/dts/chart/area/DottedArea.d.ts +0 -46
  26. package/dts/chart/area/DottedArea.d.ts.map +0 -1
  27. package/dts/chart/area/GradientArea.d.ts +0 -36
  28. package/dts/chart/area/GradientArea.d.ts.map +0 -1
  29. package/dts/chart/area/SolidArea.d.ts +0 -23
  30. package/dts/chart/area/SolidArea.d.ts.map +0 -1
  31. package/dts/chart/area/index.d.ts +0 -6
  32. package/dts/chart/area/index.d.ts.map +0 -1
  33. package/dts/chart/axis/Axis.d.ts +0 -174
  34. package/dts/chart/axis/Axis.d.ts.map +0 -1
  35. package/dts/chart/axis/DefaultAxisTickLabel.d.ts +0 -8
  36. package/dts/chart/axis/DefaultAxisTickLabel.d.ts.map +0 -1
  37. package/dts/chart/axis/XAxis.d.ts +0 -22
  38. package/dts/chart/axis/XAxis.d.ts.map +0 -1
  39. package/dts/chart/axis/YAxis.d.ts +0 -22
  40. package/dts/chart/axis/YAxis.d.ts.map +0 -1
  41. package/dts/chart/axis/index.d.ts +0 -5
  42. package/dts/chart/axis/index.d.ts.map +0 -1
  43. package/dts/chart/bar/Bar.d.ts +0 -100
  44. package/dts/chart/bar/Bar.d.ts.map +0 -1
  45. package/dts/chart/bar/BarChart.d.ts +0 -158
  46. package/dts/chart/bar/BarChart.d.ts.map +0 -1
  47. package/dts/chart/bar/BarPlot.d.ts +0 -31
  48. package/dts/chart/bar/BarPlot.d.ts.map +0 -1
  49. package/dts/chart/bar/BarStack.d.ts +0 -127
  50. package/dts/chart/bar/BarStack.d.ts.map +0 -1
  51. package/dts/chart/bar/BarStackGroup.d.ts +0 -37
  52. package/dts/chart/bar/BarStackGroup.d.ts.map +0 -1
  53. package/dts/chart/bar/DefaultBar.d.ts +0 -7
  54. package/dts/chart/bar/DefaultBar.d.ts.map +0 -1
  55. package/dts/chart/bar/DefaultBarStack.d.ts +0 -7
  56. package/dts/chart/bar/DefaultBarStack.d.ts.map +0 -1
  57. package/dts/chart/bar/PercentageBarChart.d.ts +0 -106
  58. package/dts/chart/bar/PercentageBarChart.d.ts.map +0 -1
  59. package/dts/chart/bar/index.d.ts +0 -9
  60. package/dts/chart/bar/index.d.ts.map +0 -1
  61. package/dts/chart/gradient/Gradient.d.ts +0 -41
  62. package/dts/chart/gradient/Gradient.d.ts.map +0 -1
  63. package/dts/chart/gradient/index.d.ts +0 -2
  64. package/dts/chart/gradient/index.d.ts.map +0 -1
  65. package/dts/chart/legend/DefaultLegendEntry.d.ts +0 -5
  66. package/dts/chart/legend/DefaultLegendEntry.d.ts.map +0 -1
  67. package/dts/chart/legend/DefaultLegendShape.d.ts +0 -5
  68. package/dts/chart/legend/DefaultLegendShape.d.ts.map +0 -1
  69. package/dts/chart/legend/Legend.d.ts +0 -168
  70. package/dts/chart/legend/Legend.d.ts.map +0 -1
  71. package/dts/chart/legend/index.d.ts +0 -4
  72. package/dts/chart/legend/index.d.ts.map +0 -1
  73. package/dts/chart/line/DefaultReferenceLineLabel.d.ts +0 -9
  74. package/dts/chart/line/DefaultReferenceLineLabel.d.ts.map +0 -1
  75. package/dts/chart/line/DottedLine.d.ts +0 -20
  76. package/dts/chart/line/DottedLine.d.ts.map +0 -1
  77. package/dts/chart/line/Line.d.ts +0 -122
  78. package/dts/chart/line/Line.d.ts.map +0 -1
  79. package/dts/chart/line/LineChart.d.ts +0 -135
  80. package/dts/chart/line/LineChart.d.ts.map +0 -1
  81. package/dts/chart/line/ReferenceLine.d.ts +0 -140
  82. package/dts/chart/line/ReferenceLine.d.ts.map +0 -1
  83. package/dts/chart/line/SolidLine.d.ts +0 -15
  84. package/dts/chart/line/SolidLine.d.ts.map +0 -1
  85. package/dts/chart/line/index.d.ts +0 -7
  86. package/dts/chart/line/index.d.ts.map +0 -1
  87. package/dts/chart/point/DefaultPointLabel.d.ts +0 -10
  88. package/dts/chart/point/DefaultPointLabel.d.ts.map +0 -1
  89. package/dts/chart/point/Point.d.ts +0 -144
  90. package/dts/chart/point/Point.d.ts.map +0 -1
  91. package/dts/chart/point/index.d.ts +0 -3
  92. package/dts/chart/point/index.d.ts.map +0 -1
  93. package/dts/chart/scrubber/DefaultScrubberBeacon.d.ts +0 -38
  94. package/dts/chart/scrubber/DefaultScrubberBeacon.d.ts.map +0 -1
  95. package/dts/chart/scrubber/DefaultScrubberBeaconLabel.d.ts +0 -12
  96. package/dts/chart/scrubber/DefaultScrubberBeaconLabel.d.ts.map +0 -1
  97. package/dts/chart/scrubber/DefaultScrubberLabel.d.ts +0 -12
  98. package/dts/chart/scrubber/DefaultScrubberLabel.d.ts.map +0 -1
  99. package/dts/chart/scrubber/Scrubber.d.ts +0 -302
  100. package/dts/chart/scrubber/Scrubber.d.ts.map +0 -1
  101. package/dts/chart/scrubber/ScrubberAccessibilityView.d.ts +0 -12
  102. package/dts/chart/scrubber/ScrubberAccessibilityView.d.ts.map +0 -1
  103. package/dts/chart/scrubber/ScrubberBeaconGroup.d.ts +0 -54
  104. package/dts/chart/scrubber/ScrubberBeaconGroup.d.ts.map +0 -1
  105. package/dts/chart/scrubber/ScrubberBeaconLabelGroup.d.ts +0 -46
  106. package/dts/chart/scrubber/ScrubberBeaconLabelGroup.d.ts.map +0 -1
  107. package/dts/chart/scrubber/ScrubberProvider.d.ts +0 -20
  108. package/dts/chart/scrubber/ScrubberProvider.d.ts.map +0 -1
  109. package/dts/chart/scrubber/index.d.ts +0 -5
  110. package/dts/chart/scrubber/index.d.ts.map +0 -1
  111. package/dts/chart/text/ChartText.d.ts +0 -164
  112. package/dts/chart/text/ChartText.d.ts.map +0 -1
  113. package/dts/chart/text/ChartTextGroup.d.ts +0 -61
  114. package/dts/chart/text/ChartTextGroup.d.ts.map +0 -1
  115. package/dts/chart/text/index.d.ts +0 -3
  116. package/dts/chart/text/index.d.ts.map +0 -1
  117. package/dts/chart/utils/axis.d.ts +0 -387
  118. package/dts/chart/utils/axis.d.ts.map +0 -1
  119. package/dts/chart/utils/bar.d.ts +0 -225
  120. package/dts/chart/utils/bar.d.ts.map +0 -1
  121. package/dts/chart/utils/chart.d.ts +0 -165
  122. package/dts/chart/utils/chart.d.ts.map +0 -1
  123. package/dts/chart/utils/context.d.ts +0 -131
  124. package/dts/chart/utils/context.d.ts.map +0 -1
  125. package/dts/chart/utils/gradient.d.ts +0 -129
  126. package/dts/chart/utils/gradient.d.ts.map +0 -1
  127. package/dts/chart/utils/index.d.ts +0 -11
  128. package/dts/chart/utils/index.d.ts.map +0 -1
  129. package/dts/chart/utils/path.d.ts +0 -186
  130. package/dts/chart/utils/path.d.ts.map +0 -1
  131. package/dts/chart/utils/point.d.ts +0 -146
  132. package/dts/chart/utils/point.d.ts.map +0 -1
  133. package/dts/chart/utils/scale.d.ts +0 -145
  134. package/dts/chart/utils/scale.d.ts.map +0 -1
  135. package/dts/chart/utils/scrubber.d.ts +0 -40
  136. package/dts/chart/utils/scrubber.d.ts.map +0 -1
  137. package/dts/chart/utils/transition.d.ts +0 -181
  138. package/dts/chart/utils/transition.d.ts.map +0 -1
  139. package/dts/sparkline/Counter.d.ts +0 -8
  140. package/dts/sparkline/Counter.d.ts.map +0 -1
  141. package/dts/sparkline/Sparkline.d.ts +0 -74
  142. package/dts/sparkline/Sparkline.d.ts.map +0 -1
  143. package/dts/sparkline/SparklineArea.d.ts +0 -15
  144. package/dts/sparkline/SparklineArea.d.ts.map +0 -1
  145. package/dts/sparkline/SparklineAreaPattern.d.ts +0 -14
  146. package/dts/sparkline/SparklineAreaPattern.d.ts.map +0 -1
  147. package/dts/sparkline/SparklineGradient.d.ts +0 -24
  148. package/dts/sparkline/SparklineGradient.d.ts.map +0 -1
  149. package/dts/sparkline/__figma__/Sparkline.figma.d.ts +0 -2
  150. package/dts/sparkline/__figma__/Sparkline.figma.d.ts.map +0 -1
  151. package/dts/sparkline/generateSparklineWithId.d.ts +0 -11
  152. package/dts/sparkline/generateSparklineWithId.d.ts.map +0 -1
  153. package/dts/sparkline/sparkline-interactive/SparklineAccessibleView.d.ts +0 -23
  154. package/dts/sparkline/sparkline-interactive/SparklineAccessibleView.d.ts.map +0 -1
  155. package/dts/sparkline/sparkline-interactive/SparklineInteractive.d.ts +0 -185
  156. package/dts/sparkline/sparkline-interactive/SparklineInteractive.d.ts.map +0 -1
  157. package/dts/sparkline/sparkline-interactive/SparklineInteractiveAnimatedPath.d.ts +0 -25
  158. package/dts/sparkline/sparkline-interactive/SparklineInteractiveAnimatedPath.d.ts.map +0 -1
  159. package/dts/sparkline/sparkline-interactive/SparklineInteractiveHoverDate.d.ts +0 -28
  160. package/dts/sparkline/sparkline-interactive/SparklineInteractiveHoverDate.d.ts.map +0 -1
  161. package/dts/sparkline/sparkline-interactive/SparklineInteractiveLineVertical.d.ts +0 -13
  162. package/dts/sparkline/sparkline-interactive/SparklineInteractiveLineVertical.d.ts.map +0 -1
  163. package/dts/sparkline/sparkline-interactive/SparklineInteractiveMarkerDates.d.ts +0 -17
  164. package/dts/sparkline/sparkline-interactive/SparklineInteractiveMarkerDates.d.ts.map +0 -1
  165. package/dts/sparkline/sparkline-interactive/SparklineInteractiveMinMax.d.ts +0 -11
  166. package/dts/sparkline/sparkline-interactive/SparklineInteractiveMinMax.d.ts.map +0 -1
  167. package/dts/sparkline/sparkline-interactive/SparklineInteractivePanGestureHandler.d.ts +0 -26
  168. package/dts/sparkline/sparkline-interactive/SparklineInteractivePanGestureHandler.d.ts.map +0 -1
  169. package/dts/sparkline/sparkline-interactive/SparklineInteractivePaths.d.ts +0 -25
  170. package/dts/sparkline/sparkline-interactive/SparklineInteractivePaths.d.ts.map +0 -1
  171. package/dts/sparkline/sparkline-interactive/SparklineInteractivePeriodSelector.d.ts +0 -25
  172. package/dts/sparkline/sparkline-interactive/SparklineInteractivePeriodSelector.d.ts.map +0 -1
  173. package/dts/sparkline/sparkline-interactive/SparklineInteractiveProvider.d.ts +0 -39
  174. package/dts/sparkline/sparkline-interactive/SparklineInteractiveProvider.d.ts.map +0 -1
  175. package/dts/sparkline/sparkline-interactive/SparklineInteractiveTimeseriesPaths.d.ts +0 -31
  176. package/dts/sparkline/sparkline-interactive/SparklineInteractiveTimeseriesPaths.d.ts.map +0 -1
  177. package/dts/sparkline/sparkline-interactive/__figma__/SparklineInteractive.figma.d.ts +0 -2
  178. package/dts/sparkline/sparkline-interactive/__figma__/SparklineInteractive.figma.d.ts.map +0 -1
  179. package/dts/sparkline/sparkline-interactive/useInterruptiblePathAnimation.d.ts +0 -13
  180. package/dts/sparkline/sparkline-interactive/useInterruptiblePathAnimation.d.ts.map +0 -1
  181. package/dts/sparkline/sparkline-interactive/useMinMaxTransform.d.ts +0 -16
  182. package/dts/sparkline/sparkline-interactive/useMinMaxTransform.d.ts.map +0 -1
  183. package/dts/sparkline/sparkline-interactive/useOpacityAnimation.d.ts +0 -6
  184. package/dts/sparkline/sparkline-interactive/useOpacityAnimation.d.ts.map +0 -1
  185. package/dts/sparkline/sparkline-interactive/useSparklineInteractiveConstants.d.ts +0 -22
  186. package/dts/sparkline/sparkline-interactive/useSparklineInteractiveConstants.d.ts.map +0 -1
  187. package/dts/sparkline/sparkline-interactive/useSparklineInteractiveLineStyles.d.ts +0 -34
  188. package/dts/sparkline/sparkline-interactive/useSparklineInteractiveLineStyles.d.ts.map +0 -1
  189. package/dts/sparkline/sparkline-interactive-header/SparklineInteractiveHeader.d.ts +0 -118
  190. package/dts/sparkline/sparkline-interactive-header/SparklineInteractiveHeader.d.ts.map +0 -1
  191. package/dts/sparkline/sparkline-interactive-header/__figma__/SparklineInteractiveHeader.figma.d.ts +0 -2
  192. package/dts/sparkline/sparkline-interactive-header/__figma__/SparklineInteractiveHeader.figma.d.ts.map +0 -1
  193. package/dts/sparkline/sparkline-interactive-header/useSparklineInteractiveHeaderStyles.d.ts +0 -29
  194. package/dts/sparkline/sparkline-interactive-header/useSparklineInteractiveHeaderStyles.d.ts.map +0 -1
  195. package/esm/chart/CartesianChart.js +0 -431
  196. package/esm/chart/ChartContextBridge.js +0 -159
  197. package/esm/chart/ChartProvider.js +0 -10
  198. package/esm/chart/Path.js +0 -255
  199. package/esm/chart/PeriodSelector.js +0 -139
  200. package/esm/chart/__stories__/CartesianChart.stories.js +0 -659
  201. package/esm/chart/__stories__/ChartAccessibility.stories.js +0 -721
  202. package/esm/chart/__stories__/ChartTransitions.stories.js +0 -693
  203. package/esm/chart/__stories__/PeriodSelector.stories.js +0 -420
  204. package/esm/chart/area/Area.js +0 -85
  205. package/esm/chart/area/AreaChart.js +0 -152
  206. package/esm/chart/area/DottedArea.js +0 -92
  207. package/esm/chart/area/GradientArea.js +0 -63
  208. package/esm/chart/area/SolidArea.js +0 -45
  209. package/esm/chart/area/__stories__/AreaChart.stories.js +0 -370
  210. package/esm/chart/area/index.js +0 -7
  211. package/esm/chart/axis/Axis.js +0 -9
  212. package/esm/chart/axis/DefaultAxisTickLabel.js +0 -11
  213. package/esm/chart/axis/XAxis.js +0 -256
  214. package/esm/chart/axis/YAxis.js +0 -255
  215. package/esm/chart/axis/__stories__/Axis.stories.js +0 -552
  216. package/esm/chart/axis/index.js +0 -6
  217. package/esm/chart/bar/Bar.js +0 -71
  218. package/esm/chart/bar/BarChart.js +0 -122
  219. package/esm/chart/bar/BarPlot.js +0 -106
  220. package/esm/chart/bar/BarStack.js +0 -173
  221. package/esm/chart/bar/BarStackGroup.js +0 -89
  222. package/esm/chart/bar/DefaultBar.js +0 -79
  223. package/esm/chart/bar/DefaultBarStack.js +0 -68
  224. package/esm/chart/bar/PercentageBarChart.js +0 -99
  225. package/esm/chart/bar/__stories__/BarChart.stories.js +0 -1417
  226. package/esm/chart/bar/__stories__/PercentageBarChart.stories.js +0 -833
  227. package/esm/chart/bar/index.js +0 -10
  228. package/esm/chart/gradient/Gradient.js +0 -156
  229. package/esm/chart/gradient/index.js +0 -1
  230. package/esm/chart/legend/DefaultLegendEntry.js +0 -42
  231. package/esm/chart/legend/DefaultLegendShape.js +0 -64
  232. package/esm/chart/legend/Legend.js +0 -59
  233. package/esm/chart/legend/__stories__/Legend.stories.js +0 -574
  234. package/esm/chart/legend/index.js +0 -3
  235. package/esm/chart/line/DefaultReferenceLineLabel.js +0 -66
  236. package/esm/chart/line/DottedLine.js +0 -57
  237. package/esm/chart/line/Line.js +0 -180
  238. package/esm/chart/line/LineChart.js +0 -149
  239. package/esm/chart/line/ReferenceLine.js +0 -132
  240. package/esm/chart/line/SolidLine.js +0 -53
  241. package/esm/chart/line/__stories__/LineChart.stories.js +0 -2018
  242. package/esm/chart/line/__stories__/ReferenceLine.stories.js +0 -226
  243. package/esm/chart/line/index.js +0 -8
  244. package/esm/chart/point/DefaultPointLabel.js +0 -39
  245. package/esm/chart/point/Point.js +0 -187
  246. package/esm/chart/point/index.js +0 -2
  247. package/esm/chart/scrubber/DefaultScrubberBeacon.js +0 -182
  248. package/esm/chart/scrubber/DefaultScrubberBeaconLabel.js +0 -43
  249. package/esm/chart/scrubber/DefaultScrubberLabel.js +0 -44
  250. package/esm/chart/scrubber/Scrubber.js +0 -198
  251. package/esm/chart/scrubber/ScrubberAccessibilityView.js +0 -177
  252. package/esm/chart/scrubber/ScrubberBeaconGroup.js +0 -169
  253. package/esm/chart/scrubber/ScrubberBeaconLabelGroup.js +0 -212
  254. package/esm/chart/scrubber/ScrubberProvider.js +0 -140
  255. package/esm/chart/scrubber/__stories__/Scrubber.stories.js +0 -946
  256. package/esm/chart/scrubber/index.js +0 -4
  257. package/esm/chart/text/ChartText.js +0 -305
  258. package/esm/chart/text/ChartTextGroup.js +0 -211
  259. package/esm/chart/text/index.js +0 -4
  260. package/esm/chart/utils/axis.js +0 -664
  261. package/esm/chart/utils/bar.js +0 -906
  262. package/esm/chart/utils/chart.js +0 -329
  263. package/esm/chart/utils/context.js +0 -22
  264. package/esm/chart/utils/gradient.js +0 -319
  265. package/esm/chart/utils/index.js +0 -12
  266. package/esm/chart/utils/path.js +0 -304
  267. package/esm/chart/utils/point.js +0 -282
  268. package/esm/chart/utils/scale.js +0 -288
  269. package/esm/chart/utils/scrubber.js +0 -146
  270. package/esm/chart/utils/transition.js +0 -241
  271. package/esm/sparkline/Counter.js +0 -45
  272. package/esm/sparkline/Sparkline.js +0 -165
  273. package/esm/sparkline/SparklineArea.js +0 -20
  274. package/esm/sparkline/SparklineAreaPattern.js +0 -38
  275. package/esm/sparkline/SparklineGradient.js +0 -77
  276. package/esm/sparkline/__figma__/Sparkline.figma.js +0 -22
  277. package/esm/sparkline/__stories__/Sparkline.stories.js +0 -124
  278. package/esm/sparkline/__stories__/SparklineGradient.stories.js +0 -126
  279. package/esm/sparkline/generateSparklineWithId.js +0 -7
  280. package/esm/sparkline/sparkline-interactive/SparklineAccessibleView.js +0 -75
  281. package/esm/sparkline/sparkline-interactive/SparklineInteractive.js +0 -308
  282. package/esm/sparkline/sparkline-interactive/SparklineInteractiveAnimatedPath.js +0 -116
  283. package/esm/sparkline/sparkline-interactive/SparklineInteractiveHoverDate.js +0 -131
  284. package/esm/sparkline/sparkline-interactive/SparklineInteractiveLineVertical.js +0 -99
  285. package/esm/sparkline/sparkline-interactive/SparklineInteractiveMarkerDates.js +0 -82
  286. package/esm/sparkline/sparkline-interactive/SparklineInteractiveMinMax.js +0 -103
  287. package/esm/sparkline/sparkline-interactive/SparklineInteractivePanGestureHandler.js +0 -104
  288. package/esm/sparkline/sparkline-interactive/SparklineInteractivePaths.js +0 -57
  289. package/esm/sparkline/sparkline-interactive/SparklineInteractivePeriodSelector.js +0 -124
  290. package/esm/sparkline/sparkline-interactive/SparklineInteractiveProvider.js +0 -80
  291. package/esm/sparkline/sparkline-interactive/SparklineInteractiveTimeseriesPaths.js +0 -109
  292. package/esm/sparkline/sparkline-interactive/__figma__/SparklineInteractive.figma.js +0 -85
  293. package/esm/sparkline/sparkline-interactive/__stories__/SparklineInteractive.stories.js +0 -526
  294. package/esm/sparkline/sparkline-interactive/useInterruptiblePathAnimation.js +0 -58
  295. package/esm/sparkline/sparkline-interactive/useInterruptiblePathAnimation.test.disable.js +0 -37
  296. package/esm/sparkline/sparkline-interactive/useMinMaxTransform.js +0 -56
  297. package/esm/sparkline/sparkline-interactive/useOpacityAnimation.js +0 -23
  298. package/esm/sparkline/sparkline-interactive/useSparklineInteractiveConstants.js +0 -47
  299. package/esm/sparkline/sparkline-interactive/useSparklineInteractiveLineStyles.js +0 -34
  300. package/esm/sparkline/sparkline-interactive-header/SparklineInteractiveHeader.js +0 -233
  301. package/esm/sparkline/sparkline-interactive-header/__figma__/SparklineInteractiveHeader.figma.js +0 -104
  302. package/esm/sparkline/sparkline-interactive-header/__stories__/SparklineInteractiveHeader.stories.js +0 -565
  303. package/esm/sparkline/sparkline-interactive-header/useSparklineInteractiveHeaderStyles.js +0 -117
@@ -1,574 +0,0 @@
1
- function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
2
- import { memo, useCallback, useMemo, useState } from 'react';
3
- import { ScrollView } from 'react-native';
4
- import { Chip } from '@coinbase/cds-mobile/chips';
5
- import { Example, ExampleScreen } from '@coinbase/cds-mobile/examples/ExampleScreen';
6
- import { useTheme } from '@coinbase/cds-mobile/hooks/useTheme';
7
- import { Box, HStack, VStack } from '@coinbase/cds-mobile/layout';
8
- import { TextLabel1, TextLabel2 } from '@coinbase/cds-mobile/typography';
9
- import { Canvas, Group, Path as SkiaPath, Skia } from '@shopify/react-native-skia';
10
- import { XAxis, YAxis } from '../../axis';
11
- import { BarChart, BarPlot, DefaultBar } from '../../bar';
12
- import { CartesianChart } from '../../CartesianChart';
13
- import { LineChart } from '../../line';
14
- import { Scrubber } from '../../scrubber';
15
- import { getDottedAreaPath } from '../../utils/path';
16
- import { DefaultLegendShape } from '../DefaultLegendShape';
17
- import { Legend } from '../Legend';
18
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
19
- const spectrumColors = ['blue40', 'green40', 'orange40', 'yellow40', 'gray40', 'indigo40', 'pink40', 'purple40', 'red40', 'teal40'];
20
- const shapes = ['pill', 'circle', 'squircle', 'square'];
21
- const Shapes = () => {
22
- const theme = useTheme();
23
- return /*#__PURE__*/_jsx(VStack, {
24
- gap: 2,
25
- children: shapes.map(shape => /*#__PURE__*/_jsx(HStack, {
26
- gap: 1,
27
- children: spectrumColors.map(color => /*#__PURE__*/_jsx(Box, {
28
- style: {
29
- width: 10,
30
- justifyContent: 'center'
31
- },
32
- children: /*#__PURE__*/_jsx(DefaultLegendShape, {
33
- color: "rgb(" + theme.spectrum[color] + ")",
34
- shape: shape
35
- })
36
- }, color))
37
- }, shape))
38
- });
39
- };
40
- const BasicLegend = () => {
41
- const theme = useTheme();
42
- const pages = useMemo(() => ['Page A', 'Page B', 'Page C', 'Page D', 'Page E', 'Page F', 'Page G'], []);
43
- const pageViews = useMemo(() => [2400, 1398, 9800, 3908, 4800, 3800, 4300], []);
44
- const uniqueVisitors = useMemo(() => [4000, 3000, 2000, 2780, 1890, 2390, 3490], []);
45
- const numberFormatter = useCallback(value => new Intl.NumberFormat('en-US', {
46
- maximumFractionDigits: 0
47
- }).format(value), []);
48
- const chartAccessibilityLabel = "Website traffic across " + pages.length + " pages showing page views and unique visitors.";
49
- return /*#__PURE__*/_jsx(LineChart, {
50
- enableScrubbing: true,
51
- legend: true,
52
- showArea: true,
53
- accessibilityLabel: chartAccessibilityLabel,
54
- height: 150,
55
- legendPosition: "right",
56
- series: [{
57
- id: 'pageViews',
58
- data: pageViews,
59
- color: "rgb(" + theme.spectrum.green40 + ")",
60
- label: 'Page Views'
61
- }, {
62
- id: 'uniqueVisitors',
63
- data: uniqueVisitors,
64
- color: "rgb(" + theme.spectrum.purple40 + ")",
65
- label: 'Unique Visitors',
66
- areaType: 'dotted'
67
- }],
68
- width: "100%",
69
- xAxis: {
70
- data: pages
71
- },
72
- yAxis: {
73
- showGrid: true,
74
- tickLabelFormatter: numberFormatter
75
- },
76
- children: /*#__PURE__*/_jsx(Scrubber, {})
77
- });
78
- };
79
- const Position = () => {
80
- const theme = useTheme();
81
- return /*#__PURE__*/_jsxs(CartesianChart, {
82
- height: 200,
83
- inset: {
84
- bottom: 8,
85
- left: 0,
86
- right: 0,
87
- top: 8
88
- },
89
- legend: /*#__PURE__*/_jsx(Legend, {
90
- justifyContent: "flex-end"
91
- }),
92
- legendPosition: "bottom",
93
- series: [{
94
- id: 'revenue',
95
- label: 'Revenue',
96
- data: [455, 520, 380, 455, 285, 235],
97
- yAxisId: 'revenue',
98
- color: "rgb(" + theme.spectrum.yellow40 + ")",
99
- legendShape: 'squircle'
100
- }, {
101
- id: 'profitMargin',
102
- label: 'Profit Margin',
103
- data: [23, 20, 16, 38, 12, 9],
104
- yAxisId: 'profitMargin',
105
- color: theme.color.fgPositive,
106
- legendShape: 'squircle'
107
- }],
108
- width: "100%",
109
- xAxis: {
110
- data: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun'],
111
- scaleType: 'band'
112
- },
113
- yAxis: [{
114
- id: 'revenue',
115
- domain: {
116
- min: 0
117
- }
118
- }, {
119
- id: 'profitMargin',
120
- domain: {
121
- max: 100,
122
- min: 0
123
- }
124
- }],
125
- children: [/*#__PURE__*/_jsx(XAxis, {
126
- showLine: true,
127
- showTickMarks: true
128
- }), /*#__PURE__*/_jsx(YAxis, {
129
- showGrid: true,
130
- showLine: true,
131
- showTickMarks: true,
132
- axisId: "revenue",
133
- position: "left",
134
- requestedTickCount: 5,
135
- tickLabelFormatter: value => "$" + value + "k",
136
- width: 60
137
- }), /*#__PURE__*/_jsx(YAxis, {
138
- showLine: true,
139
- showTickMarks: true,
140
- axisId: "profitMargin",
141
- position: "right",
142
- requestedTickCount: 5,
143
- tickLabelFormatter: value => value + "%"
144
- }), /*#__PURE__*/_jsx(BarPlot, {})]
145
- });
146
- };
147
- const ShapeVariants = () => {
148
- const theme = useTheme();
149
- const months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun'];
150
- return /*#__PURE__*/_jsx(LineChart, {
151
- legend: true,
152
- showArea: true,
153
- height: 200,
154
- legendPosition: "left",
155
- series: [{
156
- id: 'pill',
157
- label: 'Pill',
158
- data: [120, 150, 130, 170, 160, 190],
159
- color: "rgb(" + theme.spectrum.blue40 + ")",
160
- legendShape: 'pill'
161
- }, {
162
- id: 'circle',
163
- label: 'Circle',
164
- data: [80, 110, 95, 125, 115, 140],
165
- color: "rgb(" + theme.spectrum.green40 + ")",
166
- legendShape: 'circle'
167
- }, {
168
- id: 'square',
169
- label: 'Square',
170
- data: [60, 85, 70, 100, 90, 115],
171
- color: "rgb(" + theme.spectrum.orange40 + ")",
172
- legendShape: 'square'
173
- }, {
174
- id: 'squircle',
175
- label: 'Squircle',
176
- data: [40, 60, 50, 75, 65, 85],
177
- color: "rgb(" + theme.spectrum.purple40 + ")",
178
- legendShape: 'squircle'
179
- }],
180
- width: "100%",
181
- xAxis: {
182
- data: months
183
- },
184
- yAxis: {
185
- domain: {
186
- min: 0
187
- },
188
- showGrid: true
189
- }
190
- });
191
- };
192
- const DynamicData = () => {
193
- var _seriesConfig$0$data$, _seriesConfig$0$data;
194
- const theme = useTheme();
195
- const [scrubberPosition, setScrubberPosition] = useState();
196
- const timeLabels = useMemo(() => ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], []);
197
- const seriesConfig = useMemo(() => [{
198
- id: 'candidate-a',
199
- label: 'Candidate A',
200
- data: [48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 38],
201
- color: "rgb(" + theme.spectrum.blue40 + ")",
202
- legendShape: 'circle'
203
- }, {
204
- id: 'candidate-b',
205
- label: 'Candidate B',
206
- data: [null, null, null, 6, 10, 14, 18, 22, 26, 29, 32, 35],
207
- color: "rgb(" + theme.spectrum.orange40 + ")",
208
- legendShape: 'circle'
209
- }, {
210
- id: 'candidate-c',
211
- label: 'Candidate C',
212
- data: [52, 53, 54, 49, 46, 43, 40, 37, 34, 32, 30, 27],
213
- color: "rgb(" + theme.spectrum.gray40 + ")",
214
- legendShape: 'circle'
215
- }], [theme.spectrum.blue40, theme.spectrum.gray40, theme.spectrum.orange40]);
216
- const dataLength = (_seriesConfig$0$data$ = (_seriesConfig$0$data = seriesConfig[0].data) == null ? void 0 : _seriesConfig$0$data.length) != null ? _seriesConfig$0$data$ : 0;
217
- const dataIndex = scrubberPosition != null ? scrubberPosition : dataLength - 1;
218
- const chartAccessibilityLabel = "Candidate polling data over " + timeLabels.length + " months showing support percentages for 3 candidates.";
219
- const ValueLegendEntry = useCallback(_ref => {
220
- var _seriesData$data;
221
- let {
222
- seriesId,
223
- label,
224
- color,
225
- shape
226
- } = _ref;
227
- const seriesData = seriesConfig.find(s => s.id === seriesId);
228
- const rawValue = seriesData == null || (_seriesData$data = seriesData.data) == null ? void 0 : _seriesData$data[dataIndex];
229
- const formattedValue = rawValue === null || rawValue === undefined ? '--' : Math.round(rawValue) + "%";
230
- return /*#__PURE__*/_jsxs(HStack, {
231
- gap: 1,
232
- style: {
233
- alignItems: 'center'
234
- },
235
- children: [/*#__PURE__*/_jsx(DefaultLegendShape, {
236
- color: color,
237
- shape: shape
238
- }), /*#__PURE__*/_jsx(TextLabel2, {
239
- children: label
240
- }), /*#__PURE__*/_jsx(TextLabel1, {
241
- children: formattedValue
242
- })]
243
- });
244
- }, [seriesConfig, dataIndex]);
245
- return /*#__PURE__*/_jsx(LineChart, {
246
- enableScrubbing: true,
247
- showArea: true,
248
- accessibilityLabel: chartAccessibilityLabel,
249
- height: 250,
250
- legend: /*#__PURE__*/_jsx(Legend, {
251
- EntryComponent: ValueLegendEntry,
252
- justifyContent: "flex-start",
253
- paddingX: 2
254
- }),
255
- legendPosition: "top",
256
- onScrubberPositionChange: setScrubberPosition,
257
- series: seriesConfig,
258
- width: "100%",
259
- xAxis: {
260
- data: timeLabels
261
- },
262
- yAxis: {
263
- domain: {
264
- max: 100,
265
- min: 0
266
- },
267
- showGrid: true,
268
- tickLabelFormatter: value => value + "%"
269
- },
270
- children: /*#__PURE__*/_jsx(Scrubber, {})
271
- });
272
- };
273
- const Interactive = () => {
274
- const theme = useTheme();
275
- const [emphasizedId, setEmphasizedId] = useState(null);
276
- const months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
277
- const seriesConfig = useMemo(() => [{
278
- id: 'revenue',
279
- label: 'Revenue',
280
- data: [120, 150, 180, 165, 190, 210, 240, 220, 260, 280, 310, 350],
281
- baseColor: 'blue'
282
- }, {
283
- id: 'expenses',
284
- label: 'Expenses',
285
- data: [80, 95, 110, 105, 120, 130, 145, 140, 155, 165, 180, 195],
286
- baseColor: 'orange'
287
- }, {
288
- id: 'profit',
289
- label: 'Profit',
290
- data: [40, 55, 70, 60, 70, 80, 95, 80, 105, 115, 130, 155],
291
- baseColor: 'green'
292
- }], []);
293
- const handleToggle = useCallback(seriesId => {
294
- setEmphasizedId(prev => prev === seriesId ? null : seriesId);
295
- }, []);
296
- const ChipLegendEntry = /*#__PURE__*/memo(function ChipLegendEntry(_ref2) {
297
- var _config$baseColor;
298
- let {
299
- seriesId,
300
- label
301
- } = _ref2;
302
- const isEmphasized = emphasizedId === seriesId;
303
- const config = seriesConfig.find(s => s.id === seriesId);
304
- const baseColor = (_config$baseColor = config == null ? void 0 : config.baseColor) != null ? _config$baseColor : 'gray';
305
- const color10 = theme.spectrum[baseColor + "10"];
306
- const color50 = theme.spectrum[baseColor + "50"];
307
- const color90 = theme.spectrum[baseColor + "90"];
308
- return /*#__PURE__*/_jsx(Chip, {
309
- compact: true,
310
- accessibilityLabel: (isEmphasized ? 'Remove emphasis from' : 'Emphasize') + " " + label + " series",
311
- background: "transparent",
312
- onPress: () => handleToggle(seriesId),
313
- style: {
314
- backgroundColor: "rgb(" + (isEmphasized ? color90 : color10) + ")",
315
- borderWidth: 0,
316
- borderRadius: theme.borderRadius[1000]
317
- },
318
- children: /*#__PURE__*/_jsxs(HStack, {
319
- gap: 1,
320
- style: {
321
- alignItems: 'center'
322
- },
323
- children: [/*#__PURE__*/_jsx(DefaultLegendShape, {
324
- color: "rgb(" + color50 + ")"
325
- }), /*#__PURE__*/_jsx(TextLabel2, {
326
- color: isEmphasized ? 'bg' : 'fg',
327
- children: label
328
- })]
329
- })
330
- });
331
- });
332
- const series = useMemo(() => {
333
- return seriesConfig.map(config => {
334
- const isEmphasized = emphasizedId === config.id;
335
- const isDimmed = emphasizedId !== null && !isEmphasized;
336
- return {
337
- id: config.id,
338
- label: config.label,
339
- data: config.data,
340
- color: "rgb(" + theme.spectrum[config.baseColor + "40"] + ")",
341
- opacity: isDimmed ? 0.3 : 1
342
- };
343
- });
344
- }, [emphasizedId, seriesConfig, theme]);
345
- return /*#__PURE__*/_jsx(LineChart, {
346
- showArea: true,
347
- height: 300,
348
- legend: /*#__PURE__*/_jsx(Legend, {
349
- EntryComponent: ChipLegendEntry,
350
- gap: 1,
351
- paddingTop: 1
352
- }),
353
- legendPosition: "top",
354
- series: series,
355
- width: "100%",
356
- xAxis: {
357
- data: months
358
- },
359
- yAxis: {
360
- domain: {
361
- min: 0
362
- },
363
- showGrid: true,
364
- tickLabelFormatter: value => "$" + value + "k"
365
- }
366
- });
367
- };
368
- const Accessible = () => {
369
- const theme = useTheme();
370
- const months = useMemo(() => ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun'], []);
371
- return /*#__PURE__*/_jsx(LineChart, {
372
- legend: true,
373
- showArea: true,
374
- height: 200,
375
- legendAccessibilityLabel: "Financial performance chart, legend",
376
- legendPosition: "bottom",
377
- series: [{
378
- id: 'revenue',
379
- label: 'Revenue',
380
- data: [120, 150, 180, 165, 190, 210],
381
- color: "rgb(" + theme.spectrum.green40 + ")"
382
- }, {
383
- id: 'expenses',
384
- label: 'Expenses',
385
- data: [80, 95, 110, 105, 120, 130],
386
- color: "rgb(" + theme.spectrum.orange40 + ")"
387
- }],
388
- width: "100%",
389
- xAxis: {
390
- data: months
391
- },
392
- yAxis: {
393
- domain: {
394
- min: 0
395
- },
396
- showGrid: true
397
- }
398
- });
399
- };
400
- const LegendShapes = () => {
401
- const theme = useTheme();
402
- const months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
403
-
404
- // Actual revenue (first 9 months)
405
- const actualRevenue = [320, 380, 420, 390, 450, 480, 520, 490, 540, null, null, null];
406
-
407
- // Forecasted revenue (last 3 months)
408
- const forecastRevenue = [null, null, null, null, null, null, null, null, null, 580, 620, 680];
409
- const numberFormatter = useCallback(value => "$" + new Intl.NumberFormat('en-US', {
410
- maximumFractionDigits: 0
411
- }).format(value) + "k", []);
412
-
413
- // Pattern settings for dotted fill
414
- const patternSize = 4;
415
- const dotSize = 1;
416
-
417
- // Custom legend indicator that matches the dotted bar pattern
418
- const DottedLegendIndicator = useMemo(() => {
419
- // Create a small dotted pattern for the legend indicator
420
- const indicatorSize = 10;
421
- const legendPatternSize = patternSize / 2;
422
- const legendDotSize = dotSize / 2;
423
- const dottedPath = getDottedAreaPath({
424
- x: 1,
425
- y: 1,
426
- width: indicatorSize - 2,
427
- height: indicatorSize - 2
428
- }, legendPatternSize, legendDotSize);
429
- const skiaPath = Skia.Path.MakeFromSVGString(dottedPath);
430
- // Create squircle path for clipping
431
- const squirclePath = Skia.Path.Make();
432
- squirclePath.addRRect(Skia.RRectXY(Skia.XYWHRect(1, 1, 8, 8), 2, 2));
433
- return /*#__PURE__*/_jsxs(Canvas, {
434
- style: {
435
- width: indicatorSize,
436
- height: indicatorSize
437
- },
438
- children: [/*#__PURE__*/_jsx(Group, {
439
- clip: squirclePath,
440
- children: skiaPath && /*#__PURE__*/_jsx(SkiaPath, {
441
- color: theme.color.fgPositive,
442
- path: skiaPath,
443
- style: "fill"
444
- })
445
- }), /*#__PURE__*/_jsx(SkiaPath, {
446
- color: theme.color.fgPositive,
447
- path: squirclePath,
448
- strokeWidth: 2,
449
- style: "stroke"
450
- })]
451
- });
452
- }, [theme.color.fgPositive]);
453
-
454
- // Custom bar component that renders bars with dotted pattern fill
455
- const DottedBarComponent = useMemo(() => {
456
- return /*#__PURE__*/memo(function DottedBar(props) {
457
- const {
458
- x,
459
- y,
460
- width,
461
- height,
462
- fill,
463
- d
464
- } = props;
465
-
466
- // Generate dotted path for this bar's bounds
467
- const dottedPath = useMemo(() => {
468
- return getDottedAreaPath({
469
- x,
470
- y,
471
- width,
472
- height
473
- }, patternSize, dotSize);
474
- }, [x, y, width, height]);
475
-
476
- // Create Skia paths
477
- const barClipPath = useMemo(() => {
478
- var _Skia$Path$MakeFromSV;
479
- return d ? (_Skia$Path$MakeFromSV = Skia.Path.MakeFromSVGString(d)) != null ? _Skia$Path$MakeFromSV : undefined : undefined;
480
- }, [d]);
481
- const dotsSkiaPath = useMemo(() => {
482
- var _Skia$Path$MakeFromSV2;
483
- return (_Skia$Path$MakeFromSV2 = Skia.Path.MakeFromSVGString(dottedPath)) != null ? _Skia$Path$MakeFromSV2 : undefined;
484
- }, [dottedPath]);
485
- return /*#__PURE__*/_jsxs(_Fragment, {
486
- children: [/*#__PURE__*/_jsx(Group, {
487
- clip: barClipPath,
488
- children: dotsSkiaPath && /*#__PURE__*/_jsx(SkiaPath, {
489
- color: fill,
490
- path: dotsSkiaPath,
491
- style: "fill"
492
- })
493
- }), /*#__PURE__*/_jsx(DefaultBar, _extends({}, props, {
494
- fill: undefined,
495
- stroke: fill,
496
- strokeWidth: 2
497
- }))]
498
- });
499
- });
500
- }, []);
501
- return /*#__PURE__*/_jsx(BarChart, {
502
- legend: true,
503
- showXAxis: true,
504
- showYAxis: true,
505
- height: 250,
506
- inset: 0,
507
- legendPosition: "top",
508
- series: [{
509
- id: 'actual',
510
- label: 'Historical',
511
- data: actualRevenue,
512
- color: theme.color.fgPositive,
513
- legendShape: 'squircle',
514
- stackId: 'revenue'
515
- }, {
516
- id: 'forecast',
517
- label: 'Forecasted',
518
- data: forecastRevenue,
519
- color: theme.color.fgPositive,
520
- legendShape: DottedLegendIndicator,
521
- stackId: 'revenue',
522
- BarComponent: DottedBarComponent
523
- }],
524
- xAxis: {
525
- data: months,
526
- scaleType: 'band',
527
- showLine: true,
528
- showTickMarks: true
529
- },
530
- yAxis: {
531
- domain: {
532
- min: 0
533
- },
534
- showGrid: true,
535
- showLine: true,
536
- showTickMarks: true,
537
- position: 'left',
538
- tickLabelFormatter: numberFormatter,
539
- width: 60
540
- }
541
- });
542
- };
543
- const LegendStories = () => {
544
- return /*#__PURE__*/_jsx(ScrollView, {
545
- children: /*#__PURE__*/_jsxs(ExampleScreen, {
546
- children: [/*#__PURE__*/_jsx(Example, {
547
- title: "Shapes",
548
- children: /*#__PURE__*/_jsx(Shapes, {})
549
- }), /*#__PURE__*/_jsx(Example, {
550
- title: "Basic Legend",
551
- children: /*#__PURE__*/_jsx(BasicLegend, {})
552
- }), /*#__PURE__*/_jsx(Example, {
553
- title: "Position",
554
- children: /*#__PURE__*/_jsx(Position, {})
555
- }), /*#__PURE__*/_jsx(Example, {
556
- title: "Shape Variants",
557
- children: /*#__PURE__*/_jsx(ShapeVariants, {})
558
- }), /*#__PURE__*/_jsx(Example, {
559
- title: "Dynamic Data",
560
- children: /*#__PURE__*/_jsx(DynamicData, {})
561
- }), /*#__PURE__*/_jsx(Example, {
562
- title: "Interactive Legend",
563
- children: /*#__PURE__*/_jsx(Interactive, {})
564
- }), /*#__PURE__*/_jsx(Example, {
565
- title: "Legend Shapes",
566
- children: /*#__PURE__*/_jsx(LegendShapes, {})
567
- }), /*#__PURE__*/_jsx(Example, {
568
- title: "Accessible Legend",
569
- children: /*#__PURE__*/_jsx(Accessible, {})
570
- })]
571
- })
572
- });
573
- };
574
- export default LegendStories;
@@ -1,3 +0,0 @@
1
- export * from './DefaultLegendEntry';
2
- export * from './DefaultLegendShape';
3
- export * from './Legend';
@@ -1,66 +0,0 @@
1
- const _excluded = ["color", "elevated", "borderRadius", "inset", "boundsInset"];
2
- function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
3
- function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
4
- import { memo, useMemo } from 'react';
5
- import { useTheme } from '@coinbase/cds-mobile';
6
- import { useCartesianChartContext } from '../ChartProvider';
7
- import { ChartText } from '../text';
8
- import { getChartInset } from '../utils';
9
- import { jsx as _jsx } from "react/jsx-runtime";
10
- const elevatedInset = {
11
- top: 8,
12
- bottom: 8,
13
- left: 12,
14
- right: 12
15
- };
16
- const elevatedBorderRadius = 4;
17
- // Default bounds inset when elevated to prevent shadow clipping
18
- const elevatedBoundsInset = {
19
- top: 4,
20
- bottom: 20,
21
- left: 12,
22
- right: 12
23
- };
24
- const nonElevatedBoundsInset = {
25
- top: 0,
26
- bottom: 0,
27
- left: 0,
28
- right: 0
29
- };
30
-
31
- /**
32
- * DefaultReferenceLineLabel is the default label component for ReferenceLine.
33
- * Provides standard styling with elevation, inset, and color defaults.
34
- * When elevated, automatically adds bounds to prevent shadow cutoff at chart edges.
35
- */
36
- export const DefaultReferenceLineLabel = /*#__PURE__*/memo(_ref => {
37
- let {
38
- color,
39
- elevated,
40
- borderRadius = elevated ? elevatedBorderRadius : undefined,
41
- inset = elevated ? elevatedInset : undefined,
42
- boundsInset: boundsInsetProp
43
- } = _ref,
44
- props = _objectWithoutPropertiesLoose(_ref, _excluded);
45
- const theme = useTheme();
46
- const {
47
- width: chartWidth,
48
- height: chartHeight
49
- } = useCartesianChartContext();
50
- const bounds = useMemo(() => {
51
- const boundsInset = getChartInset(boundsInsetProp, elevated ? elevatedBoundsInset : nonElevatedBoundsInset);
52
- return {
53
- x: boundsInset.left,
54
- y: boundsInset.top,
55
- width: chartWidth - boundsInset.left - boundsInset.right,
56
- height: chartHeight - boundsInset.top - boundsInset.bottom
57
- };
58
- }, [elevated, boundsInsetProp, chartWidth, chartHeight]);
59
- return /*#__PURE__*/_jsx(ChartText, _extends({
60
- borderRadius: borderRadius,
61
- bounds: bounds,
62
- color: color != null ? color : theme.color.fgMuted,
63
- elevated: elevated,
64
- inset: inset
65
- }, props));
66
- });
@@ -1,57 +0,0 @@
1
- const _excluded = ["fill", "stroke", "dashIntervals", "strokeCap", "strokeJoin", "strokeOpacity", "strokeWidth", "gradient", "xAxisId", "yAxisId", "d", "animate", "transitions", "transition"];
2
- function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
3
- function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
4
- import { memo } from 'react';
5
- import { useTheme } from '@coinbase/cds-mobile/hooks/useTheme';
6
- import { DashPathEffect } from '@shopify/react-native-skia';
7
- import { Gradient } from '../gradient';
8
- import { Path } from '../Path';
9
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
10
- /**
11
- * A customizable dotted line component.
12
- * Supports gradient for gradient effects on the dots and smooth data transitions via AnimatedPath.
13
- */
14
- export const DottedLine = /*#__PURE__*/memo(_ref => {
15
- var _transitions$update;
16
- let {
17
- fill = 'none',
18
- stroke,
19
- dashIntervals = [0, 4],
20
- strokeCap = 'round',
21
- strokeJoin = 'round',
22
- strokeOpacity = 1,
23
- strokeWidth = 2,
24
- gradient,
25
- xAxisId,
26
- yAxisId,
27
- d,
28
- animate,
29
- transitions,
30
- transition
31
- } = _ref,
32
- props = _objectWithoutPropertiesLoose(_ref, _excluded);
33
- const theme = useTheme();
34
- return /*#__PURE__*/_jsxs(Path, _extends({
35
- animate: animate,
36
- clipOffset: strokeWidth,
37
- d: d,
38
- fill: fill,
39
- stroke: stroke != null ? stroke : theme.color.fgPrimary,
40
- strokeCap: strokeCap,
41
- strokeJoin: strokeJoin,
42
- strokeOpacity: strokeOpacity,
43
- strokeWidth: strokeWidth,
44
- transition: transition,
45
- transitions: transitions
46
- }, props, {
47
- children: [/*#__PURE__*/_jsx(DashPathEffect, {
48
- intervals: dashIntervals
49
- }), gradient && /*#__PURE__*/_jsx(Gradient, {
50
- animate: animate,
51
- gradient: gradient,
52
- transition: (_transitions$update = transitions == null ? void 0 : transitions.update) != null ? _transitions$update : transition,
53
- xAxisId: xAxisId,
54
- yAxisId: yAxisId
55
- })]
56
- }));
57
- });