@rio-cloud/rio-uikit 1.3.0 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ChartLabel.d.ts +2 -0
- package/ChartLabel.js +2 -0
- package/ComposedChart.d.ts +2 -0
- package/ComposedChart.js +2 -0
- package/GroupedItemList.d.ts +2 -0
- package/GroupedItemList.js +2 -0
- package/LicensePlate.d.ts +2 -0
- package/LicensePlate.js +2 -0
- package/ReferenceLine.d.ts +2 -0
- package/ReferenceLine.js +2 -0
- package/components/assetTree/TreeOptions.js +7 -3
- package/components/charts/Area.d.ts +5 -0
- package/components/charts/Area.js +1 -9
- package/components/charts/AreaChart.d.ts +2 -0
- package/components/charts/AreaChart.js +9 -6
- package/components/charts/BarChart.js +4 -4
- package/components/charts/ChartLabel.d.ts +5 -0
- package/components/charts/ChartLabel.js +2 -0
- package/components/charts/ComposedChart.d.ts +34 -0
- package/components/charts/ComposedChart.js +30 -0
- package/components/charts/Legend.d.ts +8 -10
- package/components/charts/Legend.js +3 -12
- package/components/charts/Line.d.ts +5 -0
- package/components/charts/Line.js +1 -9
- package/components/charts/LineChart.d.ts +2 -0
- package/components/charts/LineChart.js +8 -5
- package/components/charts/PieChart.js +5 -5
- package/components/charts/RadialBarChart.js +5 -5
- package/components/charts/ReferenceLine.d.ts +7 -0
- package/components/charts/ReferenceLine.js +2 -0
- package/components/dialog/Dialog.d.ts +12 -4
- package/components/dialog/SplitDialog.d.ts +3 -3
- package/components/groupedItemList/GroupedItemList.d.ts +79 -0
- package/components/groupedItemList/GroupedItemList.js +77 -0
- package/components/licensePlate/LicensePlate.d.ts +19 -0
- package/components/licensePlate/LicensePlate.js +14 -0
- package/components/selects/BaseSelectDropdown.d.ts +1 -0
- package/components/selects/BaseSelectDropdown.js +16 -14
- package/components/selects/Multiselect.d.ts +5 -0
- package/components/selects/Multiselect.js +2 -2
- package/components/selects/Select.d.ts +5 -0
- package/components/selects/Select.js +2 -2
- package/hooks/useKey.d.ts +7 -4
- package/hooks/useKey.js +36 -8
- package/lib/es/ChartLabel.d.ts +2 -0
- package/lib/es/ChartLabel.js +7 -0
- package/lib/es/ComposedChart.d.ts +2 -0
- package/lib/es/ComposedChart.js +7 -0
- package/lib/es/GroupedItemList.d.ts +2 -0
- package/lib/es/GroupedItemList.js +7 -0
- package/lib/es/LicensePlate.d.ts +2 -0
- package/lib/es/LicensePlate.js +7 -0
- package/lib/es/ReferenceLine.d.ts +2 -0
- package/lib/es/ReferenceLine.js +7 -0
- package/lib/es/components/assetTree/TreeOptions.js +7 -3
- package/lib/es/components/charts/Area.d.ts +5 -0
- package/lib/es/components/charts/Area.js +1 -9
- package/lib/es/components/charts/AreaChart.d.ts +2 -0
- package/lib/es/components/charts/AreaChart.js +7 -4
- package/lib/es/components/charts/BarChart.js +3 -3
- package/lib/es/components/charts/ChartLabel.d.ts +5 -0
- package/lib/es/components/charts/ChartLabel.js +4 -0
- package/lib/es/components/charts/ComposedChart.d.ts +34 -0
- package/lib/es/components/charts/ComposedChart.js +32 -0
- package/lib/es/components/charts/Legend.d.ts +8 -10
- package/lib/es/components/charts/Legend.js +5 -12
- package/lib/es/components/charts/Line.d.ts +5 -0
- package/lib/es/components/charts/Line.js +1 -9
- package/lib/es/components/charts/LineChart.d.ts +2 -0
- package/lib/es/components/charts/LineChart.js +7 -4
- package/lib/es/components/charts/PieChart.js +4 -4
- package/lib/es/components/charts/RadialBarChart.js +4 -4
- package/lib/es/components/charts/ReferenceLine.d.ts +7 -0
- package/lib/es/components/charts/ReferenceLine.js +4 -0
- package/lib/es/components/dialog/Dialog.d.ts +12 -4
- package/lib/es/components/dialog/SplitDialog.d.ts +3 -3
- package/lib/es/components/groupedItemList/GroupedItemList.d.ts +79 -0
- package/lib/es/components/groupedItemList/GroupedItemList.js +80 -0
- package/lib/es/components/licensePlate/LicensePlate.d.ts +19 -0
- package/lib/es/components/licensePlate/LicensePlate.js +16 -0
- package/lib/es/components/selects/BaseSelectDropdown.d.ts +1 -0
- package/lib/es/components/selects/BaseSelectDropdown.js +16 -14
- package/lib/es/components/selects/Multiselect.d.ts +5 -0
- package/lib/es/components/selects/Multiselect.js +2 -2
- package/lib/es/components/selects/Select.d.ts +5 -0
- package/lib/es/components/selects/Select.js +2 -2
- package/lib/es/hooks/useKey.d.ts +7 -4
- package/lib/es/hooks/useKey.js +35 -7
- package/lib/es/utils/colorScheme.js +10 -8
- package/lib/es/version.json +1 -1
- package/package.json +11 -11
- package/utils/colorScheme.js +10 -8
- package/version.json +1 -1
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ComposedChart as RechartsComposedChart, type XAxisProps, type YAxisProps } from 'recharts';
|
|
3
|
+
import { ChartTooltipProps } from './ChartTooltip';
|
|
4
|
+
import { type LegendProps } from './Legend';
|
|
5
|
+
import type { LineProps } from './Line';
|
|
6
|
+
import type { BarProps } from './Bar';
|
|
7
|
+
import type { ReferenceLineProps } from './ReferenceLine';
|
|
8
|
+
import type { GridProps } from './ChartGrid';
|
|
9
|
+
import type { ResponsiveContainerProps } from './ResponsiveContainer';
|
|
10
|
+
import type { AreaProps } from './Area';
|
|
11
|
+
type RechartsComposedChartProps = React.ComponentProps<typeof RechartsComposedChart>;
|
|
12
|
+
export type ComposedChartProps<T extends object> = Omit<RechartsComposedChartProps, 'data'> & {
|
|
13
|
+
width?: number;
|
|
14
|
+
height?: number;
|
|
15
|
+
data: T[];
|
|
16
|
+
dataUnit?: string;
|
|
17
|
+
dataKey?: string | number | ((obj: T) => any);
|
|
18
|
+
lines?: React.ReactElement<LineProps>[];
|
|
19
|
+
bars?: React.ReactElement<BarProps>[];
|
|
20
|
+
areas?: React.ReactElement<AreaProps>[];
|
|
21
|
+
referenceLines?: React.ReactElement<ReferenceLineProps>[];
|
|
22
|
+
xAxisOptions?: XAxisProps;
|
|
23
|
+
yAxisOptions?: YAxisProps;
|
|
24
|
+
gridOptions?: GridProps;
|
|
25
|
+
containerOptions?: ResponsiveContainerProps;
|
|
26
|
+
showXAxis?: boolean;
|
|
27
|
+
showYAxis?: boolean;
|
|
28
|
+
showGrid?: boolean;
|
|
29
|
+
legend?: React.ReactElement<LegendProps> | boolean;
|
|
30
|
+
tooltip?: React.ReactElement<ChartTooltipProps> | boolean;
|
|
31
|
+
brush?: boolean;
|
|
32
|
+
};
|
|
33
|
+
declare const ComposedChart: <T extends object>(props: ComposedChartProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
34
|
+
export default ComposedChart;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
// @ts-ignore-next-line importsNotUsedAsValues
|
|
7
|
+
require("react");
|
|
8
|
+
const recharts_1 = require("recharts");
|
|
9
|
+
const isObject_1 = tslib_1.__importDefault(require("lodash/fp/isObject"));
|
|
10
|
+
const chartHelper_1 = require("./chartHelper");
|
|
11
|
+
const ChartTooltip_1 = tslib_1.__importDefault(require("./ChartTooltip"));
|
|
12
|
+
const Legend_1 = require("./Legend");
|
|
13
|
+
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"]);
|
|
15
|
+
const tooltipProps = (0, isObject_1.default)(tooltip) ? tooltip.props : {};
|
|
16
|
+
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 _a = area.props, { strokeColor, fill } = _a, remainingAreaProps = tslib_1.__rest(_a, ["strokeColor", "fill"]);
|
|
19
|
+
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
|
+
}), bars.map(bar => {
|
|
21
|
+
const _a = bar.props, { color } = _a, remainingBarProps = tslib_1.__rest(_a, ["color"]);
|
|
22
|
+
const cellColor = color && (0, chartHelper_1.getColor)(color);
|
|
23
|
+
return (0, jsx_runtime_1.jsx)(recharts_1.Bar, Object.assign({ unit: dataUnit }, remainingBarProps, { fill: cellColor }), bar.key);
|
|
24
|
+
}), lines.map(line => {
|
|
25
|
+
const _a = line.props, { strokeColor } = _a, remainingLineProps = tslib_1.__rest(_a, ["strokeColor"]);
|
|
26
|
+
return (0, react_1.createElement)(recharts_1.Line, Object.assign({}, remainingLineProps, { key: line.key, stroke: (0, chartHelper_1.getColor)(strokeColor) }));
|
|
27
|
+
}), referenceLines.map(referenceLine => {
|
|
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
|
+
};
|
|
32
|
+
exports.default = ComposedChart;
|
|
@@ -1,18 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { LegendProps as RechartsLegendProps } from 'recharts';
|
|
2
2
|
import type { Formatter, Payload } from 'recharts/types/component/DefaultLegendContent';
|
|
3
3
|
export type LegendFormatter = Formatter;
|
|
4
4
|
export type LegendPayload = Payload;
|
|
5
5
|
export type LegendProps = Omit<RechartsLegendProps, 'ref' | 'formatter'> & {
|
|
6
6
|
formatter?: (value: any, entry: any, index: number) => void;
|
|
7
7
|
};
|
|
8
|
-
declare const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
align: string;
|
|
15
|
-
verticalAlign: string;
|
|
16
|
-
};
|
|
8
|
+
export declare const getLegendDefaultProps: () => {
|
|
9
|
+
iconType: string;
|
|
10
|
+
iconSize: number;
|
|
11
|
+
layout: string;
|
|
12
|
+
align: string;
|
|
13
|
+
verticalAlign: string;
|
|
17
14
|
};
|
|
15
|
+
declare const Legend: (props: LegendProps) => null;
|
|
18
16
|
export default Legend;
|
|
@@ -1,22 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
3
|
+
exports.getLegendDefaultProps = void 0;
|
|
4
4
|
// @ts-ignore-next-line importsNotUsedAsValues
|
|
5
5
|
require("react");
|
|
6
|
-
const
|
|
7
|
-
const Legend = (props) => {
|
|
8
|
-
const { verticalAlign, wrapperStyle } = props;
|
|
9
|
-
return ((0, jsx_runtime_1.jsx)(recharts_1.Legend
|
|
10
|
-
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
|
|
11
|
-
, Object.assign({
|
|
12
|
-
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
|
|
13
|
-
formatter: props.formatter, wrapperStyle: verticalAlign === 'bottom' ? { bottom: 0 } : wrapperStyle }, props)));
|
|
14
|
-
};
|
|
15
|
-
Legend.defaultProps = {
|
|
6
|
+
const getLegendDefaultProps = () => ({
|
|
16
7
|
iconType: 'circle',
|
|
17
8
|
iconSize: 12,
|
|
18
9
|
layout: 'vertical',
|
|
19
10
|
align: 'right',
|
|
20
11
|
verticalAlign: 'top',
|
|
21
|
-
};
|
|
12
|
+
});
|
|
13
|
+
exports.getLegendDefaultProps = getLegendDefaultProps;
|
|
14
|
+
const Legend = (props) => null;
|
|
22
15
|
exports.default = Legend;
|
|
@@ -2,6 +2,11 @@
|
|
|
2
2
|
import type { LineProps as RechartsLineProps } from 'recharts';
|
|
3
3
|
export type LineProps = Omit<RechartsLineProps, 'ref'> & {
|
|
4
4
|
strokeColor?: string;
|
|
5
|
+
dataKey?: string;
|
|
6
|
+
unit?: string;
|
|
7
|
+
legendType?: string;
|
|
8
|
+
type?: string;
|
|
9
|
+
isAnimationActive?: boolean;
|
|
5
10
|
};
|
|
6
11
|
declare const Line: React.FC<LineProps>;
|
|
7
12
|
export default Line;
|
|
@@ -1,12 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const Line = () => null;
|
|
4
|
-
Line.defaultProps = {
|
|
5
|
-
dataKey: 'value',
|
|
6
|
-
unit: '',
|
|
7
|
-
strokeColor: 'color-coldplay-fountain',
|
|
8
|
-
legendType: 'square',
|
|
9
|
-
type: 'monotone',
|
|
10
|
-
isAnimationActive: true,
|
|
11
|
-
};
|
|
3
|
+
const Line = ({ dataKey = 'value', unit = '', strokeColor = 'color-coldplay-fountain', legendType = 'square', type = 'monotone', isAnimationActive = true, }) => null;
|
|
12
4
|
exports.default = Line;
|
|
@@ -3,6 +3,7 @@ import { LineChart as RechartsLineChart, type XAxisProps, type YAxisProps } from
|
|
|
3
3
|
import { ChartTooltipProps } from './ChartTooltip';
|
|
4
4
|
import { type LegendProps } from './Legend';
|
|
5
5
|
import type { LineProps } from './Line';
|
|
6
|
+
import type { ReferenceLineProps } from './ReferenceLine';
|
|
6
7
|
import type { GridProps } from './ChartGrid';
|
|
7
8
|
import type { ResponsiveContainerProps } from './ResponsiveContainer';
|
|
8
9
|
type RechartsLineChartProps = React.ComponentProps<typeof RechartsLineChart>;
|
|
@@ -13,6 +14,7 @@ export type LineChartProps<T extends object> = Omit<RechartsLineChartProps, 'dat
|
|
|
13
14
|
dataUnit?: string;
|
|
14
15
|
dataKey?: string | number | ((obj: T) => any);
|
|
15
16
|
lines: React.ReactElement<LineProps>[];
|
|
17
|
+
referenceLines?: React.ReactElement<ReferenceLineProps>[];
|
|
16
18
|
xAxisOptions?: XAxisProps;
|
|
17
19
|
yAxisOptions?: YAxisProps;
|
|
18
20
|
gridOptions?: GridProps;
|
|
@@ -9,14 +9,17 @@ const recharts_1 = require("recharts");
|
|
|
9
9
|
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
|
-
const Legend_1 =
|
|
12
|
+
const Legend_1 = require("./Legend");
|
|
13
13
|
const LineChart = (props) => {
|
|
14
|
-
const { width, height, data = [], dataUnit = '', dataKey = 'value', lines = [], 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", "xAxisOptions", "yAxisOptions", "gridOptions", "containerOptions", "showXAxis", "showYAxis", "showGrid", "legend", "brush", "tooltip"]);
|
|
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"]);
|
|
15
15
|
const tooltipProps = (0, isObject_1.default)(tooltip) ? tooltip.props : {};
|
|
16
|
-
const legendProps = (0, isObject_1.default)(legend) ? 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)(
|
|
16
|
+
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
18
|
const _a = line.props, { strokeColor } = _a, remainingLineProps = tslib_1.__rest(_a, ["strokeColor"]);
|
|
19
19
|
return (0, react_1.createElement)(recharts_1.Line, Object.assign({}, remainingLineProps, { key: line.key, stroke: (0, chartHelper_1.getColor)(strokeColor) }));
|
|
20
|
+
}), referenceLines.map(referenceLine => {
|
|
21
|
+
const _a = referenceLine.props, { stroke } = _a, remainingReferenceLineProps = tslib_1.__rest(_a, ["stroke"]);
|
|
22
|
+
return ((0, react_1.createElement)(recharts_1.ReferenceLine, Object.assign({}, remainingReferenceLineProps, { key: referenceLine.key, stroke: (0, chartHelper_1.getColor)(stroke) })));
|
|
20
23
|
}), brush && (0, jsx_runtime_1.jsx)(recharts_1.Brush, { stroke: (0, chartHelper_1.getColor)('gray') })] })) })));
|
|
21
24
|
};
|
|
22
25
|
exports.default = LineChart;
|
|
@@ -8,7 +8,7 @@ const recharts_1 = require("recharts");
|
|
|
8
8
|
const isFunction_1 = tslib_1.__importDefault(require("lodash/fp/isFunction"));
|
|
9
9
|
const isObject_1 = tslib_1.__importDefault(require("lodash/fp/isObject"));
|
|
10
10
|
const chartHelper_1 = require("./chartHelper");
|
|
11
|
-
const Legend_1 =
|
|
11
|
+
const Legend_1 = require("./Legend");
|
|
12
12
|
const ChartTooltip_1 = tslib_1.__importStar(require("./ChartTooltip"));
|
|
13
13
|
const RADIAN = Math.PI / 180;
|
|
14
14
|
const renderCustomInnerLabel = (dataUnit) => ({ cx, cy, midAngle, innerRadius, outerRadius, value }) => {
|
|
@@ -18,13 +18,13 @@ const renderCustomInnerLabel = (dataUnit) => ({ cx, cy, midAngle, innerRadius, o
|
|
|
18
18
|
return ((0, jsx_runtime_1.jsx)("text", Object.assign({ x: x, y: y, fill: 'white', textAnchor: x > cx ? 'start' : 'end', dominantBaseline: 'central' }, { children: `${value} ${dataUnit}` })));
|
|
19
19
|
};
|
|
20
20
|
const PieChart = (props) => {
|
|
21
|
-
const { width, height, innerRadius, outerRadius, data = [], dataKey = 'value', dataUnit = '', nameKey = 'name', color, filled = false, labels = true, innerLabels = false, paddingAngle = 3, legend = (0, jsx_runtime_1.jsx)(
|
|
21
|
+
const { width, height, innerRadius, outerRadius, data = [], dataKey = 'value', dataUnit = '', nameKey = 'name', color, filled = false, labels = true, innerLabels = false, paddingAngle = 3, legend = (0, jsx_runtime_1.jsx)(recharts_1.Legend, {}), tooltip = true, pieOptions, containerOptions } = props, remainingProps = tslib_1.__rest(props, ["width", "height", "innerRadius", "outerRadius", "data", "dataKey", "dataUnit", "nameKey", "color", "filled", "labels", "innerLabels", "paddingAngle", "legend", "tooltip", "pieOptions", "containerOptions"]);
|
|
22
22
|
// biome-ignore lint/suspicious/noExplicitAny:
|
|
23
23
|
const renderLabels = (entry) => `${(0, isFunction_1.default)(dataKey) ? dataKey(entry) : entry[dataKey]} ${dataUnit}`;
|
|
24
24
|
const pieLabel = labels && (innerLabels ? renderCustomInnerLabel(dataUnit) : renderLabels);
|
|
25
25
|
const tooltipProps = (0, isObject_1.default)(tooltip) ? tooltip.props : {};
|
|
26
|
-
const legendProps = (0, isObject_1.default)(legend) ? legend.props : {};
|
|
27
|
-
return ((0, jsx_runtime_1.jsx)(recharts_1.ResponsiveContainer, Object.assign({}, containerOptions, { children: (0, jsx_runtime_1.jsxs)(recharts_1.PieChart, Object.assign({ width: width, height: height }, remainingProps, { children: [legend && ((0, jsx_runtime_1.jsx)(
|
|
26
|
+
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.PieChart, Object.assign({ width: width, height: height }, remainingProps, { children: [legend && ((0, jsx_runtime_1.jsx)(recharts_1.Legend, Object.assign({ formatter: (value, entry) => ((0, jsx_runtime_1.jsx)("span", Object.assign({ className: 'text-color-darker' }, { children: value }))) }, legendProps))), (0, jsx_runtime_1.jsx)(recharts_1.Pie, Object.assign({ data: data, isAnimationActive: true, nameKey: nameKey, dataKey: dataKey, label: pieLabel,
|
|
28
28
|
// cx={Math.max(outerRadius, width / 3)}
|
|
29
29
|
// cy={height / 2}
|
|
30
30
|
innerRadius: filled ? 0 : innerRadius, outerRadius: outerRadius, paddingAngle: filled ? 0 : paddingAngle, labelLine: !innerLabels }, pieOptions, { children: data.map((entry, index) => {
|
|
@@ -8,10 +8,10 @@ const recharts_1 = require("recharts");
|
|
|
8
8
|
const isFunction_1 = tslib_1.__importDefault(require("lodash/fp/isFunction"));
|
|
9
9
|
const isObject_1 = tslib_1.__importDefault(require("lodash/fp/isObject"));
|
|
10
10
|
const chartHelper_1 = require("./chartHelper");
|
|
11
|
-
const Legend_1 =
|
|
11
|
+
const Legend_1 = require("./Legend");
|
|
12
12
|
const ChartTooltip_1 = tslib_1.__importDefault(require("./ChartTooltip"));
|
|
13
13
|
const RadialBarChart = (props) => {
|
|
14
|
-
const { width, height, data = [], dataKey = 'value', startAngle = 180, endAngle = 0, innerRadius = '30%', outerRadius = '100%', legend = (0, jsx_runtime_1.jsx)(
|
|
14
|
+
const { width, height, data = [], dataKey = 'value', startAngle = 180, endAngle = 0, innerRadius = '30%', outerRadius = '100%', legend = (0, jsx_runtime_1.jsx)(recharts_1.Legend, {}), textOptions, radialBarOptions, containerOptions, showBarLabel = false, cornerRadius = 30, background = true, range, tooltip = false } = props, remainingProps = tslib_1.__rest(props, ["width", "height", "data", "dataKey", "startAngle", "endAngle", "innerRadius", "outerRadius", "legend", "textOptions", "radialBarOptions", "containerOptions", "showBarLabel", "cornerRadius", "background", "range", "tooltip"]);
|
|
15
15
|
const _a = textOptions || {}, { text, size = '500%', weight = 'normal', color = 'gray-darkest' } = _a, remainingTextOptions = tslib_1.__rest(_a, ["text", "size", "weight", "color"]);
|
|
16
16
|
const textStyle = {
|
|
17
17
|
fontSize: size,
|
|
@@ -19,10 +19,10 @@ const RadialBarChart = (props) => {
|
|
|
19
19
|
fill: color && (0, chartHelper_1.getColor)(color),
|
|
20
20
|
};
|
|
21
21
|
const tooltipProps = (0, isObject_1.default)(tooltip) ? tooltip.props : {};
|
|
22
|
-
const legendProps = (0, isObject_1.default)(legend) ? legend.props : {};
|
|
22
|
+
const legendProps = (0, isObject_1.default)(legend) ? Object.assign(Object.assign({}, (0, Legend_1.getLegendDefaultProps)()), legend.props) : {};
|
|
23
23
|
return ((0, jsx_runtime_1.jsx)(recharts_1.ResponsiveContainer, Object.assign({}, containerOptions, { children: (0, jsx_runtime_1.jsxs)(recharts_1.RadialBarChart, Object.assign({ width: width, height: height, data: data, innerRadius: innerRadius, outerRadius: outerRadius, startAngle: startAngle, endAngle: endAngle }, remainingProps, { children: [(0, jsx_runtime_1.jsx)(recharts_1.RadialBar, Object.assign({ label: showBarLabel && { fill: '#666', position: 'insideStart' }, background: background, dataKey: dataKey, cornerRadius: cornerRadius }, radialBarOptions, { children: data.map((entry, index) => {
|
|
24
24
|
const cellColor = (0, chartHelper_1.getColor)(entry.color) || (0, chartHelper_1.getFromDefaultColors)(index);
|
|
25
25
|
return ((0, jsx_runtime_1.jsx)(recharts_1.Cell, { fill: (0, isFunction_1.default)(color) ? color(entry, index) : cellColor }, `cell-${index}`));
|
|
26
|
-
}) })), range && (0, jsx_runtime_1.jsx)(recharts_1.PolarAngleAxis, { type: 'number', domain: range, angleAxisId: 0, tick: false }), textOptions && ((0, jsx_runtime_1.jsx)("text", Object.assign({ x: width ? width / 2 : '50%', y: height ? height / 2 : '50%', textAnchor: 'middle', dominantBaseline: 'middle', className: 'radialbarchart-text', style: textStyle }, remainingTextOptions, { children: text }))), legend && ((0, jsx_runtime_1.jsx)(
|
|
26
|
+
}) })), range && (0, jsx_runtime_1.jsx)(recharts_1.PolarAngleAxis, { type: 'number', domain: range, angleAxisId: 0, tick: false }), textOptions && ((0, jsx_runtime_1.jsx)("text", Object.assign({ x: width ? width / 2 : '50%', y: height ? height / 2 : '50%', textAnchor: 'middle', dominantBaseline: 'middle', className: 'radialbarchart-text', style: textStyle }, remainingTextOptions, { children: text }))), legend && ((0, jsx_runtime_1.jsx)(recharts_1.Legend, Object.assign({ formatter: (value, entry) => ((0, jsx_runtime_1.jsx)("span", Object.assign({ className: 'text-color-darker' }, { children: value }))) }, legendProps))), tooltip && (0, jsx_runtime_1.jsx)(ChartTooltip_1.default, Object.assign({ cursor: { fill: chartHelper_1.CURSOR_BACKGROUND_COLOR } }, tooltipProps))] })) })));
|
|
27
27
|
};
|
|
28
28
|
exports.default = RadialBarChart;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { ReferenceLineProps as RechartsReferenceLineProps } from 'recharts';
|
|
3
|
+
export type ReferenceLineProps = Omit<RechartsReferenceLineProps, 'ref'> & {
|
|
4
|
+
stroke?: string;
|
|
5
|
+
};
|
|
6
|
+
declare const Line: React.FC<ReferenceLineProps>;
|
|
7
|
+
export default Line;
|
|
@@ -3,6 +3,7 @@ export type DialogSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'full' | 'fullwidth'
|
|
|
3
3
|
export type BaseDialogProps = {
|
|
4
4
|
/**
|
|
5
5
|
* Opens the dialog when set to `true`.
|
|
6
|
+
*
|
|
6
7
|
* @default false
|
|
7
8
|
*/
|
|
8
9
|
show: boolean;
|
|
@@ -16,6 +17,7 @@ export type BaseDialogProps = {
|
|
|
16
17
|
subtitle?: React.ReactNode;
|
|
17
18
|
/**
|
|
18
19
|
* Shows a close button when set to `true`.
|
|
20
|
+
*
|
|
19
21
|
* @default true
|
|
20
22
|
*/
|
|
21
23
|
showCloseButton?: boolean;
|
|
@@ -25,24 +27,29 @@ export type BaseDialogProps = {
|
|
|
25
27
|
onClose?: () => void;
|
|
26
28
|
/**
|
|
27
29
|
* Defined how large the dialog will be rendered.
|
|
28
|
-
*
|
|
30
|
+
*
|
|
31
|
+
* By default, the dialog has a medium size, and thus it can be omitted.
|
|
29
32
|
*
|
|
30
33
|
* Possible values are: `xs`, `sm`, `lg` `xl` `fullwidth` `fullheight` `fullscreen`
|
|
34
|
+
*
|
|
31
35
|
* @default 'md'
|
|
32
36
|
*/
|
|
33
37
|
bsSize?: DialogSize;
|
|
34
38
|
/**
|
|
35
39
|
* Enables or disabled closing the dialog via esc key.
|
|
40
|
+
*
|
|
36
41
|
* @default false
|
|
37
42
|
*/
|
|
38
43
|
disableEsc?: boolean;
|
|
39
44
|
/**
|
|
40
45
|
* Enables the modal body to overflow and use inline scrolling if needed.
|
|
46
|
+
*
|
|
41
47
|
* @default false
|
|
42
48
|
*/
|
|
43
49
|
useOverflow?: boolean;
|
|
44
50
|
/**
|
|
45
51
|
* Show Header and Footer Borders for the "xs" dialog
|
|
52
|
+
*
|
|
46
53
|
* @default false
|
|
47
54
|
*/
|
|
48
55
|
showXsDialogBorders?: boolean;
|
|
@@ -74,6 +81,7 @@ export type DialogProps = BaseDialogProps & {
|
|
|
74
81
|
headerButtons?: React.ReactNode;
|
|
75
82
|
/**
|
|
76
83
|
* Deprecate to align with other dialog callbacks.
|
|
84
|
+
*
|
|
77
85
|
* @deprecated please use `onClose`
|
|
78
86
|
*/
|
|
79
87
|
onHide?: VoidFunction;
|
|
@@ -82,9 +90,9 @@ export type DialogProps = BaseDialogProps & {
|
|
|
82
90
|
*/
|
|
83
91
|
onEsc?: VoidFunction;
|
|
84
92
|
/**
|
|
85
|
-
* A callback function to be executed before closing the dialog.
|
|
86
|
-
*
|
|
87
|
-
*
|
|
93
|
+
* A callback function to be executed before closing the dialog.
|
|
94
|
+
*
|
|
95
|
+
* If the function returns `false`, the dialog will not be closed
|
|
88
96
|
*/
|
|
89
97
|
onCloseValidation?: () => boolean;
|
|
90
98
|
};
|
|
@@ -26,9 +26,9 @@ export type SplitDialogProps = BaseDialogProps & {
|
|
|
26
26
|
*/
|
|
27
27
|
footerClassName?: string;
|
|
28
28
|
/**
|
|
29
|
-
* A callback function to be executed before closing the dialog.
|
|
30
|
-
*
|
|
31
|
-
*
|
|
29
|
+
* A callback function to be executed before closing the dialog.
|
|
30
|
+
*
|
|
31
|
+
* If the function returns `false`, the dialog will not be closed
|
|
32
32
|
*/
|
|
33
33
|
onCloseValidation?: () => boolean;
|
|
34
34
|
};
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { SortDirectionType } from '../../SortUtils';
|
|
3
|
+
export type Group = {
|
|
4
|
+
groupKey: string;
|
|
5
|
+
items: any[];
|
|
6
|
+
};
|
|
7
|
+
export type GroupedItemListProps<T> = {
|
|
8
|
+
/**
|
|
9
|
+
* The list of items to be grouped and rendered.
|
|
10
|
+
*
|
|
11
|
+
* By default, the component assumes an item object containing an 'id' and 'name' property
|
|
12
|
+
* plus some other attributes.
|
|
13
|
+
*/
|
|
14
|
+
items: T[];
|
|
15
|
+
/**
|
|
16
|
+
* The property of the items to group by as a string, or a custom group function.
|
|
17
|
+
* Defaults to 'name' if not provided.
|
|
18
|
+
*
|
|
19
|
+
* @default 'name'
|
|
20
|
+
*/
|
|
21
|
+
groupBy?: keyof T | ((item: T) => string);
|
|
22
|
+
/**
|
|
23
|
+
* The order in which to sort the groups. Accepts 'asc' for ascending or 'desc' for descending.
|
|
24
|
+
* @default 'asc'.
|
|
25
|
+
*/
|
|
26
|
+
groupSortOrder?: SortDirectionType;
|
|
27
|
+
/**
|
|
28
|
+
* The order in which to sort the items inside a group. Accepts 'asc' for ascending or 'desc' for descending.
|
|
29
|
+
* @default 'asc'.
|
|
30
|
+
*/
|
|
31
|
+
itemSortOrder?: SortDirectionType;
|
|
32
|
+
/**
|
|
33
|
+
* Sorting function for the groups.
|
|
34
|
+
*/
|
|
35
|
+
groupSortFunction?: (groups: Group[]) => Group[];
|
|
36
|
+
/**
|
|
37
|
+
* Sorting function for the items within each group.
|
|
38
|
+
*/
|
|
39
|
+
itemSortFunction?: (items: T[]) => T[];
|
|
40
|
+
/**
|
|
41
|
+
* A custom render function for the group divider.
|
|
42
|
+
* Receives the group key (e.g., letter or date) as a parameter.
|
|
43
|
+
*/
|
|
44
|
+
renderDivider?: (groupKey: string) => React.ReactNode;
|
|
45
|
+
/**
|
|
46
|
+
* A custom render function for individual list items.
|
|
47
|
+
* Receives an item as a parameter.
|
|
48
|
+
*/
|
|
49
|
+
renderItem?: (item: T) => React.ReactNode;
|
|
50
|
+
/**
|
|
51
|
+
* Specifies the HTML element to use for the list inside each group.
|
|
52
|
+
* Default is 'div'. Use 'ul' for rendering the list items as `<li>` elements.
|
|
53
|
+
*/
|
|
54
|
+
listElement?: 'div' | 'ul';
|
|
55
|
+
/**
|
|
56
|
+
* Optional class name for the list element inside each group.
|
|
57
|
+
* Applied to the `div` or `ul` wrapping the items.
|
|
58
|
+
*/
|
|
59
|
+
listElementClassName?: string;
|
|
60
|
+
/**
|
|
61
|
+
* Optional class name for the divider element in each group.
|
|
62
|
+
* Applied to the `div` wrapping each group divider.
|
|
63
|
+
*/
|
|
64
|
+
dividerElementClassName?: string;
|
|
65
|
+
/**
|
|
66
|
+
* Optional class name for the outer wrapper element.
|
|
67
|
+
* Applied to the outer `div` wrapping the entire component.
|
|
68
|
+
*/
|
|
69
|
+
className?: string;
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
* A React component that groups and renders a list of items based on a specified property.
|
|
73
|
+
* The component can be customized to render dividers and list items in different styles.
|
|
74
|
+
*
|
|
75
|
+
* @param {GroupedItemListProps} props - The props for the component.
|
|
76
|
+
* @returns {JSX.Element} The grouped and rendered list component.
|
|
77
|
+
*/
|
|
78
|
+
declare const GroupedItemList: <T>(props: GroupedItemListProps<T>) => import("react/jsx-runtime").JSX.Element;
|
|
79
|
+
export default GroupedItemList;
|
|
@@ -0,0 +1,80 @@
|
|
|
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 = tslib_1.__importStar(require("react"));
|
|
6
|
+
const SortUtils_1 = require("../../SortUtils");
|
|
7
|
+
/**
|
|
8
|
+
* A React component that groups and renders a list of items based on a specified property.
|
|
9
|
+
* The component can be customized to render dividers and list items in different styles.
|
|
10
|
+
*
|
|
11
|
+
* @param {GroupedItemListProps} props - The props for the component.
|
|
12
|
+
* @returns {JSX.Element} The grouped and rendered list component.
|
|
13
|
+
*/
|
|
14
|
+
const GroupedItemList = (props) => {
|
|
15
|
+
const { items, groupBy = 'name', groupSortOrder = 'asc', // Default to ascending order if not specified
|
|
16
|
+
groupSortFunction, itemSortFunction, itemSortOrder = 'asc', // Default to ascending order if not specified
|
|
17
|
+
renderDivider, renderItem, listElement = 'div', // Default to 'div' if not specified
|
|
18
|
+
listElementClassName, dividerElementClassName, className, } = props;
|
|
19
|
+
// Default group sorting function or specific function provided
|
|
20
|
+
const groupSortFn = groupSortFunction
|
|
21
|
+
? groupSortFunction
|
|
22
|
+
: (groups) => (0, SortUtils_1.naturalSortByProperty)(groups, 'groupKey', groupSortOrder);
|
|
23
|
+
// Default item sorting within groups or specific function provided
|
|
24
|
+
const itemSortFn = itemSortFunction
|
|
25
|
+
? itemSortFunction
|
|
26
|
+
: (itemsToSort) => (0, SortUtils_1.sortByProperty)(itemsToSort, groupBy, itemSortOrder);
|
|
27
|
+
// Determine the grouping function based on the type of groupBy
|
|
28
|
+
// const getGroupKey = (item: T): string => {
|
|
29
|
+
// if (typeof groupBy === 'string') {
|
|
30
|
+
// if (groupBy === 'name') {
|
|
31
|
+
// return (item as any).name?.[0]?.toUpperCase() ?? '';
|
|
32
|
+
// }
|
|
33
|
+
// return (item as any)[groupBy]?.toString() ?? '';
|
|
34
|
+
// } else if (typeof groupBy === 'function') {
|
|
35
|
+
// return groupBy(item);
|
|
36
|
+
// }
|
|
37
|
+
// throw new Error('Please define a "groupBy" property as a string or function.');
|
|
38
|
+
// };
|
|
39
|
+
const getGroupKey = typeof groupBy === 'function'
|
|
40
|
+
? groupBy
|
|
41
|
+
: (item) => { var _a, _b, _c; return (_c = (_b = (_a = item[groupBy]) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.toUpperCase()) !== null && _c !== void 0 ? _c : ''; };
|
|
42
|
+
// Group items by the specified property
|
|
43
|
+
// const allGroups = useMemo(
|
|
44
|
+
// () =>
|
|
45
|
+
// items.reduce<Record<string, T[]>>((acc, item) => {
|
|
46
|
+
// const groupKey = getGroupKey(item);
|
|
47
|
+
// if (!acc[groupKey]) {
|
|
48
|
+
// acc[groupKey] = [];
|
|
49
|
+
// }
|
|
50
|
+
// acc[groupKey].push(item);
|
|
51
|
+
// return acc;
|
|
52
|
+
// }, {}),
|
|
53
|
+
// [items, getGroupKey]
|
|
54
|
+
// );
|
|
55
|
+
// Group items by the specified property
|
|
56
|
+
const groupedItems = (0, react_1.useMemo)(() => {
|
|
57
|
+
// Explicitly typing the accumulator as Record<string, T[]>
|
|
58
|
+
const groups = items.reduce((acc, item) => {
|
|
59
|
+
const groupKey = getGroupKey(item);
|
|
60
|
+
if (!acc[groupKey]) {
|
|
61
|
+
acc[groupKey] = [];
|
|
62
|
+
}
|
|
63
|
+
acc[groupKey].push(item);
|
|
64
|
+
return acc;
|
|
65
|
+
}, {});
|
|
66
|
+
return Object.keys(groups).map(groupKey => ({
|
|
67
|
+
groupKey,
|
|
68
|
+
items: groups[groupKey],
|
|
69
|
+
}));
|
|
70
|
+
}, [items, getGroupKey]);
|
|
71
|
+
// Assign the specified list element ('div' or 'ul')
|
|
72
|
+
const ListElement = listElement;
|
|
73
|
+
// Sort groups using the provided sort function
|
|
74
|
+
const sortedGroups = (0, react_1.useMemo)(() => groupSortFn(groupedItems), [groupedItems, groupSortFn]);
|
|
75
|
+
return ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: `grouped-item-list ${className !== null && className !== void 0 ? className : ''}` }, { children: sortedGroups.map(group => ((0, jsx_runtime_1.jsxs)(react_1.default.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", Object.assign({ className: `group-divider ${dividerElementClassName !== null && dividerElementClassName !== void 0 ? dividerElementClassName : ''}` }, { children: renderDivider ? renderDivider(group.groupKey) : group.groupKey })), (0, jsx_runtime_1.jsx)(ListElement, Object.assign({ className: listElementClassName }, { children: itemSortFn(group.items).map(item => {
|
|
76
|
+
var _a;
|
|
77
|
+
return renderItem ? (renderItem(item)) : ((0, jsx_runtime_1.jsx)(react_1.default.Fragment, { children: (0, jsx_runtime_1.jsx)("div", Object.assign({ className: 'item-name' }, { children: item.name })) }, (_a = item.id) !== null && _a !== void 0 ? _a : crypto.randomUUID()));
|
|
78
|
+
}) }))] }, group.groupKey))) })));
|
|
79
|
+
};
|
|
80
|
+
exports.default = GroupedItemList;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type PropsWithChildren } from 'react';
|
|
2
|
+
export type LicensePlateProps = {
|
|
3
|
+
/**
|
|
4
|
+
* The country code.
|
|
5
|
+
*
|
|
6
|
+
* Should be a string with 1-3 capital letters.
|
|
7
|
+
*/
|
|
8
|
+
countryCode?: string;
|
|
9
|
+
/**
|
|
10
|
+
* Whether the EU stars should be hidden.
|
|
11
|
+
*/
|
|
12
|
+
hideStars?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Additional classes added to the wrapping element.
|
|
15
|
+
*/
|
|
16
|
+
className?: string;
|
|
17
|
+
};
|
|
18
|
+
declare const LicensePlate: (props: PropsWithChildren<LicensePlateProps>) => import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
export default LicensePlate;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
4
|
+
// @ts-ignore-next-line importsNotUsedAsValues
|
|
5
|
+
require("react");
|
|
6
|
+
const euStars = ((0, jsx_runtime_1.jsx)("svg", Object.assign({ xmlns: 'http://www.w3.org/2000/svg', width: '10', height: '10' }, { children: (0, jsx_runtime_1.jsx)("path", { fill: '#FFC200', fillRule: 'nonzero', d: 'M5.143.439H5.6L5.23.71l.141.438L5 .88l-.371.27.14-.438L4.4.439h.459L5 0zm2.198.594h.458l-.37.272.141.44-.371-.271-.372.27.142-.439-.372-.271h.46l.142-.44zm1.607 1.625h.458l-.37.272.141.44-.371-.271-.372.27.142-.438-.371-.272.459-.001.142-.438zm.593 2.208H10l-.37.272.14.44-.37-.272-.372.271.14-.438-.37-.272.46-.001.141-.438zm-.59 2.214h.459l-.37.271.14.44-.37-.271-.372.271.141-.439-.371-.271.46-.001.141-.439zM7.337 8.701h.459l-.371.272.141.44-.371-.27-.371.27.14-.44-.37-.27.459-.002.142-.438zm-2.201.588h.458l-.37.272.141.439-.371-.27-.372.27.142-.439-.372-.271.46-.001.142-.438zM2.938 8.7h.458l-.37.273.141.439-.371-.27-.372.27.141-.44-.37-.27h.459l.142-.44zM1.33 7.083h.458l-.37.272.14.44-.371-.271-.372.27.142-.439-.37-.271h.458l.143-.44zM.743 4.869H1.2l-.37.272.141.439-.371-.27-.372.27.142-.439L0 4.87l.459-.001L.6 4.43zm.581-2.217h.459l-.37.272.14.439-.37-.27-.372.27.14-.439-.37-.271h.459l.142-.44zM2.94 1.03h.459l-.37.272.14.44-.37-.272-.372.271.14-.439-.37-.271.458-.001.143-.439z' }) })));
|
|
7
|
+
const LicensePlate = (props) => {
|
|
8
|
+
const { countryCode, hideStars, className = '', children } = props;
|
|
9
|
+
let letterCount = '';
|
|
10
|
+
if ((countryCode === null || countryCode === void 0 ? void 0 : countryCode.length) === 2)
|
|
11
|
+
letterCount = 'two-letters';
|
|
12
|
+
if ((countryCode === null || countryCode === void 0 ? void 0 : countryCode.length) === 3)
|
|
13
|
+
letterCount = 'three-letters';
|
|
14
|
+
return ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: `license-plate ${className}` }, { children: (0, jsx_runtime_1.jsxs)("div", Object.assign({ className: 'plate-content' }, { children: [countryCode && ((0, jsx_runtime_1.jsxs)("div", Object.assign({ className: 'plate-country' }, { children: [!hideStars && (0, jsx_runtime_1.jsx)("span", Object.assign({ className: 'stars' }, { children: euStars })), (0, jsx_runtime_1.jsx)("span", Object.assign({ className: `plate-country-code ${letterCount}` }, { children: countryCode }))] }))), (0, jsx_runtime_1.jsx)("div", Object.assign({ className: 'plate-number' }, { children: children }))] })) })));
|
|
15
|
+
};
|
|
16
|
+
exports.default = LicensePlate;
|
|
@@ -36,6 +36,7 @@ export type SelectOption = {
|
|
|
36
36
|
export type BaseSelectDropdownProps<T extends SelectOption> = {
|
|
37
37
|
options?: T[];
|
|
38
38
|
isOpen?: boolean;
|
|
39
|
+
isLoading?: boolean;
|
|
39
40
|
updateDOMValues?: (values: OptionDOMValue[] | undefined) => void;
|
|
40
41
|
onOpen?: (hasDropup: boolean) => void;
|
|
41
42
|
onSelect?: (selectedItem: T | undefined) => void;
|