@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
|
@@ -0,0 +1,406 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
'use client';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @file SVGIcon.tsx
|
|
7
|
+
* @input SVG path data with per-element roles, variation preset, size, color
|
|
8
|
+
* @output CSS-variable-driven SVG icon with role-aware rendering and mask-based gaps
|
|
9
|
+
* @position Core implementation for the lab SVG icon system
|
|
10
|
+
*
|
|
11
|
+
* Two key concepts beyond basic CSS-var-driven icons:
|
|
12
|
+
*
|
|
13
|
+
* 1. Path roles — each element is either "fill" (closed shapes that switch between
|
|
14
|
+
* stroke and fill across variations) or "stroke" (lines that always stay stroked).
|
|
15
|
+
*
|
|
16
|
+
* 2. Mask-based gaps — in bold/filled mode, overlapping fill-role shapes get
|
|
17
|
+
* auto-generated SVG masks. Secondary fill shapes are knocked out of primary
|
|
18
|
+
* shapes with a configurable gap and corner rounding, producing clean negative
|
|
19
|
+
* space on any background.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
import {type CSSProperties, type SVGProps, useId} from 'react';
|
|
23
|
+
import * as stylex from '@stylexjs/stylex';
|
|
24
|
+
import {colorVars} from '@astryxdesign/core/theme/tokens.stylex';
|
|
25
|
+
import {mergeProps} from '@astryxdesign/core/utils';
|
|
26
|
+
import {iconVars} from './tokens.stylex';
|
|
27
|
+
import {variations, opticalSize} from './variations.stylex';
|
|
28
|
+
import {themeProps} from '@astryxdesign/core/utils';
|
|
29
|
+
|
|
30
|
+
// =============================================================================
|
|
31
|
+
// Types
|
|
32
|
+
// =============================================================================
|
|
33
|
+
|
|
34
|
+
export type SVGIconVariation =
|
|
35
|
+
| 'linear'
|
|
36
|
+
| 'bold'
|
|
37
|
+
| 'twotone'
|
|
38
|
+
| 'bulk'
|
|
39
|
+
| 'broken';
|
|
40
|
+
export type SVGIconSize = 'xsm' | 'sm' | 'md' | 'lg';
|
|
41
|
+
export type SVGIconColor =
|
|
42
|
+
| 'primary'
|
|
43
|
+
| 'secondary'
|
|
44
|
+
| 'disabled'
|
|
45
|
+
| 'accent'
|
|
46
|
+
| 'positive'
|
|
47
|
+
| 'negative'
|
|
48
|
+
| 'warning'
|
|
49
|
+
| 'inherit';
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Role determines how an element behaves across variations.
|
|
53
|
+
* - "fill": closed shapes — stroked in linear, filled in bold
|
|
54
|
+
* - "stroke": lines/detail strokes — always rendered as strokes
|
|
55
|
+
*/
|
|
56
|
+
export type IconShapeRole = 'fill' | 'stroke';
|
|
57
|
+
|
|
58
|
+
/** Shape element within an icon layer */
|
|
59
|
+
export interface IconShape {
|
|
60
|
+
/** SVG element type */
|
|
61
|
+
type: 'path' | 'circle' | 'rect' | 'line' | 'polyline' | 'polygon';
|
|
62
|
+
/** SVG attributes for this shape (d, cx, cy, r, points, x1, y1, etc.) */
|
|
63
|
+
attrs: Record<string, string>;
|
|
64
|
+
/**
|
|
65
|
+
* How this element behaves across variations.
|
|
66
|
+
* @default 'fill'
|
|
67
|
+
*/
|
|
68
|
+
role?: IconShapeRole;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/** Definition of an SVG icon's geometry */
|
|
72
|
+
export interface SVGIconDef {
|
|
73
|
+
/** Display name */
|
|
74
|
+
name: string;
|
|
75
|
+
/** ViewBox dimensions (default: "0 0 24 24") */
|
|
76
|
+
viewBox?: string;
|
|
77
|
+
/** Primary layer shapes (main outlines) */
|
|
78
|
+
primary: IconShape[];
|
|
79
|
+
/** Secondary layer shapes (detail elements) */
|
|
80
|
+
secondary?: IconShape[];
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export interface SVGIconProps extends Omit<SVGProps<SVGSVGElement>, 'color'> {
|
|
84
|
+
/** The icon definition containing path data */
|
|
85
|
+
icon: SVGIconDef;
|
|
86
|
+
/**
|
|
87
|
+
* Visual variation preset.
|
|
88
|
+
* @default 'linear'
|
|
89
|
+
*/
|
|
90
|
+
variation?: SVGIconVariation;
|
|
91
|
+
/**
|
|
92
|
+
* Icon size with optical stroke compensation.
|
|
93
|
+
* @default 'md'
|
|
94
|
+
*/
|
|
95
|
+
size?: SVGIconSize;
|
|
96
|
+
/**
|
|
97
|
+
* Semantic color.
|
|
98
|
+
* @default 'primary'
|
|
99
|
+
*/
|
|
100
|
+
color?: SVGIconColor;
|
|
101
|
+
/** Override stroke width (bypasses optical compensation). */
|
|
102
|
+
strokeWidth?: number;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// =============================================================================
|
|
106
|
+
// Styles
|
|
107
|
+
// =============================================================================
|
|
108
|
+
|
|
109
|
+
const styles = stylex.create({
|
|
110
|
+
root: {
|
|
111
|
+
display: 'inline-flex',
|
|
112
|
+
flexShrink: 0,
|
|
113
|
+
width: iconVars['--icon-size'],
|
|
114
|
+
height: iconVars['--icon-size'],
|
|
115
|
+
paddingInlineStart: iconVars['--icon-inline-offset'],
|
|
116
|
+
paddingBlockStart: iconVars['--icon-block-offset'],
|
|
117
|
+
},
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
const colorStyles = stylex.create({
|
|
121
|
+
primary: {color: colorVars['--color-icon-primary']},
|
|
122
|
+
secondary: {color: colorVars['--color-icon-secondary']},
|
|
123
|
+
disabled: {color: colorVars['--color-icon-disabled']},
|
|
124
|
+
accent: {color: colorVars['--color-accent']},
|
|
125
|
+
positive: {color: colorVars['--color-success']},
|
|
126
|
+
negative: {color: colorVars['--color-error']},
|
|
127
|
+
warning: {color: colorVars['--color-warning']},
|
|
128
|
+
inherit: {color: 'inherit'},
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
// =============================================================================
|
|
132
|
+
// Shape Renderer
|
|
133
|
+
// =============================================================================
|
|
134
|
+
|
|
135
|
+
function renderShapeElement(
|
|
136
|
+
attrs: Record<string, string>,
|
|
137
|
+
type: IconShape['type'],
|
|
138
|
+
key: number | string,
|
|
139
|
+
) {
|
|
140
|
+
const props = {...attrs, key};
|
|
141
|
+
switch (type) {
|
|
142
|
+
case 'path':
|
|
143
|
+
return <path {...props} />;
|
|
144
|
+
case 'circle':
|
|
145
|
+
return <circle {...props} />;
|
|
146
|
+
case 'rect':
|
|
147
|
+
return <rect {...props} />;
|
|
148
|
+
case 'line':
|
|
149
|
+
return <line {...props} />;
|
|
150
|
+
case 'polyline':
|
|
151
|
+
return <polyline {...props} />;
|
|
152
|
+
case 'polygon':
|
|
153
|
+
return <polygon {...props} />;
|
|
154
|
+
default:
|
|
155
|
+
return null;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
// =============================================================================
|
|
160
|
+
// Mask Generation
|
|
161
|
+
// =============================================================================
|
|
162
|
+
|
|
163
|
+
/** Check whether bold mode needs a mask for this layer */
|
|
164
|
+
function needsMask(
|
|
165
|
+
variation: SVGIconVariation,
|
|
166
|
+
primaryFillShapes: IconShape[],
|
|
167
|
+
secondaryShapes: IconShape[],
|
|
168
|
+
): boolean {
|
|
169
|
+
if (variation !== 'bold') {
|
|
170
|
+
return false;
|
|
171
|
+
}
|
|
172
|
+
return primaryFillShapes.length > 0 && secondaryShapes.length > 0;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* Render mask knockout shapes — secondary elements become holes
|
|
177
|
+
* in the primary layer, with gap and corner rounding from CSS vars.
|
|
178
|
+
*/
|
|
179
|
+
function renderMaskKnockouts(shapes: IconShape[]) {
|
|
180
|
+
return shapes.map((shape, i) => {
|
|
181
|
+
const role = shape.role ?? 'fill';
|
|
182
|
+
// Stroke-role knockouts need wider stroke to fully cover the visible stroke + gap
|
|
183
|
+
// Fill-role knockouts just need the gap width for the border around the hole
|
|
184
|
+
const knockoutWidth =
|
|
185
|
+
role === 'stroke'
|
|
186
|
+
? `calc(${iconVars['--icon-stroke-width'] as string} + ${iconVars['--icon-gap'] as string} * 2)`
|
|
187
|
+
: (iconVars['--icon-gap'] as string);
|
|
188
|
+
|
|
189
|
+
return renderShapeElement(
|
|
190
|
+
{
|
|
191
|
+
...shape.attrs,
|
|
192
|
+
fill: role === 'fill' ? 'black' : 'none',
|
|
193
|
+
stroke: 'black',
|
|
194
|
+
strokeWidth: knockoutWidth,
|
|
195
|
+
strokeLinecap: 'round',
|
|
196
|
+
strokeLinejoin: iconVars['--icon-gap-linejoin'] as string,
|
|
197
|
+
},
|
|
198
|
+
shape.type,
|
|
199
|
+
`knockout-${i}`,
|
|
200
|
+
);
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
// =============================================================================
|
|
205
|
+
// Layer Renderers
|
|
206
|
+
// =============================================================================
|
|
207
|
+
|
|
208
|
+
type LayerPrefix = 'primary' | 'secondary';
|
|
209
|
+
|
|
210
|
+
function renderFillRoleShapes(
|
|
211
|
+
shapes: IconShape[],
|
|
212
|
+
layer: LayerPrefix,
|
|
213
|
+
maskId?: string,
|
|
214
|
+
) {
|
|
215
|
+
const fillVar =
|
|
216
|
+
layer === 'primary'
|
|
217
|
+
? iconVars['--icon-layer-primary-fill']
|
|
218
|
+
: iconVars['--icon-layer-secondary-fill'];
|
|
219
|
+
const strokeVar =
|
|
220
|
+
layer === 'primary'
|
|
221
|
+
? iconVars['--icon-layer-primary-stroke']
|
|
222
|
+
: iconVars['--icon-layer-secondary-stroke'];
|
|
223
|
+
const opacityVar =
|
|
224
|
+
layer === 'primary'
|
|
225
|
+
? iconVars['--icon-layer-primary-opacity']
|
|
226
|
+
: iconVars['--icon-layer-secondary-opacity'];
|
|
227
|
+
|
|
228
|
+
if (shapes.length === 0) {
|
|
229
|
+
return null;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
return (
|
|
233
|
+
<g
|
|
234
|
+
style={{
|
|
235
|
+
fill: fillVar as string,
|
|
236
|
+
stroke: strokeVar as string,
|
|
237
|
+
opacity: opacityVar as string,
|
|
238
|
+
strokeWidth: iconVars['--icon-stroke-width'] as string,
|
|
239
|
+
strokeLinecap: iconVars['--icon-stroke-linecap'] as unknown as 'round',
|
|
240
|
+
strokeLinejoin: iconVars[
|
|
241
|
+
'--icon-stroke-linejoin'
|
|
242
|
+
] as unknown as 'round',
|
|
243
|
+
}}
|
|
244
|
+
mask={maskId ? `url(#${maskId})` : undefined}>
|
|
245
|
+
{shapes.map((shape, i) =>
|
|
246
|
+
renderShapeElement(shape.attrs, shape.type, `${layer}-fill-${i}`),
|
|
247
|
+
)}
|
|
248
|
+
</g>
|
|
249
|
+
);
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
function renderStrokeRoleShapes(shapes: IconShape[], layer: LayerPrefix) {
|
|
253
|
+
const fillVar =
|
|
254
|
+
layer === 'primary'
|
|
255
|
+
? iconVars['--icon-layer-primary-stroke-role-fill']
|
|
256
|
+
: iconVars['--icon-layer-secondary-stroke-role-fill'];
|
|
257
|
+
const strokeVar =
|
|
258
|
+
layer === 'primary'
|
|
259
|
+
? iconVars['--icon-layer-primary-stroke-role-stroke']
|
|
260
|
+
: iconVars['--icon-layer-secondary-stroke-role-stroke'];
|
|
261
|
+
const opacityVar =
|
|
262
|
+
layer === 'primary'
|
|
263
|
+
? iconVars['--icon-layer-primary-stroke-role-opacity']
|
|
264
|
+
: iconVars['--icon-layer-secondary-stroke-role-opacity'];
|
|
265
|
+
const widthVar =
|
|
266
|
+
layer === 'primary'
|
|
267
|
+
? iconVars['--icon-layer-primary-stroke-role-width']
|
|
268
|
+
: iconVars['--icon-layer-secondary-stroke-role-width'];
|
|
269
|
+
|
|
270
|
+
if (shapes.length === 0) {
|
|
271
|
+
return null;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
return (
|
|
275
|
+
<g
|
|
276
|
+
style={{
|
|
277
|
+
fill: fillVar as string,
|
|
278
|
+
stroke: strokeVar as string,
|
|
279
|
+
opacity: opacityVar as string,
|
|
280
|
+
strokeWidth: widthVar as string,
|
|
281
|
+
strokeLinecap: iconVars['--icon-stroke-linecap'] as unknown as 'round',
|
|
282
|
+
strokeLinejoin: iconVars[
|
|
283
|
+
'--icon-stroke-linejoin'
|
|
284
|
+
] as unknown as 'round',
|
|
285
|
+
}}>
|
|
286
|
+
{shapes.map((shape, i) =>
|
|
287
|
+
renderShapeElement(shape.attrs, shape.type, `${layer}-stroke-${i}`),
|
|
288
|
+
)}
|
|
289
|
+
</g>
|
|
290
|
+
);
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
// =============================================================================
|
|
294
|
+
// Component
|
|
295
|
+
// =============================================================================
|
|
296
|
+
|
|
297
|
+
function splitByRole(shapes: IconShape[]): {
|
|
298
|
+
fill: IconShape[];
|
|
299
|
+
stroke: IconShape[];
|
|
300
|
+
} {
|
|
301
|
+
const fill: IconShape[] = [];
|
|
302
|
+
const stroke: IconShape[] = [];
|
|
303
|
+
for (const shape of shapes) {
|
|
304
|
+
if (shape.role === 'stroke') {
|
|
305
|
+
stroke.push(shape);
|
|
306
|
+
} else {
|
|
307
|
+
fill.push(shape);
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
return {fill, stroke};
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
/**
|
|
314
|
+
* CSS-variable-driven SVG icon with role-aware rendering.
|
|
315
|
+
*
|
|
316
|
+
* Each shape element has a role ("fill" or "stroke") that determines how it
|
|
317
|
+
* behaves across variations. In bold mode, overlapping fill-role shapes get
|
|
318
|
+
* auto-generated SVG masks for clean gap subtraction.
|
|
319
|
+
*
|
|
320
|
+
* @example
|
|
321
|
+
* ```
|
|
322
|
+
* <SVGIcon icon={bellIcon} variation="twotone" size="md" color="accent" />
|
|
323
|
+
* ```
|
|
324
|
+
*/
|
|
325
|
+
export function SVGIcon({
|
|
326
|
+
icon,
|
|
327
|
+
variation = 'linear',
|
|
328
|
+
size = 'md',
|
|
329
|
+
color = 'primary',
|
|
330
|
+
strokeWidth,
|
|
331
|
+
style,
|
|
332
|
+
...props
|
|
333
|
+
}: SVGIconProps) {
|
|
334
|
+
const uid = useId();
|
|
335
|
+
const viewBox = icon.viewBox ?? '0 0 24 24';
|
|
336
|
+
const hasSecondary = icon.secondary && icon.secondary.length > 0;
|
|
337
|
+
|
|
338
|
+
const primarySplit = splitByRole(icon.primary);
|
|
339
|
+
const secondarySplit = hasSecondary
|
|
340
|
+
? splitByRole(icon.secondary ?? [])
|
|
341
|
+
: {fill: [], stroke: []};
|
|
342
|
+
|
|
343
|
+
const allSecondary = [...secondarySplit.fill, ...secondarySplit.stroke];
|
|
344
|
+
const useMask = needsMask(variation, primarySplit.fill, allSecondary);
|
|
345
|
+
const maskId = useMask ? `${uid}-mask` : undefined;
|
|
346
|
+
|
|
347
|
+
// Extract raw CSS property name from StyleX var reference: "var(--xABC)" -> "--xABC"
|
|
348
|
+
const strokeWidthProp = (iconVars['--icon-stroke-width'] as string).replace(
|
|
349
|
+
/^var\((.+)\)$/,
|
|
350
|
+
'$1',
|
|
351
|
+
);
|
|
352
|
+
|
|
353
|
+
const strokeWidthOverride: Record<string, string> = {
|
|
354
|
+
[strokeWidthProp]: String(strokeWidth),
|
|
355
|
+
};
|
|
356
|
+
|
|
357
|
+
const overrideStyle: CSSProperties = {
|
|
358
|
+
...(style as CSSProperties),
|
|
359
|
+
...(strokeWidth != null ? strokeWidthOverride : undefined),
|
|
360
|
+
};
|
|
361
|
+
|
|
362
|
+
return (
|
|
363
|
+
<svg
|
|
364
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
365
|
+
viewBox={viewBox}
|
|
366
|
+
aria-hidden="true"
|
|
367
|
+
{...mergeProps(
|
|
368
|
+
themeProps('svg-icon', {variation, size, color}),
|
|
369
|
+
stylex.props(
|
|
370
|
+
styles.root,
|
|
371
|
+
colorStyles[color],
|
|
372
|
+
variations[variation],
|
|
373
|
+
opticalSize[size],
|
|
374
|
+
),
|
|
375
|
+
)}
|
|
376
|
+
style={overrideStyle}
|
|
377
|
+
{...props}>
|
|
378
|
+
{/* Mask definition — knocks secondary fill shapes out of primary */}
|
|
379
|
+
{useMask && (
|
|
380
|
+
<defs>
|
|
381
|
+
<mask id={maskId}>
|
|
382
|
+
<rect width="24" height="24" fill="white" />
|
|
383
|
+
{renderMaskKnockouts([
|
|
384
|
+
...secondarySplit.fill,
|
|
385
|
+
...secondarySplit.stroke,
|
|
386
|
+
])}
|
|
387
|
+
</mask>
|
|
388
|
+
</defs>
|
|
389
|
+
)}
|
|
390
|
+
|
|
391
|
+
{/* Primary layer */}
|
|
392
|
+
{renderFillRoleShapes(primarySplit.fill, 'primary', maskId)}
|
|
393
|
+
{renderStrokeRoleShapes(primarySplit.stroke, 'primary')}
|
|
394
|
+
|
|
395
|
+
{/* Secondary layer — hidden entirely in bold+mask (all secondaries are knockouts) */}
|
|
396
|
+
{hasSecondary && !useMask && (
|
|
397
|
+
<>
|
|
398
|
+
{renderFillRoleShapes(secondarySplit.fill, 'secondary')}
|
|
399
|
+
{renderStrokeRoleShapes(secondarySplit.stroke, 'secondary')}
|
|
400
|
+
</>
|
|
401
|
+
)}
|
|
402
|
+
</svg>
|
|
403
|
+
);
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
SVGIcon.displayName = 'SVGIcon';
|
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @file icons.ts
|
|
5
|
+
* @input Lucide icon SVG paths
|
|
6
|
+
* @output SVGIconDef objects with per-element roles
|
|
7
|
+
* @position Icon library consumed by stories and tests
|
|
8
|
+
*
|
|
9
|
+
* Each shape has a role:
|
|
10
|
+
* - "fill": closed shapes that switch between stroke (linear) and fill (bold)
|
|
11
|
+
* - "stroke": lines/strokes that always render as strokes
|
|
12
|
+
*
|
|
13
|
+
* The role defaults to "fill" if omitted.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
import type {SVGIconDef} from './SVGIcon';
|
|
17
|
+
|
|
18
|
+
/** Simple stroke-only: X / Close — both lines are stroke-role */
|
|
19
|
+
export const xIcon: SVGIconDef = {
|
|
20
|
+
name: 'X',
|
|
21
|
+
primary: [
|
|
22
|
+
{
|
|
23
|
+
type: 'line',
|
|
24
|
+
attrs: {x1: '18', y1: '6', x2: '6', y2: '18'},
|
|
25
|
+
role: 'stroke',
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
type: 'line',
|
|
29
|
+
attrs: {x1: '6', y1: '6', x2: '18', y2: '18'},
|
|
30
|
+
role: 'stroke',
|
|
31
|
+
},
|
|
32
|
+
],
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
/** Simple stroke-only: Check */
|
|
36
|
+
export const checkIcon: SVGIconDef = {
|
|
37
|
+
name: 'Check',
|
|
38
|
+
primary: [{type: 'path', attrs: {d: 'M20 6 9 17l-5-5'}, role: 'stroke'}],
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
/** Two-layer with mixed roles: Bell body is fill, clapper is stroke */
|
|
42
|
+
export const bellIcon: SVGIconDef = {
|
|
43
|
+
name: 'Bell',
|
|
44
|
+
primary: [
|
|
45
|
+
{
|
|
46
|
+
type: 'path',
|
|
47
|
+
attrs: {d: 'M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9'},
|
|
48
|
+
role: 'fill',
|
|
49
|
+
},
|
|
50
|
+
],
|
|
51
|
+
secondary: [
|
|
52
|
+
{
|
|
53
|
+
type: 'path',
|
|
54
|
+
attrs: {d: 'M10.3 21a1.94 1.94 0 0 0 3.4 0'},
|
|
55
|
+
role: 'stroke',
|
|
56
|
+
},
|
|
57
|
+
],
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Two-layer: Home — house outline is fill, door is fill (secondary).
|
|
62
|
+
* In bold mode the door gets masked out of the house body.
|
|
63
|
+
*/
|
|
64
|
+
export const homeIcon: SVGIconDef = {
|
|
65
|
+
name: 'Home',
|
|
66
|
+
primary: [
|
|
67
|
+
{
|
|
68
|
+
type: 'path',
|
|
69
|
+
attrs: {
|
|
70
|
+
d: 'M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z',
|
|
71
|
+
},
|
|
72
|
+
role: 'fill',
|
|
73
|
+
},
|
|
74
|
+
],
|
|
75
|
+
secondary: [
|
|
76
|
+
{
|
|
77
|
+
type: 'path',
|
|
78
|
+
attrs: {d: 'M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8'},
|
|
79
|
+
role: 'fill',
|
|
80
|
+
},
|
|
81
|
+
],
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
/** Complex: Settings — gear body is fill, center circle is fill (secondary, masked in bold) */
|
|
85
|
+
export const settingsIcon: SVGIconDef = {
|
|
86
|
+
name: 'Settings',
|
|
87
|
+
primary: [
|
|
88
|
+
{
|
|
89
|
+
type: 'path',
|
|
90
|
+
attrs: {
|
|
91
|
+
d: 'M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z',
|
|
92
|
+
},
|
|
93
|
+
role: 'fill',
|
|
94
|
+
},
|
|
95
|
+
],
|
|
96
|
+
secondary: [
|
|
97
|
+
{type: 'circle', attrs: {cx: '12', cy: '12', r: '3'}, role: 'fill'},
|
|
98
|
+
],
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
/** Mixed roles: Calendar frame is fill, pegs are stroke, divider line is stroke */
|
|
102
|
+
export const calendarIcon: SVGIconDef = {
|
|
103
|
+
name: 'Calendar',
|
|
104
|
+
primary: [
|
|
105
|
+
{
|
|
106
|
+
type: 'rect',
|
|
107
|
+
attrs: {width: '18', height: '18', x: '3', y: '4', rx: '2'},
|
|
108
|
+
role: 'fill',
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
type: 'line',
|
|
112
|
+
attrs: {x1: '16', y1: '2', x2: '16', y2: '6'},
|
|
113
|
+
role: 'stroke',
|
|
114
|
+
},
|
|
115
|
+
{type: 'line', attrs: {x1: '8', y1: '2', x2: '8', y2: '6'}, role: 'stroke'},
|
|
116
|
+
],
|
|
117
|
+
secondary: [
|
|
118
|
+
{
|
|
119
|
+
type: 'line',
|
|
120
|
+
attrs: {x1: '3', y1: '10', x2: '21', y2: '10'},
|
|
121
|
+
role: 'stroke',
|
|
122
|
+
},
|
|
123
|
+
],
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
/** Stroke-only: Menu / Hamburger — all lines are stroke-role */
|
|
127
|
+
export const menuIcon: SVGIconDef = {
|
|
128
|
+
name: 'Menu',
|
|
129
|
+
primary: [
|
|
130
|
+
{
|
|
131
|
+
type: 'line',
|
|
132
|
+
attrs: {x1: '4', y1: '6', x2: '20', y2: '6'},
|
|
133
|
+
role: 'stroke',
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
type: 'line',
|
|
137
|
+
attrs: {x1: '4', y1: '12', x2: '20', y2: '12'},
|
|
138
|
+
role: 'stroke',
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
type: 'line',
|
|
142
|
+
attrs: {x1: '4', y1: '18', x2: '20', y2: '18'},
|
|
143
|
+
role: 'stroke',
|
|
144
|
+
},
|
|
145
|
+
],
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
/** Single curved path: Heart */
|
|
149
|
+
export const heartIcon: SVGIconDef = {
|
|
150
|
+
name: 'Heart',
|
|
151
|
+
primary: [
|
|
152
|
+
{
|
|
153
|
+
type: 'path',
|
|
154
|
+
attrs: {
|
|
155
|
+
d: 'M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5',
|
|
156
|
+
},
|
|
157
|
+
role: 'fill',
|
|
158
|
+
},
|
|
159
|
+
],
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
/** Nested shapes: Eye — outer shape (fill) + pupil (fill, secondary) */
|
|
163
|
+
export const eyeIcon: SVGIconDef = {
|
|
164
|
+
name: 'Eye',
|
|
165
|
+
primary: [
|
|
166
|
+
{
|
|
167
|
+
type: 'path',
|
|
168
|
+
attrs: {
|
|
169
|
+
d: 'M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0',
|
|
170
|
+
},
|
|
171
|
+
role: 'fill',
|
|
172
|
+
},
|
|
173
|
+
],
|
|
174
|
+
secondary: [
|
|
175
|
+
{type: 'circle', attrs: {cx: '12', cy: '12', r: '3'}, role: 'fill'},
|
|
176
|
+
],
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
/** Complex single path: Star */
|
|
180
|
+
export const starIcon: SVGIconDef = {
|
|
181
|
+
name: 'Star',
|
|
182
|
+
primary: [
|
|
183
|
+
{
|
|
184
|
+
type: 'path',
|
|
185
|
+
attrs: {
|
|
186
|
+
d: 'M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z',
|
|
187
|
+
},
|
|
188
|
+
role: 'fill',
|
|
189
|
+
},
|
|
190
|
+
],
|
|
191
|
+
};
|
|
192
|
+
|
|
193
|
+
/** Single panel: Folder */
|
|
194
|
+
export const folderIcon: SVGIconDef = {
|
|
195
|
+
name: 'Folder',
|
|
196
|
+
primary: [
|
|
197
|
+
{
|
|
198
|
+
type: 'path',
|
|
199
|
+
attrs: {
|
|
200
|
+
d: 'M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z',
|
|
201
|
+
},
|
|
202
|
+
role: 'fill',
|
|
203
|
+
},
|
|
204
|
+
],
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
/** Single path: Shield */
|
|
208
|
+
export const shieldIcon: SVGIconDef = {
|
|
209
|
+
name: 'Shield',
|
|
210
|
+
primary: [
|
|
211
|
+
{
|
|
212
|
+
type: 'path',
|
|
213
|
+
attrs: {
|
|
214
|
+
d: 'M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z',
|
|
215
|
+
},
|
|
216
|
+
role: 'fill',
|
|
217
|
+
},
|
|
218
|
+
],
|
|
219
|
+
};
|
|
220
|
+
|
|
221
|
+
/** Mixed: Search — glass (fill) + handle (stroke, secondary) */
|
|
222
|
+
export const searchIcon: SVGIconDef = {
|
|
223
|
+
name: 'Search',
|
|
224
|
+
primary: [
|
|
225
|
+
{type: 'circle', attrs: {cx: '11', cy: '11', r: '8'}, role: 'stroke'},
|
|
226
|
+
{
|
|
227
|
+
type: 'path',
|
|
228
|
+
attrs: {d: 'm21 21-4.34-4.34'},
|
|
229
|
+
role: 'stroke',
|
|
230
|
+
},
|
|
231
|
+
],
|
|
232
|
+
};
|
|
233
|
+
|
|
234
|
+
/** Mixed: Mail — body (fill) + flap line (stroke, secondary) */
|
|
235
|
+
export const mailIcon: SVGIconDef = {
|
|
236
|
+
name: 'Mail',
|
|
237
|
+
primary: [
|
|
238
|
+
{
|
|
239
|
+
type: 'rect',
|
|
240
|
+
attrs: {x: '2', y: '4', width: '20', height: '16', rx: '2'},
|
|
241
|
+
role: 'fill',
|
|
242
|
+
},
|
|
243
|
+
],
|
|
244
|
+
secondary: [
|
|
245
|
+
{
|
|
246
|
+
type: 'path',
|
|
247
|
+
attrs: {d: 'm22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7'},
|
|
248
|
+
role: 'stroke',
|
|
249
|
+
},
|
|
250
|
+
],
|
|
251
|
+
};
|
|
252
|
+
|
|
253
|
+
/** Mixed: Lock — body (fill) + shackle (stroke) */
|
|
254
|
+
export const lockIcon: SVGIconDef = {
|
|
255
|
+
name: 'Lock',
|
|
256
|
+
primary: [
|
|
257
|
+
{
|
|
258
|
+
type: 'rect',
|
|
259
|
+
attrs: {width: '18', height: '11', x: '3', y: '11', rx: '2'},
|
|
260
|
+
role: 'fill',
|
|
261
|
+
},
|
|
262
|
+
{type: 'path', attrs: {d: 'M7 11V7a5 5 0 0 1 10 0v4'}, role: 'stroke'},
|
|
263
|
+
],
|
|
264
|
+
};
|
|
265
|
+
|
|
266
|
+
/** All starter icons for convenience */
|
|
267
|
+
export const starterIcons: SVGIconDef[] = [
|
|
268
|
+
xIcon,
|
|
269
|
+
checkIcon,
|
|
270
|
+
bellIcon,
|
|
271
|
+
homeIcon,
|
|
272
|
+
settingsIcon,
|
|
273
|
+
calendarIcon,
|
|
274
|
+
menuIcon,
|
|
275
|
+
heartIcon,
|
|
276
|
+
eyeIcon,
|
|
277
|
+
starIcon,
|
|
278
|
+
folderIcon,
|
|
279
|
+
shieldIcon,
|
|
280
|
+
searchIcon,
|
|
281
|
+
mailIcon,
|
|
282
|
+
lockIcon,
|
|
283
|
+
];
|