@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.
- package/CHANGELOG.md +67 -0
- package/LICENSE +21 -0
- package/README.md +47 -1
- package/dist/Chart/Chart.d.ts +77 -0
- package/dist/Chart/Chart.d.ts.map +1 -0
- package/dist/Chart/Chart.js +247 -0
- package/dist/Chart/ChartArea.d.ts +28 -0
- package/dist/Chart/ChartArea.d.ts.map +1 -0
- package/dist/Chart/ChartArea.js +71 -0
- package/dist/Chart/ChartAxis.d.ts +27 -0
- package/dist/Chart/ChartAxis.d.ts.map +1 -0
- package/dist/Chart/ChartAxis.js +147 -0
- package/dist/Chart/ChartBar.d.ts +19 -0
- package/dist/Chart/ChartBar.d.ts.map +1 -0
- package/dist/Chart/ChartBar.js +61 -0
- package/dist/Chart/ChartBrush.d.ts +59 -0
- package/dist/Chart/ChartBrush.d.ts.map +1 -0
- package/dist/Chart/ChartBrush.js +197 -0
- package/dist/Chart/ChartCandlestick.d.ts +50 -0
- package/dist/Chart/ChartCandlestick.d.ts.map +1 -0
- package/dist/Chart/ChartCandlestick.js +138 -0
- package/dist/Chart/ChartContext.d.ts +5 -0
- package/dist/Chart/ChartContext.d.ts.map +1 -0
- package/dist/Chart/ChartContext.js +20 -0
- package/dist/Chart/ChartDot.d.ts +18 -0
- package/dist/Chart/ChartDot.d.ts.map +1 -0
- package/dist/Chart/ChartDot.js +43 -0
- package/dist/Chart/ChartDotGL.d.ts +16 -0
- package/dist/Chart/ChartDotGL.d.ts.map +1 -0
- package/dist/Chart/ChartDotGL.js +135 -0
- package/dist/Chart/ChartDotGLInteractive.d.ts +41 -0
- package/dist/Chart/ChartDotGLInteractive.d.ts.map +1 -0
- package/dist/Chart/ChartDotGLInteractive.js +446 -0
- package/dist/Chart/ChartErrorBar.d.ts +23 -0
- package/dist/Chart/ChartErrorBar.d.ts.map +1 -0
- package/dist/Chart/ChartErrorBar.js +68 -0
- package/dist/Chart/ChartGrid.d.ts +17 -0
- package/dist/Chart/ChartGrid.d.ts.map +1 -0
- package/dist/Chart/ChartGrid.js +67 -0
- package/dist/Chart/ChartHeatmapGL.d.ts +10 -0
- package/dist/Chart/ChartHeatmapGL.d.ts.map +1 -0
- package/dist/Chart/ChartHeatmapGL.js +171 -0
- package/dist/Chart/ChartLegend.d.ts +60 -0
- package/dist/Chart/ChartLegend.d.ts.map +1 -0
- package/dist/Chart/ChartLegend.js +161 -0
- package/dist/Chart/ChartLine.d.ts +23 -0
- package/dist/Chart/ChartLine.d.ts.map +1 -0
- package/dist/Chart/ChartLine.js +64 -0
- package/dist/Chart/ChartReferenceLine.d.ts +11 -0
- package/dist/Chart/ChartReferenceLine.d.ts.map +1 -0
- package/dist/Chart/ChartReferenceLine.js +109 -0
- package/dist/Chart/ChartSelect.d.ts +9 -0
- package/dist/Chart/ChartSelect.d.ts.map +1 -0
- package/dist/Chart/ChartSelect.js +90 -0
- package/dist/Chart/ChartStreamGL.d.ts +17 -0
- package/dist/Chart/ChartStreamGL.d.ts.map +1 -0
- package/dist/Chart/ChartStreamGL.js +157 -0
- package/dist/Chart/ChartTooltip.d.ts +85 -0
- package/dist/Chart/ChartTooltip.d.ts.map +1 -0
- package/dist/Chart/ChartTooltip.js +335 -0
- package/dist/Chart/ChartZoom.d.ts +23 -0
- package/dist/Chart/ChartZoom.d.ts.map +1 -0
- package/dist/Chart/ChartZoom.js +314 -0
- package/dist/Chart/formatters.d.ts +33 -0
- package/dist/Chart/formatters.d.ts.map +1 -0
- package/dist/Chart/formatters.js +101 -0
- package/dist/Chart/getChartColors.d.ts +56 -0
- package/dist/Chart/getChartColors.d.ts.map +1 -0
- package/dist/Chart/getChartColors.js +150 -0
- package/dist/Chart/index.d.ts +29 -0
- package/dist/Chart/index.d.ts.map +1 -0
- package/dist/Chart/index.js +29 -0
- package/dist/Chart/m4.d.ts +36 -0
- package/dist/Chart/m4.d.ts.map +1 -0
- package/dist/Chart/m4.js +106 -0
- package/dist/Chart/types.d.ts +55 -0
- package/dist/Chart/types.d.ts.map +1 -0
- package/dist/Chart/types.js +1 -0
- package/dist/Chart/useChartColors.d.ts +16 -0
- package/dist/Chart/useChartColors.d.ts.map +1 -0
- package/dist/Chart/useChartColors.js +30 -0
- package/dist/Chart/useChartRange.d.ts +50 -0
- package/dist/Chart/useChartRange.d.ts.map +1 -0
- package/dist/Chart/useChartRange.js +90 -0
- package/dist/Chart/utils.d.ts +15 -0
- package/dist/Chart/utils.d.ts.map +1 -0
- package/dist/Chart/utils.js +24 -0
- package/dist/Chart/webgl.d.ts +62 -0
- package/dist/Chart/webgl.d.ts.map +1 -0
- package/dist/Chart/webgl.js +169 -0
- package/dist/ChartV2/Chart.d.ts +32 -0
- package/dist/ChartV2/Chart.d.ts.map +1 -0
- package/dist/ChartV2/Chart.js +281 -0
- package/dist/ChartV2/ChartAxis.d.ts +36 -0
- package/dist/ChartV2/ChartAxis.d.ts.map +1 -0
- package/dist/ChartV2/ChartAxis.js +161 -0
- package/dist/ChartV2/ChartGrid.d.ts +20 -0
- package/dist/ChartV2/ChartGrid.d.ts.map +1 -0
- package/dist/ChartV2/ChartGrid.js +76 -0
- package/dist/ChartV2/ChartLegend.d.ts +14 -0
- package/dist/ChartV2/ChartLegend.d.ts.map +1 -0
- package/dist/ChartV2/ChartLegend.js +54 -0
- package/dist/ChartV2/ChartSwatch.d.ts +36 -0
- package/dist/ChartV2/ChartSwatch.d.ts.map +1 -0
- package/dist/ChartV2/ChartSwatch.js +82 -0
- package/dist/ChartV2/ChartTooltip.d.ts +46 -0
- package/dist/ChartV2/ChartTooltip.d.ts.map +1 -0
- package/dist/ChartV2/ChartTooltip.js +267 -0
- package/dist/ChartV2/ChartV2Context.d.ts +4 -0
- package/dist/ChartV2/ChartV2Context.d.ts.map +1 -0
- package/dist/ChartV2/ChartV2Context.js +12 -0
- package/dist/ChartV2/index.d.ts +13 -0
- package/dist/ChartV2/index.d.ts.map +1 -0
- package/dist/ChartV2/index.js +10 -0
- package/dist/ChartV2/layout.d.ts +25 -0
- package/dist/ChartV2/layout.d.ts.map +1 -0
- package/dist/ChartV2/layout.js +195 -0
- package/dist/ChartV2/legend.d.ts +18 -0
- package/dist/ChartV2/legend.d.ts.map +1 -0
- package/dist/ChartV2/legend.js +24 -0
- package/dist/ChartV2/marks/area.d.ts +19 -0
- package/dist/ChartV2/marks/area.d.ts.map +1 -0
- package/dist/ChartV2/marks/area.js +109 -0
- package/dist/ChartV2/marks/band.d.ts +9 -0
- package/dist/ChartV2/marks/band.d.ts.map +1 -0
- package/dist/ChartV2/marks/band.js +59 -0
- package/dist/ChartV2/marks/bar.d.ts +17 -0
- package/dist/ChartV2/marks/bar.d.ts.map +1 -0
- package/dist/ChartV2/marks/bar.js +120 -0
- package/dist/ChartV2/marks/candlestick.d.ts +15 -0
- package/dist/ChartV2/marks/candlestick.d.ts.map +1 -0
- package/dist/ChartV2/marks/candlestick.js +83 -0
- package/dist/ChartV2/marks/dot.d.ts +15 -0
- package/dist/ChartV2/marks/dot.d.ts.map +1 -0
- package/dist/ChartV2/marks/dot.js +65 -0
- package/dist/ChartV2/marks/dotGL.d.ts +16 -0
- package/dist/ChartV2/marks/dotGL.d.ts.map +1 -0
- package/dist/ChartV2/marks/dotGL.js +178 -0
- package/dist/ChartV2/marks/dotGLInteractive.d.ts +30 -0
- package/dist/ChartV2/marks/dotGLInteractive.d.ts.map +1 -0
- package/dist/ChartV2/marks/dotGLInteractive.js +464 -0
- package/dist/ChartV2/marks/errorBar.d.ts +27 -0
- package/dist/ChartV2/marks/errorBar.d.ts.map +1 -0
- package/dist/ChartV2/marks/errorBar.js +87 -0
- package/dist/ChartV2/marks/heatmapGL.d.ts +23 -0
- package/dist/ChartV2/marks/heatmapGL.d.ts.map +1 -0
- package/dist/ChartV2/marks/heatmapGL.js +242 -0
- package/dist/ChartV2/marks/index.d.ts +13 -0
- package/dist/ChartV2/marks/index.d.ts.map +1 -0
- package/dist/ChartV2/marks/index.js +14 -0
- package/dist/ChartV2/marks/line.d.ts +18 -0
- package/dist/ChartV2/marks/line.d.ts.map +1 -0
- package/dist/ChartV2/marks/line.js +76 -0
- package/dist/ChartV2/marks/referenceLine.d.ts +35 -0
- package/dist/ChartV2/marks/referenceLine.d.ts.map +1 -0
- package/dist/ChartV2/marks/referenceLine.js +186 -0
- package/dist/ChartV2/marks/streamGL.d.ts +36 -0
- package/dist/ChartV2/marks/streamGL.d.ts.map +1 -0
- package/dist/ChartV2/marks/streamGL.js +204 -0
- package/dist/ChartV2/tooltip.d.ts +38 -0
- package/dist/ChartV2/tooltip.d.ts.map +1 -0
- package/dist/ChartV2/tooltip.js +54 -0
- package/dist/ChartV2/types.d.ts +115 -0
- package/dist/ChartV2/types.d.ts.map +1 -0
- package/dist/ChartV2/types.js +35 -0
- package/dist/ChatReasoning/ChatReasoning.d.ts +51 -0
- package/dist/ChatReasoning/ChatReasoning.d.ts.map +1 -0
- package/dist/ChatReasoning/ChatReasoning.js +236 -0
- package/dist/CircularProgress/CircularProgress.d.ts +101 -0
- package/dist/CircularProgress/CircularProgress.d.ts.map +1 -0
- package/dist/CircularProgress/CircularProgress.js +263 -0
- package/dist/CircularProgress/index.d.ts +6 -0
- package/dist/CircularProgress/index.d.ts.map +1 -0
- package/dist/CircularProgress/index.js +8 -0
- package/dist/CodeBlock/index.d.ts +8 -0
- package/dist/CodeBlock/index.d.ts.map +1 -0
- package/dist/CodeBlock/index.js +9 -0
- package/dist/CodeEditor/CodeEditor.d.ts +46 -0
- package/dist/CodeEditor/CodeEditor.d.ts.map +1 -0
- package/dist/CodeEditor/CodeEditor.js +396 -0
- package/dist/CodeEditor/index.d.ts +6 -0
- package/dist/CodeEditor/index.d.ts.map +1 -0
- package/dist/CodeEditor/index.js +7 -0
- package/dist/Radial/RadialArea.d.ts +25 -0
- package/dist/Radial/RadialArea.d.ts.map +1 -0
- package/dist/Radial/RadialArea.js +91 -0
- package/dist/Radial/RadialAxis.d.ts +14 -0
- package/dist/Radial/RadialAxis.d.ts.map +1 -0
- package/dist/Radial/RadialAxis.js +55 -0
- package/dist/Radial/RadialChart.d.ts +70 -0
- package/dist/Radial/RadialChart.d.ts.map +1 -0
- package/dist/Radial/RadialChart.js +174 -0
- package/dist/Radial/RadialContext.d.ts +5 -0
- package/dist/Radial/RadialContext.d.ts.map +1 -0
- package/dist/Radial/RadialContext.js +19 -0
- package/dist/Radial/RadialGrid.d.ts +14 -0
- package/dist/Radial/RadialGrid.d.ts.map +1 -0
- package/dist/Radial/RadialGrid.js +70 -0
- package/dist/Radial/RadialSlice.d.ts +23 -0
- package/dist/Radial/RadialSlice.d.ts.map +1 -0
- package/dist/Radial/RadialSlice.js +85 -0
- package/dist/Radial/RadialTooltip.d.ts +44 -0
- package/dist/Radial/RadialTooltip.d.ts.map +1 -0
- package/dist/Radial/RadialTooltip.js +284 -0
- package/dist/Radial/index.d.ts +9 -0
- package/dist/Radial/index.d.ts.map +1 -0
- package/dist/Radial/index.js +9 -0
- package/dist/Radial/types.d.ts +39 -0
- package/dist/Radial/types.d.ts.map +1 -0
- package/dist/Radial/types.js +1 -0
- package/dist/SVGIcon/SVGIcon.d.ts +87 -0
- package/dist/SVGIcon/SVGIcon.d.ts.map +1 -0
- package/dist/SVGIcon/SVGIcon.js +299 -0
- package/dist/SVGIcon/icons.d.ts +49 -0
- package/dist/SVGIcon/icons.d.ts.map +1 -0
- package/dist/SVGIcon/icons.js +326 -0
- package/dist/SVGIcon/index.d.ts +15 -0
- package/dist/SVGIcon/index.d.ts.map +1 -0
- package/dist/SVGIcon/index.js +22 -0
- package/dist/SVGIcon/pathTransforms.d.ts +35 -0
- package/dist/SVGIcon/pathTransforms.d.ts.map +1 -0
- package/dist/SVGIcon/pathTransforms.js +644 -0
- package/dist/SVGIcon/tokens.stylex.d.ts +37 -0
- package/dist/SVGIcon/tokens.stylex.d.ts.map +1 -0
- package/dist/SVGIcon/tokens.stylex.js +40 -0
- package/dist/SVGIcon/variations.stylex.d.ts +44 -0
- package/dist/SVGIcon/variations.stylex.d.ts.map +1 -0
- package/dist/SVGIcon/variations.stylex.js +119 -0
- package/dist/SVGIcon/xif-examples.d.ts +22 -0
- package/dist/SVGIcon/xif-examples.d.ts.map +1 -0
- package/dist/SVGIcon/xif-examples.js +202 -0
- package/dist/SVGIcon/xif-types.d.ts +129 -0
- package/dist/SVGIcon/xif-types.d.ts.map +1 -0
- package/dist/SVGIcon/xif-types.js +1 -0
- package/dist/Sankey/SankeyChart.d.ts +72 -0
- package/dist/Sankey/SankeyChart.d.ts.map +1 -0
- package/dist/Sankey/SankeyChart.js +162 -0
- package/dist/Sankey/SankeyContext.d.ts +5 -0
- package/dist/Sankey/SankeyContext.d.ts.map +1 -0
- package/dist/Sankey/SankeyContext.js +20 -0
- package/dist/Sankey/SankeyGrid.d.ts +20 -0
- package/dist/Sankey/SankeyGrid.d.ts.map +1 -0
- package/dist/Sankey/SankeyGrid.js +53 -0
- package/dist/Sankey/SankeyLabel.d.ts +11 -0
- package/dist/Sankey/SankeyLabel.d.ts.map +1 -0
- package/dist/Sankey/SankeyLabel.js +179 -0
- package/dist/Sankey/SankeyLink.d.ts +29 -0
- package/dist/Sankey/SankeyLink.d.ts.map +1 -0
- package/dist/Sankey/SankeyLink.js +139 -0
- package/dist/Sankey/SankeyNode.d.ts +15 -0
- package/dist/Sankey/SankeyNode.d.ts.map +1 -0
- package/dist/Sankey/SankeyNode.js +56 -0
- package/dist/Sankey/index.d.ts +8 -0
- package/dist/Sankey/index.d.ts.map +1 -0
- package/dist/Sankey/index.js +8 -0
- package/dist/Sankey/layout.d.ts +26 -0
- package/dist/Sankey/layout.d.ts.map +1 -0
- package/dist/Sankey/layout.js +157 -0
- package/dist/Sankey/types.d.ts +84 -0
- package/dist/Sankey/types.d.ts.map +1 -0
- package/dist/Sankey/types.js +1 -0
- package/dist/Schedule/CalendarEvent.d.ts +36 -0
- package/dist/Schedule/CalendarEvent.d.ts.map +1 -0
- package/dist/Schedule/CalendarEvent.js +35 -0
- package/dist/Schedule/DayView.d.ts +8 -0
- package/dist/Schedule/DayView.d.ts.map +1 -0
- package/dist/Schedule/DayView.js +105 -0
- package/dist/Schedule/ListView.d.ts +6 -0
- package/dist/Schedule/ListView.d.ts.map +1 -0
- package/dist/Schedule/ListView.js +171 -0
- package/dist/Schedule/MonthlyView.d.ts +6 -0
- package/dist/Schedule/MonthlyView.d.ts.map +1 -0
- package/dist/Schedule/MonthlyView.js +270 -0
- package/dist/Schedule/Schedule.d.ts +22 -0
- package/dist/Schedule/Schedule.d.ts.map +1 -0
- package/dist/Schedule/Schedule.js +185 -0
- package/dist/Schedule/TimeGridView.d.ts +12 -0
- package/dist/Schedule/TimeGridView.d.ts.map +1 -0
- package/dist/Schedule/TimeGridView.js +364 -0
- package/dist/Schedule/WeeklyView.d.ts +9 -0
- package/dist/Schedule/WeeklyView.d.ts.map +1 -0
- package/dist/Schedule/WeeklyView.js +112 -0
- package/dist/Schedule/context.d.ts +20 -0
- package/dist/Schedule/context.d.ts.map +1 -0
- package/dist/Schedule/context.js +19 -0
- package/dist/Schedule/dateMath.d.ts +21 -0
- package/dist/Schedule/dateMath.d.ts.map +1 -0
- package/dist/Schedule/dateMath.js +63 -0
- package/dist/Schedule/index.d.ts +19 -0
- package/dist/Schedule/index.d.ts.map +1 -0
- package/dist/Schedule/index.js +17 -0
- package/dist/Schedule/plugins/PaginationPlugin.d.ts +7 -0
- package/dist/Schedule/plugins/PaginationPlugin.d.ts.map +1 -0
- package/dist/Schedule/plugins/PaginationPlugin.js +81 -0
- package/dist/Schedule/plugins/ViewSelectorPlugin.d.ts +11 -0
- package/dist/Schedule/plugins/ViewSelectorPlugin.d.ts.map +1 -0
- package/dist/Schedule/plugins/ViewSelectorPlugin.js +78 -0
- package/dist/Schedule/plugins/index.d.ts +5 -0
- package/dist/Schedule/plugins/index.d.ts.map +1 -0
- package/dist/Schedule/plugins/index.js +14 -0
- package/dist/Schedule/shared.d.ts +923 -0
- package/dist/Schedule/shared.d.ts.map +1 -0
- package/dist/Schedule/shared.js +1325 -0
- package/dist/Schedule/types.d.ts +51 -0
- package/dist/Schedule/types.d.ts.map +1 -0
- package/dist/Schedule/types.js +1 -0
- package/dist/Schedule/useCurrentTime.d.ts +3 -0
- package/dist/Schedule/useCurrentTime.d.ts.map +1 -0
- package/dist/Schedule/useCurrentTime.js +43 -0
- package/dist/Schedule/zonedDateTime.d.ts +20 -0
- package/dist/Schedule/zonedDateTime.d.ts.map +1 -0
- package/dist/Schedule/zonedDateTime.js +31 -0
- package/dist/Stepper/Step.d.ts +120 -0
- package/dist/Stepper/Step.d.ts.map +1 -0
- package/dist/Stepper/Step.js +573 -0
- package/dist/Stepper/StepStatus.d.ts +24 -0
- package/dist/Stepper/StepStatus.d.ts.map +1 -0
- package/dist/Stepper/StepStatus.js +1 -0
- package/dist/Stepper/Stepper.d.ts +77 -0
- package/dist/Stepper/Stepper.d.ts.map +1 -0
- package/dist/Stepper/Stepper.js +104 -0
- package/dist/Stepper/StepperContext.d.ts +12 -0
- package/dist/Stepper/StepperContext.d.ts.map +1 -0
- package/dist/Stepper/StepperContext.js +24 -0
- package/dist/Stepper/index.d.ts +8 -0
- package/dist/Stepper/index.d.ts.map +1 -0
- package/dist/Stepper/index.js +7 -0
- package/dist/ThreeD/ThreeDAxis.d.ts +6 -0
- package/dist/ThreeD/ThreeDAxis.d.ts.map +1 -0
- package/dist/ThreeD/ThreeDAxis.js +75 -0
- package/dist/ThreeD/ThreeDBar.d.ts +7 -0
- package/dist/ThreeD/ThreeDBar.d.ts.map +1 -0
- package/dist/ThreeD/ThreeDBar.js +98 -0
- package/dist/ThreeD/ThreeDChart.d.ts +24 -0
- package/dist/ThreeD/ThreeDChart.d.ts.map +1 -0
- package/dist/ThreeD/ThreeDChart.js +202 -0
- package/dist/ThreeD/ThreeDContext.d.ts +5 -0
- package/dist/ThreeD/ThreeDContext.d.ts.map +1 -0
- package/dist/ThreeD/ThreeDContext.js +19 -0
- package/dist/ThreeD/ThreeDGrid.d.ts +5 -0
- package/dist/ThreeD/ThreeDGrid.d.ts.map +1 -0
- package/dist/ThreeD/ThreeDGrid.js +55 -0
- package/dist/ThreeD/ThreeDScatter.d.ts +7 -0
- package/dist/ThreeD/ThreeDScatter.d.ts.map +1 -0
- package/dist/ThreeD/ThreeDScatter.js +57 -0
- package/dist/ThreeD/ThreeDScatterGL.d.ts +7 -0
- package/dist/ThreeD/ThreeDScatterGL.d.ts.map +1 -0
- package/dist/ThreeD/ThreeDScatterGL.js +243 -0
- package/dist/ThreeD/ThreeDSurface.d.ts +15 -0
- package/dist/ThreeD/ThreeDSurface.d.ts.map +1 -0
- package/dist/ThreeD/ThreeDSurface.js +97 -0
- package/dist/ThreeD/index.d.ts +10 -0
- package/dist/ThreeD/index.d.ts.map +1 -0
- package/dist/ThreeD/index.js +10 -0
- package/dist/ThreeD/types.d.ts +57 -0
- package/dist/ThreeD/types.d.ts.map +1 -0
- package/dist/ThreeD/types.js +1 -0
- package/dist/index.d.ts +26 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +47 -0
- package/dist/lab.css +423 -0
- package/package.json +69 -4
- package/src/Chart/Chart.tsx +312 -0
- package/src/Chart/ChartArea.doc.mjs +16 -0
- package/src/Chart/ChartArea.tsx +91 -0
- package/src/Chart/ChartAxis.tsx +186 -0
- package/src/Chart/ChartBar.doc.mjs +16 -0
- package/src/Chart/ChartBar.tsx +71 -0
- package/src/Chart/ChartBrush.tsx +237 -0
- package/src/Chart/ChartCandlestick.doc.mjs +16 -0
- package/src/Chart/ChartCandlestick.tsx +186 -0
- package/src/Chart/ChartContext.ts +23 -0
- package/src/Chart/ChartDot.doc.mjs +16 -0
- package/src/Chart/ChartDot.tsx +44 -0
- package/src/Chart/ChartDotGL.doc.mjs +16 -0
- package/src/Chart/ChartDotGL.tsx +151 -0
- package/src/Chart/ChartDotGLInteractive.doc.mjs +16 -0
- package/src/Chart/ChartDotGLInteractive.tsx +519 -0
- package/src/Chart/ChartErrorBar.tsx +84 -0
- package/src/Chart/ChartGrid.tsx +86 -0
- package/src/Chart/ChartHeatmapGL.doc.mjs +16 -0
- package/src/Chart/ChartHeatmapGL.tsx +219 -0
- package/src/Chart/ChartLegend.tsx +181 -0
- package/src/Chart/ChartLine.doc.mjs +16 -0
- package/src/Chart/ChartLine.tsx +70 -0
- package/src/Chart/ChartReferenceLine.tsx +76 -0
- package/src/Chart/ChartSelect.tsx +111 -0
- package/src/Chart/ChartStreamGL.doc.mjs +16 -0
- package/src/Chart/ChartStreamGL.tsx +189 -0
- package/src/Chart/ChartTooltip.tsx +451 -0
- package/src/Chart/ChartZoom.tsx +400 -0
- package/src/Chart/formatters.ts +95 -0
- package/src/Chart/getChartColors.ts +249 -0
- package/src/Chart/index.ts +90 -0
- package/src/Chart/m4.test.ts +66 -0
- package/src/Chart/m4.ts +128 -0
- package/src/Chart/types.ts +64 -0
- package/src/Chart/useChartColors.ts +34 -0
- package/src/Chart/useChartRange.test.ts +101 -0
- package/src/Chart/useChartRange.ts +146 -0
- package/src/Chart/utils.ts +31 -0
- package/src/Chart/webgl.ts +192 -0
- package/src/ChartV2/Chart.tsx +348 -0
- package/src/ChartV2/ChartAxis.tsx +209 -0
- package/src/ChartV2/ChartGrid.tsx +99 -0
- package/src/ChartV2/ChartLegend.tsx +69 -0
- package/src/ChartV2/ChartSwatch.doc.mjs +17 -0
- package/src/ChartV2/ChartSwatch.tsx +86 -0
- package/src/ChartV2/ChartTooltip.tsx +382 -0
- package/src/ChartV2/ChartV2.doc.mjs +16 -0
- package/src/ChartV2/ChartV2Context.ts +15 -0
- package/src/ChartV2/index.ts +62 -0
- package/src/ChartV2/layout.ts +223 -0
- package/src/ChartV2/legend.ts +32 -0
- package/src/ChartV2/marks/area.tsx +122 -0
- package/src/ChartV2/marks/band.tsx +70 -0
- package/src/ChartV2/marks/bar.tsx +159 -0
- package/src/ChartV2/marks/candlestick.tsx +106 -0
- package/src/ChartV2/marks/dot.tsx +64 -0
- package/src/ChartV2/marks/dotGL.tsx +202 -0
- package/src/ChartV2/marks/dotGLInteractive.tsx +546 -0
- package/src/ChartV2/marks/errorBar.tsx +89 -0
- package/src/ChartV2/marks/heatmapGL.tsx +299 -0
- package/src/ChartV2/marks/index.ts +14 -0
- package/src/ChartV2/marks/line.tsx +94 -0
- package/src/ChartV2/marks/referenceLine.tsx +224 -0
- package/src/ChartV2/marks/streamGL.tsx +251 -0
- package/src/ChartV2/tooltip.ts +70 -0
- package/src/ChartV2/types.ts +129 -0
- package/src/ChatReasoning/ChatReasoning.doc.mjs +16 -0
- package/src/ChatReasoning/ChatReasoning.test.tsx +56 -0
- package/src/ChatReasoning/ChatReasoning.tsx +322 -0
- package/src/CircularProgress/CircularProgress.doc.mjs +174 -0
- package/src/CircularProgress/CircularProgress.test.tsx +157 -0
- package/src/CircularProgress/CircularProgress.tsx +373 -0
- package/src/CircularProgress/index.ts +15 -0
- package/src/CodeBlock/index.ts +10 -0
- package/src/CodeEditor/CodeEditor.doc.mjs +16 -0
- package/src/CodeEditor/CodeEditor.tsx +466 -0
- package/src/CodeEditor/index.ts +8 -0
- package/src/Radial/RadialArea.tsx +103 -0
- package/src/Radial/RadialAxis.tsx +60 -0
- package/src/Radial/RadialChart.doc.mjs +16 -0
- package/src/Radial/RadialChart.tsx +219 -0
- package/src/Radial/RadialContext.ts +22 -0
- package/src/Radial/RadialGrid.tsx +81 -0
- package/src/Radial/RadialSlice.tsx +130 -0
- package/src/Radial/RadialTooltip.tsx +347 -0
- package/src/Radial/index.ts +14 -0
- package/src/Radial/types.ts +46 -0
- package/src/SVGIcon/SVGIcon.doc.mjs +16 -0
- package/src/SVGIcon/SVGIcon.tsx +406 -0
- package/src/SVGIcon/icons.ts +283 -0
- package/src/SVGIcon/index.ts +73 -0
- package/src/SVGIcon/pathTransforms.ts +612 -0
- package/src/SVGIcon/tokens.stylex.ts +53 -0
- package/src/SVGIcon/variations.stylex.ts +122 -0
- package/src/SVGIcon/xif-examples.ts +191 -0
- package/src/SVGIcon/xif-types.ts +181 -0
- package/src/Sankey/SankeyChart.doc.mjs +16 -0
- package/src/Sankey/SankeyChart.tsx +220 -0
- package/src/Sankey/SankeyContext.ts +23 -0
- package/src/Sankey/SankeyGrid.tsx +69 -0
- package/src/Sankey/SankeyLabel.tsx +234 -0
- package/src/Sankey/SankeyLink.tsx +167 -0
- package/src/Sankey/SankeyNode.tsx +66 -0
- package/src/Sankey/index.ts +22 -0
- package/src/Sankey/layout.ts +219 -0
- package/src/Sankey/types.ts +93 -0
- package/src/Schedule/CalendarEvent.ts +74 -0
- package/src/Schedule/DayView.tsx +112 -0
- package/src/Schedule/ListView.tsx +236 -0
- package/src/Schedule/MonthlyView.tsx +401 -0
- package/src/Schedule/Schedule.doc.mjs +16 -0
- package/src/Schedule/Schedule.test.tsx +405 -0
- package/src/Schedule/Schedule.tsx +307 -0
- package/src/Schedule/TimeGridView.tsx +589 -0
- package/src/Schedule/WeeklyView.tsx +130 -0
- package/src/Schedule/context.tsx +49 -0
- package/src/Schedule/dateMath.ts +112 -0
- package/src/Schedule/index.ts +61 -0
- package/src/Schedule/plugins/PaginationPlugin.tsx +98 -0
- package/src/Schedule/plugins/ViewSelectorPlugin.tsx +128 -0
- package/src/Schedule/plugins/index.tsx +20 -0
- package/src/Schedule/shared.tsx +1304 -0
- package/src/Schedule/types.ts +86 -0
- package/src/Schedule/useCurrentTime.ts +50 -0
- package/src/Schedule/zonedDateTime.ts +71 -0
- package/src/Stepper/Step.doc.mjs +17 -0
- package/src/Stepper/Step.tsx +756 -0
- package/src/Stepper/StepStatus.ts +26 -0
- package/src/Stepper/Stepper.doc.mjs +265 -0
- package/src/Stepper/Stepper.test.tsx +281 -0
- package/src/Stepper/Stepper.tsx +157 -0
- package/src/Stepper/StepperContext.ts +43 -0
- package/src/Stepper/index.ts +14 -0
- package/src/ThreeD/3DBar.doc.mjs +16 -0
- package/src/ThreeD/3DChart.doc.mjs +16 -0
- package/src/ThreeD/3DScatter.doc.mjs +16 -0
- package/src/ThreeD/3DScatterGL.doc.mjs +16 -0
- package/src/ThreeD/3DSurface.doc.mjs +16 -0
- package/src/ThreeD/ThreeDAxis.tsx +86 -0
- package/src/ThreeD/ThreeDBar.tsx +130 -0
- package/src/ThreeD/ThreeDChart.tsx +262 -0
- package/src/ThreeD/ThreeDContext.ts +22 -0
- package/src/ThreeD/ThreeDGrid.tsx +68 -0
- package/src/ThreeD/ThreeDScatter.tsx +63 -0
- package/src/ThreeD/ThreeDScatterGL.tsx +270 -0
- package/src/ThreeD/ThreeDSurface.tsx +142 -0
- package/src/ThreeD/index.ts +11 -0
- package/src/ThreeD/projection.test.ts +132 -0
- package/src/ThreeD/types.ts +62 -0
- package/src/index.ts +250 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# @xds/lab
|
|
2
|
+
|
|
3
|
+
# 0.1.2
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# 0.1.1
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# 0.1.0
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
# 0.0.15
|
|
16
|
+
|
|
17
|
+
#### Breaking Changes
|
|
18
|
+
|
|
19
|
+
- **Fully unprefixed** — `@xds/lab` drops the `XDS*` prefix entirely (no compat aliases): import `Stepper`, `Step`, `ChartV2`, `Schedule`, etc. directly. (#2954)
|
|
20
|
+
|
|
21
|
+
#### New Components
|
|
22
|
+
|
|
23
|
+
- **Stepper / Step** — Moved here from `@xds/core` for an API rework; visual overhaul with a segmented bar, indicator modes, and density. (#2335, #2308)
|
|
24
|
+
- **Schedule** — New scheduling component. (#2366)
|
|
25
|
+
|
|
26
|
+
#### New Features
|
|
27
|
+
|
|
28
|
+
- **ChartV2** — New v2 axis + grid with composable styling, plus tooltip, axis formatters, and tick controls. (#2287, #2189)
|
|
29
|
+
|
|
30
|
+
#### Fixes
|
|
31
|
+
|
|
32
|
+
- Adopt `handleRef` for imperative component handles, and rebrand internal SVG ids `xds-` → `astryx-`. (#2363, #2952)
|
|
33
|
+
|
|
34
|
+
# 0.0.13
|
|
35
|
+
|
|
36
|
+
#### New Features
|
|
37
|
+
|
|
38
|
+
- **XDSChart** — Composable d3-based chart components (#1389)
|
|
39
|
+
- **XDSChartColors** — Palette accessor for data visualization (#1388)
|
|
40
|
+
- **XDSSankeyChart** — Ribbon-based flow visualization (#1516)
|
|
41
|
+
- **Advanced charts** — WebGL, streaming, confidence intervals, candlestick (#1397)
|
|
42
|
+
- **Radial charts + 3D charts** + `useXDSChartRange` (#1440)
|
|
43
|
+
- **Chart interactions** — brush, crosshair, zoom, select, highlight, reference lines (#1463)
|
|
44
|
+
- **Chart v2 architecture** — config model with series renderers (#1548, #1730)
|
|
45
|
+
|
|
46
|
+
#### Fixes
|
|
47
|
+
|
|
48
|
+
- Chart Tier 1 correctness — xKey in context, bars from zero (#1402)
|
|
49
|
+
- Chart Tier 2 — remove hardcoded colors, document DPR contract (#1424)
|
|
50
|
+
- Rewrite zoom/pan + fix yDomain ratcheting (#1527)
|
|
51
|
+
- Merge Crosshair into Tooltip, use XDS Layer for top-layer rendering (#1514)
|
|
52
|
+
- CodeEditor: perf/theme stories, remove span fallback (#1470)
|
|
53
|
+
- CodeBlock: per-line tokens, skip default color, fix `::highlight` selectors (#1369)
|
|
54
|
+
|
|
55
|
+
#### Patch Changes
|
|
56
|
+
|
|
57
|
+
- Updated dependencies
|
|
58
|
+
- @xds/core@0.0.13
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
# 0.0.5
|
|
63
|
+
|
|
64
|
+
#### Patch Changes
|
|
65
|
+
|
|
66
|
+
- Updated dependencies
|
|
67
|
+
- @xds/core@0.0.5
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Meta Platforms, Inc.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1 +1,47 @@
|
|
|
1
|
-
|
|
1
|
+
# @astryxdesign/lab
|
|
2
|
+
|
|
3
|
+
Experimental Astryx components. This package is a staging area for components being developed before graduating to `@astryxdesign/core`. It ships to npm **only under the `@canary` dist-tag** — there is never a stable (`latest`) release.
|
|
4
|
+
|
|
5
|
+
## Purpose
|
|
6
|
+
|
|
7
|
+
Components in lab:
|
|
8
|
+
|
|
9
|
+
- Are importable in storybook and sandbox for testing
|
|
10
|
+
- Are publishable for early external testing via the `@canary` tag only
|
|
11
|
+
- Can be iterated on freely without worrying about breaking stable consumers
|
|
12
|
+
- Compose with `@astryxdesign/core` components (use the theme, follow naming conventions)
|
|
13
|
+
- Graduate to `@astryxdesign/core` after thorough engineering review
|
|
14
|
+
|
|
15
|
+
## What's here vs what's in core
|
|
16
|
+
|
|
17
|
+
**Lab:** Works, has basic props, maybe has stories. API might change. Not accessibility-hardened, not vibe-tested, not fully themed. **Canary-only — no stability promise.**
|
|
18
|
+
|
|
19
|
+
**Core:** Full keyboard/a11y, hover guards, theming story, status states, spec compliance, vibe tested. Shipped to consumers on `latest`.
|
|
20
|
+
|
|
21
|
+
## Usage
|
|
22
|
+
|
|
23
|
+
Inside the monorepo (storybook/sandbox), imports resolve via pnpm workspaces:
|
|
24
|
+
|
|
25
|
+
```tsx
|
|
26
|
+
import {CodeEditor} from '@astryxdesign/lab';
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### Trying lab components in your own project (canary)
|
|
30
|
+
|
|
31
|
+
Lab is published **only** under the `@canary` dist-tag, so you must request that tag explicitly. There is no `latest` version to install.
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
npm install @astryxdesign/lab@canary @astryxdesign/core@canary
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
```tsx
|
|
38
|
+
import {CodeEditor} from '@astryxdesign/lab';
|
|
39
|
+
import '@astryxdesign/core/astryx.css';
|
|
40
|
+
import '@astryxdesign/lab/lab.css';
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
> Canary builds track the latest commit on `main` (`0.x.y-canary.<sha>`). They can break between any two versions — pin an exact version if you need stability.
|
|
44
|
+
|
|
45
|
+
## Why no stable release?
|
|
46
|
+
|
|
47
|
+
`package.json` keeps `"private": true` plus an `"astryx": { "canaryOnly": true }` marker. The release workflow's stable (`latest`) job skips both private and `canaryOnly` packages, while the canary job strips `private` in its ephemeral CI checkout only (never in git) to publish the `@canary` tag. The committed `private: true` is npm's hard guarantee that no stable publish can ever happen — **do not remove it.**
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Chart.tsx
|
|
3
|
+
* @output Root chart container — sets up SVG, scales, and context
|
|
4
|
+
* @position Parent component; all chart marks/axes/interactions are children
|
|
5
|
+
*
|
|
6
|
+
* Handles the d3 margin convention: outer SVG at full size, inner <g> translated
|
|
7
|
+
* by margins. Children receive scales and dimensions via context.
|
|
8
|
+
*/
|
|
9
|
+
import { type ReactNode } from 'react';
|
|
10
|
+
import type { ChartMargin } from './types';
|
|
11
|
+
/**
|
|
12
|
+
* Controls how the y-axis domain is computed:
|
|
13
|
+
* - `'auto'` — includes 0 when all values are positive (default, bar-friendly)
|
|
14
|
+
* - `'zero'` — symmetric range centered on 0 (good for +/- data)
|
|
15
|
+
* - `'data'` — tight fit to data extent only (no forced zero)
|
|
16
|
+
*/
|
|
17
|
+
export type YBaseline = 'auto' | 'zero' | 'data';
|
|
18
|
+
export interface ChartProps {
|
|
19
|
+
/** The dataset — array of objects with consistent keys */
|
|
20
|
+
data: Record<string, unknown>[];
|
|
21
|
+
/**
|
|
22
|
+
* Key for the x-axis domain values.
|
|
23
|
+
* String values produce a band scale; numeric values produce a linear scale.
|
|
24
|
+
*/
|
|
25
|
+
xKey: string;
|
|
26
|
+
/**
|
|
27
|
+
* Key(s) for the y-axis domain values.
|
|
28
|
+
* Used to compute the y-domain across all series.
|
|
29
|
+
*/
|
|
30
|
+
yKeys: string[];
|
|
31
|
+
/** Chart height in pixels. Width is responsive (fills container). */
|
|
32
|
+
height?: number;
|
|
33
|
+
/** Override default margins */
|
|
34
|
+
margin?: Partial<ChartMargin>;
|
|
35
|
+
/**
|
|
36
|
+
* How the y-axis domain is computed.
|
|
37
|
+
* - `'auto'` — includes 0 when all values are positive (default)
|
|
38
|
+
* - `'zero'` — symmetric around 0 (use for profit/loss, sentiment, etc.)
|
|
39
|
+
* - `'data'` — tight fit to data extent
|
|
40
|
+
*/
|
|
41
|
+
yBaseline?: YBaseline;
|
|
42
|
+
/**
|
|
43
|
+
* Explicit y-axis domain [min, max].
|
|
44
|
+
* When provided, this is the y-axis range. Data outside it is not clipped
|
|
45
|
+
* visually but will extend beyond the chart area.
|
|
46
|
+
*/
|
|
47
|
+
yDomain?: [number, number];
|
|
48
|
+
/**
|
|
49
|
+
* Explicit x-axis domain [min, max] for linear/time scales.
|
|
50
|
+
* When provided, this is the x-axis range — the chart renders exactly
|
|
51
|
+
* this window. Use for streaming charts where the range shifts over time.
|
|
52
|
+
* Ignored for band (categorical) scales.
|
|
53
|
+
*/
|
|
54
|
+
xDomain?: [number, number];
|
|
55
|
+
/**
|
|
56
|
+
* Set touch-action on the chart container. Use 'none' when interactive
|
|
57
|
+
* components (brush, zoom, crosshair) are present to prevent scroll
|
|
58
|
+
* interference on mobile.
|
|
59
|
+
*/
|
|
60
|
+
interactive?: boolean;
|
|
61
|
+
/** Chart contents — axes, marks, tooltips */
|
|
62
|
+
children: ReactNode;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Root chart container. Computes scales from data and provides them to children.
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* ```
|
|
69
|
+
* <Chart data={data} xKey="month" yKeys={['revenue']} height={300}>
|
|
70
|
+
* <ChartAxis position="bottom" />
|
|
71
|
+
* <ChartAxis position="left" />
|
|
72
|
+
* <ChartBar dataKey="revenue" color={useChartColors().categorical(1)[0]} />
|
|
73
|
+
* </Chart>
|
|
74
|
+
* ```
|
|
75
|
+
*/
|
|
76
|
+
export declare function Chart({ data, xKey, yKeys, height, margin: marginOverride, yBaseline, yDomain: yDomainProp, xDomain: xDomainProp, interactive, children, }: ChartProps): import("react").JSX.Element;
|
|
77
|
+
//# sourceMappingURL=Chart.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Chart.d.ts","sourceRoot":"","sources":["../../src/Chart/Chart.tsx"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AAEH,OAAO,EAEL,KAAK,SAAS,EAMf,MAAM,OAAO,CAAC;AAKf,OAAO,KAAK,EAAC,WAAW,EAAa,MAAM,SAAS,CAAC;AAErD;;;;;GAKG;AACH,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;AAEjD,MAAM,WAAW,UAAU;IACzB,0DAA0D;IAC1D,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC;IAChC;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,qEAAqE;IACrE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,+BAA+B;IAC/B,MAAM,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;IAC9B;;;;;OAKG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB;;;;OAIG;IACH,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC3B;;;;;OAKG;IACH,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC3B;;;;OAIG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,6CAA6C;IAC7C,QAAQ,EAAE,SAAS,CAAC;CACrB;AAID;;;;;;;;;;;GAWG;AACH,wBAAgB,KAAK,CAAC,EACpB,IAAI,EACJ,IAAI,EACJ,KAAK,EACL,MAAY,EACZ,MAAM,EAAE,cAAc,EACtB,SAAkB,EAClB,OAAO,EAAE,WAAW,EACpB,OAAO,EAAE,WAAW,EACpB,WAAmB,EACnB,QAAQ,GACT,EAAE,UAAU,+BA6MZ"}
|
|
@@ -0,0 +1,247 @@
|
|
|
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 { useMemo, useRef, useState, useCallback, useLayoutEffect } from 'react';
|
|
13
|
+
import { scaleLinear, scaleBand } from 'd3-scale';
|
|
14
|
+
import { isBandScale } from "./utils.js";
|
|
15
|
+
import { ChartProvider } from "./ChartContext.js";
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Controls how the y-axis domain is computed:
|
|
19
|
+
* - `'auto'` — includes 0 when all values are positive (default, bar-friendly)
|
|
20
|
+
* - `'zero'` — symmetric range centered on 0 (good for +/- data)
|
|
21
|
+
* - `'data'` — tight fit to data extent only (no forced zero)
|
|
22
|
+
*/
|
|
23
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
24
|
+
const DEFAULT_MARGIN = {
|
|
25
|
+
top: 16,
|
|
26
|
+
right: 16,
|
|
27
|
+
bottom: 32,
|
|
28
|
+
left: 48
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Root chart container. Computes scales from data and provides them to children.
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```
|
|
36
|
+
* <Chart data={data} xKey="month" yKeys={['revenue']} height={300}>
|
|
37
|
+
* <ChartAxis position="bottom" />
|
|
38
|
+
* <ChartAxis position="left" />
|
|
39
|
+
* <ChartBar dataKey="revenue" color={useChartColors().categorical(1)[0]} />
|
|
40
|
+
* </Chart>
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
export function Chart({
|
|
44
|
+
data,
|
|
45
|
+
xKey,
|
|
46
|
+
yKeys,
|
|
47
|
+
height = 300,
|
|
48
|
+
margin: marginOverride,
|
|
49
|
+
yBaseline = 'auto',
|
|
50
|
+
yDomain: yDomainProp,
|
|
51
|
+
xDomain: xDomainProp,
|
|
52
|
+
interactive = false,
|
|
53
|
+
children
|
|
54
|
+
}) {
|
|
55
|
+
const containerRef = useRef(null);
|
|
56
|
+
const svgRef = useRef(null);
|
|
57
|
+
const [containerWidth, setContainerWidth] = useState(0);
|
|
58
|
+
useLayoutEffect(() => {
|
|
59
|
+
if (!containerRef.current) {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
const observer = new ResizeObserver(entries => {
|
|
63
|
+
const entry = entries[0];
|
|
64
|
+
if (entry) {
|
|
65
|
+
setContainerWidth(entry.contentRect.width);
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
observer.observe(containerRef.current);
|
|
69
|
+
return () => observer.disconnect();
|
|
70
|
+
}, []);
|
|
71
|
+
|
|
72
|
+
// Block scroll/zoom on the container when interactive.
|
|
73
|
+
// Must be non-passive to actually prevent default on touch events.
|
|
74
|
+
useLayoutEffect(() => {
|
|
75
|
+
const el = containerRef.current;
|
|
76
|
+
if (!el || !interactive) {
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
const prevent = e => e.preventDefault();
|
|
80
|
+
el.addEventListener('touchstart', prevent, {
|
|
81
|
+
passive: false
|
|
82
|
+
});
|
|
83
|
+
el.addEventListener('touchmove', prevent, {
|
|
84
|
+
passive: false
|
|
85
|
+
});
|
|
86
|
+
return () => {
|
|
87
|
+
el.removeEventListener('touchstart', prevent);
|
|
88
|
+
el.removeEventListener('touchmove', prevent);
|
|
89
|
+
};
|
|
90
|
+
}, [interactive]);
|
|
91
|
+
const margin = useMemo(() => ({
|
|
92
|
+
...DEFAULT_MARGIN,
|
|
93
|
+
...marginOverride
|
|
94
|
+
}), [marginOverride]);
|
|
95
|
+
const innerWidth = Math.max(0, containerWidth - margin.left - margin.right);
|
|
96
|
+
const innerHeight = Math.max(0, height - margin.top - margin.bottom);
|
|
97
|
+
const xScale = useMemo(() => {
|
|
98
|
+
const xValues = data.map(d => d[xKey]);
|
|
99
|
+
const isNumeric = xValues.every(v => typeof v === 'number');
|
|
100
|
+
if (isNumeric) {
|
|
101
|
+
if (xDomainProp) {
|
|
102
|
+
// Explicit domain is authoritative — use as-is
|
|
103
|
+
return scaleLinear().domain(xDomainProp).range([0, innerWidth]);
|
|
104
|
+
}
|
|
105
|
+
// Auto-compute from data
|
|
106
|
+
const nums = xValues;
|
|
107
|
+
let min = Infinity;
|
|
108
|
+
let max = -Infinity;
|
|
109
|
+
for (const n of nums) {
|
|
110
|
+
if (n < min) {
|
|
111
|
+
min = n;
|
|
112
|
+
}
|
|
113
|
+
if (n > max) {
|
|
114
|
+
max = n;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
return scaleLinear().domain([min, max]).range([0, innerWidth]).nice();
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// Categorical — xDomain doesn't apply to band scales
|
|
121
|
+
return scaleBand().domain(xValues.map(String)).range([0, innerWidth]).padding(0.2);
|
|
122
|
+
}, [data, xKey, innerWidth, xDomainProp]);
|
|
123
|
+
const yScale = useMemo(() => {
|
|
124
|
+
if (yDomainProp) {
|
|
125
|
+
// Explicit domain is authoritative — use as-is.
|
|
126
|
+
// No baseline adjustment, no .nice(). The caller owns the domain
|
|
127
|
+
// (e.g. zoom/pan controls) and rounding would cause ratcheting.
|
|
128
|
+
return scaleLinear().domain(yDomainProp).range([innerHeight, 0]);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// Auto-compute from data
|
|
132
|
+
let min = Infinity;
|
|
133
|
+
let max = -Infinity;
|
|
134
|
+
for (const d of data) {
|
|
135
|
+
for (const key of yKeys) {
|
|
136
|
+
const v = d[key];
|
|
137
|
+
if (typeof v === 'number') {
|
|
138
|
+
if (v < min) {
|
|
139
|
+
min = v;
|
|
140
|
+
}
|
|
141
|
+
if (v > max) {
|
|
142
|
+
max = v;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
if (yBaseline === 'zero') {
|
|
148
|
+
const abs = Math.max(Math.abs(min), Math.abs(max));
|
|
149
|
+
min = -abs;
|
|
150
|
+
max = abs;
|
|
151
|
+
} else if (yBaseline === 'auto') {
|
|
152
|
+
if (min > 0) {
|
|
153
|
+
min = 0;
|
|
154
|
+
}
|
|
155
|
+
if (max < 0) {
|
|
156
|
+
max = 0;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
return scaleLinear().domain([min, max]).range([innerHeight, 0]).nice();
|
|
160
|
+
}, [data, yKeys, innerHeight, yBaseline, yDomainProp]);
|
|
161
|
+
const pixelToData = useCallback((px, py) => {
|
|
162
|
+
const y = yScale.invert(py);
|
|
163
|
+
let x;
|
|
164
|
+
if (isBandScale(xScale)) {
|
|
165
|
+
const domain = xScale.domain();
|
|
166
|
+
const step = xScale.step();
|
|
167
|
+
const idx = Math.min(domain.length - 1, Math.max(0, Math.floor(px / step)));
|
|
168
|
+
x = domain[idx];
|
|
169
|
+
} else {
|
|
170
|
+
x = xScale.invert(px);
|
|
171
|
+
}
|
|
172
|
+
return {
|
|
173
|
+
x,
|
|
174
|
+
y,
|
|
175
|
+
px,
|
|
176
|
+
py
|
|
177
|
+
};
|
|
178
|
+
}, [xScale, yScale]);
|
|
179
|
+
const pointerToData = useCallback(e => {
|
|
180
|
+
const svg = svgRef.current;
|
|
181
|
+
if (!svg) {
|
|
182
|
+
return {
|
|
183
|
+
x: null,
|
|
184
|
+
y: 0,
|
|
185
|
+
px: 0,
|
|
186
|
+
py: 0
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
const pt = svg.createSVGPoint();
|
|
190
|
+
pt.x = e.clientX;
|
|
191
|
+
pt.y = e.clientY;
|
|
192
|
+
// Transform to the inner <g> coordinate space (accounts for margins)
|
|
193
|
+
const gEl = svg.querySelector('g');
|
|
194
|
+
const ctm = gEl?.getScreenCTM?.()?.inverse();
|
|
195
|
+
const local = ctm ? pt.matrixTransform(ctm) : {
|
|
196
|
+
x: 0,
|
|
197
|
+
y: 0
|
|
198
|
+
};
|
|
199
|
+
return pixelToData(local.x, local.y);
|
|
200
|
+
}, [pixelToData]);
|
|
201
|
+
const ctx = useMemo(() => ({
|
|
202
|
+
width: innerWidth,
|
|
203
|
+
height: innerHeight,
|
|
204
|
+
margin,
|
|
205
|
+
xKey,
|
|
206
|
+
data,
|
|
207
|
+
xScale,
|
|
208
|
+
yScale,
|
|
209
|
+
svgRef,
|
|
210
|
+
pointerToData,
|
|
211
|
+
pixelToData
|
|
212
|
+
}), [innerWidth, innerHeight, margin, xKey, data, xScale, yScale, pointerToData, pixelToData]);
|
|
213
|
+
const containerStyle = {
|
|
214
|
+
width: '100%',
|
|
215
|
+
touchAction: interactive ? 'none' : undefined,
|
|
216
|
+
userSelect: interactive ? 'none' : undefined
|
|
217
|
+
};
|
|
218
|
+
return /*#__PURE__*/_jsx("div", {
|
|
219
|
+
ref: containerRef,
|
|
220
|
+
style: containerStyle,
|
|
221
|
+
children: containerWidth > 0 && /*#__PURE__*/_jsxs("svg", {
|
|
222
|
+
ref: svgRef,
|
|
223
|
+
width: containerWidth,
|
|
224
|
+
height: height,
|
|
225
|
+
style: interactive ? {
|
|
226
|
+
touchAction: 'none'
|
|
227
|
+
} : undefined,
|
|
228
|
+
children: [/*#__PURE__*/_jsx("defs", {
|
|
229
|
+
children: /*#__PURE__*/_jsx("clipPath", {
|
|
230
|
+
id: "astryx-chart-plot",
|
|
231
|
+
children: /*#__PURE__*/_jsx("rect", {
|
|
232
|
+
x: 0,
|
|
233
|
+
y: 0,
|
|
234
|
+
width: innerWidth,
|
|
235
|
+
height: innerHeight
|
|
236
|
+
})
|
|
237
|
+
})
|
|
238
|
+
}), /*#__PURE__*/_jsx("g", {
|
|
239
|
+
transform: `translate(${margin.left},${margin.top})`,
|
|
240
|
+
children: /*#__PURE__*/_jsx(ChartProvider, {
|
|
241
|
+
value: ctx,
|
|
242
|
+
children: children
|
|
243
|
+
})
|
|
244
|
+
})]
|
|
245
|
+
})
|
|
246
|
+
});
|
|
247
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export interface ChartAreaProps {
|
|
2
|
+
/** Data key for the upper bound. If omitted, uses `baseline`. */
|
|
3
|
+
yUpper?: string;
|
|
4
|
+
/** Data key for the lower bound. If omitted, uses `baseline`. */
|
|
5
|
+
yLower?: string;
|
|
6
|
+
/** Fallback data key when only one bound is specified. */
|
|
7
|
+
baseline?: string;
|
|
8
|
+
/** Fill color */
|
|
9
|
+
color: string;
|
|
10
|
+
/** Fill opacity (default: 0.2) */
|
|
11
|
+
opacity?: number;
|
|
12
|
+
/** Optional stroke on the band edges */
|
|
13
|
+
stroke?: boolean;
|
|
14
|
+
/** Stroke width when stroke is enabled */
|
|
15
|
+
strokeWidth?: number;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Area band between two y-values. Use for confidence intervals, error ranges,
|
|
19
|
+
* or any min/max band around a line.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```
|
|
23
|
+
* <ChartArea yUpper="upper95" yLower="lower95" color={colors[0]} />
|
|
24
|
+
* <ChartArea yUpper="upper95" baseline="mean" color={colors[0]} />
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export declare function ChartArea({ yUpper, yLower, baseline, color, opacity, stroke, strokeWidth, }: ChartAreaProps): import("react").JSX.Element | null;
|
|
28
|
+
//# sourceMappingURL=ChartArea.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChartArea.d.ts","sourceRoot":"","sources":["../../src/Chart/ChartArea.tsx"],"names":[],"mappings":"AAaA,MAAM,WAAW,cAAc;IAC7B,iEAAiE;IACjE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,iEAAiE;IACjE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,0DAA0D;IAC1D,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,iBAAiB;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,kCAAkC;IAClC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,wCAAwC;IACxC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,0CAA0C;IAC1C,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;;;;;;;GASG;AACH,wBAAgB,SAAS,CAAC,EACxB,MAAM,EACN,MAAM,EACN,QAAQ,EACR,KAAK,EACL,OAAa,EACb,MAAc,EACd,WAAe,GAChB,EAAE,cAAc,sCA0ChB"}
|
|
@@ -0,0 +1,71 @@
|
|
|
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.js";
|
|
12
|
+
import { xPixel } from "./utils.js";
|
|
13
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
|
+
/**
|
|
15
|
+
* Area band between two y-values. Use for confidence intervals, error ranges,
|
|
16
|
+
* or any min/max band around a line.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```
|
|
20
|
+
* <ChartArea yUpper="upper95" yLower="lower95" color={colors[0]} />
|
|
21
|
+
* <ChartArea yUpper="upper95" baseline="mean" color={colors[0]} />
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export function ChartArea({
|
|
25
|
+
yUpper,
|
|
26
|
+
yLower,
|
|
27
|
+
baseline,
|
|
28
|
+
color,
|
|
29
|
+
opacity = 0.2,
|
|
30
|
+
stroke = false,
|
|
31
|
+
strokeWidth = 1
|
|
32
|
+
}) {
|
|
33
|
+
const {
|
|
34
|
+
data,
|
|
35
|
+
xKey,
|
|
36
|
+
xScale,
|
|
37
|
+
yScale
|
|
38
|
+
} = useChart();
|
|
39
|
+
const upperKey = yUpper ?? baseline;
|
|
40
|
+
const lowerKey = yLower ?? baseline;
|
|
41
|
+
const pathD = useMemo(() => {
|
|
42
|
+
if (!upperKey || !lowerKey) {
|
|
43
|
+
return '';
|
|
44
|
+
}
|
|
45
|
+
const generator = area().x(d => xPixel(d, xKey, xScale)).y0(d => {
|
|
46
|
+
const v = typeof d[lowerKey] === 'number' ? d[lowerKey] : 0;
|
|
47
|
+
return yScale(v);
|
|
48
|
+
}).y1(d => {
|
|
49
|
+
const v = typeof d[upperKey] === 'number' ? d[upperKey] : 0;
|
|
50
|
+
return yScale(v);
|
|
51
|
+
}).curve(curveMonotoneX);
|
|
52
|
+
return generator(data) ?? '';
|
|
53
|
+
}, [data, xKey, xScale, yScale, upperKey, lowerKey]);
|
|
54
|
+
if (!pathD) {
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
return /*#__PURE__*/_jsxs("g", {
|
|
58
|
+
children: [/*#__PURE__*/_jsx("path", {
|
|
59
|
+
d: pathD,
|
|
60
|
+
fill: color,
|
|
61
|
+
fillOpacity: opacity,
|
|
62
|
+
stroke: "none"
|
|
63
|
+
}), stroke && /*#__PURE__*/_jsx("path", {
|
|
64
|
+
d: pathD,
|
|
65
|
+
fill: "none",
|
|
66
|
+
stroke: color,
|
|
67
|
+
strokeWidth: strokeWidth,
|
|
68
|
+
strokeOpacity: opacity * 2
|
|
69
|
+
})]
|
|
70
|
+
});
|
|
71
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export interface ChartAxisProps {
|
|
2
|
+
/** Which edge to render the axis on */
|
|
3
|
+
position: 'top' | 'right' | 'bottom' | 'left';
|
|
4
|
+
/** Number of ticks (approximate — d3 decides final count) */
|
|
5
|
+
tickCount?: number;
|
|
6
|
+
/** Maximum number of tick labels to show. Labels are evenly skipped when exceeded. */
|
|
7
|
+
maxTicks?: number;
|
|
8
|
+
/** Custom tick formatter */
|
|
9
|
+
tickFormat?: (value: unknown) => string;
|
|
10
|
+
/** Truncate labels to this many characters (appends "\u2026"). */
|
|
11
|
+
truncate?: number;
|
|
12
|
+
/** Enable smooth transitions for streaming (default: true) */
|
|
13
|
+
animated?: boolean;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Chart axis. Renders tick marks and labels for the x or y dimension.
|
|
17
|
+
* Ticks transition smoothly when the scale domain shifts (e.g. streaming).
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```
|
|
21
|
+
* <ChartAxis position="bottom" />
|
|
22
|
+
* <ChartAxis position="left" tickCount={5} tickFormat={currency} />
|
|
23
|
+
* <ChartAxis position="bottom" maxTicks={6} truncate={10} />
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export declare function ChartAxis({ position, tickCount, maxTicks, tickFormat, truncate, animated, }: ChartAxisProps): import("react").JSX.Element;
|
|
27
|
+
//# sourceMappingURL=ChartAxis.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChartAxis.d.ts","sourceRoot":"","sources":["../../src/Chart/ChartAxis.tsx"],"names":[],"mappings":"AAeA,MAAM,WAAW,cAAc;IAC7B,uCAAuC;IACvC,QAAQ,EAAE,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAC;IAC9C,6DAA6D;IAC7D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,sFAAsF;IACtF,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,4BAA4B;IAC5B,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,MAAM,CAAC;IACxC,kEAAkE;IAClE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,8DAA8D;IAC9D,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,SAAS,CAAC,EACxB,QAAQ,EACR,SAAa,EACb,QAAQ,EACR,UAAU,EACV,QAAQ,EACR,QAAe,GAChB,EAAE,cAAc,+BAyIhB"}
|