@fluentui/react-charts 1.2.0 → 9.0.1
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 +193 -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,163 @@
|
|
|
1
|
+
import { __styles, mergeClasses, shorthands } from '@griffel/react';
|
|
2
|
+
import { tokens, typographyStyles } from '@fluentui/react-theme';
|
|
3
|
+
import { HorizontalBarChartVariant } from './index';
|
|
4
|
+
import { HighContrastSelector } from '../../utilities/index';
|
|
5
|
+
/**
|
|
6
|
+
* @internal
|
|
7
|
+
*/
|
|
8
|
+
export const hbcClassNames = {
|
|
9
|
+
root: 'fui-hbc__root',
|
|
10
|
+
items: 'fui-hbc__items',
|
|
11
|
+
chart: 'fui-hbc__chart',
|
|
12
|
+
chartTitle: 'fui-hbc__chartTitle',
|
|
13
|
+
barWrapper: 'fui-hbc__barWrapper',
|
|
14
|
+
chartTitleLeft: 'fui-hbc__chartTitleLeft',
|
|
15
|
+
chartTitleRight: 'fui-hbc__chartTitleRight',
|
|
16
|
+
chartDataTextDenominator: 'fui-hbc__textDenom',
|
|
17
|
+
benchmarkContainer: 'fui-hbc__benchmark',
|
|
18
|
+
triangle: 'fui-hbc__triangle',
|
|
19
|
+
barLabel: 'fui-hbc__barLabel',
|
|
20
|
+
chartWrapper: 'fui-hbc__chartWrapper',
|
|
21
|
+
legendContainer: 'fui-hbc__legendContainer'
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Base Styles
|
|
25
|
+
*/
|
|
26
|
+
const useStyles = /*#__PURE__*/__styles({
|
|
27
|
+
root: {
|
|
28
|
+
mc9l5x: "f22iagw",
|
|
29
|
+
Beiy3e4: "f1vx9l62",
|
|
30
|
+
a9b677: "fly5x3f"
|
|
31
|
+
},
|
|
32
|
+
items10pMargin: {
|
|
33
|
+
jrapky: "f1rfdi54"
|
|
34
|
+
},
|
|
35
|
+
items16pMargin: {
|
|
36
|
+
jrapky: "fbxl46w"
|
|
37
|
+
},
|
|
38
|
+
chart: {
|
|
39
|
+
a9b677: "fly5x3f",
|
|
40
|
+
Bqenvij: "fvblgha",
|
|
41
|
+
mc9l5x: "ftgm304",
|
|
42
|
+
B68tc82: 0,
|
|
43
|
+
Bmxbyg5: 0,
|
|
44
|
+
Bpg54ce: "f1gl81tg"
|
|
45
|
+
},
|
|
46
|
+
barWrapper: {},
|
|
47
|
+
chartTitle: {
|
|
48
|
+
Bahqtrf: "fk6fouc",
|
|
49
|
+
Be2twd7: "fy9rknc",
|
|
50
|
+
Bhrd7zp: "figsok6",
|
|
51
|
+
Bg96gwp: "fwrc4pm",
|
|
52
|
+
mc9l5x: "f22iagw",
|
|
53
|
+
Brf1p80: "f1869bpl"
|
|
54
|
+
},
|
|
55
|
+
chartTitleLeft: {
|
|
56
|
+
ygn44y: "f1cmbuwj",
|
|
57
|
+
B68tc82: 0,
|
|
58
|
+
Bmxbyg5: 0,
|
|
59
|
+
Bpg54ce: "f1a3p1vp",
|
|
60
|
+
Huce71: "fz5stix",
|
|
61
|
+
mc9l5x: "ftgm304",
|
|
62
|
+
sj55zd: "f19n0e5"
|
|
63
|
+
},
|
|
64
|
+
chartTitleLeft4pMargin: {
|
|
65
|
+
jrapky: "fd1gkq"
|
|
66
|
+
},
|
|
67
|
+
chartTitleLeft5pMargin: {
|
|
68
|
+
jrapky: "f475ppk"
|
|
69
|
+
},
|
|
70
|
+
chartTitleRight: {
|
|
71
|
+
Bahqtrf: "fk6fouc",
|
|
72
|
+
Be2twd7: "fkhj508",
|
|
73
|
+
Bhrd7zp: "fl43uef",
|
|
74
|
+
Bg96gwp: "f1i3iumi",
|
|
75
|
+
sj55zd: "f19n0e5"
|
|
76
|
+
},
|
|
77
|
+
chartDataTextDenominator: {
|
|
78
|
+
Bahqtrf: "fk6fouc",
|
|
79
|
+
Be2twd7: "fkhj508",
|
|
80
|
+
Bhrd7zp: "figsok6",
|
|
81
|
+
Bg96gwp: "f1i3iumi",
|
|
82
|
+
sj55zd: "f19n0e5"
|
|
83
|
+
},
|
|
84
|
+
benchmarkContainer: {
|
|
85
|
+
qhf8xq: "f10pi13n",
|
|
86
|
+
Bqenvij: "f7u49ja",
|
|
87
|
+
B6of3ja: "f1h5g6v3",
|
|
88
|
+
jrapky: "fmxx68s"
|
|
89
|
+
},
|
|
90
|
+
triangle: {
|
|
91
|
+
a9b677: "f3tsq5r",
|
|
92
|
+
Bqenvij: "fniina8",
|
|
93
|
+
ibv6hh: ["fbdn13q", "fdo4c7f"],
|
|
94
|
+
wvpqe5: ["fjik90z", "fcdblym"],
|
|
95
|
+
zhjwy3: ["f1pdflbu", "f11589ue"],
|
|
96
|
+
Bekrc4i: ["fdo4c7f", "fbdn13q"],
|
|
97
|
+
vrafjx: ["fcdblym", "fjik90z"],
|
|
98
|
+
h3c5rm: ["f11589ue", "f1pdflbu"],
|
|
99
|
+
B4j52fo: "f1st6vq5",
|
|
100
|
+
icvyot: "fzkkow9",
|
|
101
|
+
g2u3we: "f1bpgvfk",
|
|
102
|
+
jrapky: "f8l5zjj",
|
|
103
|
+
qhf8xq: "f1euv43f"
|
|
104
|
+
},
|
|
105
|
+
barLabel: {
|
|
106
|
+
Bahqtrf: "fk6fouc",
|
|
107
|
+
Be2twd7: "fy9rknc",
|
|
108
|
+
Bhrd7zp: "fl43uef",
|
|
109
|
+
Bg96gwp: "fwrc4pm",
|
|
110
|
+
Bkfmm31: "fhuob2q",
|
|
111
|
+
a6j6cd: "f1j86lqe",
|
|
112
|
+
B93v9kj: "f15mrrko"
|
|
113
|
+
},
|
|
114
|
+
chartWrapper40ppadding: {
|
|
115
|
+
z189sj: ["f1emi2st", "f53ee3v"]
|
|
116
|
+
},
|
|
117
|
+
chartWrapper0ppadding: {
|
|
118
|
+
z189sj: ["flk2ux3", "fkl3uby"]
|
|
119
|
+
},
|
|
120
|
+
legendContainer: {
|
|
121
|
+
z8tnut: "fikn0iw"
|
|
122
|
+
}
|
|
123
|
+
}, {
|
|
124
|
+
d: [".f22iagw{display:flex;}", ".f1vx9l62{flex-direction:column;}", ".fly5x3f{width:100%;}", ".f1rfdi54{margin-bottom:var(--spacingVerticalMNudge);}", ".fbxl46w{margin-bottom:var(--spacingVerticalL);}", ".fvblgha{height:12px;}", ".ftgm304{display:block;}", [".f1gl81tg{overflow:visible;}", {
|
|
125
|
+
p: -1
|
|
126
|
+
}], ".fk6fouc{font-family:var(--fontFamilyBase);}", ".fy9rknc{font-size:var(--fontSizeBase200);}", ".figsok6{font-weight:var(--fontWeightRegular);}", ".fwrc4pm{line-height:var(--lineHeightBase200);}", ".f1869bpl{justify-content:space-between;}", ".f1cmbuwj{text-overflow:ellipsis;}", [".f1a3p1vp{overflow:hidden;}", {
|
|
127
|
+
p: -1
|
|
128
|
+
}], ".fz5stix{white-space:nowrap;}", ".f19n0e5{color:var(--colorNeutralForeground1);}", ".fd1gkq{margin-bottom:4px;}", ".f475ppk{margin-bottom:5px;}", ".fkhj508{font-size:var(--fontSizeBase300);}", ".fl43uef{font-weight:var(--fontWeightSemibold);}", ".f1i3iumi{line-height:var(--lineHeightBase300);}", ".f10pi13n{position:relative;}", ".f7u49ja{height:7px;}", ".f1h5g6v3{margin-top:-3px;}", ".fmxx68s{margin-bottom:-1px;}", ".f3tsq5r{width:0;}", ".fniina8{height:0;}", ".fbdn13q{border-left-width:4px;}", ".fdo4c7f{border-right-width:4px;}", ".fjik90z{border-left-style:solid;}", ".fcdblym{border-right-style:solid;}", ".f1pdflbu{border-left-color:transparent;}", ".f11589ue{border-right-color:transparent;}", ".f1st6vq5{border-top-width:7px;}", ".fzkkow9{border-top-style:solid;}", ".f1bpgvfk{border-top-color:var(--colorPaletteBlueBorderActive);}", ".f8l5zjj{margin-bottom:var(--spacingVerticalXS);}", ".f1euv43f{position:absolute;}", ".fhuob2q{fill:var(--colorNeutralForeground1);}", ".f1emi2st{padding-right:40p;}", ".f53ee3v{padding-left:40p;}", ".flk2ux3{padding-right:var(--spacingHorizontalNone);}", ".fkl3uby{padding-left:var(--spacingHorizontalNone);}", ".fikn0iw{padding-top:var(--spacingVerticalL);}"],
|
|
129
|
+
m: [["@media screen and (-ms-high-contrast: active),screen and (forced-colors: active){.f1j86lqe{fill:WindowText;}}", {
|
|
130
|
+
m: "screen and (-ms-high-contrast: active), screen and (forced-colors: active)"
|
|
131
|
+
}], ["@media screen and (-ms-high-contrast: active),screen and (forced-colors: active){.f15mrrko{forced-color-adjust:none;}}", {
|
|
132
|
+
m: "screen and (-ms-high-contrast: active), screen and (forced-colors: active)"
|
|
133
|
+
}]]
|
|
134
|
+
});
|
|
135
|
+
/**
|
|
136
|
+
* Apply styling to the Carousel slots based on the state
|
|
137
|
+
*/
|
|
138
|
+
export const useHorizontalBarChartStyles = props => {
|
|
139
|
+
var _props_styles, _props_styles1, _props_styles2, _props_styles3, _props_styles4, _props_styles5, _props_styles6, _props_styles7, _props_styles8, _props_styles9, _props_styles10, _props_styles11, _props_styles12;
|
|
140
|
+
const {
|
|
141
|
+
className,
|
|
142
|
+
showTriangle,
|
|
143
|
+
variant,
|
|
144
|
+
hideLabels
|
|
145
|
+
} = props; // ToDo - width, barHeight is non enumerable. Need to be used inline.
|
|
146
|
+
const baseStyles = useStyles();
|
|
147
|
+
return {
|
|
148
|
+
root: mergeClasses(hbcClassNames.root, baseStyles.root, className, (_props_styles = props.styles) === null || _props_styles === void 0 ? void 0 : _props_styles.root),
|
|
149
|
+
items: mergeClasses(hbcClassNames.items, showTriangle || variant === HorizontalBarChartVariant.AbsoluteScale ? baseStyles.items16pMargin : baseStyles.items10pMargin, (_props_styles1 = props.styles) === null || _props_styles1 === void 0 ? void 0 : _props_styles1.items),
|
|
150
|
+
chart: mergeClasses(hbcClassNames.chart, baseStyles.chart, (_props_styles2 = props.styles) === null || _props_styles2 === void 0 ? void 0 : _props_styles2.chart),
|
|
151
|
+
chartTitle: mergeClasses(hbcClassNames.chartTitle, baseStyles.chartTitle, (_props_styles3 = props.styles) === null || _props_styles3 === void 0 ? void 0 : _props_styles3.chartTitle),
|
|
152
|
+
barWrapper: mergeClasses(hbcClassNames.barWrapper, baseStyles.barWrapper, (_props_styles4 = props.styles) === null || _props_styles4 === void 0 ? void 0 : _props_styles4.barWrapper),
|
|
153
|
+
chartTitleLeft: mergeClasses(hbcClassNames.chartTitleLeft, baseStyles.chartTitleLeft, variant === HorizontalBarChartVariant.AbsoluteScale ? baseStyles.chartTitleLeft4pMargin : baseStyles.chartTitleLeft5pMargin, (_props_styles5 = props.styles) === null || _props_styles5 === void 0 ? void 0 : _props_styles5.chartTitleLeft),
|
|
154
|
+
chartTitleRight: mergeClasses(hbcClassNames.chartTitleRight, baseStyles.chartTitleRight, (_props_styles6 = props.styles) === null || _props_styles6 === void 0 ? void 0 : _props_styles6.chartTitleRight),
|
|
155
|
+
chartDataTextDenominator: mergeClasses(hbcClassNames.chartDataTextDenominator, baseStyles.chartDataTextDenominator, (_props_styles7 = props.styles) === null || _props_styles7 === void 0 ? void 0 : _props_styles7.chartDataTextDenominator),
|
|
156
|
+
benchmarkContainer: mergeClasses(hbcClassNames.benchmarkContainer, baseStyles.benchmarkContainer, (_props_styles8 = props.styles) === null || _props_styles8 === void 0 ? void 0 : _props_styles8.benchmarkContainer),
|
|
157
|
+
triangle: mergeClasses(hbcClassNames.triangle, baseStyles.triangle, (_props_styles9 = props.styles) === null || _props_styles9 === void 0 ? void 0 : _props_styles9.triangle),
|
|
158
|
+
barLabel: mergeClasses(hbcClassNames.barLabel, baseStyles.barLabel, (_props_styles10 = props.styles) === null || _props_styles10 === void 0 ? void 0 : _props_styles10.barLabel),
|
|
159
|
+
chartWrapper: mergeClasses(hbcClassNames.chartWrapper, variant === HorizontalBarChartVariant.AbsoluteScale && !hideLabels ? baseStyles.chartWrapper40ppadding : baseStyles.chartWrapper0ppadding, (_props_styles11 = props.styles) === null || _props_styles11 === void 0 ? void 0 : _props_styles11.chartWrapper),
|
|
160
|
+
legendContainer: mergeClasses(hbcClassNames.legendContainer, baseStyles.legendContainer, (_props_styles12 = props.styles) === null || _props_styles12 === void 0 ? void 0 : _props_styles12.legendContainer)
|
|
161
|
+
};
|
|
162
|
+
};
|
|
163
|
+
//# sourceMappingURL=useHorizontalBarChartStyles.styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["__styles","mergeClasses","shorthands","tokens","typographyStyles","HorizontalBarChartVariant","HighContrastSelector","hbcClassNames","root","items","chart","chartTitle","barWrapper","chartTitleLeft","chartTitleRight","chartDataTextDenominator","benchmarkContainer","triangle","barLabel","chartWrapper","legendContainer","useStyles","mc9l5x","Beiy3e4","a9b677","items10pMargin","jrapky","items16pMargin","Bqenvij","B68tc82","Bmxbyg5","Bpg54ce","Bahqtrf","Be2twd7","Bhrd7zp","Bg96gwp","Brf1p80","ygn44y","Huce71","sj55zd","chartTitleLeft4pMargin","chartTitleLeft5pMargin","qhf8xq","B6of3ja","ibv6hh","wvpqe5","zhjwy3","Bekrc4i","vrafjx","h3c5rm","B4j52fo","icvyot","g2u3we","Bkfmm31","a6j6cd","B93v9kj","chartWrapper40ppadding","z189sj","chartWrapper0ppadding","z8tnut","d","p","m","useHorizontalBarChartStyles","props","_props_styles","_props_styles1","_props_styles2","_props_styles3","_props_styles4","_props_styles5","_props_styles6","_props_styles7","_props_styles8","_props_styles9","_props_styles10","_props_styles11","_props_styles12","className","showTriangle","variant","hideLabels","baseStyles","styles","AbsoluteScale"],"sources":["useHorizontalBarChartStyles.styles.js"],"sourcesContent":["import { makeStyles, mergeClasses, shorthands } from '@griffel/react';\nimport { tokens, typographyStyles } from '@fluentui/react-theme';\nimport { HorizontalBarChartVariant } from './index';\nimport { HighContrastSelector } from '../../utilities/index';\n/**\n * @internal\n */ export const hbcClassNames = {\n root: 'fui-hbc__root',\n items: 'fui-hbc__items',\n chart: 'fui-hbc__chart',\n chartTitle: 'fui-hbc__chartTitle',\n barWrapper: 'fui-hbc__barWrapper',\n chartTitleLeft: 'fui-hbc__chartTitleLeft',\n chartTitleRight: 'fui-hbc__chartTitleRight',\n chartDataTextDenominator: 'fui-hbc__textDenom',\n benchmarkContainer: 'fui-hbc__benchmark',\n triangle: 'fui-hbc__triangle',\n barLabel: 'fui-hbc__barLabel',\n chartWrapper: 'fui-hbc__chartWrapper',\n legendContainer: 'fui-hbc__legendContainer'\n};\n/**\n * Base Styles\n */ const useStyles = makeStyles({\n root: {\n display: 'flex',\n flexDirection: 'column',\n width: '100%'\n },\n items10pMargin: {\n marginBottom: tokens.spacingVerticalMNudge\n },\n items16pMargin: {\n marginBottom: tokens.spacingVerticalL\n },\n chart: {\n width: '100%',\n height: '12px',\n display: 'block',\n overflow: 'visible'\n },\n barWrapper: {},\n chartTitle: {\n ...typographyStyles.caption1,\n display: 'flex',\n justifyContent: 'space-between'\n },\n chartTitleLeft: {\n textOverflow: 'ellipsis',\n overflow: 'hidden',\n whiteSpace: 'nowrap',\n display: 'block',\n color: tokens.colorNeutralForeground1\n },\n chartTitleLeft4pMargin: {\n marginBottom: '4px'\n },\n chartTitleLeft5pMargin: {\n marginBottom: '5px'\n },\n chartTitleRight: {\n ...typographyStyles.body1Strong,\n color: tokens.colorNeutralForeground1\n },\n chartDataTextDenominator: {\n ...typographyStyles.body1,\n color: tokens.colorNeutralForeground1\n },\n benchmarkContainer: {\n position: 'relative',\n height: '7px',\n marginTop: '-3px',\n marginBottom: '-1px'\n },\n triangle: {\n width: '0',\n height: '0',\n ...shorthands.borderLeft('4px', 'solid', 'transparent'),\n ...shorthands.borderRight('4px', 'solid', 'transparent'),\n ...shorthands.borderTop('7px', 'solid'),\n borderTopColor: tokens.colorPaletteBlueBorderActive,\n marginBottom: tokens.spacingVerticalXS,\n position: 'absolute'\n },\n barLabel: {\n ...typographyStyles.caption1Strong,\n fill: tokens.colorNeutralForeground1,\n [HighContrastSelector]: {\n fill: 'WindowText',\n forcedColorAdjust: 'none'\n }\n },\n chartWrapper40ppadding: {\n paddingRight: '40p'\n },\n chartWrapper0ppadding: {\n paddingRight: tokens.spacingHorizontalNone\n },\n legendContainer: {\n paddingTop: tokens.spacingVerticalL\n }\n});\n/**\n * Apply styling to the Carousel slots based on the state\n */ export const useHorizontalBarChartStyles = (props)=>{\n var _props_styles, _props_styles1, _props_styles2, _props_styles3, _props_styles4, _props_styles5, _props_styles6, _props_styles7, _props_styles8, _props_styles9, _props_styles10, _props_styles11, _props_styles12;\n const { className, showTriangle, variant, hideLabels } = props; // ToDo - width, barHeight is non enumerable. Need to be used inline.\n const baseStyles = useStyles();\n return {\n root: mergeClasses(hbcClassNames.root, baseStyles.root, className, (_props_styles = props.styles) === null || _props_styles === void 0 ? void 0 : _props_styles.root),\n items: mergeClasses(hbcClassNames.items, showTriangle || variant === HorizontalBarChartVariant.AbsoluteScale ? baseStyles.items16pMargin : baseStyles.items10pMargin, (_props_styles1 = props.styles) === null || _props_styles1 === void 0 ? void 0 : _props_styles1.items),\n chart: mergeClasses(hbcClassNames.chart, baseStyles.chart, (_props_styles2 = props.styles) === null || _props_styles2 === void 0 ? void 0 : _props_styles2.chart),\n chartTitle: mergeClasses(hbcClassNames.chartTitle, baseStyles.chartTitle, (_props_styles3 = props.styles) === null || _props_styles3 === void 0 ? void 0 : _props_styles3.chartTitle),\n barWrapper: mergeClasses(hbcClassNames.barWrapper, baseStyles.barWrapper, (_props_styles4 = props.styles) === null || _props_styles4 === void 0 ? void 0 : _props_styles4.barWrapper),\n chartTitleLeft: mergeClasses(hbcClassNames.chartTitleLeft, baseStyles.chartTitleLeft, variant === HorizontalBarChartVariant.AbsoluteScale ? baseStyles.chartTitleLeft4pMargin : baseStyles.chartTitleLeft5pMargin, (_props_styles5 = props.styles) === null || _props_styles5 === void 0 ? void 0 : _props_styles5.chartTitleLeft),\n chartTitleRight: mergeClasses(hbcClassNames.chartTitleRight, baseStyles.chartTitleRight, (_props_styles6 = props.styles) === null || _props_styles6 === void 0 ? void 0 : _props_styles6.chartTitleRight),\n chartDataTextDenominator: mergeClasses(hbcClassNames.chartDataTextDenominator, baseStyles.chartDataTextDenominator, (_props_styles7 = props.styles) === null || _props_styles7 === void 0 ? void 0 : _props_styles7.chartDataTextDenominator),\n benchmarkContainer: mergeClasses(hbcClassNames.benchmarkContainer, baseStyles.benchmarkContainer, (_props_styles8 = props.styles) === null || _props_styles8 === void 0 ? void 0 : _props_styles8.benchmarkContainer),\n triangle: mergeClasses(hbcClassNames.triangle, baseStyles.triangle, (_props_styles9 = props.styles) === null || _props_styles9 === void 0 ? void 0 : _props_styles9.triangle),\n barLabel: mergeClasses(hbcClassNames.barLabel, baseStyles.barLabel, (_props_styles10 = props.styles) === null || _props_styles10 === void 0 ? void 0 : _props_styles10.barLabel),\n chartWrapper: mergeClasses(hbcClassNames.chartWrapper, variant === HorizontalBarChartVariant.AbsoluteScale && !hideLabels ? baseStyles.chartWrapper40ppadding : baseStyles.chartWrapper0ppadding, (_props_styles11 = props.styles) === null || _props_styles11 === void 0 ? void 0 : _props_styles11.chartWrapper),\n legendContainer: mergeClasses(hbcClassNames.legendContainer, baseStyles.legendContainer, (_props_styles12 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,QAAQ,EAAE,CAACyD,eAAe,GAAGX,KAAK,CAACmB,MAAM,MAAM,IAAI,IAAIR,eAAe,KAAK,KAAK,CAAC,GAAG,KAAK,CAAC,GAAGA,eAAe,CAACzD,QAAQ,CAAC;IAChLC,YAAY,EAAElB,YAAY,CAACM,aAAa,CAACY,YAAY,EAAE6D,OAAO,KAAK3E,yBAAyB,CAAC+E,aAAa,IAAI,CAACH,UAAU,GAAGC,UAAU,CAAC1B,sBAAsB,GAAG0B,UAAU,CAACxB,qBAAqB,EAAE,CAACkB,eAAe,GAAGZ,KAAK,CAACmB,MAAM,MAAM,IAAI,IAAIP,eAAe,KAAK,KAAK,CAAC,GAAG,KAAK,CAAC,GAAGA,eAAe,CAACzD,YAAY,CAAC;IAClTC,eAAe,EAAEnB,YAAY,CAACM,aAAa,CAACa,eAAe,EAAE8D,UAAU,CAAC9D,eAAe,EAAE,CAACyD,eAAe,GAAGb,KAAK,CAACmB,MAAM,MAAM,IAAI,IAAIN,eAAe,KAAK,KAAK,CAAC,GAAG,KAAK,CAAC,GAAGA,eAAe,CAACzD,eAAe;EAC/M,CAAC;AACL,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Button } from '@fluentui/react-button';
|
|
3
|
+
import { Shape } from './shape';
|
|
4
|
+
import { useLegendStyles } from './useLegendsStyles.styles';
|
|
5
|
+
import { Overflow, OverflowItem } from '@fluentui/react-overflow';
|
|
6
|
+
import { useFocusableGroup, useArrowNavigationGroup } from '@fluentui/react-tabster';
|
|
7
|
+
import { OverflowMenu } from './OverflowMenu';
|
|
8
|
+
import { tokens } from '@fluentui/react-theme';
|
|
9
|
+
export const Legends = /*#__PURE__*/ React.forwardRef((props, forwardedRef)=>{
|
|
10
|
+
/** Boolean variable to check if one or more legends are selected */ let _isLegendSelected = false;
|
|
11
|
+
// set states separately for each instance of the component
|
|
12
|
+
const [activeLegend, setActiveLegend] = React.useState('');
|
|
13
|
+
const [selectedLegends, setSelectedLegends] = React.useState({});
|
|
14
|
+
const focusAttributes = useFocusableGroup();
|
|
15
|
+
const arrowAttributes = useArrowNavigationGroup({
|
|
16
|
+
axis: 'horizontal',
|
|
17
|
+
memorizeCurrent: true
|
|
18
|
+
});
|
|
19
|
+
React.useEffect(()=>{
|
|
20
|
+
let defaultSelectedLegends = {};
|
|
21
|
+
if (props.canSelectMultipleLegends) {
|
|
22
|
+
var _props_defaultSelectedLegends;
|
|
23
|
+
defaultSelectedLegends = ((_props_defaultSelectedLegends = props.defaultSelectedLegends) === null || _props_defaultSelectedLegends === void 0 ? void 0 : _props_defaultSelectedLegends.reduce((combinedDict, key)=>({
|
|
24
|
+
[key]: true,
|
|
25
|
+
...combinedDict
|
|
26
|
+
}), {})) || {};
|
|
27
|
+
} else if (props.defaultSelectedLegend) {
|
|
28
|
+
defaultSelectedLegends = {
|
|
29
|
+
[props.defaultSelectedLegend]: true
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
setSelectedLegends(defaultSelectedLegends);
|
|
33
|
+
}, [
|
|
34
|
+
props.canSelectMultipleLegends,
|
|
35
|
+
props.defaultSelectedLegend,
|
|
36
|
+
props.defaultSelectedLegends
|
|
37
|
+
]);
|
|
38
|
+
_isLegendSelected = Object.keys(selectedLegends).length > 0;
|
|
39
|
+
const dataToRender = _generateData();
|
|
40
|
+
const { overflowStyles, allowFocusOnLegends = true, canSelectMultipleLegends = false } = props;
|
|
41
|
+
const classes = useLegendStyles(props);
|
|
42
|
+
const itemIds = dataToRender.map((_item, index)=>index.toString());
|
|
43
|
+
const overflowHoverCardLegends = [];
|
|
44
|
+
props.legends.map((legend, index)=>{
|
|
45
|
+
const hoverCardElement = _renderButton(legend, index);
|
|
46
|
+
overflowHoverCardLegends.push(hoverCardElement);
|
|
47
|
+
});
|
|
48
|
+
const overflowString = props.overflowText ? props.overflowText : 'more';
|
|
49
|
+
return props.enabledWrapLines ? renderWrappedLegends() : renderLegends();
|
|
50
|
+
function renderLegends() {
|
|
51
|
+
return /*#__PURE__*/ React.createElement("div", {
|
|
52
|
+
...focusAttributes,
|
|
53
|
+
...arrowAttributes,
|
|
54
|
+
...allowFocusOnLegends && {
|
|
55
|
+
role: 'listbox',
|
|
56
|
+
'aria-label': 'Legends',
|
|
57
|
+
'aria-multiselectable': canSelectMultipleLegends
|
|
58
|
+
},
|
|
59
|
+
className: classes.root
|
|
60
|
+
}, /*#__PURE__*/ React.createElement(Overflow, null, /*#__PURE__*/ React.createElement("div", {
|
|
61
|
+
className: classes.resizableArea,
|
|
62
|
+
style: {
|
|
63
|
+
textAlign: props.centerLegends ? 'center' : 'unset'
|
|
64
|
+
}
|
|
65
|
+
}, dataToRender.map((item, id)=>/*#__PURE__*/ React.createElement(OverflowItem, {
|
|
66
|
+
key: id,
|
|
67
|
+
id: id.toString()
|
|
68
|
+
}, _renderButton(item))), /*#__PURE__*/ React.createElement(OverflowMenu, {
|
|
69
|
+
itemIds: itemIds,
|
|
70
|
+
title: `${overflowString}`,
|
|
71
|
+
items: overflowHoverCardLegends
|
|
72
|
+
}))));
|
|
73
|
+
}
|
|
74
|
+
function renderWrappedLegends() {
|
|
75
|
+
return /*#__PURE__*/ React.createElement("div", {
|
|
76
|
+
...focusAttributes,
|
|
77
|
+
...arrowAttributes,
|
|
78
|
+
...allowFocusOnLegends && {
|
|
79
|
+
role: 'listbox',
|
|
80
|
+
'aria-label': 'Legends',
|
|
81
|
+
'aria-multiselectable': canSelectMultipleLegends
|
|
82
|
+
},
|
|
83
|
+
style: {
|
|
84
|
+
justifyContent: props.centerLegends ? 'center' : 'unset',
|
|
85
|
+
flexWrap: 'wrap',
|
|
86
|
+
...overflowStyles
|
|
87
|
+
},
|
|
88
|
+
className: classes.root
|
|
89
|
+
}, /*#__PURE__*/ React.createElement("div", {
|
|
90
|
+
className: classes.resizableArea,
|
|
91
|
+
style: {
|
|
92
|
+
display: 'flex',
|
|
93
|
+
flexWrap: 'wrap',
|
|
94
|
+
overflow: 'auto'
|
|
95
|
+
}
|
|
96
|
+
}, dataToRender.map((item, id)=>/*#__PURE__*/ React.createElement("div", {
|
|
97
|
+
key: id,
|
|
98
|
+
style: {
|
|
99
|
+
flex: '0 1 auto',
|
|
100
|
+
margin: '4px'
|
|
101
|
+
}
|
|
102
|
+
}, _renderButton(item)))));
|
|
103
|
+
}
|
|
104
|
+
function _generateData() {
|
|
105
|
+
const { shape } = props;
|
|
106
|
+
const dataItems = props.legends.map((legend, index)=>{
|
|
107
|
+
return {
|
|
108
|
+
/* ...(allowFocusOnLegends && {
|
|
109
|
+
nativeButtonProps: getIntrinsicElementProps(
|
|
110
|
+
'div',
|
|
111
|
+
{
|
|
112
|
+
legend,
|
|
113
|
+
...buttonProperties,
|
|
114
|
+
},
|
|
115
|
+
['title'],
|
|
116
|
+
),
|
|
117
|
+
'aria-setsize': props.legends.length,
|
|
118
|
+
'aria-posinset': index + 1,
|
|
119
|
+
}), */ title: legend.title,
|
|
120
|
+
action: legend.action,
|
|
121
|
+
hoverAction: legend.hoverAction,
|
|
122
|
+
onMouseOutAction: legend.onMouseOutAction,
|
|
123
|
+
color: legend.color,
|
|
124
|
+
shape: shape ? shape : legend.shape,
|
|
125
|
+
stripePattern: legend.stripePattern,
|
|
126
|
+
isLineLegendInBarChart: legend.isLineLegendInBarChart,
|
|
127
|
+
opacity: legend.opacity,
|
|
128
|
+
key: index
|
|
129
|
+
};
|
|
130
|
+
});
|
|
131
|
+
return dataItems;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* This function will get called when there is an ability to
|
|
135
|
+
* select multiple legends
|
|
136
|
+
* @param legend ILegend
|
|
137
|
+
*/ function _canSelectMultipleLegends(legend) {
|
|
138
|
+
let legendsSelected = {
|
|
139
|
+
...selectedLegends
|
|
140
|
+
};
|
|
141
|
+
if (legendsSelected[legend.title]) {
|
|
142
|
+
// Delete entry for the deselected legend to make
|
|
143
|
+
// the number of keys equal to the number of selected legends
|
|
144
|
+
delete legendsSelected[legend.title];
|
|
145
|
+
} else {
|
|
146
|
+
legendsSelected[legend.title] = true;
|
|
147
|
+
// Clear set if all legends are selected
|
|
148
|
+
if (Object.keys(legendsSelected).length === props.legends.length) {
|
|
149
|
+
legendsSelected = {};
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
setSelectedLegends(legendsSelected);
|
|
153
|
+
return legendsSelected;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* This function will get called when there is
|
|
157
|
+
* ability to select only single legend
|
|
158
|
+
* @param legend ILegend
|
|
159
|
+
*/ function _canSelectOnlySingleLegend(legend) {
|
|
160
|
+
if (selectedLegends[legend.title]) {
|
|
161
|
+
setSelectedLegends({});
|
|
162
|
+
return false;
|
|
163
|
+
} else {
|
|
164
|
+
setSelectedLegends({
|
|
165
|
+
[legend.title]: true
|
|
166
|
+
});
|
|
167
|
+
return true;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
function _onClick(legend, event) {
|
|
171
|
+
var _props_onChange, _legend_action;
|
|
172
|
+
const { canSelectMultipleLegends = false } = props;
|
|
173
|
+
let selectedLegends = [];
|
|
174
|
+
if (canSelectMultipleLegends) {
|
|
175
|
+
const nextSelectedLegends = _canSelectMultipleLegends(legend);
|
|
176
|
+
selectedLegends = Object.keys(nextSelectedLegends);
|
|
177
|
+
} else {
|
|
178
|
+
const isSelected = _canSelectOnlySingleLegend(legend);
|
|
179
|
+
selectedLegends = isSelected ? [
|
|
180
|
+
legend.title
|
|
181
|
+
] : [];
|
|
182
|
+
}
|
|
183
|
+
(_props_onChange = props.onChange) === null || _props_onChange === void 0 ? void 0 : _props_onChange.call(props, selectedLegends, event, legend);
|
|
184
|
+
(_legend_action = legend.action) === null || _legend_action === void 0 ? void 0 : _legend_action.call(legend);
|
|
185
|
+
}
|
|
186
|
+
function _onHoverOverLegend(legend) {
|
|
187
|
+
if (legend.hoverAction) {
|
|
188
|
+
setActiveLegend(legend.title);
|
|
189
|
+
legend.hoverAction();
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
function _onLeave(legend) {
|
|
193
|
+
if (legend.onMouseOutAction) {
|
|
194
|
+
setActiveLegend('');
|
|
195
|
+
legend.onMouseOutAction();
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
199
|
+
function _renderButton(data, index) {
|
|
200
|
+
const { allowFocusOnLegends = true } = props;
|
|
201
|
+
const legend = {
|
|
202
|
+
title: data.title,
|
|
203
|
+
color: data.color,
|
|
204
|
+
shape: data.shape,
|
|
205
|
+
action: data.action,
|
|
206
|
+
hoverAction: data.hoverAction,
|
|
207
|
+
onMouseOutAction: data.onMouseOutAction,
|
|
208
|
+
stripePattern: data.stripePattern,
|
|
209
|
+
isLineLegendInBarChart: data.isLineLegendInBarChart,
|
|
210
|
+
opacity: data.opacity
|
|
211
|
+
};
|
|
212
|
+
const color = _getColor(legend.title, legend.color);
|
|
213
|
+
const onClickHandler = (event)=>{
|
|
214
|
+
_onClick(legend, event);
|
|
215
|
+
};
|
|
216
|
+
const onHoverHandler = ()=>{
|
|
217
|
+
_onHoverOverLegend(legend);
|
|
218
|
+
};
|
|
219
|
+
const onMouseOut = ()=>{
|
|
220
|
+
_onLeave(legend);
|
|
221
|
+
};
|
|
222
|
+
const shape = _getShape(legend, color);
|
|
223
|
+
return /*#__PURE__*/ React.createElement(Button, {
|
|
224
|
+
...allowFocusOnLegends && {
|
|
225
|
+
'aria-selected': !!selectedLegends[legend.title],
|
|
226
|
+
role: 'option',
|
|
227
|
+
'aria-label': `${legend.title}`,
|
|
228
|
+
'aria-setsize': data['aria-setsize'],
|
|
229
|
+
'aria-posinset': data['aria-posinset']
|
|
230
|
+
},
|
|
231
|
+
...data.nativeButtonProps && {
|
|
232
|
+
...data.nativeButtonProps
|
|
233
|
+
},
|
|
234
|
+
key: index,
|
|
235
|
+
className: classes.legend,
|
|
236
|
+
onClick: onClickHandler,
|
|
237
|
+
onMouseOver: onHoverHandler,
|
|
238
|
+
onMouseOut: onMouseOut,
|
|
239
|
+
onFocus: onHoverHandler,
|
|
240
|
+
onBlur: onMouseOut,
|
|
241
|
+
appearance: 'outline',
|
|
242
|
+
size: "small",
|
|
243
|
+
style: {
|
|
244
|
+
'--rect-height': legend.isLineLegendInBarChart ? '4px' : '12px',
|
|
245
|
+
'--rect-backgroundColor': legend.stripePattern ? '' : color,
|
|
246
|
+
'--rect-borderColor': legend.color ? legend.color : tokens.colorNeutralStroke1,
|
|
247
|
+
'--rect-content': legend.stripePattern ? `repeating-linear-gradient(135deg, transparent, transparent 3px, ${color} 1px, ${color} 4px)` : ''
|
|
248
|
+
}
|
|
249
|
+
}, shape, /*#__PURE__*/ React.createElement("div", {
|
|
250
|
+
className: classes.text,
|
|
251
|
+
style: {
|
|
252
|
+
opacity: color === tokens.colorNeutralBackground1 ? '0.67' : ''
|
|
253
|
+
}
|
|
254
|
+
}, legend.title));
|
|
255
|
+
}
|
|
256
|
+
function _getShape(legend, color) {
|
|
257
|
+
const svgParentProps = {
|
|
258
|
+
className: classes.shape
|
|
259
|
+
};
|
|
260
|
+
const svgChildProps = {
|
|
261
|
+
fill: color,
|
|
262
|
+
strokeWidth: 2,
|
|
263
|
+
stroke: legend.color
|
|
264
|
+
};
|
|
265
|
+
return /*#__PURE__*/ React.createElement(Shape, {
|
|
266
|
+
svgProps: svgParentProps,
|
|
267
|
+
pathProps: svgChildProps,
|
|
268
|
+
shape: legend.shape,
|
|
269
|
+
classNameForNonSvg: classes.rect,
|
|
270
|
+
style: {
|
|
271
|
+
height: legend.isLineLegendInBarChart ? '4px' : '12px',
|
|
272
|
+
backgroundColor: legend.stripePattern ? '' : color,
|
|
273
|
+
borderColor: legend.color ? legend.color : tokens.colorNeutralStroke1,
|
|
274
|
+
content: legend.stripePattern ? `repeating-linear-gradient(135deg, transparent, transparent 3px, ${color} 1px, ${color} 4px)` : '',
|
|
275
|
+
'--rect-content-high-contrast': `linear-gradient(to right, ${color}, ${color})`,
|
|
276
|
+
'--rect-opacity-high-contrast': color === tokens.colorNeutralBackground1 ? '0.6' : ''
|
|
277
|
+
}
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
function _getColor(title, color) {
|
|
281
|
+
let legendColor = color;
|
|
282
|
+
// if one or more legends are selected
|
|
283
|
+
if (_isLegendSelected) {
|
|
284
|
+
// if the given legend (title) is one of the selected legends
|
|
285
|
+
if (selectedLegends[title]) {
|
|
286
|
+
legendColor = color;
|
|
287
|
+
} else {
|
|
288
|
+
legendColor = tokens.colorNeutralBackground1;
|
|
289
|
+
}
|
|
290
|
+
} else {
|
|
291
|
+
// if the given legend is hovered
|
|
292
|
+
// or none of the legends is hovered
|
|
293
|
+
if (activeLegend === title || activeLegend === '') {
|
|
294
|
+
legendColor = color;
|
|
295
|
+
} else {
|
|
296
|
+
legendColor = tokens.colorNeutralBackground1;
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
return legendColor;
|
|
300
|
+
}
|
|
301
|
+
});
|
|
302
|
+
Legends.displayName = 'Legends';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["Legends.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { Button } from '@fluentui/react-button';\nimport { Legend, LegendsProps, LegendShape } from './Legends.types';\nimport { Shape } from './shape';\nimport { useLegendStyles } from './useLegendsStyles.styles';\nimport { Overflow, OverflowItem } from '@fluentui/react-overflow';\nimport { useFocusableGroup, useArrowNavigationGroup } from '@fluentui/react-tabster';\nimport { OverflowMenu } from './OverflowMenu';\nimport { tokens } from '@fluentui/react-theme';\n\n// This is an internal interface used for rendering the legends with unique key\ninterface LegendItem extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n name?: string;\n title: string;\n action: VoidFunction;\n hoverAction: VoidFunction;\n onMouseOutAction: VoidFunction;\n color: string;\n shape?: LegendShape;\n key: number;\n opacity?: number;\n stripePattern?: boolean;\n isLineLegendInBarChart?: boolean;\n}\n\ninterface LegendMap {\n [key: string]: boolean;\n}\n\nexport interface LegendState {\n activeLegend: string;\n /** Set of legends selected, both for multiple selection and single selection */\n selectedLegends: LegendMap;\n}\nexport const Legends: React.FunctionComponent<LegendsProps> = React.forwardRef<HTMLDivElement, LegendsProps>(\n (props, forwardedRef) => {\n /** Boolean variable to check if one or more legends are selected */\n let _isLegendSelected = false;\n\n // set states separately for each instance of the component\n const [activeLegend, setActiveLegend] = React.useState('');\n const [selectedLegends, setSelectedLegends] = React.useState<LegendMap>({});\n const focusAttributes = useFocusableGroup();\n const arrowAttributes = useArrowNavigationGroup({ axis: 'horizontal', memorizeCurrent: true });\n\n React.useEffect(() => {\n let defaultSelectedLegends = {};\n if (props.canSelectMultipleLegends) {\n defaultSelectedLegends =\n props.defaultSelectedLegends?.reduce((combinedDict, key) => ({ [key]: true, ...combinedDict }), {}) || {};\n } else if (props.defaultSelectedLegend) {\n defaultSelectedLegends = { [props.defaultSelectedLegend]: true };\n }\n\n setSelectedLegends(defaultSelectedLegends);\n }, [props.canSelectMultipleLegends, props.defaultSelectedLegend, props.defaultSelectedLegends]);\n\n _isLegendSelected = Object.keys(selectedLegends).length > 0;\n const dataToRender = _generateData();\n const { overflowStyles, allowFocusOnLegends = true, canSelectMultipleLegends = false } = props;\n const classes = useLegendStyles(props);\n const itemIds = dataToRender.map((_item, index) => index.toString());\n const overflowHoverCardLegends: JSX.Element[] = [];\n props.legends.map((legend, index) => {\n const hoverCardElement = _renderButton(legend, index);\n overflowHoverCardLegends.push(hoverCardElement);\n });\n const overflowString = props.overflowText ? props.overflowText : 'more';\n return props.enabledWrapLines ? renderWrappedLegends() : renderLegends();\n\n function renderLegends(): JSX.Element {\n return (\n <div\n {...focusAttributes}\n {...arrowAttributes}\n {...(allowFocusOnLegends && {\n role: 'listbox',\n 'aria-label': 'Legends',\n 'aria-multiselectable': canSelectMultipleLegends,\n })}\n className={classes.root}\n >\n <Overflow>\n <div className={classes.resizableArea} style={{ textAlign: props.centerLegends ? 'center' : 'unset' }}>\n {dataToRender.map((item, id) => (\n <OverflowItem key={id} id={id.toString()}>\n {_renderButton(item)}\n </OverflowItem>\n ))}\n <OverflowMenu itemIds={itemIds} title={`${overflowString}`} items={overflowHoverCardLegends} />\n </div>\n </Overflow>\n </div>\n );\n }\n\n function renderWrappedLegends(): JSX.Element {\n return (\n <div\n {...focusAttributes}\n {...arrowAttributes}\n {...(allowFocusOnLegends && {\n role: 'listbox',\n 'aria-label': 'Legends',\n 'aria-multiselectable': canSelectMultipleLegends,\n })}\n style={{ justifyContent: props.centerLegends ? 'center' : 'unset', flexWrap: 'wrap', ...overflowStyles }}\n className={classes.root}\n >\n <div className={classes.resizableArea} style={{ display: 'flex', flexWrap: 'wrap', overflow: 'auto' }}>\n {dataToRender.map((item, id) => (\n <div key={id} style={{ flex: '0 1 auto', margin: '4px' }}>\n {_renderButton(item)}\n </div>\n ))}\n </div>\n </div>\n );\n }\n\n function _generateData(): LegendItem[] {\n const { /*allowFocusOnLegends = true,*/ shape } = props;\n const dataItems: LegendItem[] = props.legends.map((legend: Legend, index: number) => {\n return {\n /* ...(allowFocusOnLegends && {\n nativeButtonProps: getIntrinsicElementProps(\n 'div',\n {\n legend,\n ...buttonProperties,\n },\n ['title'],\n ),\n 'aria-setsize': props.legends.length,\n 'aria-posinset': index + 1,\n }), */\n title: legend.title,\n action: legend.action!,\n hoverAction: legend.hoverAction!,\n onMouseOutAction: legend.onMouseOutAction!,\n color: legend.color,\n shape: shape ? shape : legend.shape,\n stripePattern: legend.stripePattern,\n isLineLegendInBarChart: legend.isLineLegendInBarChart,\n opacity: legend.opacity,\n key: index,\n };\n });\n return dataItems;\n }\n\n /**\n * This function will get called when there is an ability to\n * select multiple legends\n * @param legend ILegend\n */\n function _canSelectMultipleLegends(legend: Legend): { [key: string]: boolean } {\n let legendsSelected = { ...selectedLegends };\n if (legendsSelected[legend.title]) {\n // Delete entry for the deselected legend to make\n // the number of keys equal to the number of selected legends\n delete legendsSelected[legend.title];\n } else {\n legendsSelected[legend.title] = true;\n // Clear set if all legends are selected\n if (Object.keys(legendsSelected).length === props.legends.length) {\n legendsSelected = {};\n }\n }\n setSelectedLegends(legendsSelected);\n return legendsSelected;\n }\n\n /**\n * This function will get called when there is\n * ability to select only single legend\n * @param legend ILegend\n */\n\n function _canSelectOnlySingleLegend(legend: Legend): boolean {\n if (selectedLegends[legend.title]) {\n setSelectedLegends({});\n return false;\n } else {\n setSelectedLegends({ [legend.title]: true });\n return true;\n }\n }\n\n function _onClick(legend: Legend, event: React.MouseEvent<HTMLButtonElement>): void {\n const { canSelectMultipleLegends = false } = props;\n let selectedLegends: string[] = [];\n if (canSelectMultipleLegends) {\n const nextSelectedLegends = _canSelectMultipleLegends(legend);\n selectedLegends = Object.keys(nextSelectedLegends);\n } else {\n const isSelected = _canSelectOnlySingleLegend(legend);\n selectedLegends = isSelected ? [legend.title] : [];\n }\n props.onChange?.(selectedLegends, event, legend);\n legend.action?.();\n }\n\n function _onHoverOverLegend(legend: Legend) {\n if (legend.hoverAction) {\n setActiveLegend(legend.title);\n legend.hoverAction();\n }\n }\n\n function _onLeave(legend: Legend) {\n if (legend.onMouseOutAction) {\n setActiveLegend('');\n legend.onMouseOutAction();\n }\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n function _renderButton(data: any, index?: number) {\n const { allowFocusOnLegends = true } = props;\n const legend: Legend = {\n title: data.title,\n color: data.color,\n shape: data.shape,\n action: data.action,\n hoverAction: data.hoverAction,\n onMouseOutAction: data.onMouseOutAction,\n stripePattern: data.stripePattern,\n isLineLegendInBarChart: data.isLineLegendInBarChart,\n opacity: data.opacity,\n };\n const color = _getColor(legend.title, legend.color);\n const onClickHandler = (event: React.MouseEvent<HTMLButtonElement>) => {\n _onClick(legend, event);\n };\n const onHoverHandler = () => {\n _onHoverOverLegend(legend);\n };\n const onMouseOut = () => {\n _onLeave(legend);\n };\n const shape = _getShape(legend, color);\n return (\n <Button\n {...(allowFocusOnLegends && {\n 'aria-selected': !!selectedLegends[legend.title],\n role: 'option',\n 'aria-label': `${legend.title}`,\n 'aria-setsize': data['aria-setsize'],\n 'aria-posinset': data['aria-posinset'],\n })}\n {...(data.nativeButtonProps && { ...data.nativeButtonProps })}\n key={index}\n className={classes.legend}\n onClick={onClickHandler}\n onMouseOver={onHoverHandler}\n onMouseOut={onMouseOut}\n onFocus={onHoverHandler}\n onBlur={onMouseOut}\n appearance={'outline'}\n size=\"small\"\n style={{\n '--rect-height': legend.isLineLegendInBarChart ? '4px' : '12px',\n '--rect-backgroundColor': legend.stripePattern ? '' : color,\n '--rect-borderColor': legend.color ? legend.color : tokens.colorNeutralStroke1,\n '--rect-content': legend.stripePattern\n ? // eslint-disable-next-line @fluentui/max-len\n `repeating-linear-gradient(135deg, transparent, transparent 3px, ${color} 1px, ${color} 4px)`\n : '',\n }} /* eslint-enable react/jsx-no-bind */\n >\n {shape}\n <div className={classes.text} style={{ opacity: color === tokens.colorNeutralBackground1 ? '0.67' : '' }}>\n {legend.title}\n </div>\n </Button>\n );\n }\n\n function _getShape(legend: Legend, color: string): React.ReactNode | string {\n const svgParentProps: React.SVGAttributes<SVGElement> = {\n className: classes.shape,\n };\n const svgChildProps: React.SVGAttributes<SVGElement> = {\n fill: color,\n strokeWidth: 2,\n stroke: legend.color,\n };\n return (\n <Shape\n svgProps={svgParentProps}\n pathProps={svgChildProps}\n shape={legend.shape as LegendShape}\n classNameForNonSvg={classes.rect}\n style={\n {\n height: legend.isLineLegendInBarChart ? '4px' : '12px',\n backgroundColor: legend.stripePattern ? '' : color,\n borderColor: legend.color ? legend.color : tokens.colorNeutralStroke1,\n content: legend.stripePattern\n ? // eslint-disable-next-line @fluentui/max-len\n `repeating-linear-gradient(135deg, transparent, transparent 3px, ${color} 1px, ${color} 4px)`\n : '',\n '--rect-content-high-contrast': `linear-gradient(to right, ${color}, ${color})`,\n '--rect-opacity-high-contrast': color === tokens.colorNeutralBackground1 ? '0.6' : '',\n } as React.CSSProperties\n }\n />\n );\n }\n\n function _getColor(title: string, color: string): string {\n let legendColor = color;\n // if one or more legends are selected\n if (_isLegendSelected) {\n // if the given legend (title) is one of the selected legends\n if (selectedLegends[title]) {\n legendColor = color;\n }\n // if the given legend is unselected\n else {\n legendColor = tokens.colorNeutralBackground1;\n }\n }\n // if no legend is selected\n else {\n // if the given legend is hovered\n // or none of the legends is hovered\n if (activeLegend === title || activeLegend === '') {\n legendColor = color;\n }\n // if there is a hovered legend but the given legend is not the one\n else {\n legendColor = tokens.colorNeutralBackground1;\n }\n }\n return legendColor;\n }\n },\n);\nLegends.displayName = 'Legends';\n"],"names":["React","Button","Shape","useLegendStyles","Overflow","OverflowItem","useFocusableGroup","useArrowNavigationGroup","OverflowMenu","tokens","Legends","forwardRef","props","forwardedRef","_isLegendSelected","activeLegend","setActiveLegend","useState","selectedLegends","setSelectedLegends","focusAttributes","arrowAttributes","axis","memorizeCurrent","useEffect","defaultSelectedLegends","canSelectMultipleLegends","reduce","combinedDict","key","defaultSelectedLegend","Object","keys","length","dataToRender","_generateData","overflowStyles","allowFocusOnLegends","classes","itemIds","map","_item","index","toString","overflowHoverCardLegends","legends","legend","hoverCardElement","_renderButton","push","overflowString","overflowText","enabledWrapLines","renderWrappedLegends","renderLegends","div","role","className","root","resizableArea","style","textAlign","centerLegends","item","id","title","items","justifyContent","flexWrap","display","overflow","flex","margin","shape","dataItems","action","hoverAction","onMouseOutAction","color","stripePattern","isLineLegendInBarChart","opacity","_canSelectMultipleLegends","legendsSelected","_canSelectOnlySingleLegend","_onClick","event","nextSelectedLegends","isSelected","onChange","_onHoverOverLegend","_onLeave","data","_getColor","onClickHandler","onHoverHandler","onMouseOut","_getShape","nativeButtonProps","onClick","onMouseOver","onFocus","onBlur","appearance","size","colorNeutralStroke1","text","colorNeutralBackground1","svgParentProps","svgChildProps","fill","strokeWidth","stroke","svgProps","pathProps","classNameForNonSvg","rect","height","backgroundColor","borderColor","content","legendColor","displayName"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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QAC7C,IAAI2C,cAAc3C;QAClB,sCAAsC;QACtC,IAAIhE,mBAAmB;YACrB,6DAA6D;YAC7D,IAAII,eAAe,CAAC+C,MAAM,EAAE;gBAC1BwD,cAAc3C;YAChB,OAEK;gBACH2C,cAAchH,OAAOkG,uBAAuB;YAC9C;QACF,OAEK;YACH,iCAAiC;YACjC,oCAAoC;YACpC,IAAI5F,iBAAiBkD,SAASlD,iBAAiB,IAAI;gBACjD0G,cAAc3C;YAChB,OAEK;gBACH2C,cAAchH,OAAOkG,uBAAuB;YAC9C;QACF;QACA,OAAOc;IACT;AACF,GACA;AACF/G,QAAQgH,WAAW,GAAG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["Legends.types.ts"],"sourcesContent":["import * as React from 'react';\nimport { CustomPoints, Points } from '../../utilities/utilities';\n\n/**\n * @public\n * Legends styles\n * {@docCategory Legends}\n */\nexport interface LegendsStyles {\n /**\n * Style set for the root of the legend component\n */\n root?: string;\n\n /**\n * Style set for Legend. This is a wrapping class for text of legend and the rectange box that represents a legend\n */\n legend?: string;\n\n /**\n * Style set for the rectangle that represents a legend\n */\n rect?: string;\n\n /**\n * styles set for the shape that represents a legend\n */\n shape?: string;\n\n /**\n * Style set for the triangle that represents a legend\n */\n triangle?: string;\n\n /**\n * Style for the legend text\n */\n text?: string;\n\n /**\n * Style for the legend text\n */\n hoverChange?: string;\n\n /**\n * Style for the area that is resizable\n */\n resizableArea?: string;\n}\n\n/**\n * @public\n * ILegend interface\n * {@docCategory Legends}\n */\nexport interface Legend {\n /**\n * Defines the title of the legend\n */\n title: string;\n\n /**\n * Defines the function that is executed on clicking this legend\n */\n action?: VoidFunction;\n\n /**\n * Defines the function that is executed upon hovering over the legend\n */\n hoverAction?: VoidFunction;\n\n /**\n * Defines the function that is executed upon moving the mouse away from the legend\n */\n onMouseOutAction?: (isLegendFocused?: boolean) => void;\n\n /**\n * The color for the legend\n */\n color: string;\n\n /**\n * The opacity of the legend color\n */\n opacity?: number;\n\n /**\n * The shape for the legend\n */\n shape?: LegendShape;\n\n /**\n * Indicated whether or not to apply stripe pattern\n */\n stripePattern?: boolean;\n\n /**\n * Indicates if the legend belongs to a line in the Bar Chart\n */\n isLineLegendInBarChart?: boolean;\n\n /*\n * native button props for the legend button\n */\n nativeButtonProps?: React.ButtonHTMLAttributes<HTMLButtonElement>;\n}\n\n/**\n * @public\n * Legend style properties\n * {@docCategory Legends}\n */\nexport interface LegendStyleProps {\n className?: string;\n colorOnSelectedState?: string;\n borderColor?: string;\n opacity?: number;\n overflow?: boolean;\n stripePattern?: boolean;\n isLineLegendInBarChart?: boolean;\n}\n\n/**\n * @public\n * Legend properties\n * {@docCategory Legends}\n */\nexport interface LegendsProps {\n /**\n * Prop that takes list of legends\n */\n legends: Legend[];\n\n /**\n * Additional CSS class(es) to apply to the legneds component.\n */\n className?: string;\n\n /**\n * Call to provide customized styling that will layer on top of the variant rules.\n */\n styles?: LegendsStyles;\n\n /**\n * This prop makes the legends component align itself to the center in the container it is sitting in\n */\n centerLegends?: boolean;\n\n /**\n * Enable the legends to wrap lines if there is not enough space to show all legends on a single line\n */\n enabledWrapLines?: boolean;\n\n /**\n * style for the overflow component\n */\n overflowStyles?: React.CSSProperties;\n\n /**\n * text for overflow legends string\n */\n overflowText?: string;\n\n /**\n * prop that decides if legends are focusable\n * @default true\n */\n allowFocusOnLegends?: boolean;\n\n /**\n * prop that decide if we can select multiple legends or single legend at a time\n * @default false\n */\n canSelectMultipleLegends?: boolean;\n\n /**\n * Callback issued when the selected option changes.\n */\n onChange?: (selectedLegends: string[], event: React.MouseEvent<HTMLButtonElement>, currentLegend?: Legend) => void;\n\n /**\n * Keys (title) that will be initially used to set selected items.\n * This prop is used for multiSelect scenarios.\n * In other cases, defaultSelectedLegend should be used.\n */\n defaultSelectedLegends?: string[];\n\n /**\n * Key that will be initially used to set selected item.\n * This prop is used for singleSelect scenarios.\n */\n defaultSelectedLegend?: string;\n\n /**\n * The shape for the legend.\n */\n shape?: LegendShape;\n}\n\n/**\n * @public\n * The shape for the legend\n * default: show the rect legend\n * triangle: show the triangle legend\n * {@docCategory Legends}\n */\nexport type LegendShape = 'default' | 'triangle' | keyof typeof Points | keyof typeof CustomPoints;\n"],"names":["React"],"rangeMappings":"","mappings":"AAAA,YAAYA,WAAW,QAAQ"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Menu, MenuTrigger, MenuPopover, MenuList, MenuItem } from '@fluentui/react-menu';
|
|
3
|
+
import { MenuButton } from '@fluentui/react-button';
|
|
4
|
+
import { useOverflowMenu } from '@fluentui/react-overflow';
|
|
5
|
+
export const OverflowMenu = ({ itemIds, title, items })=>{
|
|
6
|
+
const { ref, overflowCount, isOverflowing } = useOverflowMenu();
|
|
7
|
+
let displayLabel = title;
|
|
8
|
+
displayLabel = title === '' ? `+${overflowCount} items` : `+${overflowCount} ${title}`;
|
|
9
|
+
if (!isOverflowing) {
|
|
10
|
+
return null;
|
|
11
|
+
}
|
|
12
|
+
const remainingItemsCount = itemIds.length - overflowCount;
|
|
13
|
+
const menuList = [];
|
|
14
|
+
for(let i = remainingItemsCount; i < itemIds.length; i++){
|
|
15
|
+
menuList.push(/*#__PURE__*/ React.createElement(MenuItem, {
|
|
16
|
+
tabIndex: -1,
|
|
17
|
+
key: i
|
|
18
|
+
}, items[i]));
|
|
19
|
+
}
|
|
20
|
+
return /*#__PURE__*/ React.createElement(Menu, null, /*#__PURE__*/ React.createElement(MenuTrigger, {
|
|
21
|
+
disableButtonEnhancement: true
|
|
22
|
+
}, /*#__PURE__*/ React.createElement(MenuButton, {
|
|
23
|
+
ref: ref
|
|
24
|
+
}, displayLabel)), /*#__PURE__*/ React.createElement(MenuPopover, null, /*#__PURE__*/ React.createElement(MenuList, null, menuList)));
|
|
25
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["OverflowMenu.tsx"],"sourcesContent":["import * as React from 'react';\nimport { Menu, MenuTrigger, MenuPopover, MenuList, MenuItem } from '@fluentui/react-menu';\nimport { MenuButton } from '@fluentui/react-button';\nimport { useOverflowMenu } from '@fluentui/react-overflow';\n\nexport const OverflowMenu: React.FC<{ itemIds: string[]; title: string; items: JSX.Element[] }> = ({\n itemIds,\n title,\n items,\n}) => {\n const { ref, overflowCount, isOverflowing } = useOverflowMenu<HTMLButtonElement>();\n let displayLabel = title;\n displayLabel = title === '' ? `+${overflowCount} items` : `+${overflowCount} ${title}`;\n\n if (!isOverflowing) {\n return null;\n }\n const remainingItemsCount = itemIds.length - overflowCount;\n const menuList = [];\n for (let i = remainingItemsCount; i < itemIds.length; i++) {\n menuList.push(\n <MenuItem tabIndex={-1} key={i}>\n {items[i]}\n </MenuItem>,\n );\n }\n return (\n <Menu>\n <MenuTrigger disableButtonEnhancement>\n <MenuButton ref={ref}>{displayLabel}</MenuButton>\n </MenuTrigger>\n\n <MenuPopover>\n <MenuList>{menuList}</MenuList>\n </MenuPopover>\n </Menu>\n );\n};\n"],"names":["React","Menu","MenuTrigger","MenuPopover","MenuList","MenuItem","MenuButton","useOverflowMenu","OverflowMenu","itemIds","title","items","ref","overflowCount","isOverflowing","displayLabel","remainingItemsCount","length","menuList","i","push","tabIndex","key","disableButtonEnhancement"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,IAAI,EAAEC,WAAW,EAAEC,WAAW,EAAEC,QAAQ,EAAEC,QAAQ,QAAQ,uBAAuB;AAC1F,SAASC,UAAU,QAAQ,yBAAyB;AACpD,SAASC,eAAe,QAAQ,2BAA2B;AAE3D,OAAO,MAAMC,eAAqF,CAAC,EACjGC,OAAO,EACPC,KAAK,EACLC,KAAK,EACN;IACC,MAAM,EAAEC,GAAG,EAAEC,aAAa,EAAEC,aAAa,EAAE,GAAGP;IAC9C,IAAIQ,eAAeL;IACnBK,eAAeL,UAAU,KAAK,CAAC,CAAC,EAAEG,cAAc,MAAM,CAAC,GAAG,CAAC,CAAC,EAAEA,cAAc,CAAC,EAAEH,MAAM,CAAC;IAEtF,IAAI,CAACI,eAAe;QAClB,OAAO;IACT;IACA,MAAME,sBAAsBP,QAAQQ,MAAM,GAAGJ;IAC7C,MAAMK,WAAW,EAAE;IACnB,IAAK,IAAIC,IAAIH,qBAAqBG,IAAIV,QAAQQ,MAAM,EAAEE,IAAK;QACzDD,SAASE,IAAI,eACX,oBAACf;YAASgB,UAAU,CAAC;YAAGC,KAAKH;WAC1BR,KAAK,CAACQ,EAAE;IAGf;IACA,qBACE,oBAAClB,0BACC,oBAACC;QAAYqB,0BAAAA;qBACX,oBAACjB;QAAWM,KAAKA;OAAMG,8BAGzB,oBAACZ,iCACC,oBAACC,gBAAUc;AAInB,EAAE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["index.ts"],"sourcesContent":["export * from './Legends';\nexport * from './Legends.types';\nexport * from './shape';\n"],"names":[],"rangeMappings":";;","mappings":"AAAA,cAAc,YAAY;AAC1B,cAAc,kBAAkB;AAChC,cAAc,UAAU"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { CustomPoints, Points } from '../../utilities/utilities';
|
|
3
|
+
const pointPath = {
|
|
4
|
+
[`${Points[Points.circle]}`]: 'M1 6 A5 5 0 1 0 12 6 M1 6 A5 5 0 0 1 12 6',
|
|
5
|
+
[`${Points[Points.square]}`]: 'M1 1 L12 1 L12 12 L1 12 L1 1 Z',
|
|
6
|
+
[`${Points[Points.triangle]}`]: 'M6 10L8.74228e-07 -1.04907e-06L12 0L6 10Z',
|
|
7
|
+
[`${Points[Points.pyramid]}`]: 'M6 10L8.74228e-07 -1.04907e-06L12 0L6 10Z',
|
|
8
|
+
[`${Points[Points.diamond]}`]: 'M2 2 L10 2 L10 10 L2 10 L2 2 Z',
|
|
9
|
+
[`${Points[Points.hexagon]}`]: 'M9 0H3L0 5L3 10H9L12 5L9 0Z',
|
|
10
|
+
[`${Points[Points.pentagon]}`]: 'M6.06061 0L0 4.21277L2.30303 11H9.69697L12 4.21277L6.06061 0Z',
|
|
11
|
+
[`${Points[Points.octagon]}`]: 'M7.08333 0H2.91667L0 2.91667V7.08333L2.91667 10H7.08333L10 7.08333V2.91667L7.08333 0Z',
|
|
12
|
+
[`${CustomPoints[CustomPoints.dottedLine]}`]: 'M0 6 H3 M5 6 H8 M10 6 H13'
|
|
13
|
+
};
|
|
14
|
+
export const Shape = /*#__PURE__*/ React.forwardRef(({ svgProps, pathProps, shape, classNameForNonSvg, style }, forwardedRef)=>{
|
|
15
|
+
if (Object.keys(pointPath).indexOf(shape) === -1) {
|
|
16
|
+
return /*#__PURE__*/ React.createElement("div", {
|
|
17
|
+
className: classNameForNonSvg,
|
|
18
|
+
style: style
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
return /*#__PURE__*/ React.createElement("svg", {
|
|
22
|
+
width: 14,
|
|
23
|
+
height: 14,
|
|
24
|
+
viewBox: '-1 -1 14 14',
|
|
25
|
+
...svgProps,
|
|
26
|
+
transform: `rotate(${shape === Points[Points.diamond] ? 45 : shape === Points[Points.pyramid] ? 180 : 0}, 0, 0)`,
|
|
27
|
+
style: {
|
|
28
|
+
width: '14px',
|
|
29
|
+
height: '14px'
|
|
30
|
+
}
|
|
31
|
+
}, /*#__PURE__*/ React.createElement("path", {
|
|
32
|
+
d: pointPath[shape],
|
|
33
|
+
...pathProps
|
|
34
|
+
}));
|
|
35
|
+
});
|