@rio-cloud/rio-uikit 1.4.1 → 1.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/FadeExpander.d.ts +2 -0
- package/FadeExpander.js +2 -0
- package/FadeUp.d.ts +2 -0
- package/FadeUp.js +2 -0
- package/XAxis.d.ts +2 -0
- package/XAxis.js +2 -0
- package/YAxis.d.ts +2 -0
- package/YAxis.js +2 -0
- package/components/applicationLayout/ApplicationLayoutBody.d.ts +5 -0
- package/components/applicationLayout/ApplicationLayoutBody.js +10 -1
- package/components/charts/Area.d.ts +11 -3
- package/components/charts/Area.js +9 -1
- package/components/charts/AreaChart.d.ts +4 -3
- package/components/charts/AreaChart.js +9 -8
- package/components/charts/Bar.d.ts +6 -2
- package/components/charts/Bar.js +3 -4
- package/components/charts/BarChart.d.ts +2 -1
- package/components/charts/BarChart.js +8 -4
- package/components/charts/ComposedChart.d.ts +6 -5
- package/components/charts/ComposedChart.js +16 -11
- package/components/charts/Line.d.ts +11 -3
- package/components/charts/Line.js +9 -1
- package/components/charts/LineChart.d.ts +6 -4
- package/components/charts/LineChart.js +10 -9
- package/components/charts/ReferenceLine.d.ts +8 -4
- package/components/charts/ReferenceLine.js +18 -2
- package/components/charts/XAxis.d.ts +7 -0
- package/components/charts/XAxis.js +18 -0
- package/components/charts/YAxis.d.ts +5 -0
- package/components/charts/YAxis.js +2 -0
- package/components/collapse/Collapse.js +3 -2
- package/components/fade/FadeExpander.d.ts +27 -0
- package/components/fade/FadeExpander.js +41 -0
- package/components/fade/FadeUp.d.ts +27 -0
- package/components/fade/FadeUp.js +28 -0
- package/components/listMenu/ListMenu.d.ts +7 -0
- package/components/listMenu/ListMenu.js +6 -3
- package/components/map/components/features/Route.d.ts +13 -2
- package/components/map/components/features/Route.js +19 -11
- package/components/map/components/features/basics/Polygon.d.ts +1 -0
- package/components/map/components/features/basics/Polygon.js +1 -0
- package/components/map/components/features/basics/Polyline.d.ts +3 -1
- package/components/map/components/features/basics/Polyline.js +5 -16
- package/components/map/components/features/basics/polygonColors.d.ts +252 -0
- package/components/map/components/features/basics/polygonColors.js +252 -0
- package/components/map/utils/mapTypes.d.ts +1 -1
- package/components/map/utils/mapTypes.js +2 -0
- package/components/mapMarker/SingleMapMarker.d.ts +3 -2
- package/components/mapMarker/SingleMapMarker.js +3 -3
- package/components/selects/BaseSelectDropdown.d.ts +0 -1
- package/components/selects/BaseSelectDropdown.js +7 -1
- package/components/selects/Multiselect.js +1 -4
- package/components/selects/Select.d.ts +1 -1
- package/components/selects/Select.js +1 -4
- package/components/smoothScrollbars/SmoothScrollbars.js +28 -3
- package/hooks/useSorting.d.ts +29 -0
- package/hooks/useSorting.js +41 -0
- package/lib/es/FadeExpander.d.ts +2 -0
- package/lib/es/FadeExpander.js +7 -0
- package/lib/es/FadeUp.d.ts +2 -0
- package/lib/es/FadeUp.js +7 -0
- package/lib/es/XAxis.d.ts +2 -0
- package/lib/es/XAxis.js +7 -0
- package/lib/es/YAxis.d.ts +2 -0
- package/lib/es/YAxis.js +7 -0
- package/lib/es/components/applicationLayout/ApplicationLayoutBody.d.ts +5 -0
- package/lib/es/components/applicationLayout/ApplicationLayoutBody.js +10 -1
- package/lib/es/components/charts/Area.d.ts +11 -3
- package/lib/es/components/charts/Area.js +11 -1
- package/lib/es/components/charts/AreaChart.d.ts +4 -3
- package/lib/es/components/charts/AreaChart.js +8 -7
- package/lib/es/components/charts/Bar.d.ts +6 -2
- package/lib/es/components/charts/Bar.js +5 -4
- package/lib/es/components/charts/BarChart.d.ts +2 -1
- package/lib/es/components/charts/BarChart.js +7 -3
- package/lib/es/components/charts/ComposedChart.d.ts +6 -5
- package/lib/es/components/charts/ComposedChart.js +15 -10
- package/lib/es/components/charts/Line.d.ts +11 -3
- package/lib/es/components/charts/Line.js +11 -1
- package/lib/es/components/charts/LineChart.d.ts +6 -4
- package/lib/es/components/charts/LineChart.js +9 -8
- package/lib/es/components/charts/ReferenceLine.d.ts +8 -4
- package/lib/es/components/charts/ReferenceLine.js +21 -2
- package/lib/es/components/charts/XAxis.d.ts +7 -0
- package/lib/es/components/charts/XAxis.js +23 -0
- package/lib/es/components/charts/YAxis.d.ts +5 -0
- package/lib/es/components/charts/YAxis.js +4 -0
- package/lib/es/components/collapse/Collapse.js +3 -2
- package/lib/es/components/fade/FadeExpander.d.ts +27 -0
- package/lib/es/components/fade/FadeExpander.js +43 -0
- package/lib/es/components/fade/FadeUp.d.ts +27 -0
- package/lib/es/components/fade/FadeUp.js +30 -0
- package/lib/es/components/listMenu/ListMenu.d.ts +7 -0
- package/lib/es/components/listMenu/ListMenu.js +6 -3
- package/lib/es/components/map/components/features/Route.d.ts +13 -2
- package/lib/es/components/map/components/features/Route.js +20 -12
- package/lib/es/components/map/components/features/basics/Polygon.d.ts +1 -0
- package/lib/es/components/map/components/features/basics/Polygon.js +10 -0
- package/lib/es/components/map/components/features/basics/Polyline.d.ts +3 -1
- package/lib/es/components/map/components/features/basics/Polyline.js +5 -16
- package/lib/es/components/map/components/features/basics/polygonColors.d.ts +252 -0
- package/lib/es/components/map/components/features/basics/polygonColors.js +255 -0
- package/lib/es/components/map/utils/mapTypes.d.ts +1 -1
- package/lib/es/components/map/utils/mapTypes.js +2 -0
- package/lib/es/components/mapMarker/SingleMapMarker.d.ts +3 -2
- package/lib/es/components/mapMarker/SingleMapMarker.js +3 -3
- package/lib/es/components/selects/BaseSelectDropdown.d.ts +0 -1
- package/lib/es/components/selects/BaseSelectDropdown.js +6 -0
- package/lib/es/components/selects/Multiselect.js +1 -4
- package/lib/es/components/selects/Select.d.ts +1 -1
- package/lib/es/components/selects/Select.js +1 -4
- package/lib/es/components/smoothScrollbars/SmoothScrollbars.js +27 -2
- package/lib/es/hooks/useSorting.d.ts +29 -0
- package/lib/es/hooks/useSorting.js +43 -0
- package/lib/es/storageUtils.d.ts +1 -0
- package/lib/es/storageUtils.js +4 -0
- package/lib/es/styles/variables/colors/colors.json +4 -3
- package/lib/es/urlFeatureToggles.d.ts +1 -0
- package/lib/es/urlFeatureToggles.js +4 -0
- package/lib/es/useSorting.d.ts +2 -0
- package/lib/es/useSorting.js +7 -0
- package/lib/es/utils/storageUtils.d.ts +5 -0
- package/lib/es/utils/storageUtils.js +32 -0
- package/lib/es/utils/urlFeatureToggles.d.ts +10 -0
- package/lib/es/utils/urlFeatureToggles.js +41 -0
- package/lib/es/version.json +1 -1
- package/package.json +4 -1
- package/storageUtils.d.ts +1 -0
- package/storageUtils.js +1 -0
- package/styles/variables/colors/colors.json +4 -3
- package/urlFeatureToggles.d.ts +1 -0
- package/urlFeatureToggles.js +1 -0
- package/useSorting.d.ts +2 -0
- package/useSorting.js +2 -0
- package/utils/storageUtils.d.ts +5 -0
- package/utils/storageUtils.js +29 -0
- package/utils/urlFeatureToggles.d.ts +10 -0
- package/utils/urlFeatureToggles.js +32 -0
- package/version.json +1 -1
- package/.DS_Store +0 -0
|
@@ -1,12 +1,20 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import type { AreaProps as RechartsAreaProps } from 'recharts';
|
|
2
|
+
import type { CurveType } from 'recharts/types/shape/Curve';
|
|
3
3
|
export type AreaProps = Omit<RechartsAreaProps, 'ref'> & {
|
|
4
4
|
strokeColor?: string;
|
|
5
5
|
dataKey?: string;
|
|
6
6
|
unit?: string;
|
|
7
7
|
legendType?: string;
|
|
8
|
-
type?:
|
|
8
|
+
type?: CurveType;
|
|
9
9
|
isAnimationActive?: boolean;
|
|
10
10
|
};
|
|
11
|
-
declare const
|
|
11
|
+
export declare const getAreaDefaultProps: () => {
|
|
12
|
+
dataKey: string;
|
|
13
|
+
unit: string;
|
|
14
|
+
strokeColor: string;
|
|
15
|
+
legendType: string;
|
|
16
|
+
type: string;
|
|
17
|
+
isAnimationActive: boolean;
|
|
18
|
+
};
|
|
19
|
+
declare const Area: (props: AreaProps) => null;
|
|
12
20
|
export default Area;
|
|
@@ -1,4 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
3
|
+
exports.getAreaDefaultProps = void 0;
|
|
4
|
+
const getAreaDefaultProps = () => ({
|
|
5
|
+
dataKey: 'value',
|
|
6
|
+
unit: '',
|
|
7
|
+
strokeColor: 'color-coldplay-fountain',
|
|
8
|
+
legendType: 'square',
|
|
9
|
+
type: 'monotone',
|
|
10
|
+
isAnimationActive: true,
|
|
11
|
+
});
|
|
12
|
+
exports.getAreaDefaultProps = getAreaDefaultProps;
|
|
13
|
+
const Area = (props) => null;
|
|
4
14
|
exports.default = Area;
|
|
@@ -3,10 +3,10 @@ import { AreaChart as RechartsAreaChart, type XAxisProps, type YAxisProps } from
|
|
|
3
3
|
import { type AreaGradientProps } from './AreaGradient';
|
|
4
4
|
import { type ChartTooltipProps } from './ChartTooltip';
|
|
5
5
|
import { type LegendProps } from './Legend';
|
|
6
|
-
import type
|
|
6
|
+
import { type AreaProps } from './Area';
|
|
7
7
|
import type { GridProps } from './ChartGrid';
|
|
8
8
|
import type { ResponsiveContainerProps } from './ResponsiveContainer';
|
|
9
|
-
import type
|
|
9
|
+
import { type ReferenceLineProps } from './ReferenceLine';
|
|
10
10
|
type RechartsAreaChartProps = React.ComponentProps<typeof RechartsAreaChart>;
|
|
11
11
|
export type AreaChartProps<T extends object> = Omit<RechartsAreaChartProps, 'data'> & {
|
|
12
12
|
width?: number;
|
|
@@ -19,11 +19,12 @@ export type AreaChartProps<T extends object> = Omit<RechartsAreaChartProps, 'dat
|
|
|
19
19
|
referenceLines?: React.ReactElement<ReferenceLineProps>[];
|
|
20
20
|
xAxisOptions?: XAxisProps;
|
|
21
21
|
yAxisOptions?: YAxisProps;
|
|
22
|
+
additionalAxes?: React.ReactElement<XAxisProps | YAxisProps>[];
|
|
22
23
|
gridOptions?: GridProps;
|
|
24
|
+
showGrid?: boolean;
|
|
23
25
|
containerOptions?: ResponsiveContainerProps;
|
|
24
26
|
showXAxis?: boolean;
|
|
25
27
|
showYAxis?: boolean;
|
|
26
|
-
showGrid?: boolean;
|
|
27
28
|
legend?: React.ReactElement<LegendProps> | boolean;
|
|
28
29
|
tooltip?: React.ReactElement<ChartTooltipProps> | boolean;
|
|
29
30
|
brush?: boolean;
|
|
@@ -11,22 +11,23 @@ const chartHelper_1 = require("./chartHelper");
|
|
|
11
11
|
const AreaGradient_1 = tslib_1.__importStar(require("./AreaGradient"));
|
|
12
12
|
const ChartTooltip_1 = tslib_1.__importDefault(require("./ChartTooltip"));
|
|
13
13
|
const Legend_1 = require("./Legend");
|
|
14
|
+
const XAxis_1 = require("./XAxis");
|
|
15
|
+
const Area_1 = require("./Area");
|
|
16
|
+
const ReferenceLine_1 = require("./ReferenceLine");
|
|
14
17
|
const AreaChart = (props) => {
|
|
15
|
-
const { width, height, data = [], dataUnit = '', dataKey = 'value', gradients = [], areas = [], referenceLines = [], xAxisOptions, yAxisOptions, gridOptions, containerOptions, showXAxis = true, showYAxis = false, showGrid = false, legend, brush = false, tooltip = true } = props, remainingProps = tslib_1.__rest(props, ["width", "height", "data", "dataUnit", "dataKey", "gradients", "areas", "referenceLines", "xAxisOptions", "yAxisOptions", "gridOptions", "containerOptions", "showXAxis", "showYAxis", "showGrid", "legend", "brush", "tooltip"]);
|
|
18
|
+
const { width, height, data = [], dataUnit = '', dataKey = 'value', gradients = [], areas = [], referenceLines = [], xAxisOptions, yAxisOptions, gridOptions, containerOptions, showXAxis = true, showYAxis = false, additionalAxes = [], showGrid = false, legend, brush = false, tooltip = true } = props, remainingProps = tslib_1.__rest(props, ["width", "height", "data", "dataUnit", "dataKey", "gradients", "areas", "referenceLines", "xAxisOptions", "yAxisOptions", "gridOptions", "containerOptions", "showXAxis", "showYAxis", "additionalAxes", "showGrid", "legend", "brush", "tooltip"]);
|
|
16
19
|
const areasWithGradient = areas.map(area => {
|
|
17
|
-
const
|
|
20
|
+
const areaPropsWithDefault = Object.assign(Object.assign({}, (0, Area_1.getAreaDefaultProps)()), area.props);
|
|
21
|
+
const { strokeColor } = areaPropsWithDefault, remainingAreaProps = tslib_1.__rest(areaPropsWithDefault, ["strokeColor"]);
|
|
18
22
|
const gradientId = area.key;
|
|
19
23
|
const stroke = (0, chartHelper_1.getColor)(strokeColor);
|
|
20
24
|
return {
|
|
21
|
-
area: (0, react_1.createElement)(recharts_1.Area, Object.assign({}, remainingAreaProps, { key: area.key, stroke: stroke, fill: `url(#${gradientId})` })),
|
|
25
|
+
area: ((0, react_1.createElement)(recharts_1.Area, Object.assign({}, remainingAreaProps, { key: area.key, stroke: stroke, fill: `url(#${gradientId})` }))),
|
|
22
26
|
gradient: (0, jsx_runtime_1.jsx)(AreaGradient_1.default, { id: gradientId || AreaGradient_1.DEFAULT_ARIA_GRADIENT_ID, color: strokeColor }, area.key),
|
|
23
27
|
};
|
|
24
28
|
});
|
|
25
29
|
const tooltipProps = (0, isObject_1.default)(tooltip) ? tooltip.props : {};
|
|
26
30
|
const legendProps = (0, isObject_1.default)(legend) ? Object.assign(Object.assign({}, (0, Legend_1.getLegendDefaultProps)()), legend.props) : {};
|
|
27
|
-
return ((0, jsx_runtime_1.jsx)(recharts_1.ResponsiveContainer, Object.assign({}, containerOptions, { children: (0, jsx_runtime_1.jsxs)(recharts_1.AreaChart, Object.assign({ width: width, height: height, data: data, margin: { top: 15, right: 15, left: 15, bottom: 15 } }, remainingProps, { children: [(0, jsx_runtime_1.jsxs)("defs", { children: [gradients, areasWithGradient.map(areaWithGradient => areaWithGradient.gradient)] }), showGrid && (0, jsx_runtime_1.jsx)(recharts_1.CartesianGrid, Object.assign({ strokeDasharray: '3 3' }, (0, chartHelper_1.mapGridOptions)(gridOptions))), (0, jsx_runtime_1.jsx)(recharts_1.XAxis, Object.assign({ hide: !showXAxis, dataKey: dataKey }, xAxisOptions)), (0, jsx_runtime_1.jsx)(recharts_1.YAxis, Object.assign({ hide: !showYAxis, unit: dataUnit }, yAxisOptions)), tooltip && (0, jsx_runtime_1.jsx)(ChartTooltip_1.default, Object.assign({}, tooltipProps)), legend && legendProps && ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(recharts_1.Legend, Object.assign({ wrapperStyle: legendProps.verticalAlign === 'bottom' ? { bottom: 0 } : legendProps.wrapperStyle }, legendProps)) })), areasWithGradient.map(areaWithGradient => areaWithGradient.area), referenceLines.map(
|
|
28
|
-
const _a = referenceLine.props, { stroke } = _a, remainingReferenceLineProps = tslib_1.__rest(_a, ["stroke"]);
|
|
29
|
-
return ((0, react_1.createElement)(recharts_1.ReferenceLine, Object.assign({}, remainingReferenceLineProps, { key: referenceLine.key, stroke: (0, chartHelper_1.getColor)(stroke) })));
|
|
30
|
-
}), brush && (0, jsx_runtime_1.jsx)(recharts_1.Brush, { stroke: (0, chartHelper_1.getColor)('gray') })] })) })));
|
|
31
|
+
return ((0, jsx_runtime_1.jsx)(recharts_1.ResponsiveContainer, Object.assign({}, containerOptions, { children: (0, jsx_runtime_1.jsxs)(recharts_1.AreaChart, Object.assign({ width: width, height: height, data: data, margin: { top: 15, right: 15, left: 15, bottom: 15 } }, remainingProps, { children: [(0, jsx_runtime_1.jsxs)("defs", { children: [gradients, areasWithGradient.map(areaWithGradient => areaWithGradient.gradient)] }), showGrid && (0, jsx_runtime_1.jsx)(recharts_1.CartesianGrid, Object.assign({ strokeDasharray: '3 3' }, (0, chartHelper_1.mapGridOptions)(gridOptions))), (0, jsx_runtime_1.jsx)(recharts_1.XAxis, Object.assign({ hide: !showXAxis, dataKey: dataKey }, xAxisOptions)), (0, jsx_runtime_1.jsx)(recharts_1.YAxis, Object.assign({ hide: !showYAxis, unit: dataUnit }, yAxisOptions)), additionalAxes.map(XAxis_1.renderAxis), tooltip && (0, jsx_runtime_1.jsx)(ChartTooltip_1.default, Object.assign({}, tooltipProps)), legend && legendProps && ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(recharts_1.Legend, Object.assign({ wrapperStyle: legendProps.verticalAlign === 'bottom' ? { bottom: 0 } : legendProps.wrapperStyle }, legendProps)) })), areasWithGradient.map(areaWithGradient => areaWithGradient.area), referenceLines.map(ReferenceLine_1.renderReferenceLine), brush && (0, jsx_runtime_1.jsx)(recharts_1.Brush, { stroke: (0, chartHelper_1.getColor)('gray') })] })) })));
|
|
31
32
|
};
|
|
32
33
|
exports.default = AreaChart;
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import type { BarProps as RechartsBarProps } from 'recharts';
|
|
3
2
|
export type BarProps = Omit<RechartsBarProps, 'ref'> & {};
|
|
4
|
-
declare const
|
|
3
|
+
export declare const getBarDefaultProps: () => {
|
|
4
|
+
dataKey: string;
|
|
5
|
+
color: string;
|
|
6
|
+
isAnimationActive: boolean;
|
|
7
|
+
};
|
|
8
|
+
declare const Bar: (props: BarProps) => null;
|
|
5
9
|
export default Bar;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
exports.getBarDefaultProps = void 0;
|
|
4
|
+
const getBarDefaultProps = () => ({
|
|
5
5
|
dataKey: 'value',
|
|
6
|
-
unit: '',
|
|
7
6
|
color: 'color-coldplay-fountain',
|
|
8
7
|
isAnimationActive: true,
|
|
9
|
-
};
|
|
8
|
+
});
|
|
9
|
+
exports.getBarDefaultProps = getBarDefaultProps;
|
|
10
|
+
const Bar = (props) => null;
|
|
10
11
|
exports.default = Bar;
|
|
@@ -3,7 +3,7 @@ import { BarChart as RechartsBarChart, type XAxisProps, type YAxisProps } from '
|
|
|
3
3
|
import { type DataType } from './chartHelper';
|
|
4
4
|
import { type ChartTooltipProps } from './ChartTooltip';
|
|
5
5
|
import { type LegendProps } from './Legend';
|
|
6
|
-
import type
|
|
6
|
+
import { type BarProps } from './Bar';
|
|
7
7
|
import type { GridProps } from './ChartGrid';
|
|
8
8
|
import type { ResponsiveContainerProps } from './ResponsiveContainer';
|
|
9
9
|
export type BarChartDataType = DataType;
|
|
@@ -22,6 +22,7 @@ export type BarChartProps<T extends DataType> = Omit<RechartsBarChartProps, with
|
|
|
22
22
|
useDataColors?: boolean;
|
|
23
23
|
xAxisOptions?: XAxisProps;
|
|
24
24
|
yAxisOptions?: YAxisProps;
|
|
25
|
+
additionalAxes?: React.ReactElement<XAxisProps | YAxisProps>[];
|
|
25
26
|
gridOptions?: GridProps;
|
|
26
27
|
containerOptions?: ResponsiveContainerProps;
|
|
27
28
|
legend?: React.ReactElement<LegendProps> | boolean;
|
|
@@ -10,8 +10,10 @@ const isObject_1 = tslib_1.__importDefault(require("lodash/fp/isObject"));
|
|
|
10
10
|
const chartHelper_1 = require("./chartHelper");
|
|
11
11
|
const ChartTooltip_1 = tslib_1.__importDefault(require("./ChartTooltip"));
|
|
12
12
|
const Legend_1 = require("./Legend");
|
|
13
|
+
const XAxis_1 = require("./XAxis");
|
|
14
|
+
const Bar_1 = require("./Bar");
|
|
13
15
|
const BarChart = (props) => {
|
|
14
|
-
const { width, height, data = [], dataUnit, dataKey = 'value', layout = 'horizontal', legend = false, bars = [], xAxisOptions, yAxisOptions, gridOptions, containerOptions, showGrid = false, showXAxis = true, showYAxis = true, useDataColors = false, brush = false, tooltip = true } = props, remainingProps = tslib_1.__rest(props, ["width", "height", "data", "dataUnit", "dataKey", "layout", "legend", "bars", "xAxisOptions", "yAxisOptions", "gridOptions", "containerOptions", "showGrid", "showXAxis", "showYAxis", "useDataColors", "brush", "tooltip"]);
|
|
16
|
+
const { width, height, data = [], dataUnit, dataKey = 'value', layout = 'horizontal', legend = false, bars = [], xAxisOptions, yAxisOptions, additionalAxes = [], gridOptions, containerOptions, showGrid = false, showXAxis = true, showYAxis = true, useDataColors = false, brush = false, tooltip = true } = props, remainingProps = tslib_1.__rest(props, ["width", "height", "data", "dataUnit", "dataKey", "layout", "legend", "bars", "xAxisOptions", "yAxisOptions", "additionalAxes", "gridOptions", "containerOptions", "showGrid", "showXAxis", "showYAxis", "useDataColors", "brush", "tooltip"]);
|
|
15
17
|
const tooltipProps = (0, isObject_1.default)(tooltip) ? tooltip.props : {};
|
|
16
18
|
const legendProps = (0, isObject_1.default)(legend) ? Object.assign(Object.assign({}, (0, Legend_1.getLegendDefaultProps)()), legend.props) : {};
|
|
17
19
|
let legendPayload;
|
|
@@ -21,12 +23,14 @@ const BarChart = (props) => {
|
|
|
21
23
|
return Object.assign(Object.assign({}, entry), { value: (0, isFunction_1.default)(dataKey) ? dataKey(entry) : entry[dataKey], color: legendColor });
|
|
22
24
|
});
|
|
23
25
|
}
|
|
24
|
-
return ((0, jsx_runtime_1.jsx)(recharts_1.ResponsiveContainer, Object.assign({}, containerOptions, { children: (0, jsx_runtime_1.jsxs)(recharts_1.BarChart, Object.assign({ layout: layout, width: width, height: height, data: data }, remainingProps, { children: [showGrid && (0, jsx_runtime_1.jsx)(recharts_1.CartesianGrid, Object.assign({ strokeDasharray: '3 3' }, (0, chartHelper_1.mapGridOptions)(gridOptions))), (0, jsx_runtime_1.jsx)(recharts_1.XAxis, Object.assign({ hide: !showXAxis, dataKey: dataKey }, xAxisOptions)), (0, jsx_runtime_1.jsx)(recharts_1.YAxis, Object.assign({ hide: !showYAxis, unit: dataUnit }, yAxisOptions)), tooltip && (0, jsx_runtime_1.jsx)(ChartTooltip_1.default, Object.assign({ cursor: { fill: chartHelper_1.CURSOR_BACKGROUND_COLOR } }, tooltipProps)), legend && (0, jsx_runtime_1.jsx)(recharts_1.Legend, Object.assign({ payload: useDataColors ? legendPayload : undefined }, legendProps)), bars.map(bar => {
|
|
25
|
-
const
|
|
26
|
+
return ((0, jsx_runtime_1.jsx)(recharts_1.ResponsiveContainer, Object.assign({}, containerOptions, { children: (0, jsx_runtime_1.jsxs)(recharts_1.BarChart, Object.assign({ layout: layout, width: width, height: height, data: data }, remainingProps, { children: [showGrid && (0, jsx_runtime_1.jsx)(recharts_1.CartesianGrid, Object.assign({ strokeDasharray: '3 3' }, (0, chartHelper_1.mapGridOptions)(gridOptions))), (0, jsx_runtime_1.jsx)(recharts_1.XAxis, Object.assign({ hide: !showXAxis, dataKey: dataKey }, xAxisOptions)), (0, jsx_runtime_1.jsx)(recharts_1.YAxis, Object.assign({ hide: !showYAxis, unit: dataUnit }, yAxisOptions)), additionalAxes.map(XAxis_1.renderAxis), tooltip && (0, jsx_runtime_1.jsx)(ChartTooltip_1.default, Object.assign({ cursor: { fill: chartHelper_1.CURSOR_BACKGROUND_COLOR } }, tooltipProps)), legend && (0, jsx_runtime_1.jsx)(recharts_1.Legend, Object.assign({ payload: useDataColors ? legendPayload : undefined }, legendProps)), bars.map(bar => {
|
|
27
|
+
const barPropsWithDefault = Object.assign(Object.assign({}, (0, Bar_1.getBarDefaultProps)()), bar.props);
|
|
28
|
+
const { color } = barPropsWithDefault, remainingBarProps = tslib_1.__rest(barPropsWithDefault, ["color"]);
|
|
26
29
|
const cellColor = color && (0, chartHelper_1.getColor)(color);
|
|
27
30
|
return ((0, jsx_runtime_1.jsx)(recharts_1.Bar, Object.assign({ unit: dataUnit }, remainingBarProps, { fill: cellColor }, { children: useDataColors &&
|
|
28
31
|
data.map((entry, index) => {
|
|
29
32
|
const entryCellColor = (0, chartHelper_1.getColor)(entry.color) || (0, chartHelper_1.getFromDefaultColors)(index);
|
|
33
|
+
// biome-ignore lint/suspicious/noArrayIndexKey: unknown key
|
|
30
34
|
return (0, jsx_runtime_1.jsx)(recharts_1.Cell, { fill: entryCellColor }, `cell-${index}`);
|
|
31
35
|
}) }), bar.key));
|
|
32
36
|
}), brush && (0, jsx_runtime_1.jsx)(recharts_1.Brush, { stroke: (0, chartHelper_1.getColor)('gray') })] })) })));
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ComposedChart as RechartsComposedChart, type XAxisProps, type YAxisProps } from 'recharts';
|
|
3
|
-
import { ChartTooltipProps } from './ChartTooltip';
|
|
3
|
+
import { type ChartTooltipProps } from './ChartTooltip';
|
|
4
4
|
import { type LegendProps } from './Legend';
|
|
5
|
-
import type
|
|
6
|
-
import type
|
|
7
|
-
import type
|
|
5
|
+
import { type BarProps } from './Bar';
|
|
6
|
+
import { type ReferenceLineProps } from './ReferenceLine';
|
|
7
|
+
import { type LineProps } from './Line';
|
|
8
|
+
import { type AreaProps } from './Area';
|
|
8
9
|
import type { GridProps } from './ChartGrid';
|
|
9
10
|
import type { ResponsiveContainerProps } from './ResponsiveContainer';
|
|
10
|
-
import type { AreaProps } from './Area';
|
|
11
11
|
type RechartsComposedChartProps = React.ComponentProps<typeof RechartsComposedChart>;
|
|
12
12
|
export type ComposedChartProps<T extends object> = Omit<RechartsComposedChartProps, 'data'> & {
|
|
13
13
|
width?: number;
|
|
@@ -21,6 +21,7 @@ export type ComposedChartProps<T extends object> = Omit<RechartsComposedChartPro
|
|
|
21
21
|
referenceLines?: React.ReactElement<ReferenceLineProps>[];
|
|
22
22
|
xAxisOptions?: XAxisProps;
|
|
23
23
|
yAxisOptions?: YAxisProps;
|
|
24
|
+
additionalAxes?: React.ReactElement<XAxisProps | YAxisProps>[];
|
|
24
25
|
gridOptions?: GridProps;
|
|
25
26
|
containerOptions?: ResponsiveContainerProps;
|
|
26
27
|
showXAxis?: boolean;
|
|
@@ -10,23 +10,28 @@ const isObject_1 = tslib_1.__importDefault(require("lodash/fp/isObject"));
|
|
|
10
10
|
const chartHelper_1 = require("./chartHelper");
|
|
11
11
|
const ChartTooltip_1 = tslib_1.__importDefault(require("./ChartTooltip"));
|
|
12
12
|
const Legend_1 = require("./Legend");
|
|
13
|
+
const XAxis_1 = require("./XAxis");
|
|
14
|
+
const Bar_1 = require("./Bar");
|
|
15
|
+
const ReferenceLine_1 = require("./ReferenceLine");
|
|
16
|
+
const Line_1 = require("./Line");
|
|
17
|
+
const Area_1 = require("./Area");
|
|
13
18
|
const ComposedChart = (props) => {
|
|
14
|
-
const { width, height, data = [], dataUnit = '', dataKey = 'value', lines = [], bars = [], areas = [], referenceLines = [], xAxisOptions, yAxisOptions, gridOptions, containerOptions, showXAxis = true, showYAxis = false, showGrid = false, legend, brush = false, tooltip = true } = props, remainingProps = tslib_1.__rest(props, ["width", "height", "data", "dataUnit", "dataKey", "lines", "bars", "areas", "referenceLines", "xAxisOptions", "yAxisOptions", "gridOptions", "containerOptions", "showXAxis", "showYAxis", "showGrid", "legend", "brush", "tooltip"]);
|
|
19
|
+
const { width, height, data = [], dataUnit = '', dataKey = 'value', lines = [], bars = [], areas = [], referenceLines = [], xAxisOptions, yAxisOptions, additionalAxes = [], gridOptions, containerOptions, showXAxis = true, showYAxis = false, showGrid = false, legend, brush = false, tooltip = true } = props, remainingProps = tslib_1.__rest(props, ["width", "height", "data", "dataUnit", "dataKey", "lines", "bars", "areas", "referenceLines", "xAxisOptions", "yAxisOptions", "additionalAxes", "gridOptions", "containerOptions", "showXAxis", "showYAxis", "showGrid", "legend", "brush", "tooltip"]);
|
|
15
20
|
const tooltipProps = (0, isObject_1.default)(tooltip) ? tooltip.props : {};
|
|
16
21
|
const legendProps = (0, isObject_1.default)(legend) ? Object.assign(Object.assign({}, (0, Legend_1.getLegendDefaultProps)()), legend.props) : {};
|
|
17
|
-
return ((0, jsx_runtime_1.jsx)(recharts_1.ResponsiveContainer, Object.assign({}, containerOptions, { children: (0, jsx_runtime_1.jsxs)(recharts_1.ComposedChart, Object.assign({ width: width, height: height, data: data, margin: { top: 15, right: 15, left: 15, bottom: 15 } }, remainingProps, { children: [showGrid && (0, jsx_runtime_1.jsx)(recharts_1.CartesianGrid, Object.assign({ strokeDasharray: '3 3' }, (0, chartHelper_1.mapGridOptions)(gridOptions))), (0, jsx_runtime_1.jsx)(recharts_1.XAxis, Object.assign({ hide: !showXAxis, dataKey: dataKey }, xAxisOptions)), (0, jsx_runtime_1.jsx)(recharts_1.YAxis, Object.assign({ hide: !showYAxis, unit: dataUnit }, yAxisOptions)), tooltip && (0, jsx_runtime_1.jsx)(ChartTooltip_1.default, Object.assign({}, tooltipProps)), legend && (0, jsx_runtime_1.jsx)(recharts_1.Legend, Object.assign({}, legendProps)), areas.map(area => {
|
|
18
|
-
const
|
|
22
|
+
return ((0, jsx_runtime_1.jsx)(recharts_1.ResponsiveContainer, Object.assign({}, containerOptions, { children: (0, jsx_runtime_1.jsxs)(recharts_1.ComposedChart, Object.assign({ width: width, height: height, data: data, margin: { top: 15, right: 15, left: 15, bottom: 15 } }, remainingProps, { children: [showGrid && (0, jsx_runtime_1.jsx)(recharts_1.CartesianGrid, Object.assign({ strokeDasharray: '3 3' }, (0, chartHelper_1.mapGridOptions)(gridOptions))), (0, jsx_runtime_1.jsx)(recharts_1.XAxis, Object.assign({ hide: !showXAxis, dataKey: dataKey }, xAxisOptions)), (0, jsx_runtime_1.jsx)(recharts_1.YAxis, Object.assign({ hide: !showYAxis, unit: dataUnit }, yAxisOptions)), additionalAxes.map(XAxis_1.renderAxis), tooltip && (0, jsx_runtime_1.jsx)(ChartTooltip_1.default, Object.assign({}, tooltipProps)), legend && (0, jsx_runtime_1.jsx)(recharts_1.Legend, Object.assign({}, legendProps)), areas.map(area => {
|
|
23
|
+
const areaPropsWithDefault = Object.assign(Object.assign({}, (0, Area_1.getAreaDefaultProps)()), area.props);
|
|
24
|
+
const { strokeColor, fill } = areaPropsWithDefault, remainingAreaProps = tslib_1.__rest(areaPropsWithDefault, ["strokeColor", "fill"]);
|
|
19
25
|
return ((0, react_1.createElement)(recharts_1.Area, Object.assign({}, remainingAreaProps, { key: area.key, stroke: (0, chartHelper_1.getColor)(strokeColor), fill: (0, chartHelper_1.getColor)(fill) })));
|
|
20
26
|
}), bars.map(bar => {
|
|
21
|
-
const
|
|
27
|
+
const barPropsWithDefault = Object.assign(Object.assign({}, (0, Bar_1.getBarDefaultProps)()), bar.props);
|
|
28
|
+
const { color } = barPropsWithDefault, remainingBarProps = tslib_1.__rest(barPropsWithDefault, ["color"]);
|
|
22
29
|
const cellColor = color && (0, chartHelper_1.getColor)(color);
|
|
23
30
|
return (0, jsx_runtime_1.jsx)(recharts_1.Bar, Object.assign({ unit: dataUnit }, remainingBarProps, { fill: cellColor }), bar.key);
|
|
24
31
|
}), lines.map(line => {
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
return ((0, react_1.createElement)(recharts_1.ReferenceLine, Object.assign({}, remainingReferenceLineProps, { key: referenceLine.key, stroke: (0, chartHelper_1.getColor)(stroke) })));
|
|
30
|
-
}), brush && (0, jsx_runtime_1.jsx)(recharts_1.Brush, { stroke: (0, chartHelper_1.getColor)('gray') })] })) })));
|
|
32
|
+
const linePropsWithDefault = Object.assign(Object.assign({}, (0, Line_1.getLineDefaultProps)()), line.props);
|
|
33
|
+
const { strokeColor } = linePropsWithDefault, remainingLineProps = tslib_1.__rest(linePropsWithDefault, ["strokeColor"]);
|
|
34
|
+
return ((0, react_1.createElement)(recharts_1.Line, Object.assign({}, remainingLineProps, { key: line.key, stroke: (0, chartHelper_1.getColor)(strokeColor) })));
|
|
35
|
+
}), referenceLines.map(ReferenceLine_1.renderReferenceLine), brush && (0, jsx_runtime_1.jsx)(recharts_1.Brush, { stroke: (0, chartHelper_1.getColor)('gray') })] })) })));
|
|
31
36
|
};
|
|
32
37
|
exports.default = ComposedChart;
|
|
@@ -1,12 +1,20 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import type { LineProps as RechartsLineProps } from 'recharts';
|
|
2
|
+
import type { CurveType } from 'recharts/types/shape/Curve';
|
|
3
3
|
export type LineProps = Omit<RechartsLineProps, 'ref'> & {
|
|
4
4
|
strokeColor?: string;
|
|
5
5
|
dataKey?: string;
|
|
6
6
|
unit?: string;
|
|
7
7
|
legendType?: string;
|
|
8
|
-
type?:
|
|
8
|
+
type?: CurveType;
|
|
9
9
|
isAnimationActive?: boolean;
|
|
10
10
|
};
|
|
11
|
-
declare const
|
|
11
|
+
export declare const getLineDefaultProps: () => {
|
|
12
|
+
dataKey: string;
|
|
13
|
+
unit: string;
|
|
14
|
+
strokeColor: string;
|
|
15
|
+
legendType: string;
|
|
16
|
+
type: string;
|
|
17
|
+
isAnimationActive: boolean;
|
|
18
|
+
};
|
|
19
|
+
declare const Line: (props: LineProps) => null;
|
|
12
20
|
export default Line;
|
|
@@ -1,4 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
3
|
+
exports.getLineDefaultProps = void 0;
|
|
4
|
+
const getLineDefaultProps = () => ({
|
|
5
|
+
dataKey: 'value',
|
|
6
|
+
unit: '',
|
|
7
|
+
strokeColor: 'color-coldplay-fountain',
|
|
8
|
+
legendType: 'square',
|
|
9
|
+
type: 'monotone',
|
|
10
|
+
isAnimationActive: true,
|
|
11
|
+
});
|
|
12
|
+
exports.getLineDefaultProps = getLineDefaultProps;
|
|
13
|
+
const Line = (props) => null;
|
|
4
14
|
exports.default = Line;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { LineChart as RechartsLineChart, type XAxisProps, type YAxisProps } from 'recharts';
|
|
3
|
-
import { ChartTooltipProps } from './ChartTooltip';
|
|
2
|
+
import { LineChart as RechartsLineChart, type XAxisProps, type YAxisProps, type BrushProps } from 'recharts';
|
|
3
|
+
import { type ChartTooltipProps } from './ChartTooltip';
|
|
4
4
|
import { type LegendProps } from './Legend';
|
|
5
|
-
import type
|
|
6
|
-
import type
|
|
5
|
+
import { type LineProps } from './Line';
|
|
6
|
+
import { type ReferenceLineProps } from './ReferenceLine';
|
|
7
7
|
import type { GridProps } from './ChartGrid';
|
|
8
8
|
import type { ResponsiveContainerProps } from './ResponsiveContainer';
|
|
9
9
|
type RechartsLineChartProps = React.ComponentProps<typeof RechartsLineChart>;
|
|
@@ -17,6 +17,7 @@ export type LineChartProps<T extends object> = Omit<RechartsLineChartProps, 'dat
|
|
|
17
17
|
referenceLines?: React.ReactElement<ReferenceLineProps>[];
|
|
18
18
|
xAxisOptions?: XAxisProps;
|
|
19
19
|
yAxisOptions?: YAxisProps;
|
|
20
|
+
additionalAxes?: React.ReactElement<XAxisProps | YAxisProps>[];
|
|
20
21
|
gridOptions?: GridProps;
|
|
21
22
|
containerOptions?: ResponsiveContainerProps;
|
|
22
23
|
showXAxis?: boolean;
|
|
@@ -25,6 +26,7 @@ export type LineChartProps<T extends object> = Omit<RechartsLineChartProps, 'dat
|
|
|
25
26
|
legend?: React.ReactElement<LegendProps> | boolean;
|
|
26
27
|
tooltip?: React.ReactElement<ChartTooltipProps> | boolean;
|
|
27
28
|
brush?: boolean;
|
|
29
|
+
brushOptions?: BrushProps;
|
|
28
30
|
};
|
|
29
31
|
declare const LineChart: <T extends object>(props: LineChartProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
30
32
|
export default LineChart;
|
|
@@ -10,16 +10,17 @@ const isObject_1 = tslib_1.__importDefault(require("lodash/fp/isObject"));
|
|
|
10
10
|
const chartHelper_1 = require("./chartHelper");
|
|
11
11
|
const ChartTooltip_1 = tslib_1.__importDefault(require("./ChartTooltip"));
|
|
12
12
|
const Legend_1 = require("./Legend");
|
|
13
|
+
const XAxis_1 = require("./XAxis");
|
|
14
|
+
const Line_1 = require("./Line");
|
|
15
|
+
const ReferenceLine_1 = require("./ReferenceLine");
|
|
13
16
|
const LineChart = (props) => {
|
|
14
|
-
const { width, height, data = [], dataUnit = '', dataKey = 'value', lines = [], referenceLines = [], xAxisOptions, yAxisOptions, gridOptions, containerOptions, showXAxis = true, showYAxis = false, showGrid = false, legend, brush = false, tooltip = true } = props, remainingProps = tslib_1.__rest(props, ["width", "height", "data", "dataUnit", "dataKey", "lines", "referenceLines", "xAxisOptions", "yAxisOptions", "gridOptions", "containerOptions", "showXAxis", "showYAxis", "showGrid", "legend", "brush", "tooltip"]);
|
|
17
|
+
const { width, height, data = [], dataUnit = '', dataKey = 'value', lines = [], referenceLines = [], xAxisOptions, yAxisOptions, gridOptions, containerOptions, showXAxis = true, showYAxis = false, additionalAxes = [], showGrid = false, legend, brush = false, tooltip = true, brushOptions = {} } = props, remainingProps = tslib_1.__rest(props, ["width", "height", "data", "dataUnit", "dataKey", "lines", "referenceLines", "xAxisOptions", "yAxisOptions", "gridOptions", "containerOptions", "showXAxis", "showYAxis", "additionalAxes", "showGrid", "legend", "brush", "tooltip", "brushOptions"]);
|
|
15
18
|
const tooltipProps = (0, isObject_1.default)(tooltip) ? tooltip.props : {};
|
|
16
19
|
const legendProps = (0, isObject_1.default)(legend) ? Object.assign(Object.assign({}, (0, Legend_1.getLegendDefaultProps)()), legend.props) : {};
|
|
17
|
-
return ((0, jsx_runtime_1.jsx)(recharts_1.ResponsiveContainer, Object.assign({}, containerOptions, { children: (0, jsx_runtime_1.jsxs)(recharts_1.LineChart, Object.assign({ width: width, height: height, data: data, margin: { top: 15, right: 15, left: 15, bottom: 15 } }, remainingProps, { children: [showGrid && (0, jsx_runtime_1.jsx)(recharts_1.CartesianGrid, Object.assign({ strokeDasharray: '3 3' }, (0, chartHelper_1.mapGridOptions)(gridOptions))), (0, jsx_runtime_1.jsx)(recharts_1.XAxis, Object.assign({ hide: !showXAxis, dataKey: dataKey }, xAxisOptions)), (0, jsx_runtime_1.jsx)(recharts_1.YAxis, Object.assign({ hide: !showYAxis, unit: dataUnit }, yAxisOptions)), tooltip && (0, jsx_runtime_1.jsx)(ChartTooltip_1.default, Object.assign({}, tooltipProps)), legend && (0, jsx_runtime_1.jsx)(recharts_1.Legend, Object.assign({}, legendProps)), lines.map(line => {
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
return ((0, react_1.createElement)(recharts_1.ReferenceLine, Object.assign({}, remainingReferenceLineProps, { key: referenceLine.key, stroke: (0, chartHelper_1.getColor)(stroke) })));
|
|
23
|
-
}), brush && (0, jsx_runtime_1.jsx)(recharts_1.Brush, { stroke: (0, chartHelper_1.getColor)('gray') })] })) })));
|
|
20
|
+
return ((0, jsx_runtime_1.jsx)(recharts_1.ResponsiveContainer, Object.assign({}, containerOptions, { children: (0, jsx_runtime_1.jsxs)(recharts_1.LineChart, Object.assign({ width: width, height: height, data: data, margin: { top: 15, right: 15, left: 15, bottom: 15 } }, remainingProps, { children: [showGrid && (0, jsx_runtime_1.jsx)(recharts_1.CartesianGrid, Object.assign({ strokeDasharray: '3 3' }, (0, chartHelper_1.mapGridOptions)(gridOptions))), (0, jsx_runtime_1.jsx)(recharts_1.XAxis, Object.assign({ hide: !showXAxis, dataKey: dataKey }, xAxisOptions)), (0, jsx_runtime_1.jsx)(recharts_1.YAxis, Object.assign({ hide: !showYAxis, unit: dataUnit }, yAxisOptions)), additionalAxes.map(XAxis_1.renderAxis), tooltip && (0, jsx_runtime_1.jsx)(ChartTooltip_1.default, Object.assign({}, tooltipProps)), legend && (0, jsx_runtime_1.jsx)(recharts_1.Legend, Object.assign({}, legendProps)), lines.map(line => {
|
|
21
|
+
const linePropsWithDefault = Object.assign(Object.assign({}, (0, Line_1.getLineDefaultProps)()), line.props);
|
|
22
|
+
const { strokeColor } = linePropsWithDefault, remainingLineProps = tslib_1.__rest(linePropsWithDefault, ["strokeColor"]);
|
|
23
|
+
return ((0, react_1.createElement)(recharts_1.Line, Object.assign({}, remainingLineProps, { key: line.key, stroke: (0, chartHelper_1.getColor)(strokeColor) })));
|
|
24
|
+
}), referenceLines.map(ReferenceLine_1.renderReferenceLine), brush && (0, jsx_runtime_1.jsx)(recharts_1.Brush, Object.assign({}, brushOptions, { stroke: (0, chartHelper_1.getColor)('gray') }))] })) })));
|
|
24
25
|
};
|
|
25
26
|
exports.default = LineChart;
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
import type
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type ReferenceLineProps as RechartsReferenceLineProps } from 'recharts';
|
|
3
3
|
export type ReferenceLineProps = Omit<RechartsReferenceLineProps, 'ref'> & {
|
|
4
4
|
stroke?: string;
|
|
5
5
|
};
|
|
6
|
-
declare const
|
|
7
|
-
|
|
6
|
+
export declare const getReferenceLineDefaultProps: () => {
|
|
7
|
+
stroke: string;
|
|
8
|
+
};
|
|
9
|
+
export declare const renderReferenceLine: (element: React.ReactElement<ReferenceLineProps>) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
declare const ReferenceLine: (props: ReferenceLineProps) => null;
|
|
11
|
+
export default ReferenceLine;
|
|
@@ -1,4 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
exports.renderReferenceLine = exports.getReferenceLineDefaultProps = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
// @ts-ignore-next-line importsNotUsedAsValues
|
|
7
|
+
require("react");
|
|
8
|
+
const recharts_1 = require("recharts");
|
|
9
|
+
const chartHelper_1 = require("./chartHelper");
|
|
10
|
+
const getReferenceLineDefaultProps = () => ({
|
|
11
|
+
stroke: 'color-coldplay-fountain',
|
|
12
|
+
});
|
|
13
|
+
exports.getReferenceLineDefaultProps = getReferenceLineDefaultProps;
|
|
14
|
+
const renderReferenceLine = (element) => {
|
|
15
|
+
const referenceLinePropsWithDefault = Object.assign(Object.assign({}, (0, exports.getReferenceLineDefaultProps)()), element.props);
|
|
16
|
+
const { stroke } = referenceLinePropsWithDefault, remainingReferenceLineProps = tslib_1.__rest(referenceLinePropsWithDefault, ["stroke"]);
|
|
17
|
+
return (0, react_1.createElement)(recharts_1.ReferenceLine, Object.assign({}, remainingReferenceLineProps, { key: element.key, stroke: (0, chartHelper_1.getColor)(stroke) }));
|
|
18
|
+
};
|
|
19
|
+
exports.renderReferenceLine = renderReferenceLine;
|
|
20
|
+
// This is only used for passing this as prop to the UIKIT charts wrapper.
|
|
21
|
+
// Recharts component need to be direct children of the chart itself and cannot be wrapped again
|
|
22
|
+
const ReferenceLine = (props) => null;
|
|
23
|
+
exports.default = ReferenceLine;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type XAxisProps as XAxisPropsProps } from 'recharts';
|
|
3
|
+
import { type YAxisProps } from './YAxis';
|
|
4
|
+
export type XAxisProps = Partial<XAxisPropsProps> & {};
|
|
5
|
+
export declare const renderAxis: (axis: React.ReactElement<XAxisProps | YAxisProps>, index: number) => import("react/jsx-runtime").JSX.Element | null;
|
|
6
|
+
declare const XAxis: React.FC<XAxisProps>;
|
|
7
|
+
export default XAxis;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.renderAxis = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
const react_1 = tslib_1.__importDefault(require("react"));
|
|
7
|
+
const recharts_1 = require("recharts");
|
|
8
|
+
const YAxis_1 = tslib_1.__importDefault(require("./YAxis"));
|
|
9
|
+
const renderAxis = (axis, index) => {
|
|
10
|
+
const key = `additional-axis-${index}`;
|
|
11
|
+
if (react_1.default.isValidElement(axis)) {
|
|
12
|
+
if (axis.type === XAxis) {
|
|
13
|
+
return (0, jsx_runtime_1.jsx)(recharts_1.XAxis, Object.assign({}, axis.props), key);
|
|
14
|
+
}
|
|
15
|
+
if (axis.type === YAxis_1.default) {
|
|
16
|
+
return (0, jsx_runtime_1.jsx)(recharts_1.YAxis, Object.assign({}, axis.props), key);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return null;
|
|
20
|
+
};
|
|
21
|
+
exports.renderAxis = renderAxis;
|
|
22
|
+
const XAxis = props => null;
|
|
23
|
+
exports.default = XAxis;
|
|
@@ -6,7 +6,7 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
6
6
|
require("react");
|
|
7
7
|
const framer_motion_1 = require("framer-motion");
|
|
8
8
|
const noop_1 = tslib_1.__importDefault(require("lodash/fp/noop"));
|
|
9
|
-
const DEFAULT_ANIMATION_TIME_IN_MS =
|
|
9
|
+
const DEFAULT_ANIMATION_TIME_IN_MS = 200;
|
|
10
10
|
const Collapse = (props) => {
|
|
11
11
|
const { open = false, unmountOnExit = false, appear = false, timeout = DEFAULT_ANIMATION_TIME_IN_MS, onEntered = noop_1.default, onExited = noop_1.default, onAnimationStart = noop_1.default, children, } = props;
|
|
12
12
|
const shouldKeepContentInDom = !unmountOnExit;
|
|
@@ -23,6 +23,7 @@ const Collapse = (props) => {
|
|
|
23
23
|
open: { opacity: 1, height: 'auto' },
|
|
24
24
|
collapsed: { opacity: 0, height: 0 },
|
|
25
25
|
};
|
|
26
|
-
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(framer_motion_1.AnimatePresence, Object.assign({ initial: appear, exitBeforeEnter: true }, { children: (open || shouldKeepContentInDom) && ((0, jsx_runtime_1.jsx)(framer_motion_1.motion.div, Object.assign({ initial: 'collapsed', animate: open ? 'open' : 'collapsed', exit: 'collapsed', className: 'collapse display-block width-100pct', variants: variants, transition: { duration: timeout / 1000, ease:
|
|
26
|
+
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(framer_motion_1.AnimatePresence, Object.assign({ initial: appear, exitBeforeEnter: true }, { children: (open || shouldKeepContentInDom) && ((0, jsx_runtime_1.jsx)(framer_motion_1.motion.div, Object.assign({ initial: 'collapsed', animate: open ? 'open' : 'collapsed', exit: 'collapsed', className: 'collapse display-block width-100pct', variants: variants, transition: { duration: timeout / 1000, ease: 'easeIn' }, onAnimationComplete: handleAnimationComplete, onAnimationStart: handleAnimationStart }, { children: children }), 'content')) })) }));
|
|
27
27
|
};
|
|
28
|
+
//
|
|
28
29
|
exports.default = Collapse;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type PropsWithChildren } from 'react';
|
|
2
|
+
type FadeExpanderProps = {
|
|
3
|
+
/**
|
|
4
|
+
* Defines if the content is shown or not.
|
|
5
|
+
*
|
|
6
|
+
* @default false
|
|
7
|
+
*/
|
|
8
|
+
show: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Allows customization of animation duration.
|
|
11
|
+
*
|
|
12
|
+
* @default 0.2
|
|
13
|
+
*/
|
|
14
|
+
duration?: number;
|
|
15
|
+
/**
|
|
16
|
+
* Delay in seconds before starting the animation.
|
|
17
|
+
*
|
|
18
|
+
* @default 0
|
|
19
|
+
*/
|
|
20
|
+
delay?: number;
|
|
21
|
+
/**
|
|
22
|
+
* Additional classes set to the wrapper element.
|
|
23
|
+
*/
|
|
24
|
+
className?: string;
|
|
25
|
+
};
|
|
26
|
+
declare const FadeExpander: (props: PropsWithChildren<FadeExpanderProps>) => import("react/jsx-runtime").JSX.Element;
|
|
27
|
+
export default FadeExpander;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const framer_motion_1 = require("framer-motion");
|
|
6
|
+
const THRESHOLD_TIMEOUT_MS = 200;
|
|
7
|
+
const FadeExpander = (props) => {
|
|
8
|
+
const { children, show = false, duration = 0.2, delay = 0, className = '' } = props;
|
|
9
|
+
const [isVisible, setIsVisible] = (0, react_1.useState)(show);
|
|
10
|
+
const [overflow, setOverflow] = (0, react_1.useState)('hidden'); // Start with hidden overflow
|
|
11
|
+
const durationRef = (0, react_1.useRef)(duration);
|
|
12
|
+
// Effect to manage visibility based on show prop
|
|
13
|
+
(0, react_1.useEffect)(() => {
|
|
14
|
+
if (show) {
|
|
15
|
+
// Set to visible when show is true
|
|
16
|
+
setIsVisible(true);
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
// Set overflow to hidden immediately when show is false
|
|
20
|
+
setOverflow('hidden');
|
|
21
|
+
// Delay setting isVisible to false so the overflow can change before
|
|
22
|
+
setTimeout(() => {
|
|
23
|
+
setIsVisible(false);
|
|
24
|
+
}, 0);
|
|
25
|
+
}
|
|
26
|
+
}, [show]);
|
|
27
|
+
const handleAnimationComplete = () => {
|
|
28
|
+
if (show) {
|
|
29
|
+
// Set overflow to visible after animation is done
|
|
30
|
+
setTimeout(() => setOverflow('visible'), durationRef.current * 1000 + THRESHOLD_TIMEOUT_MS);
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
return (
|
|
34
|
+
// @ts-ignore
|
|
35
|
+
(0, jsx_runtime_1.jsx)(framer_motion_1.AnimatePresence, Object.assign({ onExitComplete: () => setOverflow('hidden') }, { children: isVisible && ((0, jsx_runtime_1.jsx)(framer_motion_1.motion.div, Object.assign({ initial: { height: 0, opacity: 0 }, animate: { height: 'auto', opacity: 1 }, exit: { height: 0, opacity: 0 }, transition: {
|
|
36
|
+
height: { duration, delay },
|
|
37
|
+
opacity: { duration, delay },
|
|
38
|
+
ease: 'easeIn',
|
|
39
|
+
},
|
|
40
|
+
// To ensures smooth height transition, the overflow should be "hidden" during the animation
|
|
41
|
+
style: { overflow }, onAnimationComplete: handleAnimationComplete, className: className }, { children: children }))) })));
|
|
42
|
+
};
|
|
43
|
+
exports.default = FadeExpander;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type ComponentProps, type PropsWithChildren } from 'react';
|
|
2
|
+
type FadeUpProps = Omit<ComponentProps<'div'>, 'onAnimationStart' | 'onDragStart' | 'onDragEnd' | 'onDrag'> & {
|
|
3
|
+
/**
|
|
4
|
+
* Defines the time the animation should wait until it starts.
|
|
5
|
+
*
|
|
6
|
+
* @default 0
|
|
7
|
+
*/
|
|
8
|
+
delay?: number;
|
|
9
|
+
/**
|
|
10
|
+
* Defines the duration in seconds of the fade up animation.
|
|
11
|
+
*
|
|
12
|
+
* @default 0.4
|
|
13
|
+
*/
|
|
14
|
+
duration?: number;
|
|
15
|
+
/**
|
|
16
|
+
* Defines the y offset from the bottom where the element starts to fade in.
|
|
17
|
+
*
|
|
18
|
+
* @default 15
|
|
19
|
+
*/
|
|
20
|
+
offset?: number;
|
|
21
|
+
/**
|
|
22
|
+
* Additional classes names added to the motion div wrapper.
|
|
23
|
+
*/
|
|
24
|
+
className?: string;
|
|
25
|
+
};
|
|
26
|
+
declare const FadeUp: (props: PropsWithChildren<FadeUpProps>) => import("react/jsx-runtime").JSX.Element;
|
|
27
|
+
export default FadeUp;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const framer_motion_1 = require("framer-motion");
|
|
7
|
+
const useOnScreen_1 = tslib_1.__importDefault(require("../../hooks/useOnScreen"));
|
|
8
|
+
const FadeUp = (props) => {
|
|
9
|
+
const { delay = 0, duration = 0.4, className = '', offset = 15, children } = props, remainingProps = tslib_1.__rest(props, ["delay", "duration", "className", "offset", "children"]);
|
|
10
|
+
const ref = (0, react_1.useRef)(null);
|
|
11
|
+
const isInView = (0, useOnScreen_1.default)(ref);
|
|
12
|
+
const [isVisible, setIsVisible] = (0, react_1.useState)(false);
|
|
13
|
+
const variants = {
|
|
14
|
+
hidden: {
|
|
15
|
+
opacity: 0,
|
|
16
|
+
y: offset,
|
|
17
|
+
},
|
|
18
|
+
visible: {
|
|
19
|
+
opacity: 1,
|
|
20
|
+
y: 0,
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
(0, react_1.useEffect)(() => {
|
|
24
|
+
if (isInView && !isVisible) {
|
|
25
|
+
setIsVisible(true);
|
|
26
|
+
}
|
|
27
|
+
}, [isInView, isVisible]);
|
|
28
|
+
return ((0, jsx_runtime_1.jsx)(framer_motion_1.motion.div, Object.assign({ ref: ref, variants: variants, initial: 'hidden', animate: isVisible ? 'visible' : 'hidden', transition: { delay, type: 'spring', duration } }, remainingProps, { className: className }, { children: children })));
|
|
29
|
+
};
|
|
30
|
+
exports.default = FadeUp;
|