@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,256 +0,0 @@
1
- const _excluded = ["axisId", "position", "showGrid", "requestedTickCount", "ticks", "tickLabelFormatter", "TickLabelComponent", "GridLineComponent", "LineComponent", "TickMarkLineComponent", "tickMarkLabelGap", "minTickLabelGap", "showTickMarks", "showLine", "tickMarkSize", "tickInterval", "tickMinStep", "tickMaxStep", "label", "labelGap", "height", "bandGridLinePlacement", "bandTickMarkPlacement"];
2
- 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; }
3
- import { memo, useCallback, useEffect, useId, useMemo } from 'react';
4
- import { useTheme } from '@coinbase/cds-mobile/hooks/useTheme';
5
- import { Group } from '@shopify/react-native-skia';
6
- import { useCartesianChartContext } from '../ChartProvider';
7
- import { DottedLine } from '../line/DottedLine';
8
- import { SolidLine } from '../line/SolidLine';
9
- import { ChartText } from '../text/ChartText';
10
- import { ChartTextGroup } from '../text/ChartTextGroup';
11
- import { getAxisTicksData, getPointOnScale, isCategoricalScale, lineToPath, toPointAnchor } from '../utils';
12
- import { DefaultAxisTickLabel } from './DefaultAxisTickLabel';
13
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
14
- const AXIS_HEIGHT = 32;
15
- const LABEL_SIZE = 20;
16
- export const XAxis = /*#__PURE__*/memo(_ref => {
17
- let {
18
- axisId,
19
- position = 'bottom',
20
- showGrid,
21
- requestedTickCount,
22
- ticks,
23
- tickLabelFormatter,
24
- TickLabelComponent = DefaultAxisTickLabel,
25
- GridLineComponent = DottedLine,
26
- LineComponent = SolidLine,
27
- TickMarkLineComponent = SolidLine,
28
- tickMarkLabelGap = 2,
29
- minTickLabelGap = 4,
30
- showTickMarks,
31
- showLine,
32
- tickMarkSize = 4,
33
- tickInterval = 32,
34
- tickMinStep = 1,
35
- tickMaxStep,
36
- label,
37
- labelGap = 4,
38
- height = label ? AXIS_HEIGHT + LABEL_SIZE : AXIS_HEIGHT,
39
- bandGridLinePlacement = 'edges',
40
- bandTickMarkPlacement = 'middle'
41
- } = _ref,
42
- props = _objectWithoutPropertiesLoose(_ref, _excluded);
43
- const theme = useTheme();
44
- const registrationId = useId();
45
- const {
46
- animate,
47
- drawingArea,
48
- layout,
49
- getXScale,
50
- getXAxis,
51
- registerAxis,
52
- unregisterAxis,
53
- getAxisBounds
54
- } = useCartesianChartContext();
55
- const xScale = getXScale(axisId);
56
- const xAxis = getXAxis(axisId);
57
- const axisBounds = getAxisBounds(registrationId);
58
- useEffect(() => {
59
- registerAxis(registrationId, position, height);
60
- return () => unregisterAxis(registrationId);
61
- }, [registrationId, registerAxis, unregisterAxis, position, height]);
62
- const formatTick = useCallback(value => {
63
- var _tickLabelFormatter;
64
- // If we have string labels and no custom formatter, use the labels
65
- const axisData = xAxis == null ? void 0 : xAxis.data;
66
- const hasStringLabels = axisData && Array.isArray(axisData) && typeof axisData[0] === 'string';
67
- if (hasStringLabels && !tickLabelFormatter && axisData[value] !== undefined) {
68
- return axisData[value];
69
- }
70
-
71
- // Otherwise passes raw index to formatter
72
- return (_tickLabelFormatter = tickLabelFormatter == null ? void 0 : tickLabelFormatter(value)) != null ? _tickLabelFormatter : value;
73
- }, [xAxis == null ? void 0 : xAxis.data, tickLabelFormatter]);
74
- const ticksData = useMemo(() => {
75
- if (!xScale) return [];
76
-
77
- // Check if we have string labels
78
- const axisData = xAxis == null ? void 0 : xAxis.data;
79
- const hasStringLabels = axisData && Array.isArray(axisData) && typeof axisData[0] === 'string';
80
-
81
- // For band scales, we need categories
82
- let categories;
83
- if (hasStringLabels) {
84
- categories = axisData;
85
- } else if (isCategoricalScale(xScale)) {
86
- // For band scales without explicit string data, generate numeric categories
87
- // based on the domain of the scale
88
- const domain = xScale.domain();
89
- categories = domain.map(String);
90
- }
91
- return getAxisTicksData({
92
- scaleFunction: xScale,
93
- ticks,
94
- requestedTickCount: requestedTickCount != null ? requestedTickCount : layout === 'horizontal' ? 5 : undefined,
95
- categories,
96
- possibleTickValues: axisData && Array.isArray(axisData) && typeof axisData[0] === 'string' ? Array.from({
97
- length: axisData.length
98
- }, (_, i) => i) : undefined,
99
- tickInterval: tickInterval,
100
- options: {
101
- minStep: tickMinStep,
102
- maxStep: tickMaxStep
103
- }
104
- });
105
- }, [ticks, xScale, requestedTickCount, tickInterval, tickMinStep, tickMaxStep, xAxis == null ? void 0 : xAxis.data, layout]);
106
- const isBandScale = useMemo(() => {
107
- if (!xScale) return false;
108
- return isCategoricalScale(xScale);
109
- }, [xScale]);
110
-
111
- // Compute grid line positions (including bounds closing line for band scales)
112
- const gridLinePositions = useMemo(() => {
113
- if (!xScale) return [];
114
- return ticksData.flatMap((tick, index) => {
115
- if (!isBandScale) {
116
- return [{
117
- x: tick.position,
118
- key: "grid-" + tick.tick + "-" + index
119
- }];
120
- }
121
- const bandScale = xScale;
122
- const isLastTick = index === ticksData.length - 1;
123
- const isEdges = bandGridLinePlacement === 'edges';
124
- const startX = getPointOnScale(tick.tick, bandScale, toPointAnchor(bandGridLinePlacement));
125
- const positions = [{
126
- x: startX,
127
- key: "grid-" + tick.tick + "-" + index
128
- }];
129
-
130
- // For edges on last tick, add the closing line at stepEnd
131
- if (isLastTick && isEdges) {
132
- const endX = getPointOnScale(tick.tick, bandScale, 'stepEnd');
133
- positions.push({
134
- x: endX,
135
- key: "grid-" + tick.tick + "-" + index + "-end"
136
- });
137
- }
138
- return positions;
139
- });
140
- }, [ticksData, xScale, isBandScale, bandGridLinePlacement]);
141
-
142
- // Compute tick mark positions (including bounds closing tick for band scales)
143
- const tickMarkPositions = useMemo(() => {
144
- if (!xScale) return [];
145
- return ticksData.flatMap((tick, index) => {
146
- if (!isBandScale) {
147
- return [{
148
- x: tick.position,
149
- key: "tick-mark-" + tick.tick + "-" + index
150
- }];
151
- }
152
- const bandScale = xScale;
153
- const isLastTick = index === ticksData.length - 1;
154
- const isEdges = bandTickMarkPlacement === 'edges';
155
- const startX = getPointOnScale(tick.tick, bandScale, toPointAnchor(bandTickMarkPlacement));
156
- const positions = [{
157
- x: startX,
158
- key: "tick-mark-" + tick.tick + "-" + index
159
- }];
160
-
161
- // For edges on last tick, add the closing tick mark at stepEnd
162
- if (isLastTick && isEdges) {
163
- const endX = getPointOnScale(tick.tick, bandScale, 'stepEnd');
164
- positions.push({
165
- x: endX,
166
- key: "tick-mark-" + tick.tick + "-" + index + "-end"
167
- });
168
- }
169
- return positions;
170
- });
171
- }, [ticksData, xScale, isBandScale, bandTickMarkPlacement]);
172
- const chartTextData = useMemo(() => {
173
- if (!axisBounds) return null;
174
- return ticksData.map(tick => {
175
- const tickOffset = tickMarkLabelGap + (showTickMarks ? tickMarkSize : 0);
176
-
177
- // Use AXIS_HEIGHT for centering, not full axisBounds.height
178
- // This ensures tick labels are centered in the axis area, not including label space
179
- const availableSpace = AXIS_HEIGHT - tickOffset;
180
- const labelOffset = availableSpace / 2;
181
- const labelY = position === 'top' ? axisBounds.y + axisBounds.height - tickOffset - labelOffset : axisBounds.y + labelOffset + tickOffset;
182
- return {
183
- x: tick.position,
184
- y: labelY,
185
- label: String(formatTick(tick.tick)),
186
- chartTextProps: {
187
- color: theme.color.fgMuted,
188
- verticalAlignment: 'middle',
189
- horizontalAlignment: 'center'
190
- }
191
- };
192
- });
193
- }, [axisBounds, ticksData, theme.color.fgMuted, tickMarkLabelGap, showTickMarks, tickMarkSize, position, formatTick]);
194
- if (!xScale || !axisBounds) return;
195
- const labelX = axisBounds.x + axisBounds.width / 2;
196
- const labelY = position === 'bottom' ? axisBounds.y + axisBounds.height - LABEL_SIZE / 2 : axisBounds.y + LABEL_SIZE / 2;
197
-
198
- // Pre-compute tick mark Y coordinates
199
- const tickYTop = axisBounds.y;
200
- const tickYBottom = axisBounds.y + axisBounds.height;
201
- const tickYStart = position === 'bottom' ? tickYTop : tickYBottom;
202
- const tickYEnd = position === 'bottom' ? tickYTop + tickMarkSize : tickYBottom - tickMarkSize;
203
-
204
- // Note: Unlike web, mobile renders grid lines and tick marks immediately without fade animation.
205
- // This is because Skia can measure text dimensions synchronously, so there's no need to hide
206
- // elements while waiting for measurements (web uses async ResizeObserver).
207
- return /*#__PURE__*/_jsxs(Group, {
208
- children: [showGrid && /*#__PURE__*/_jsx(Group, {
209
- children: gridLinePositions.map(_ref2 => {
210
- let {
211
- x,
212
- key
213
- } = _ref2;
214
- return /*#__PURE__*/_jsx(GridLineComponent, {
215
- animate: false,
216
- clipPath: null,
217
- d: lineToPath(x, drawingArea.y, x, drawingArea.y + drawingArea.height),
218
- stroke: theme.color.bgLine
219
- }, key);
220
- })
221
- }), chartTextData && /*#__PURE__*/_jsx(ChartTextGroup, {
222
- prioritizeEndLabels: true,
223
- LabelComponent: TickLabelComponent,
224
- labels: chartTextData,
225
- minGap: minTickLabelGap
226
- }), axisBounds && showTickMarks && /*#__PURE__*/_jsx(Group, {
227
- children: tickMarkPositions.map(_ref3 => {
228
- let {
229
- x,
230
- key
231
- } = _ref3;
232
- return /*#__PURE__*/_jsx(TickMarkLineComponent, {
233
- animate: false,
234
- clipPath: null,
235
- d: lineToPath(x, tickYStart, x, tickYEnd),
236
- stroke: theme.color.fg,
237
- strokeCap: "square",
238
- strokeWidth: 1
239
- }, key);
240
- })
241
- }), showLine && /*#__PURE__*/_jsx(LineComponent, {
242
- animate: false,
243
- clipPath: null,
244
- d: lineToPath(axisBounds.x, position === 'bottom' ? axisBounds.y : axisBounds.y + axisBounds.height, axisBounds.x + axisBounds.width, position === 'bottom' ? axisBounds.y : axisBounds.y + axisBounds.height),
245
- stroke: theme.color.fg,
246
- strokeCap: "square",
247
- strokeWidth: 1
248
- }), label && /*#__PURE__*/_jsx(ChartText, {
249
- horizontalAlignment: "center",
250
- verticalAlignment: "middle",
251
- x: labelX,
252
- y: labelY,
253
- children: label
254
- })]
255
- });
256
- });
@@ -1,255 +0,0 @@
1
- const _excluded = ["axisId", "position", "showGrid", "requestedTickCount", "ticks", "tickLabelFormatter", "TickLabelComponent", "GridLineComponent", "LineComponent", "TickMarkLineComponent", "tickMarkLabelGap", "minTickLabelGap", "showTickMarks", "showLine", "tickMarkSize", "tickInterval", "label", "labelGap", "width", "bandGridLinePlacement", "bandTickMarkPlacement"];
2
- 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; }
3
- import { memo, useCallback, useEffect, useId, useMemo } from 'react';
4
- import { useTheme } from '@coinbase/cds-mobile/hooks/useTheme';
5
- import { Group, vec } from '@shopify/react-native-skia';
6
- import { useCartesianChartContext } from '../ChartProvider';
7
- import { DottedLine } from '../line/DottedLine';
8
- import { SolidLine } from '../line/SolidLine';
9
- import { ChartText } from '../text/ChartText';
10
- import { ChartTextGroup } from '../text/ChartTextGroup';
11
- import { getAxisTicksData, getPointOnScale, isCategoricalScale, lineToPath, toPointAnchor } from '../utils';
12
- import { DefaultAxisTickLabel } from './DefaultAxisTickLabel';
13
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
14
- const AXIS_WIDTH = 44;
15
- const LABEL_SIZE = 20;
16
- export const YAxis = /*#__PURE__*/memo(_ref => {
17
- let {
18
- axisId,
19
- position = 'right',
20
- showGrid,
21
- requestedTickCount,
22
- ticks,
23
- tickLabelFormatter,
24
- TickLabelComponent = DefaultAxisTickLabel,
25
- GridLineComponent = DottedLine,
26
- LineComponent = SolidLine,
27
- TickMarkLineComponent = SolidLine,
28
- tickMarkLabelGap = 8,
29
- minTickLabelGap = 0,
30
- showTickMarks,
31
- showLine,
32
- tickMarkSize = 4,
33
- tickInterval,
34
- label,
35
- labelGap = 4,
36
- width = label ? AXIS_WIDTH + LABEL_SIZE : AXIS_WIDTH,
37
- bandGridLinePlacement = 'edges',
38
- bandTickMarkPlacement = 'middle'
39
- } = _ref,
40
- props = _objectWithoutPropertiesLoose(_ref, _excluded);
41
- const theme = useTheme();
42
- const registrationId = useId();
43
- const {
44
- animate,
45
- drawingArea,
46
- layout,
47
- getYScale,
48
- getYAxis,
49
- registerAxis,
50
- unregisterAxis,
51
- getAxisBounds
52
- } = useCartesianChartContext();
53
- const yScale = getYScale(axisId);
54
- const yAxis = getYAxis(axisId);
55
- const axisBounds = getAxisBounds(registrationId);
56
- useEffect(() => {
57
- registerAxis(registrationId, position, width);
58
- return () => unregisterAxis(registrationId);
59
- }, [registrationId, registerAxis, unregisterAxis, position, width]);
60
- const formatTick = useCallback(value => {
61
- var _tickLabelFormatter;
62
- // If we have string labels and no custom formatter, use the labels
63
- const axisData = yAxis == null ? void 0 : yAxis.data;
64
- const hasStringLabels = axisData && Array.isArray(axisData) && typeof axisData[0] === 'string';
65
- if (hasStringLabels && !tickLabelFormatter && axisData[value] !== undefined) {
66
- // Use the string label from the data array
67
- return axisData[value];
68
- }
69
-
70
- // Otherwise use the formatter (if provided) or the value itself
71
- return (_tickLabelFormatter = tickLabelFormatter == null ? void 0 : tickLabelFormatter(value)) != null ? _tickLabelFormatter : value;
72
- }, [yAxis == null ? void 0 : yAxis.data, tickLabelFormatter]);
73
-
74
- // Use D3 to get the ticks data
75
- // Result contains each tick value and its axis position
76
- const ticksData = useMemo(() => {
77
- if (!yScale) return [];
78
-
79
- // Check if we have string labels
80
- const axisData = yAxis == null ? void 0 : yAxis.data;
81
- const hasStringLabels = axisData && Array.isArray(axisData) && typeof axisData[0] === 'string';
82
-
83
- // For band scales, we need categories
84
- let categories;
85
- if (hasStringLabels) {
86
- categories = axisData;
87
- } else if (isCategoricalScale(yScale)) {
88
- // For band scales without explicit string data, generate numeric categories
89
- // based on the domain of the scale
90
- const domain = yScale.domain();
91
- categories = domain.map(String);
92
- }
93
-
94
- // For numeric data or no explicit data, use default tick generation
95
- return getAxisTicksData({
96
- scaleFunction: yScale,
97
- ticks,
98
- requestedTickCount: tickInterval !== undefined ? undefined : requestedTickCount != null ? requestedTickCount : layout === 'horizontal' ? undefined : 5,
99
- categories,
100
- possibleTickValues: axisData && Array.isArray(axisData) && typeof axisData[0] === 'number' ? axisData : undefined,
101
- tickInterval: tickInterval
102
- });
103
- }, [ticks, yScale, requestedTickCount, tickInterval, yAxis == null ? void 0 : yAxis.data, layout]);
104
- const isBandScale = useMemo(() => {
105
- if (!yScale) return false;
106
- return isCategoricalScale(yScale);
107
- }, [yScale]);
108
-
109
- // Compute grid line positions (including bounds closing line for band scales)
110
- const gridLinePositions = useMemo(() => {
111
- if (!yScale) return [];
112
- return ticksData.flatMap((tick, index) => {
113
- if (!isBandScale) {
114
- return [{
115
- y: tick.position,
116
- key: "grid-" + tick.tick + "-" + index
117
- }];
118
- }
119
- const bandScale = yScale;
120
- const isLastTick = index === ticksData.length - 1;
121
- const isEdges = bandGridLinePlacement === 'edges';
122
- const startY = getPointOnScale(tick.tick, bandScale, toPointAnchor(bandGridLinePlacement));
123
- const positions = [{
124
- y: startY,
125
- key: "grid-" + tick.tick + "-" + index
126
- }];
127
-
128
- // For edges on last tick, add the closing line at stepEnd
129
- if (isLastTick && isEdges) {
130
- const endY = getPointOnScale(tick.tick, bandScale, 'stepEnd');
131
- positions.push({
132
- y: endY,
133
- key: "grid-" + tick.tick + "-" + index + "-end"
134
- });
135
- }
136
- return positions;
137
- });
138
- }, [ticksData, yScale, isBandScale, bandGridLinePlacement]);
139
-
140
- // Compute tick mark positions (including bounds closing tick for band scales)
141
- const tickMarkPositions = useMemo(() => {
142
- if (!yScale) return [];
143
- return ticksData.flatMap((tick, index) => {
144
- if (!isBandScale) {
145
- return [{
146
- y: tick.position,
147
- key: "tick-mark-" + tick.tick + "-" + index
148
- }];
149
- }
150
- const bandScale = yScale;
151
- const isLastTick = index === ticksData.length - 1;
152
- const isEdges = bandTickMarkPlacement === 'edges';
153
- const startY = getPointOnScale(tick.tick, bandScale, toPointAnchor(bandTickMarkPlacement));
154
- const positions = [{
155
- y: startY,
156
- key: "tick-mark-" + tick.tick + "-" + index
157
- }];
158
-
159
- // For edges on last tick, add the closing tick mark at stepEnd
160
- if (isLastTick && isEdges) {
161
- const endY = getPointOnScale(tick.tick, bandScale, 'stepEnd');
162
- positions.push({
163
- y: endY,
164
- key: "tick-mark-" + tick.tick + "-" + index + "-end"
165
- });
166
- }
167
- return positions;
168
- });
169
- }, [ticksData, yScale, isBandScale, bandTickMarkPlacement]);
170
- const chartTextData = useMemo(() => {
171
- if (!axisBounds) return null;
172
- return ticksData.map(tick => {
173
- const tickOffset = tickMarkLabelGap + (showTickMarks ? tickMarkSize : 0);
174
- const labelX = position === 'left' ? axisBounds.x + axisBounds.width - tickOffset : axisBounds.x + tickOffset;
175
- return {
176
- x: labelX,
177
- y: tick.position,
178
- label: String(formatTick(tick.tick)),
179
- chartTextProps: {
180
- color: theme.color.fgMuted,
181
- verticalAlignment: 'middle',
182
- horizontalAlignment: position === 'left' ? 'right' : 'left'
183
- }
184
- };
185
- });
186
- }, [axisBounds, ticksData, tickMarkLabelGap, showTickMarks, tickMarkSize, position, formatTick, theme.color.fgMuted]);
187
- if (!yScale || !axisBounds) return;
188
- const labelX = position === 'left' ? axisBounds.x + LABEL_SIZE / 2 : axisBounds.x + axisBounds.width - LABEL_SIZE / 2;
189
- const labelY = axisBounds.y + axisBounds.height / 2;
190
-
191
- // Pre-compute tick mark X coordinates
192
- const tickXLeft = axisBounds.x;
193
- const tickXRight = axisBounds.x + axisBounds.width;
194
- const tickXStart = position === 'left' ? tickXRight : tickXLeft;
195
- const tickXEnd = position === 'left' ? tickXRight - tickMarkSize : tickXLeft + tickMarkSize;
196
-
197
- // Note: Unlike web, mobile renders grid lines and tick marks immediately without fade animation.
198
- // This is because Skia can measure text dimensions synchronously, so there's no need to hide
199
- // elements while waiting for measurements (web uses async ResizeObserver).
200
- return /*#__PURE__*/_jsxs(Group, {
201
- children: [showGrid && /*#__PURE__*/_jsx(Group, {
202
- children: gridLinePositions.map(_ref2 => {
203
- let {
204
- y,
205
- key
206
- } = _ref2;
207
- return /*#__PURE__*/_jsx(GridLineComponent, {
208
- animate: false,
209
- clipPath: null,
210
- d: lineToPath(drawingArea.x, y, drawingArea.x + drawingArea.width, y),
211
- stroke: theme.color.bgLine
212
- }, key);
213
- })
214
- }), chartTextData && /*#__PURE__*/_jsx(ChartTextGroup, {
215
- prioritizeEndLabels: true,
216
- LabelComponent: TickLabelComponent,
217
- labels: chartTextData,
218
- minGap: minTickLabelGap
219
- }), axisBounds && showTickMarks && /*#__PURE__*/_jsx(Group, {
220
- children: tickMarkPositions.map(_ref3 => {
221
- let {
222
- y,
223
- key
224
- } = _ref3;
225
- return /*#__PURE__*/_jsx(TickMarkLineComponent, {
226
- animate: false,
227
- clipPath: null,
228
- d: lineToPath(tickXStart, y, tickXEnd, y),
229
- stroke: theme.color.fg,
230
- strokeCap: "square",
231
- strokeWidth: 1
232
- }, key);
233
- })
234
- }), showLine && /*#__PURE__*/_jsx(LineComponent, {
235
- animate: false,
236
- clipPath: null,
237
- d: lineToPath(position === 'left' ? axisBounds.x + axisBounds.width : axisBounds.x, axisBounds.y, position === 'left' ? axisBounds.x + axisBounds.width : axisBounds.x, axisBounds.y + axisBounds.height),
238
- stroke: theme.color.fg,
239
- strokeCap: "square",
240
- strokeWidth: 1
241
- }), label && /*#__PURE__*/_jsx(Group, {
242
- origin: vec(labelX, labelY),
243
- transform: [{
244
- rotate: position === 'left' ? -Math.PI / 2 : Math.PI / 2
245
- }],
246
- children: /*#__PURE__*/_jsx(ChartText, {
247
- horizontalAlignment: "center",
248
- verticalAlignment: "middle",
249
- x: labelX,
250
- y: labelY,
251
- children: label
252
- })
253
- })]
254
- });
255
- });