@foodpilot/foods 2.1.9 → 2.2.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/dist/components/Cards/TrajectoryCards/components/Comparisons.d.ts +1 -1
- package/dist/components/Cards/TrajectoryCards/components/Step.d.ts +1 -1
- package/dist/components/Cards/TrajectoryCards/styles/index.d.ts +1 -1
- package/dist/components/Chart/DoughnutChart/DoughnutChart.d.ts +3 -2
- package/dist/components/Chart/DoughnutChart/DoughnutChartContent.d.ts +11 -0
- package/dist/components/Chart/DoughnutChart/DoughnutPieChart.d.ts +26 -0
- package/dist/components/Chart/DoughnutChart/useDoughnutChartInteractions.d.ts +16 -0
- package/dist/components/Chart/DoughnutChart/utils.d.ts +18 -0
- package/dist/components/Chart/EvolutionChart/EvolutionChart.d.ts +28 -0
- package/dist/components/Chart/EvolutionChart/EvolutionChartBars.d.ts +17 -0
- package/dist/components/Chart/EvolutionChart/EvolutionChartHoverOverlay.d.ts +19 -0
- package/dist/components/Chart/EvolutionChart/EvolutionChartTooltip.d.ts +33 -0
- package/dist/components/Chart/EvolutionChart/MultiTooltipDisplay.d.ts +21 -0
- package/dist/components/Chart/EvolutionChart/TooltipItem.d.ts +19 -0
- package/dist/components/Chart/EvolutionChart/tooltipUtils.d.ts +36 -0
- package/dist/components/Chart/EvolutionChart/useEvolutionChartInteraction.d.ts +17 -0
- package/dist/components/Chart/EvolutionChart/utils.d.ts +25 -8
- package/dist/components/Chart/HistogramComparisonChart/ComparisonLabel.d.ts +1 -1
- package/dist/components/Chart/HistogramComparisonChart/HistogramComparisonChart.d.ts +2 -2
- package/dist/components/Chart/HistogramComparisonChart/types.d.ts +2 -2
- package/dist/components/Chart/HorizontalGauge/HorizontalGaugeChart.d.ts +1 -1
- package/dist/components/Chart/HorizontalGauge/components/GaugeBackground.d.ts +1 -1
- package/dist/components/Chart/HorizontalGauge/components/GaugeLabels.d.ts +1 -1
- package/dist/components/Chart/HorizontalGauge/types.d.ts +4 -4
- package/dist/components/Chart/Legend/Legend.d.ts +16 -0
- package/dist/components/Chart/Legend/LegendBottom.d.ts +17 -0
- package/dist/components/Chart/Legend/LegendRight.d.ts +17 -0
- package/dist/components/Chart/Legend/LegendSeeMore.d.ts +6 -0
- package/dist/components/Chart/Legend/index.d.ts +5 -0
- package/dist/components/Chart/Legend/types.d.ts +5 -0
- package/dist/components/Chart/Legend/utils.d.ts +7 -0
- package/dist/components/Chart/ScatterPlot/ScatterPlot.d.ts +54 -0
- package/dist/components/Chart/ScatterPlot/ScatterPlotCore.d.ts +30 -0
- package/dist/components/Chart/ScatterPlot/ScatterPlotHoverOverlay.d.ts +9 -0
- package/dist/components/Chart/ScatterPlot/ScatterPlotLabels.d.ts +6 -0
- package/dist/components/Chart/ScatterPlot/ScatterPlotPoints.d.ts +20 -0
- package/dist/components/Chart/ScatterPlot/ScatterPlotTooltip.d.ts +38 -0
- package/dist/components/Chart/ScatterPlot/useScatterPlotInteraction.d.ts +27 -0
- package/dist/components/Chart/ScatterPlot/utils.d.ts +41 -0
- package/dist/components/Chart/TrajectoryChart/TrajectoryChart.d.ts +2 -2
- package/dist/components/Chart/TrajectoryChart/TrajectoryChartBarShapes.d.ts +8 -0
- package/dist/components/Chart/TrajectoryChart/TrajectoryChartCore.d.ts +18 -0
- package/dist/components/Chart/TrajectoryChart/TrajectoryLegend/TrajectoryLegend.d.ts +3 -2
- package/dist/components/Chart/TrajectoryChart/{formatChart.d.ts → TrajectoryLegend/formatChart.d.ts} +11 -2
- package/dist/components/Chart/TrajectoryChart/TrajectoryLegend/types.d.ts +2 -3
- package/dist/components/Chart/TrajectoryChart/TrajectoryLegend/useBuildLegendBlocks.d.ts +3 -2
- package/dist/components/Chart/TrajectoryChart/TrajectoryTooltip.d.ts +2 -16
- package/dist/components/Chart/TrajectoryChart/TrajectoryTooltipItem.d.ts +12 -0
- package/dist/components/Chart/TrajectoryChart/barLayout.d.ts +38 -11
- package/dist/components/Chart/TrajectoryChart/trajectoryTooltipUtils.d.ts +17 -0
- package/dist/components/Chart/TrajectoryChart/types.d.ts +3 -3
- package/dist/components/Chart/TrajectoryChart/useBars.d.ts +3 -3
- package/dist/components/Chart/{WaterfallChart.d.ts → WaterfallChart/WaterfallChart.d.ts} +4 -2
- package/dist/components/Chart/WaterfallChart/WaterfallChartBars.d.ts +9 -0
- package/dist/components/Chart/WaterfallChart/WaterfallChartCore.d.ts +17 -0
- package/dist/components/Chart/WaterfallChart/WaterfallChartTick.d.ts +10 -0
- package/dist/components/Chart/WaterfallChart/WaterfallLegend/WaterfallLegend.d.ts +1 -1
- package/dist/components/Chart/WaterfallChart/WaterfallLegend/types.d.ts +4 -2
- package/dist/components/Chart/WaterfallChart/WaterfallLegend/useBuildLegendBlocks.d.ts +1 -1
- package/dist/components/Chart/WaterfallChart/utils.d.ts +16 -0
- package/dist/components/Chart/index.d.ts +3 -10
- package/dist/components/Chart/shared/tooltipPositioning.d.ts +24 -0
- package/dist/components/Form/FoodsFormBase/FoodsFormBase.d.ts +2 -2
- package/dist/components/Form/FoodsFormBase/FormBaseContext.d.ts +1 -1
- package/dist/components/Navigation/FoodsNavBar/FoodsNavbar.d.ts +4 -4
- package/dist/components/RichTextEditor/components/BackgroundColorInput/index.d.ts +2 -2
- package/dist/components/RichTextEditor/components/BorderRadiusInput/index.d.ts +2 -2
- package/dist/components/RichTextEditor/components/ColorInput/index.d.ts +2 -2
- package/dist/components/RichTextEditor/components/ColorInput/style/index.d.ts +2 -2
- package/dist/components/RichTextEditor/editor/styles/index.d.ts +6 -6
- package/dist/components/RichTextEditor/extensions/FontSize.d.ts +1 -1
- package/dist/components/RichTextEditor/extensions/LabelExtension.d.ts +1 -1
- package/dist/components/RichTextEditor/extensions/SvgIconExtension.d.ts +1 -1
- package/dist/components/ToggleSwitch/ToggleSwitch.d.ts +2 -2
- package/dist/main.js +51583 -58004
- package/dist/main.umd.cjs +182 -205
- package/dist/themes/common/custom.d.ts +4 -0
- package/package.json +5 -8
- package/dist/components/Chart/DoughnutChart/DoughnutChartLegend.d.ts +0 -21
- package/dist/components/Chart/DoughnutChart/DoughnutChartLegendBottom.d.ts +0 -17
- package/dist/components/Chart/DoughnutChart/DoughnutChartLegendRight.d.ts +0 -17
- package/dist/components/Chart/DoughnutChart/DoughnutChartLegendSeeMoreLink.d.ts +0 -6
- package/dist/components/Chart/DoughnutChart/doughnutChartAdditions.d.ts +0 -21
- package/dist/components/Chart/EvolutionChart/Legend.d.ts +0 -14
- package/dist/components/Chart/EvolutionChart/Popover.d.ts +0 -15
- package/dist/components/Chart/EvolutionChart/lineRepositionPlugin.d.ts +0 -2
- package/dist/components/Chart/EvolutionChart/useEvolutionChart.d.ts +0 -14
- package/dist/components/Chart/EvolutionChart.d.ts +0 -22
- package/dist/components/Chart/ScatterPlot.d.ts +0 -21
- package/dist/components/Chart/WaterfallChart/useWaterfallChart.d.ts +0 -11
- package/dist/components/Chart/common/chart.d.ts +0 -15
- package/dist/components/Chart/scatterPlotAdditions.d.ts +0 -41
- /package/dist/components/Chart/{DoughnutChart → Legend}/RenderItemMarker.d.ts +0 -0
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { ComparisonProps, TargetComparisonProps } from '../Blocks/types';
|
|
2
|
-
export declare const StartCurrentComparison: ({ currentValue, targetValue, orientation, improvement
|
|
2
|
+
export declare const StartCurrentComparison: ({ currentValue, targetValue, orientation, improvement }: ComparisonProps) => import("react/jsx-runtime").JSX.Element;
|
|
3
3
|
export declare const LastTargetComparison: ({ currentValue, targetValue, orientation, improvement, }: TargetComparisonProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -10,7 +10,7 @@ type StepsProps = {
|
|
|
10
10
|
isLast: boolean;
|
|
11
11
|
isHorizontal?: boolean;
|
|
12
12
|
extra?: SxProps;
|
|
13
|
-
orientation?:
|
|
13
|
+
orientation?: "horizontal" | "vertical";
|
|
14
14
|
children?: React.ReactNode;
|
|
15
15
|
valueFormatterFn?: (value: number) => string | number;
|
|
16
16
|
};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
import { TypographyProps } from '@mui/material';
|
|
3
3
|
import { Property } from 'csstype';
|
|
4
|
-
import {
|
|
4
|
+
import { ChartLegend } from '../Legend';
|
|
5
5
|
export type DoughnutChartProps = {
|
|
6
6
|
values?: number[];
|
|
7
7
|
valuesUnit?: string;
|
|
8
8
|
labels?: string[];
|
|
9
9
|
colors?: Property.Color[];
|
|
10
|
-
legend?:
|
|
10
|
+
legend?: ChartLegend;
|
|
11
11
|
icons?: ReactNode[];
|
|
12
12
|
children?: ReactNode;
|
|
13
13
|
className?: string;
|
|
@@ -22,5 +22,6 @@ export type DoughnutChartProps = {
|
|
|
22
22
|
fullWidthLegend?: boolean;
|
|
23
23
|
hoverOffset?: number;
|
|
24
24
|
showTooltip?: boolean;
|
|
25
|
+
width?: string;
|
|
25
26
|
};
|
|
26
27
|
export declare const DoughnutChart: (props: DoughnutChartProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { TypographyProps } from '@mui/material';
|
|
3
|
+
type DoughnutChartContentProps = {
|
|
4
|
+
isLoading: boolean;
|
|
5
|
+
displayValue: ReactNode;
|
|
6
|
+
displayTotalVariant: TypographyProps["variant"];
|
|
7
|
+
valuesUnit?: string;
|
|
8
|
+
displayTotal: string | boolean | undefined;
|
|
9
|
+
};
|
|
10
|
+
export declare const DoughnutChartContent: (props: DoughnutChartContentProps) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { Property } from 'csstype';
|
|
3
|
+
import { DoughnutChartData } from './utils';
|
|
4
|
+
import { RechartsMouseEventHandler } from './useDoughnutChartInteractions';
|
|
5
|
+
type DoughnutPieChartProps = {
|
|
6
|
+
data: DoughnutChartData[];
|
|
7
|
+
hoveredArcIndex: number | null;
|
|
8
|
+
spacing: number;
|
|
9
|
+
borderWidth: number;
|
|
10
|
+
borderColor?: Property.Color;
|
|
11
|
+
showTooltip: boolean;
|
|
12
|
+
tooltipPos: {
|
|
13
|
+
x: number;
|
|
14
|
+
y: number;
|
|
15
|
+
angle?: number;
|
|
16
|
+
} | undefined;
|
|
17
|
+
valuesFormatterFn?: (value: number) => string;
|
|
18
|
+
language: string;
|
|
19
|
+
valuesUnit?: string;
|
|
20
|
+
icons?: ReactNode[];
|
|
21
|
+
onMouseEnter: (event: RechartsMouseEventHandler, index: number) => void;
|
|
22
|
+
onMouseLeave: () => void;
|
|
23
|
+
onLegendAction?: (index: number) => void;
|
|
24
|
+
};
|
|
25
|
+
export declare const DoughnutPieChart: (props: DoughnutPieChartProps) => import("react/jsx-runtime").JSX.Element;
|
|
26
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { RefObject } from 'react';
|
|
2
|
+
import { DoughnutChartData, TooltipPosition } from './utils';
|
|
3
|
+
export type RechartsMouseEventHandler = {
|
|
4
|
+
cx: number;
|
|
5
|
+
cy: number;
|
|
6
|
+
midAngle: number;
|
|
7
|
+
outerRadius: number;
|
|
8
|
+
innerRadius: number;
|
|
9
|
+
};
|
|
10
|
+
export declare const useDoughnutChartInteractions: (data: DoughnutChartData[], chartRef: RefObject<HTMLDivElement>) => {
|
|
11
|
+
hoveredArcIndex: number | null;
|
|
12
|
+
tooltipPos: TooltipPosition | undefined;
|
|
13
|
+
handleLegendHover: (index: number | null, event?: React.MouseEvent<HTMLElement>) => void;
|
|
14
|
+
handleMouseEnter: (event: RechartsMouseEventHandler, index: number) => void;
|
|
15
|
+
handleMouseOut: () => void;
|
|
16
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Property } from 'csstype';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
export type DoughnutChartData = {
|
|
4
|
+
name: string;
|
|
5
|
+
value: number;
|
|
6
|
+
color: Property.Color;
|
|
7
|
+
index: number;
|
|
8
|
+
};
|
|
9
|
+
export type TooltipPosition = {
|
|
10
|
+
x: number;
|
|
11
|
+
y: number;
|
|
12
|
+
angle?: number;
|
|
13
|
+
};
|
|
14
|
+
export declare const prepareChartData: (values: number[] | undefined, labels: string[] | undefined, palette: Property.Color[]) => DoughnutChartData[];
|
|
15
|
+
export declare const calculateTooltipPosition: (data: DoughnutChartData[], index: number, chartWidth: number, chartHeight: number) => TooltipPosition;
|
|
16
|
+
export declare const calculateTooltipPositionFromEvent: (cx: number, cy: number, midAngle: number, outerRadius: number) => TooltipPosition;
|
|
17
|
+
export declare const formatDisplayValue: (children: ReactNode | undefined, displayTotal: string | boolean | undefined, sumValues: number | undefined, valueFormatterFn: (value: number) => string) => ReactNode;
|
|
18
|
+
export declare const calculateSumValues: (values: number[] | undefined, displayTotal: string | boolean | undefined) => number | undefined;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export type EvolutionChartDataset = {
|
|
3
|
+
label: string;
|
|
4
|
+
data: number[];
|
|
5
|
+
backgroundColor?: string;
|
|
6
|
+
};
|
|
7
|
+
export type EvolutionChartLegend = {
|
|
8
|
+
position: "bottom" | "right";
|
|
9
|
+
actions?: Array<(() => void) | undefined>;
|
|
10
|
+
seeMore?: string;
|
|
11
|
+
fullWidthLegend?: boolean;
|
|
12
|
+
};
|
|
13
|
+
export type EvolutionChartProps = {
|
|
14
|
+
labels: string[];
|
|
15
|
+
values: EvolutionChartDataset[];
|
|
16
|
+
unit?: string;
|
|
17
|
+
height?: string;
|
|
18
|
+
width?: string;
|
|
19
|
+
legend?: EvolutionChartLegend;
|
|
20
|
+
valueFormatterFn?: (value: number, precision?: number) => string;
|
|
21
|
+
precision?: number;
|
|
22
|
+
icons?: ReactNode[];
|
|
23
|
+
showLegend?: boolean;
|
|
24
|
+
improvement?: "increase" | "decrease";
|
|
25
|
+
segmentGap?: number;
|
|
26
|
+
areaGap?: number;
|
|
27
|
+
};
|
|
28
|
+
export declare const EvolutionChart: (props: EvolutionChartProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { EvolutionChartDataset } from './EvolutionChart';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
type EvolutionChartBarsProps = {
|
|
4
|
+
values: EvolutionChartDataset[];
|
|
5
|
+
colors: string[];
|
|
6
|
+
hoveredDatasetIndex: number | null;
|
|
7
|
+
maxBarSize: number;
|
|
8
|
+
segmentGap: number;
|
|
9
|
+
registerBarTopY: (payloadName: unknown, datasetIndex: unknown, y: unknown) => void;
|
|
10
|
+
registerBarBottomY: (payloadName: unknown, datasetIndex: unknown, yBottom: unknown) => void;
|
|
11
|
+
registerBarCenterX: (payloadName: unknown, xCenter: unknown) => void;
|
|
12
|
+
registerBarHalfWidth: (payloadName: unknown, width: unknown) => void;
|
|
13
|
+
onDatasetHover: (index: number) => void;
|
|
14
|
+
onDatasetLeave: () => void;
|
|
15
|
+
};
|
|
16
|
+
export declare const EvolutionChartBars: (props: EvolutionChartBarsProps) => ReactNode;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { MutableRefObject, ReactNode } from 'react';
|
|
2
|
+
type EvolutionChartHoverOverlayProps = {
|
|
3
|
+
hoveredDatasetIndex: number | null;
|
|
4
|
+
labels: string[];
|
|
5
|
+
barCentersRef: MutableRefObject<Record<string, number>>;
|
|
6
|
+
barHalfWidthRef: MutableRefObject<Record<string, number>>;
|
|
7
|
+
barTopsRef: MutableRefObject<Record<string, Record<number, number>>>;
|
|
8
|
+
barBottomsRef: MutableRefObject<Record<string, Record<number, number>>>;
|
|
9
|
+
colors: string[];
|
|
10
|
+
areaGap: number;
|
|
11
|
+
barWidth: number;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Creates smooth curved areas that highlight a dataset when you hover over it.
|
|
15
|
+
* Think of it like drawing connecting bridges between all the bars of the same color
|
|
16
|
+
* to show they belong together - like connecting the dots but with pretty curves!
|
|
17
|
+
*/
|
|
18
|
+
export declare const EvolutionChartHoverOverlay: (props: EvolutionChartHoverOverlayProps) => ReactNode;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { EvolutionChartDataset } from './EvolutionChart';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
type EvolutionChartTooltipProps = {
|
|
4
|
+
active?: boolean;
|
|
5
|
+
payload?: Array<{
|
|
6
|
+
payload?: {
|
|
7
|
+
total?: number;
|
|
8
|
+
};
|
|
9
|
+
} & Record<string, unknown>>;
|
|
10
|
+
label?: string | number;
|
|
11
|
+
coordinate?: {
|
|
12
|
+
x: number;
|
|
13
|
+
y: number;
|
|
14
|
+
} | null;
|
|
15
|
+
unit?: string;
|
|
16
|
+
valueFormatterFn?: (value: number, precision?: number) => string;
|
|
17
|
+
precision?: number;
|
|
18
|
+
language: string;
|
|
19
|
+
positiveTrend: "increase" | "decrease";
|
|
20
|
+
datasets: EvolutionChartDataset[];
|
|
21
|
+
labels: string[];
|
|
22
|
+
barTopY?: number;
|
|
23
|
+
hoveredDatasetIndex?: number | null;
|
|
24
|
+
prevBarTopY?: number;
|
|
25
|
+
prevX?: number;
|
|
26
|
+
currentX?: number;
|
|
27
|
+
allCenters?: Array<number | undefined>;
|
|
28
|
+
allTopYs?: Array<number | undefined>;
|
|
29
|
+
improvement?: "increase" | "decrease";
|
|
30
|
+
legendHovering?: boolean;
|
|
31
|
+
};
|
|
32
|
+
export declare const EvolutionChartTooltip: (props: EvolutionChartTooltipProps) => ReactNode;
|
|
33
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { EvolutionChartDataset } from './EvolutionChart';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
type MultiTooltipDisplayProps = {
|
|
4
|
+
hoveredIdx: number;
|
|
5
|
+
labels: string[];
|
|
6
|
+
datasets: EvolutionChartDataset[];
|
|
7
|
+
allCenters: Array<number | undefined>;
|
|
8
|
+
allTopYs: Array<number | undefined>;
|
|
9
|
+
coordinate: {
|
|
10
|
+
x: number;
|
|
11
|
+
y: number;
|
|
12
|
+
};
|
|
13
|
+
positiveTrend: "increase" | "decrease";
|
|
14
|
+
currentIndex: number;
|
|
15
|
+
unit?: string;
|
|
16
|
+
valueFormatterFn?: (value: number, precision?: number) => string;
|
|
17
|
+
precision: number;
|
|
18
|
+
language: string;
|
|
19
|
+
};
|
|
20
|
+
export declare const MultiTooltipDisplay: (props: MultiTooltipDisplayProps) => ReactNode;
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
type TooltipItemProps = {
|
|
3
|
+
x: number;
|
|
4
|
+
y: number;
|
|
5
|
+
value: number;
|
|
6
|
+
unit?: string;
|
|
7
|
+
formatValue: (value: number) => string;
|
|
8
|
+
showDelta?: boolean;
|
|
9
|
+
deltaProps?: {
|
|
10
|
+
percentageChange: number;
|
|
11
|
+
isIncrease: boolean;
|
|
12
|
+
isPositive: boolean;
|
|
13
|
+
precision: number;
|
|
14
|
+
language: string;
|
|
15
|
+
};
|
|
16
|
+
zIndex?: number;
|
|
17
|
+
};
|
|
18
|
+
export declare const TooltipItem: (props: TooltipItemProps) => ReactNode;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { EvolutionChartDataset } from './EvolutionChart';
|
|
2
|
+
export type TooltipCalculations = {
|
|
3
|
+
currentIndex: number;
|
|
4
|
+
currentTotal: number;
|
|
5
|
+
previousTotal: number;
|
|
6
|
+
currentSegment: number | undefined;
|
|
7
|
+
previousSegment: number | undefined;
|
|
8
|
+
valueToDisplay: number;
|
|
9
|
+
previousValue: number;
|
|
10
|
+
isIncrease: boolean;
|
|
11
|
+
isPositive: boolean;
|
|
12
|
+
percentageChange: number;
|
|
13
|
+
};
|
|
14
|
+
export type TooltipPositions = {
|
|
15
|
+
curX: number;
|
|
16
|
+
curY: number;
|
|
17
|
+
prevXPos?: number;
|
|
18
|
+
prevYPos?: number;
|
|
19
|
+
};
|
|
20
|
+
export type MultiTooltipData = {
|
|
21
|
+
firstVal: number;
|
|
22
|
+
val: number;
|
|
23
|
+
showDelta: boolean;
|
|
24
|
+
pctChange: number;
|
|
25
|
+
isIncreaseVsFirst: boolean;
|
|
26
|
+
isPositiveVsFirst: boolean;
|
|
27
|
+
};
|
|
28
|
+
export declare const calculateTooltipData: (hoveredDatasetIndex: number | null, datasets: EvolutionChartDataset[], labels: string[], label: string | number, currentData: {
|
|
29
|
+
total: number;
|
|
30
|
+
}, positiveTrend: "increase" | "decrease", legendHovering: boolean) => TooltipCalculations | null;
|
|
31
|
+
export declare const calculateTooltipPositions: (coordinate: {
|
|
32
|
+
x: number;
|
|
33
|
+
y: number;
|
|
34
|
+
}, currentX?: number, barTopY?: number, prevX?: number, prevBarTopY?: number) => TooltipPositions;
|
|
35
|
+
export declare const formatTooltipValue: (value: number, valueFormatterFn: (value: number, precision?: number) => string, precision?: number) => string;
|
|
36
|
+
export declare const calculateMultiTooltipData: (datasets: EvolutionChartDataset[], hoveredIdx: number, idx: number, labels: string[], positiveTrend: "increase" | "decrease") => MultiTooltipData;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { TransformedData } from './utils';
|
|
2
|
+
export declare const useEvolutionChartInteraction: (transformedData: TransformedData[]) => {
|
|
3
|
+
hoveredDatasetIndex: number | null;
|
|
4
|
+
isLegendHover: boolean;
|
|
5
|
+
barTopsRef: import('react').MutableRefObject<Record<string, Record<number, number>>>;
|
|
6
|
+
barCentersRef: import('react').MutableRefObject<Record<string, number>>;
|
|
7
|
+
barBottomsRef: import('react').MutableRefObject<Record<string, Record<number, number>>>;
|
|
8
|
+
barHalfWidthRef: import('react').MutableRefObject<Record<string, number>>;
|
|
9
|
+
chartContainerRef: import('react').MutableRefObject<HTMLElement | null>;
|
|
10
|
+
registerBarTopY: (payloadName: unknown, datasetIndex: unknown, y: unknown) => void;
|
|
11
|
+
registerBarBottomY: (payloadName: unknown, datasetIndex: unknown, yBottom: unknown) => void;
|
|
12
|
+
registerBarCenterX: (payloadName: unknown, xCenter: unknown) => void;
|
|
13
|
+
registerBarHalfWidth: (payloadName: unknown, width: unknown) => void;
|
|
14
|
+
handleDatasetHover: (index: number) => void;
|
|
15
|
+
handleDatasetLeave: () => void;
|
|
16
|
+
handleLegendHover: (index: number | null) => void;
|
|
17
|
+
};
|
|
@@ -1,8 +1,25 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export {
|
|
1
|
+
import { EvolutionChartDataset } from './EvolutionChart';
|
|
2
|
+
import { Theme } from '@mui/material/styles';
|
|
3
|
+
export type TransformedData = {
|
|
4
|
+
name: string;
|
|
5
|
+
total: number;
|
|
6
|
+
[key: string]: string | number;
|
|
7
|
+
};
|
|
8
|
+
export type Point = {
|
|
9
|
+
x: number;
|
|
10
|
+
y: number;
|
|
11
|
+
};
|
|
12
|
+
export declare const transformData: (labels: string[], values: EvolutionChartDataset[]) => TransformedData[];
|
|
13
|
+
export declare const getColors: (values: EvolutionChartDataset[], theme: Theme) => string[];
|
|
14
|
+
export declare const getAggregatedTotals: (values: EvolutionChartDataset[]) => number[];
|
|
15
|
+
export declare const clamp: (v: number, min: number, max: number) => number;
|
|
16
|
+
export declare const computeControlPoints: (_p0: Point, p1: Point, p2: Point, _p3: Point, _invertBump?: boolean) => {
|
|
17
|
+
cp1: {
|
|
18
|
+
x: number;
|
|
19
|
+
y: number;
|
|
20
|
+
};
|
|
21
|
+
cp2: {
|
|
22
|
+
x: number;
|
|
23
|
+
y: number;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
@@ -7,7 +7,7 @@ export type ComparisonLabelProps = LabelProps & {
|
|
|
7
7
|
options?: ComparisonLabelOptions;
|
|
8
8
|
precision?: number;
|
|
9
9
|
language?: string;
|
|
10
|
-
improvementType?:
|
|
10
|
+
improvementType?: "increase" | "decrease";
|
|
11
11
|
chartHeight?: number;
|
|
12
12
|
valuesFormatterFn?: (value: number) => string;
|
|
13
13
|
};
|
|
@@ -5,12 +5,12 @@ type HistogramComparisonChartProps = {
|
|
|
5
5
|
chartStyling?: ChartStylingOptions;
|
|
6
6
|
comparisonLabelOptions?: ComparisonLabelOptions;
|
|
7
7
|
valueLabelOptions?: ValueLabelOptions;
|
|
8
|
-
valuesFormatterFn?: (value: number) => string;
|
|
8
|
+
valuesFormatterFn?: (value: number, precision?: number) => string;
|
|
9
9
|
precision?: number;
|
|
10
10
|
chartWidth?: number;
|
|
11
11
|
chartHeight?: number;
|
|
12
12
|
displayComparisonLabel?: boolean;
|
|
13
|
-
improvementType?:
|
|
13
|
+
improvementType?: "increase" | "decrease";
|
|
14
14
|
};
|
|
15
15
|
export declare const HistogramComparisonChart: (props: HistogramComparisonChartProps) => import("react/jsx-runtime").JSX.Element;
|
|
16
16
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export type DataPoint = {
|
|
2
2
|
value: number;
|
|
3
3
|
label: string;
|
|
4
|
-
shape?:
|
|
4
|
+
shape?: "dotted" | "solid";
|
|
5
5
|
withComparison?: boolean;
|
|
6
6
|
comparisonValue?: number;
|
|
7
7
|
};
|
|
@@ -37,7 +37,7 @@ export type ComparisonLabelOptions = {
|
|
|
37
37
|
minTextSize?: number;
|
|
38
38
|
minUnitSize?: number;
|
|
39
39
|
hideWhenNoSpace?: boolean;
|
|
40
|
-
improvementType?:
|
|
40
|
+
improvementType?: "increase" | "decrease";
|
|
41
41
|
};
|
|
42
42
|
export type ValueLabelOptions = {
|
|
43
43
|
valueOffsetY?: number;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { HorizontalGaugeChartProps } from './types';
|
|
2
|
-
export declare const HorizontalGaugeChart: (
|
|
2
|
+
export declare const HorizontalGaugeChart: (props: HorizontalGaugeChartProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { GaugeBackgroundProps } from '../types';
|
|
2
|
-
export declare const GaugeBackground: ({ x, y, width, height, animated, backgroundProps }: GaugeBackgroundProps) => import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare const GaugeBackground: ({ x, y, width, height, animated, backgroundProps, }: GaugeBackgroundProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { GaugeLabelsProps } from '../types';
|
|
2
|
-
export declare const GaugeLabels: ({ minValue, maxValue, companyValue, averageValue, companyPosition, averagePosition, labelCompany, labelAverage, labelYPositions, labelPositions, animated, precision, unit, valueFormatter }: GaugeLabelsProps) => import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare const GaugeLabels: ({ minValue, maxValue, companyValue, averageValue, companyPosition, averagePosition, labelCompany, labelAverage, labelYPositions, labelPositions, animated, precision, unit, valueFormatter, }: GaugeLabelsProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -12,9 +12,9 @@ export type HorizontalGaugeChartProps = {
|
|
|
12
12
|
backgroundProps?: BackgroundProps;
|
|
13
13
|
precision?: number;
|
|
14
14
|
unit?: string;
|
|
15
|
-
valueFormatter?: (value: number) => string;
|
|
15
|
+
valueFormatter?: (value: number, precision?: number) => string;
|
|
16
16
|
};
|
|
17
|
-
export type TextAnchor =
|
|
17
|
+
export type TextAnchor = "start" | "middle" | "end";
|
|
18
18
|
export type LabelPosition = {
|
|
19
19
|
x: number;
|
|
20
20
|
anchor: TextAnchor;
|
|
@@ -98,7 +98,7 @@ export type GaugeMarkersProps = {
|
|
|
98
98
|
unit?: string;
|
|
99
99
|
labelCompany?: string;
|
|
100
100
|
labelAverage?: string;
|
|
101
|
-
valueFormatter?: (value: number) => string;
|
|
101
|
+
valueFormatter?: (value: number, precision?: number) => string;
|
|
102
102
|
};
|
|
103
103
|
export type GaugeLabelsProps = {
|
|
104
104
|
minValue: number;
|
|
@@ -114,5 +114,5 @@ export type GaugeLabelsProps = {
|
|
|
114
114
|
animated: boolean;
|
|
115
115
|
precision?: number;
|
|
116
116
|
unit?: string;
|
|
117
|
-
valueFormatter?: (value: number) => string;
|
|
117
|
+
valueFormatter?: (value: number, precision?: number) => string;
|
|
118
118
|
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ChartLegend } from './types';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
import { Property } from 'csstype';
|
|
4
|
+
export type ChartLegendProps = {
|
|
5
|
+
labels?: string[];
|
|
6
|
+
values?: number[];
|
|
7
|
+
colors?: Property.Color[];
|
|
8
|
+
icons?: ReactNode[];
|
|
9
|
+
legend?: ChartLegend;
|
|
10
|
+
hoveredDatasetIndex: number | null;
|
|
11
|
+
onLegendHover?: (index: number | null, event?: React.MouseEvent<HTMLElement>) => void;
|
|
12
|
+
hidePercentage?: boolean;
|
|
13
|
+
children?: ReactNode;
|
|
14
|
+
chartRef?: React.RefObject<HTMLElement>;
|
|
15
|
+
};
|
|
16
|
+
export declare const Legend: (props: ChartLegendProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ChartLegend } from './types';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
import { Property } from 'csstype';
|
|
4
|
+
type ChartLegendVariantProps = {
|
|
5
|
+
values?: number[];
|
|
6
|
+
labels?: string[];
|
|
7
|
+
colors?: Property.Color[];
|
|
8
|
+
icons?: ReactNode[];
|
|
9
|
+
legend?: ChartLegend;
|
|
10
|
+
hoveredDatasetIndex: number | null;
|
|
11
|
+
onLegendHover?: (index: number | null, event?: React.MouseEvent<HTMLElement>) => void;
|
|
12
|
+
children?: ReactNode;
|
|
13
|
+
chartRef?: React.RefObject<HTMLElement>;
|
|
14
|
+
hidePercentage?: boolean;
|
|
15
|
+
};
|
|
16
|
+
export declare const LegendBottom: (props: ChartLegendVariantProps) => import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ChartLegend } from './types';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
import { Property } from 'csstype';
|
|
4
|
+
type ChartLegendVariantProps = {
|
|
5
|
+
values?: number[];
|
|
6
|
+
labels?: string[];
|
|
7
|
+
colors?: Property.Color[];
|
|
8
|
+
icons?: ReactNode[];
|
|
9
|
+
legend?: ChartLegend;
|
|
10
|
+
hoveredDatasetIndex: number | null;
|
|
11
|
+
onLegendHover?: (index: number | null, event?: React.MouseEvent<HTMLElement>) => void;
|
|
12
|
+
children?: ReactNode;
|
|
13
|
+
chartRef?: React.RefObject<HTMLElement>;
|
|
14
|
+
hidePercentage?: boolean;
|
|
15
|
+
};
|
|
16
|
+
export declare const LegendRight: (props: ChartLegendVariantProps) => import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Theme } from '@mui/material';
|
|
2
|
+
import { Property } from 'csstype';
|
|
3
|
+
export declare const extractPaletteFromTheme: (theme: Theme, min: number, max: number) => Property.Color[];
|
|
4
|
+
export declare const createPalette: (colors: Property.Color[], values: number[]) => Property.Color[];
|
|
5
|
+
export declare const createDistribution: (values: number[]) => number[];
|
|
6
|
+
export declare const dispatchMouseEventOnChart: (element: HTMLElement | null, x: number, y: number) => void;
|
|
7
|
+
export declare const dispatchMouseLeaveOnChart: (element: HTMLElement | null) => void;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { ButtonProps } from '@mui/material';
|
|
3
|
+
import { ChartLegend } from '../Legend/types';
|
|
4
|
+
export type Point = {
|
|
5
|
+
x: number;
|
|
6
|
+
y: number;
|
|
7
|
+
label: string;
|
|
8
|
+
id?: number | string;
|
|
9
|
+
additionalContent?: ReactNode;
|
|
10
|
+
};
|
|
11
|
+
export type SeriesData = {
|
|
12
|
+
name: string;
|
|
13
|
+
color?: string;
|
|
14
|
+
data: Point[];
|
|
15
|
+
};
|
|
16
|
+
export type SelectedPoint = {
|
|
17
|
+
point: Point;
|
|
18
|
+
seriesName: string;
|
|
19
|
+
absoluteCoordinate: {
|
|
20
|
+
x: number;
|
|
21
|
+
y: number;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
export type ScatterPlotProps = {
|
|
25
|
+
values: SeriesData[];
|
|
26
|
+
xLabel: ReactNode;
|
|
27
|
+
yLabel: ReactNode;
|
|
28
|
+
onPointSelection: (selectedPoint: SelectedPoint | null) => void;
|
|
29
|
+
width?: string;
|
|
30
|
+
height?: string;
|
|
31
|
+
valueFormatterFn?: (value: number, precision?: number) => string;
|
|
32
|
+
precision?: number;
|
|
33
|
+
language?: string;
|
|
34
|
+
unit?: string;
|
|
35
|
+
xUnit?: string;
|
|
36
|
+
yUnit?: string;
|
|
37
|
+
textOptions?: {
|
|
38
|
+
for: string;
|
|
39
|
+
};
|
|
40
|
+
legend?: ChartLegend;
|
|
41
|
+
onLegendHover?: (index: number | null) => void;
|
|
42
|
+
tooltipOptions?: {
|
|
43
|
+
button?: {
|
|
44
|
+
variant?: ButtonProps["variant"];
|
|
45
|
+
color?: ButtonProps["color"];
|
|
46
|
+
size?: ButtonProps["size"];
|
|
47
|
+
text?: string;
|
|
48
|
+
startIcon?: ReactNode;
|
|
49
|
+
onClick?: () => void;
|
|
50
|
+
href?: string;
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
export declare const ScatterPlot: (props: ScatterPlotProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { ButtonProps } from '@mui/material';
|
|
3
|
+
import { SelectedPoint, SeriesData } from './ScatterPlot';
|
|
4
|
+
export type ScatterPlotCoreProps = {
|
|
5
|
+
values: SeriesData[];
|
|
6
|
+
onPointSelection: (selectedPoint: SelectedPoint | null) => void;
|
|
7
|
+
valueFormatterFn?: (value: number, precision?: number) => string;
|
|
8
|
+
precision?: number;
|
|
9
|
+
language?: string;
|
|
10
|
+
unit?: string;
|
|
11
|
+
xUnit?: string;
|
|
12
|
+
yUnit?: string;
|
|
13
|
+
textOptions?: {
|
|
14
|
+
for: string;
|
|
15
|
+
};
|
|
16
|
+
onLegendHover?: (index: number | null) => void;
|
|
17
|
+
showSeriesInTooltip?: boolean;
|
|
18
|
+
tooltipOptions?: {
|
|
19
|
+
button?: {
|
|
20
|
+
variant?: ButtonProps["variant"];
|
|
21
|
+
color?: ButtonProps["color"];
|
|
22
|
+
size?: ButtonProps["size"];
|
|
23
|
+
text?: string;
|
|
24
|
+
endIcon?: ReactNode;
|
|
25
|
+
onClick?: () => void;
|
|
26
|
+
href?: string;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
export declare const ScatterPlotCore: (props: ScatterPlotCoreProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { HoverState } from './useScatterPlotInteraction';
|
|
2
|
+
type OverlayProps = {
|
|
3
|
+
hover: HoverState;
|
|
4
|
+
valueFormatterFn?: (value: number, precision?: number) => string;
|
|
5
|
+
precision?: number;
|
|
6
|
+
language?: string;
|
|
7
|
+
};
|
|
8
|
+
export declare const ScatterPlotHoverOverlay: (props: OverlayProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
9
|
+
export {};
|