@fluentui/react-charts 1.2.0 → 9.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +177 -15
- package/LICENSE +11 -17
- package/README.md +174 -23
- package/dist/index.d.ts +2143 -0
- package/lib/CartesianChart.js +1 -0
- package/lib/CartesianChart.js.map +1 -0
- package/lib/DeclarativeChart.js +1 -0
- package/lib/DeclarativeChart.js.map +1 -0
- package/lib/DonutChart.js +1 -0
- package/lib/DonutChart.js.map +1 -0
- package/lib/HorizontalBarChart.js +1 -0
- package/lib/HorizontalBarChart.js.map +1 -0
- package/lib/Legends.js +1 -0
- package/lib/Legends.js.map +1 -0
- package/lib/LineChart.js +1 -0
- package/lib/LineChart.js.map +1 -0
- package/lib/Popover.js +1 -0
- package/lib/Popover.js.map +1 -0
- package/lib/ResponsiveContainer.js +1 -0
- package/lib/ResponsiveContainer.js.map +1 -0
- package/lib/Sparkline.js +1 -0
- package/lib/Sparkline.js.map +1 -0
- package/lib/VerticalBarChart.js +1 -0
- package/lib/VerticalBarChart.js.map +1 -0
- package/lib/components/CommonComponents/CartesianChart.js +462 -0
- package/lib/components/CommonComponents/CartesianChart.js.map +1 -0
- package/lib/components/CommonComponents/CartesianChart.types.js +1 -0
- package/lib/components/CommonComponents/CartesianChart.types.js.map +1 -0
- package/lib/components/CommonComponents/ChartPopover.js +187 -0
- package/lib/components/CommonComponents/ChartPopover.js.map +1 -0
- package/lib/components/CommonComponents/ChartPopover.types.js +1 -0
- package/lib/components/CommonComponents/ChartPopover.types.js.map +1 -0
- package/lib/components/CommonComponents/index.js +4 -0
- package/lib/components/CommonComponents/index.js.map +1 -0
- package/lib/components/CommonComponents/useCartesianChartStyles.styles.js +229 -0
- package/lib/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -0
- package/lib/components/CommonComponents/useChartPopoverStyles.styles.js +178 -0
- package/lib/components/CommonComponents/useChartPopoverStyles.styles.js.map +1 -0
- package/lib/components/DeclarativeChart/DeclarativeChart.js +150 -0
- package/lib/components/DeclarativeChart/DeclarativeChart.js.map +1 -0
- package/lib/components/DeclarativeChart/PlotlySchema.js +7 -0
- package/lib/components/DeclarativeChart/PlotlySchema.js.map +1 -0
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +400 -0
- package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -0
- package/lib/components/DeclarativeChart/imageExporter.js +221 -0
- package/lib/components/DeclarativeChart/imageExporter.js.map +1 -0
- package/lib/components/DeclarativeChart/index.js +1 -0
- package/lib/components/DeclarativeChart/index.js.map +1 -0
- package/lib/components/DonutChart/Arc/Arc.js +110 -0
- package/lib/components/DonutChart/Arc/Arc.js.map +1 -0
- package/lib/components/DonutChart/Arc/Arc.types.js +1 -0
- package/lib/components/DonutChart/Arc/Arc.types.js.map +1 -0
- package/lib/components/DonutChart/Arc/index.js +2 -0
- package/lib/components/DonutChart/Arc/index.js.map +1 -0
- package/lib/components/DonutChart/Arc/useArcStyles.styles.js +54 -0
- package/lib/components/DonutChart/Arc/useArcStyles.styles.js.map +1 -0
- package/lib/components/DonutChart/DonutChart.js +291 -0
- package/lib/components/DonutChart/DonutChart.js.map +1 -0
- package/lib/components/DonutChart/DonutChart.types.js +1 -0
- package/lib/components/DonutChart/DonutChart.types.js.map +1 -0
- package/lib/components/DonutChart/Pie/Pie.js +72 -0
- package/lib/components/DonutChart/Pie/Pie.js.map +1 -0
- package/lib/components/DonutChart/Pie/Pie.types.js +1 -0
- package/lib/components/DonutChart/Pie/Pie.types.js.map +1 -0
- package/lib/components/DonutChart/Pie/index.js +2 -0
- package/lib/components/DonutChart/Pie/index.js.map +1 -0
- package/lib/components/DonutChart/Pie/usePieStyles.styles.js +44 -0
- package/lib/components/DonutChart/Pie/usePieStyles.styles.js.map +1 -0
- package/lib/components/DonutChart/index.js +3 -0
- package/lib/components/DonutChart/index.js.map +1 -0
- package/lib/components/DonutChart/useDonutChartStyles.styles.js +58 -0
- package/lib/components/DonutChart/useDonutChartStyles.styles.js.map +1 -0
- package/lib/components/HorizontalBarChart/HorizontalBarChart.js +402 -0
- package/lib/components/HorizontalBarChart/HorizontalBarChart.js.map +1 -0
- package/lib/components/HorizontalBarChart/HorizontalBarChart.types.js +6 -0
- package/lib/components/HorizontalBarChart/HorizontalBarChart.types.js.map +1 -0
- package/lib/components/HorizontalBarChart/index.js +3 -0
- package/lib/components/HorizontalBarChart/index.js.map +1 -0
- package/lib/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.js +163 -0
- package/lib/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.js.map +1 -0
- package/lib/components/Legends/Legends.js +302 -0
- package/lib/components/Legends/Legends.js.map +1 -0
- package/lib/components/Legends/Legends.types.js +1 -0
- package/lib/components/Legends/Legends.types.js.map +1 -0
- package/lib/components/Legends/OverflowMenu.js +25 -0
- package/lib/components/Legends/OverflowMenu.js.map +1 -0
- package/lib/components/Legends/index.js +3 -0
- package/lib/components/Legends/index.js.map +1 -0
- package/lib/components/Legends/shape.js +35 -0
- package/lib/components/Legends/shape.js.map +1 -0
- package/lib/components/Legends/useLegendsStyles.styles.js +147 -0
- package/lib/components/Legends/useLegendsStyles.styles.js.map +1 -0
- package/lib/components/LineChart/LineChart.js +1026 -0
- package/lib/components/LineChart/LineChart.js.map +1 -0
- package/lib/components/LineChart/LineChart.types.js +3 -0
- package/lib/components/LineChart/LineChart.types.js.map +1 -0
- package/lib/components/LineChart/eventAnnotation/EventAnnotation.js +119 -0
- package/lib/components/LineChart/eventAnnotation/EventAnnotation.js.map +1 -0
- package/lib/components/LineChart/eventAnnotation/LabelLink.js +57 -0
- package/lib/components/LineChart/eventAnnotation/LabelLink.js.map +1 -0
- package/lib/components/LineChart/eventAnnotation/Textbox.js +40 -0
- package/lib/components/LineChart/eventAnnotation/Textbox.js.map +1 -0
- package/lib/components/LineChart/index.js +4 -0
- package/lib/components/LineChart/index.js.map +1 -0
- package/lib/components/LineChart/useLineChartStyles.styles.js +65 -0
- package/lib/components/LineChart/useLineChartStyles.styles.js.map +1 -0
- package/lib/components/ResponsiveContainer/ResponsiveContainer.js +65 -0
- package/lib/components/ResponsiveContainer/ResponsiveContainer.js.map +1 -0
- package/lib/components/ResponsiveContainer/ResponsiveContainer.types.js +1 -0
- package/lib/components/ResponsiveContainer/ResponsiveContainer.types.js.map +1 -0
- package/lib/components/ResponsiveContainer/index.js +1 -0
- package/lib/components/ResponsiveContainer/index.js.map +1 -0
- package/lib/components/ResponsiveContainer/useResponsiveContainerStyles.styles.js +23 -0
- package/lib/components/ResponsiveContainer/useResponsiveContainerStyles.styles.js.map +1 -0
- package/lib/components/Sparkline/Sparkline.js +119 -0
- package/lib/components/Sparkline/Sparkline.js.map +1 -0
- package/lib/components/Sparkline/Sparkline.types.js +4 -0
- package/lib/components/Sparkline/Sparkline.types.js.map +1 -0
- package/lib/components/Sparkline/index.js +3 -0
- package/lib/components/Sparkline/index.js.map +1 -0
- package/lib/components/Sparkline/useSparklineStyles.styles.js +49 -0
- package/lib/components/Sparkline/useSparklineStyles.styles.js.map +1 -0
- package/lib/components/VerticalBarChart/VerticalBarChart.js +849 -0
- package/lib/components/VerticalBarChart/VerticalBarChart.js.map +1 -0
- package/lib/components/VerticalBarChart/VerticalBarChart.types.js +4 -0
- package/lib/components/VerticalBarChart/VerticalBarChart.types.js.map +1 -0
- package/lib/components/VerticalBarChart/index.js +3 -0
- package/lib/components/VerticalBarChart/index.js.map +1 -0
- package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.js +74 -0
- package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.js.map +1 -0
- package/lib/index.js +12 -8
- package/lib/index.js.map +1 -1
- package/lib/types/DataPoint.js +3 -0
- package/lib/types/DataPoint.js.map +1 -0
- package/lib/types/EventAnnotation.js +1 -0
- package/lib/types/EventAnnotation.js.map +1 -0
- package/lib/types/LegendDataItem.js +1 -0
- package/lib/types/LegendDataItem.js.map +1 -0
- package/lib/types/index.js +2 -2
- package/lib/types/index.js.map +1 -1
- package/lib/utilities/FocusableTooltipText.js +65 -0
- package/lib/utilities/FocusableTooltipText.js.map +1 -0
- package/lib/utilities/KeyCodes.js +8 -0
- package/lib/utilities/KeyCodes.js.map +1 -0
- package/lib/utilities/SVGTooltipText.js +138 -0
- package/lib/utilities/SVGTooltipText.js.map +1 -0
- package/lib/utilities/async-utils.js +380 -0
- package/lib/utilities/async-utils.js.map +1 -0
- package/lib/utilities/colors.js +249 -0
- package/lib/utilities/colors.js.map +1 -0
- package/lib/utilities/getWindow.js +25 -0
- package/lib/utilities/getWindow.js.map +1 -0
- package/lib/utilities/index.js +3 -0
- package/lib/utilities/index.js.map +1 -0
- package/lib/utilities/locale-util.js +15 -0
- package/lib/utilities/locale-util.js.map +1 -0
- package/lib/utilities/overflow-utils.js +27 -0
- package/lib/utilities/overflow-utils.js.map +1 -0
- package/lib/utilities/test-data.js +276 -0
- package/lib/utilities/test-data.js.map +1 -0
- package/lib/utilities/utilities.js +1215 -0
- package/lib/utilities/utilities.js.map +1 -0
- package/lib/utilities/vbc-utils.js +27 -0
- package/lib/utilities/vbc-utils.js.map +1 -0
- package/lib-commonjs/CartesianChart.js +6 -0
- package/lib-commonjs/CartesianChart.js.map +1 -0
- package/lib-commonjs/DeclarativeChart.js +6 -0
- package/lib-commonjs/DeclarativeChart.js.map +1 -0
- package/lib-commonjs/DonutChart.js +6 -0
- package/lib-commonjs/DonutChart.js.map +1 -0
- package/lib-commonjs/HorizontalBarChart.js +6 -0
- package/lib-commonjs/HorizontalBarChart.js.map +1 -0
- package/lib-commonjs/Legends.js +6 -0
- package/lib-commonjs/Legends.js.map +1 -0
- package/lib-commonjs/LineChart.js +6 -0
- package/lib-commonjs/LineChart.js.map +1 -0
- package/lib-commonjs/Popover.js +6 -0
- package/lib-commonjs/Popover.js.map +1 -0
- package/lib-commonjs/ResponsiveContainer.js +6 -0
- package/lib-commonjs/ResponsiveContainer.js.map +1 -0
- package/lib-commonjs/Sparkline.js +6 -0
- package/lib-commonjs/Sparkline.js.map +1 -0
- package/lib-commonjs/VerticalBarChart.js +6 -0
- package/lib-commonjs/VerticalBarChart.js.map +1 -0
- package/lib-commonjs/components/CommonComponents/CartesianChart.js +469 -0
- package/lib-commonjs/components/CommonComponents/CartesianChart.js.map +1 -0
- package/lib-commonjs/components/CommonComponents/CartesianChart.types.js +6 -0
- package/lib-commonjs/components/CommonComponents/CartesianChart.types.js.map +1 -0
- package/lib-commonjs/components/CommonComponents/ChartPopover.js +197 -0
- package/lib-commonjs/components/CommonComponents/ChartPopover.js.map +1 -0
- package/lib-commonjs/components/CommonComponents/ChartPopover.types.js +4 -0
- package/lib-commonjs/components/CommonComponents/ChartPopover.types.js.map +1 -0
- package/lib-commonjs/components/CommonComponents/index.js +9 -0
- package/lib-commonjs/components/CommonComponents/index.js.map +1 -0
- package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.js +356 -0
- package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -0
- package/lib-commonjs/components/CommonComponents/useChartPopoverStyles.styles.js +261 -0
- package/lib-commonjs/components/CommonComponents/useChartPopoverStyles.styles.js.map +1 -0
- package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js +158 -0
- package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -0
- package/lib-commonjs/components/DeclarativeChart/PlotlySchema.js +10 -0
- package/lib-commonjs/components/DeclarativeChart/PlotlySchema.js.map +1 -0
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +445 -0
- package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -0
- package/lib-commonjs/components/DeclarativeChart/imageExporter.js +231 -0
- package/lib-commonjs/components/DeclarativeChart/imageExporter.js.map +1 -0
- package/lib-commonjs/components/DeclarativeChart/index.js +6 -0
- package/lib-commonjs/components/DeclarativeChart/index.js.map +1 -0
- package/lib-commonjs/components/DonutChart/Arc/Arc.js +117 -0
- package/lib-commonjs/components/DonutChart/Arc/Arc.js.map +1 -0
- package/lib-commonjs/components/DonutChart/Arc/Arc.types.js +4 -0
- package/lib-commonjs/components/DonutChart/Arc/Arc.types.js.map +1 -0
- package/lib-commonjs/components/DonutChart/Arc/index.js +7 -0
- package/lib-commonjs/components/DonutChart/Arc/index.js.map +1 -0
- package/lib-commonjs/components/DonutChart/Arc/useArcStyles.styles.js +83 -0
- package/lib-commonjs/components/DonutChart/Arc/useArcStyles.styles.js.map +1 -0
- package/lib-commonjs/components/DonutChart/DonutChart.js +298 -0
- package/lib-commonjs/components/DonutChart/DonutChart.js.map +1 -0
- package/lib-commonjs/components/DonutChart/DonutChart.types.js +6 -0
- package/lib-commonjs/components/DonutChart/DonutChart.types.js.map +1 -0
- package/lib-commonjs/components/DonutChart/Pie/Pie.js +79 -0
- package/lib-commonjs/components/DonutChart/Pie/Pie.js.map +1 -0
- package/lib-commonjs/components/DonutChart/Pie/Pie.types.js +4 -0
- package/lib-commonjs/components/DonutChart/Pie/Pie.types.js.map +1 -0
- package/lib-commonjs/components/DonutChart/Pie/index.js +7 -0
- package/lib-commonjs/components/DonutChart/Pie/index.js.map +1 -0
- package/lib-commonjs/components/DonutChart/Pie/usePieStyles.styles.js +61 -0
- package/lib-commonjs/components/DonutChart/Pie/usePieStyles.styles.js.map +1 -0
- package/lib-commonjs/components/DonutChart/index.js +8 -0
- package/lib-commonjs/components/DonutChart/index.js.map +1 -0
- package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.js +82 -0
- package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.js.map +1 -0
- package/lib-commonjs/components/HorizontalBarChart/HorizontalBarChart.js +408 -0
- package/lib-commonjs/components/HorizontalBarChart/HorizontalBarChart.js.map +1 -0
- package/lib-commonjs/components/HorizontalBarChart/HorizontalBarChart.types.js +17 -0
- package/lib-commonjs/components/HorizontalBarChart/HorizontalBarChart.types.js.map +1 -0
- package/lib-commonjs/components/HorizontalBarChart/index.js +8 -0
- package/lib-commonjs/components/HorizontalBarChart/index.js.map +1 -0
- package/lib-commonjs/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.js +251 -0
- package/lib-commonjs/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.js.map +1 -0
- package/lib-commonjs/components/Legends/Legends.js +313 -0
- package/lib-commonjs/components/Legends/Legends.js.map +1 -0
- package/lib-commonjs/components/Legends/Legends.types.js +6 -0
- package/lib-commonjs/components/Legends/Legends.types.js.map +1 -0
- package/lib-commonjs/components/Legends/OverflowMenu.js +36 -0
- package/lib-commonjs/components/Legends/OverflowMenu.js.map +1 -0
- package/lib-commonjs/components/Legends/index.js +8 -0
- package/lib-commonjs/components/Legends/index.js.map +1 -0
- package/lib-commonjs/components/Legends/shape.js +46 -0
- package/lib-commonjs/components/Legends/shape.js.map +1 -0
- package/lib-commonjs/components/Legends/useLegendsStyles.styles.js +304 -0
- package/lib-commonjs/components/Legends/useLegendsStyles.styles.js.map +1 -0
- package/lib-commonjs/components/LineChart/LineChart.js +1032 -0
- package/lib-commonjs/components/LineChart/LineChart.js.map +1 -0
- package/lib-commonjs/components/LineChart/LineChart.types.js +6 -0
- package/lib-commonjs/components/LineChart/LineChart.types.js.map +1 -0
- package/lib-commonjs/components/LineChart/eventAnnotation/EventAnnotation.js +129 -0
- package/lib-commonjs/components/LineChart/eventAnnotation/EventAnnotation.js.map +1 -0
- package/lib-commonjs/components/LineChart/eventAnnotation/LabelLink.js +68 -0
- package/lib-commonjs/components/LineChart/eventAnnotation/LabelLink.js.map +1 -0
- package/lib-commonjs/components/LineChart/eventAnnotation/Textbox.js +51 -0
- package/lib-commonjs/components/LineChart/eventAnnotation/Textbox.js.map +1 -0
- package/lib-commonjs/components/LineChart/index.js +9 -0
- package/lib-commonjs/components/LineChart/index.js.map +1 -0
- package/lib-commonjs/components/LineChart/useLineChartStyles.styles.js +96 -0
- package/lib-commonjs/components/LineChart/useLineChartStyles.styles.js.map +1 -0
- package/lib-commonjs/components/ResponsiveContainer/ResponsiveContainer.js +76 -0
- package/lib-commonjs/components/ResponsiveContainer/ResponsiveContainer.js.map +1 -0
- package/lib-commonjs/components/ResponsiveContainer/ResponsiveContainer.types.js +6 -0
- package/lib-commonjs/components/ResponsiveContainer/ResponsiveContainer.types.js.map +1 -0
- package/lib-commonjs/components/ResponsiveContainer/index.js +6 -0
- package/lib-commonjs/components/ResponsiveContainer/index.js.map +1 -0
- package/lib-commonjs/components/ResponsiveContainer/useResponsiveContainerStyles.styles.js +47 -0
- package/lib-commonjs/components/ResponsiveContainer/useResponsiveContainerStyles.styles.js.map +1 -0
- package/lib-commonjs/components/Sparkline/Sparkline.js +125 -0
- package/lib-commonjs/components/Sparkline/Sparkline.js.map +1 -0
- package/lib-commonjs/components/Sparkline/Sparkline.types.js +7 -0
- package/lib-commonjs/components/Sparkline/Sparkline.types.js.map +1 -0
- package/lib-commonjs/components/Sparkline/index.js +8 -0
- package/lib-commonjs/components/Sparkline/index.js.map +1 -0
- package/lib-commonjs/components/Sparkline/useSparklineStyles.styles.js +77 -0
- package/lib-commonjs/components/Sparkline/useSparklineStyles.styles.js.map +1 -0
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js +851 -0
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js.map +1 -0
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.types.js +7 -0
- package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.types.js.map +1 -0
- package/lib-commonjs/components/VerticalBarChart/index.js +8 -0
- package/lib-commonjs/components/VerticalBarChart/index.js.map +1 -0
- package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.js +117 -0
- package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.js.map +1 -0
- package/lib-commonjs/index.js +17 -0
- package/lib-commonjs/index.js.map +1 -0
- package/lib-commonjs/types/DataPoint.js +6 -0
- package/lib-commonjs/types/DataPoint.js.map +1 -0
- package/lib-commonjs/types/EventAnnotation.js +6 -0
- package/lib-commonjs/types/EventAnnotation.js.map +1 -0
- package/lib-commonjs/types/LegendDataItem.js +4 -0
- package/lib-commonjs/types/LegendDataItem.js.map +1 -0
- package/lib-commonjs/types/index.js +7 -0
- package/lib-commonjs/types/index.js.map +1 -0
- package/lib-commonjs/utilities/FocusableTooltipText.js +75 -0
- package/lib-commonjs/utilities/FocusableTooltipText.js.map +1 -0
- package/lib-commonjs/utilities/KeyCodes.js +18 -0
- package/lib-commonjs/utilities/KeyCodes.js.map +1 -0
- package/lib-commonjs/utilities/SVGTooltipText.js +148 -0
- package/lib-commonjs/utilities/SVGTooltipText.js.map +1 -0
- package/lib-commonjs/utilities/async-utils.js +382 -0
- package/lib-commonjs/utilities/async-utils.js.map +1 -0
- package/lib-commonjs/utilities/colors.js +270 -0
- package/lib-commonjs/utilities/colors.js.map +1 -0
- package/lib-commonjs/utilities/getWindow.js +28 -0
- package/lib-commonjs/utilities/getWindow.js.map +1 -0
- package/lib-commonjs/utilities/index.js +8 -0
- package/lib-commonjs/utilities/index.js.map +1 -0
- package/lib-commonjs/utilities/locale-util.js +25 -0
- package/lib-commonjs/utilities/locale-util.js.map +1 -0
- package/lib-commonjs/utilities/overflow-utils.js +36 -0
- package/lib-commonjs/utilities/overflow-utils.js.map +1 -0
- package/lib-commonjs/utilities/test-data.js +324 -0
- package/lib-commonjs/utilities/test-data.js.map +1 -0
- package/lib-commonjs/utilities/utilities.js +1184 -0
- package/lib-commonjs/utilities/utilities.js.map +1 -0
- package/lib-commonjs/utilities/vbc-utils.js +45 -0
- package/lib-commonjs/utilities/vbc-utils.js.map +1 -0
- package/package.json +80 -72
- package/CHANGELOG.json +0 -65
- package/lib/chart/chart-legend.d.ts +0 -6
- package/lib/chart/chart-legend.js +0 -445
- package/lib/chart/chart-legend.js.map +0 -1
- package/lib/chart/chart-render.d.ts +0 -3
- package/lib/chart/chart-render.js +0 -50
- package/lib/chart/chart-render.js.map +0 -1
- package/lib/chart/chart.d.ts +0 -3
- package/lib/chart/chart.js +0 -10
- package/lib/chart/chart.js.map +0 -1
- package/lib/chart/index.d.ts +0 -1
- package/lib/chart/index.js +0 -2
- package/lib/chart/index.js.map +0 -1
- package/lib/index.d.ts +0 -7
- package/lib/lib/builder.d.ts +0 -89
- package/lib/lib/builder.js +0 -379
- package/lib/lib/builder.js.map +0 -1
- package/lib/lib/datasets.d.ts +0 -123
- package/lib/lib/datasets.js +0 -285
- package/lib/lib/datasets.js.map +0 -1
- package/lib/lib/patterns.d.ts +0 -43
- package/lib/lib/patterns.js +0 -433
- package/lib/lib/patterns.js.map +0 -1
- package/lib/lib/plugins.d.ts +0 -11
- package/lib/lib/plugins.js +0 -403
- package/lib/lib/plugins.js.map +0 -1
- package/lib/lib/settings.d.ts +0 -12
- package/lib/lib/settings.js +0 -368
- package/lib/lib/settings.js.map +0 -1
- package/lib/lib/storybook.d.ts +0 -11
- package/lib/lib/storybook.js +0 -13
- package/lib/lib/storybook.js.map +0 -1
- package/lib/lib/utils.d.ts +0 -34
- package/lib/lib/utils.js +0 -253
- package/lib/lib/utils.js.map +0 -1
- package/lib/types/index.d.ts +0 -1
- package/lib/types/types.d.ts +0 -101
- package/lib/types/types.js +0 -41
- package/lib/types/types.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["PlotlySchemaAdapter.ts"],"sourcesContent":["/* eslint-disable one-var */\n/* eslint-disable vars-on-top */\n/* eslint-disable no-var */\n/* eslint-disable @typescript-eslint/no-explicit-any */\nimport * as React from 'react';\nimport { bin as d3Bin, extent as d3Extent, sum as d3Sum, min as d3Min, max as d3Max, merge as d3Merge } from 'd3-array';\nimport { scaleLinear as d3ScaleLinear } from 'd3-scale';\nimport { format as d3Format, precisionFixed as d3PrecisionFixed } from 'd3-format';\nimport { DonutChartProps } from '../DonutChart/index';\nimport { ChartDataPoint, ChartProps, LineChartPoints, VerticalBarChartDataPoint } from '../../types/DataPoint';\nimport { LineChartProps } from '../LineChart/index';\nimport { getNextColor } from '../../utilities/colors';\nimport { VerticalBarChartProps } from '../VerticalBarChart/index';\nimport { findNumericMinMaxOfY } from '../../utilities/utilities';\nimport { Layout, PlotlySchema, PieData, PlotData } from './PlotlySchema';\nimport type { Datum, TypedArray } from './PlotlySchema';\nimport { timeParse } from 'd3-time-format';\n\ninterface SecondaryYAxisValues {\n secondaryYAxistitle?: string;\n secondaryYScaleOptions?: { yMinValue?: number; yMaxValue?: number };\n}\n\nconst SUPPORTED_PLOT_TYPES = ['pie', 'bar', 'scatter', 'heatmap', 'sankey', 'indicator', 'histogram'];\nconst dashOptions = {\n dot: {\n strokeDasharray: '1, 5',\n strokeLinecap: 'round',\n strokeWidth: '2',\n lineBorderWidth: '4',\n },\n dash: {\n strokeDasharray: '5, 5',\n strokeLinecap: 'butt',\n strokeWidth: '2',\n lineBorderWidth: '4',\n },\n longdash: {\n strokeDasharray: '10, 5',\n strokeLinecap: 'butt',\n strokeWidth: '2',\n lineBorderWidth: '4',\n },\n dashdot: {\n strokeDasharray: '5, 5, 1, 5',\n strokeLinecap: 'butt',\n strokeWidth: '2',\n lineBorderWidth: '4',\n },\n longdashdot: {\n strokeDasharray: '10, 5, 1, 5',\n strokeLinecap: 'butt',\n strokeWidth: '2',\n lineBorderWidth: '4',\n },\n solid: {\n strokeDasharray: '0',\n strokeLinecap: 'butt',\n strokeWidth: '2',\n lineBorderWidth: '4',\n },\n} as const;\nconst isDate = (value: any): boolean => {\n const parsedDate = new Date(Date.parse(value));\n if (isNaN(parsedDate.getTime())) {\n return false;\n }\n const parsedYear = parsedDate.getFullYear();\n const yearInString = /\\b\\d{4}\\b/.test(value);\n if (!yearInString && (parsedYear === 2000 || parsedYear === 2001)) {\n return false;\n }\n return true;\n};\n\nconst isNumber = (value: any): boolean => !isNaN(parseFloat(value)) && isFinite(value);\n\nconst isMonth = (possiblyMonthValue: any): boolean => {\n const parseFullMonth = timeParse('%B');\n const parseShortMonth = timeParse('%b');\n return parseFullMonth(possiblyMonthValue) !== null || parseShortMonth(possiblyMonthValue) !== null;\n};\n\nconst isArrayOfType = (\n plotCoordinates: Datum[] | Datum[][] | TypedArray | undefined,\n typeCheck: (datum: any, ...args: any[]) => boolean,\n ...args: any[]\n): boolean => {\n if (!isArrayOrTypedArray(plotCoordinates)) {\n return false;\n }\n\n if (plotCoordinates!.length === 0) {\n return false;\n }\n\n if (Array.isArray(plotCoordinates![0])) {\n // Handle 2D array\n return (plotCoordinates as Datum[][]).every(innerArray => innerArray.every(datum => typeCheck(datum, ...args)));\n } else {\n // Handle 1D array\n return (plotCoordinates as Datum[]).every(datum => typeCheck(datum, ...args));\n }\n};\n\nexport const isDateArray = (data: Datum[] | Datum[][] | TypedArray): boolean => {\n return isArrayOfType(data, isDate);\n};\n\nexport const isNumberArray = (data: Datum[] | Datum[][] | TypedArray): boolean => {\n return isArrayOfType(data, isNumber);\n};\n\nexport const isMonthArray = (data: Datum[] | Datum[][] | TypedArray): boolean => {\n return isArrayOfType(data, isMonth);\n};\n\nexport const isLineData = (data: Partial<PlotData>): boolean => {\n return (\n !SUPPORTED_PLOT_TYPES.includes(`${data.type}`) &&\n Array.isArray(data.x) &&\n isArrayOfType(data.y, (value: any) => typeof value === 'number') &&\n data.x.length > 0 &&\n data.x.length === data.y!.length\n );\n};\n\nconst invalidate2Dseries = (series: PlotData, chartType: string): void => {\n if (series.x?.length > 0 && Array.isArray(series.x[0])) {\n throw new Error(`transform to ${chartType}:: 2D x array not supported`);\n }\n if (series.y?.length > 0 && Array.isArray(series.y[0])) {\n throw new Error(`transform to ${chartType}:: 2D y array not supported`);\n }\n};\n\nconst getLegend = (series: PlotData, index: number): string => {\n return series.name || `Series ${index + 1}`;\n};\n\nfunction getTitles(layout: Partial<Layout> | undefined) {\n const titles = {\n chartTitle: typeof layout?.title === 'string' ? layout.title : layout?.title?.text ?? '',\n xAxisTitle: typeof layout?.xaxis?.title === 'string' ? layout?.xaxis?.title : layout?.xaxis?.title?.text ?? '',\n yAxisTitle: typeof layout?.yaxis?.title === 'string' ? layout?.yaxis?.title : layout?.yaxis?.title?.text ?? '',\n };\n return titles;\n}\n\nexport const updateXValues = (xValues: Datum[] | Datum[][] | TypedArray): any[] => {\n const presentYear = new Date().getFullYear();\n if (xValues.length > 0 && Array.isArray(xValues[0])) {\n throw new Error('updateXValues:: 2D array not supported');\n }\n const dates = (xValues as Datum[]).map(possiblyMonthValue => {\n const parsedDate = `${possiblyMonthValue} 01, ${presentYear}`;\n return isDate(parsedDate) ? new Date(parsedDate) : null;\n });\n for (let i = dates.length - 1; i > 0; i--) {\n const currentMonth = dates[i]!.getMonth();\n const previousMonth = dates[i - 1]!.getMonth();\n const currentYear = dates[i]!.getFullYear();\n const previousYear = dates[i - 1]!.getFullYear();\n if (previousMonth >= currentMonth) {\n dates[i - 1]!.setFullYear(dates[i]!.getFullYear() - 1);\n } else if (previousYear > currentYear) {\n dates[i - 1]!.setFullYear(currentYear);\n }\n }\n xValues = (xValues as Datum[]).map((month, index) => {\n return `${month} 01, ${dates[index]!.getFullYear()}`;\n });\n return xValues;\n};\n\nexport const getColor = (\n legendLabel: string,\n colorMap: React.MutableRefObject<Map<string, string>>,\n isDarkTheme?: boolean,\n): string => {\n if (!colorMap.current.has(legendLabel)) {\n const nextColor = getNextColor(colorMap.current.size + 1, 0, isDarkTheme);\n colorMap.current.set(legendLabel, nextColor);\n return nextColor;\n }\n\n return colorMap.current.get(legendLabel) as string;\n};\n\nconst getSecondaryYAxisValues = (series: PlotData, layout: Partial<Layout> | undefined) => {\n const secondaryYAxisValues: SecondaryYAxisValues = {};\n if (layout && layout.yaxis2 && series.yaxis === 'y2') {\n secondaryYAxisValues.secondaryYAxistitle =\n typeof layout.yaxis2.title === 'string'\n ? layout.yaxis2.title\n : typeof layout.yaxis2.title?.text === 'string'\n ? layout.yaxis2.title.text\n : '';\n if (layout.yaxis2.range) {\n secondaryYAxisValues.secondaryYScaleOptions = {\n yMinValue: layout.yaxis2.range[0],\n yMaxValue: layout.yaxis2.range[1],\n };\n } else {\n const yValues = series.y as number[];\n if (yValues) {\n secondaryYAxisValues.secondaryYScaleOptions = {\n yMinValue: Math.min(...yValues),\n yMaxValue: Math.max(...yValues),\n };\n }\n }\n }\n secondaryYAxisValues.secondaryYAxistitle =\n secondaryYAxisValues.secondaryYAxistitle !== '' ? secondaryYAxisValues.secondaryYAxistitle : undefined;\n secondaryYAxisValues.secondaryYScaleOptions =\n secondaryYAxisValues.secondaryYScaleOptions && Object.keys(secondaryYAxisValues.secondaryYScaleOptions).length !== 0\n ? secondaryYAxisValues.secondaryYScaleOptions\n : undefined;\n return secondaryYAxisValues;\n};\n\nexport const transformPlotlyJsonToDonutProps = (\n input: PlotlySchema,\n colorMap: React.MutableRefObject<Map<string, string>>,\n isDarkTheme?: boolean,\n): DonutChartProps => {\n const firstData = input.data[0] as PieData;\n\n const donutData = firstData.labels?.map((label: string, index: number): ChartDataPoint => {\n const color = getColor(label, colorMap, isDarkTheme);\n return {\n legend: label,\n data: firstData.values?.[index] as number, //ToDo how to handle string data?\n color,\n };\n });\n\n const width: number = input.layout?.width ?? 440;\n const height: number = input.layout?.height ?? 220;\n const hideLabels: boolean = firstData.textinfo\n ? !['value', 'percent', 'label+percent'].includes(firstData.textinfo)\n : false;\n const donutMarginHorizontal: number = hideLabels ? 0 : 80;\n const donutMarginVertical: number = 40 + (hideLabels ? 0 : 40);\n const innerRadius: number = firstData.hole\n ? firstData.hole * (Math.min(width - donutMarginHorizontal, height - donutMarginVertical) / 2)\n : 0;\n const { chartTitle } = getTitles(input.layout);\n\n return {\n data: {\n chartTitle,\n chartData: donutData,\n },\n hideLegend: input.layout?.showlegend === false ? true : false,\n width,\n height,\n innerRadius,\n hideLabels,\n showLabelsInPercent: firstData.textinfo ? ['percent', 'label+percent'].includes(firstData.textinfo) : true,\n };\n};\n\nexport const transformPlotlyJsonToVBCProps = (\n input: PlotlySchema,\n colorMap: React.MutableRefObject<Map<string, string>>,\n isDarkTheme?: boolean,\n): VerticalBarChartProps => {\n const vbcData: VerticalBarChartDataPoint[] = [];\n\n input.data.forEach((series: PlotData, index: number) => {\n invalidate2Dseries(series, 'VBC');\n\n if (!series.x) {\n return;\n }\n\n const scale = d3ScaleLinear()\n .domain(d3Extent<number>(series.x as number[]) as [number, number])\n .nice();\n let [xMin, xMax] = scale.domain();\n\n xMin = typeof series.xbins?.start === 'number' ? series.xbins.start : xMin;\n xMax = typeof series.xbins?.end === 'number' ? series.xbins.end : xMax;\n\n const bin = d3Bin().domain([xMin, xMax]);\n\n if (typeof series.xbins?.size === 'number') {\n const thresholds: number[] = [];\n let th = xMin;\n const precision = d3PrecisionFixed(series.xbins.size);\n const format = d3Format(`.${precision}f`);\n\n while (th < xMax + series.xbins.size) {\n thresholds.push(parseFloat(format(th)));\n th += series.xbins.size;\n }\n\n xMin = thresholds[0];\n xMax = thresholds[thresholds.length - 1];\n bin.domain([xMin, xMax]).thresholds(thresholds);\n }\n\n const buckets = bin(series.x as number[]);\n // If the start or end of xbins is specified, then the number of datapoints may become less than x.length\n const totalDataPoints = d3Merge(buckets).length;\n\n buckets.forEach(bucket => {\n const legend: string = getLegend(series, index);\n const color: string = getColor(legend, colorMap, isDarkTheme);\n let y = bucket.length;\n\n if (series.histnorm === 'percent') {\n y = (bucket.length / totalDataPoints) * 100;\n } else if (series.histnorm === 'probability') {\n y = bucket.length / totalDataPoints;\n } else if (series.histnorm === 'density') {\n y = bucket.x0 === bucket.x1 ? 0 : bucket.length / (bucket.x1! - bucket.x0!);\n } else if (series.histnorm === 'probability density') {\n y = bucket.x0 === bucket.x1 ? 0 : bucket.length / (totalDataPoints * (bucket.x1! - bucket.x0!));\n } else if (series.histfunc === 'sum') {\n y = d3Sum(bucket);\n } else if (series.histfunc === 'avg') {\n y = bucket.length === 0 ? 0 : d3Sum(bucket) / bucket.length;\n } else if (series.histfunc === 'min') {\n y = d3Min(bucket)!;\n } else if (series.histfunc === 'max') {\n y = d3Max(bucket)!;\n }\n\n vbcData.push({\n x: (bucket.x1! + bucket.x0!) / 2,\n y,\n legend,\n color,\n xAxisCalloutData: `[${bucket.x0} - ${bucket.x1})`,\n });\n });\n });\n\n const { chartTitle, xAxisTitle, yAxisTitle } = getTitles(input.layout);\n\n return {\n data: vbcData,\n // width: layout?.width,\n // height: layout?.height,\n chartTitle,\n xAxisTitle,\n yAxisTitle,\n hideTickOverlap: true,\n };\n};\n\nexport const transformPlotlyJsonToScatterChartProps = (\n input: PlotlySchema,\n isAreaChart: boolean,\n colorMap: React.MutableRefObject<Map<string, string>>,\n isDarkTheme?: boolean,\n): LineChartProps => {\n let secondaryYAxisValues: SecondaryYAxisValues = {};\n const chartData: LineChartPoints[] = input.data.map((series: PlotData, index: number) => {\n invalidate2Dseries(series, 'Scatter');\n const xValues = series.x as Datum[];\n const isString = typeof xValues[0] === 'string';\n const isXDate = isDateArray(xValues);\n const isXNumber = isNumberArray(xValues);\n const legend: string = getLegend(series, index);\n const lineColor = getColor(legend, colorMap, isDarkTheme);\n secondaryYAxisValues = getSecondaryYAxisValues(series, input.layout);\n\n return {\n legend,\n ...(series.line?.dash && dashOptions[series.line.dash]\n ? { lineOptions: { ...dashOptions[series.line.dash] } }\n : {}),\n data: xValues.map((x, i: number) => ({\n x: isString ? (isXDate ? new Date(x as string) : isXNumber ? parseFloat(x as string) : x) : x,\n y: series.y[i],\n })),\n color: lineColor,\n } as LineChartPoints;\n });\n\n const yMinMaxValues = findNumericMinMaxOfY(chartData);\n const { chartTitle, xAxisTitle, yAxisTitle } = getTitles(input.layout);\n\n const chartProps: ChartProps = {\n chartTitle,\n lineChartData: chartData,\n };\n\n return {\n data: chartProps,\n supportNegativeData: true,\n xAxisTitle,\n yAxisTitle,\n secondaryYAxistitle: secondaryYAxisValues.secondaryYAxistitle,\n secondaryYScaleOptions: secondaryYAxisValues.secondaryYScaleOptions,\n roundedTicks: true,\n yMinValue: yMinMaxValues.startValue,\n yMaxValue: yMinMaxValues.endValue,\n hideTickOverlap: true,\n } as LineChartProps;\n};\n\nconst MAX_DEPTH = 15;\nexport const sanitizeJson = (jsonObject: any, depth: number = 0): any => {\n if (depth > MAX_DEPTH) {\n throw new Error('Maximum json depth exceeded');\n }\n\n if (typeof jsonObject === 'object' && jsonObject !== null) {\n for (const key in jsonObject) {\n if (jsonObject.hasOwnProperty(key)) {\n if (typeof jsonObject[key] === 'string') {\n jsonObject[key] = jsonObject[key].replace(/</g, '<').replace(/>/g, '>');\n } else {\n jsonObject[key] = sanitizeJson(jsonObject[key], depth + 1);\n }\n }\n }\n }\n\n return jsonObject;\n};\n\nfunction isTypedArray(a: any) {\n return ArrayBuffer.isView(a) && !(a instanceof DataView);\n}\n\nexport function isArrayOrTypedArray(a: any) {\n return Array.isArray(a) || isTypedArray(a);\n}\n\nfunction isPlainObject(obj: any) {\n return (\n Object.prototype.toString.call(obj) === '[object Object]' &&\n Object.getPrototypeOf(obj).hasOwnProperty('hasOwnProperty')\n );\n}\n\nvar arrayAttributes: any[] = [];\nvar stack: any[] = [];\nvar isArrayStack: any[] = [];\nvar baseContainer: any, baseAttrName: any;\n/**\n * Interate iteratively through the trace object and find all the array attributes.\n * 1 trace record = 1 series of data\n * @param trace\n */\nexport function findArrayAttributes(trace: any) {\n // Init basecontainer and baseAttrName\n crawlIntoTrace(baseContainer, 0, '');\n}\n\nfunction crawlIntoTrace(container: any, i: number, astrPartial: any) {\n var item = container[stack[i]];\n var newAstrPartial = astrPartial + stack[i];\n if (i === stack.length - 1) {\n if (isArrayOrTypedArray(item)) {\n arrayAttributes.push(baseAttrName + newAstrPartial);\n }\n } else {\n if (isArrayStack[i]) {\n if (Array.isArray(item)) {\n for (var j = 0; j < item.length; j++) {\n if (isPlainObject(item[j])) {\n crawlIntoTrace(item[j], i + 1, newAstrPartial + '[' + j + '].');\n }\n }\n }\n } else if (isPlainObject(item)) {\n crawlIntoTrace(item, i + 1, newAstrPartial + '.');\n }\n }\n}\n"],"names":["findArrayAttributes","getColor","isArrayOrTypedArray","isDateArray","isLineData","isMonthArray","isNumberArray","sanitizeJson","transformPlotlyJsonToDonutProps","transformPlotlyJsonToScatterChartProps","transformPlotlyJsonToVBCProps","updateXValues","SUPPORTED_PLOT_TYPES","dashOptions","dot","strokeDasharray","strokeLinecap","strokeWidth","lineBorderWidth","dash","longdash","dashdot","longdashdot","solid","isDate","value","parsedDate","Date","parse","isNaN","getTime","parsedYear","getFullYear","yearInString","test","isNumber","parseFloat","isFinite","isMonth","possiblyMonthValue","parseFullMonth","timeParse","parseShortMonth","isArrayOfType","plotCoordinates","typeCheck","args","length","Array","isArray","every","innerArray","datum","data","includes","type","x","y","invalidate2Dseries","series","chartType","Error","getLegend","index","name","getTitles","layout","titles","chartTitle","title","text","xAxisTitle","xaxis","yAxisTitle","yaxis","xValues","presentYear","dates","map","i","currentMonth","getMonth","previousMonth","currentYear","previousYear","setFullYear","month","legendLabel","colorMap","isDarkTheme","current","has","nextColor","getNextColor","size","set","get","getSecondaryYAxisValues","secondaryYAxisValues","yaxis2","secondaryYAxistitle","range","secondaryYScaleOptions","yMinValue","yMaxValue","yValues","Math","min","max","undefined","Object","keys","input","firstData","donutData","labels","label","color","legend","values","width","height","hideLabels","textinfo","donutMarginHorizontal","donutMarginVertical","innerRadius","hole","chartData","hideLegend","showlegend","showLabelsInPercent","vbcData","forEach","scale","d3ScaleLinear","domain","d3Extent","nice","xMin","xMax","xbins","start","end","bin","d3Bin","thresholds","th","precision","d3PrecisionFixed","format","d3Format","push","buckets","totalDataPoints","d3Merge","bucket","histnorm","x0","x1","histfunc","d3Sum","d3Min","d3Max","xAxisCalloutData","hideTickOverlap","isAreaChart","isString","isXDate","isXNumber","lineColor","line","lineOptions","yMinMaxValues","findNumericMinMaxOfY","chartProps","lineChartData","supportNegativeData","roundedTicks","startValue","endValue","MAX_DEPTH","jsonObject","depth","key","hasOwnProperty","replace","isTypedArray","a","ArrayBuffer","isView","DataView","isPlainObject","obj","prototype","toString","call","getPrototypeOf","arrayAttributes","stack","isArrayStack","baseContainer","baseAttrName","trace","crawlIntoTrace","container","astrPartial","item","newAstrPartial","j"],"rang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GiI,iBAAiB;QAC/C;IACF;AACF"}
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "toImage", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return toImage;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const _d3selection = require("d3-selection");
|
|
12
|
+
const _index = require("../../utilities/index");
|
|
13
|
+
function toImage(chartContainer, opts = {}) {
|
|
14
|
+
return new Promise((resolve, reject)=>{
|
|
15
|
+
if (!chartContainer) {
|
|
16
|
+
return reject(new Error('Chart container is not defined'));
|
|
17
|
+
}
|
|
18
|
+
try {
|
|
19
|
+
const background = typeof opts.background === 'string' ? (0, _index.resolveCSSVariables)(chartContainer, opts.background) : 'transparent';
|
|
20
|
+
const svg = toSVG(chartContainer, background);
|
|
21
|
+
const svgData = new XMLSerializer().serializeToString(svg.node);
|
|
22
|
+
const svgDataUrl = 'data:image/svg+xml;base64,' + btoa(unescapePonyfill(encodeURIComponent(svgData)));
|
|
23
|
+
svgToPng(svgDataUrl, {
|
|
24
|
+
width: opts.width || svg.width,
|
|
25
|
+
height: opts.height || svg.height,
|
|
26
|
+
scale: opts.scale
|
|
27
|
+
}).then(resolve).catch(reject);
|
|
28
|
+
} catch (err) {
|
|
29
|
+
return reject(err);
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
const SVG_STYLE_PROPERTIES = [
|
|
34
|
+
'display',
|
|
35
|
+
'fill',
|
|
36
|
+
'fill-opacity',
|
|
37
|
+
'opacity',
|
|
38
|
+
'stroke',
|
|
39
|
+
'stroke-width',
|
|
40
|
+
'transform'
|
|
41
|
+
];
|
|
42
|
+
const SVG_TEXT_STYLE_PROPERTIES = [
|
|
43
|
+
'font-family',
|
|
44
|
+
'font-size',
|
|
45
|
+
'font-weight',
|
|
46
|
+
'text-anchor'
|
|
47
|
+
];
|
|
48
|
+
function toSVG(chartContainer, background) {
|
|
49
|
+
const svg = chartContainer.querySelector('svg');
|
|
50
|
+
if (!svg) {
|
|
51
|
+
throw new Error('SVG not found');
|
|
52
|
+
}
|
|
53
|
+
const clonedSvg = (0, _d3selection.select)(svg.cloneNode(true)).attr('width', null).attr('height', null).attr('viewBox', null);
|
|
54
|
+
const svgElements = svg.getElementsByTagName('*');
|
|
55
|
+
const clonedSvgElements = clonedSvg.node().getElementsByTagName('*');
|
|
56
|
+
for(let i = 0; i < svgElements.length; i++){
|
|
57
|
+
if (svgElements[i].tagName.toLowerCase() === 'text') {
|
|
58
|
+
copyStyle([
|
|
59
|
+
...SVG_STYLE_PROPERTIES,
|
|
60
|
+
...SVG_TEXT_STYLE_PROPERTIES
|
|
61
|
+
], svgElements[i], clonedSvgElements[i]);
|
|
62
|
+
} else {
|
|
63
|
+
copyStyle(SVG_STYLE_PROPERTIES, svgElements[i], clonedSvgElements[i]);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
const { width: svgWidth, height: svgHeight } = svg.getBoundingClientRect();
|
|
67
|
+
const legendGroup = cloneLegendsToSVG(chartContainer, svgWidth, svgHeight);
|
|
68
|
+
const w1 = Math.max(svgWidth, legendGroup.width);
|
|
69
|
+
const h1 = svgHeight + legendGroup.height;
|
|
70
|
+
if (legendGroup.node) {
|
|
71
|
+
clonedSvg.append(()=>legendGroup.node);
|
|
72
|
+
}
|
|
73
|
+
clonedSvg.insert('rect', ':first-child').attr('x', 0).attr('y', 0).attr('width', w1).attr('height', h1).attr('fill', background);
|
|
74
|
+
clonedSvg.attr('width', w1).attr('height', h1).attr('viewBox', `0 0 ${w1} ${h1}`);
|
|
75
|
+
return {
|
|
76
|
+
node: clonedSvg.node(),
|
|
77
|
+
width: w1,
|
|
78
|
+
height: h1
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
const LEGEND_RECT_STYLE_PROPERTIES_MAP = {
|
|
82
|
+
'background-color': 'fill',
|
|
83
|
+
'border-color': 'stroke'
|
|
84
|
+
};
|
|
85
|
+
const LEGEND_TEXT_STYLE_PROPERTIES_MAP = {
|
|
86
|
+
color: 'fill',
|
|
87
|
+
'font-family': 'font-family',
|
|
88
|
+
'font-size': 'font-size',
|
|
89
|
+
'font-weight': 'font-weight',
|
|
90
|
+
opacity: 'opacity'
|
|
91
|
+
};
|
|
92
|
+
function cloneLegendsToSVG(chartContainer, svgWidth, svgHeight) {
|
|
93
|
+
const legendButtons = chartContainer.querySelectorAll(`
|
|
94
|
+
button.fui-legend__legend:not([data-overflowing]),
|
|
95
|
+
.fui-donut__legendContainer button.fui-MenuButton,
|
|
96
|
+
.fui-cart__legendContainer button.fui-MenuButton
|
|
97
|
+
`);
|
|
98
|
+
if (legendButtons.length === 0) {
|
|
99
|
+
return {
|
|
100
|
+
node: null,
|
|
101
|
+
width: 0,
|
|
102
|
+
height: 0
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
const legendGroup = (0, _d3selection.create)('svg:g');
|
|
106
|
+
let legendX = 0;
|
|
107
|
+
let legendY = 8;
|
|
108
|
+
let legendLine = [];
|
|
109
|
+
const legendLines = [];
|
|
110
|
+
const legendLineWidths = [];
|
|
111
|
+
for(let i = 0; i < legendButtons.length; i++){
|
|
112
|
+
const { width: legendWidth } = legendButtons[i].getBoundingClientRect();
|
|
113
|
+
const legendItem = legendGroup.append('g');
|
|
114
|
+
legendLine.push(legendItem);
|
|
115
|
+
if (legendX + legendWidth > svgWidth && legendLine.length > 1) {
|
|
116
|
+
legendLine.pop();
|
|
117
|
+
legendLines.push(legendLine);
|
|
118
|
+
legendLineWidths.push(legendX);
|
|
119
|
+
legendLine = [
|
|
120
|
+
legendItem
|
|
121
|
+
];
|
|
122
|
+
legendX = 0;
|
|
123
|
+
legendY += 32;
|
|
124
|
+
}
|
|
125
|
+
let legendText;
|
|
126
|
+
let textOffset = 0;
|
|
127
|
+
if (!legendButtons[i].hasAttribute('data-overflow-menu')) {
|
|
128
|
+
const legendRect = legendButtons[i].querySelector('.fui-legend__rect');
|
|
129
|
+
legendText = legendButtons[i].querySelector('.fui-legend__text');
|
|
130
|
+
legendItem.append('rect').attr('x', legendX + 8).attr('y', svgHeight + legendY + 8).attr('width', 12).attr('height', 12).attr('stroke-width', 1).call((selection)=>copyStyle(LEGEND_RECT_STYLE_PROPERTIES_MAP, legendRect, selection.node()));
|
|
131
|
+
textOffset = 28;
|
|
132
|
+
} else {
|
|
133
|
+
legendText = legendButtons[i];
|
|
134
|
+
console.log(legendText.textContent);
|
|
135
|
+
textOffset = 8;
|
|
136
|
+
}
|
|
137
|
+
legendItem.append('text').attr('x', legendX + textOffset).attr('y', svgHeight + legendY + 8).attr('dominant-baseline', 'hanging').text(legendText.textContent).call((selection)=>copyStyle(LEGEND_TEXT_STYLE_PROPERTIES_MAP, legendText, selection.node()));
|
|
138
|
+
legendX += legendWidth;
|
|
139
|
+
}
|
|
140
|
+
legendLines.push(legendLine);
|
|
141
|
+
legendLineWidths.push(legendX);
|
|
142
|
+
legendY += 32;
|
|
143
|
+
const centerLegends = true;
|
|
144
|
+
if (centerLegends) {
|
|
145
|
+
legendLines.forEach((ln, idx)=>{
|
|
146
|
+
const offsetX = Math.max((svgWidth - legendLineWidths[idx]) / 2, 0);
|
|
147
|
+
ln.forEach((item)=>{
|
|
148
|
+
item.attr('transform', `translate(${offsetX}, 0)`);
|
|
149
|
+
});
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
return {
|
|
153
|
+
node: legendGroup.node(),
|
|
154
|
+
width: Math.max(...legendLineWidths),
|
|
155
|
+
height: legendY
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
function svgToPng(svgDataUrl, opts = {}) {
|
|
159
|
+
return new Promise((resolve, reject)=>{
|
|
160
|
+
const scale = opts.scale || 1;
|
|
161
|
+
const w0 = opts.width || 300;
|
|
162
|
+
const h0 = opts.height || 150;
|
|
163
|
+
const w1 = scale * w0;
|
|
164
|
+
const h1 = scale * h0;
|
|
165
|
+
const canvas = document.createElement('canvas');
|
|
166
|
+
const img = new Image();
|
|
167
|
+
canvas.width = w1;
|
|
168
|
+
canvas.height = h1;
|
|
169
|
+
img.onload = function() {
|
|
170
|
+
const ctx = canvas.getContext('2d');
|
|
171
|
+
if (!ctx) {
|
|
172
|
+
return reject(new Error('Canvas context is null'));
|
|
173
|
+
}
|
|
174
|
+
ctx.clearRect(0, 0, w1, h1);
|
|
175
|
+
ctx.drawImage(img, 0, 0, w1, h1);
|
|
176
|
+
const imgData = canvas.toDataURL('image/png');
|
|
177
|
+
resolve(imgData);
|
|
178
|
+
};
|
|
179
|
+
img.onerror = function(err) {
|
|
180
|
+
reject(err);
|
|
181
|
+
};
|
|
182
|
+
img.src = svgDataUrl;
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
const hex2 = /^[\da-f]{2}$/i;
|
|
186
|
+
const hex4 = /^[\da-f]{4}$/i;
|
|
187
|
+
/**
|
|
188
|
+
* A ponyfill for the deprecated `unescape` method, taken from the `core-js` library.
|
|
189
|
+
*
|
|
190
|
+
* Source: {@link https://github.com/zloirock/core-js/blob/167136f479d3b8519953f2e4c534ecdd1031d3cf/packages/core-js/modules/es.unescape.js core-js/packages/core-js/modules/es.unescape.js}
|
|
191
|
+
*/ function unescapePonyfill(str) {
|
|
192
|
+
let result = '';
|
|
193
|
+
const length = str.length;
|
|
194
|
+
let index = 0;
|
|
195
|
+
let chr;
|
|
196
|
+
let part;
|
|
197
|
+
while(index < length){
|
|
198
|
+
chr = str.charAt(index++);
|
|
199
|
+
if (chr === '%') {
|
|
200
|
+
if (str.charAt(index) === 'u') {
|
|
201
|
+
part = str.slice(index + 1, index + 5);
|
|
202
|
+
if (hex4.exec(part)) {
|
|
203
|
+
result += String.fromCharCode(parseInt(part, 16));
|
|
204
|
+
index += 5;
|
|
205
|
+
continue;
|
|
206
|
+
}
|
|
207
|
+
} else {
|
|
208
|
+
part = str.slice(index, index + 2);
|
|
209
|
+
if (hex2.exec(part)) {
|
|
210
|
+
result += String.fromCharCode(parseInt(part, 16));
|
|
211
|
+
index += 2;
|
|
212
|
+
continue;
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
result += chr;
|
|
217
|
+
}
|
|
218
|
+
return result;
|
|
219
|
+
}
|
|
220
|
+
function copyStyle(properties, fromEl, toEl) {
|
|
221
|
+
const styles = getComputedStyle(fromEl);
|
|
222
|
+
if (Array.isArray(properties)) {
|
|
223
|
+
properties.forEach((prop)=>{
|
|
224
|
+
(0, _d3selection.select)(toEl).style(prop, styles.getPropertyValue(prop));
|
|
225
|
+
});
|
|
226
|
+
} else {
|
|
227
|
+
Object.entries(properties).forEach(([fromProp, toProp])=>{
|
|
228
|
+
(0, _d3selection.select)(toEl).style(toProp, styles.getPropertyValue(fromProp));
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["imageExporter.ts"],"sourcesContent":["import { create as d3Create, select as d3Select, Selection } from 'd3-selection';\nimport { resolveCSSVariables } from '../../utilities/index';\n\n/**\n * {@docCategory DeclarativeChart}\n */\nexport interface ImageExportOptions {\n width?: number;\n height?: number;\n scale?: number;\n background?: string;\n}\n\nexport function toImage(chartContainer?: HTMLElement | null, opts: ImageExportOptions = {}): Promise<string> {\n return new Promise((resolve, reject) => {\n if (!chartContainer) {\n return reject(new Error('Chart container is not defined'));\n }\n\n try {\n const background =\n typeof opts.background === 'string' ? resolveCSSVariables(chartContainer, opts.background) : 'transparent';\n const svg = toSVG(chartContainer, background);\n\n const svgData = new XMLSerializer().serializeToString(svg.node);\n const svgDataUrl = 'data:image/svg+xml;base64,' + btoa(unescapePonyfill(encodeURIComponent(svgData)));\n\n svgToPng(svgDataUrl, {\n width: opts.width || svg.width,\n height: opts.height || svg.height,\n scale: opts.scale,\n })\n .then(resolve)\n .catch(reject);\n } catch (err) {\n return reject(err);\n }\n });\n}\n\nconst SVG_STYLE_PROPERTIES = ['display', 'fill', 'fill-opacity', 'opacity', 'stroke', 'stroke-width', 'transform'];\nconst SVG_TEXT_STYLE_PROPERTIES = ['font-family', 'font-size', 'font-weight', 'text-anchor'];\n\nfunction toSVG(chartContainer: HTMLElement, background: string) {\n const svg = chartContainer.querySelector<SVGSVGElement>('svg');\n if (!svg) {\n throw new Error('SVG not found');\n }\n\n const clonedSvg = d3Select(svg.cloneNode(true) as SVGSVGElement)\n .attr('width', null)\n .attr('height', null)\n .attr('viewBox', null);\n const svgElements = svg.getElementsByTagName('*');\n const clonedSvgElements = clonedSvg.node()!.getElementsByTagName('*');\n\n for (let i = 0; i < svgElements.length; i++) {\n if (svgElements[i].tagName.toLowerCase() === 'text') {\n copyStyle([...SVG_STYLE_PROPERTIES, ...SVG_TEXT_STYLE_PROPERTIES], svgElements[i], clonedSvgElements[i]);\n } else {\n copyStyle(SVG_STYLE_PROPERTIES, svgElements[i], clonedSvgElements[i]);\n }\n }\n\n const { width: svgWidth, height: svgHeight } = svg.getBoundingClientRect();\n const legendGroup = cloneLegendsToSVG(chartContainer, svgWidth, svgHeight);\n const w1 = Math.max(svgWidth, legendGroup.width);\n const h1 = svgHeight + legendGroup.height;\n\n if (legendGroup.node) {\n clonedSvg.append(() => legendGroup.node);\n }\n clonedSvg\n .insert('rect', ':first-child')\n .attr('x', 0)\n .attr('y', 0)\n .attr('width', w1)\n .attr('height', h1)\n .attr('fill', background);\n clonedSvg.attr('width', w1).attr('height', h1).attr('viewBox', `0 0 ${w1} ${h1}`);\n\n return {\n node: clonedSvg.node()!,\n width: w1,\n height: h1,\n };\n}\n\nconst LEGEND_RECT_STYLE_PROPERTIES_MAP = {\n 'background-color': 'fill',\n 'border-color': 'stroke',\n};\nconst LEGEND_TEXT_STYLE_PROPERTIES_MAP = {\n color: 'fill',\n 'font-family': 'font-family',\n 'font-size': 'font-size',\n 'font-weight': 'font-weight',\n opacity: 'opacity',\n};\n\nfunction cloneLegendsToSVG(chartContainer: HTMLElement, svgWidth: number, svgHeight: number) {\n const legendButtons = chartContainer.querySelectorAll<HTMLElement>(`\n button.fui-legend__legend:not([data-overflowing]),\n .fui-donut__legendContainer button.fui-MenuButton,\n .fui-cart__legendContainer button.fui-MenuButton\n `);\n if (legendButtons.length === 0) {\n return {\n node: null,\n width: 0,\n height: 0,\n };\n }\n\n const legendGroup = d3Create<SVGGElement>('svg:g');\n let legendX = 0;\n let legendY = 8;\n let legendLine: Selection<SVGGElement, unknown, null, undefined>[] = [];\n const legendLines: (typeof legendLine)[] = [];\n const legendLineWidths: number[] = [];\n\n for (let i = 0; i < legendButtons.length; i++) {\n const { width: legendWidth } = legendButtons[i].getBoundingClientRect();\n const legendItem = legendGroup.append('g');\n\n legendLine.push(legendItem);\n if (legendX + legendWidth > svgWidth && legendLine.length > 1) {\n legendLine.pop();\n legendLines.push(legendLine);\n legendLineWidths.push(legendX);\n\n legendLine = [legendItem];\n legendX = 0;\n legendY += 32;\n }\n\n let legendText: HTMLDivElement | HTMLButtonElement | null;\n let textOffset = 0;\n\n if (!legendButtons[i].hasAttribute('data-overflow-menu')) {\n const legendRect = legendButtons[i].querySelector<HTMLDivElement>('.fui-legend__rect');\n\n legendText = legendButtons[i].querySelector<HTMLDivElement>('.fui-legend__text');\n legendItem\n .append('rect')\n .attr('x', legendX + 8)\n .attr('y', svgHeight + legendY + 8)\n .attr('width', 12)\n .attr('height', 12)\n .attr('stroke-width', 1)\n .call(selection => copyStyle(LEGEND_RECT_STYLE_PROPERTIES_MAP, legendRect!, selection.node()!));\n textOffset = 28;\n } else {\n legendText = legendButtons[i] as HTMLButtonElement;\n console.log(legendText!.textContent);\n textOffset = 8;\n }\n\n legendItem\n .append('text')\n .attr('x', legendX + textOffset)\n .attr('y', svgHeight + legendY + 8)\n .attr('dominant-baseline', 'hanging')\n .text(legendText!.textContent)\n .call(selection => copyStyle(LEGEND_TEXT_STYLE_PROPERTIES_MAP, legendText!, selection.node()!));\n legendX += legendWidth;\n }\n\n legendLines.push(legendLine);\n legendLineWidths.push(legendX);\n legendY += 32;\n\n const centerLegends = true;\n if (centerLegends) {\n legendLines.forEach((ln, idx) => {\n const offsetX = Math.max((svgWidth - legendLineWidths[idx]) / 2, 0);\n ln.forEach(item => {\n item.attr('transform', `translate(${offsetX}, 0)`);\n });\n });\n }\n\n return {\n node: legendGroup.node(),\n width: Math.max(...legendLineWidths),\n height: legendY,\n };\n}\n\nfunction svgToPng(svgDataUrl: string, opts: ImageExportOptions = {}): Promise<string> {\n return new Promise((resolve, reject) => {\n const scale = opts.scale || 1;\n const w0 = opts.width || 300;\n const h0 = opts.height || 150;\n const w1 = scale * w0;\n const h1 = scale * h0;\n\n const canvas = document.createElement('canvas');\n const img = new Image();\n\n canvas.width = w1;\n canvas.height = h1;\n\n img.onload = function () {\n const ctx = canvas.getContext('2d');\n if (!ctx) {\n return reject(new Error('Canvas context is null'));\n }\n\n ctx.clearRect(0, 0, w1, h1);\n ctx.drawImage(img, 0, 0, w1, h1);\n\n const imgData = canvas.toDataURL('image/png');\n resolve(imgData);\n };\n\n img.onerror = function (err) {\n reject(err);\n };\n\n img.src = svgDataUrl;\n });\n}\n\nconst hex2 = /^[\\da-f]{2}$/i;\nconst hex4 = /^[\\da-f]{4}$/i;\n\n/**\n * A ponyfill for the deprecated `unescape` method, taken from the `core-js` library.\n *\n * Source: {@link https://github.com/zloirock/core-js/blob/167136f479d3b8519953f2e4c534ecdd1031d3cf/packages/core-js/modules/es.unescape.js core-js/packages/core-js/modules/es.unescape.js}\n */\nfunction unescapePonyfill(str: string) {\n let result = '';\n const length = str.length;\n let index = 0;\n let chr;\n let part;\n while (index < length) {\n chr = str.charAt(index++);\n if (chr === '%') {\n if (str.charAt(index) === 'u') {\n part = str.slice(index + 1, index + 5);\n if (hex4.exec(part)) {\n result += String.fromCharCode(parseInt(part, 16));\n index += 5;\n continue;\n }\n } else {\n part = str.slice(index, index + 2);\n if (hex2.exec(part)) {\n result += String.fromCharCode(parseInt(part, 16));\n index += 2;\n continue;\n }\n }\n }\n result += chr;\n }\n return result;\n}\n\nfunction copyStyle(properties: string[] | Record<string, string>, fromEl: Element, toEl: Element) {\n const styles = getComputedStyle(fromEl);\n if (Array.isArray(properties)) {\n properties.forEach(prop => {\n d3Select(toEl).style(prop, styles.getPropertyValue(prop));\n });\n } else {\n Object.entries(properties).forEach(([fromProp, toProp]) => {\n d3Select(toEl).style(toProp, styles.getPropertyValue(fromProp));\n });\n }\n}\n"],"names":["toImage","chartContainer","opts","Promise","resolve","reject","Error","background","resolveCSSVariables","svg","toSVG","svgData","XMLSerializer","serializeToString","node","svgDataUrl","btoa","unescapePonyfill","encodeURIComponent","svgToPng","width","height","scale","then","catch","err","SVG_STYLE_PROPERTIES","SVG_TEXT_STYLE_PROPERTIES","querySelector","clonedSvg","d3Select","cloneNode","attr","svgElements","getElementsByTagName","clonedSvgElements","i","length","tagName","toLowerCase","copyStyle","svgWidth","svgHeight","getBoundingClientRect","legendGroup","cloneLegendsToSVG","w1","Math","max","h1","append","insert","LEGEND_RECT_STYLE_PROPERTIES_MAP","LEGEND_TEXT_STYLE_PROPERTIES_MAP","color","opacity","legendButtons","querySelectorAll","d3Create","legendX","legendY","legendLine","legendLines","legendLineWidths","legendWidth","legendItem","push","pop","legendText","textOffset","hasAttribute","legendRect","call","selection","console","log","textContent","text","centerLegends","forEach","ln","idx","offsetX","item","w0","h0","canvas","document","createElement","img","Image","onload","ctx","getContext","clearRect","drawImage","imgData","toDataURL","onerror","src","hex2","hex4","str","result","index","chr","part","charAt","slice","exec","String","fromCharCode","parseInt","properties","fromEl","toEl","styles","getComputedStyle","Array","isArray","prop","style","getPropertyValue","Object","entries","fromProp","toProp"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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ACC,SAASN,MAAM;oBAC7CF,SAAS;oBACT;gBACF;YACF;QACF;QACAD,UAAUE;IACZ;IACA,OAAOF;AACT;AAEA,SAAS/D,UAAUyE,UAA6C,EAAEC,MAAe,EAAEC,IAAa;IAC9F,MAAMC,SAASC,iBAAiBH;IAChC,IAAII,MAAMC,OAAO,CAACN,aAAa;QAC7BA,WAAWlC,OAAO,CAACyC,CAAAA;YACjB1F,IAAAA,mBAAAA,EAASqF,MAAMM,KAAK,CAACD,MAAMJ,OAAOM,gBAAgB,CAACF;QACrD;IACF,OAAO;QACLG,OAAOC,OAAO,CAACX,YAAYlC,OAAO,CAAC,CAAC,CAAC8C,UAAUC,OAAO;YACpDhG,IAAAA,mBAAAA,EAASqF,MAAMM,KAAK,CAACK,QAAQV,OAAOM,gBAAgB,CAACG;QACvD;IACF;AACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["index.ts"],"sourcesContent":["export * from './DeclarativeChart';\nexport type { ImageExportOptions } from './imageExporter';\n"],"names":[],"rangeMappings":";;;;;","mappings":";;;;;uBAAc"}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "Arc", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return Arc;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
|
12
|
+
const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
|
13
|
+
const _d3shape = require("d3-shape");
|
|
14
|
+
const _useArcStylesstyles = require("./useArcStyles.styles");
|
|
15
|
+
const _d3format = require("d3-format");
|
|
16
|
+
const _index = require("../../../utilities/index");
|
|
17
|
+
const Arc = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
|
|
18
|
+
var _props_data;
|
|
19
|
+
const arc = (0, _d3shape.arc)();
|
|
20
|
+
const currentRef = /*#__PURE__*/ _react.createRef();
|
|
21
|
+
const _isRTL = (0, _index.useRtl)();
|
|
22
|
+
const classes = (0, _useArcStylesstyles.useArcStyles)(props);
|
|
23
|
+
_react.useEffect(()=>{
|
|
24
|
+
_updateChart(props);
|
|
25
|
+
}, [
|
|
26
|
+
props
|
|
27
|
+
]);
|
|
28
|
+
function _onFocus(data, id) {
|
|
29
|
+
props.onFocusCallback(data, id, currentRef.current);
|
|
30
|
+
}
|
|
31
|
+
function _hoverOn(data, mouseEvent) {
|
|
32
|
+
mouseEvent.persist();
|
|
33
|
+
props.hoverOnCallback(data, mouseEvent);
|
|
34
|
+
}
|
|
35
|
+
function _hoverOff() {
|
|
36
|
+
props.hoverLeaveCallback();
|
|
37
|
+
}
|
|
38
|
+
function _onBlur() {
|
|
39
|
+
props.onBlurCallback();
|
|
40
|
+
}
|
|
41
|
+
function _getAriaLabel() {
|
|
42
|
+
var _point_callOutAccessibilityData;
|
|
43
|
+
const point = props.data.data;
|
|
44
|
+
const legend = point.xAxisCalloutData || point.legend;
|
|
45
|
+
const yValue = point.yAxisCalloutData || point.data || 0;
|
|
46
|
+
return ((_point_callOutAccessibilityData = point.callOutAccessibilityData) === null || _point_callOutAccessibilityData === void 0 ? void 0 : _point_callOutAccessibilityData.ariaLabel) || (legend ? `${legend}, ` : '') + `${yValue}.`;
|
|
47
|
+
}
|
|
48
|
+
function _renderArcLabel(className) {
|
|
49
|
+
const { data, innerRadius, outerRadius, showLabelsInPercent, totalValue, hideLabels, activeArc } = props;
|
|
50
|
+
if (hideLabels || Math.abs(data.endAngle - data.startAngle) < Math.PI / 12 || activeArc !== data.data.legend && activeArc !== '') {
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
53
|
+
const [base, perp] = arc.centroid({
|
|
54
|
+
...data,
|
|
55
|
+
innerRadius,
|
|
56
|
+
outerRadius
|
|
57
|
+
});
|
|
58
|
+
const hyp = Math.sqrt(base * base + perp * perp);
|
|
59
|
+
const labelRadius = Math.max(innerRadius, outerRadius) + 2;
|
|
60
|
+
const angle = (data.startAngle + data.endAngle) / 2;
|
|
61
|
+
const arcValue = data.value;
|
|
62
|
+
return /*#__PURE__*/ _react.createElement("text", {
|
|
63
|
+
x: (hyp === 0 ? 0 : base / hyp) * labelRadius,
|
|
64
|
+
y: (hyp === 0 ? 0 : perp / hyp) * labelRadius,
|
|
65
|
+
textAnchor: angle > Math.PI !== _isRTL ? 'end' : 'start',
|
|
66
|
+
dominantBaseline: angle > Math.PI / 2 && angle < 3 * Math.PI / 2 ? 'hanging' : 'auto',
|
|
67
|
+
className: className,
|
|
68
|
+
"aria-hidden": true
|
|
69
|
+
}, showLabelsInPercent ? (0, _d3format.format)('.0%')(totalValue === 0 ? 0 : arcValue / totalValue) : (0, _index.formatValueWithSIPrefix)(arcValue));
|
|
70
|
+
}
|
|
71
|
+
function _updateChart(newProps) {
|
|
72
|
+
if (newProps.arc && newProps.innerRadius && newProps.outerRadius) {
|
|
73
|
+
newProps.arc.innerRadius(newProps.innerRadius);
|
|
74
|
+
newProps.arc.outerRadius(newProps.outerRadius);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
const { href, focusedArcId } = props;
|
|
78
|
+
//TO DO 'replace' is throwing error
|
|
79
|
+
const id = props.uniqText + props.data.data.legend.replace(/\s+/, '') + props.data.data.data;
|
|
80
|
+
const opacity = props.activeArc === props.data.data.legend || props.activeArc === '' ? 1 : 0.1;
|
|
81
|
+
return /*#__PURE__*/ _react.createElement("g", {
|
|
82
|
+
ref: currentRef
|
|
83
|
+
}, !!focusedArcId && focusedArcId === id && // TODO innerradius and outerradius were absent
|
|
84
|
+
/*#__PURE__*/ _react.createElement("path", {
|
|
85
|
+
id: id + 'focusRing',
|
|
86
|
+
d: arc({
|
|
87
|
+
...props.focusData,
|
|
88
|
+
innerRadius: props.innerRadius,
|
|
89
|
+
outerRadius: props.outerRadius
|
|
90
|
+
}),
|
|
91
|
+
className: classes.focusRing
|
|
92
|
+
}), /*#__PURE__*/ _react.createElement("path", {
|
|
93
|
+
// TODO innerradius and outerradius were absent
|
|
94
|
+
id: id,
|
|
95
|
+
d: arc({
|
|
96
|
+
...props.data,
|
|
97
|
+
innerRadius: props.innerRadius,
|
|
98
|
+
outerRadius: props.outerRadius
|
|
99
|
+
}),
|
|
100
|
+
className: classes.root,
|
|
101
|
+
style: {
|
|
102
|
+
fill: props.color,
|
|
103
|
+
cursor: href ? 'pointer' : 'default'
|
|
104
|
+
},
|
|
105
|
+
onFocus: _onFocus.bind(void 0, props.data.data, id),
|
|
106
|
+
"data-is-focusable": props.activeArc === props.data.data.legend || props.activeArc === '',
|
|
107
|
+
onMouseOver: _hoverOn.bind(void 0, props.data.data),
|
|
108
|
+
onMouseMove: _hoverOn.bind(void 0, props.data.data),
|
|
109
|
+
onMouseLeave: _hoverOff,
|
|
110
|
+
onBlur: _onBlur,
|
|
111
|
+
opacity: opacity,
|
|
112
|
+
onClick: (_props_data = props.data) === null || _props_data === void 0 ? void 0 : _props_data.data.onClick,
|
|
113
|
+
"aria-label": _getAriaLabel(),
|
|
114
|
+
role: "img"
|
|
115
|
+
}), _renderArcLabel(classes.arcLabel));
|
|
116
|
+
});
|
|
117
|
+
Arc.displayName = 'Arc';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["Arc.tsx"],"sourcesContent":["import * as React from 'react';\nimport { arc as d3Arc } from 'd3-shape';\nimport { useArcStyles } from './useArcStyles.styles';\nimport { ChartDataPoint } from '../index';\nimport { ArcProps } from './index';\nimport { format as d3Format } from 'd3-format';\nimport { formatValueWithSIPrefix, useRtl } from '../../../utilities/index';\n\n// Create a Arc within Donut Chart variant which uses these default styles and this styled subcomponent.\n/**\n * Arc component within Donut Chart.\n * {@docCategory ArcDonutChart}\n */\nexport const Arc: React.FunctionComponent<ArcProps> = React.forwardRef<HTMLDivElement, ArcProps>(\n (props, forwardedRef) => {\n const arc = d3Arc();\n const currentRef = React.createRef<SVGPathElement>();\n const _isRTL: boolean = useRtl();\n const classes = useArcStyles(props);\n\n React.useEffect(() => {\n _updateChart(props);\n }, [props]);\n\n function _onFocus(data: ChartDataPoint, id: string): void {\n props.onFocusCallback!(data, id, currentRef.current);\n }\n\n function _hoverOn(data: ChartDataPoint, mouseEvent: React.MouseEvent<SVGPathElement>): void {\n mouseEvent.persist();\n props.hoverOnCallback!(data, mouseEvent);\n }\n\n function _hoverOff(): void {\n props.hoverLeaveCallback!();\n }\n\n function _onBlur(): void {\n props.onBlurCallback!();\n }\n\n function _getAriaLabel(): string {\n const point = props.data!.data;\n const legend = point.xAxisCalloutData || point.legend;\n const yValue = point.yAxisCalloutData || point.data || 0;\n return point.callOutAccessibilityData?.ariaLabel || (legend ? `${legend}, ` : '') + `${yValue}.`;\n }\n\n function _renderArcLabel(className: string) {\n const { data, innerRadius, outerRadius, showLabelsInPercent, totalValue, hideLabels, activeArc } = props;\n\n if (\n hideLabels ||\n Math.abs(data!.endAngle - data!.startAngle) < Math.PI / 12 ||\n (activeArc !== data!.data.legend && activeArc !== '')\n ) {\n return null;\n }\n\n const [base, perp] = arc.centroid({ ...data!, innerRadius, outerRadius });\n const hyp = Math.sqrt(base * base + perp * perp);\n const labelRadius = Math.max(innerRadius!, outerRadius!) + 2;\n const angle = (data!.startAngle + data!.endAngle) / 2;\n const arcValue = data!.value;\n\n return (\n <text\n x={(hyp === 0 ? 0 : base / hyp) * labelRadius}\n y={(hyp === 0 ? 0 : perp / hyp) * labelRadius}\n textAnchor={angle > Math.PI !== _isRTL ? 'end' : 'start'}\n dominantBaseline={angle > Math.PI / 2 && angle < (3 * Math.PI) / 2 ? 'hanging' : 'auto'}\n className={className}\n aria-hidden={true}\n >\n {showLabelsInPercent\n ? d3Format('.0%')(totalValue! === 0 ? 0 : arcValue / totalValue!)\n : formatValueWithSIPrefix(arcValue)}\n </text>\n );\n }\n\n function _updateChart(newProps: ArcProps): void {\n if (newProps.arc && newProps.innerRadius && newProps.outerRadius) {\n newProps.arc.innerRadius(newProps.innerRadius);\n newProps.arc.outerRadius(newProps.outerRadius);\n }\n }\n\n const { href, focusedArcId } = props;\n //TO DO 'replace' is throwing error\n const id = props.uniqText! + props.data!.data.legend!.replace(/\\s+/, '') + props.data!.data.data;\n const opacity: number = props.activeArc === props.data!.data.legend || props.activeArc === '' ? 1 : 0.1;\n return (\n <g ref={currentRef}>\n {!!focusedArcId && focusedArcId === id && (\n // TODO innerradius and outerradius were absent\n <path\n id={id + 'focusRing'}\n d={arc({ ...props.focusData!, innerRadius: props.innerRadius, outerRadius: props.outerRadius })!}\n className={classes.focusRing}\n />\n )}\n <path\n // TODO innerradius and outerradius were absent\n id={id}\n d={arc({ ...props.data!, innerRadius: props.innerRadius, outerRadius: props.outerRadius })!}\n className={classes.root}\n style={{ fill: props.color, cursor: href ? 'pointer' : 'default' }}\n onFocus={_onFocus.bind(this, props.data!.data, id)}\n data-is-focusable={props.activeArc === props.data!.data.legend || props.activeArc === ''}\n onMouseOver={_hoverOn.bind(this, props.data!.data)}\n onMouseMove={_hoverOn.bind(this, props.data!.data)}\n onMouseLeave={_hoverOff}\n onBlur={_onBlur}\n opacity={opacity}\n onClick={props.data?.data.onClick}\n aria-label={_getAriaLabel()}\n role=\"img\"\n />\n {_renderArcLabel(classes.arcLabel)}\n </g>\n );\n },\n);\nArc.displayName = 'Arc';\n"],"names":["Arc","React","forwardRef","props","forwardedRef","arc","d3Arc","currentRef","createRef","_isRTL","useRtl","classes","useArcStyles","useEffect","_updateChart","_onFocus","data","id","onFocusCallback","current","_hoverOn","mouseEvent","persist","hoverOnCallback","_hoverOff","hoverLeaveCallback","_onBlur","onBlurCallback","_getAriaLabel","point","legend","xAxisCalloutData","yValue","yAxisCalloutData","callOutAccessibilityData","ariaLabel","_renderArcLabel","className","innerRadius","outerRadius","showLabelsInPercent","totalValue","hideLabels","activeArc","Math","abs","endAngle","startAngle","PI","base","perp","centroid","hyp","sqrt","labelRadius","max","angle","arcValue","value","createElement","text","x","y","textAnchor","dominantBaseline","aria-hidden","d3Format","formatValueWithSIPrefix","newProps","href","focusedArcId","uniqText","replace","opacity","g","ref","path","d","focusData","focusRing","root","style","fill","color","cursor","onFocus","bind","data-is-focusable","onMouseOver","onMouseMove","onMouseLeave","onBlur","onClick","aria-label","role","arcLabel","displayName"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;+BAaaA;;;eAAAA;;;;iEAbU;yBACM;oCACA;0BAGM;uBACa;AAOzC,MAAMA,MAAAA,WAAAA,GAAyCC,OAAMC,UAAU,CACpE,CAACC,OAAOC;QAqGSD;IApGf,MAAME,MAAMC,IAAAA,YAAAA;IACZ,MAAMC,aAAAA,WAAAA,GAAaN,OAAMO,SAAS;IAClC,MAAMC,SAAkBC,IAAAA,aAAAA;IACxB,MAAMC,UAAUC,IAAAA,gCAAAA,EAAaT;IAE7BF,OAAMY,SAAS,CAAC;QACdC,aAAaX;IACf,GAAG;QAACA;KAAM;IAEV,SAASY,SAASC,IAAoB,EAAEC,EAAU;QAChDd,MAAMe,eAAe,CAAEF,MAAMC,IAAIV,WAAWY,OAAO;IACrD;IAEA,SAASC,SAASJ,IAAoB,EAAEK,UAA4C;QAClFA,WAAWC,OAAO;QAClBnB,MAAMoB,eAAe,CAAEP,MAAMK;IAC/B;IAEA,SAASG;QACPrB,MAAMsB,kBAAkB;IAC1B;IAEA,SAASC;QACPvB,MAAMwB,cAAc;IACtB;IAEA,SAASC;YAIAC;QAHP,MAAMA,QAAQ1B,MAAMa,IAAI,CAAEA,IAAI;QAC9B,MAAMc,SAASD,MAAME,gBAAgB,IAAIF,MAAMC,MAAM;QACrD,MAAME,SAASH,MAAMI,gBAAgB,IAAIJ,MAAMb,IAAI,IAAI;QACvD,OAAOa,CAAAA,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,WAAW;YAAEC,aAAapC,MAAMoC,WAAW;QAAC;QACxFF,WAAW1B,QAAQqE,IAAI;QACvBC,OAAO;YAAEC,MAAM/E,MAAMgF,KAAK;YAAEC,QAAQf,OAAO,YAAY;QAAU;QACjEgB,SAAStE,SAASuE,IAAI,CAAC,QAAMnF,MAAMa,IAAI,CAAEA,IAAI,EAAEC;QAC/CsE,qBAAmBpF,MAAMwC,SAAS,KAAKxC,MAAMa,IAAI,CAAEA,IAAI,CAACc,MAAM,IAAI3B,MAAMwC,SAAS,KAAK;QACtF6C,aAAapE,SAASkE,IAAI,CAAC,QAAMnF,MAAMa,IAAI,CAAEA,IAAI;QACjDyE,aAAarE,SAASkE,IAAI,CAAC,QAAMnF,MAAMa,IAAI,CAAEA,IAAI;QACjD0E,cAAclE;QACdmE,QAAQjE;QACR+C,SAASA;QACTmB,SAAO,AAAEzF,CAAAA,cAAAA,MAAMa,IAAI,AAAJA,MAAI,QAAVb,gBAAAA,KAAAA,IAAAA,KAAAA,IAAAA,YAAYa,IAAI,CAAC4E,OAAO;QACjCC,cAAYjE;QACZkE,MAAK;QAEN1D,gBAAgBzB,QAAQoF,QAAQ;AAGvC;AAEF/F,IAAIgG,WAAW,GAAG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["Arc.types.ts"],"sourcesContent":["import { ChartDataPoint } from '../index';\nexport interface ArcProps {\n /**\n * Data to render in the Arc.\n */\n data?: ArcData;\n\n /**\n * Data to render focused Arc\n */\n focusData?: ArcData;\n\n /**\n * id of the focused arc\n */\n focusedArcId?: string;\n /**\n * shape for Arc.\n */\n /* eslint-disable @typescript-eslint/no-explicit-any */\n arc?: any;\n\n /**\n * innerRadius of the Arc.\n */\n innerRadius: number;\n\n /**\n * outerRadius of the Arc.\n */\n outerRadius: number;\n\n /**\n * Color for the Arc.\n */\n color: string;\n\n /**\n * Defines the function that is executed upon hovering over the legend\n */\n hoverOnCallback?: Function;\n\n /**\n * Defines the function that is executed upon hovering over the legend\n */\n onFocusCallback?: Function;\n\n /**\n * Defines the function that is executed upon hovering Leave the legend\n */\n onBlurCallback?: Function;\n\n /**\n * Defines the function that is executed upon hovering Leave the legend\n */\n hoverLeaveCallback?: Function;\n\n /**\n * Uniq string for chart\n */\n uniqText?: string;\n\n /**\n * string for callout id\n */\n calloutId?: string;\n\n /**\n * Active Arc for chart\n */\n activeArc?: string;\n\n /**\n * internal prop for href\n */\n href?: string;\n\n /**\n * props for inside donut value\n */\n valueInsideDonut?: string | number;\n\n /**\n * Prop to show the arc labels in percentage format\n */\n showLabelsInPercent?: boolean;\n\n /**\n * Prop used to define the sum of all arc values\n */\n totalValue?: number;\n\n /**\n * Prop to hide the arc labels\n */\n hideLabels?: boolean;\n\n /**\n * Call to provide customized styling that will layer on top of the variant rules.\n */\n styles?: ArcStyles;\n\n /**\n * Additional CSS class(es) to apply to the Chart.\n */\n className?: string;\n}\n\nexport interface ArcData {\n /**\n * Data to render in the chart for individual arc.\n */\n data: ChartDataPoint;\n /**\n * endAngle of the Arc\n */\n endAngle: number;\n /**\n * index of the Arc\n */\n index: number;\n /**\n * padAngle of the Arc\n */\n padAngle: number;\n /**\n * startAngle of the Arc\n */\n startAngle: number;\n /**\n * value of the Arc\n */\n value: number;\n}\n\nexport interface ArcStyles {\n /**\n * Style set for the card header component root\n */\n root: string;\n\n /**\n * styles for the focus\n */\n focusRing: string;\n\n /**\n * Style for the arc labels\n */\n arcLabel: string;\n}\n"],"names":[],"rangeMappings":"","mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["index.ts"],"sourcesContent":["export * from './Arc';\nexport * from './Arc.types';\n"],"names":[],"rangeMappings":";;;;;;","mappings":";;;;;uBAAc;uBACA"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: all[name]
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
donutArcClassNames: function() {
|
|
13
|
+
return donutArcClassNames;
|
|
14
|
+
},
|
|
15
|
+
useArcStyles: function() {
|
|
16
|
+
return useArcStyles;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
const _react = require("@griffel/react");
|
|
20
|
+
const donutArcClassNames = {
|
|
21
|
+
root: 'fui-donut-arc__root',
|
|
22
|
+
focusRing: 'fui-donut-arc__focusRing',
|
|
23
|
+
arcLabel: 'fui-donut-arc__arcLabel'
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Base Styles
|
|
27
|
+
*/ const useStyles = /*#__PURE__*/ (0, _react.__styles)({
|
|
28
|
+
root: {
|
|
29
|
+
Bceei9c: "f158kwzp",
|
|
30
|
+
Bpd4iqm: "f2cu5sd",
|
|
31
|
+
ojy3ng: "f1yuyku4",
|
|
32
|
+
B4ncu3z: "f138xzbb",
|
|
33
|
+
zxy5zd: [
|
|
34
|
+
"fny96iz",
|
|
35
|
+
"fi0bkha"
|
|
36
|
+
],
|
|
37
|
+
bkw2yb: "f1jv8gm3",
|
|
38
|
+
Bjksbd0: [
|
|
39
|
+
"fi0bkha",
|
|
40
|
+
"fny96iz"
|
|
41
|
+
]
|
|
42
|
+
},
|
|
43
|
+
focusRing: {
|
|
44
|
+
ojy3ng: "frcfrt5",
|
|
45
|
+
Be5yapy: "f9nnx8l",
|
|
46
|
+
Bkfmm31: "f1au8mb3"
|
|
47
|
+
},
|
|
48
|
+
arcLabel: {
|
|
49
|
+
Bahqtrf: "fk6fouc",
|
|
50
|
+
Be2twd7: "fy9rknc",
|
|
51
|
+
Bhrd7zp: "fl43uef",
|
|
52
|
+
Bg96gwp: "fwrc4pm",
|
|
53
|
+
Bkfmm31: "fhuob2q"
|
|
54
|
+
}
|
|
55
|
+
}, {
|
|
56
|
+
d: [
|
|
57
|
+
".f158kwzp{cursor:default;}",
|
|
58
|
+
".f2cu5sd{outline-width:transparent;}",
|
|
59
|
+
".f1yuyku4{stroke:var(--colorNeutralBackground1);}",
|
|
60
|
+
".f138xzbb selectors::-moz-focus-inner{border-top-width:0;}",
|
|
61
|
+
".fny96iz selectors::-moz-focus-inner{border-right-width:0;}",
|
|
62
|
+
".fi0bkha selectors::-moz-focus-inner{border-left-width:0;}",
|
|
63
|
+
".f1jv8gm3 selectors::-moz-focus-inner{border-bottom-width:0;}",
|
|
64
|
+
".frcfrt5{stroke:var(--colorStrokeFocus2);}",
|
|
65
|
+
".f9nnx8l{stroke-width:var(--strokeWidthThickest);}",
|
|
66
|
+
".f1au8mb3{fill:transparent;}",
|
|
67
|
+
".fk6fouc{font-family:var(--fontFamilyBase);}",
|
|
68
|
+
".fy9rknc{font-size:var(--fontSizeBase200);}",
|
|
69
|
+
".fl43uef{font-weight:var(--fontWeightSemibold);}",
|
|
70
|
+
".fwrc4pm{line-height:var(--lineHeightBase200);}",
|
|
71
|
+
".fhuob2q{fill:var(--colorNeutralForeground1);}"
|
|
72
|
+
]
|
|
73
|
+
});
|
|
74
|
+
const useArcStyles = (props)=>{
|
|
75
|
+
var _props_styles, _props_styles1, _props_styles2;
|
|
76
|
+
const { className } = props;
|
|
77
|
+
const baseStyles = useStyles();
|
|
78
|
+
return {
|
|
79
|
+
root: (0, _react.mergeClasses)(donutArcClassNames.root, baseStyles.root, className, (_props_styles = props.styles) === null || _props_styles === void 0 ? void 0 : _props_styles.root),
|
|
80
|
+
focusRing: (0, _react.mergeClasses)(donutArcClassNames.focusRing, baseStyles.focusRing, (_props_styles1 = props.styles) === null || _props_styles1 === void 0 ? void 0 : _props_styles1.focusRing),
|
|
81
|
+
arcLabel: (0, _react.mergeClasses)(donutArcClassNames.arcLabel, baseStyles.arcLabel, (_props_styles2 = props.styles) === null || _props_styles2 === void 0 ? void 0 : _props_styles2.arcLabel)
|
|
82
|
+
};
|
|
83
|
+
}; //# sourceMappingURL=useArcStyles.styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["useArcStyles.styles.js"],"sourcesContent":["import { makeStyles, mergeClasses, shorthands } from '@griffel/react';\nimport { tokens, typographyStyles } from '@fluentui/react-theme';\n/**\n * @internal\n */ export const donutArcClassNames = {\n root: 'fui-donut-arc__root',\n focusRing: 'fui-donut-arc__focusRing',\n arcLabel: 'fui-donut-arc__arcLabel'\n};\n/**\n * Base Styles\n */ const useStyles = makeStyles({\n root: {\n cursor: 'default',\n ...shorthands.outline('transparent'),\n stroke: tokens.colorNeutralBackground1,\n '& selectors': {\n '::-moz-focus-inner': {\n ...shorthands.border('0')\n }\n }\n },\n focusRing: {\n stroke: tokens.colorStrokeFocus2,\n strokeWidth: tokens.strokeWidthThickest,\n fill: 'transparent'\n },\n arcLabel: {\n ...typographyStyles.caption1Strong,\n fill: tokens.colorNeutralForeground1\n }\n});\n/**\n * Apply styling to the Arc components\n */ export const useArcStyles = (props)=>{\n var _props_styles, _props_styles1, _props_styles2;\n const { className } = props;\n const baseStyles = useStyles();\n return {\n root: mergeClasses(donutArcClassNames.root, baseStyles.root, className, (_props_styles = props.styles) === null || _props_styles === void 0 ? void 0 : _props_styles.root),\n focusRing: mergeClasses(donutArcClassNames.focusRing, baseStyles.focusRing, (_props_styles1 = props.styles) === null || _props_styles1 === void 0 ? void 0 : _props_styles1.focusRing),\n arcLabel: mergeClasses(donutArcClassNames.arcLabel, baseStyles.arcLabel, (_props_styles2 = props.styles) === null || _props_styles2 === void 0 ? void 0 : _props_styles2.arcLabel)\n };\n};\n"],"names":["donutArcClassNames","useArcStyles","root","focusRing","arcLabel","useStyles","__styles","Bceei9c","Bpd4iqm","ojy3ng","B4ncu3z","zxy5zd","bkw2yb","Bjksbd0","Be5yapy","Bkfmm31","Bahqtrf","Be2twd7","Bhrd7zp","Bg96gwp","d","props","_props_styles","_props_styles1","_props_styles2","className","baseStyles","merg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