@astryxdesign/lab 0.0.0-bootstrap.0 → 0.1.2-canary.04e71b2

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 (513) hide show
  1. package/CHANGELOG.md +67 -0
  2. package/LICENSE +21 -0
  3. package/README.md +47 -1
  4. package/dist/Chart/Chart.d.ts +77 -0
  5. package/dist/Chart/Chart.d.ts.map +1 -0
  6. package/dist/Chart/Chart.js +247 -0
  7. package/dist/Chart/ChartArea.d.ts +28 -0
  8. package/dist/Chart/ChartArea.d.ts.map +1 -0
  9. package/dist/Chart/ChartArea.js +71 -0
  10. package/dist/Chart/ChartAxis.d.ts +27 -0
  11. package/dist/Chart/ChartAxis.d.ts.map +1 -0
  12. package/dist/Chart/ChartAxis.js +147 -0
  13. package/dist/Chart/ChartBar.d.ts +19 -0
  14. package/dist/Chart/ChartBar.d.ts.map +1 -0
  15. package/dist/Chart/ChartBar.js +61 -0
  16. package/dist/Chart/ChartBrush.d.ts +59 -0
  17. package/dist/Chart/ChartBrush.d.ts.map +1 -0
  18. package/dist/Chart/ChartBrush.js +197 -0
  19. package/dist/Chart/ChartCandlestick.d.ts +50 -0
  20. package/dist/Chart/ChartCandlestick.d.ts.map +1 -0
  21. package/dist/Chart/ChartCandlestick.js +138 -0
  22. package/dist/Chart/ChartContext.d.ts +5 -0
  23. package/dist/Chart/ChartContext.d.ts.map +1 -0
  24. package/dist/Chart/ChartContext.js +20 -0
  25. package/dist/Chart/ChartDot.d.ts +18 -0
  26. package/dist/Chart/ChartDot.d.ts.map +1 -0
  27. package/dist/Chart/ChartDot.js +43 -0
  28. package/dist/Chart/ChartDotGL.d.ts +16 -0
  29. package/dist/Chart/ChartDotGL.d.ts.map +1 -0
  30. package/dist/Chart/ChartDotGL.js +135 -0
  31. package/dist/Chart/ChartDotGLInteractive.d.ts +41 -0
  32. package/dist/Chart/ChartDotGLInteractive.d.ts.map +1 -0
  33. package/dist/Chart/ChartDotGLInteractive.js +446 -0
  34. package/dist/Chart/ChartErrorBar.d.ts +23 -0
  35. package/dist/Chart/ChartErrorBar.d.ts.map +1 -0
  36. package/dist/Chart/ChartErrorBar.js +68 -0
  37. package/dist/Chart/ChartGrid.d.ts +17 -0
  38. package/dist/Chart/ChartGrid.d.ts.map +1 -0
  39. package/dist/Chart/ChartGrid.js +67 -0
  40. package/dist/Chart/ChartHeatmapGL.d.ts +10 -0
  41. package/dist/Chart/ChartHeatmapGL.d.ts.map +1 -0
  42. package/dist/Chart/ChartHeatmapGL.js +171 -0
  43. package/dist/Chart/ChartLegend.d.ts +60 -0
  44. package/dist/Chart/ChartLegend.d.ts.map +1 -0
  45. package/dist/Chart/ChartLegend.js +161 -0
  46. package/dist/Chart/ChartLine.d.ts +23 -0
  47. package/dist/Chart/ChartLine.d.ts.map +1 -0
  48. package/dist/Chart/ChartLine.js +64 -0
  49. package/dist/Chart/ChartReferenceLine.d.ts +11 -0
  50. package/dist/Chart/ChartReferenceLine.d.ts.map +1 -0
  51. package/dist/Chart/ChartReferenceLine.js +109 -0
  52. package/dist/Chart/ChartSelect.d.ts +9 -0
  53. package/dist/Chart/ChartSelect.d.ts.map +1 -0
  54. package/dist/Chart/ChartSelect.js +90 -0
  55. package/dist/Chart/ChartStreamGL.d.ts +17 -0
  56. package/dist/Chart/ChartStreamGL.d.ts.map +1 -0
  57. package/dist/Chart/ChartStreamGL.js +157 -0
  58. package/dist/Chart/ChartTooltip.d.ts +85 -0
  59. package/dist/Chart/ChartTooltip.d.ts.map +1 -0
  60. package/dist/Chart/ChartTooltip.js +335 -0
  61. package/dist/Chart/ChartZoom.d.ts +23 -0
  62. package/dist/Chart/ChartZoom.d.ts.map +1 -0
  63. package/dist/Chart/ChartZoom.js +314 -0
  64. package/dist/Chart/formatters.d.ts +33 -0
  65. package/dist/Chart/formatters.d.ts.map +1 -0
  66. package/dist/Chart/formatters.js +101 -0
  67. package/dist/Chart/getChartColors.d.ts +56 -0
  68. package/dist/Chart/getChartColors.d.ts.map +1 -0
  69. package/dist/Chart/getChartColors.js +150 -0
  70. package/dist/Chart/index.d.ts +29 -0
  71. package/dist/Chart/index.d.ts.map +1 -0
  72. package/dist/Chart/index.js +29 -0
  73. package/dist/Chart/m4.d.ts +36 -0
  74. package/dist/Chart/m4.d.ts.map +1 -0
  75. package/dist/Chart/m4.js +106 -0
  76. package/dist/Chart/types.d.ts +55 -0
  77. package/dist/Chart/types.d.ts.map +1 -0
  78. package/dist/Chart/types.js +1 -0
  79. package/dist/Chart/useChartColors.d.ts +16 -0
  80. package/dist/Chart/useChartColors.d.ts.map +1 -0
  81. package/dist/Chart/useChartColors.js +30 -0
  82. package/dist/Chart/useChartRange.d.ts +50 -0
  83. package/dist/Chart/useChartRange.d.ts.map +1 -0
  84. package/dist/Chart/useChartRange.js +90 -0
  85. package/dist/Chart/utils.d.ts +15 -0
  86. package/dist/Chart/utils.d.ts.map +1 -0
  87. package/dist/Chart/utils.js +24 -0
  88. package/dist/Chart/webgl.d.ts +62 -0
  89. package/dist/Chart/webgl.d.ts.map +1 -0
  90. package/dist/Chart/webgl.js +169 -0
  91. package/dist/ChartV2/Chart.d.ts +32 -0
  92. package/dist/ChartV2/Chart.d.ts.map +1 -0
  93. package/dist/ChartV2/Chart.js +281 -0
  94. package/dist/ChartV2/ChartAxis.d.ts +36 -0
  95. package/dist/ChartV2/ChartAxis.d.ts.map +1 -0
  96. package/dist/ChartV2/ChartAxis.js +161 -0
  97. package/dist/ChartV2/ChartGrid.d.ts +20 -0
  98. package/dist/ChartV2/ChartGrid.d.ts.map +1 -0
  99. package/dist/ChartV2/ChartGrid.js +76 -0
  100. package/dist/ChartV2/ChartLegend.d.ts +14 -0
  101. package/dist/ChartV2/ChartLegend.d.ts.map +1 -0
  102. package/dist/ChartV2/ChartLegend.js +54 -0
  103. package/dist/ChartV2/ChartSwatch.d.ts +36 -0
  104. package/dist/ChartV2/ChartSwatch.d.ts.map +1 -0
  105. package/dist/ChartV2/ChartSwatch.js +82 -0
  106. package/dist/ChartV2/ChartTooltip.d.ts +46 -0
  107. package/dist/ChartV2/ChartTooltip.d.ts.map +1 -0
  108. package/dist/ChartV2/ChartTooltip.js +267 -0
  109. package/dist/ChartV2/ChartV2Context.d.ts +4 -0
  110. package/dist/ChartV2/ChartV2Context.d.ts.map +1 -0
  111. package/dist/ChartV2/ChartV2Context.js +12 -0
  112. package/dist/ChartV2/index.d.ts +13 -0
  113. package/dist/ChartV2/index.d.ts.map +1 -0
  114. package/dist/ChartV2/index.js +10 -0
  115. package/dist/ChartV2/layout.d.ts +25 -0
  116. package/dist/ChartV2/layout.d.ts.map +1 -0
  117. package/dist/ChartV2/layout.js +195 -0
  118. package/dist/ChartV2/legend.d.ts +18 -0
  119. package/dist/ChartV2/legend.d.ts.map +1 -0
  120. package/dist/ChartV2/legend.js +24 -0
  121. package/dist/ChartV2/marks/area.d.ts +19 -0
  122. package/dist/ChartV2/marks/area.d.ts.map +1 -0
  123. package/dist/ChartV2/marks/area.js +109 -0
  124. package/dist/ChartV2/marks/band.d.ts +9 -0
  125. package/dist/ChartV2/marks/band.d.ts.map +1 -0
  126. package/dist/ChartV2/marks/band.js +59 -0
  127. package/dist/ChartV2/marks/bar.d.ts +17 -0
  128. package/dist/ChartV2/marks/bar.d.ts.map +1 -0
  129. package/dist/ChartV2/marks/bar.js +120 -0
  130. package/dist/ChartV2/marks/candlestick.d.ts +15 -0
  131. package/dist/ChartV2/marks/candlestick.d.ts.map +1 -0
  132. package/dist/ChartV2/marks/candlestick.js +83 -0
  133. package/dist/ChartV2/marks/dot.d.ts +15 -0
  134. package/dist/ChartV2/marks/dot.d.ts.map +1 -0
  135. package/dist/ChartV2/marks/dot.js +65 -0
  136. package/dist/ChartV2/marks/dotGL.d.ts +16 -0
  137. package/dist/ChartV2/marks/dotGL.d.ts.map +1 -0
  138. package/dist/ChartV2/marks/dotGL.js +178 -0
  139. package/dist/ChartV2/marks/dotGLInteractive.d.ts +30 -0
  140. package/dist/ChartV2/marks/dotGLInteractive.d.ts.map +1 -0
  141. package/dist/ChartV2/marks/dotGLInteractive.js +464 -0
  142. package/dist/ChartV2/marks/errorBar.d.ts +27 -0
  143. package/dist/ChartV2/marks/errorBar.d.ts.map +1 -0
  144. package/dist/ChartV2/marks/errorBar.js +87 -0
  145. package/dist/ChartV2/marks/heatmapGL.d.ts +23 -0
  146. package/dist/ChartV2/marks/heatmapGL.d.ts.map +1 -0
  147. package/dist/ChartV2/marks/heatmapGL.js +242 -0
  148. package/dist/ChartV2/marks/index.d.ts +13 -0
  149. package/dist/ChartV2/marks/index.d.ts.map +1 -0
  150. package/dist/ChartV2/marks/index.js +14 -0
  151. package/dist/ChartV2/marks/line.d.ts +18 -0
  152. package/dist/ChartV2/marks/line.d.ts.map +1 -0
  153. package/dist/ChartV2/marks/line.js +76 -0
  154. package/dist/ChartV2/marks/referenceLine.d.ts +35 -0
  155. package/dist/ChartV2/marks/referenceLine.d.ts.map +1 -0
  156. package/dist/ChartV2/marks/referenceLine.js +186 -0
  157. package/dist/ChartV2/marks/streamGL.d.ts +36 -0
  158. package/dist/ChartV2/marks/streamGL.d.ts.map +1 -0
  159. package/dist/ChartV2/marks/streamGL.js +204 -0
  160. package/dist/ChartV2/tooltip.d.ts +38 -0
  161. package/dist/ChartV2/tooltip.d.ts.map +1 -0
  162. package/dist/ChartV2/tooltip.js +54 -0
  163. package/dist/ChartV2/types.d.ts +115 -0
  164. package/dist/ChartV2/types.d.ts.map +1 -0
  165. package/dist/ChartV2/types.js +35 -0
  166. package/dist/ChatReasoning/ChatReasoning.d.ts +51 -0
  167. package/dist/ChatReasoning/ChatReasoning.d.ts.map +1 -0
  168. package/dist/ChatReasoning/ChatReasoning.js +236 -0
  169. package/dist/CircularProgress/CircularProgress.d.ts +101 -0
  170. package/dist/CircularProgress/CircularProgress.d.ts.map +1 -0
  171. package/dist/CircularProgress/CircularProgress.js +263 -0
  172. package/dist/CircularProgress/index.d.ts +6 -0
  173. package/dist/CircularProgress/index.d.ts.map +1 -0
  174. package/dist/CircularProgress/index.js +8 -0
  175. package/dist/CodeBlock/index.d.ts +8 -0
  176. package/dist/CodeBlock/index.d.ts.map +1 -0
  177. package/dist/CodeBlock/index.js +9 -0
  178. package/dist/CodeEditor/CodeEditor.d.ts +46 -0
  179. package/dist/CodeEditor/CodeEditor.d.ts.map +1 -0
  180. package/dist/CodeEditor/CodeEditor.js +396 -0
  181. package/dist/CodeEditor/index.d.ts +6 -0
  182. package/dist/CodeEditor/index.d.ts.map +1 -0
  183. package/dist/CodeEditor/index.js +7 -0
  184. package/dist/Radial/RadialArea.d.ts +25 -0
  185. package/dist/Radial/RadialArea.d.ts.map +1 -0
  186. package/dist/Radial/RadialArea.js +91 -0
  187. package/dist/Radial/RadialAxis.d.ts +14 -0
  188. package/dist/Radial/RadialAxis.d.ts.map +1 -0
  189. package/dist/Radial/RadialAxis.js +55 -0
  190. package/dist/Radial/RadialChart.d.ts +70 -0
  191. package/dist/Radial/RadialChart.d.ts.map +1 -0
  192. package/dist/Radial/RadialChart.js +174 -0
  193. package/dist/Radial/RadialContext.d.ts +5 -0
  194. package/dist/Radial/RadialContext.d.ts.map +1 -0
  195. package/dist/Radial/RadialContext.js +19 -0
  196. package/dist/Radial/RadialGrid.d.ts +14 -0
  197. package/dist/Radial/RadialGrid.d.ts.map +1 -0
  198. package/dist/Radial/RadialGrid.js +70 -0
  199. package/dist/Radial/RadialSlice.d.ts +23 -0
  200. package/dist/Radial/RadialSlice.d.ts.map +1 -0
  201. package/dist/Radial/RadialSlice.js +85 -0
  202. package/dist/Radial/RadialTooltip.d.ts +44 -0
  203. package/dist/Radial/RadialTooltip.d.ts.map +1 -0
  204. package/dist/Radial/RadialTooltip.js +284 -0
  205. package/dist/Radial/index.d.ts +9 -0
  206. package/dist/Radial/index.d.ts.map +1 -0
  207. package/dist/Radial/index.js +9 -0
  208. package/dist/Radial/types.d.ts +39 -0
  209. package/dist/Radial/types.d.ts.map +1 -0
  210. package/dist/Radial/types.js +1 -0
  211. package/dist/SVGIcon/SVGIcon.d.ts +87 -0
  212. package/dist/SVGIcon/SVGIcon.d.ts.map +1 -0
  213. package/dist/SVGIcon/SVGIcon.js +299 -0
  214. package/dist/SVGIcon/icons.d.ts +49 -0
  215. package/dist/SVGIcon/icons.d.ts.map +1 -0
  216. package/dist/SVGIcon/icons.js +326 -0
  217. package/dist/SVGIcon/index.d.ts +15 -0
  218. package/dist/SVGIcon/index.d.ts.map +1 -0
  219. package/dist/SVGIcon/index.js +22 -0
  220. package/dist/SVGIcon/pathTransforms.d.ts +35 -0
  221. package/dist/SVGIcon/pathTransforms.d.ts.map +1 -0
  222. package/dist/SVGIcon/pathTransforms.js +644 -0
  223. package/dist/SVGIcon/tokens.stylex.d.ts +37 -0
  224. package/dist/SVGIcon/tokens.stylex.d.ts.map +1 -0
  225. package/dist/SVGIcon/tokens.stylex.js +40 -0
  226. package/dist/SVGIcon/variations.stylex.d.ts +44 -0
  227. package/dist/SVGIcon/variations.stylex.d.ts.map +1 -0
  228. package/dist/SVGIcon/variations.stylex.js +119 -0
  229. package/dist/SVGIcon/xif-examples.d.ts +22 -0
  230. package/dist/SVGIcon/xif-examples.d.ts.map +1 -0
  231. package/dist/SVGIcon/xif-examples.js +202 -0
  232. package/dist/SVGIcon/xif-types.d.ts +129 -0
  233. package/dist/SVGIcon/xif-types.d.ts.map +1 -0
  234. package/dist/SVGIcon/xif-types.js +1 -0
  235. package/dist/Sankey/SankeyChart.d.ts +72 -0
  236. package/dist/Sankey/SankeyChart.d.ts.map +1 -0
  237. package/dist/Sankey/SankeyChart.js +162 -0
  238. package/dist/Sankey/SankeyContext.d.ts +5 -0
  239. package/dist/Sankey/SankeyContext.d.ts.map +1 -0
  240. package/dist/Sankey/SankeyContext.js +20 -0
  241. package/dist/Sankey/SankeyGrid.d.ts +20 -0
  242. package/dist/Sankey/SankeyGrid.d.ts.map +1 -0
  243. package/dist/Sankey/SankeyGrid.js +53 -0
  244. package/dist/Sankey/SankeyLabel.d.ts +11 -0
  245. package/dist/Sankey/SankeyLabel.d.ts.map +1 -0
  246. package/dist/Sankey/SankeyLabel.js +179 -0
  247. package/dist/Sankey/SankeyLink.d.ts +29 -0
  248. package/dist/Sankey/SankeyLink.d.ts.map +1 -0
  249. package/dist/Sankey/SankeyLink.js +139 -0
  250. package/dist/Sankey/SankeyNode.d.ts +15 -0
  251. package/dist/Sankey/SankeyNode.d.ts.map +1 -0
  252. package/dist/Sankey/SankeyNode.js +56 -0
  253. package/dist/Sankey/index.d.ts +8 -0
  254. package/dist/Sankey/index.d.ts.map +1 -0
  255. package/dist/Sankey/index.js +8 -0
  256. package/dist/Sankey/layout.d.ts +26 -0
  257. package/dist/Sankey/layout.d.ts.map +1 -0
  258. package/dist/Sankey/layout.js +157 -0
  259. package/dist/Sankey/types.d.ts +84 -0
  260. package/dist/Sankey/types.d.ts.map +1 -0
  261. package/dist/Sankey/types.js +1 -0
  262. package/dist/Schedule/CalendarEvent.d.ts +36 -0
  263. package/dist/Schedule/CalendarEvent.d.ts.map +1 -0
  264. package/dist/Schedule/CalendarEvent.js +35 -0
  265. package/dist/Schedule/DayView.d.ts +8 -0
  266. package/dist/Schedule/DayView.d.ts.map +1 -0
  267. package/dist/Schedule/DayView.js +105 -0
  268. package/dist/Schedule/ListView.d.ts +6 -0
  269. package/dist/Schedule/ListView.d.ts.map +1 -0
  270. package/dist/Schedule/ListView.js +171 -0
  271. package/dist/Schedule/MonthlyView.d.ts +6 -0
  272. package/dist/Schedule/MonthlyView.d.ts.map +1 -0
  273. package/dist/Schedule/MonthlyView.js +270 -0
  274. package/dist/Schedule/Schedule.d.ts +22 -0
  275. package/dist/Schedule/Schedule.d.ts.map +1 -0
  276. package/dist/Schedule/Schedule.js +185 -0
  277. package/dist/Schedule/TimeGridView.d.ts +12 -0
  278. package/dist/Schedule/TimeGridView.d.ts.map +1 -0
  279. package/dist/Schedule/TimeGridView.js +364 -0
  280. package/dist/Schedule/WeeklyView.d.ts +9 -0
  281. package/dist/Schedule/WeeklyView.d.ts.map +1 -0
  282. package/dist/Schedule/WeeklyView.js +112 -0
  283. package/dist/Schedule/context.d.ts +20 -0
  284. package/dist/Schedule/context.d.ts.map +1 -0
  285. package/dist/Schedule/context.js +19 -0
  286. package/dist/Schedule/dateMath.d.ts +21 -0
  287. package/dist/Schedule/dateMath.d.ts.map +1 -0
  288. package/dist/Schedule/dateMath.js +63 -0
  289. package/dist/Schedule/index.d.ts +19 -0
  290. package/dist/Schedule/index.d.ts.map +1 -0
  291. package/dist/Schedule/index.js +17 -0
  292. package/dist/Schedule/plugins/PaginationPlugin.d.ts +7 -0
  293. package/dist/Schedule/plugins/PaginationPlugin.d.ts.map +1 -0
  294. package/dist/Schedule/plugins/PaginationPlugin.js +81 -0
  295. package/dist/Schedule/plugins/ViewSelectorPlugin.d.ts +11 -0
  296. package/dist/Schedule/plugins/ViewSelectorPlugin.d.ts.map +1 -0
  297. package/dist/Schedule/plugins/ViewSelectorPlugin.js +78 -0
  298. package/dist/Schedule/plugins/index.d.ts +5 -0
  299. package/dist/Schedule/plugins/index.d.ts.map +1 -0
  300. package/dist/Schedule/plugins/index.js +14 -0
  301. package/dist/Schedule/shared.d.ts +923 -0
  302. package/dist/Schedule/shared.d.ts.map +1 -0
  303. package/dist/Schedule/shared.js +1325 -0
  304. package/dist/Schedule/types.d.ts +51 -0
  305. package/dist/Schedule/types.d.ts.map +1 -0
  306. package/dist/Schedule/types.js +1 -0
  307. package/dist/Schedule/useCurrentTime.d.ts +3 -0
  308. package/dist/Schedule/useCurrentTime.d.ts.map +1 -0
  309. package/dist/Schedule/useCurrentTime.js +43 -0
  310. package/dist/Schedule/zonedDateTime.d.ts +20 -0
  311. package/dist/Schedule/zonedDateTime.d.ts.map +1 -0
  312. package/dist/Schedule/zonedDateTime.js +31 -0
  313. package/dist/Stepper/Step.d.ts +120 -0
  314. package/dist/Stepper/Step.d.ts.map +1 -0
  315. package/dist/Stepper/Step.js +573 -0
  316. package/dist/Stepper/StepStatus.d.ts +24 -0
  317. package/dist/Stepper/StepStatus.d.ts.map +1 -0
  318. package/dist/Stepper/StepStatus.js +1 -0
  319. package/dist/Stepper/Stepper.d.ts +77 -0
  320. package/dist/Stepper/Stepper.d.ts.map +1 -0
  321. package/dist/Stepper/Stepper.js +104 -0
  322. package/dist/Stepper/StepperContext.d.ts +12 -0
  323. package/dist/Stepper/StepperContext.d.ts.map +1 -0
  324. package/dist/Stepper/StepperContext.js +24 -0
  325. package/dist/Stepper/index.d.ts +8 -0
  326. package/dist/Stepper/index.d.ts.map +1 -0
  327. package/dist/Stepper/index.js +7 -0
  328. package/dist/ThreeD/ThreeDAxis.d.ts +6 -0
  329. package/dist/ThreeD/ThreeDAxis.d.ts.map +1 -0
  330. package/dist/ThreeD/ThreeDAxis.js +75 -0
  331. package/dist/ThreeD/ThreeDBar.d.ts +7 -0
  332. package/dist/ThreeD/ThreeDBar.d.ts.map +1 -0
  333. package/dist/ThreeD/ThreeDBar.js +98 -0
  334. package/dist/ThreeD/ThreeDChart.d.ts +24 -0
  335. package/dist/ThreeD/ThreeDChart.d.ts.map +1 -0
  336. package/dist/ThreeD/ThreeDChart.js +202 -0
  337. package/dist/ThreeD/ThreeDContext.d.ts +5 -0
  338. package/dist/ThreeD/ThreeDContext.d.ts.map +1 -0
  339. package/dist/ThreeD/ThreeDContext.js +19 -0
  340. package/dist/ThreeD/ThreeDGrid.d.ts +5 -0
  341. package/dist/ThreeD/ThreeDGrid.d.ts.map +1 -0
  342. package/dist/ThreeD/ThreeDGrid.js +55 -0
  343. package/dist/ThreeD/ThreeDScatter.d.ts +7 -0
  344. package/dist/ThreeD/ThreeDScatter.d.ts.map +1 -0
  345. package/dist/ThreeD/ThreeDScatter.js +57 -0
  346. package/dist/ThreeD/ThreeDScatterGL.d.ts +7 -0
  347. package/dist/ThreeD/ThreeDScatterGL.d.ts.map +1 -0
  348. package/dist/ThreeD/ThreeDScatterGL.js +243 -0
  349. package/dist/ThreeD/ThreeDSurface.d.ts +15 -0
  350. package/dist/ThreeD/ThreeDSurface.d.ts.map +1 -0
  351. package/dist/ThreeD/ThreeDSurface.js +97 -0
  352. package/dist/ThreeD/index.d.ts +10 -0
  353. package/dist/ThreeD/index.d.ts.map +1 -0
  354. package/dist/ThreeD/index.js +10 -0
  355. package/dist/ThreeD/types.d.ts +57 -0
  356. package/dist/ThreeD/types.d.ts.map +1 -0
  357. package/dist/ThreeD/types.js +1 -0
  358. package/dist/index.d.ts +26 -0
  359. package/dist/index.d.ts.map +1 -0
  360. package/dist/index.js +47 -0
  361. package/dist/lab.css +423 -0
  362. package/package.json +69 -4
  363. package/src/Chart/Chart.tsx +312 -0
  364. package/src/Chart/ChartArea.doc.mjs +16 -0
  365. package/src/Chart/ChartArea.tsx +91 -0
  366. package/src/Chart/ChartAxis.tsx +186 -0
  367. package/src/Chart/ChartBar.doc.mjs +16 -0
  368. package/src/Chart/ChartBar.tsx +71 -0
  369. package/src/Chart/ChartBrush.tsx +237 -0
  370. package/src/Chart/ChartCandlestick.doc.mjs +16 -0
  371. package/src/Chart/ChartCandlestick.tsx +186 -0
  372. package/src/Chart/ChartContext.ts +23 -0
  373. package/src/Chart/ChartDot.doc.mjs +16 -0
  374. package/src/Chart/ChartDot.tsx +44 -0
  375. package/src/Chart/ChartDotGL.doc.mjs +16 -0
  376. package/src/Chart/ChartDotGL.tsx +151 -0
  377. package/src/Chart/ChartDotGLInteractive.doc.mjs +16 -0
  378. package/src/Chart/ChartDotGLInteractive.tsx +519 -0
  379. package/src/Chart/ChartErrorBar.tsx +84 -0
  380. package/src/Chart/ChartGrid.tsx +86 -0
  381. package/src/Chart/ChartHeatmapGL.doc.mjs +16 -0
  382. package/src/Chart/ChartHeatmapGL.tsx +219 -0
  383. package/src/Chart/ChartLegend.tsx +181 -0
  384. package/src/Chart/ChartLine.doc.mjs +16 -0
  385. package/src/Chart/ChartLine.tsx +70 -0
  386. package/src/Chart/ChartReferenceLine.tsx +76 -0
  387. package/src/Chart/ChartSelect.tsx +111 -0
  388. package/src/Chart/ChartStreamGL.doc.mjs +16 -0
  389. package/src/Chart/ChartStreamGL.tsx +189 -0
  390. package/src/Chart/ChartTooltip.tsx +451 -0
  391. package/src/Chart/ChartZoom.tsx +400 -0
  392. package/src/Chart/formatters.ts +95 -0
  393. package/src/Chart/getChartColors.ts +249 -0
  394. package/src/Chart/index.ts +90 -0
  395. package/src/Chart/m4.test.ts +66 -0
  396. package/src/Chart/m4.ts +128 -0
  397. package/src/Chart/types.ts +64 -0
  398. package/src/Chart/useChartColors.ts +34 -0
  399. package/src/Chart/useChartRange.test.ts +101 -0
  400. package/src/Chart/useChartRange.ts +146 -0
  401. package/src/Chart/utils.ts +31 -0
  402. package/src/Chart/webgl.ts +192 -0
  403. package/src/ChartV2/Chart.tsx +348 -0
  404. package/src/ChartV2/ChartAxis.tsx +209 -0
  405. package/src/ChartV2/ChartGrid.tsx +99 -0
  406. package/src/ChartV2/ChartLegend.tsx +69 -0
  407. package/src/ChartV2/ChartSwatch.doc.mjs +17 -0
  408. package/src/ChartV2/ChartSwatch.tsx +86 -0
  409. package/src/ChartV2/ChartTooltip.tsx +382 -0
  410. package/src/ChartV2/ChartV2.doc.mjs +16 -0
  411. package/src/ChartV2/ChartV2Context.ts +15 -0
  412. package/src/ChartV2/index.ts +62 -0
  413. package/src/ChartV2/layout.ts +223 -0
  414. package/src/ChartV2/legend.ts +32 -0
  415. package/src/ChartV2/marks/area.tsx +122 -0
  416. package/src/ChartV2/marks/band.tsx +70 -0
  417. package/src/ChartV2/marks/bar.tsx +159 -0
  418. package/src/ChartV2/marks/candlestick.tsx +106 -0
  419. package/src/ChartV2/marks/dot.tsx +64 -0
  420. package/src/ChartV2/marks/dotGL.tsx +202 -0
  421. package/src/ChartV2/marks/dotGLInteractive.tsx +546 -0
  422. package/src/ChartV2/marks/errorBar.tsx +89 -0
  423. package/src/ChartV2/marks/heatmapGL.tsx +299 -0
  424. package/src/ChartV2/marks/index.ts +14 -0
  425. package/src/ChartV2/marks/line.tsx +94 -0
  426. package/src/ChartV2/marks/referenceLine.tsx +224 -0
  427. package/src/ChartV2/marks/streamGL.tsx +251 -0
  428. package/src/ChartV2/tooltip.ts +70 -0
  429. package/src/ChartV2/types.ts +129 -0
  430. package/src/ChatReasoning/ChatReasoning.doc.mjs +16 -0
  431. package/src/ChatReasoning/ChatReasoning.test.tsx +56 -0
  432. package/src/ChatReasoning/ChatReasoning.tsx +322 -0
  433. package/src/CircularProgress/CircularProgress.doc.mjs +174 -0
  434. package/src/CircularProgress/CircularProgress.test.tsx +157 -0
  435. package/src/CircularProgress/CircularProgress.tsx +373 -0
  436. package/src/CircularProgress/index.ts +15 -0
  437. package/src/CodeBlock/index.ts +10 -0
  438. package/src/CodeEditor/CodeEditor.doc.mjs +16 -0
  439. package/src/CodeEditor/CodeEditor.tsx +466 -0
  440. package/src/CodeEditor/index.ts +8 -0
  441. package/src/Radial/RadialArea.tsx +103 -0
  442. package/src/Radial/RadialAxis.tsx +60 -0
  443. package/src/Radial/RadialChart.doc.mjs +16 -0
  444. package/src/Radial/RadialChart.tsx +219 -0
  445. package/src/Radial/RadialContext.ts +22 -0
  446. package/src/Radial/RadialGrid.tsx +81 -0
  447. package/src/Radial/RadialSlice.tsx +130 -0
  448. package/src/Radial/RadialTooltip.tsx +347 -0
  449. package/src/Radial/index.ts +14 -0
  450. package/src/Radial/types.ts +46 -0
  451. package/src/SVGIcon/SVGIcon.doc.mjs +16 -0
  452. package/src/SVGIcon/SVGIcon.tsx +406 -0
  453. package/src/SVGIcon/icons.ts +283 -0
  454. package/src/SVGIcon/index.ts +73 -0
  455. package/src/SVGIcon/pathTransforms.ts +612 -0
  456. package/src/SVGIcon/tokens.stylex.ts +53 -0
  457. package/src/SVGIcon/variations.stylex.ts +122 -0
  458. package/src/SVGIcon/xif-examples.ts +191 -0
  459. package/src/SVGIcon/xif-types.ts +181 -0
  460. package/src/Sankey/SankeyChart.doc.mjs +16 -0
  461. package/src/Sankey/SankeyChart.tsx +220 -0
  462. package/src/Sankey/SankeyContext.ts +23 -0
  463. package/src/Sankey/SankeyGrid.tsx +69 -0
  464. package/src/Sankey/SankeyLabel.tsx +234 -0
  465. package/src/Sankey/SankeyLink.tsx +167 -0
  466. package/src/Sankey/SankeyNode.tsx +66 -0
  467. package/src/Sankey/index.ts +22 -0
  468. package/src/Sankey/layout.ts +219 -0
  469. package/src/Sankey/types.ts +93 -0
  470. package/src/Schedule/CalendarEvent.ts +74 -0
  471. package/src/Schedule/DayView.tsx +112 -0
  472. package/src/Schedule/ListView.tsx +236 -0
  473. package/src/Schedule/MonthlyView.tsx +401 -0
  474. package/src/Schedule/Schedule.doc.mjs +16 -0
  475. package/src/Schedule/Schedule.test.tsx +405 -0
  476. package/src/Schedule/Schedule.tsx +307 -0
  477. package/src/Schedule/TimeGridView.tsx +589 -0
  478. package/src/Schedule/WeeklyView.tsx +130 -0
  479. package/src/Schedule/context.tsx +49 -0
  480. package/src/Schedule/dateMath.ts +112 -0
  481. package/src/Schedule/index.ts +61 -0
  482. package/src/Schedule/plugins/PaginationPlugin.tsx +98 -0
  483. package/src/Schedule/plugins/ViewSelectorPlugin.tsx +128 -0
  484. package/src/Schedule/plugins/index.tsx +20 -0
  485. package/src/Schedule/shared.tsx +1304 -0
  486. package/src/Schedule/types.ts +86 -0
  487. package/src/Schedule/useCurrentTime.ts +50 -0
  488. package/src/Schedule/zonedDateTime.ts +71 -0
  489. package/src/Stepper/Step.doc.mjs +17 -0
  490. package/src/Stepper/Step.tsx +756 -0
  491. package/src/Stepper/StepStatus.ts +26 -0
  492. package/src/Stepper/Stepper.doc.mjs +265 -0
  493. package/src/Stepper/Stepper.test.tsx +281 -0
  494. package/src/Stepper/Stepper.tsx +157 -0
  495. package/src/Stepper/StepperContext.ts +43 -0
  496. package/src/Stepper/index.ts +14 -0
  497. package/src/ThreeD/3DBar.doc.mjs +16 -0
  498. package/src/ThreeD/3DChart.doc.mjs +16 -0
  499. package/src/ThreeD/3DScatter.doc.mjs +16 -0
  500. package/src/ThreeD/3DScatterGL.doc.mjs +16 -0
  501. package/src/ThreeD/3DSurface.doc.mjs +16 -0
  502. package/src/ThreeD/ThreeDAxis.tsx +86 -0
  503. package/src/ThreeD/ThreeDBar.tsx +130 -0
  504. package/src/ThreeD/ThreeDChart.tsx +262 -0
  505. package/src/ThreeD/ThreeDContext.ts +22 -0
  506. package/src/ThreeD/ThreeDGrid.tsx +68 -0
  507. package/src/ThreeD/ThreeDScatter.tsx +63 -0
  508. package/src/ThreeD/ThreeDScatterGL.tsx +270 -0
  509. package/src/ThreeD/ThreeDSurface.tsx +142 -0
  510. package/src/ThreeD/index.ts +11 -0
  511. package/src/ThreeD/projection.test.ts +132 -0
  512. package/src/ThreeD/types.ts +62 -0
  513. package/src/index.ts +250 -0
@@ -0,0 +1,312 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /**
4
+ * @file Chart.tsx
5
+ * @output Root chart container — sets up SVG, scales, and context
6
+ * @position Parent component; all chart marks/axes/interactions are children
7
+ *
8
+ * Handles the d3 margin convention: outer SVG at full size, inner <g> translated
9
+ * by margins. Children receive scales and dimensions via context.
10
+ */
11
+
12
+ import {
13
+ type CSSProperties,
14
+ type ReactNode,
15
+ useMemo,
16
+ useRef,
17
+ useState,
18
+ useCallback,
19
+ useLayoutEffect,
20
+ } from 'react';
21
+ import {scaleLinear, scaleBand} from 'd3-scale';
22
+ import type {ScaleLinear} from 'd3-scale';
23
+ import {isBandScale} from './utils';
24
+ import {ChartProvider} from './ChartContext';
25
+ import type {ChartMargin, ChartScale} from './types';
26
+
27
+ /**
28
+ * Controls how the y-axis domain is computed:
29
+ * - `'auto'` — includes 0 when all values are positive (default, bar-friendly)
30
+ * - `'zero'` — symmetric range centered on 0 (good for +/- data)
31
+ * - `'data'` — tight fit to data extent only (no forced zero)
32
+ */
33
+ export type YBaseline = 'auto' | 'zero' | 'data';
34
+
35
+ export interface ChartProps {
36
+ /** The dataset — array of objects with consistent keys */
37
+ data: Record<string, unknown>[];
38
+ /**
39
+ * Key for the x-axis domain values.
40
+ * String values produce a band scale; numeric values produce a linear scale.
41
+ */
42
+ xKey: string;
43
+ /**
44
+ * Key(s) for the y-axis domain values.
45
+ * Used to compute the y-domain across all series.
46
+ */
47
+ yKeys: string[];
48
+ /** Chart height in pixels. Width is responsive (fills container). */
49
+ height?: number;
50
+ /** Override default margins */
51
+ margin?: Partial<ChartMargin>;
52
+ /**
53
+ * How the y-axis domain is computed.
54
+ * - `'auto'` — includes 0 when all values are positive (default)
55
+ * - `'zero'` — symmetric around 0 (use for profit/loss, sentiment, etc.)
56
+ * - `'data'` — tight fit to data extent
57
+ */
58
+ yBaseline?: YBaseline;
59
+ /**
60
+ * Explicit y-axis domain [min, max].
61
+ * When provided, this is the y-axis range. Data outside it is not clipped
62
+ * visually but will extend beyond the chart area.
63
+ */
64
+ yDomain?: [number, number];
65
+ /**
66
+ * Explicit x-axis domain [min, max] for linear/time scales.
67
+ * When provided, this is the x-axis range — the chart renders exactly
68
+ * this window. Use for streaming charts where the range shifts over time.
69
+ * Ignored for band (categorical) scales.
70
+ */
71
+ xDomain?: [number, number];
72
+ /**
73
+ * Set touch-action on the chart container. Use 'none' when interactive
74
+ * components (brush, zoom, crosshair) are present to prevent scroll
75
+ * interference on mobile.
76
+ */
77
+ interactive?: boolean;
78
+ /** Chart contents — axes, marks, tooltips */
79
+ children: ReactNode;
80
+ }
81
+
82
+ const DEFAULT_MARGIN: ChartMargin = {top: 16, right: 16, bottom: 32, left: 48};
83
+
84
+ /**
85
+ * Root chart container. Computes scales from data and provides them to children.
86
+ *
87
+ * @example
88
+ * ```
89
+ * <Chart data={data} xKey="month" yKeys={['revenue']} height={300}>
90
+ * <ChartAxis position="bottom" />
91
+ * <ChartAxis position="left" />
92
+ * <ChartBar dataKey="revenue" color={useChartColors().categorical(1)[0]} />
93
+ * </Chart>
94
+ * ```
95
+ */
96
+ export function Chart({
97
+ data,
98
+ xKey,
99
+ yKeys,
100
+ height = 300,
101
+ margin: marginOverride,
102
+ yBaseline = 'auto',
103
+ yDomain: yDomainProp,
104
+ xDomain: xDomainProp,
105
+ interactive = false,
106
+ children,
107
+ }: ChartProps) {
108
+ const containerRef = useRef<HTMLDivElement>(null);
109
+ const svgRef = useRef<SVGSVGElement>(null);
110
+ const [containerWidth, setContainerWidth] = useState(0);
111
+
112
+ useLayoutEffect(() => {
113
+ if (!containerRef.current) {
114
+ return;
115
+ }
116
+ const observer = new ResizeObserver(entries => {
117
+ const entry = entries[0];
118
+ if (entry) {
119
+ setContainerWidth(entry.contentRect.width);
120
+ }
121
+ });
122
+ observer.observe(containerRef.current);
123
+ return () => observer.disconnect();
124
+ }, []);
125
+
126
+ // Block scroll/zoom on the container when interactive.
127
+ // Must be non-passive to actually prevent default on touch events.
128
+ useLayoutEffect(() => {
129
+ const el = containerRef.current;
130
+ if (!el || !interactive) {
131
+ return;
132
+ }
133
+ const prevent = (e: TouchEvent) => e.preventDefault();
134
+ el.addEventListener('touchstart', prevent, {passive: false});
135
+ el.addEventListener('touchmove', prevent, {passive: false});
136
+ return () => {
137
+ el.removeEventListener('touchstart', prevent);
138
+ el.removeEventListener('touchmove', prevent);
139
+ };
140
+ }, [interactive]);
141
+
142
+ const margin = useMemo(
143
+ () => ({...DEFAULT_MARGIN, ...marginOverride}),
144
+ [marginOverride],
145
+ );
146
+
147
+ const innerWidth = Math.max(0, containerWidth - margin.left - margin.right);
148
+ const innerHeight = Math.max(0, height - margin.top - margin.bottom);
149
+
150
+ const xScale = useMemo((): ChartScale => {
151
+ const xValues = data.map(d => d[xKey]);
152
+ const isNumeric = xValues.every(v => typeof v === 'number');
153
+
154
+ if (isNumeric) {
155
+ if (xDomainProp) {
156
+ // Explicit domain is authoritative — use as-is
157
+ return scaleLinear().domain(xDomainProp).range([0, innerWidth]);
158
+ }
159
+ // Auto-compute from data
160
+ const nums = xValues as number[];
161
+ let min = Infinity;
162
+ let max = -Infinity;
163
+ for (const n of nums) {
164
+ if (n < min) {
165
+ min = n;
166
+ }
167
+ if (n > max) {
168
+ max = n;
169
+ }
170
+ }
171
+ return scaleLinear().domain([min, max]).range([0, innerWidth]).nice();
172
+ }
173
+
174
+ // Categorical — xDomain doesn't apply to band scales
175
+ return scaleBand<string>()
176
+ .domain(xValues.map(String))
177
+ .range([0, innerWidth])
178
+ .padding(0.2);
179
+ }, [data, xKey, innerWidth, xDomainProp]);
180
+
181
+ const yScale = useMemo((): ScaleLinear<number, number> => {
182
+ if (yDomainProp) {
183
+ // Explicit domain is authoritative — use as-is.
184
+ // No baseline adjustment, no .nice(). The caller owns the domain
185
+ // (e.g. zoom/pan controls) and rounding would cause ratcheting.
186
+ return scaleLinear().domain(yDomainProp).range([innerHeight, 0]);
187
+ }
188
+
189
+ // Auto-compute from data
190
+ let min = Infinity;
191
+ let max = -Infinity;
192
+ for (const d of data) {
193
+ for (const key of yKeys) {
194
+ const v = d[key];
195
+ if (typeof v === 'number') {
196
+ if (v < min) {
197
+ min = v;
198
+ }
199
+ if (v > max) {
200
+ max = v;
201
+ }
202
+ }
203
+ }
204
+ }
205
+
206
+ if (yBaseline === 'zero') {
207
+ const abs = Math.max(Math.abs(min), Math.abs(max));
208
+ min = -abs;
209
+ max = abs;
210
+ } else if (yBaseline === 'auto') {
211
+ if (min > 0) {
212
+ min = 0;
213
+ }
214
+ if (max < 0) {
215
+ max = 0;
216
+ }
217
+ }
218
+
219
+ return scaleLinear().domain([min, max]).range([innerHeight, 0]).nice();
220
+ }, [data, yKeys, innerHeight, yBaseline, yDomainProp]);
221
+
222
+ const pixelToData = useCallback(
223
+ (px: number, py: number) => {
224
+ const y = yScale.invert(py);
225
+ let x: number | string;
226
+ if (isBandScale(xScale)) {
227
+ const domain = xScale.domain();
228
+ const step = xScale.step();
229
+ const idx = Math.min(
230
+ domain.length - 1,
231
+ Math.max(0, Math.floor(px / step)),
232
+ );
233
+ x = domain[idx];
234
+ } else {
235
+ x = (xScale as ScaleLinear<number, number>).invert(px);
236
+ }
237
+ return {x, y, px, py};
238
+ },
239
+ [xScale, yScale],
240
+ );
241
+
242
+ const pointerToData = useCallback(
243
+ (e: React.PointerEvent) => {
244
+ const svg = svgRef.current;
245
+ if (!svg) {
246
+ return {x: null, y: 0, px: 0, py: 0};
247
+ }
248
+ const pt = svg.createSVGPoint();
249
+ pt.x = e.clientX;
250
+ pt.y = e.clientY;
251
+ // Transform to the inner <g> coordinate space (accounts for margins)
252
+ const gEl = svg.querySelector('g');
253
+ const ctm = gEl?.getScreenCTM?.()?.inverse();
254
+ const local = ctm ? pt.matrixTransform(ctm) : {x: 0, y: 0};
255
+ return pixelToData(local.x, local.y);
256
+ },
257
+ [pixelToData],
258
+ );
259
+
260
+ const ctx = useMemo(
261
+ () => ({
262
+ width: innerWidth,
263
+ height: innerHeight,
264
+ margin,
265
+ xKey,
266
+ data,
267
+ xScale,
268
+ yScale,
269
+ svgRef,
270
+ pointerToData,
271
+ pixelToData,
272
+ }),
273
+ [
274
+ innerWidth,
275
+ innerHeight,
276
+ margin,
277
+ xKey,
278
+ data,
279
+ xScale,
280
+ yScale,
281
+ pointerToData,
282
+ pixelToData,
283
+ ],
284
+ );
285
+
286
+ const containerStyle: CSSProperties = {
287
+ width: '100%',
288
+ touchAction: interactive ? 'none' : undefined,
289
+ userSelect: interactive ? 'none' : undefined,
290
+ };
291
+
292
+ return (
293
+ <div ref={containerRef} style={containerStyle}>
294
+ {containerWidth > 0 && (
295
+ <svg
296
+ ref={svgRef}
297
+ width={containerWidth}
298
+ height={height}
299
+ style={interactive ? {touchAction: 'none'} : undefined}>
300
+ <defs>
301
+ <clipPath id="astryx-chart-plot">
302
+ <rect x={0} y={0} width={innerWidth} height={innerHeight} />
303
+ </clipPath>
304
+ </defs>
305
+ <g transform={`translate(${margin.left},${margin.top})`}>
306
+ <ChartProvider value={ctx}>{children}</ChartProvider>
307
+ </g>
308
+ </svg>
309
+ )}
310
+ </div>
311
+ );
312
+ }
@@ -0,0 +1,16 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /** @type {import('../../core/src/docs-types').ComponentDoc} */
4
+
5
+ export const docs = {
6
+ name: 'ChartArea',
7
+ displayName: 'Chart Area',
8
+ group: 'Chart',
9
+ category: 'Data Visualization',
10
+
11
+ usage: {
12
+ description: '',
13
+ },
14
+
15
+ props: [],
16
+ };
@@ -0,0 +1,91 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /**
4
+ * @file ChartArea.tsx
5
+ * @output Renders a filled area between two y-bounds — confidence intervals, bands, ranges
6
+ * @position Child of Chart; reads scales from context
7
+ */
8
+
9
+ import {useMemo} from 'react';
10
+ import {area, curveMonotoneX} from 'd3-shape';
11
+ import {useChart} from './ChartContext';
12
+ import {xPixel} from './utils';
13
+
14
+ export interface ChartAreaProps {
15
+ /** Data key for the upper bound. If omitted, uses `baseline`. */
16
+ yUpper?: string;
17
+ /** Data key for the lower bound. If omitted, uses `baseline`. */
18
+ yLower?: string;
19
+ /** Fallback data key when only one bound is specified. */
20
+ baseline?: string;
21
+ /** Fill color */
22
+ color: string;
23
+ /** Fill opacity (default: 0.2) */
24
+ opacity?: number;
25
+ /** Optional stroke on the band edges */
26
+ stroke?: boolean;
27
+ /** Stroke width when stroke is enabled */
28
+ strokeWidth?: number;
29
+ }
30
+
31
+ /**
32
+ * Area band between two y-values. Use for confidence intervals, error ranges,
33
+ * or any min/max band around a line.
34
+ *
35
+ * @example
36
+ * ```
37
+ * <ChartArea yUpper="upper95" yLower="lower95" color={colors[0]} />
38
+ * <ChartArea yUpper="upper95" baseline="mean" color={colors[0]} />
39
+ * ```
40
+ */
41
+ export function ChartArea({
42
+ yUpper,
43
+ yLower,
44
+ baseline,
45
+ color,
46
+ opacity = 0.2,
47
+ stroke = false,
48
+ strokeWidth = 1,
49
+ }: ChartAreaProps) {
50
+ const {data, xKey, xScale, yScale} = useChart();
51
+
52
+ const upperKey = yUpper ?? baseline;
53
+ const lowerKey = yLower ?? baseline;
54
+
55
+ const pathD = useMemo(() => {
56
+ if (!upperKey || !lowerKey) {
57
+ return '';
58
+ }
59
+ const generator = area<Record<string, unknown>>()
60
+ .x(d => xPixel(d, xKey, xScale))
61
+ .y0(d => {
62
+ const v = typeof d[lowerKey] === 'number' ? (d[lowerKey] as number) : 0;
63
+ return yScale(v);
64
+ })
65
+ .y1(d => {
66
+ const v = typeof d[upperKey] === 'number' ? (d[upperKey] as number) : 0;
67
+ return yScale(v);
68
+ })
69
+ .curve(curveMonotoneX);
70
+ return generator(data) ?? '';
71
+ }, [data, xKey, xScale, yScale, upperKey, lowerKey]);
72
+
73
+ if (!pathD) {
74
+ return null;
75
+ }
76
+
77
+ return (
78
+ <g>
79
+ <path d={pathD} fill={color} fillOpacity={opacity} stroke="none" />
80
+ {stroke && (
81
+ <path
82
+ d={pathD}
83
+ fill="none"
84
+ stroke={color}
85
+ strokeWidth={strokeWidth}
86
+ strokeOpacity={opacity * 2}
87
+ />
88
+ )}
89
+ </g>
90
+ );
91
+ }
@@ -0,0 +1,186 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /**
4
+ * @file ChartAxis.tsx
5
+ * @output Renders an axis (top, right, bottom, left) using the chart's scales
6
+ * @position Child of Chart; reads scales from context
7
+ *
8
+ * Ticks use CSS transitions for smooth sliding during streaming updates.
9
+ */
10
+
11
+ import {useMemo} from 'react';
12
+ import {useChart} from './ChartContext';
13
+ import {isBandScale} from './utils';
14
+ import type {ScaleLinear, ScaleTime} from 'd3-scale';
15
+
16
+ export interface ChartAxisProps {
17
+ /** Which edge to render the axis on */
18
+ position: 'top' | 'right' | 'bottom' | 'left';
19
+ /** Number of ticks (approximate — d3 decides final count) */
20
+ tickCount?: number;
21
+ /** Maximum number of tick labels to show. Labels are evenly skipped when exceeded. */
22
+ maxTicks?: number;
23
+ /** Custom tick formatter */
24
+ tickFormat?: (value: unknown) => string;
25
+ /** Truncate labels to this many characters (appends "\u2026"). */
26
+ truncate?: number;
27
+ /** Enable smooth transitions for streaming (default: true) */
28
+ animated?: boolean;
29
+ }
30
+
31
+ /**
32
+ * Chart axis. Renders tick marks and labels for the x or y dimension.
33
+ * Ticks transition smoothly when the scale domain shifts (e.g. streaming).
34
+ *
35
+ * @example
36
+ * ```
37
+ * <ChartAxis position="bottom" />
38
+ * <ChartAxis position="left" tickCount={5} tickFormat={currency} />
39
+ * <ChartAxis position="bottom" maxTicks={6} truncate={10} />
40
+ * ```
41
+ */
42
+ export function ChartAxis({
43
+ position,
44
+ tickCount = 5,
45
+ maxTicks,
46
+ tickFormat,
47
+ truncate,
48
+ animated = true,
49
+ }: ChartAxisProps) {
50
+ const {width, height, xScale, yScale} = useChart();
51
+
52
+ const isHorizontal = position === 'top' || position === 'bottom';
53
+ const scale = isHorizontal ? xScale : yScale;
54
+
55
+ const ticks = useMemo(() => {
56
+ let allTicks: {value: unknown; offset: number}[];
57
+ if (isBandScale(scale)) {
58
+ allTicks = scale.domain().map(d => ({
59
+ value: d,
60
+ offset: (scale(d) ?? 0) + scale.bandwidth() / 2,
61
+ }));
62
+ } else {
63
+ const linearScale = scale as
64
+ | ScaleLinear<number, number>
65
+ | ScaleTime<number, number>;
66
+ allTicks = linearScale.ticks(tickCount).map(d => ({
67
+ value: d,
68
+ offset: linearScale(d as number & Date),
69
+ }));
70
+ }
71
+
72
+ // Auto-skip: show every Nth label if maxTicks is exceeded
73
+ if (maxTicks && allTicks.length > maxTicks) {
74
+ const step = Math.ceil(allTicks.length / maxTicks);
75
+ allTicks = allTicks.filter((_, i) => i % step === 0);
76
+ }
77
+
78
+ return allTicks;
79
+ }, [scale, tickCount, maxTicks]);
80
+
81
+ const transform =
82
+ position === 'bottom'
83
+ ? `translate(0,${height})`
84
+ : position === 'right'
85
+ ? `translate(${width},0)`
86
+ : undefined;
87
+
88
+ // For the bottom axis, draw the axis line at y=0 when the domain spans negative values
89
+ const axisLineY = (() => {
90
+ if (position !== 'bottom') {
91
+ return 0;
92
+ }
93
+ const domain = yScale.domain();
94
+ if (domain[0] < 0 && domain[1] > 0) {
95
+ // The axis line should appear at the zero mark relative to the bottom edge
96
+ return yScale(0) - height;
97
+ }
98
+ return 0;
99
+ })();
100
+
101
+ const baseFormat = tickFormat ?? String;
102
+ const format = truncate
103
+ ? (value: unknown) => {
104
+ const str = baseFormat(value);
105
+ return str.length > truncate ? str.slice(0, truncate) + '\u2026' : str;
106
+ }
107
+ : baseFormat;
108
+ const tickSize = 6;
109
+
110
+ // Transition style for smooth tick movement during streaming
111
+ const tickTransition = animated
112
+ ? 'transform 150ms linear, opacity 150ms ease'
113
+ : undefined;
114
+
115
+ return (
116
+ <g transform={transform}>
117
+ {/* Axis line — at y=0 for bottom axis when domain spans negative values */}
118
+ <line
119
+ x1={isHorizontal ? 0 : 0}
120
+ x2={isHorizontal ? width : 0}
121
+ y1={isHorizontal ? axisLineY : 0}
122
+ y2={isHorizontal ? axisLineY : height}
123
+ stroke="var(--color-border-emphasized)"
124
+ strokeWidth={1}
125
+ />
126
+ {ticks.map(({value, offset}) => {
127
+ const label = format(value);
128
+ // Clip ticks that are outside the visible area
129
+ const isVisible = isHorizontal
130
+ ? offset >= -10 && offset <= width + 10
131
+ : offset >= -10 && offset <= height + 10;
132
+
133
+ if (isHorizontal) {
134
+ const y = position === 'bottom' ? tickSize : -tickSize;
135
+ return (
136
+ <g
137
+ key={label}
138
+ style={{
139
+ transform: `translateX(${offset}px)`,
140
+ transition: tickTransition,
141
+ opacity: isVisible ? 1 : 0,
142
+ }}>
143
+ <line
144
+ y2={y}
145
+ stroke="var(--color-border-emphasized)"
146
+ strokeWidth={1}
147
+ />
148
+ <text
149
+ y={position === 'bottom' ? tickSize + 12 : -(tickSize + 4)}
150
+ textAnchor="middle"
151
+ fill="var(--color-text-secondary)"
152
+ fontSize={12}>
153
+ {label}
154
+ </text>
155
+ </g>
156
+ );
157
+ }
158
+ // Vertical axis
159
+ const x = position === 'left' ? -tickSize : tickSize;
160
+ return (
161
+ <g
162
+ key={label}
163
+ style={{
164
+ transform: `translateY(${offset}px)`,
165
+ transition: tickTransition,
166
+ opacity: isVisible ? 1 : 0,
167
+ }}>
168
+ <line
169
+ x2={x}
170
+ stroke="var(--color-border-emphasized)"
171
+ strokeWidth={1}
172
+ />
173
+ <text
174
+ x={position === 'left' ? -(tickSize + 4) : tickSize + 4}
175
+ dy="0.32em"
176
+ textAnchor={position === 'left' ? 'end' : 'start'}
177
+ fill="var(--color-text-secondary)"
178
+ fontSize={12}>
179
+ {label}
180
+ </text>
181
+ </g>
182
+ );
183
+ })}
184
+ </g>
185
+ );
186
+ }
@@ -0,0 +1,16 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /** @type {import('../../core/src/docs-types').ComponentDoc} */
4
+
5
+ export const docs = {
6
+ name: 'ChartBar',
7
+ displayName: 'Chart Bar',
8
+ group: 'Chart',
9
+ category: 'Data Visualization',
10
+
11
+ usage: {
12
+ description: '',
13
+ },
14
+
15
+ props: [],
16
+ };
@@ -0,0 +1,71 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /**
4
+ * @file ChartBar.tsx
5
+ * @output Renders vertical bars for a data key
6
+ * @position Child of Chart; reads scales from context
7
+ */
8
+
9
+ import {useChart} from './ChartContext';
10
+ import {isBandScale} from './utils';
11
+
12
+ export interface ChartBarProps {
13
+ /** Which data key to visualize */
14
+ dataKey: string;
15
+ /** Bar fill color (hex string, CSS var, etc.) */
16
+ color: string;
17
+ /** Corner radius on bar tops */
18
+ radius?: number;
19
+ }
20
+
21
+ /**
22
+ * Bar marks. Requires a band xScale (categorical x-axis).
23
+ * Bars grow from the zero line — handles both positive and negative values.
24
+ *
25
+ * @example
26
+ * ```
27
+ * <ChartBar dataKey="revenue" color={useChartColors().categorical(1)[0]} />
28
+ * ```
29
+ */
30
+ export function ChartBar({dataKey, color, radius = 4}: ChartBarProps) {
31
+ const {data, xKey, xScale, yScale} = useChart();
32
+
33
+ if (!isBandScale(xScale)) {
34
+ return null;
35
+ }
36
+
37
+ // Zero line position — bars grow from here
38
+ const zeroY = yScale(0);
39
+
40
+ return (
41
+ <g>
42
+ {data.map((d, i) => {
43
+ const xVal = xScale(String(d[xKey]));
44
+ if (xVal == null) {
45
+ return null;
46
+ }
47
+
48
+ const yVal =
49
+ typeof d[dataKey] === 'number' ? (d[dataKey] as number) : 0;
50
+ const yPos = yScale(yVal);
51
+
52
+ // Bar grows from zero line toward the value
53
+ const barY = Math.min(yPos, zeroY);
54
+ const barHeight = Math.abs(yPos - zeroY);
55
+
56
+ return (
57
+ <rect
58
+ key={i}
59
+ x={xVal}
60
+ y={barY}
61
+ width={xScale.bandwidth()}
62
+ height={Math.max(0, barHeight)}
63
+ fill={color}
64
+ rx={radius}
65
+ ry={radius}
66
+ />
67
+ );
68
+ })}
69
+ </g>
70
+ );
71
+ }