@mui/x-charts-pro 8.0.0-alpha.13 → 8.0.0-alpha.14
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/BarChartPro/BarChartPro.d.ts +2 -1
- package/CHANGELOG.md +131 -0
- package/ChartContainerPro/useChartContainerProProps.d.ts +1 -1
- package/ChartDataProviderPro/useChartDataProviderProProps.d.ts +1 -1
- package/FunnelChart/FunnelChart.d.ts +37 -0
- package/FunnelChart/FunnelChart.js +218 -0
- package/FunnelChart/FunnelPlot.d.ts +16 -0
- package/FunnelChart/FunnelPlot.js +191 -0
- package/FunnelChart/FunnelSection.d.ts +15 -0
- package/FunnelChart/FunnelSection.js +62 -0
- package/FunnelChart/categoryAxis.types.d.ts +24 -0
- package/FunnelChart/categoryAxis.types.js +5 -0
- package/FunnelChart/funnel.types.d.ts +124 -0
- package/FunnelChart/funnel.types.js +5 -0
- package/FunnelChart/funnelPlotSlots.types.d.ts +20 -0
- package/FunnelChart/funnelPlotSlots.types.js +5 -0
- package/FunnelChart/funnelSectionClasses.d.ts +13 -0
- package/FunnelChart/funnelSectionClasses.js +28 -0
- package/FunnelChart/funnelSlots.types.d.ts +19 -0
- package/FunnelChart/funnelSlots.types.js +5 -0
- package/FunnelChart/funnelStepCurve.d.ts +4 -0
- package/FunnelChart/funnelStepCurve.js +74 -0
- package/FunnelChart/index.d.ts +7 -0
- package/FunnelChart/index.js +59 -0
- package/FunnelChart/labelUtils.d.ts +42 -0
- package/FunnelChart/labelUtils.js +174 -0
- package/FunnelChart/seriesConfig/extremums.d.ts +3 -0
- package/FunnelChart/seriesConfig/extremums.js +50 -0
- package/FunnelChart/seriesConfig/getColor.d.ts +3 -0
- package/FunnelChart/seriesConfig/getColor.js +10 -0
- package/FunnelChart/seriesConfig/getSeriesWithDefaultValues.d.ts +3 -0
- package/FunnelChart/seriesConfig/getSeriesWithDefaultValues.js +18 -0
- package/FunnelChart/seriesConfig/index.d.ts +2 -0
- package/FunnelChart/seriesConfig/index.js +22 -0
- package/FunnelChart/seriesConfig/legend.d.ts +3 -0
- package/FunnelChart/seriesConfig/legend.js +31 -0
- package/FunnelChart/seriesConfig/seriesProcessor.d.ts +3 -0
- package/FunnelChart/seriesConfig/seriesProcessor.js +96 -0
- package/FunnelChart/seriesConfig/tooltip.d.ts +3 -0
- package/FunnelChart/seriesConfig/tooltip.js +36 -0
- package/FunnelChart/useFunnelChartProps.d.ts +30 -0
- package/FunnelChart/useFunnelChartProps.js +168 -0
- package/Heatmap/seriesConfig/getSeriesWithDefaultValues.d.ts +3 -0
- package/Heatmap/seriesConfig/getSeriesWithDefaultValues.js +15 -0
- package/Heatmap/seriesConfig/index.js +3 -1
- package/LineChartPro/LineChartPro.d.ts +2 -1
- package/esm/BarChartPro/BarChartPro.d.ts +2 -1
- package/esm/ChartContainerPro/useChartContainerProProps.d.ts +1 -1
- package/esm/ChartDataProviderPro/useChartDataProviderProProps.d.ts +1 -1
- package/esm/FunnelChart/FunnelChart.d.ts +37 -0
- package/esm/FunnelChart/FunnelChart.js +212 -0
- package/esm/FunnelChart/FunnelPlot.d.ts +16 -0
- package/esm/FunnelChart/FunnelPlot.js +184 -0
- package/esm/FunnelChart/FunnelSection.d.ts +15 -0
- package/esm/FunnelChart/FunnelSection.js +56 -0
- package/esm/FunnelChart/categoryAxis.types.d.ts +24 -0
- package/esm/FunnelChart/categoryAxis.types.js +1 -0
- package/esm/FunnelChart/funnel.types.d.ts +124 -0
- package/esm/FunnelChart/funnel.types.js +1 -0
- package/esm/FunnelChart/funnelPlotSlots.types.d.ts +20 -0
- package/esm/FunnelChart/funnelPlotSlots.types.js +1 -0
- package/esm/FunnelChart/funnelSectionClasses.d.ts +13 -0
- package/esm/FunnelChart/funnelSectionClasses.js +20 -0
- package/esm/FunnelChart/funnelSlots.types.d.ts +19 -0
- package/esm/FunnelChart/funnelSlots.types.js +1 -0
- package/esm/FunnelChart/funnelStepCurve.d.ts +4 -0
- package/esm/FunnelChart/funnelStepCurve.js +67 -0
- package/esm/FunnelChart/index.d.ts +7 -0
- package/esm/FunnelChart/index.js +5 -0
- package/esm/FunnelChart/labelUtils.d.ts +42 -0
- package/esm/FunnelChart/labelUtils.js +166 -0
- package/esm/FunnelChart/seriesConfig/extremums.d.ts +3 -0
- package/esm/FunnelChart/seriesConfig/extremums.js +42 -0
- package/esm/FunnelChart/seriesConfig/getColor.d.ts +3 -0
- package/esm/FunnelChart/seriesConfig/getColor.js +4 -0
- package/esm/FunnelChart/seriesConfig/getSeriesWithDefaultValues.d.ts +3 -0
- package/esm/FunnelChart/seriesConfig/getSeriesWithDefaultValues.js +11 -0
- package/esm/FunnelChart/seriesConfig/index.d.ts +2 -0
- package/esm/FunnelChart/seriesConfig/index.js +15 -0
- package/esm/FunnelChart/seriesConfig/legend.d.ts +3 -0
- package/esm/FunnelChart/seriesConfig/legend.js +25 -0
- package/esm/FunnelChart/seriesConfig/seriesProcessor.d.ts +3 -0
- package/esm/FunnelChart/seriesConfig/seriesProcessor.js +89 -0
- package/esm/FunnelChart/seriesConfig/tooltip.d.ts +3 -0
- package/esm/FunnelChart/seriesConfig/tooltip.js +29 -0
- package/esm/FunnelChart/useFunnelChartProps.d.ts +30 -0
- package/esm/FunnelChart/useFunnelChartProps.js +161 -0
- package/esm/Heatmap/seriesConfig/getSeriesWithDefaultValues.d.ts +3 -0
- package/esm/Heatmap/seriesConfig/getSeriesWithDefaultValues.js +8 -0
- package/esm/Heatmap/seriesConfig/index.js +3 -1
- package/esm/LineChartPro/LineChartPro.d.ts +2 -1
- package/esm/hooks/useFunnelSeries.d.ts +33 -0
- package/esm/hooks/useFunnelSeries.js +42 -0
- package/esm/index.d.ts +3 -1
- package/esm/index.js +4 -2
- package/esm/internals/plugins/allPlugins.d.ts +3 -3
- package/esm/internals/plugins/allPlugins.js +2 -2
- package/esm/internals/utils/releaseInfo.js +1 -1
- package/esm/typeOverloads/modules.d.ts +13 -2
- package/hooks/useFunnelSeries.d.ts +33 -0
- package/hooks/useFunnelSeries.js +48 -0
- package/index.d.ts +3 -1
- package/index.js +23 -1
- package/internals/plugins/allPlugins.d.ts +3 -3
- package/internals/plugins/allPlugins.js +1 -1
- package/internals/utils/releaseInfo.js +1 -1
- package/modern/BarChartPro/BarChartPro.d.ts +2 -1
- package/modern/ChartContainerPro/useChartContainerProProps.d.ts +1 -1
- package/modern/ChartDataProviderPro/useChartDataProviderProProps.d.ts +1 -1
- package/modern/FunnelChart/FunnelChart.d.ts +37 -0
- package/modern/FunnelChart/FunnelChart.js +212 -0
- package/modern/FunnelChart/FunnelPlot.d.ts +16 -0
- package/modern/FunnelChart/FunnelPlot.js +184 -0
- package/modern/FunnelChart/FunnelSection.d.ts +15 -0
- package/modern/FunnelChart/FunnelSection.js +56 -0
- package/modern/FunnelChart/categoryAxis.types.d.ts +24 -0
- package/modern/FunnelChart/categoryAxis.types.js +1 -0
- package/modern/FunnelChart/funnel.types.d.ts +124 -0
- package/modern/FunnelChart/funnel.types.js +1 -0
- package/modern/FunnelChart/funnelPlotSlots.types.d.ts +20 -0
- package/modern/FunnelChart/funnelPlotSlots.types.js +1 -0
- package/modern/FunnelChart/funnelSectionClasses.d.ts +13 -0
- package/modern/FunnelChart/funnelSectionClasses.js +20 -0
- package/modern/FunnelChart/funnelSlots.types.d.ts +19 -0
- package/modern/FunnelChart/funnelSlots.types.js +1 -0
- package/modern/FunnelChart/funnelStepCurve.d.ts +4 -0
- package/modern/FunnelChart/funnelStepCurve.js +67 -0
- package/modern/FunnelChart/index.d.ts +7 -0
- package/modern/FunnelChart/index.js +5 -0
- package/modern/FunnelChart/labelUtils.d.ts +42 -0
- package/modern/FunnelChart/labelUtils.js +166 -0
- package/modern/FunnelChart/seriesConfig/extremums.d.ts +3 -0
- package/modern/FunnelChart/seriesConfig/extremums.js +42 -0
- package/modern/FunnelChart/seriesConfig/getColor.d.ts +3 -0
- package/modern/FunnelChart/seriesConfig/getColor.js +4 -0
- package/modern/FunnelChart/seriesConfig/getSeriesWithDefaultValues.d.ts +3 -0
- package/modern/FunnelChart/seriesConfig/getSeriesWithDefaultValues.js +11 -0
- package/modern/FunnelChart/seriesConfig/index.d.ts +2 -0
- package/modern/FunnelChart/seriesConfig/index.js +15 -0
- package/modern/FunnelChart/seriesConfig/legend.d.ts +3 -0
- package/modern/FunnelChart/seriesConfig/legend.js +25 -0
- package/modern/FunnelChart/seriesConfig/seriesProcessor.d.ts +3 -0
- package/modern/FunnelChart/seriesConfig/seriesProcessor.js +89 -0
- package/modern/FunnelChart/seriesConfig/tooltip.d.ts +3 -0
- package/modern/FunnelChart/seriesConfig/tooltip.js +29 -0
- package/modern/FunnelChart/useFunnelChartProps.d.ts +30 -0
- package/modern/FunnelChart/useFunnelChartProps.js +161 -0
- package/modern/Heatmap/seriesConfig/getSeriesWithDefaultValues.d.ts +3 -0
- package/modern/Heatmap/seriesConfig/getSeriesWithDefaultValues.js +8 -0
- package/modern/Heatmap/seriesConfig/index.js +3 -1
- package/modern/LineChartPro/LineChartPro.d.ts +2 -1
- package/modern/hooks/useFunnelSeries.d.ts +33 -0
- package/modern/hooks/useFunnelSeries.js +42 -0
- package/modern/index.d.ts +3 -1
- package/modern/index.js +4 -2
- package/modern/internals/plugins/allPlugins.d.ts +3 -3
- package/modern/internals/plugins/allPlugins.js +2 -2
- package/modern/internals/utils/releaseInfo.js +1 -1
- package/modern/typeOverloads/modules.d.ts +13 -2
- package/package.json +4 -4
- package/tsconfig.build.tsbuildinfo +1 -1
- package/typeOverloads/modules.d.ts +13 -2
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
5
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
6
|
+
Object.defineProperty(exports, "__esModule", {
|
|
7
|
+
value: true
|
|
8
|
+
});
|
|
9
|
+
exports.FunnelSectionPath = exports.FunnelSection = void 0;
|
|
10
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
|
+
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
12
|
+
var React = _interopRequireWildcard(require("react"));
|
|
13
|
+
var _styles = require("@mui/material/styles");
|
|
14
|
+
var _internals = require("@mui/x-charts/internals");
|
|
15
|
+
var _hooks = require("@mui/x-charts/hooks");
|
|
16
|
+
var _clsx = _interopRequireDefault(require("clsx"));
|
|
17
|
+
var _funnelSectionClasses = require("./funnelSectionClasses");
|
|
18
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
19
|
+
const _excluded = ["seriesId", "dataIndex", "classes", "color", "onClick", "className"];
|
|
20
|
+
const FunnelSectionPath = exports.FunnelSectionPath = (0, _styles.styled)('path')(() => ({
|
|
21
|
+
transition: 'opacity 0.2s ease-in, fill 0.2s ease-in'
|
|
22
|
+
}));
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* @ignore - internal component.
|
|
26
|
+
*/
|
|
27
|
+
const FunnelSection = exports.FunnelSection = (0, _internals.consumeSlots)('MuiFunnelSection', 'funnelSection', {
|
|
28
|
+
classesResolver: _funnelSectionClasses.useUtilityClasses
|
|
29
|
+
}, function FunnelSection(props, ref) {
|
|
30
|
+
const {
|
|
31
|
+
seriesId,
|
|
32
|
+
dataIndex,
|
|
33
|
+
classes,
|
|
34
|
+
color,
|
|
35
|
+
onClick,
|
|
36
|
+
className
|
|
37
|
+
} = props,
|
|
38
|
+
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
39
|
+
const getInteractionItemProps = (0, _internals.useInteractionItemProps)();
|
|
40
|
+
const {
|
|
41
|
+
isFaded,
|
|
42
|
+
isHighlighted
|
|
43
|
+
} = (0, _hooks.useItemHighlighted)({
|
|
44
|
+
seriesId,
|
|
45
|
+
dataIndex
|
|
46
|
+
});
|
|
47
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(FunnelSectionPath, (0, _extends2.default)({}, getInteractionItemProps({
|
|
48
|
+
type: 'funnel',
|
|
49
|
+
seriesId,
|
|
50
|
+
dataIndex
|
|
51
|
+
}), {
|
|
52
|
+
filter: isHighlighted ? 'brightness(120%)' : undefined,
|
|
53
|
+
opacity: isFaded ? 0.3 : 1,
|
|
54
|
+
fill: color,
|
|
55
|
+
stroke: "none",
|
|
56
|
+
cursor: onClick ? 'pointer' : 'unset',
|
|
57
|
+
onClick: onClick,
|
|
58
|
+
className: (0, _clsx.default)(classes?.root, className, isHighlighted && classes?.highlighted, isFaded && classes?.faded)
|
|
59
|
+
}, other, {
|
|
60
|
+
ref: ref
|
|
61
|
+
}));
|
|
62
|
+
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { AxisConfig, ScaleName } from '@mui/x-charts/models';
|
|
2
|
+
import { MakeOptional } from '@mui/x-internals/types';
|
|
3
|
+
export type CategoryAxis = {
|
|
4
|
+
/**
|
|
5
|
+
* The categories to be displayed on the axis.
|
|
6
|
+
* The order of the categories is the order in which they are displayed.
|
|
7
|
+
*/
|
|
8
|
+
categories?: string[];
|
|
9
|
+
/**
|
|
10
|
+
* The position of the axis.
|
|
11
|
+
* - 'left' - The axis is positioned on the left side of the chart.
|
|
12
|
+
* - 'right' - The axis is positioned on the right side of the chart.
|
|
13
|
+
* - 'top' - The axis is positioned on the top side of the chart.
|
|
14
|
+
* - 'bottom' - The axis is positioned on the bottom side of the chart.
|
|
15
|
+
* - 'none' - The axis is not displayed.
|
|
16
|
+
*/
|
|
17
|
+
position?: 'left' | 'right' | 'top' | 'bottom' | 'none';
|
|
18
|
+
/**
|
|
19
|
+
* The size of the axis.
|
|
20
|
+
* - If the axis is horizontal, the size is the height of the axis.
|
|
21
|
+
* - If the axis is vertical, the size is the width of the axis.
|
|
22
|
+
*/
|
|
23
|
+
size?: number;
|
|
24
|
+
} & MakeOptional<Pick<AxisConfig<ScaleName, any>, 'disableLine' | 'disableTicks' | 'scaleType' | 'tickLabelStyle' | 'tickSize' | 'id'>, 'id'>;
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { ChartsLabelMarkProps } from '@mui/x-charts/ChartsLabel';
|
|
2
|
+
import { CommonSeriesType, CartesianSeriesType, CommonDefaultizedProps, SeriesId } from '@mui/x-charts/internals';
|
|
3
|
+
import { CurveType, Position } from '@mui/x-charts/models';
|
|
4
|
+
import { DefaultizedProps, MakeRequired } from '@mui/x-internals/types';
|
|
5
|
+
export type FunnelItemId = string | number;
|
|
6
|
+
export type FunnelCurveType = Extract<CurveType, 'linear' | 'step'> | 'bump';
|
|
7
|
+
export type FunnelValueType = {
|
|
8
|
+
/**
|
|
9
|
+
* A unique identifier of the funnel section.
|
|
10
|
+
*/
|
|
11
|
+
id?: FunnelItemId;
|
|
12
|
+
/**
|
|
13
|
+
* The value of the funnel section.
|
|
14
|
+
*/
|
|
15
|
+
value: number;
|
|
16
|
+
/**
|
|
17
|
+
* The label to display on the tooltip, funnel section, or the legend. It can be a string or a function.
|
|
18
|
+
*/
|
|
19
|
+
label?: string | ((location: 'tooltip' | 'legend' | 'section') => string);
|
|
20
|
+
/**
|
|
21
|
+
* The color of the funnel section
|
|
22
|
+
*/
|
|
23
|
+
color?: string;
|
|
24
|
+
/**
|
|
25
|
+
* Defines the mark type for the funnel item.
|
|
26
|
+
* @default 'square'
|
|
27
|
+
*/
|
|
28
|
+
labelMarkType?: ChartsLabelMarkProps['type'];
|
|
29
|
+
};
|
|
30
|
+
export interface FunnelSeriesType extends Omit<CommonSeriesType<FunnelValueType>, 'color'>, CartesianSeriesType {
|
|
31
|
+
type: 'funnel';
|
|
32
|
+
/**
|
|
33
|
+
* Data associated to the funnel section.
|
|
34
|
+
*/
|
|
35
|
+
data: Readonly<FunnelValueType[]>;
|
|
36
|
+
/**
|
|
37
|
+
* The label to display on the tooltip or the legend. It can be a string or a function.
|
|
38
|
+
*/
|
|
39
|
+
label?: string | ((location: 'tooltip' | 'legend') => string);
|
|
40
|
+
/**
|
|
41
|
+
* Layout of the funnel.
|
|
42
|
+
* @default 'vertical'
|
|
43
|
+
*/
|
|
44
|
+
layout?: 'horizontal' | 'vertical';
|
|
45
|
+
/**
|
|
46
|
+
* The type of curve to use for the line. Read more about curves at
|
|
47
|
+
* [line interpolation](https://mui.com/x/react-charts/lines/#interpolation).
|
|
48
|
+
* @default 'linear'
|
|
49
|
+
*/
|
|
50
|
+
curve?: FunnelCurveType;
|
|
51
|
+
/**
|
|
52
|
+
* The label configuration for the funnel plot.
|
|
53
|
+
* Allows to customize the position and margin of the label that is displayed on the funnel sections.
|
|
54
|
+
*
|
|
55
|
+
* If set to `false`, the label will not be displayed.
|
|
56
|
+
* @default { vertical: 'middle', horizontal: 'center' }
|
|
57
|
+
*/
|
|
58
|
+
sectionLabel?: FunnelLabelOptions | ((item: FunnelItem) => FunnelLabelOptions | false) | false;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* An object that allows to identify a funnel item.
|
|
62
|
+
* Used for item interaction
|
|
63
|
+
*/
|
|
64
|
+
export type FunnelItemIdentifier = {
|
|
65
|
+
type: 'funnel';
|
|
66
|
+
/**
|
|
67
|
+
* The series id of the funnel.
|
|
68
|
+
*/
|
|
69
|
+
seriesId: SeriesId;
|
|
70
|
+
/**
|
|
71
|
+
* The index of the data point in the series.
|
|
72
|
+
*/
|
|
73
|
+
dataIndex: number;
|
|
74
|
+
};
|
|
75
|
+
export type FunnelItem = {
|
|
76
|
+
/**
|
|
77
|
+
* The series id of the funnel.
|
|
78
|
+
*/
|
|
79
|
+
seriesId: SeriesId;
|
|
80
|
+
/**
|
|
81
|
+
* The index of the data point in the series.
|
|
82
|
+
*/
|
|
83
|
+
dataIndex: number;
|
|
84
|
+
/**
|
|
85
|
+
* The value of the data point.
|
|
86
|
+
*/
|
|
87
|
+
value: number;
|
|
88
|
+
};
|
|
89
|
+
export interface DefaultizedFunnelSeriesType extends DefaultizedProps<FunnelSeriesType, CommonDefaultizedProps | 'layout'> {
|
|
90
|
+
dataPoints: FunnelDataPoints[][];
|
|
91
|
+
data: Readonly<MakeRequired<FunnelValueType, 'id' | 'color'>[]>;
|
|
92
|
+
}
|
|
93
|
+
export type FunnelDataPoints = Record<'x' | 'y', number> & {
|
|
94
|
+
useBandWidth: boolean;
|
|
95
|
+
stackOffset: number;
|
|
96
|
+
};
|
|
97
|
+
export type FunnelLabelOptions = {
|
|
98
|
+
/**
|
|
99
|
+
* The position of the label.
|
|
100
|
+
* @default { vertical: 'middle', horizontal: 'center' }
|
|
101
|
+
*/
|
|
102
|
+
position?: Position;
|
|
103
|
+
/**
|
|
104
|
+
* The text anchor of the label. Affects the horizontal alignment of the text.
|
|
105
|
+
*
|
|
106
|
+
* Default value depends on the position.
|
|
107
|
+
*/
|
|
108
|
+
textAnchor?: 'start' | 'middle' | 'end';
|
|
109
|
+
/**
|
|
110
|
+
* The dominant baseline of the label. Affects the vertical alignment of the text.
|
|
111
|
+
*
|
|
112
|
+
* Default value depends on the position.
|
|
113
|
+
*/
|
|
114
|
+
dominantBaseline?: 'auto' | 'baseline' | 'hanging' | 'middle' | 'central' | 'text-after-edge' | 'text-before-edge';
|
|
115
|
+
/**
|
|
116
|
+
* The offset of the label from the anchor point.
|
|
117
|
+
* If a single number is provided, the offset will be applied in both directions.
|
|
118
|
+
* @default 0
|
|
119
|
+
*/
|
|
120
|
+
offset?: number | {
|
|
121
|
+
x?: number;
|
|
122
|
+
y?: number;
|
|
123
|
+
};
|
|
124
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { FunnelSectionProps } from './FunnelSection';
|
|
3
|
+
export interface FunnelPlotSlots {
|
|
4
|
+
funnelSection?: React.ElementType<FunnelSectionProps>;
|
|
5
|
+
}
|
|
6
|
+
export interface FunnelPlotSlotProps {
|
|
7
|
+
funnelSection?: FunnelSectionProps;
|
|
8
|
+
}
|
|
9
|
+
export interface FunnelPlotSlotExtension {
|
|
10
|
+
/**
|
|
11
|
+
* Overridable component slots.
|
|
12
|
+
* @default {}
|
|
13
|
+
*/
|
|
14
|
+
slots?: FunnelPlotSlots;
|
|
15
|
+
/**
|
|
16
|
+
* The props used for each component slot.
|
|
17
|
+
* @default {}
|
|
18
|
+
*/
|
|
19
|
+
slotProps?: FunnelPlotSlotProps;
|
|
20
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { FunnelSectionProps } from './FunnelSection';
|
|
2
|
+
export interface FunnelSectionClasses {
|
|
3
|
+
/** Styles applied to the root element. */
|
|
4
|
+
root: string;
|
|
5
|
+
/** Styles applied to the root element if `highlighted={true}`. */
|
|
6
|
+
highlighted: string;
|
|
7
|
+
/** Styles applied to the root element if `faded={true}`. */
|
|
8
|
+
faded: string;
|
|
9
|
+
/** Styles applied to the label element. */
|
|
10
|
+
label: string;
|
|
11
|
+
}
|
|
12
|
+
export declare const useUtilityClasses: (props: FunnelSectionProps) => Record<"label" | "highlighted" | "faded" | "root", string>;
|
|
13
|
+
export declare const funnelSectionClasses: FunnelSectionClasses;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.useUtilityClasses = exports.funnelSectionClasses = void 0;
|
|
8
|
+
var _generateUtilityClass = _interopRequireDefault(require("@mui/utils/generateUtilityClass"));
|
|
9
|
+
var _generateUtilityClasses = _interopRequireDefault(require("@mui/utils/generateUtilityClasses"));
|
|
10
|
+
var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"));
|
|
11
|
+
function getFunnelSectionUtilityClass(slot) {
|
|
12
|
+
return (0, _generateUtilityClass.default)('MuiFunnelSection', slot);
|
|
13
|
+
}
|
|
14
|
+
const useUtilityClasses = props => {
|
|
15
|
+
const {
|
|
16
|
+
classes,
|
|
17
|
+
seriesId
|
|
18
|
+
} = props;
|
|
19
|
+
const slots = {
|
|
20
|
+
root: ['root', `series-${seriesId}`],
|
|
21
|
+
highlighted: ['highlighted'],
|
|
22
|
+
faded: ['faded'],
|
|
23
|
+
label: ['label']
|
|
24
|
+
};
|
|
25
|
+
return (0, _composeClasses.default)(slots, getFunnelSectionUtilityClass, classes);
|
|
26
|
+
};
|
|
27
|
+
exports.useUtilityClasses = useUtilityClasses;
|
|
28
|
+
const funnelSectionClasses = exports.funnelSectionClasses = (0, _generateUtilityClasses.default)('MuiFunnelSection', ['root', 'highlighted', 'faded', 'label']);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ChartsOverlaySlotProps, ChartsOverlaySlots } from '@mui/x-charts/ChartsOverlay';
|
|
2
|
+
import { ChartsTooltipSlotProps, ChartsTooltipSlots } from '@mui/x-charts/ChartsTooltip';
|
|
3
|
+
import { ChartsAxisSlotProps, ChartsAxisSlots } from '@mui/x-charts/internals';
|
|
4
|
+
import { ChartsLegendSlotProps, ChartsLegendSlots } from '@mui/x-charts/ChartsLegend';
|
|
5
|
+
import { FunnelPlotSlotProps, FunnelPlotSlots } from "./funnelPlotSlots.types.js";
|
|
6
|
+
export interface FunnelChartSlots extends ChartsAxisSlots, FunnelPlotSlots, ChartsLegendSlots, ChartsTooltipSlots, ChartsOverlaySlots, ChartsAxisSlots {}
|
|
7
|
+
export interface FunnelChartSlotProps extends ChartsAxisSlotProps, FunnelPlotSlotProps, ChartsLegendSlotProps, ChartsTooltipSlotProps, ChartsOverlaySlotProps, ChartsAxisSlotProps {}
|
|
8
|
+
export interface FunnelChartSlotExtension {
|
|
9
|
+
/**
|
|
10
|
+
* Overridable component slots.
|
|
11
|
+
* @default {}
|
|
12
|
+
*/
|
|
13
|
+
slots?: FunnelChartSlots;
|
|
14
|
+
/**
|
|
15
|
+
* The props used for each component slot.
|
|
16
|
+
* @default {}
|
|
17
|
+
*/
|
|
18
|
+
slotProps?: FunnelChartSlotProps;
|
|
19
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.funnelVerticalStepCurve = exports.funnelHorizontalStepCurve = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* This is a custom "step" curve generator for the funnel chart.
|
|
9
|
+
* It is used to draw the funnel using "rectangles" without having to rework the rendering logic.
|
|
10
|
+
*
|
|
11
|
+
* It is based on the d3-shape step curve generator.
|
|
12
|
+
* https://github.com/d3/d3-shape/blob/a82254af78f08799c71d7ab25df557c4872a3c51/src/curve/step.js
|
|
13
|
+
*/
|
|
14
|
+
class FunnelStep {
|
|
15
|
+
constructor(context, isHorizontal) {
|
|
16
|
+
this.context = void 0;
|
|
17
|
+
this.line = NaN;
|
|
18
|
+
this.x = NaN;
|
|
19
|
+
this.y = NaN;
|
|
20
|
+
this.currentPoint = 0;
|
|
21
|
+
this.isHorizontal = false;
|
|
22
|
+
this.context = context;
|
|
23
|
+
this.isHorizontal = isHorizontal;
|
|
24
|
+
}
|
|
25
|
+
areaStart() {
|
|
26
|
+
this.line = 0;
|
|
27
|
+
}
|
|
28
|
+
areaEnd() {
|
|
29
|
+
this.line = NaN;
|
|
30
|
+
}
|
|
31
|
+
lineStart() {
|
|
32
|
+
this.x = NaN;
|
|
33
|
+
this.y = NaN;
|
|
34
|
+
this.currentPoint = 0;
|
|
35
|
+
}
|
|
36
|
+
lineEnd() {
|
|
37
|
+
if (this.currentPoint === 2) {
|
|
38
|
+
this.context.lineTo(this.x, this.y);
|
|
39
|
+
}
|
|
40
|
+
if (this.line || this.line !== 0 && this.currentPoint === 1) {
|
|
41
|
+
this.context.closePath();
|
|
42
|
+
}
|
|
43
|
+
if (this.line >= 0) {
|
|
44
|
+
this.line = 1 - this.line;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
point(x, y) {
|
|
48
|
+
x = +x;
|
|
49
|
+
y = +y;
|
|
50
|
+
if (this.currentPoint === 0) {
|
|
51
|
+
this.context.moveTo(x, y);
|
|
52
|
+
} else if (this.isHorizontal && (this.currentPoint === 2 || this.currentPoint === 1)) {
|
|
53
|
+
this.context.lineTo(x, this.y);
|
|
54
|
+
this.context.lineTo(x, y);
|
|
55
|
+
} else if (this.currentPoint === 3 && !this.isHorizontal) {
|
|
56
|
+
this.context.lineTo(x, this.y);
|
|
57
|
+
this.context.lineTo(x, y);
|
|
58
|
+
} else {
|
|
59
|
+
this.context.lineTo(this.x, y);
|
|
60
|
+
this.context.lineTo(x, y);
|
|
61
|
+
}
|
|
62
|
+
this.currentPoint += 1;
|
|
63
|
+
this.x = x;
|
|
64
|
+
this.y = y;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
const funnelHorizontalStepCurve = context => {
|
|
68
|
+
return new FunnelStep(context, true);
|
|
69
|
+
};
|
|
70
|
+
exports.funnelHorizontalStepCurve = funnelHorizontalStepCurve;
|
|
71
|
+
const funnelVerticalStepCurve = context => {
|
|
72
|
+
return new FunnelStep(context, false);
|
|
73
|
+
};
|
|
74
|
+
exports.funnelVerticalStepCurve = funnelVerticalStepCurve;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { FunnelChart as Unstable_FunnelChart } from "./FunnelChart.js";
|
|
2
|
+
export type { FunnelChartProps } from './FunnelChart';
|
|
3
|
+
export * from "./FunnelPlot.js";
|
|
4
|
+
export * from "./funnel.types.js";
|
|
5
|
+
export * from "./funnelSlots.types.js";
|
|
6
|
+
export { funnelSectionClasses } from "./funnelSectionClasses.js";
|
|
7
|
+
export type { FunnelSectionClasses } from './funnelSectionClasses';
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _exportNames = {
|
|
7
|
+
Unstable_FunnelChart: true,
|
|
8
|
+
funnelSectionClasses: true
|
|
9
|
+
};
|
|
10
|
+
Object.defineProperty(exports, "Unstable_FunnelChart", {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _FunnelChart.FunnelChart;
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
Object.defineProperty(exports, "funnelSectionClasses", {
|
|
17
|
+
enumerable: true,
|
|
18
|
+
get: function () {
|
|
19
|
+
return _funnelSectionClasses.funnelSectionClasses;
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
var _FunnelChart = require("./FunnelChart");
|
|
23
|
+
var _FunnelPlot = require("./FunnelPlot");
|
|
24
|
+
Object.keys(_FunnelPlot).forEach(function (key) {
|
|
25
|
+
if (key === "default" || key === "__esModule") return;
|
|
26
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
27
|
+
if (key in exports && exports[key] === _FunnelPlot[key]) return;
|
|
28
|
+
Object.defineProperty(exports, key, {
|
|
29
|
+
enumerable: true,
|
|
30
|
+
get: function () {
|
|
31
|
+
return _FunnelPlot[key];
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
var _funnel = require("./funnel.types");
|
|
36
|
+
Object.keys(_funnel).forEach(function (key) {
|
|
37
|
+
if (key === "default" || key === "__esModule") return;
|
|
38
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
39
|
+
if (key in exports && exports[key] === _funnel[key]) return;
|
|
40
|
+
Object.defineProperty(exports, key, {
|
|
41
|
+
enumerable: true,
|
|
42
|
+
get: function () {
|
|
43
|
+
return _funnel[key];
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
var _funnelSlots = require("./funnelSlots.types");
|
|
48
|
+
Object.keys(_funnelSlots).forEach(function (key) {
|
|
49
|
+
if (key === "default" || key === "__esModule") return;
|
|
50
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
51
|
+
if (key in exports && exports[key] === _funnelSlots[key]) return;
|
|
52
|
+
Object.defineProperty(exports, key, {
|
|
53
|
+
enumerable: true,
|
|
54
|
+
get: function () {
|
|
55
|
+
return _funnelSlots[key];
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
var _funnelSectionClasses = require("./funnelSectionClasses");
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { FunnelDataPoints, FunnelLabelOptions } from "./funnel.types.js";
|
|
2
|
+
/**
|
|
3
|
+
* It tries to keep the label inside the bounds of the section based on the position.
|
|
4
|
+
*
|
|
5
|
+
* @returns The text anchor and dominant baseline of the label.
|
|
6
|
+
*/
|
|
7
|
+
export declare const alignLabel: ({
|
|
8
|
+
position,
|
|
9
|
+
textAnchor,
|
|
10
|
+
dominantBaseline
|
|
11
|
+
}: Omit<FunnelLabelOptions, "margin">) => {
|
|
12
|
+
textAnchor: string;
|
|
13
|
+
dominantBaseline: string;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* This function calculates the position of the label based on the position and margin.
|
|
17
|
+
*
|
|
18
|
+
* It is quite complex, because it needs to calculate the position based on the position of the points of a rectangle.
|
|
19
|
+
* And we are manually calculating each possible position of the label.
|
|
20
|
+
*
|
|
21
|
+
* @returns The x and y position of the label.
|
|
22
|
+
*/
|
|
23
|
+
export declare const positionLabel: ({
|
|
24
|
+
position,
|
|
25
|
+
offset,
|
|
26
|
+
xPosition,
|
|
27
|
+
yPosition,
|
|
28
|
+
isHorizontal,
|
|
29
|
+
values,
|
|
30
|
+
dataIndex,
|
|
31
|
+
baseScaleData
|
|
32
|
+
}: Omit<FunnelLabelOptions, "textAnchor" | "dominantBaseline"> & {
|
|
33
|
+
xPosition: (value: number, bandIndex: number, stackOffset?: number, useBand?: boolean) => number | undefined;
|
|
34
|
+
yPosition: (value: number, bandIndex: number, stackOffset?: number, useBand?: boolean) => number | undefined;
|
|
35
|
+
isHorizontal: boolean;
|
|
36
|
+
values: readonly FunnelDataPoints[];
|
|
37
|
+
dataIndex: number;
|
|
38
|
+
baseScaleData: readonly number[];
|
|
39
|
+
}) => {
|
|
40
|
+
x: number;
|
|
41
|
+
y: number;
|
|
42
|
+
};
|