@mui/x-charts 8.0.0-alpha.5 → 8.0.0-alpha.7
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/BarChart/AnimatedBarElement.js +1 -0
- package/BarChart/BarChart.js +17 -7
- package/BarChart/BarLabel/BarLabel.d.ts +1 -479
- package/BarChart/BarLabel/barLabelClasses.d.ts +1 -1
- package/BarChart/legend.js +1 -0
- package/BarChart/useBarChartProps.d.ts +4 -2
- package/BarChart/useBarChartProps.js +16 -3
- package/CHANGELOG.md +206 -1
- package/ChartsLabel/ChartsLabel.d.ts +2 -3
- package/ChartsLabel/ChartsLabel.js +3 -18
- package/ChartsLabel/ChartsLabelGradient.d.ts +9 -8
- package/ChartsLabel/ChartsLabelGradient.js +21 -18
- package/ChartsLabel/ChartsLabelMark.d.ts +2 -3
- package/ChartsLabel/ChartsLabelMark.js +5 -2
- package/ChartsLabel/index.d.ts +7 -0
- package/ChartsLabel/index.js +6 -0
- package/ChartsLabel/labelClasses.d.ts +0 -1
- package/ChartsLabel/labelGradientClasses.d.ts +5 -4
- package/ChartsLabel/labelGradientClasses.js +3 -2
- package/ChartsLabel/labelMarkClasses.d.ts +3 -2
- package/ChartsLabel/labelMarkClasses.js +3 -2
- package/ChartsLabel/package.json +6 -0
- package/ChartsLegend/ChartsLegend.d.ts +18 -22
- package/ChartsLegend/ChartsLegend.js +100 -109
- package/ChartsLegend/ContinuousColorLegend.d.ts +29 -38
- package/ChartsLegend/ContinuousColorLegend.js +198 -321
- package/ChartsLegend/PiecewiseColorLegend.d.ts +27 -19
- package/ChartsLegend/PiecewiseColorLegend.js +201 -111
- package/ChartsLegend/chartsLegend.types.d.ts +17 -60
- package/ChartsLegend/chartsLegendClasses.d.ts +7 -8
- package/ChartsLegend/chartsLegendClasses.js +16 -2
- package/ChartsLegend/colorLegend.types.d.ts +13 -0
- package/ChartsLegend/colorLegend.types.js +1 -0
- package/ChartsLegend/continuousColorLegendClasses.d.ts +26 -0
- package/ChartsLegend/continuousColorLegendClasses.js +23 -0
- package/ChartsLegend/direction.d.ts +1 -0
- package/ChartsLegend/direction.js +1 -0
- package/ChartsLegend/index.d.ts +13 -3
- package/ChartsLegend/index.js +9 -3
- package/ChartsLegend/legend.types.d.ts +10 -54
- package/ChartsLegend/legendContext.types.d.ts +55 -0
- package/ChartsLegend/legendContext.types.js +1 -0
- package/ChartsLegend/onClickContextBuilder.d.ts +2 -0
- package/ChartsLegend/onClickContextBuilder.js +7 -0
- package/ChartsLegend/piecewiseColorDefaultLabelFormatter.d.ts +2 -0
- package/ChartsLegend/piecewiseColorDefaultLabelFormatter.js +9 -0
- package/ChartsLegend/piecewiseColorLegend.types.d.ts +26 -0
- package/ChartsLegend/piecewiseColorLegend.types.js +1 -0
- package/ChartsLegend/piecewiseColorLegendClasses.d.ts +28 -0
- package/ChartsLegend/piecewiseColorLegendClasses.js +23 -0
- package/ChartsLegend/useAxis.d.ts +1 -1
- package/ChartsLegend/useAxis.js +0 -1
- package/ChartsReferenceLine/ChartsXReferenceLine.d.ts +1 -1
- package/ChartsReferenceLine/ChartsYReferenceLine.d.ts +1 -1
- package/ChartsSurface/ChartsSurface.js +0 -1
- package/ChartsTooltip/chartsTooltipClasses.d.ts +1 -1
- package/LineChart/AnimatedArea.js +1 -0
- package/LineChart/AnimatedLine.js +1 -0
- package/LineChart/AppearingMask.js +1 -0
- package/LineChart/CircleMarkElement.js +1 -0
- package/LineChart/LineChart.js +20 -10
- package/LineChart/MarkElement.js +3 -1
- package/LineChart/legend.js +1 -0
- package/LineChart/useLineChartProps.d.ts +4 -2
- package/LineChart/useLineChartProps.js +15 -2
- package/PieChart/PieArc.js +3 -1
- package/PieChart/PieArcLabel.js +13 -9
- package/PieChart/PieArcLabelPlot.js +1 -0
- package/PieChart/PieArcPlot.js +1 -0
- package/PieChart/PieChart.js +42 -41
- package/PieChart/legend.js +1 -0
- package/ScatterChart/ScatterChart.js +21 -11
- package/ScatterChart/legend.js +1 -0
- package/ScatterChart/useScatterChartProps.d.ts +4 -2
- package/ScatterChart/useScatterChartProps.js +15 -2
- package/SparkLineChart/SparkLineChart.js +1 -4
- package/constants/index.d.ts +1 -0
- package/constants/index.js +2 -1
- package/context/CartesianProvider/defaultizeAxis.d.ts +9 -9
- package/context/ChartDataProvider/useChartDataProviderProps.d.ts +18 -18
- package/context/ChartDataProvider/useDefaultizeAxis.d.ts +9 -9
- package/context/ChartProvider/ChartProvider.types.d.ts +1 -1
- package/context/InteractionSelectors.d.ts +11 -11
- package/context/PluginProvider/SeriesFormatter.types.d.ts +1 -1
- package/context/PluginProvider/mergePlugins.d.ts +8 -8
- package/context/SizeProvider/Size.types.d.ts +1 -1
- package/context/SizeProvider/useChartContainerDimensions.d.ts +1 -1
- package/hooks/index.d.ts +1 -0
- package/hooks/index.js +2 -1
- package/hooks/useLegend.d.ts +13 -0
- package/{modern/ChartsLegend/utils.js → hooks/useLegend.js} +20 -1
- package/hooks/useSvgRef.d.ts +1 -1
- package/index.d.ts +1 -0
- package/index.js +2 -1
- package/internals/calculateMargins.d.ts +7 -0
- package/internals/calculateMargins.js +25 -0
- package/internals/components/ChartsAxesGradients/ChartsAxesGradients.d.ts +2 -1
- package/internals/components/ChartsAxesGradients/ChartsAxesGradients.js +60 -16
- package/internals/components/ChartsAxesGradients/ChartsContinuousGradient.js +6 -6
- package/internals/components/ChartsAxesGradients/ChartsContinuousGradientObjectBound.d.ts +13 -0
- package/internals/components/ChartsAxesGradients/ChartsContinuousGradientObjectBound.js +61 -0
- package/internals/components/ChartsAxesGradients/ChartsPiecewiseGradient.js +3 -0
- package/internals/components/ChartsWrapper/ChartsWrapper.d.ts +17 -0
- package/internals/components/ChartsWrapper/ChartsWrapper.js +66 -0
- package/internals/components/ChartsWrapper/index.d.ts +1 -0
- package/internals/components/ChartsWrapper/index.js +1 -0
- package/internals/consumeSlots.d.ts +48 -0
- package/internals/consumeSlots.js +101 -0
- package/internals/consumeThemeProps.d.ts +3 -7
- package/internals/consumeThemeProps.js +18 -27
- package/internals/defaultizeColor.d.ts +6 -1
- package/internals/index.d.ts +1 -0
- package/internals/index.js +1 -0
- package/internals/plugins/corePlugins/useChartId/useChartId.selectors.d.ts +1 -1
- package/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.selectors.d.ts +11 -11
- package/internals/plugins/models/plugin.d.ts +1 -1
- package/internals/store/useCharts.d.ts +2 -2
- package/internals/store/useCharts.types.d.ts +1 -1
- package/models/seriesType/common.d.ts +9 -0
- package/models/seriesType/pie.d.ts +9 -0
- package/modern/BarChart/AnimatedBarElement.js +1 -0
- package/modern/BarChart/BarChart.js +17 -7
- package/modern/BarChart/legend.js +1 -0
- package/modern/BarChart/useBarChartProps.js +16 -3
- package/modern/ChartsLabel/ChartsLabel.js +3 -18
- package/modern/ChartsLabel/ChartsLabelGradient.js +21 -18
- package/modern/ChartsLabel/ChartsLabelMark.js +5 -2
- package/modern/ChartsLabel/index.js +6 -0
- package/modern/ChartsLabel/labelGradientClasses.js +3 -2
- package/modern/ChartsLabel/labelMarkClasses.js +3 -2
- package/modern/ChartsLegend/ChartsLegend.js +100 -109
- package/modern/ChartsLegend/ContinuousColorLegend.js +198 -321
- package/modern/ChartsLegend/PiecewiseColorLegend.js +201 -111
- package/modern/ChartsLegend/chartsLegendClasses.js +16 -2
- package/modern/ChartsLegend/colorLegend.types.js +1 -0
- package/modern/ChartsLegend/continuousColorLegendClasses.js +23 -0
- package/modern/ChartsLegend/direction.js +1 -0
- package/modern/ChartsLegend/index.js +9 -3
- package/modern/ChartsLegend/legendContext.types.js +1 -0
- package/modern/ChartsLegend/onClickContextBuilder.js +7 -0
- package/modern/ChartsLegend/piecewiseColorDefaultLabelFormatter.js +9 -0
- package/modern/ChartsLegend/piecewiseColorLegend.types.js +1 -0
- package/modern/ChartsLegend/piecewiseColorLegendClasses.js +23 -0
- package/modern/ChartsLegend/useAxis.js +0 -1
- package/modern/ChartsSurface/ChartsSurface.js +0 -1
- package/modern/LineChart/AnimatedArea.js +1 -0
- package/modern/LineChart/AnimatedLine.js +1 -0
- package/modern/LineChart/AppearingMask.js +1 -0
- package/modern/LineChart/CircleMarkElement.js +1 -0
- package/modern/LineChart/LineChart.js +20 -10
- package/modern/LineChart/MarkElement.js +3 -1
- package/modern/LineChart/legend.js +1 -0
- package/modern/LineChart/useLineChartProps.js +15 -2
- package/modern/PieChart/PieArc.js +3 -1
- package/modern/PieChart/PieArcLabel.js +13 -9
- package/modern/PieChart/PieArcLabelPlot.js +1 -0
- package/modern/PieChart/PieArcPlot.js +1 -0
- package/modern/PieChart/PieChart.js +42 -41
- package/modern/PieChart/legend.js +1 -0
- package/modern/ScatterChart/ScatterChart.js +21 -11
- package/modern/ScatterChart/legend.js +1 -0
- package/modern/ScatterChart/useScatterChartProps.js +15 -2
- package/modern/SparkLineChart/SparkLineChart.js +1 -4
- package/modern/constants/index.js +2 -1
- package/modern/hooks/index.js +2 -1
- package/{ChartsLegend/utils.js → modern/hooks/useLegend.js} +20 -1
- package/modern/index.js +2 -1
- package/modern/internals/calculateMargins.js +25 -0
- package/modern/internals/components/ChartsAxesGradients/ChartsAxesGradients.js +60 -16
- package/modern/internals/components/ChartsAxesGradients/ChartsContinuousGradient.js +6 -6
- package/modern/internals/components/ChartsAxesGradients/ChartsContinuousGradientObjectBound.js +61 -0
- package/modern/internals/components/ChartsAxesGradients/ChartsPiecewiseGradient.js +3 -0
- package/modern/internals/components/ChartsWrapper/ChartsWrapper.js +66 -0
- package/modern/internals/components/ChartsWrapper/index.js +1 -0
- package/modern/internals/consumeSlots.js +101 -0
- package/modern/internals/consumeThemeProps.js +18 -27
- package/modern/internals/index.js +1 -0
- package/node/BarChart/AnimatedBarElement.js +1 -0
- package/node/BarChart/BarChart.js +17 -7
- package/node/BarChart/legend.js +1 -0
- package/node/BarChart/useBarChartProps.js +15 -3
- package/node/ChartsLabel/ChartsLabel.js +3 -18
- package/node/ChartsLabel/ChartsLabelGradient.js +21 -18
- package/node/ChartsLabel/ChartsLabelMark.js +5 -2
- package/node/ChartsLabel/index.js +26 -0
- package/node/ChartsLabel/labelGradientClasses.js +3 -2
- package/node/ChartsLabel/labelMarkClasses.js +3 -2
- package/node/ChartsLegend/ChartsLegend.js +99 -108
- package/node/ChartsLegend/ContinuousColorLegend.js +199 -322
- package/node/ChartsLegend/PiecewiseColorLegend.js +201 -111
- package/node/ChartsLegend/chartsLegendClasses.js +17 -3
- package/node/ChartsLegend/colorLegend.types.js +5 -0
- package/node/ChartsLegend/continuousColorLegendClasses.js +31 -0
- package/node/ChartsLegend/direction.js +5 -0
- package/node/ChartsLegend/index.js +80 -16
- package/node/ChartsLegend/legendContext.types.js +5 -0
- package/node/ChartsLegend/onClickContextBuilder.js +14 -0
- package/node/ChartsLegend/piecewiseColorDefaultLabelFormatter.js +15 -0
- package/node/ChartsLegend/piecewiseColorLegend.types.js +5 -0
- package/node/ChartsLegend/piecewiseColorLegendClasses.js +31 -0
- package/node/ChartsSurface/ChartsSurface.js +0 -1
- package/node/LineChart/AnimatedArea.js +1 -0
- package/node/LineChart/AnimatedLine.js +1 -0
- package/node/LineChart/AppearingMask.js +1 -0
- package/node/LineChart/CircleMarkElement.js +1 -0
- package/node/LineChart/LineChart.js +20 -10
- package/node/LineChart/MarkElement.js +3 -1
- package/node/LineChart/legend.js +1 -0
- package/node/LineChart/useLineChartProps.js +14 -2
- package/node/PieChart/PieArc.js +3 -1
- package/node/PieChart/PieArcLabel.js +13 -9
- package/node/PieChart/PieArcLabelPlot.js +1 -0
- package/node/PieChart/PieArcPlot.js +1 -0
- package/node/PieChart/PieChart.js +42 -41
- package/node/PieChart/legend.js +1 -0
- package/node/ScatterChart/ScatterChart.js +21 -11
- package/node/ScatterChart/legend.js +1 -0
- package/node/ScatterChart/useScatterChartProps.js +14 -2
- package/node/SparkLineChart/SparkLineChart.js +1 -4
- package/node/constants/index.js +3 -2
- package/node/hooks/index.js +13 -1
- package/node/{ChartsLegend/utils.js → hooks/useLegend.js} +19 -1
- package/node/index.js +12 -1
- package/node/internals/calculateMargins.js +33 -0
- package/node/internals/components/ChartsAxesGradients/ChartsAxesGradients.js +61 -16
- package/node/internals/components/ChartsAxesGradients/ChartsContinuousGradient.js +6 -6
- package/node/internals/components/ChartsAxesGradients/ChartsContinuousGradientObjectBound.js +69 -0
- package/node/internals/components/ChartsAxesGradients/ChartsPiecewiseGradient.js +3 -0
- package/node/internals/components/ChartsWrapper/ChartsWrapper.js +72 -0
- package/node/internals/components/ChartsWrapper/index.js +16 -0
- package/node/internals/consumeSlots.js +109 -0
- package/node/internals/consumeThemeProps.js +18 -27
- package/node/internals/index.js +12 -0
- package/package.json +4 -4
- package/ChartsLegend/ChartsLegendItem.d.ts +0 -26
- package/ChartsLegend/ChartsLegendItem.js +0 -65
- package/ChartsLegend/DefaultChartsLegend.d.ts +0 -25
- package/ChartsLegend/DefaultChartsLegend.js +0 -112
- package/ChartsLegend/LegendPerItem.d.ts +0 -65
- package/ChartsLegend/LegendPerItem.js +0 -129
- package/ChartsLegend/legendItemsPlacement.d.ts +0 -3
- package/ChartsLegend/legendItemsPlacement.js +0 -72
- package/ChartsLegend/utils.d.ts +0 -2
- package/modern/ChartsLegend/ChartsLegendItem.js +0 -65
- package/modern/ChartsLegend/DefaultChartsLegend.js +0 -112
- package/modern/ChartsLegend/LegendPerItem.js +0 -129
- package/modern/ChartsLegend/legendItemsPlacement.js +0 -72
- package/node/ChartsLegend/ChartsLegendItem.js +0 -72
- package/node/ChartsLegend/DefaultChartsLegend.js +0 -118
- package/node/ChartsLegend/LegendPerItem.js +0 -137
- package/node/ChartsLegend/legendItemsPlacement.js +0 -79
|
@@ -6,42 +6,132 @@ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWild
|
|
|
6
6
|
Object.defineProperty(exports, "__esModule", {
|
|
7
7
|
value: true
|
|
8
8
|
});
|
|
9
|
-
exports.PiecewiseColorLegend =
|
|
10
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
|
+
exports.PiecewiseColorLegend = void 0;
|
|
11
10
|
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
11
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
12
12
|
var React = _interopRequireWildcard(require("react"));
|
|
13
13
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
14
|
+
var _styles = require("@mui/material/styles");
|
|
15
|
+
var _clsx = _interopRequireDefault(require("clsx"));
|
|
16
|
+
var _ChartsLabel = require("../ChartsLabel/ChartsLabel");
|
|
17
|
+
var _ChartsLabelMark = require("../ChartsLabel/ChartsLabelMark");
|
|
18
|
+
var _consumeThemeProps = require("../internals/consumeThemeProps");
|
|
19
|
+
var _piecewiseColorLegendClasses = require("./piecewiseColorLegendClasses");
|
|
14
20
|
var _useAxis = require("./useAxis");
|
|
15
|
-
var
|
|
16
|
-
var _notNull = require("../internals/notNull");
|
|
21
|
+
var _piecewiseColorDefaultLabelFormatter = require("./piecewiseColorDefaultLabelFormatter");
|
|
17
22
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
18
|
-
const _excluded = ["
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
23
|
+
const _excluded = ["direction", "classes", "className", "markType", "labelPosition", "axisDirection", "axisId", "labelFormatter", "onItemClick"];
|
|
24
|
+
const RootElement = (0, _styles.styled)('ul', {
|
|
25
|
+
name: 'MuiPiecewiseColorLegend',
|
|
26
|
+
slot: 'Root',
|
|
27
|
+
overridesResolver: (props, styles) => styles.root
|
|
28
|
+
})(({
|
|
29
|
+
theme,
|
|
30
|
+
ownerState
|
|
31
|
+
}) => {
|
|
32
|
+
return (0, _extends2.default)({}, theme.typography.caption, {
|
|
33
|
+
color: (theme.vars || theme).palette.text.primary,
|
|
34
|
+
lineHeight: '100%',
|
|
35
|
+
display: 'flex',
|
|
36
|
+
flexDirection: ownerState.direction === 'vertical' ? 'column' : 'row',
|
|
37
|
+
flexShrink: 0,
|
|
38
|
+
gap: theme.spacing(0.5),
|
|
39
|
+
listStyleType: 'none',
|
|
40
|
+
paddingInlineStart: 0,
|
|
41
|
+
marginBlock: theme.spacing(1),
|
|
42
|
+
marginInline: theme.spacing(1),
|
|
43
|
+
width: 'max-content',
|
|
44
|
+
[`button.${_piecewiseColorLegendClasses.piecewiseColorLegendClasses.item}`]: {
|
|
45
|
+
// Reset button styles
|
|
46
|
+
background: 'none',
|
|
47
|
+
border: 'none',
|
|
48
|
+
padding: 0,
|
|
49
|
+
cursor: ownerState.onItemClick ? 'pointer' : 'unset',
|
|
50
|
+
fontFamily: 'inherit',
|
|
51
|
+
fontWeight: 'inherit',
|
|
52
|
+
fontSize: 'inherit',
|
|
53
|
+
letterSpacing: 'inherit',
|
|
54
|
+
color: 'inherit'
|
|
55
|
+
},
|
|
56
|
+
[`.${_piecewiseColorLegendClasses.piecewiseColorLegendClasses.item}`]: {
|
|
57
|
+
display: 'flex',
|
|
58
|
+
gap: theme.spacing(0.5)
|
|
59
|
+
},
|
|
60
|
+
[`li :not(.${_piecewiseColorLegendClasses.piecewiseColorLegendClasses.minLabel}, .${_piecewiseColorLegendClasses.piecewiseColorLegendClasses.maxLabel}) .${_piecewiseColorLegendClasses.piecewiseColorLegendClasses?.mark}`]: {
|
|
61
|
+
alignSelf: 'center'
|
|
62
|
+
},
|
|
63
|
+
[`&.${_piecewiseColorLegendClasses.piecewiseColorLegendClasses.start}`]: {
|
|
64
|
+
alignItems: 'end'
|
|
65
|
+
},
|
|
66
|
+
[`&.${_piecewiseColorLegendClasses.piecewiseColorLegendClasses.end}`]: {
|
|
67
|
+
alignItems: 'start'
|
|
68
|
+
},
|
|
69
|
+
[`&.${_piecewiseColorLegendClasses.piecewiseColorLegendClasses.horizontal}`]: {
|
|
70
|
+
alignItems: 'center',
|
|
71
|
+
[`.${_piecewiseColorLegendClasses.piecewiseColorLegendClasses.item}`]: {
|
|
72
|
+
flexDirection: 'column'
|
|
73
|
+
},
|
|
74
|
+
[`&.${_piecewiseColorLegendClasses.piecewiseColorLegendClasses.start}`]: {
|
|
75
|
+
alignItems: 'end'
|
|
76
|
+
},
|
|
77
|
+
[`&.${_piecewiseColorLegendClasses.piecewiseColorLegendClasses.end}`]: {
|
|
78
|
+
alignItems: 'start'
|
|
79
|
+
},
|
|
80
|
+
[`.${_piecewiseColorLegendClasses.piecewiseColorLegendClasses.minLabel}`]: {
|
|
81
|
+
alignItems: 'end'
|
|
82
|
+
},
|
|
83
|
+
[`&.${_piecewiseColorLegendClasses.piecewiseColorLegendClasses.extremes}`]: {
|
|
84
|
+
[`.${_piecewiseColorLegendClasses.piecewiseColorLegendClasses.minLabel}, .${_piecewiseColorLegendClasses.piecewiseColorLegendClasses.maxLabel}`]: {
|
|
85
|
+
alignItems: 'center',
|
|
86
|
+
display: 'flex',
|
|
87
|
+
flexDirection: 'row'
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
[`&.${_piecewiseColorLegendClasses.piecewiseColorLegendClasses.vertical}`]: {
|
|
92
|
+
[`.${_piecewiseColorLegendClasses.piecewiseColorLegendClasses.item}`]: {
|
|
93
|
+
flexDirection: 'row',
|
|
94
|
+
alignItems: 'center'
|
|
95
|
+
},
|
|
96
|
+
[`&.${_piecewiseColorLegendClasses.piecewiseColorLegendClasses.start}`]: {
|
|
97
|
+
alignItems: 'end'
|
|
98
|
+
},
|
|
99
|
+
[`&.${_piecewiseColorLegendClasses.piecewiseColorLegendClasses.end}`]: {
|
|
100
|
+
alignItems: 'start'
|
|
101
|
+
},
|
|
102
|
+
[`&.${_piecewiseColorLegendClasses.piecewiseColorLegendClasses.extremes}`]: {
|
|
103
|
+
alignItems: 'center',
|
|
104
|
+
[`.${_piecewiseColorLegendClasses.piecewiseColorLegendClasses.minLabel}, .${_piecewiseColorLegendClasses.piecewiseColorLegendClasses.maxLabel}`]: {
|
|
105
|
+
alignItems: 'center',
|
|
106
|
+
display: 'flex',
|
|
107
|
+
flexDirection: 'column'
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
});
|
|
34
112
|
});
|
|
35
|
-
|
|
113
|
+
const PiecewiseColorLegend = exports.PiecewiseColorLegend = (0, _consumeThemeProps.consumeThemeProps)('MuiPiecewiseColorLegend', {
|
|
114
|
+
defaultProps: {
|
|
115
|
+
direction: 'horizontal',
|
|
116
|
+
labelPosition: 'extremes',
|
|
117
|
+
labelFormatter: _piecewiseColorDefaultLabelFormatter.piecewiseColorDefaultLabelFormatter
|
|
118
|
+
},
|
|
119
|
+
classesResolver: _piecewiseColorLegendClasses.useUtilityClasses
|
|
120
|
+
}, function PiecewiseColorLegend(props, ref) {
|
|
36
121
|
const {
|
|
122
|
+
direction,
|
|
123
|
+
classes,
|
|
124
|
+
className,
|
|
125
|
+
markType,
|
|
126
|
+
labelPosition,
|
|
37
127
|
axisDirection,
|
|
38
128
|
axisId,
|
|
39
|
-
|
|
40
|
-
hideLast,
|
|
41
|
-
labelFormatter = defaultLabelFormatter,
|
|
129
|
+
labelFormatter,
|
|
42
130
|
onItemClick
|
|
43
131
|
} = props,
|
|
44
132
|
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
133
|
+
const isVertical = direction === 'vertical';
|
|
134
|
+
const isReverse = isVertical;
|
|
45
135
|
const axisItem = (0, _useAxis.useAxis)({
|
|
46
136
|
axisDirection,
|
|
47
137
|
axisId
|
|
@@ -54,42 +144,83 @@ function PiecewiseColorLegend(props) {
|
|
|
54
144
|
location: 'legend'
|
|
55
145
|
}) ?? v.toLocaleString();
|
|
56
146
|
const formattedLabels = colorMap.thresholds.map(valueFormatter);
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
max: colorMap.thresholds[index],
|
|
74
|
-
formattedMax: formattedLabels[index]
|
|
75
|
-
});
|
|
76
|
-
const label = labelFormatter(data);
|
|
77
|
-
if (label === null) {
|
|
78
|
-
return null;
|
|
79
|
-
}
|
|
80
|
-
return {
|
|
81
|
-
id: label,
|
|
147
|
+
const startClass = isReverse ? classes?.maxLabel : classes?.minLabel;
|
|
148
|
+
const endClass = isReverse ? classes?.minLabel : classes?.maxLabel;
|
|
149
|
+
const colors = colorMap.colors.map((color, colorIndex) => ({
|
|
150
|
+
color,
|
|
151
|
+
colorIndex
|
|
152
|
+
}));
|
|
153
|
+
const orderedColors = isReverse ? colors.reverse() : colors;
|
|
154
|
+
const isStart = labelPosition === 'start';
|
|
155
|
+
const isEnd = labelPosition === 'end';
|
|
156
|
+
const isExtremes = labelPosition === 'extremes';
|
|
157
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(RootElement, (0, _extends2.default)({
|
|
158
|
+
className: (0, _clsx.default)(classes?.root, className),
|
|
159
|
+
ref: ref
|
|
160
|
+
}, other, {
|
|
161
|
+
ownerState: props,
|
|
162
|
+
children: orderedColors.map(({
|
|
82
163
|
color,
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
164
|
+
colorIndex
|
|
165
|
+
}, index) => {
|
|
166
|
+
const isFirst = index === 0;
|
|
167
|
+
const isLast = index === colorMap.colors.length - 1;
|
|
168
|
+
const isFirstColor = colorIndex === 0;
|
|
169
|
+
const isLastColor = colorIndex === colorMap.colors.length - 1;
|
|
170
|
+
const data = (0, _extends2.default)({
|
|
171
|
+
index: colorIndex,
|
|
172
|
+
length: formattedLabels.length
|
|
173
|
+
}, isFirstColor ? {
|
|
174
|
+
min: null,
|
|
175
|
+
formattedMin: null
|
|
176
|
+
} : {
|
|
177
|
+
min: colorMap.thresholds[colorIndex - 1],
|
|
178
|
+
formattedMin: formattedLabels[colorIndex - 1]
|
|
179
|
+
}, isLastColor ? {
|
|
180
|
+
max: null,
|
|
181
|
+
formattedMax: null
|
|
182
|
+
} : {
|
|
183
|
+
max: colorMap.thresholds[colorIndex],
|
|
184
|
+
formattedMax: formattedLabels[colorIndex]
|
|
185
|
+
});
|
|
186
|
+
const label = labelFormatter?.(data);
|
|
187
|
+
if (label === null || label === undefined) {
|
|
188
|
+
return null;
|
|
189
|
+
}
|
|
190
|
+
const isTextBefore = isStart || isExtremes && isFirst;
|
|
191
|
+
const isTextAfter = isEnd || isExtremes && isLast;
|
|
192
|
+
const clickObject = {
|
|
193
|
+
type: 'piecewiseColor',
|
|
194
|
+
color,
|
|
195
|
+
label,
|
|
196
|
+
minValue: data.min,
|
|
197
|
+
maxValue: data.max
|
|
198
|
+
};
|
|
199
|
+
const Element = onItemClick ? 'button' : 'div';
|
|
200
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("li", {
|
|
201
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(Element, {
|
|
202
|
+
role: onItemClick ? 'button' : undefined,
|
|
203
|
+
type: onItemClick ? 'button' : undefined,
|
|
204
|
+
onClick:
|
|
205
|
+
// @ts-ignore onClick is only attached to a button
|
|
206
|
+
onItemClick ? event => onItemClick(event, clickObject, index) : undefined,
|
|
207
|
+
className: (0, _clsx.default)(classes?.item, index === 0 && `${startClass}`, index === orderedColors.length - 1 && `${endClass}`),
|
|
208
|
+
children: [isTextBefore && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsLabel.ChartsLabel, {
|
|
209
|
+
className: classes?.label,
|
|
210
|
+
children: label
|
|
211
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsLabelMark.ChartsLabelMark, {
|
|
212
|
+
className: classes?.mark,
|
|
213
|
+
type: markType,
|
|
214
|
+
color: color
|
|
215
|
+
}), isTextAfter && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsLabel.ChartsLabel, {
|
|
216
|
+
className: classes?.label,
|
|
217
|
+
children: label
|
|
218
|
+
})]
|
|
219
|
+
})
|
|
220
|
+
}, colorIndex);
|
|
221
|
+
})
|
|
91
222
|
}));
|
|
92
|
-
}
|
|
223
|
+
});
|
|
93
224
|
process.env.NODE_ENV !== "production" ? PiecewiseColorLegend.propTypes = {
|
|
94
225
|
// ----------------------------- Warning --------------------------------
|
|
95
226
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
@@ -109,75 +240,34 @@ process.env.NODE_ENV !== "production" ? PiecewiseColorLegend.propTypes = {
|
|
|
109
240
|
* Override or extend the styles applied to the component.
|
|
110
241
|
*/
|
|
111
242
|
classes: _propTypes.default.object,
|
|
243
|
+
className: _propTypes.default.string,
|
|
112
244
|
/**
|
|
113
245
|
* The direction of the legend layout.
|
|
114
|
-
*
|
|
115
|
-
*/
|
|
116
|
-
direction: _propTypes.default.oneOf(['column', 'row']).isRequired,
|
|
117
|
-
/**
|
|
118
|
-
* Hide the first item of the legend, corresponding to the [-infinity, min] piece.
|
|
119
|
-
* @default false
|
|
246
|
+
* @default 'horizontal'
|
|
120
247
|
*/
|
|
121
|
-
|
|
122
|
-
/**
|
|
123
|
-
* Hide the last item of the legend, corresponding to the [max, +infinity] piece.
|
|
124
|
-
* @default false
|
|
125
|
-
*/
|
|
126
|
-
hideLast: _propTypes.default.bool,
|
|
127
|
-
/**
|
|
128
|
-
* Space between two legend items (in px).
|
|
129
|
-
* @default 10
|
|
130
|
-
*/
|
|
131
|
-
itemGap: _propTypes.default.number,
|
|
132
|
-
/**
|
|
133
|
-
* Height of the item mark (in px).
|
|
134
|
-
* @default 20
|
|
135
|
-
*/
|
|
136
|
-
itemMarkHeight: _propTypes.default.number,
|
|
137
|
-
/**
|
|
138
|
-
* Width of the item mark (in px).
|
|
139
|
-
* @default 20
|
|
140
|
-
*/
|
|
141
|
-
itemMarkWidth: _propTypes.default.number,
|
|
248
|
+
direction: _propTypes.default.oneOf(['horizontal', 'vertical']),
|
|
142
249
|
/**
|
|
143
250
|
* Format the legend labels.
|
|
144
251
|
* @param {PiecewiseLabelFormatterParams} params The bound of the piece to format.
|
|
145
|
-
* @returns {string|null} The displayed label, or `null` to skip
|
|
252
|
+
* @returns {string|null} The displayed label, `''` to skip the label but show the color mark, or `null` to skip it entirely.
|
|
146
253
|
*/
|
|
147
254
|
labelFormatter: _propTypes.default.func,
|
|
148
255
|
/**
|
|
149
|
-
*
|
|
150
|
-
* @default
|
|
256
|
+
* Where to position the labels relative to the gradient.
|
|
257
|
+
* @default 'extremes'
|
|
151
258
|
*/
|
|
152
|
-
|
|
259
|
+
labelPosition: _propTypes.default.oneOf(['start', 'end', 'extremes']),
|
|
153
260
|
/**
|
|
154
|
-
*
|
|
155
|
-
* @default
|
|
261
|
+
* The type of the mark.
|
|
262
|
+
* @default 'square'
|
|
156
263
|
*/
|
|
157
|
-
|
|
264
|
+
markType: _propTypes.default.oneOf(['square', 'circle', 'line']),
|
|
158
265
|
/**
|
|
159
266
|
* Callback fired when a legend item is clicked.
|
|
160
|
-
* @param {React.MouseEvent<
|
|
267
|
+
* @param {React.MouseEvent<HTMLButtonElement, MouseEvent>} event The click event.
|
|
161
268
|
* @param {PiecewiseColorLegendItemContext} legendItem The legend item data.
|
|
162
269
|
* @param {number} index The index of the clicked legend item.
|
|
163
270
|
*/
|
|
164
271
|
onItemClick: _propTypes.default.func,
|
|
165
|
-
|
|
166
|
-
* Legend padding (in px).
|
|
167
|
-
* Can either be a single number, or an object with top, left, bottom, right properties.
|
|
168
|
-
* @default 10
|
|
169
|
-
*/
|
|
170
|
-
padding: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.shape({
|
|
171
|
-
bottom: _propTypes.default.number,
|
|
172
|
-
left: _propTypes.default.number,
|
|
173
|
-
right: _propTypes.default.number,
|
|
174
|
-
top: _propTypes.default.number
|
|
175
|
-
})]),
|
|
176
|
-
/**
|
|
177
|
-
* The position of the legend.
|
|
178
|
-
*/
|
|
179
|
-
position: _propTypes.default.shape({
|
|
180
|
-
horizontal: _propTypes.default.oneOf(['left', 'middle', 'right']).isRequired,
|
|
181
|
-
vertical: _propTypes.default.oneOf(['bottom', 'middle', 'top']).isRequired
|
|
182
|
-
}).isRequired
|
|
272
|
+
sx: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object, _propTypes.default.bool])), _propTypes.default.func, _propTypes.default.object])
|
|
183
273
|
} : void 0;
|
|
@@ -4,11 +4,25 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.
|
|
8
|
-
exports.legendClasses = void 0;
|
|
7
|
+
exports.useUtilityClasses = exports.legendClasses = void 0;
|
|
9
8
|
var _generateUtilityClass = _interopRequireDefault(require("@mui/utils/generateUtilityClass"));
|
|
10
9
|
var _generateUtilityClasses = _interopRequireDefault(require("@mui/utils/generateUtilityClasses"));
|
|
10
|
+
var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"));
|
|
11
11
|
function getLegendUtilityClass(slot) {
|
|
12
12
|
return (0, _generateUtilityClass.default)('MuiChartsLegend', slot);
|
|
13
13
|
}
|
|
14
|
-
const
|
|
14
|
+
const useUtilityClasses = props => {
|
|
15
|
+
const {
|
|
16
|
+
classes,
|
|
17
|
+
direction
|
|
18
|
+
} = props;
|
|
19
|
+
const slots = {
|
|
20
|
+
root: ['root', direction],
|
|
21
|
+
mark: ['mark'],
|
|
22
|
+
label: ['label'],
|
|
23
|
+
series: ['series']
|
|
24
|
+
};
|
|
25
|
+
return (0, _composeClasses.default)(slots, getLegendUtilityClass, classes);
|
|
26
|
+
};
|
|
27
|
+
exports.useUtilityClasses = useUtilityClasses;
|
|
28
|
+
const legendClasses = exports.legendClasses = (0, _generateUtilityClasses.default)('MuiChartsLegend', ['root', 'series', 'mark', 'label', 'vertical', 'horizontal']);
|
|
@@ -0,0 +1,31 @@
|
|
|
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.continuousColorLegendClasses = 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 getLegendUtilityClass(slot) {
|
|
12
|
+
return (0, _generateUtilityClass.default)('MuiContinuousColorLegend', slot);
|
|
13
|
+
}
|
|
14
|
+
const useUtilityClasses = props => {
|
|
15
|
+
const {
|
|
16
|
+
classes,
|
|
17
|
+
direction,
|
|
18
|
+
labelPosition
|
|
19
|
+
} = props;
|
|
20
|
+
const slots = {
|
|
21
|
+
root: ['root', direction, labelPosition],
|
|
22
|
+
minLabel: ['minLabel'],
|
|
23
|
+
maxLabel: ['maxLabel'],
|
|
24
|
+
gradient: ['gradient'],
|
|
25
|
+
mark: ['mark'],
|
|
26
|
+
label: ['label']
|
|
27
|
+
};
|
|
28
|
+
return (0, _composeClasses.default)(slots, getLegendUtilityClass, classes);
|
|
29
|
+
};
|
|
30
|
+
exports.useUtilityClasses = useUtilityClasses;
|
|
31
|
+
const continuousColorLegendClasses = exports.continuousColorLegendClasses = (0, _generateUtilityClasses.default)('MuiContinuousColorLegend', ['root', 'minLabel', 'maxLabel', 'gradient', 'vertical', 'horizontal', 'start', 'end', 'extremes', 'label']);
|
|
@@ -3,9 +3,40 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
var _exportNames = {
|
|
7
|
+
legendClasses: true,
|
|
8
|
+
continuousColorLegendClasses: true,
|
|
9
|
+
piecewiseColorLegendClasses: true,
|
|
10
|
+
piecewiseColorDefaultLabelFormatter: true
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "continuousColorLegendClasses", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _continuousColorLegendClasses.continuousColorLegendClasses;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(exports, "legendClasses", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () {
|
|
21
|
+
return _chartsLegendClasses.legendClasses;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
Object.defineProperty(exports, "piecewiseColorDefaultLabelFormatter", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function () {
|
|
27
|
+
return _piecewiseColorDefaultLabelFormatter.piecewiseColorDefaultLabelFormatter;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
Object.defineProperty(exports, "piecewiseColorLegendClasses", {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
get: function () {
|
|
33
|
+
return _piecewiseColorLegendClasses.piecewiseColorLegendClasses;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
6
36
|
var _ChartsLegend = require("./ChartsLegend");
|
|
7
37
|
Object.keys(_ChartsLegend).forEach(function (key) {
|
|
8
38
|
if (key === "default" || key === "__esModule") return;
|
|
39
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
9
40
|
if (key in exports && exports[key] === _ChartsLegend[key]) return;
|
|
10
41
|
Object.defineProperty(exports, key, {
|
|
11
42
|
enumerable: true,
|
|
@@ -14,20 +45,47 @@ Object.keys(_ChartsLegend).forEach(function (key) {
|
|
|
14
45
|
}
|
|
15
46
|
});
|
|
16
47
|
});
|
|
17
|
-
var
|
|
18
|
-
Object.keys(
|
|
48
|
+
var _chartsLegend = require("./chartsLegend.types");
|
|
49
|
+
Object.keys(_chartsLegend).forEach(function (key) {
|
|
50
|
+
if (key === "default" || key === "__esModule") return;
|
|
51
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
52
|
+
if (key in exports && exports[key] === _chartsLegend[key]) return;
|
|
53
|
+
Object.defineProperty(exports, key, {
|
|
54
|
+
enumerable: true,
|
|
55
|
+
get: function () {
|
|
56
|
+
return _chartsLegend[key];
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
var _direction = require("./direction");
|
|
61
|
+
Object.keys(_direction).forEach(function (key) {
|
|
62
|
+
if (key === "default" || key === "__esModule") return;
|
|
63
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
64
|
+
if (key in exports && exports[key] === _direction[key]) return;
|
|
65
|
+
Object.defineProperty(exports, key, {
|
|
66
|
+
enumerable: true,
|
|
67
|
+
get: function () {
|
|
68
|
+
return _direction[key];
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
var _legendContext = require("./legendContext.types");
|
|
73
|
+
Object.keys(_legendContext).forEach(function (key) {
|
|
19
74
|
if (key === "default" || key === "__esModule") return;
|
|
20
|
-
if (
|
|
75
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
76
|
+
if (key in exports && exports[key] === _legendContext[key]) return;
|
|
21
77
|
Object.defineProperty(exports, key, {
|
|
22
78
|
enumerable: true,
|
|
23
79
|
get: function () {
|
|
24
|
-
return
|
|
80
|
+
return _legendContext[key];
|
|
25
81
|
}
|
|
26
82
|
});
|
|
27
83
|
});
|
|
84
|
+
var _chartsLegendClasses = require("./chartsLegendClasses");
|
|
28
85
|
var _ContinuousColorLegend = require("./ContinuousColorLegend");
|
|
29
86
|
Object.keys(_ContinuousColorLegend).forEach(function (key) {
|
|
30
87
|
if (key === "default" || key === "__esModule") return;
|
|
88
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
31
89
|
if (key in exports && exports[key] === _ContinuousColorLegend[key]) return;
|
|
32
90
|
Object.defineProperty(exports, key, {
|
|
33
91
|
enumerable: true,
|
|
@@ -36,36 +94,42 @@ Object.keys(_ContinuousColorLegend).forEach(function (key) {
|
|
|
36
94
|
}
|
|
37
95
|
});
|
|
38
96
|
});
|
|
39
|
-
var
|
|
40
|
-
Object.keys(
|
|
97
|
+
var _colorLegend = require("./colorLegend.types");
|
|
98
|
+
Object.keys(_colorLegend).forEach(function (key) {
|
|
41
99
|
if (key === "default" || key === "__esModule") return;
|
|
42
|
-
if (
|
|
100
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
101
|
+
if (key in exports && exports[key] === _colorLegend[key]) return;
|
|
43
102
|
Object.defineProperty(exports, key, {
|
|
44
103
|
enumerable: true,
|
|
45
104
|
get: function () {
|
|
46
|
-
return
|
|
105
|
+
return _colorLegend[key];
|
|
47
106
|
}
|
|
48
107
|
});
|
|
49
108
|
});
|
|
50
|
-
var
|
|
51
|
-
|
|
109
|
+
var _continuousColorLegendClasses = require("./continuousColorLegendClasses");
|
|
110
|
+
var _PiecewiseColorLegend = require("./PiecewiseColorLegend");
|
|
111
|
+
Object.keys(_PiecewiseColorLegend).forEach(function (key) {
|
|
52
112
|
if (key === "default" || key === "__esModule") return;
|
|
53
|
-
if (
|
|
113
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
114
|
+
if (key in exports && exports[key] === _PiecewiseColorLegend[key]) return;
|
|
54
115
|
Object.defineProperty(exports, key, {
|
|
55
116
|
enumerable: true,
|
|
56
117
|
get: function () {
|
|
57
|
-
return
|
|
118
|
+
return _PiecewiseColorLegend[key];
|
|
58
119
|
}
|
|
59
120
|
});
|
|
60
121
|
});
|
|
61
|
-
var
|
|
62
|
-
|
|
122
|
+
var _piecewiseColorLegendClasses = require("./piecewiseColorLegendClasses");
|
|
123
|
+
var _piecewiseColorDefaultLabelFormatter = require("./piecewiseColorDefaultLabelFormatter");
|
|
124
|
+
var _legend = require("./legend.types");
|
|
125
|
+
Object.keys(_legend).forEach(function (key) {
|
|
63
126
|
if (key === "default" || key === "__esModule") return;
|
|
64
|
-
if (
|
|
127
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
128
|
+
if (key in exports && exports[key] === _legend[key]) return;
|
|
65
129
|
Object.defineProperty(exports, key, {
|
|
66
130
|
enumerable: true,
|
|
67
131
|
get: function () {
|
|
68
|
-
return
|
|
132
|
+
return _legend[key];
|
|
69
133
|
}
|
|
70
134
|
});
|
|
71
135
|
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.seriesContextBuilder = void 0;
|
|
7
|
+
const seriesContextBuilder = context => ({
|
|
8
|
+
type: 'series',
|
|
9
|
+
color: context.color,
|
|
10
|
+
label: context.label,
|
|
11
|
+
seriesId: context.seriesId,
|
|
12
|
+
itemId: context.itemId
|
|
13
|
+
});
|
|
14
|
+
exports.seriesContextBuilder = seriesContextBuilder;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.piecewiseColorDefaultLabelFormatter = piecewiseColorDefaultLabelFormatter;
|
|
7
|
+
function piecewiseColorDefaultLabelFormatter(params) {
|
|
8
|
+
if (params.min === null) {
|
|
9
|
+
return `<${params.formattedMax}`;
|
|
10
|
+
}
|
|
11
|
+
if (params.max === null) {
|
|
12
|
+
return `>${params.formattedMin}`;
|
|
13
|
+
}
|
|
14
|
+
return `${params.formattedMin}-${params.formattedMax}`;
|
|
15
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
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.piecewiseColorLegendClasses = 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 getLegendUtilityClass(slot) {
|
|
12
|
+
return (0, _generateUtilityClass.default)('MuiPiecewiseColorLegendClasses', slot);
|
|
13
|
+
}
|
|
14
|
+
const useUtilityClasses = props => {
|
|
15
|
+
const {
|
|
16
|
+
classes,
|
|
17
|
+
direction,
|
|
18
|
+
labelPosition
|
|
19
|
+
} = props;
|
|
20
|
+
const slots = {
|
|
21
|
+
root: ['root', direction, labelPosition],
|
|
22
|
+
minLabel: ['minLabel'],
|
|
23
|
+
maxLabel: ['maxLabel'],
|
|
24
|
+
item: ['item'],
|
|
25
|
+
mark: ['mark'],
|
|
26
|
+
label: ['label']
|
|
27
|
+
};
|
|
28
|
+
return (0, _composeClasses.default)(slots, getLegendUtilityClass, classes);
|
|
29
|
+
};
|
|
30
|
+
exports.useUtilityClasses = useUtilityClasses;
|
|
31
|
+
const piecewiseColorLegendClasses = exports.piecewiseColorLegendClasses = (0, _generateUtilityClasses.default)('MuiPiecewiseColorLegendClasses', ['root', 'minLabel', 'maxLabel', 'item', 'vertical', 'horizontal', 'start', 'end', 'extremes', 'mark', 'label']);
|