@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
package/FadeExpander.js
ADDED
package/FadeUp.d.ts
ADDED
package/FadeUp.js
ADDED
package/XAxis.d.ts
ADDED
package/XAxis.js
ADDED
package/YAxis.d.ts
ADDED
package/YAxis.js
ADDED
|
@@ -12,6 +12,11 @@ export type ApplicationLayoutBodyProps = {
|
|
|
12
12
|
* @default true
|
|
13
13
|
*/
|
|
14
14
|
forceScrollbar?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Prop to trigger scroll reset from outside. This comes in handy when changing the body content
|
|
17
|
+
* and to reset the scrolling like when the pathname changes from an body internal menu.
|
|
18
|
+
*/
|
|
19
|
+
scrollResetTrigger?: any;
|
|
15
20
|
/**
|
|
16
21
|
* The ApplicationLayoutBodyBanner component.
|
|
17
22
|
*/
|
|
@@ -7,11 +7,20 @@ import SmoothScrollbars from '../smoothScrollbars/SmoothScrollbars';
|
|
|
7
7
|
const RESIZE_THROTTLING = 200;
|
|
8
8
|
const DEFAULT_BOTTOM_BAR_HEIGHT = 54;
|
|
9
9
|
const ApplicationLayoutBody = forwardRef((props, ref) => {
|
|
10
|
-
const { className, innerClassName, forceScrollbar = true, enableScrollToTop = true, banner, navigation, bottomBar, bottomBarHeight = DEFAULT_BOTTOM_BAR_HEIGHT, children } = props, remainingProps = __rest(props, ["className", "innerClassName", "forceScrollbar", "enableScrollToTop", "banner", "navigation", "bottomBar", "bottomBarHeight", "children"]);
|
|
10
|
+
const { className, innerClassName, forceScrollbar = true, enableScrollToTop = true, banner, navigation, bottomBar, bottomBarHeight = DEFAULT_BOTTOM_BAR_HEIGHT, scrollResetTrigger, children } = props, remainingProps = __rest(props, ["className", "innerClassName", "forceScrollbar", "enableScrollToTop", "banner", "navigation", "bottomBar", "bottomBarHeight", "scrollResetTrigger", "children"]);
|
|
11
11
|
const [offset, setOffset] = useState(0);
|
|
12
12
|
const moduleContentRef = useRef(null);
|
|
13
13
|
const layoutBodyRef = useRef(null);
|
|
14
14
|
useImperativeHandle(ref, () => layoutBodyRef, []);
|
|
15
|
+
// Reset scroll position when children are different. This fixes the issue of
|
|
16
|
+
// changing body content (like in another route) and still having the same scroll position
|
|
17
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: <explanation>
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
if (moduleContentRef.current) {
|
|
20
|
+
moduleContentRef.current.scrollTop(0);
|
|
21
|
+
setOffset(0);
|
|
22
|
+
}
|
|
23
|
+
}, [scrollResetTrigger]);
|
|
15
24
|
useEffect(() => {
|
|
16
25
|
var _a;
|
|
17
26
|
if (((_a = layoutBodyRef.current) === null || _a === void 0 ? void 0 : _a.parentNode) instanceof HTMLElement) {
|
|
@@ -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,2 +1,10 @@
|
|
|
1
|
-
const
|
|
1
|
+
export const getAreaDefaultProps = () => ({
|
|
2
|
+
dataKey: 'value',
|
|
3
|
+
unit: '',
|
|
4
|
+
strokeColor: 'color-coldplay-fountain',
|
|
5
|
+
legendType: 'square',
|
|
6
|
+
type: 'monotone',
|
|
7
|
+
isAnimationActive: true,
|
|
8
|
+
});
|
|
9
|
+
const Area = (props) => null;
|
|
2
10
|
export 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;
|
|
@@ -3,28 +3,29 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
3
3
|
import { createElement as _createElement } from "react";
|
|
4
4
|
// @ts-ignore-next-line importsNotUsedAsValues
|
|
5
5
|
import 'react';
|
|
6
|
-
import { AreaChart as RechartsAreaChart, Area as RechartsArea,
|
|
6
|
+
import { AreaChart as RechartsAreaChart, Area as RechartsArea, Legend as RechartsLegend, Brush, CartesianGrid, ResponsiveContainer, XAxis as RechartsXAxis, YAxis as RechartsYAxis, } from 'recharts';
|
|
7
7
|
import isObject from 'lodash/fp/isObject';
|
|
8
8
|
import { getColor, mapGridOptions } from './chartHelper';
|
|
9
9
|
import AreaGradient, { DEFAULT_ARIA_GRADIENT_ID } from './AreaGradient';
|
|
10
10
|
import ChartTooltip from './ChartTooltip';
|
|
11
11
|
import { getLegendDefaultProps } from './Legend';
|
|
12
|
+
import { renderAxis } from './XAxis';
|
|
13
|
+
import { getAreaDefaultProps } from './Area';
|
|
14
|
+
import { renderReferenceLine } from './ReferenceLine';
|
|
12
15
|
const AreaChart = (props) => {
|
|
13
|
-
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 = __rest(props, ["width", "height", "data", "dataUnit", "dataKey", "gradients", "areas", "referenceLines", "xAxisOptions", "yAxisOptions", "gridOptions", "containerOptions", "showXAxis", "showYAxis", "showGrid", "legend", "brush", "tooltip"]);
|
|
16
|
+
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 = __rest(props, ["width", "height", "data", "dataUnit", "dataKey", "gradients", "areas", "referenceLines", "xAxisOptions", "yAxisOptions", "gridOptions", "containerOptions", "showXAxis", "showYAxis", "additionalAxes", "showGrid", "legend", "brush", "tooltip"]);
|
|
14
17
|
const areasWithGradient = areas.map(area => {
|
|
15
|
-
const
|
|
18
|
+
const areaPropsWithDefault = Object.assign(Object.assign({}, getAreaDefaultProps()), area.props);
|
|
19
|
+
const { strokeColor } = areaPropsWithDefault, remainingAreaProps = __rest(areaPropsWithDefault, ["strokeColor"]);
|
|
16
20
|
const gradientId = area.key;
|
|
17
21
|
const stroke = getColor(strokeColor);
|
|
18
22
|
return {
|
|
19
|
-
area: _createElement(RechartsArea, Object.assign({}, remainingAreaProps, { key: area.key, stroke: stroke, fill: `url(#${gradientId})` })),
|
|
23
|
+
area: (_createElement(RechartsArea, Object.assign({}, remainingAreaProps, { key: area.key, stroke: stroke, fill: `url(#${gradientId})` }))),
|
|
20
24
|
gradient: _jsx(AreaGradient, { id: gradientId || DEFAULT_ARIA_GRADIENT_ID, color: strokeColor }, area.key),
|
|
21
25
|
};
|
|
22
26
|
});
|
|
23
27
|
const tooltipProps = isObject(tooltip) ? tooltip.props : {};
|
|
24
28
|
const legendProps = isObject(legend) ? Object.assign(Object.assign({}, getLegendDefaultProps()), legend.props) : {};
|
|
25
|
-
return (_jsx(ResponsiveContainer, Object.assign({}, containerOptions, { children: _jsxs(RechartsAreaChart, Object.assign({ width: width, height: height, data: data, margin: { top: 15, right: 15, left: 15, bottom: 15 } }, remainingProps, { children: [_jsxs("defs", { children: [gradients, areasWithGradient.map(areaWithGradient => areaWithGradient.gradient)] }), showGrid && _jsx(CartesianGrid, Object.assign({ strokeDasharray: '3 3' }, mapGridOptions(gridOptions))), _jsx(
|
|
26
|
-
const _a = referenceLine.props, { stroke } = _a, remainingReferenceLineProps = __rest(_a, ["stroke"]);
|
|
27
|
-
return (_createElement(RechartsReferenceLine, Object.assign({}, remainingReferenceLineProps, { key: referenceLine.key, stroke: getColor(stroke) })));
|
|
28
|
-
}), brush && _jsx(Brush, { stroke: getColor('gray') })] })) })));
|
|
29
|
+
return (_jsx(ResponsiveContainer, Object.assign({}, containerOptions, { children: _jsxs(RechartsAreaChart, Object.assign({ width: width, height: height, data: data, margin: { top: 15, right: 15, left: 15, bottom: 15 } }, remainingProps, { children: [_jsxs("defs", { children: [gradients, areasWithGradient.map(areaWithGradient => areaWithGradient.gradient)] }), showGrid && _jsx(CartesianGrid, Object.assign({ strokeDasharray: '3 3' }, mapGridOptions(gridOptions))), _jsx(RechartsXAxis, Object.assign({ hide: !showXAxis, dataKey: dataKey }, xAxisOptions)), _jsx(RechartsYAxis, Object.assign({ hide: !showYAxis, unit: dataUnit }, yAxisOptions)), additionalAxes.map(renderAxis), tooltip && _jsx(ChartTooltip, Object.assign({}, tooltipProps)), legend && legendProps && (_jsx(_Fragment, { children: _jsx(RechartsLegend, Object.assign({ wrapperStyle: legendProps.verticalAlign === 'bottom' ? { bottom: 0 } : legendProps.wrapperStyle }, legendProps)) })), areasWithGradient.map(areaWithGradient => areaWithGradient.area), referenceLines.map(renderReferenceLine), brush && _jsx(Brush, { stroke: getColor('gray') })] })) })));
|
|
29
30
|
};
|
|
30
31
|
export 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;
|
package/components/charts/Bar.js
CHANGED
|
@@ -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;
|
|
@@ -2,14 +2,16 @@ import { __rest } from "tslib";
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
// @ts-ignore-next-line importsNotUsedAsValues
|
|
4
4
|
import 'react';
|
|
5
|
-
import { BarChart as RechartsBarChart, Bar as RechartsBar, Legend as RechartsLegend,
|
|
5
|
+
import { BarChart as RechartsBarChart, Bar as RechartsBar, Legend as RechartsLegend, Brush, Cell, CartesianGrid, ResponsiveContainer, XAxis as RechartsXAxis, YAxis as RechartsYAxis, } from 'recharts';
|
|
6
6
|
import isFunction from 'lodash/fp/isFunction';
|
|
7
7
|
import isObject from 'lodash/fp/isObject';
|
|
8
8
|
import { getFromDefaultColors, getColor, mapGridOptions, CURSOR_BACKGROUND_COLOR } from './chartHelper';
|
|
9
9
|
import ChartTooltip from './ChartTooltip';
|
|
10
10
|
import { getLegendDefaultProps } from './Legend';
|
|
11
|
+
import { renderAxis } from './XAxis';
|
|
12
|
+
import { getBarDefaultProps } from './Bar';
|
|
11
13
|
const BarChart = (props) => {
|
|
12
|
-
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 = __rest(props, ["width", "height", "data", "dataUnit", "dataKey", "layout", "legend", "bars", "xAxisOptions", "yAxisOptions", "gridOptions", "containerOptions", "showGrid", "showXAxis", "showYAxis", "useDataColors", "brush", "tooltip"]);
|
|
14
|
+
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 = __rest(props, ["width", "height", "data", "dataUnit", "dataKey", "layout", "legend", "bars", "xAxisOptions", "yAxisOptions", "additionalAxes", "gridOptions", "containerOptions", "showGrid", "showXAxis", "showYAxis", "useDataColors", "brush", "tooltip"]);
|
|
13
15
|
const tooltipProps = isObject(tooltip) ? tooltip.props : {};
|
|
14
16
|
const legendProps = isObject(legend) ? Object.assign(Object.assign({}, getLegendDefaultProps()), legend.props) : {};
|
|
15
17
|
let legendPayload;
|
|
@@ -19,12 +21,14 @@ const BarChart = (props) => {
|
|
|
19
21
|
return Object.assign(Object.assign({}, entry), { value: isFunction(dataKey) ? dataKey(entry) : entry[dataKey], color: legendColor });
|
|
20
22
|
});
|
|
21
23
|
}
|
|
22
|
-
return (_jsx(ResponsiveContainer, Object.assign({}, containerOptions, { children: _jsxs(RechartsBarChart, Object.assign({ layout: layout, width: width, height: height, data: data }, remainingProps, { children: [showGrid && _jsx(CartesianGrid, Object.assign({ strokeDasharray: '3 3' }, mapGridOptions(gridOptions))), _jsx(
|
|
23
|
-
const
|
|
24
|
+
return (_jsx(ResponsiveContainer, Object.assign({}, containerOptions, { children: _jsxs(RechartsBarChart, Object.assign({ layout: layout, width: width, height: height, data: data }, remainingProps, { children: [showGrid && _jsx(CartesianGrid, Object.assign({ strokeDasharray: '3 3' }, mapGridOptions(gridOptions))), _jsx(RechartsXAxis, Object.assign({ hide: !showXAxis, dataKey: dataKey }, xAxisOptions)), _jsx(RechartsYAxis, Object.assign({ hide: !showYAxis, unit: dataUnit }, yAxisOptions)), additionalAxes.map(renderAxis), tooltip && _jsx(ChartTooltip, Object.assign({ cursor: { fill: CURSOR_BACKGROUND_COLOR } }, tooltipProps)), legend && _jsx(RechartsLegend, Object.assign({ payload: useDataColors ? legendPayload : undefined }, legendProps)), bars.map(bar => {
|
|
25
|
+
const barPropsWithDefault = Object.assign(Object.assign({}, getBarDefaultProps()), bar.props);
|
|
26
|
+
const { color } = barPropsWithDefault, remainingBarProps = __rest(barPropsWithDefault, ["color"]);
|
|
24
27
|
const cellColor = color && getColor(color);
|
|
25
28
|
return (_jsx(RechartsBar, Object.assign({ unit: dataUnit }, remainingBarProps, { fill: cellColor }, { children: useDataColors &&
|
|
26
29
|
data.map((entry, index) => {
|
|
27
30
|
const entryCellColor = getColor(entry.color) || getFromDefaultColors(index);
|
|
31
|
+
// biome-ignore lint/suspicious/noArrayIndexKey: unknown key
|
|
28
32
|
return _jsx(Cell, { fill: entryCellColor }, `cell-${index}`);
|
|
29
33
|
}) }), bar.key));
|
|
30
34
|
}), brush && _jsx(Brush, { stroke: 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;
|
|
@@ -3,28 +3,33 @@ import { createElement as _createElement } from "react";
|
|
|
3
3
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
4
4
|
// @ts-ignore-next-line importsNotUsedAsValues
|
|
5
5
|
import 'react';
|
|
6
|
-
import { ComposedChart as RechartsComposedChart, Line as RechartsLine, Bar as RechartsBar, Area as RechartsArea,
|
|
6
|
+
import { ComposedChart as RechartsComposedChart, Line as RechartsLine, Bar as RechartsBar, Area as RechartsArea, Legend as RechartsLegend, Brush, CartesianGrid, ResponsiveContainer, XAxis as RechartsXAxis, YAxis as RechartsYAxis, } from 'recharts';
|
|
7
7
|
import isObject from 'lodash/fp/isObject';
|
|
8
8
|
import { getColor, mapGridOptions } from './chartHelper';
|
|
9
9
|
import ChartTooltip from './ChartTooltip';
|
|
10
10
|
import { getLegendDefaultProps } from './Legend';
|
|
11
|
+
import { renderAxis } from './XAxis';
|
|
12
|
+
import { getBarDefaultProps } from './Bar';
|
|
13
|
+
import { renderReferenceLine } from './ReferenceLine';
|
|
14
|
+
import { getLineDefaultProps } from './Line';
|
|
15
|
+
import { getAreaDefaultProps } from './Area';
|
|
11
16
|
const ComposedChart = (props) => {
|
|
12
|
-
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 = __rest(props, ["width", "height", "data", "dataUnit", "dataKey", "lines", "bars", "areas", "referenceLines", "xAxisOptions", "yAxisOptions", "gridOptions", "containerOptions", "showXAxis", "showYAxis", "showGrid", "legend", "brush", "tooltip"]);
|
|
17
|
+
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 = __rest(props, ["width", "height", "data", "dataUnit", "dataKey", "lines", "bars", "areas", "referenceLines", "xAxisOptions", "yAxisOptions", "additionalAxes", "gridOptions", "containerOptions", "showXAxis", "showYAxis", "showGrid", "legend", "brush", "tooltip"]);
|
|
13
18
|
const tooltipProps = isObject(tooltip) ? tooltip.props : {};
|
|
14
19
|
const legendProps = isObject(legend) ? Object.assign(Object.assign({}, getLegendDefaultProps()), legend.props) : {};
|
|
15
|
-
return (_jsx(ResponsiveContainer, Object.assign({}, containerOptions, { children: _jsxs(RechartsComposedChart, Object.assign({ width: width, height: height, data: data, margin: { top: 15, right: 15, left: 15, bottom: 15 } }, remainingProps, { children: [showGrid && _jsx(CartesianGrid, Object.assign({ strokeDasharray: '3 3' }, mapGridOptions(gridOptions))), _jsx(
|
|
16
|
-
const
|
|
20
|
+
return (_jsx(ResponsiveContainer, Object.assign({}, containerOptions, { children: _jsxs(RechartsComposedChart, Object.assign({ width: width, height: height, data: data, margin: { top: 15, right: 15, left: 15, bottom: 15 } }, remainingProps, { children: [showGrid && _jsx(CartesianGrid, Object.assign({ strokeDasharray: '3 3' }, mapGridOptions(gridOptions))), _jsx(RechartsXAxis, Object.assign({ hide: !showXAxis, dataKey: dataKey }, xAxisOptions)), _jsx(RechartsYAxis, Object.assign({ hide: !showYAxis, unit: dataUnit }, yAxisOptions)), additionalAxes.map(renderAxis), tooltip && _jsx(ChartTooltip, Object.assign({}, tooltipProps)), legend && _jsx(RechartsLegend, Object.assign({}, legendProps)), areas.map(area => {
|
|
21
|
+
const areaPropsWithDefault = Object.assign(Object.assign({}, getAreaDefaultProps()), area.props);
|
|
22
|
+
const { strokeColor, fill } = areaPropsWithDefault, remainingAreaProps = __rest(areaPropsWithDefault, ["strokeColor", "fill"]);
|
|
17
23
|
return (_createElement(RechartsArea, Object.assign({}, remainingAreaProps, { key: area.key, stroke: getColor(strokeColor), fill: getColor(fill) })));
|
|
18
24
|
}), bars.map(bar => {
|
|
19
|
-
const
|
|
25
|
+
const barPropsWithDefault = Object.assign(Object.assign({}, getBarDefaultProps()), bar.props);
|
|
26
|
+
const { color } = barPropsWithDefault, remainingBarProps = __rest(barPropsWithDefault, ["color"]);
|
|
20
27
|
const cellColor = color && getColor(color);
|
|
21
28
|
return _jsx(RechartsBar, Object.assign({ unit: dataUnit }, remainingBarProps, { fill: cellColor }), bar.key);
|
|
22
29
|
}), lines.map(line => {
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
return (_createElement(RechartsReferenceLine, Object.assign({}, remainingReferenceLineProps, { key: referenceLine.key, stroke: getColor(stroke) })));
|
|
28
|
-
}), brush && _jsx(Brush, { stroke: getColor('gray') })] })) })));
|
|
30
|
+
const linePropsWithDefault = Object.assign(Object.assign({}, getLineDefaultProps()), line.props);
|
|
31
|
+
const { strokeColor } = linePropsWithDefault, remainingLineProps = __rest(linePropsWithDefault, ["strokeColor"]);
|
|
32
|
+
return (_createElement(RechartsLine, Object.assign({}, remainingLineProps, { key: line.key, stroke: getColor(strokeColor) })));
|
|
33
|
+
}), referenceLines.map(renderReferenceLine), brush && _jsx(Brush, { stroke: getColor('gray') })] })) })));
|
|
29
34
|
};
|
|
30
35
|
export 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,2 +1,10 @@
|
|
|
1
|
-
const
|
|
1
|
+
export const getLineDefaultProps = () => ({
|
|
2
|
+
dataKey: 'value',
|
|
3
|
+
unit: '',
|
|
4
|
+
strokeColor: 'color-coldplay-fountain',
|
|
5
|
+
legendType: 'square',
|
|
6
|
+
type: 'monotone',
|
|
7
|
+
isAnimationActive: true,
|
|
8
|
+
});
|
|
9
|
+
const Line = (props) => null;
|
|
2
10
|
export 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;
|
|
@@ -3,21 +3,22 @@ import { createElement as _createElement } from "react";
|
|
|
3
3
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
4
4
|
// @ts-ignore-next-line importsNotUsedAsValues
|
|
5
5
|
import 'react';
|
|
6
|
-
import { LineChart as RechartsLineChart, Line as RechartsLine,
|
|
6
|
+
import { LineChart as RechartsLineChart, Line as RechartsLine, Legend as RechartsLegend, Brush, CartesianGrid, ResponsiveContainer, XAxis as RechartsXAxis, YAxis as RechartsYAxis, } from 'recharts';
|
|
7
7
|
import isObject from 'lodash/fp/isObject';
|
|
8
8
|
import { getColor, mapGridOptions } from './chartHelper';
|
|
9
9
|
import ChartTooltip from './ChartTooltip';
|
|
10
10
|
import { getLegendDefaultProps } from './Legend';
|
|
11
|
+
import { renderAxis } from './XAxis';
|
|
12
|
+
import { getLineDefaultProps } from './Line';
|
|
13
|
+
import { renderReferenceLine } from './ReferenceLine';
|
|
11
14
|
const LineChart = (props) => {
|
|
12
|
-
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 = __rest(props, ["width", "height", "data", "dataUnit", "dataKey", "lines", "referenceLines", "xAxisOptions", "yAxisOptions", "gridOptions", "containerOptions", "showXAxis", "showYAxis", "showGrid", "legend", "brush", "tooltip"]);
|
|
15
|
+
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 = __rest(props, ["width", "height", "data", "dataUnit", "dataKey", "lines", "referenceLines", "xAxisOptions", "yAxisOptions", "gridOptions", "containerOptions", "showXAxis", "showYAxis", "additionalAxes", "showGrid", "legend", "brush", "tooltip", "brushOptions"]);
|
|
13
16
|
const tooltipProps = isObject(tooltip) ? tooltip.props : {};
|
|
14
17
|
const legendProps = isObject(legend) ? Object.assign(Object.assign({}, getLegendDefaultProps()), legend.props) : {};
|
|
15
|
-
return (_jsx(ResponsiveContainer, Object.assign({}, containerOptions, { children: _jsxs(RechartsLineChart, Object.assign({ width: width, height: height, data: data, margin: { top: 15, right: 15, left: 15, bottom: 15 } }, remainingProps, { children: [showGrid && _jsx(CartesianGrid, Object.assign({ strokeDasharray: '3 3' }, mapGridOptions(gridOptions))), _jsx(
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
return (_createElement(RechartsReferenceLine, Object.assign({}, remainingReferenceLineProps, { key: referenceLine.key, stroke: getColor(stroke) })));
|
|
21
|
-
}), brush && _jsx(Brush, { stroke: getColor('gray') })] })) })));
|
|
18
|
+
return (_jsx(ResponsiveContainer, Object.assign({}, containerOptions, { children: _jsxs(RechartsLineChart, Object.assign({ width: width, height: height, data: data, margin: { top: 15, right: 15, left: 15, bottom: 15 } }, remainingProps, { children: [showGrid && _jsx(CartesianGrid, Object.assign({ strokeDasharray: '3 3' }, mapGridOptions(gridOptions))), _jsx(RechartsXAxis, Object.assign({ hide: !showXAxis, dataKey: dataKey }, xAxisOptions)), _jsx(RechartsYAxis, Object.assign({ hide: !showYAxis, unit: dataUnit }, yAxisOptions)), additionalAxes.map(renderAxis), tooltip && _jsx(ChartTooltip, Object.assign({}, tooltipProps)), legend && _jsx(RechartsLegend, Object.assign({}, legendProps)), lines.map(line => {
|
|
19
|
+
const linePropsWithDefault = Object.assign(Object.assign({}, getLineDefaultProps()), line.props);
|
|
20
|
+
const { strokeColor } = linePropsWithDefault, remainingLineProps = __rest(linePropsWithDefault, ["strokeColor"]);
|
|
21
|
+
return (_createElement(RechartsLine, Object.assign({}, remainingLineProps, { key: line.key, stroke: getColor(strokeColor) })));
|
|
22
|
+
}), referenceLines.map(renderReferenceLine), brush && _jsx(Brush, Object.assign({}, brushOptions, { stroke: getColor('gray') }))] })) })));
|
|
22
23
|
};
|
|
23
24
|
export 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,2 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { __rest } from "tslib";
|
|
2
|
+
import { createElement as _createElement } from "react";
|
|
3
|
+
// @ts-ignore-next-line importsNotUsedAsValues
|
|
4
|
+
import 'react';
|
|
5
|
+
import { ReferenceLine as RechartsReferenceLine, } from 'recharts';
|
|
6
|
+
import { getColor } from './chartHelper';
|
|
7
|
+
export const getReferenceLineDefaultProps = () => ({
|
|
8
|
+
stroke: 'color-coldplay-fountain',
|
|
9
|
+
});
|
|
10
|
+
export const renderReferenceLine = (element) => {
|
|
11
|
+
const referenceLinePropsWithDefault = Object.assign(Object.assign({}, getReferenceLineDefaultProps()), element.props);
|
|
12
|
+
const { stroke } = referenceLinePropsWithDefault, remainingReferenceLineProps = __rest(referenceLinePropsWithDefault, ["stroke"]);
|
|
13
|
+
return _createElement(RechartsReferenceLine, Object.assign({}, remainingReferenceLineProps, { key: element.key, stroke: getColor(stroke) }));
|
|
14
|
+
};
|
|
15
|
+
// This is only used for passing this as prop to the UIKIT charts wrapper.
|
|
16
|
+
// Recharts component need to be direct children of the chart itself and cannot be wrapped again
|
|
17
|
+
const ReferenceLine = (props) => null;
|
|
18
|
+
export 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,18 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { XAxis as RechartsXAxis, YAxis as RechartsYAxis } from 'recharts';
|
|
4
|
+
import YAxis from './YAxis';
|
|
5
|
+
export const renderAxis = (axis, index) => {
|
|
6
|
+
const key = `additional-axis-${index}`;
|
|
7
|
+
if (React.isValidElement(axis)) {
|
|
8
|
+
if (axis.type === XAxis) {
|
|
9
|
+
return _jsx(RechartsXAxis, Object.assign({}, axis.props), key);
|
|
10
|
+
}
|
|
11
|
+
if (axis.type === YAxis) {
|
|
12
|
+
return _jsx(RechartsYAxis, Object.assign({}, axis.props), key);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
return null;
|
|
16
|
+
};
|
|
17
|
+
const XAxis = props => null;
|
|
18
|
+
export default XAxis;
|
|
@@ -3,7 +3,7 @@ import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
|
3
3
|
import 'react';
|
|
4
4
|
import { motion, AnimatePresence } from 'framer-motion';
|
|
5
5
|
import noop from 'lodash/fp/noop';
|
|
6
|
-
const DEFAULT_ANIMATION_TIME_IN_MS =
|
|
6
|
+
const DEFAULT_ANIMATION_TIME_IN_MS = 200;
|
|
7
7
|
const Collapse = (props) => {
|
|
8
8
|
const { open = false, unmountOnExit = false, appear = false, timeout = DEFAULT_ANIMATION_TIME_IN_MS, onEntered = noop, onExited = noop, onAnimationStart = noop, children, } = props;
|
|
9
9
|
const shouldKeepContentInDom = !unmountOnExit;
|
|
@@ -20,6 +20,7 @@ const Collapse = (props) => {
|
|
|
20
20
|
open: { opacity: 1, height: 'auto' },
|
|
21
21
|
collapsed: { opacity: 0, height: 0 },
|
|
22
22
|
};
|
|
23
|
-
return (_jsx(_Fragment, { children: _jsx(AnimatePresence, Object.assign({ initial: appear, exitBeforeEnter: true }, { children: (open || shouldKeepContentInDom) && (_jsx(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:
|
|
23
|
+
return (_jsx(_Fragment, { children: _jsx(AnimatePresence, Object.assign({ initial: appear, exitBeforeEnter: true }, { children: (open || shouldKeepContentInDom) && (_jsx(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')) })) }));
|
|
24
24
|
};
|
|
25
|
+
//
|
|
25
26
|
export 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;
|