@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,1417 +0,0 @@
1
- const _excluded = ["children"],
2
- _excluded2 = ["animate"],
3
- _excluded3 = ["x", "y", "width", "height", "dataX"],
4
- _excluded4 = ["data", "height"],
5
- _excluded5 = ["buy", "sell", "animate", "borderRadius", "height", "inset", "layout", "stackGap", "xAxis", "yAxis", "barMinSize"];
6
- 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; }
7
- 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); }
8
- import { memo, useCallback, useEffect, useId, useMemo, useState } from 'react';
9
- import { useDerivedValue } from 'react-native-reanimated';
10
- import { assets } from '@coinbase/cds-common/internal/data/assets';
11
- import { candles as btcCandles } from '@coinbase/cds-common/internal/data/candles';
12
- import { Button, IconButton } from '@coinbase/cds-mobile/buttons';
13
- import { ExampleScreen } from '@coinbase/cds-mobile/examples/ExampleScreen';
14
- import { useTheme } from '@coinbase/cds-mobile/hooks/useTheme';
15
- import { Box, HStack, VStack } from '@coinbase/cds-mobile/layout';
16
- import { Text } from '@coinbase/cds-mobile/typography';
17
- import { Line as SkiaLine, Rect } from '@shopify/react-native-skia';
18
- import { XAxis, YAxis } from '../../axis';
19
- import { CartesianChart } from '../../CartesianChart';
20
- import { useCartesianChartContext } from '../../ChartProvider';
21
- import { DefaultLegendEntry } from '../../legend';
22
- import { ReferenceLine, SolidLine } from '../../line';
23
- import { Scrubber } from '../../scrubber';
24
- import { getPointOnSerializableScale, unwrapAnimatedValue, useScrubberContext } from '../../utils';
25
- import { Bar } from '../Bar';
26
- import { BarChart } from '../BarChart';
27
- import { BarPlot } from '../BarPlot';
28
- import { DefaultBarStack } from '../DefaultBarStack';
29
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
30
- const ThinSolidLine = /*#__PURE__*/memo(props => /*#__PURE__*/_jsx(SolidLine, _extends({}, props, {
31
- strokeWidth: 1
32
- })));
33
- const defaultChartHeight = 250;
34
- const baselineThresholdData = [40, 28, 21, 5, 48, 5, 28, 2, 29, 48, 18, 30, 29, 8].map(value => value + 50);
35
- const PositiveAndNegativeCashFlow = () => {
36
- const theme = useTheme();
37
- const categories = Array.from({
38
- length: 31
39
- }, (_, i) => "3/" + (i + 1));
40
- const gains = [5, 0, 6, 18, 0, 5, 12, 0, 12, 22, 28, 18, 0, 12, 6, 0, 0, 24, 0, 0, 4, 0, 18, 0, 0, 14, 10, 16, 0, 0, 0];
41
- const losses = [-4, 0, -8, -12, -6, 0, 0, 0, -18, 0, -12, 0, -9, -6, 0, 0, 0, 0, -22, -8, 0, 0, -10, -14, 0, 0, 0, 0, 0, -12, -10];
42
- const series = [{
43
- id: 'gains',
44
- data: gains,
45
- color: theme.color.fgPositive,
46
- stackId: 'bars'
47
- }, {
48
- id: 'losses',
49
- data: losses,
50
- color: theme.color.fgNegative,
51
- stackId: 'bars'
52
- }];
53
- return /*#__PURE__*/_jsxs(CartesianChart, {
54
- height: 420,
55
- inset: 32,
56
- series: series,
57
- xAxis: {
58
- data: categories,
59
- scaleType: 'band'
60
- },
61
- children: [/*#__PURE__*/_jsx(XAxis, {}), /*#__PURE__*/_jsx(YAxis, {
62
- showGrid: true,
63
- GridLineComponent: ThinSolidLine,
64
- tickLabelFormatter: value => "$" + value + "M"
65
- }), /*#__PURE__*/_jsx(BarPlot, {}), /*#__PURE__*/_jsx(ReferenceLine, {
66
- LineComponent: SolidLine,
67
- dataY: 0
68
- })]
69
- });
70
- };
71
- const FiatAndStablecoinBalance = () => {
72
- const theme = useTheme();
73
- const categories = Array.from({
74
- length: 31
75
- }, (_, i) => "3/" + (i + 1));
76
- const usd = [20, 20, 20, 20, 20, 40, 60, 60, 80, 120, 200, 240, 240, 240, 240, 240, 240, 240, 240, 60, 30, 20, 25, 5, 0, 0, 0, 0, 80, 120, 150];
77
- const usdc = [0, 0, 0, 0, 0, 0, 0, 0, 0, 60, 260, 260, 240, 220, 180, 160, 200, 240, 220, 0, 0, 0, 0, 0, 0, 250, 250, 250, 250, 250, 250];
78
- const brl = [0, 0, 0, 0, 0, 0, 0, 20, 40, 100, 60, 60, 60, 0, 0, 0, 0, 0, 0, 160, 40, 80, 140, 180, 120, 0, 0, 0, 30, 30, 40];
79
- const series = [{
80
- id: 'BRL',
81
- data: brl,
82
- color: theme.color.accentBoldGreen
83
- }, {
84
- id: 'USDC',
85
- data: usdc,
86
- color: theme.color.accentBoldBlue
87
- }, {
88
- id: 'USD',
89
- data: usd,
90
- color: '#5b6cff'
91
- }];
92
- return /*#__PURE__*/_jsx(BarChart, {
93
- showXAxis: true,
94
- stacked: true,
95
- barMinSize: 8,
96
- height: 420,
97
- inset: 32,
98
- series: series,
99
- stackGap: 2,
100
- stackMinSize: 16,
101
- xAxis: {
102
- data: categories
103
- }
104
- });
105
- };
106
- const CustomBarStackComponent = /*#__PURE__*/memo(_ref => {
107
- let {
108
- children
109
- } = _ref,
110
- props = _objectWithoutPropertiesLoose(_ref, _excluded);
111
- const theme = useTheme();
112
- if (props.height === 0) {
113
- const diameter = props.width;
114
- return /*#__PURE__*/_jsx(Bar, {
115
- roundBottom: true,
116
- roundTop: true,
117
- borderRadius: 1000,
118
- fill: theme.color.bgTertiary,
119
- height: diameter,
120
- origin: props.y,
121
- width: diameter,
122
- x: props.x,
123
- y: props.y - diameter
124
- });
125
- }
126
- return /*#__PURE__*/_jsx(DefaultBarStack, _extends({}, props, {
127
- children: children
128
- }));
129
- });
130
- const MonthlyRewards = () => {
131
- const theme = useTheme();
132
- const months = ['J', 'F', 'M', 'A', 'M', 'J', 'J', 'A', 'S', 'O', 'N', 'D'];
133
- const purple = [null, 6, 8, 10, 7, 6, 6, 8, null, null, null, null];
134
- const blue = [null, 10, 12, 11, 10, 9, 10, 11, null, null, null, null];
135
- const cyan = [null, 7, 10, 12, 11, 10, 8, 11, null, null, null, null];
136
- const green = [10, null, null, null, 1, null, null, 6, null, null, null, null];
137
- const [roundBaseline, setRoundBaseline] = useState(true);
138
- const series = [{
139
- id: 'purple',
140
- data: purple,
141
- color: "rgb(" + theme.spectrum.purple30 + ")"
142
- }, {
143
- id: 'blue',
144
- data: blue,
145
- color: "rgb(" + theme.spectrum.blue30 + ")"
146
- }, {
147
- id: 'cyan',
148
- data: cyan,
149
- color: "rgb(" + theme.spectrum.teal30 + ")"
150
- }, {
151
- id: 'green',
152
- data: green,
153
- color: "rgb(" + theme.spectrum.green30 + ")"
154
- }];
155
- return /*#__PURE__*/_jsxs(VStack, {
156
- gap: 2,
157
- children: [/*#__PURE__*/_jsx(BarChart, {
158
- showXAxis: true,
159
- stacked: true,
160
- BarStackComponent: CustomBarStackComponent,
161
- borderRadius: 1000,
162
- height: 300,
163
- inset: 0,
164
- roundBaseline: roundBaseline,
165
- series: series,
166
- showYAxis: false,
167
- stackMinSize: 24,
168
- xAxis: {
169
- tickLabelFormatter: index => {
170
- return months[index];
171
- },
172
- categoryPadding: 0.25
173
- }
174
- }), /*#__PURE__*/_jsx(Button, {
175
- onPress: () => setRoundBaseline(!roundBaseline),
176
- children: "Toggle Round Baseline"
177
- })]
178
- });
179
- };
180
- const MultipleYAxes = () => {
181
- const theme = useTheme();
182
- return /*#__PURE__*/_jsxs(CartesianChart, {
183
- height: defaultChartHeight,
184
- series: [{
185
- id: 'revenue',
186
- data: [455, 520, 380, 455, 190, 235],
187
- yAxisId: 'revenue',
188
- color: theme.color.accentBoldYellow
189
- }, {
190
- id: 'profit',
191
- data: [23, 15, 30, 56, 4, 12],
192
- yAxisId: 'profit',
193
- color: theme.color.fgPositive
194
- }],
195
- xAxis: {
196
- data: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun'],
197
- scaleType: 'band'
198
- },
199
- yAxis: [{
200
- id: 'revenue'
201
- }, {
202
- id: 'profit'
203
- }],
204
- children: [/*#__PURE__*/_jsx(XAxis, {
205
- showLine: true,
206
- showTickMarks: true,
207
- label: "Month"
208
- }), /*#__PURE__*/_jsx(YAxis, {
209
- showGrid: true,
210
- showLine: true,
211
- showTickMarks: true,
212
- axisId: "revenue",
213
- label: "Revenue",
214
- position: "left",
215
- requestedTickCount: 5,
216
- tickLabelFormatter: value => "$" + value + "k",
217
- width: 80
218
- }), /*#__PURE__*/_jsx(YAxis, {
219
- showLine: true,
220
- showTickMarks: true,
221
- axisId: "profit",
222
- label: "Profit",
223
- requestedTickCount: 5,
224
- tickLabelFormatter: value => "$" + value + "k",
225
- width: 70
226
- }), /*#__PURE__*/_jsx(BarPlot, {})]
227
- });
228
- };
229
- const initialData = [45, 52, 38, 45, 19, 23, 32];
230
- const MyCustomLine = /*#__PURE__*/memo(_ref2 => {
231
- let props = _objectWithoutPropertiesLoose(_ref2, _excluded2);
232
- return /*#__PURE__*/_jsx(SolidLine, _extends({}, props));
233
- });
234
- const UpdatingChartValues = () => {
235
- const [data, setData] = useState(initialData);
236
- return /*#__PURE__*/_jsxs(VStack, {
237
- gap: 2,
238
- children: [/*#__PURE__*/_jsx(BarChart, {
239
- height: 100,
240
- series: [{
241
- id: 'weekly-data',
242
- data: data
243
- }],
244
- xAxis: {
245
- data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
246
- showTickMarks: true,
247
- showLine: true
248
- },
249
- yAxis: {
250
- requestedTickCount: 5,
251
- tickLabelFormatter: value => "$" + value + "k",
252
- showGrid: true,
253
- showTickMarks: true,
254
- showLine: true,
255
- tickMarkSize: 12,
256
- domain: {
257
- max: 250
258
- }
259
- }
260
- }), /*#__PURE__*/_jsx(BarChart, {
261
- height: 100,
262
- series: [{
263
- id: 'weekly-data',
264
- data: data
265
- }],
266
- transition: {
267
- type: 'timing',
268
- duration: 300
269
- },
270
- xAxis: {
271
- data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
272
- showTickMarks: true,
273
- showLine: true
274
- },
275
- yAxis: {
276
- requestedTickCount: 5,
277
- tickLabelFormatter: value => "$" + value + "k",
278
- showGrid: true,
279
- showTickMarks: true,
280
- showLine: true,
281
- tickMarkSize: 12,
282
- domain: {
283
- max: 250
284
- }
285
- }
286
- }), /*#__PURE__*/_jsx(BarChart, {
287
- height: 100,
288
- series: [{
289
- id: 'weekly-data',
290
- data: data.map((d, i) => i % 2 === 0 ? d : -d)
291
- }],
292
- xAxis: {
293
- data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
294
- showTickMarks: true,
295
- showLine: true
296
- },
297
- yAxis: {
298
- requestedTickCount: 5,
299
- tickLabelFormatter: value => "$" + value + "k",
300
- showGrid: true,
301
- showTickMarks: true,
302
- showLine: true,
303
- tickMarkSize: 12,
304
- domain: {
305
- max: 250
306
- }
307
- },
308
- children: /*#__PURE__*/_jsx(ReferenceLine, {
309
- LineComponent: MyCustomLine,
310
- dataY: 0
311
- })
312
- }), /*#__PURE__*/_jsx(Button, {
313
- onPress: () => setData(data => data[0] > 200 ? initialData : data.map(d => d + 50)),
314
- children: "Update Data"
315
- })]
316
- });
317
- };
318
- const AnimatedUpdatingChartValues = () => {
319
- const [data, setData] = useState([45, 52, 38, 45, 19, 23, 32]);
320
- useEffect(() => {
321
- const interval = setInterval(() => {
322
- setData(prevData => prevData.map(value => {
323
- // Generate random change between -15 and +15
324
- const change = Math.floor(Math.random() * 31) - 15;
325
- // Ensure values stay between 10 and 200
326
- return Math.max(10, Math.min(200, value + change));
327
- }));
328
- }, 1000);
329
- return () => clearInterval(interval);
330
- }, []);
331
- return /*#__PURE__*/_jsx(BarChart, {
332
- showXAxis: true,
333
- showYAxis: true,
334
- height: defaultChartHeight,
335
- series: [{
336
- id: 'weekly-data',
337
- data: data
338
- }],
339
- xAxis: {
340
- data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
341
- showTickMarks: true,
342
- showLine: true
343
- },
344
- yAxis: {
345
- requestedTickCount: 5,
346
- tickLabelFormatter: value => "$" + value + "k",
347
- showGrid: true,
348
- showTickMarks: true,
349
- showLine: true,
350
- tickMarkSize: 12,
351
- domain: {
352
- max: 250
353
- }
354
- }
355
- });
356
- };
357
- const NegativeValuesWithTopAxis = () => {
358
- const theme = useTheme();
359
- return /*#__PURE__*/_jsxs(CartesianChart, {
360
- height: defaultChartHeight,
361
- series: [{
362
- id: 'losses',
363
- data: [-45, -52, -38, -45, -19, -23, -32],
364
- color: theme.color.fgNegative
365
- }],
366
- xAxis: {
367
- data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
368
- scaleType: 'band'
369
- },
370
- children: [/*#__PURE__*/_jsx(XAxis, {
371
- showLine: true,
372
- showTickMarks: true,
373
- label: "Day of Week",
374
- position: "top"
375
- }), /*#__PURE__*/_jsx(YAxis, {
376
- showGrid: true,
377
- showLine: true,
378
- showTickMarks: true,
379
- label: "Loss",
380
- requestedTickCount: 5,
381
- tickLabelFormatter: value => "$" + value + "k"
382
- }), /*#__PURE__*/_jsx(BarPlot, {})]
383
- });
384
- };
385
- const tabs = [{
386
- id: 'week',
387
- label: '1W'
388
- }, {
389
- id: 'month',
390
- label: '1M'
391
- }, {
392
- id: 'year',
393
- label: '1Y'
394
- }];
395
- const YAxisContinuousColorMap = () => {
396
- const theme = useTheme();
397
- return /*#__PURE__*/_jsx(BarChart, {
398
- showXAxis: true,
399
- showYAxis: true,
400
- height: defaultChartHeight,
401
- series: [{
402
- id: 'temperature',
403
- data: [12, 25, 38, 52, 45, 30, 18],
404
- // Continuous gradient from blue (cold) to red (hot)
405
- gradient: {
406
- axis: 'y',
407
- stops: _ref3 => {
408
- let {
409
- min,
410
- max
411
- } = _ref3;
412
- return [{
413
- offset: min,
414
- color: theme.color.accentBoldGreen
415
- }, {
416
- offset: (min + max) / 2,
417
- color: theme.color.accentBoldYellow
418
- }, {
419
- offset: max,
420
- color: theme.color.accentBoldRed
421
- }];
422
- }
423
- }
424
- }],
425
- xAxis: {
426
- data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
427
- },
428
- yAxis: {
429
- requestedTickCount: 5,
430
- tickLabelFormatter: value => value + "\xB0C",
431
- showGrid: true
432
- }
433
- });
434
- };
435
- const YAxisDiscreteColorMap = () => {
436
- const theme = useTheme();
437
- return /*#__PURE__*/_jsx(BarChart, {
438
- showXAxis: true,
439
- showYAxis: true,
440
- height: defaultChartHeight,
441
- series: [{
442
- id: 'temperature',
443
- data: [12, 25, 38, 52, 45, 30, 18],
444
- // Hard transitions based on performance thresholds
445
- gradient: {
446
- axis: 'y',
447
- stops: [{
448
- offset: 20,
449
- color: theme.color.accentBoldGreen
450
- }, {
451
- offset: 20,
452
- color: theme.color.accentBoldYellow
453
- }, {
454
- offset: 40,
455
- color: theme.color.accentBoldYellow
456
- }, {
457
- offset: 40,
458
- color: theme.color.accentBoldRed
459
- }, {
460
- offset: 60,
461
- color: theme.color.accentBoldRed
462
- }] // Hard transitions at 20, 40
463
- }
464
- }],
465
- xAxis: {
466
- data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
467
- },
468
- yAxis: {
469
- requestedTickCount: 5,
470
- tickLabelFormatter: value => value + "\xB0C",
471
- showGrid: true
472
- }
473
- });
474
- };
475
- const XAxisContinuousColorMap = () => {
476
- const theme = useTheme();
477
- return /*#__PURE__*/_jsx(BarChart, {
478
- showXAxis: true,
479
- showYAxis: true,
480
- height: defaultChartHeight,
481
- series: [{
482
- id: 'weekly-trend',
483
- data: [45, 52, 38, 45, 48, 50, 55],
484
- // Gradient from left (start of week) to right (end of week)
485
- gradient: {
486
- axis: 'x',
487
- stops: _ref4 => {
488
- let {
489
- min,
490
- max
491
- } = _ref4;
492
- return [{
493
- offset: min,
494
- color: theme.color.accentBoldPurple
495
- }, {
496
- offset: max,
497
- color: theme.color.accentBoldBlue
498
- }];
499
- }
500
- }
501
- }],
502
- xAxis: {
503
- data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
504
- },
505
- yAxis: {
506
- requestedTickCount: 5,
507
- tickLabelFormatter: value => "" + value,
508
- showGrid: true
509
- }
510
- });
511
- };
512
- const XAxisDiscreteColorMap = () => {
513
- const theme = useTheme();
514
- return /*#__PURE__*/_jsx(BarChart, {
515
- showXAxis: true,
516
- showYAxis: true,
517
- height: defaultChartHeight,
518
- series: [{
519
- id: 'weekly-trend',
520
- data: [45, 52, 38, 45, 48, 50, 55],
521
- // Hard color transition from purple to blue at midweek
522
- gradient: {
523
- axis: 'x',
524
- stops: [{
525
- offset: 4,
526
- color: theme.color.accentBoldPurple
527
- },
528
- // First half of week
529
- {
530
- offset: 4,
531
- color: theme.color.accentBoldBlue
532
- } // Second half of week - hard transition at index 4 (Thursday)
533
- ]
534
- }
535
- }],
536
- xAxis: {
537
- data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
538
- },
539
- yAxis: {
540
- requestedTickCount: 5,
541
- tickLabelFormatter: value => "" + value,
542
- showGrid: true
543
- }
544
- });
545
- };
546
- const XAxisMultiSegmentColorMap = () => {
547
- const theme = useTheme();
548
- return /*#__PURE__*/_jsx(BarChart, {
549
- showXAxis: true,
550
- showYAxis: true,
551
- height: defaultChartHeight,
552
- series: [{
553
- id: 'quarters',
554
- data: [120, 135, 142, 128, 145, 158, 162, 155, 168, 175, 182, 190],
555
- // Different color for each quarter
556
- gradient: {
557
- axis: 'x',
558
- stops: [{
559
- offset: 3,
560
- color: theme.color.accentBoldBlue
561
- },
562
- // Q1 (Jan-Mar)
563
- {
564
- offset: 3,
565
- color: theme.color.accentBoldGreen
566
- },
567
- // Q2 (Apr-Jun)
568
- {
569
- offset: 6,
570
- color: theme.color.accentBoldGreen
571
- }, {
572
- offset: 6,
573
- color: theme.color.accentBoldYellow
574
- },
575
- // Q3 (Jul-Sep)
576
- {
577
- offset: 9,
578
- color: theme.color.accentBoldYellow
579
- }, {
580
- offset: 9,
581
- color: theme.color.accentBoldPurple
582
- } // Q4 (Oct-Dec)
583
- ] // Hard transitions at indices 3, 6, 9
584
- }
585
- }],
586
- xAxis: {
587
- data: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
588
- },
589
- yAxis: {
590
- requestedTickCount: 5,
591
- tickLabelFormatter: value => "$" + value + "k",
592
- showGrid: true
593
- }
594
- });
595
- };
596
- const ColorMapWithOpacity = () => {
597
- const theme = useTheme();
598
- return /*#__PURE__*/_jsx(BarChart, {
599
- showXAxis: true,
600
- showYAxis: true,
601
- height: defaultChartHeight,
602
- series: [{
603
- id: 'confidence',
604
- data: [25, 35, 45, 55, 65, 75, 85],
605
- // Gradient with opacity changes
606
- gradient: {
607
- axis: 'y',
608
- stops: _ref5 => {
609
- let {
610
- min,
611
- max
612
- } = _ref5;
613
- return [{
614
- offset: min,
615
- color: theme.color.accentBoldBlue,
616
- opacity: 0
617
- },
618
- // Low values - more transparent
619
- {
620
- offset: max,
621
- color: theme.color.accentBoldBlue,
622
- opacity: 1.0
623
- } // High values - more opaque
624
- ];
625
- }
626
- }
627
- }],
628
- xAxis: {
629
- data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
630
- },
631
- yAxis: {
632
- requestedTickCount: 5,
633
- tickLabelFormatter: value => value + "%",
634
- showGrid: true
635
- }
636
- });
637
- };
638
- const BandGridPositionExample = _ref6 => {
639
- let {
640
- position
641
- } = _ref6;
642
- return /*#__PURE__*/_jsxs(CartesianChart, {
643
- height: 180,
644
- inset: 4,
645
- series: [{
646
- id: 'data',
647
- data: [30, 50, 40, 60, 35]
648
- }],
649
- xAxis: {
650
- scaleType: 'band',
651
- data: ['A', 'B', 'C', 'D', 'E']
652
- },
653
- yAxis: {
654
- domain: {
655
- min: 0
656
- }
657
- },
658
- children: [/*#__PURE__*/_jsx(XAxis, {
659
- showGrid: true,
660
- showLine: true,
661
- bandGridLinePlacement: position,
662
- label: position
663
- }), /*#__PURE__*/_jsx(BarPlot, {})]
664
- });
665
- };
666
-
667
- // --- Composed Examples ---
668
-
669
- const candlestickStockData = [...btcCandles].reverse().slice(0, 90);
670
- const CandlesticksHeader = /*#__PURE__*/memo(_ref7 => {
671
- let {
672
- currentIndex
673
- } = _ref7;
674
- const formatPrice = useCallback(price => {
675
- return new Intl.NumberFormat('en-US', {
676
- style: 'currency',
677
- currency: 'USD'
678
- }).format(parseFloat(price));
679
- }, []);
680
- const formatThousandsPriceNumber = useCallback(price => {
681
- const formattedPrice = new Intl.NumberFormat('en-US', {
682
- style: 'currency',
683
- currency: 'USD',
684
- minimumFractionDigits: 0,
685
- maximumFractionDigits: 0
686
- }).format(price / 1000);
687
- return formattedPrice + "k";
688
- }, []);
689
- const currentText = useMemo(() => {
690
- if (currentIndex !== undefined) {
691
- return "Open: " + formatThousandsPriceNumber(parseFloat(candlestickStockData[currentIndex].open)) + ", Close: " + formatThousandsPriceNumber(parseFloat(candlestickStockData[currentIndex].close)) + ", Volume: " + (parseFloat(candlestickStockData[currentIndex].volume) / 1000).toFixed(2) + "k";
692
- }
693
- return formatPrice(candlestickStockData[candlestickStockData.length - 1].close);
694
- }, [currentIndex, formatThousandsPriceNumber, formatPrice]);
695
- return /*#__PURE__*/_jsx(Text, {
696
- "aria-live": "polite",
697
- font: "headline",
698
- children: currentText
699
- });
700
- });
701
- const CandlesticksChart = /*#__PURE__*/memo(_ref8 => {
702
- let {
703
- infoTextId,
704
- onScrubberPositionChange
705
- } = _ref8;
706
- const theme = useTheme();
707
- const min = useMemo(() => Math.min(...candlestickStockData.map(data => parseFloat(data.low))), []);
708
- const CandleThinSolidLine = /*#__PURE__*/memo(props => /*#__PURE__*/_jsx(SolidLine, _extends({}, props, {
709
- strokeWidth: 1
710
- })));
711
- const BandwidthHighlight = /*#__PURE__*/memo(_ref9 => {
712
- let {
713
- stroke
714
- } = _ref9;
715
- const {
716
- getXSerializableScale,
717
- drawingArea
718
- } = useCartesianChartContext();
719
- const {
720
- scrubberPosition
721
- } = useScrubberContext();
722
- const xScale = useMemo(() => getXSerializableScale(), [getXSerializableScale]);
723
- const rectWidth = useMemo(() => {
724
- if (xScale !== undefined && xScale.type === 'band') {
725
- return xScale.bandwidth;
726
- }
727
- return 0;
728
- }, [xScale]);
729
- const xPos = useDerivedValue(() => {
730
- const position = unwrapAnimatedValue(scrubberPosition);
731
- const xPos = position !== undefined && xScale ? getPointOnSerializableScale(position, xScale) : undefined;
732
- return xPos !== undefined ? xPos - rectWidth / 2 : 0;
733
- }, [scrubberPosition, xScale]);
734
- const opacity = useDerivedValue(() => xPos.value !== undefined ? 1 : 0, [xPos]);
735
- return /*#__PURE__*/_jsx(Rect, {
736
- color: stroke,
737
- height: drawingArea.height,
738
- opacity: opacity,
739
- width: rectWidth,
740
- x: xPos,
741
- y: drawingArea.y
742
- });
743
- });
744
- const candlesData = useMemo(() => candlestickStockData.map(data => [parseFloat(data.low), parseFloat(data.high)]), []);
745
- const CandlestickBarComponent = /*#__PURE__*/memo(_ref0 => {
746
- var _yScale, _yScale2;
747
- let {
748
- x,
749
- y,
750
- width,
751
- height,
752
- dataX
753
- } = _ref0,
754
- props = _objectWithoutPropertiesLoose(_ref0, _excluded3);
755
- const {
756
- getYScale
757
- } = useCartesianChartContext();
758
- const yScale = getYScale();
759
- const wickX = x + width / 2;
760
- const timePeriodValue = candlestickStockData[dataX];
761
- const open = parseFloat(timePeriodValue.open);
762
- const close = parseFloat(timePeriodValue.close);
763
- const bullish = open < close;
764
- const theme = useTheme();
765
- const color = bullish ? theme.color.fgPositive : theme.color.fgNegative;
766
- const openY = (_yScale = yScale == null ? void 0 : yScale(open)) != null ? _yScale : 0;
767
- const closeY = (_yScale2 = yScale == null ? void 0 : yScale(close)) != null ? _yScale2 : 0;
768
- const bodyHeight = Math.abs(openY - closeY);
769
- const bodyY = openY < closeY ? openY : closeY;
770
- return /*#__PURE__*/_jsxs(_Fragment, {
771
- children: [/*#__PURE__*/_jsx(SkiaLine, {
772
- color: color,
773
- p1: {
774
- x: wickX,
775
- y
776
- },
777
- p2: {
778
- x: wickX,
779
- y: y + height
780
- },
781
- strokeWidth: 1
782
- }), /*#__PURE__*/_jsx(Rect, {
783
- color: color,
784
- height: bodyHeight,
785
- width: width,
786
- x: x,
787
- y: bodyY
788
- })]
789
- });
790
- });
791
- const formatThousandsPriceNumber = useCallback(price => {
792
- const formattedPrice = new Intl.NumberFormat('en-US', {
793
- style: 'currency',
794
- currency: 'USD',
795
- minimumFractionDigits: 0,
796
- maximumFractionDigits: 0
797
- }).format(price / 1000);
798
- return formattedPrice + "k";
799
- }, []);
800
- const formatTime = useCallback(index => {
801
- if (index === null || index === undefined || index >= candlestickStockData.length) return '';
802
- const ts = parseInt(candlestickStockData[index].start);
803
- return new Date(ts * 1000).toLocaleDateString('en-US', {
804
- month: 'short',
805
- day: 'numeric'
806
- });
807
- }, []);
808
- const getScrubberAccessibilityLabel = useCallback(index => {
809
- const candle = candlestickStockData[index];
810
- return formatTime(index) + ": O " + formatThousandsPriceNumber(parseFloat(candle.open)) + " H " + formatThousandsPriceNumber(parseFloat(candle.high)) + " L " + formatThousandsPriceNumber(parseFloat(candle.low)) + " C " + formatThousandsPriceNumber(parseFloat(candle.close));
811
- }, [formatTime, formatThousandsPriceNumber]);
812
- return /*#__PURE__*/_jsxs(CartesianChart, {
813
- enableScrubbing: true,
814
- accessibilityLabel: "Candlestick chart with " + candlesData.length + " data points. Swipe to navigate.",
815
- animate: false,
816
- "aria-labelledby": infoTextId,
817
- borderRadius: 0,
818
- getScrubberAccessibilityLabel: getScrubberAccessibilityLabel,
819
- height: 150,
820
- inset: {
821
- top: 8,
822
- bottom: 8,
823
- left: 0,
824
- right: 0
825
- },
826
- onScrubberPositionChange: onScrubberPositionChange,
827
- series: [{
828
- id: 'stock-prices',
829
- data: candlesData
830
- }],
831
- xAxis: {
832
- scaleType: 'band'
833
- },
834
- yAxis: {
835
- domain: {
836
- min
837
- }
838
- },
839
- children: [/*#__PURE__*/_jsx(XAxis, {
840
- tickLabelFormatter: formatTime
841
- }), /*#__PURE__*/_jsx(YAxis, {
842
- showGrid: true,
843
- GridLineComponent: CandleThinSolidLine,
844
- tickLabelFormatter: formatThousandsPriceNumber,
845
- width: 40
846
- }), /*#__PURE__*/_jsx(Scrubber, {
847
- hideOverlay: true,
848
- LineComponent: BandwidthHighlight,
849
- lineStroke: theme.color.fgMuted,
850
- seriesIds: []
851
- }), /*#__PURE__*/_jsx(BarPlot, {
852
- BarComponent: CandlestickBarComponent,
853
- BarStackComponent: _ref1 => {
854
- let {
855
- children
856
- } = _ref1;
857
- return /*#__PURE__*/_jsx(_Fragment, {
858
- children: children
859
- });
860
- }
861
- })]
862
- });
863
- });
864
- const Candlesticks = () => {
865
- const infoTextId = useId();
866
- const [currentIndex, setCurrentIndex] = useState();
867
- return /*#__PURE__*/_jsxs(VStack, {
868
- gap: 2,
869
- children: [/*#__PURE__*/_jsx(CandlesticksHeader, {
870
- currentIndex: currentIndex
871
- }), /*#__PURE__*/_jsx(CandlesticksChart, {
872
- infoTextId: infoTextId,
873
- onScrubberPositionChange: setCurrentIndex
874
- })]
875
- });
876
- };
877
- const DAY_LENGTH_MINUTES = 1440;
878
- const sunlightData = [{
879
- label: 'Jan',
880
- value: 598
881
- }, {
882
- label: 'Feb',
883
- value: 635
884
- }, {
885
- label: 'Mar',
886
- value: 688
887
- }, {
888
- label: 'Apr',
889
- value: 753
890
- }, {
891
- label: 'May',
892
- value: 812
893
- }, {
894
- label: 'Jun',
895
- value: 855
896
- }, {
897
- label: 'Jul',
898
- value: 861
899
- }, {
900
- label: 'Aug',
901
- value: 828
902
- }, {
903
- label: 'Sep',
904
- value: 772
905
- }, {
906
- label: 'Oct',
907
- value: 710
908
- }, {
909
- label: 'Nov',
910
- value: 648
911
- }, {
912
- label: 'Dec',
913
- value: 605
914
- }];
915
- const SunlightChartInner = /*#__PURE__*/memo(_ref10 => {
916
- let {
917
- data,
918
- height = 300
919
- } = _ref10,
920
- props = _objectWithoutPropertiesLoose(_ref10, _excluded4);
921
- const theme = useTheme();
922
- const SunlightThinSolidLine = /*#__PURE__*/memo(props => /*#__PURE__*/_jsx(SolidLine, _extends({}, props, {
923
- strokeWidth: 1
924
- })));
925
- return /*#__PURE__*/_jsxs(CartesianChart, _extends({}, props, {
926
- height: height,
927
- series: [{
928
- id: 'sunlight',
929
- data: data.map(_ref11 => {
930
- let {
931
- value
932
- } = _ref11;
933
- return value;
934
- }),
935
- yAxisId: 'sunlight',
936
- color: "rgb(" + theme.spectrum.yellow40 + ")"
937
- }, {
938
- id: 'day',
939
- data: data.map(() => DAY_LENGTH_MINUTES),
940
- yAxisId: 'day',
941
- color: "rgb(" + theme.spectrum.blue100 + ")"
942
- }],
943
- xAxis: _extends({}, props.xAxis, {
944
- scaleType: 'band',
945
- data: data.map(_ref12 => {
946
- let {
947
- label
948
- } = _ref12;
949
- return label;
950
- })
951
- }),
952
- yAxis: [{
953
- id: 'day',
954
- domain: {
955
- min: 0,
956
- max: DAY_LENGTH_MINUTES
957
- },
958
- domainLimit: 'strict'
959
- }, {
960
- id: 'sunlight',
961
- domain: {
962
- min: 0,
963
- max: DAY_LENGTH_MINUTES
964
- },
965
- domainLimit: 'strict'
966
- }],
967
- children: [/*#__PURE__*/_jsx(YAxis, {
968
- showGrid: true,
969
- showLine: true,
970
- GridLineComponent: SunlightThinSolidLine,
971
- axisId: "day",
972
- position: "left"
973
- }), /*#__PURE__*/_jsx(XAxis, {
974
- showLine: true
975
- }), /*#__PURE__*/_jsx(BarPlot, {
976
- seriesIds: ['day'],
977
- transitions: {
978
- enter: null
979
- }
980
- }), /*#__PURE__*/_jsx(BarPlot, {
981
- borderRadius: 0,
982
- seriesIds: ['sunlight'],
983
- transitions: {
984
- enter: {
985
- type: 'spring',
986
- stiffness: 700,
987
- damping: 40,
988
- staggerDelay: 1000
989
- }
990
- }
991
- })]
992
- }));
993
- });
994
- const SunlightChart = () => {
995
- return /*#__PURE__*/_jsxs(VStack, {
996
- gap: 2,
997
- children: [/*#__PURE__*/_jsx(SunlightChartInner, {
998
- data: sunlightData
999
- }), /*#__PURE__*/_jsx(Text, {
1000
- color: "fgMuted",
1001
- font: "caption",
1002
- textAlign: "center",
1003
- children: "2026 Sunlight data for the first day of each month in Atlanta, Georgia, provided by NOAA."
1004
- })]
1005
- });
1006
- };
1007
- const PriceRange = () => {
1008
- const candles = [...btcCandles].reverse().slice(0, 180);
1009
- const data = useMemo(() => candles.map(candle => [parseFloat(candle.low), parseFloat(candle.high)]), [candles]);
1010
- const min = useMemo(() => Math.min(...data.map(_ref13 => {
1011
- let [low] = _ref13;
1012
- return low;
1013
- })), [data]);
1014
- const max = useMemo(() => Math.max(...data.map(_ref14 => {
1015
- let [, high] = _ref14;
1016
- return high;
1017
- })), [data]);
1018
- const tickFormatter = useCallback(value => new Intl.NumberFormat('en-US', {
1019
- style: 'currency',
1020
- currency: 'USD',
1021
- notation: 'compact',
1022
- maximumFractionDigits: 0
1023
- }).format(value), []);
1024
- return /*#__PURE__*/_jsx(BarChart, {
1025
- showYAxis: true,
1026
- height: 150,
1027
- series: [{
1028
- id: 'prices',
1029
- data,
1030
- color: assets.btc.color
1031
- }],
1032
- yAxis: {
1033
- domain: {
1034
- min,
1035
- max
1036
- },
1037
- showGrid: true,
1038
- tickLabelFormatter: tickFormatter
1039
- }
1040
- });
1041
- };
1042
- const HorizontalBarChart = () => {
1043
- const labels = ['BTC', 'ETH', 'SOL', 'ADA'];
1044
- const allocation = [42, 28, 18, 12];
1045
- return /*#__PURE__*/_jsx(BarChart, {
1046
- showXAxis: true,
1047
- showYAxis: true,
1048
- height: 220,
1049
- layout: "horizontal",
1050
- series: [{
1051
- id: 'allocation',
1052
- data: allocation,
1053
- color: assets.btc.color
1054
- }],
1055
- xAxis: {
1056
- domain: {
1057
- min: 0,
1058
- max: 50
1059
- },
1060
- tickLabelFormatter: value => value + "%"
1061
- },
1062
- yAxis: {
1063
- data: labels,
1064
- scaleType: 'band'
1065
- }
1066
- });
1067
- };
1068
- const AxisBaselineExample = () => {
1069
- return /*#__PURE__*/_jsx(BarChart, {
1070
- showXAxis: true,
1071
- showYAxis: true,
1072
- accessibilityLabel: "Bar chart with custom axis baseline at 100.",
1073
- height: defaultChartHeight,
1074
- series: [{
1075
- id: 'net-flow',
1076
- data: [112, 97, 121, 103, 129, 118, 94]
1077
- }],
1078
- xAxis: {
1079
- data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
1080
- },
1081
- yAxis: {
1082
- baseline: 100,
1083
- domain: {
1084
- min: 80,
1085
- max: 140
1086
- },
1087
- showGrid: true
1088
- }
1089
- });
1090
- };
1091
- const AxisBaselineThresholdExample = () => {
1092
- const theme = useTheme();
1093
- return /*#__PURE__*/_jsxs(VStack, {
1094
- gap: 2,
1095
- children: [/*#__PURE__*/_jsx(BarChart, {
1096
- showYAxis: true,
1097
- accessibilityLabel: "Bar chart with threshold baseline at 30.",
1098
- height: 220,
1099
- inset: 0,
1100
- series: [{
1101
- id: 'axis-baseline-threshold-vertical',
1102
- data: baselineThresholdData,
1103
- gradient: {
1104
- stops: [{
1105
- offset: 30,
1106
- color: theme.color.fgNegative
1107
- }, {
1108
- offset: 30,
1109
- color: theme.color.fgPositive
1110
- }]
1111
- }
1112
- }],
1113
- yAxis: {
1114
- showGrid: true,
1115
- baseline: 30
1116
- }
1117
- }), /*#__PURE__*/_jsx(BarChart, {
1118
- showXAxis: true,
1119
- accessibilityLabel: "Horizontal bar chart with threshold baseline at 30.",
1120
- height: 220,
1121
- inset: 0,
1122
- layout: "horizontal",
1123
- series: [{
1124
- id: 'axis-baseline-threshold-horizontal',
1125
- data: baselineThresholdData,
1126
- gradient: {
1127
- stops: [{
1128
- offset: 30,
1129
- color: theme.color.fgNegative
1130
- }, {
1131
- offset: 30,
1132
- color: theme.color.fgPositive
1133
- }]
1134
- }
1135
- }],
1136
- xAxis: {
1137
- showGrid: true,
1138
- baseline: 30
1139
- }
1140
- })]
1141
- });
1142
- };
1143
- function BuyVsSellExample() {
1144
- function BuyVsSellLegend(_ref15) {
1145
- let {
1146
- buy,
1147
- sell
1148
- } = _ref15;
1149
- const theme = useTheme();
1150
- return /*#__PURE__*/_jsxs(HStack, {
1151
- gap: 1,
1152
- justifyContent: "space-between",
1153
- children: [/*#__PURE__*/_jsx(DefaultLegendEntry, {
1154
- color: theme.color.fgPositive,
1155
- label: /*#__PURE__*/_jsxs(Text, {
1156
- color: "fgMuted",
1157
- font: "legal",
1158
- children: [buy, "% bought"]
1159
- }),
1160
- seriesId: "buy"
1161
- }), /*#__PURE__*/_jsx(DefaultLegendEntry, {
1162
- color: theme.color.fgNegative,
1163
- label: /*#__PURE__*/_jsxs(Text, {
1164
- color: "fgMuted",
1165
- font: "legal",
1166
- children: [sell, "% sold"]
1167
- }),
1168
- seriesId: "sell"
1169
- })]
1170
- });
1171
- }
1172
- function BuyVsSellChart(_ref16) {
1173
- let {
1174
- buy,
1175
- sell,
1176
- animate = true,
1177
- borderRadius = 3,
1178
- height = 6,
1179
- inset = 0,
1180
- layout = 'horizontal',
1181
- stackGap = 4,
1182
- xAxis,
1183
- yAxis,
1184
- barMinSize = height
1185
- } = _ref16,
1186
- props = _objectWithoutPropertiesLoose(_ref16, _excluded5);
1187
- const theme = useTheme();
1188
- return /*#__PURE__*/_jsxs(VStack, {
1189
- gap: 1.5,
1190
- children: [/*#__PURE__*/_jsx(BarChart, _extends({
1191
- roundBaseline: true,
1192
- stacked: true,
1193
- animate: animate,
1194
- barMinSize: barMinSize,
1195
- borderRadius: borderRadius,
1196
- height: height,
1197
- inset: inset,
1198
- layout: layout,
1199
- series: [{
1200
- id: 'buy',
1201
- data: [buy],
1202
- color: theme.color.fgPositive,
1203
- legendShape: 'circle'
1204
- }, {
1205
- id: 'sell',
1206
- data: [sell],
1207
- color: theme.color.fgNegative,
1208
- legendShape: 'circle'
1209
- }],
1210
- stackGap: stackGap,
1211
- xAxis: _extends({
1212
- domainLimit: 'strict'
1213
- }, xAxis),
1214
- yAxis: _extends({
1215
- categoryPadding: 0
1216
- }, yAxis)
1217
- }, props)), /*#__PURE__*/_jsx(BuyVsSellLegend, {
1218
- buy: buy,
1219
- sell: sell
1220
- })]
1221
- });
1222
- }
1223
- return /*#__PURE__*/_jsx(BuyVsSellChart, {
1224
- buy: 76,
1225
- sell: 24
1226
- });
1227
- }
1228
- const PopulationPyramid = () => {
1229
- const theme = useTheme();
1230
- const ageGroups = ['100+ yrs', '95-99 yrs', '90-94 yrs', '85-89 yrs', '80-84 yrs', '75-79 yrs', '70-74 yrs', '65-69 yrs', '60-64 yrs', '55-59 yrs', '50-54 yrs', '45-49 yrs', '40-44 yrs', '35-39 yrs', '30-34 yrs', '25-29 yrs', '20-24 yrs', '15-19 yrs', '10-14 yrs', '5-9 yrs', '0-4 yrs'];
1231
- const malePopulation = [14587, 48604, 83560, 128957, 184152, 248505, 498683, 706420, 852333, 939629, 1002195, 1001264, 960282, 1161371, 1105023, 1061755, 1019343, 1023264, 1026330, 984773, 944071];
1232
- const femalePopulation = [14122, 46974, 80768, 124663, 178043, 240293, 482271, 683270, 824525, 909115, 969807, 969070, 929571, 1122380, 1068050, 1026356, 985483, 989404, 992505, 952453, 913222];
1233
- const numberWithSuffixFormatter = useMemo(() => new Intl.NumberFormat('en-US', {
1234
- notation: 'compact'
1235
- }), []);
1236
- const tickLabelFormatter = useCallback(value => numberWithSuffixFormatter.format(Math.abs(value)), [numberWithSuffixFormatter]);
1237
- const domainSymmetric = useCallback(bounds => {
1238
- const extremum = Math.max(-bounds.min, bounds.max);
1239
- const roundedExtremum = Math.ceil(extremum / 100000) * 100000;
1240
- return {
1241
- min: -roundedExtremum,
1242
- max: roundedExtremum
1243
- };
1244
- }, []);
1245
- const series = [{
1246
- id: 'male',
1247
- label: 'Male',
1248
- data: malePopulation.map(population => -population),
1249
- color: "rgb(" + theme.spectrum.blue40 + ")",
1250
- stackId: 'population'
1251
- }, {
1252
- id: 'female',
1253
- label: 'Female',
1254
- data: femalePopulation,
1255
- color: "rgb(" + theme.spectrum.pink40 + ")",
1256
- stackId: 'population'
1257
- }];
1258
- return /*#__PURE__*/_jsx(VStack, {
1259
- gap: 2,
1260
- children: /*#__PURE__*/_jsx(BarChart, {
1261
- showXAxis: true,
1262
- showYAxis: true,
1263
- stacked: true,
1264
- borderRadius: 2,
1265
- height: 550,
1266
- inset: 0,
1267
- layout: "horizontal",
1268
- series: series,
1269
- xAxis: {
1270
- domain: domainSymmetric,
1271
- GridLineComponent: ThinSolidLine,
1272
- showGrid: true,
1273
- showLine: true,
1274
- showTickMarks: true,
1275
- tickLabelFormatter
1276
- },
1277
- yAxis: {
1278
- bandTickMarkPlacement: 'edges',
1279
- data: ageGroups,
1280
- position: 'left',
1281
- showLine: true,
1282
- showTickMarks: true,
1283
- width: 80
1284
- },
1285
- children: /*#__PURE__*/_jsx(ReferenceLine, {
1286
- LineComponent: SolidLine,
1287
- dataX: 0
1288
- })
1289
- })
1290
- });
1291
- };
1292
- function ExampleNavigator() {
1293
- const [currentIndex, setCurrentIndex] = useState(0);
1294
- const examples = useMemo(() => [{
1295
- title: 'Basic',
1296
- component: /*#__PURE__*/_jsx(UpdatingChartValues, {})
1297
- }, {
1298
- title: 'Animated Auto-Updating',
1299
- component: /*#__PURE__*/_jsx(AnimatedUpdatingChartValues, {})
1300
- }, {
1301
- title: 'Negative Values with Top Axis',
1302
- component: /*#__PURE__*/_jsx(NegativeValuesWithTopAxis, {})
1303
- }, {
1304
- title: 'Axis Baseline',
1305
- component: /*#__PURE__*/_jsx(AxisBaselineExample, {})
1306
- }, {
1307
- title: 'Axis Baseline Threshold',
1308
- component: /*#__PURE__*/_jsx(AxisBaselineThresholdExample, {})
1309
- }, {
1310
- title: 'Positive and Negative Cash Flow',
1311
- component: /*#__PURE__*/_jsx(PositiveAndNegativeCashFlow, {})
1312
- }, {
1313
- title: 'Fiat & Stablecoin Balance',
1314
- component: /*#__PURE__*/_jsx(FiatAndStablecoinBalance, {})
1315
- }, {
1316
- title: 'Monthly Rewards',
1317
- component: /*#__PURE__*/_jsx(MonthlyRewards, {})
1318
- }, {
1319
- title: 'Multiple Y Axes',
1320
- component: /*#__PURE__*/_jsx(MultipleYAxes, {})
1321
- }, {
1322
- title: 'Y-Axis Continuous ColorMap',
1323
- component: /*#__PURE__*/_jsx(YAxisContinuousColorMap, {})
1324
- }, {
1325
- title: 'Y-Axis Discrete ColorMap',
1326
- component: /*#__PURE__*/_jsx(YAxisDiscreteColorMap, {})
1327
- }, {
1328
- title: 'X-Axis Continuous ColorMap',
1329
- component: /*#__PURE__*/_jsx(XAxisContinuousColorMap, {})
1330
- }, {
1331
- title: 'X-Axis Discrete ColorMap',
1332
- component: /*#__PURE__*/_jsx(XAxisDiscreteColorMap, {})
1333
- }, {
1334
- title: 'X-Axis Multi-Segment ColorMap',
1335
- component: /*#__PURE__*/_jsx(XAxisMultiSegmentColorMap, {})
1336
- }, {
1337
- title: 'ColorMap with Opacity',
1338
- component: /*#__PURE__*/_jsx(ColorMapWithOpacity, {})
1339
- }, {
1340
- title: 'Band Grid Position',
1341
- component: /*#__PURE__*/_jsxs(VStack, {
1342
- gap: 2,
1343
- children: [/*#__PURE__*/_jsx(BandGridPositionExample, {
1344
- position: "edges"
1345
- }), /*#__PURE__*/_jsx(BandGridPositionExample, {
1346
- position: "start"
1347
- }), /*#__PURE__*/_jsx(BandGridPositionExample, {
1348
- position: "middle"
1349
- }), /*#__PURE__*/_jsx(BandGridPositionExample, {
1350
- position: "end"
1351
- })]
1352
- })
1353
- }, {
1354
- title: 'Candlesticks',
1355
- component: /*#__PURE__*/_jsx(Candlesticks, {})
1356
- }, {
1357
- title: 'Monthly Sunlight',
1358
- component: /*#__PURE__*/_jsx(SunlightChart, {})
1359
- }, {
1360
- title: 'Price Range',
1361
- component: /*#__PURE__*/_jsx(PriceRange, {})
1362
- }, {
1363
- title: 'Horizontal Layout',
1364
- component: /*#__PURE__*/_jsx(HorizontalBarChart, {})
1365
- }, {
1366
- title: 'Buy vs Sell',
1367
- component: /*#__PURE__*/_jsx(BuyVsSellExample, {})
1368
- }, {
1369
- title: 'Population Pyramid',
1370
- component: /*#__PURE__*/_jsx(PopulationPyramid, {})
1371
- }], []);
1372
- const currentExample = examples[currentIndex];
1373
- const handlePrevious = useCallback(() => {
1374
- setCurrentIndex(prev => (prev - 1 + examples.length) % examples.length);
1375
- }, [examples.length]);
1376
- const handleNext = useCallback(() => {
1377
- setCurrentIndex(prev => (prev + 1 + examples.length) % examples.length);
1378
- }, [examples.length]);
1379
- return /*#__PURE__*/_jsx(ExampleScreen, {
1380
- paddingX: 0,
1381
- children: /*#__PURE__*/_jsxs(VStack, {
1382
- gap: 4,
1383
- children: [/*#__PURE__*/_jsxs(HStack, {
1384
- alignItems: "center",
1385
- justifyContent: "space-between",
1386
- padding: 2,
1387
- children: [/*#__PURE__*/_jsx(IconButton, {
1388
- accessibilityHint: "Navigate to previous example",
1389
- accessibilityLabel: "Previous",
1390
- name: "arrowLeft",
1391
- onPress: handlePrevious,
1392
- variant: "secondary"
1393
- }), /*#__PURE__*/_jsxs(VStack, {
1394
- alignItems: "center",
1395
- children: [/*#__PURE__*/_jsx(Text, {
1396
- font: "title3",
1397
- children: currentExample.title
1398
- }), /*#__PURE__*/_jsxs(Text, {
1399
- color: "fgMuted",
1400
- font: "label1",
1401
- children: [currentIndex + 1, " / ", examples.length]
1402
- })]
1403
- }), /*#__PURE__*/_jsx(IconButton, {
1404
- accessibilityHint: "Navigate to next example",
1405
- accessibilityLabel: "Next",
1406
- name: "arrowRight",
1407
- onPress: handleNext,
1408
- variant: "secondary"
1409
- })]
1410
- }), /*#__PURE__*/_jsx(Box, {
1411
- padding: 1,
1412
- children: currentExample.component
1413
- })]
1414
- })
1415
- });
1416
- }
1417
- export default ExampleNavigator;