@monolith-forensics/monolith-ui 1.8.0 → 1.8.1-dev.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/dist/Button/Button.js +9 -58
- package/dist/Calendar/Calendar.d.ts +3 -1
- package/dist/Calendar/Calendar.js +134 -33
- package/dist/Calendar/CalendarStyles.d.ts +3 -0
- package/dist/Calendar/CalendarStyles.js +92 -14
- package/dist/Calendar/calendarHelpers.d.ts +5 -1
- package/dist/Calendar/calendarHelpers.js +13 -5
- package/dist/Charts/BarChart/BarChart.d.ts +5 -0
- package/dist/Charts/BarChart/BarChart.js +549 -0
- package/dist/Charts/BarChart/BarChart.lib.d.ts +31 -0
- package/dist/Charts/BarChart/BarChart.lib.js +136 -0
- package/dist/Charts/BarChart/BarChart.styled.d.ts +51 -0
- package/dist/Charts/BarChart/BarChart.styled.js +115 -0
- package/dist/Charts/BarChart/BarChart.types.d.ts +171 -0
- package/dist/Charts/BarChart/BarChart.types.js +1 -0
- package/dist/Charts/BarChart/index.d.ts +3 -0
- package/dist/Charts/BarChart/index.js +2 -0
- package/dist/Charts/ChartPrimitives/ChartExportControl.d.ts +11 -0
- package/dist/Charts/ChartPrimitives/ChartExportControl.js +29 -0
- package/dist/Charts/ChartPrimitives/chartActions.styled.d.ts +1 -0
- package/dist/Charts/ChartPrimitives/chartActions.styled.js +8 -0
- package/dist/Charts/ChartPrimitives/chartLegend.styled.d.ts +12 -0
- package/dist/Charts/ChartPrimitives/chartLegend.styled.js +52 -0
- package/dist/Charts/ChartPrimitives/chartTooltip.styled.d.ts +19 -0
- package/dist/Charts/ChartPrimitives/chartTooltip.styled.js +61 -0
- package/dist/Charts/ChartPrimitives/index.d.ts +4 -0
- package/dist/Charts/ChartPrimitives/index.js +4 -0
- package/dist/Charts/ChartUtils/chartColors.d.ts +8 -0
- package/dist/Charts/ChartUtils/chartColors.js +65 -0
- package/dist/Charts/ChartUtils/chartExport.d.ts +47 -0
- package/dist/Charts/ChartUtils/chartExport.js +311 -0
- package/dist/Charts/ChartUtils/chartMath.d.ts +3 -0
- package/dist/Charts/ChartUtils/chartMath.js +3 -0
- package/dist/Charts/ChartUtils/index.d.ts +3 -0
- package/dist/Charts/ChartUtils/index.js +3 -0
- package/dist/Charts/HeatMap/HeatMap.d.ts +5 -0
- package/dist/Charts/HeatMap/HeatMap.js +212 -0
- package/dist/Charts/HeatMap/HeatMap.lib.d.ts +30 -0
- package/dist/Charts/HeatMap/HeatMap.lib.js +115 -0
- package/dist/Charts/HeatMap/HeatMap.styled.d.ts +37 -0
- package/dist/Charts/HeatMap/HeatMap.styled.js +91 -0
- package/dist/Charts/HeatMap/HeatMap.types.d.ts +80 -0
- package/dist/Charts/HeatMap/HeatMap.types.js +1 -0
- package/dist/Charts/HeatMap/index.d.ts +3 -0
- package/dist/Charts/HeatMap/index.js +2 -0
- package/dist/Charts/LineChart/LineChart.d.ts +5 -0
- package/dist/Charts/LineChart/LineChart.js +529 -0
- package/dist/Charts/LineChart/LineChart.lib.d.ts +24 -0
- package/dist/Charts/LineChart/LineChart.lib.js +132 -0
- package/dist/Charts/LineChart/LineChart.styled.d.ts +59 -0
- package/dist/Charts/LineChart/LineChart.styled.js +147 -0
- package/dist/Charts/LineChart/LineChart.types.d.ts +193 -0
- package/dist/Charts/LineChart/LineChart.types.js +1 -0
- package/dist/Charts/LineChart/index.d.ts +3 -0
- package/dist/Charts/LineChart/index.js +2 -0
- package/dist/Charts/PieChart/PieChart.d.ts +4 -0
- package/dist/Charts/PieChart/PieChart.js +199 -0
- package/dist/Charts/PieChart/PieChart.lib.d.ts +5 -0
- package/dist/Charts/PieChart/PieChart.lib.js +19 -0
- package/dist/Charts/PieChart/PieChart.styled.d.ts +51 -0
- package/dist/Charts/PieChart/PieChart.styled.js +163 -0
- package/dist/Charts/PieChart/PieChart.types.d.ts +100 -0
- package/dist/Charts/PieChart/PieChart.types.js +1 -0
- package/dist/Charts/PieChart/index.d.ts +2 -0
- package/dist/Charts/PieChart/index.js +1 -0
- package/dist/Charts/index.d.ts +5 -0
- package/dist/Charts/index.js +4 -0
- package/dist/CheckBox/CheckBox.js +2 -16
- package/dist/DateInput/DateInput.js +198 -143
- package/dist/DropDownMenu/components/MenuComponent.js +2 -1
- package/dist/DropDownMenu/components/MenuItem.js +5 -14
- package/dist/DropDownMenu/components/MenuItemList.js +7 -24
- package/dist/DropDownMenu/components/StyledFloatContainer.js +1 -1
- package/dist/FieldLabel/FieldLabel.js +4 -12
- package/dist/FileInputField/FileInputField.js +4 -23
- package/dist/FormSection/FormSection.js +5 -25
- package/dist/IconButton/IconButton.js +2 -16
- package/dist/Input/Input.js +7 -56
- package/dist/Pill/Pill.js +8 -79
- package/dist/Popover/Popover.context.d.ts +2 -1
- package/dist/Popover/Popover.js +5 -2
- package/dist/Popover/Popover.styles.d.ts +1 -6
- package/dist/Popover/Popover.styles.js +11 -28
- package/dist/Popover/Popover.transitions.d.ts +4 -2
- package/dist/Popover/Popover.transitions.js +23 -49
- package/dist/Popover/PopoverDropdown.js +6 -8
- package/dist/Popover/PopoverTarget.js +6 -3
- package/dist/SegmentedControl/SegmentedControl.utils.d.ts +2 -2
- package/dist/SegmentedControl/SegmentedControl.utils.js +3 -30
- package/dist/SelectBox/SelectBox.js +5 -5
- package/dist/SelectBox/select-box.styled-components.d.ts +4 -1
- package/dist/SelectBox/select-box.styled-components.js +11 -48
- package/dist/SelectBox/types.d.ts +1 -0
- package/dist/Switch/Switch.d.ts +2 -2
- package/dist/Switch/Switch.js +18 -83
- package/dist/Table/StateStorage.d.ts +4 -0
- package/dist/Table/StateStorage.js +13 -0
- package/dist/Table/Table.js +160 -12
- package/dist/Table/TableComponents.d.ts +10 -0
- package/dist/Table/TableComponents.js +57 -0
- package/dist/Table/TableDefaults.d.ts +7 -0
- package/dist/Table/TableDefaults.js +7 -0
- package/dist/Table/TableProvider.js +263 -71
- package/dist/Table/TableRow.js +15 -10
- package/dist/Table/types.d.ts +64 -0
- package/dist/TagBox/TagBox.js +18 -76
- package/dist/TextArea/TextArea.js +4 -23
- package/dist/TextInput/TextInput.js +12 -6
- package/dist/Utilities/parseTimestamp.js +11 -6
- package/dist/core/ArrowButton.d.ts +2 -0
- package/dist/core/ArrowButton.js +7 -3
- package/dist/core/ClearButton.d.ts +2 -0
- package/dist/core/ClearButton.js +7 -3
- package/dist/core/controlSizes.d.ts +34 -0
- package/dist/core/controlSizes.js +190 -0
- package/dist/core/index.d.ts +1 -0
- package/dist/core/index.js +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/package.json +5 -1
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { area, curveLinear, curveMonotoneX, curveNatural, curveStep, line, } from "d3-shape";
|
|
2
|
+
import { useMemo } from "react";
|
|
3
|
+
import { useTheme } from "styled-components";
|
|
4
|
+
import { clamp, easeOutCubic, formatDefaultValue, getGradientColor, getGradientStops, mixColors, } from "../ChartUtils";
|
|
5
|
+
export { clamp, easeOutCubic, formatDefaultValue, getGradientColor, getGradientStops, mixColors };
|
|
6
|
+
export const getPointKey = (datum, index) => { var _a; return (_a = datum.id) !== null && _a !== void 0 ? _a : `${String(datum.x)}-${index}`; };
|
|
7
|
+
export const getSeriesKey = (series, index) => {
|
|
8
|
+
var _a;
|
|
9
|
+
return (_a = series.id) !== null && _a !== void 0 ? _a : (typeof series.label === "string" || typeof series.label === "number"
|
|
10
|
+
? `${series.label}-${index}`
|
|
11
|
+
: `series-${index}`);
|
|
12
|
+
};
|
|
13
|
+
export const useThemeColor = (lineColor) => {
|
|
14
|
+
const theme = useTheme();
|
|
15
|
+
return useMemo(() => lineColor !== null && lineColor !== void 0 ? lineColor : theme.palette.primary.main, [lineColor, theme.palette.primary.main]);
|
|
16
|
+
};
|
|
17
|
+
export const useThemeColors = (colors) => {
|
|
18
|
+
const theme = useTheme();
|
|
19
|
+
return useMemo(() => (colors === null || colors === void 0 ? void 0 : colors.length)
|
|
20
|
+
? colors
|
|
21
|
+
: [
|
|
22
|
+
theme.palette.primary.main,
|
|
23
|
+
theme.alert.info.color,
|
|
24
|
+
theme.alert.success.color,
|
|
25
|
+
theme.alert.warning.color,
|
|
26
|
+
theme.alert.error.color,
|
|
27
|
+
theme.palette.fourth.main,
|
|
28
|
+
theme.button.text.secondary,
|
|
29
|
+
], [colors, theme]);
|
|
30
|
+
};
|
|
31
|
+
export const getSeriesLabelText = (label, fallback) => {
|
|
32
|
+
if (typeof label === "string" || typeof label === "number") {
|
|
33
|
+
return String(label);
|
|
34
|
+
}
|
|
35
|
+
return fallback;
|
|
36
|
+
};
|
|
37
|
+
export const parseLineChartXValue = (value) => {
|
|
38
|
+
if (value instanceof Date) {
|
|
39
|
+
return Number.isFinite(value.getTime()) ? value : null;
|
|
40
|
+
}
|
|
41
|
+
if (typeof value === "number") {
|
|
42
|
+
return Number.isFinite(value) ? value : null;
|
|
43
|
+
}
|
|
44
|
+
if (typeof value !== "string")
|
|
45
|
+
return null;
|
|
46
|
+
const trimmed = value.trim();
|
|
47
|
+
if (!trimmed)
|
|
48
|
+
return null;
|
|
49
|
+
const numeric = Number(trimmed);
|
|
50
|
+
if (!Number.isNaN(numeric) && trimmed === String(numeric)) {
|
|
51
|
+
return numeric;
|
|
52
|
+
}
|
|
53
|
+
const timestamp = Date.parse(trimmed);
|
|
54
|
+
if (!Number.isNaN(timestamp)) {
|
|
55
|
+
return new Date(timestamp);
|
|
56
|
+
}
|
|
57
|
+
return trimmed;
|
|
58
|
+
};
|
|
59
|
+
export const resolveXAxisType = (points, xAxisType) => {
|
|
60
|
+
var _a;
|
|
61
|
+
if (xAxisType !== "auto")
|
|
62
|
+
return xAxisType;
|
|
63
|
+
const firstValue = (_a = points[0]) === null || _a === void 0 ? void 0 : _a.parsedX;
|
|
64
|
+
if (firstValue instanceof Date)
|
|
65
|
+
return "time";
|
|
66
|
+
if (typeof firstValue === "number")
|
|
67
|
+
return "linear";
|
|
68
|
+
return "point";
|
|
69
|
+
};
|
|
70
|
+
export const getDefaultMargin = (showXAxisLabels, showYAxisLabels, showLabels) => ({
|
|
71
|
+
top: showLabels ? 24 : 16,
|
|
72
|
+
right: showLabels ? 52 : 20,
|
|
73
|
+
bottom: showXAxisLabels ? 42 : 18,
|
|
74
|
+
left: showYAxisLabels ? 56 : 18,
|
|
75
|
+
});
|
|
76
|
+
export const mergeChartMargin = (margin, showXAxisLabels, showYAxisLabels, showLabels) => {
|
|
77
|
+
var _a, _b, _c, _d;
|
|
78
|
+
const defaults = getDefaultMargin(showXAxisLabels, showYAxisLabels, showLabels);
|
|
79
|
+
return {
|
|
80
|
+
top: (_a = margin === null || margin === void 0 ? void 0 : margin.top) !== null && _a !== void 0 ? _a : defaults.top,
|
|
81
|
+
right: (_b = margin === null || margin === void 0 ? void 0 : margin.right) !== null && _b !== void 0 ? _b : defaults.right,
|
|
82
|
+
bottom: (_c = margin === null || margin === void 0 ? void 0 : margin.bottom) !== null && _c !== void 0 ? _c : defaults.bottom,
|
|
83
|
+
left: (_d = margin === null || margin === void 0 ? void 0 : margin.left) !== null && _d !== void 0 ? _d : defaults.left,
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
export const getValueDomain = (values, minValue, maxValue) => {
|
|
87
|
+
const actualMin = values.length ? Math.min(...values) : 0;
|
|
88
|
+
const actualMax = values.length ? Math.max(...values) : 0;
|
|
89
|
+
const resolvedMin = minValue !== null && minValue !== void 0 ? minValue : actualMin;
|
|
90
|
+
const resolvedMax = maxValue !== null && maxValue !== void 0 ? maxValue : actualMax;
|
|
91
|
+
if (resolvedMin === resolvedMax) {
|
|
92
|
+
if (resolvedMin === 0)
|
|
93
|
+
return [0, 1];
|
|
94
|
+
return [resolvedMin - 1, resolvedMax + 1];
|
|
95
|
+
}
|
|
96
|
+
return [resolvedMin, resolvedMax];
|
|
97
|
+
};
|
|
98
|
+
export const getCurveFactory = (curve) => {
|
|
99
|
+
switch (curve) {
|
|
100
|
+
case "linear":
|
|
101
|
+
return curveLinear;
|
|
102
|
+
case "step":
|
|
103
|
+
return curveStep;
|
|
104
|
+
case "natural":
|
|
105
|
+
return curveNatural;
|
|
106
|
+
case "monotone":
|
|
107
|
+
default:
|
|
108
|
+
return curveMonotoneX;
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
export const buildLinePath = (points, getX, getY, curve) => line()
|
|
112
|
+
.defined((point) => Number.isFinite(point.y))
|
|
113
|
+
.x(getX)
|
|
114
|
+
.y(getY)
|
|
115
|
+
.curve(getCurveFactory(curve))(points);
|
|
116
|
+
export const buildAreaPath = (points, getX, getY, y0, curve) => area()
|
|
117
|
+
.defined((point) => Number.isFinite(point.y))
|
|
118
|
+
.x(getX)
|
|
119
|
+
.y0(y0)
|
|
120
|
+
.y1(getY)
|
|
121
|
+
.curve(getCurveFactory(curve))(points);
|
|
122
|
+
export const measureSvgPath = (path) => {
|
|
123
|
+
if (!path)
|
|
124
|
+
return 0;
|
|
125
|
+
try {
|
|
126
|
+
return path.getTotalLength();
|
|
127
|
+
}
|
|
128
|
+
catch (_a) {
|
|
129
|
+
return 0;
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
export const normalizeTickValue = (value) => Math.abs(value) < 1e-9 ? 0 : value;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { StyledChartActions } from "../ChartPrimitives";
|
|
2
|
+
export declare const StyledContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
3
|
+
export declare const StyledChartScroller: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
4
|
+
export declare const StyledChartFrame: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
5
|
+
export { StyledChartActions };
|
|
6
|
+
export declare const StyledSvg: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").SVGProps<SVGSVGElement>, never>> & string;
|
|
7
|
+
export declare const StyledGridLine: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").SVGLineElementAttributes<SVGLineElement>, never>> & string;
|
|
8
|
+
export declare const StyledAxisLine: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").SVGLineElementAttributes<SVGLineElement>, never>> & string;
|
|
9
|
+
export declare const StyledAxisText: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").SVGTextElementAttributes<SVGTextElement>, never>> & string;
|
|
10
|
+
export declare const StyledArea: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").SVGProps<SVGPathElement>, never>> & string;
|
|
11
|
+
export declare const StyledLine: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").SVGProps<SVGPathElement>, {
|
|
12
|
+
$active: boolean;
|
|
13
|
+
$dimmed: boolean;
|
|
14
|
+
}>> & string;
|
|
15
|
+
export declare const StyledPoint: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").SVGProps<SVGCircleElement>, {
|
|
16
|
+
$active: boolean;
|
|
17
|
+
}>> & string;
|
|
18
|
+
export declare const StyledHoverTarget: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").SVGProps<SVGRectElement>, never>> & string;
|
|
19
|
+
export declare const StyledValueLabel: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").SVGTextElementAttributes<SVGTextElement>, never>> & string;
|
|
20
|
+
export declare const StyledLegend: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
21
|
+
export declare const StyledLegendItem: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
22
|
+
$active: boolean;
|
|
23
|
+
}>> & string;
|
|
24
|
+
export declare const StyledLegendLine: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {
|
|
25
|
+
$color: string;
|
|
26
|
+
}>> & string;
|
|
27
|
+
export declare const StyledLegendLabel: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, never>> & string;
|
|
28
|
+
export declare const StyledLegendValue: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, never>> & string;
|
|
29
|
+
export declare const StyledEmptyState: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
|
|
30
|
+
$width: number;
|
|
31
|
+
$height: number;
|
|
32
|
+
}>> & string;
|
|
33
|
+
export declare const StyledTooltip: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("styled-components").FastOmit<import("styled-components/dist/types").Substitute<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "$minWidth" | "$maxWidth" | "$transform"> & {
|
|
34
|
+
$minWidth?: number;
|
|
35
|
+
$maxWidth?: number;
|
|
36
|
+
$transform?: string;
|
|
37
|
+
}, import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "$minWidth" | "$maxWidth" | "$transform"> & {
|
|
38
|
+
$minWidth?: number;
|
|
39
|
+
$maxWidth?: number;
|
|
40
|
+
$transform?: string;
|
|
41
|
+
}>, never>, never>> & string;
|
|
42
|
+
export declare const StyledTooltipHeader: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
43
|
+
export declare const StyledTooltipSwatch: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("styled-components").FastOmit<import("styled-components/dist/types").Substitute<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "$color" | "$radius"> & {
|
|
44
|
+
$color: string;
|
|
45
|
+
$radius?: string;
|
|
46
|
+
}, import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "$color" | "$radius"> & {
|
|
47
|
+
$color: string;
|
|
48
|
+
$radius?: string;
|
|
49
|
+
}>, never>, never>> & string;
|
|
50
|
+
export declare const StyledTooltipLabel: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, never>> & string;
|
|
51
|
+
export declare const StyledTooltipMeta: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("styled-components").FastOmit<import("styled-components/dist/types").Substitute<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "$marginTop" | "$direction" | "$gap"> & {
|
|
52
|
+
$marginTop?: number;
|
|
53
|
+
$direction?: "row" | "column";
|
|
54
|
+
$gap?: number;
|
|
55
|
+
}, import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "$marginTop" | "$direction" | "$gap"> & {
|
|
56
|
+
$marginTop?: number;
|
|
57
|
+
$direction?: "row" | "column";
|
|
58
|
+
$gap?: number;
|
|
59
|
+
}>, never>, never>> & string;
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import styled from "styled-components";
|
|
2
|
+
import { StyledChartActions, StyledChartLegend, StyledChartLegendLabel, StyledChartLegendValue, StyledChartTooltip, StyledChartTooltipHeader, StyledChartTooltipLabel, StyledChartTooltipMeta, StyledChartTooltipSwatch, sharedLegendItemStyles, } from "../ChartPrimitives";
|
|
3
|
+
const activePointStyles = `
|
|
4
|
+
filter: brightness(1.08) saturate(1.06);
|
|
5
|
+
transform: scale(1.08);
|
|
6
|
+
`;
|
|
7
|
+
export const StyledContainer = styled.div `
|
|
8
|
+
position: relative;
|
|
9
|
+
display: flex;
|
|
10
|
+
align-items: flex-start;
|
|
11
|
+
flex-wrap: wrap;
|
|
12
|
+
gap: 20px;
|
|
13
|
+
width: fit-content;
|
|
14
|
+
max-width: 100%;
|
|
15
|
+
color: ${({ theme }) => theme.palette.text.primary};
|
|
16
|
+
box-sizing: border-box;
|
|
17
|
+
overflow: visible;
|
|
18
|
+
`;
|
|
19
|
+
export const StyledChartScroller = styled.div `
|
|
20
|
+
display: flex;
|
|
21
|
+
max-width: 100%;
|
|
22
|
+
overflow-x: auto;
|
|
23
|
+
overflow-y: visible;
|
|
24
|
+
padding-bottom: 2px;
|
|
25
|
+
`;
|
|
26
|
+
export const StyledChartFrame = styled.div `
|
|
27
|
+
position: relative;
|
|
28
|
+
display: flex;
|
|
29
|
+
flex-direction: column;
|
|
30
|
+
flex: 0 0 auto;
|
|
31
|
+
`;
|
|
32
|
+
export { StyledChartActions };
|
|
33
|
+
export const StyledSvg = styled.svg `
|
|
34
|
+
display: block;
|
|
35
|
+
overflow: visible;
|
|
36
|
+
`;
|
|
37
|
+
export const StyledGridLine = styled.line `
|
|
38
|
+
stroke: ${({ theme }) => theme.palette.divider};
|
|
39
|
+
stroke-opacity: 0.65;
|
|
40
|
+
stroke-dasharray: 3 4;
|
|
41
|
+
`;
|
|
42
|
+
export const StyledAxisLine = styled.line `
|
|
43
|
+
stroke: ${({ theme }) => theme.palette.divider};
|
|
44
|
+
stroke-width: 1;
|
|
45
|
+
`;
|
|
46
|
+
export const StyledAxisText = styled.text `
|
|
47
|
+
fill: ${({ theme }) => theme.palette.text.secondary};
|
|
48
|
+
font-size: 11px;
|
|
49
|
+
`;
|
|
50
|
+
export const StyledArea = styled.path `
|
|
51
|
+
transition:
|
|
52
|
+
opacity 0.16s ease,
|
|
53
|
+
filter 0.16s ease;
|
|
54
|
+
pointer-events: none;
|
|
55
|
+
`;
|
|
56
|
+
export const StyledLine = styled.path `
|
|
57
|
+
fill: none;
|
|
58
|
+
pointer-events: none;
|
|
59
|
+
transition:
|
|
60
|
+
opacity 0.16s ease,
|
|
61
|
+
filter 0.16s ease;
|
|
62
|
+
|
|
63
|
+
${({ $active }) => $active &&
|
|
64
|
+
`
|
|
65
|
+
filter: brightness(1.12) saturate(1.08);
|
|
66
|
+
`}
|
|
67
|
+
|
|
68
|
+
${({ $dimmed }) => $dimmed &&
|
|
69
|
+
`
|
|
70
|
+
opacity: 0.34;
|
|
71
|
+
`}
|
|
72
|
+
`;
|
|
73
|
+
export const StyledPoint = styled.circle `
|
|
74
|
+
cursor: pointer;
|
|
75
|
+
outline: none;
|
|
76
|
+
transform-box: fill-box;
|
|
77
|
+
transform-origin: center;
|
|
78
|
+
transition:
|
|
79
|
+
opacity 0.16s ease,
|
|
80
|
+
filter 0.16s ease,
|
|
81
|
+
transform 0.16s ease;
|
|
82
|
+
|
|
83
|
+
&:hover,
|
|
84
|
+
&:focus-visible {
|
|
85
|
+
${activePointStyles}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
${({ $active }) => $active && activePointStyles}
|
|
89
|
+
`;
|
|
90
|
+
export const StyledHoverTarget = styled.rect `
|
|
91
|
+
fill: transparent;
|
|
92
|
+
cursor: crosshair;
|
|
93
|
+
`;
|
|
94
|
+
export const StyledValueLabel = styled.text `
|
|
95
|
+
fill: ${({ theme }) => theme.palette.text.primary};
|
|
96
|
+
font-size: 11px;
|
|
97
|
+
font-weight: 600;
|
|
98
|
+
pointer-events: none;
|
|
99
|
+
`;
|
|
100
|
+
export const StyledLegend = StyledChartLegend;
|
|
101
|
+
export const StyledLegendItem = styled.div `
|
|
102
|
+
display: grid;
|
|
103
|
+
grid-template-columns: 20px minmax(0, 1fr) auto;
|
|
104
|
+
${sharedLegendItemStyles}
|
|
105
|
+
`;
|
|
106
|
+
export const StyledLegendLine = styled.span `
|
|
107
|
+
display: inline-flex;
|
|
108
|
+
align-items: center;
|
|
109
|
+
align-self: center;
|
|
110
|
+
width: 20px;
|
|
111
|
+
height: 2px;
|
|
112
|
+
border-radius: 999px;
|
|
113
|
+
background: ${({ $color }) => $color};
|
|
114
|
+
`;
|
|
115
|
+
export const StyledLegendLabel = StyledChartLegendLabel;
|
|
116
|
+
export const StyledLegendValue = StyledChartLegendValue;
|
|
117
|
+
export const StyledEmptyState = styled.div `
|
|
118
|
+
display: flex;
|
|
119
|
+
align-items: center;
|
|
120
|
+
justify-content: center;
|
|
121
|
+
width: ${({ $width }) => $width}px;
|
|
122
|
+
height: ${({ $height }) => $height}px;
|
|
123
|
+
border: 1px dashed ${({ theme }) => theme.palette.divider};
|
|
124
|
+
border-radius: 8px;
|
|
125
|
+
background: linear-gradient(
|
|
126
|
+
180deg,
|
|
127
|
+
${({ theme }) => theme.palette.background.paper} 0%,
|
|
128
|
+
${({ theme }) => theme.palette.background.secondary} 100%
|
|
129
|
+
);
|
|
130
|
+
font-size: 12px;
|
|
131
|
+
color: ${({ theme }) => theme.palette.text.secondary};
|
|
132
|
+
`;
|
|
133
|
+
export const StyledTooltip = styled(StyledChartTooltip).attrs({
|
|
134
|
+
$minWidth: 132,
|
|
135
|
+
$maxWidth: 240,
|
|
136
|
+
$transform: "none",
|
|
137
|
+
}) ``;
|
|
138
|
+
export const StyledTooltipHeader = StyledChartTooltipHeader;
|
|
139
|
+
export const StyledTooltipSwatch = styled(StyledChartTooltipSwatch).attrs({
|
|
140
|
+
$radius: "999px",
|
|
141
|
+
}) ``;
|
|
142
|
+
export const StyledTooltipLabel = StyledChartTooltipLabel;
|
|
143
|
+
export const StyledTooltipMeta = styled(StyledChartTooltipMeta).attrs({
|
|
144
|
+
$direction: "column",
|
|
145
|
+
$gap: 2,
|
|
146
|
+
$marginTop: 4,
|
|
147
|
+
}) ``;
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
import React, { HTMLAttributes } from "react";
|
|
2
|
+
import type { ChartExportOptions } from "../ChartUtils";
|
|
3
|
+
export type LineChartDatum<TData = unknown> = {
|
|
4
|
+
/** Stable identifier for the point. Falls back to x and index when omitted. */
|
|
5
|
+
id?: string | number;
|
|
6
|
+
/** X-axis value. Supports Date, ISO-like date strings, numbers, and category strings. */
|
|
7
|
+
x: Date | string | number;
|
|
8
|
+
/** Y-axis value rendered by the line. */
|
|
9
|
+
y: number;
|
|
10
|
+
/** Optional per-point color. Takes precedence over lineColor and theme color. */
|
|
11
|
+
color?: string;
|
|
12
|
+
/** Optional contextual payload returned in callbacks and formatter functions. */
|
|
13
|
+
data?: TData;
|
|
14
|
+
};
|
|
15
|
+
export type LineChartColorGradient =
|
|
16
|
+
/** Ordered color stops used to generate a line or area gradient. */
|
|
17
|
+
string[]
|
|
18
|
+
/** Two-color gradient range used from start to end of the line. */
|
|
19
|
+
| {
|
|
20
|
+
/** Starting color for the generated gradient. */
|
|
21
|
+
from: string;
|
|
22
|
+
/** Ending color for the generated gradient. */
|
|
23
|
+
to: string;
|
|
24
|
+
};
|
|
25
|
+
export type LineChartXAxisType = "auto" | "time" | "linear" | "point";
|
|
26
|
+
export type LineChartCurve = "linear" | "monotone" | "step" | "natural";
|
|
27
|
+
export type LineChartSeries<TData = unknown> = {
|
|
28
|
+
/** Stable identifier for the series. Falls back to its label and index when omitted. */
|
|
29
|
+
id?: string | number;
|
|
30
|
+
/** Display label used in legends and tooltips. */
|
|
31
|
+
label: React.ReactNode;
|
|
32
|
+
/** Optional per-series line color. Takes precedence over colors and theme colors. */
|
|
33
|
+
color?: string;
|
|
34
|
+
/** Optional per-series gradient for the line and area. */
|
|
35
|
+
colorGradient?: LineChartColorGradient;
|
|
36
|
+
/** Optional per-series stroke dasharray. */
|
|
37
|
+
lineDasharray?: string;
|
|
38
|
+
/** Optional per-series line width in pixels. */
|
|
39
|
+
lineWidth?: number;
|
|
40
|
+
/** Optional per-series line opacity between 0 and 1. */
|
|
41
|
+
lineOpacity?: number;
|
|
42
|
+
/** Optional per-series area visibility override. */
|
|
43
|
+
showArea?: boolean;
|
|
44
|
+
/** Optional per-series area color. Defaults to the resolved series color. */
|
|
45
|
+
areaColor?: string;
|
|
46
|
+
/** Optional per-series area opacity between 0 and 1. */
|
|
47
|
+
areaOpacity?: number;
|
|
48
|
+
/** Optional per-series point visibility override. */
|
|
49
|
+
showPoints?: boolean;
|
|
50
|
+
/** Optional per-series point fill color. Defaults to the resolved series color. */
|
|
51
|
+
pointColor?: string;
|
|
52
|
+
/** Optional per-series point radius in pixels. */
|
|
53
|
+
pointRadius?: number;
|
|
54
|
+
/** Optional per-series active point radius in pixels. */
|
|
55
|
+
activePointRadius?: number;
|
|
56
|
+
/** Values rendered by this series. */
|
|
57
|
+
data: LineChartDatum<TData>[];
|
|
58
|
+
};
|
|
59
|
+
export type LineChartMargin = {
|
|
60
|
+
top: number;
|
|
61
|
+
right: number;
|
|
62
|
+
bottom: number;
|
|
63
|
+
left: number;
|
|
64
|
+
};
|
|
65
|
+
export type ResolvedLinePoint<TData = unknown> = LineChartDatum<TData> & {
|
|
66
|
+
key: string | number;
|
|
67
|
+
index: number;
|
|
68
|
+
parsedX: Date | number | string;
|
|
69
|
+
xType: "time" | "linear" | "point";
|
|
70
|
+
seriesKey: string | number;
|
|
71
|
+
seriesIndex: number;
|
|
72
|
+
seriesLabel: React.ReactNode;
|
|
73
|
+
seriesLabelText: string;
|
|
74
|
+
seriesColor: string;
|
|
75
|
+
};
|
|
76
|
+
export type ResolvedLineSeries<TData = unknown> = {
|
|
77
|
+
key: string | number;
|
|
78
|
+
label: React.ReactNode;
|
|
79
|
+
labelText: string;
|
|
80
|
+
color: string;
|
|
81
|
+
gradientStops: string[] | null;
|
|
82
|
+
lineDasharray?: string;
|
|
83
|
+
lineWidth: number;
|
|
84
|
+
lineOpacity: number;
|
|
85
|
+
showArea: boolean;
|
|
86
|
+
areaColor: string;
|
|
87
|
+
areaOpacity: number;
|
|
88
|
+
showPoints: boolean;
|
|
89
|
+
pointColor: string;
|
|
90
|
+
pointRadius: number;
|
|
91
|
+
activePointRadius: number;
|
|
92
|
+
sourceSeries?: LineChartSeries<TData>;
|
|
93
|
+
points: ResolvedLinePoint<TData>[];
|
|
94
|
+
};
|
|
95
|
+
export type ActiveTooltip = {
|
|
96
|
+
pointKey: string | number;
|
|
97
|
+
x: number;
|
|
98
|
+
y: number;
|
|
99
|
+
};
|
|
100
|
+
export type LineChartProps<TData = unknown> = HTMLAttributes<HTMLDivElement> & ChartExportOptions & {
|
|
101
|
+
/** Single-series line data. Ignored when series is provided. */
|
|
102
|
+
data?: LineChartDatum<TData>[];
|
|
103
|
+
/** Multi-series line data. Takes precedence over data when provided. */
|
|
104
|
+
series?: LineChartSeries<TData>[];
|
|
105
|
+
/** Label used for the single-line variant in legend and tooltip context. */
|
|
106
|
+
seriesLabel?: React.ReactNode;
|
|
107
|
+
/** SVG width in pixels. Defaults to 720. */
|
|
108
|
+
width?: number;
|
|
109
|
+
/** SVG height in pixels. Defaults to 320. */
|
|
110
|
+
height?: number;
|
|
111
|
+
/** Partial chart margin overrides. Defaults are based on visible labels. */
|
|
112
|
+
margin?: Partial<LineChartMargin>;
|
|
113
|
+
/** X-axis scale type. Defaults to "auto". */
|
|
114
|
+
xAxisType?: LineChartXAxisType;
|
|
115
|
+
/** D3 curve interpolation used for the line. Defaults to "monotone". */
|
|
116
|
+
curve?: LineChartCurve;
|
|
117
|
+
/** Stroke color for the line. Defaults to the theme primary color. */
|
|
118
|
+
lineColor?: string;
|
|
119
|
+
/** Categorical color palette used for multiple series. */
|
|
120
|
+
colors?: string[];
|
|
121
|
+
/** Generates a gradient for the line and area from start to end. */
|
|
122
|
+
colorGradient?: LineChartColorGradient;
|
|
123
|
+
/** Stroke width of the line in pixels. Defaults to 2.5. */
|
|
124
|
+
lineWidth?: number;
|
|
125
|
+
/** Opacity applied to the line stroke. Clamped between 0 and 1. Defaults to 1. */
|
|
126
|
+
lineOpacity?: number;
|
|
127
|
+
/** SVG stroke dasharray applied to the line. */
|
|
128
|
+
lineDasharray?: string;
|
|
129
|
+
/** Shows a filled area under the line. Defaults to false. */
|
|
130
|
+
showArea?: boolean;
|
|
131
|
+
/** Fill color for the area. Defaults to the line color. */
|
|
132
|
+
areaColor?: string;
|
|
133
|
+
/** Opacity applied to the area fill. Clamped between 0 and 1. Defaults to 0.14. */
|
|
134
|
+
areaOpacity?: number;
|
|
135
|
+
/** Shows visible point markers. Defaults to false. */
|
|
136
|
+
showPoints?: boolean;
|
|
137
|
+
/** Point marker radius in pixels. Defaults to 3. */
|
|
138
|
+
pointRadius?: number;
|
|
139
|
+
/** Radius of the active hovered point marker in pixels. Defaults to 4. */
|
|
140
|
+
activePointRadius?: number;
|
|
141
|
+
/** Point fill color. Defaults to the line color. */
|
|
142
|
+
pointColor?: string;
|
|
143
|
+
/** Point stroke color. Defaults to the theme background paper color. */
|
|
144
|
+
pointBorderColor?: string;
|
|
145
|
+
/** Point stroke width in pixels. Defaults to 1.5. */
|
|
146
|
+
pointBorderWidth?: number;
|
|
147
|
+
/** Opacity applied to point markers. Clamped between 0 and 1. Defaults to 1. */
|
|
148
|
+
pointOpacity?: number;
|
|
149
|
+
/** Minimum y-domain value. */
|
|
150
|
+
yMin?: number;
|
|
151
|
+
/** Maximum y-domain value. */
|
|
152
|
+
yMax?: number;
|
|
153
|
+
/** Approximate number of x-axis ticks for continuous scales. Defaults to 6. */
|
|
154
|
+
xTickCount?: number;
|
|
155
|
+
/** Approximate number of y-axis ticks. Defaults to 5. */
|
|
156
|
+
yTickCount?: number;
|
|
157
|
+
/** Shows or hides grid lines. Defaults to true. */
|
|
158
|
+
showGridLines?: boolean;
|
|
159
|
+
/** Shows or hides axis lines. Defaults to true. */
|
|
160
|
+
showAxisLines?: boolean;
|
|
161
|
+
/** Shows or hides x-axis labels. Defaults to true. */
|
|
162
|
+
showXAxisLabels?: boolean;
|
|
163
|
+
/** Shows or hides y-axis labels. Defaults to true. */
|
|
164
|
+
showYAxisLabels?: boolean;
|
|
165
|
+
/** Shows or hides a compact legend. Defaults to false. */
|
|
166
|
+
showLegend?: boolean;
|
|
167
|
+
/** Shows or hides point labels for smaller datasets. Defaults to false. */
|
|
168
|
+
showLabels?: boolean;
|
|
169
|
+
/** Content shown when no valid data values are available. Defaults to "No data". */
|
|
170
|
+
emptyLabel?: React.ReactNode;
|
|
171
|
+
/** Accessible label for the SVG chart image. Defaults to "Line chart". */
|
|
172
|
+
ariaLabel?: string;
|
|
173
|
+
/** Animates the line on initial render. Defaults to false. */
|
|
174
|
+
animateOnRender?: boolean;
|
|
175
|
+
/** Duration in milliseconds for line animation. Defaults to 720. */
|
|
176
|
+
animationDuration?: number;
|
|
177
|
+
/** Shows a custom themed tooltip when hovering the chart. Defaults to false. */
|
|
178
|
+
showTooltips?: boolean;
|
|
179
|
+
/** Formats y values shown in labels, tooltips, and accessibility text. */
|
|
180
|
+
valueFormatter?: (value: number, datum: LineChartDatum<TData>, series?: LineChartSeries<TData>) => React.ReactNode;
|
|
181
|
+
/** Formats x values shown in tooltips and accessibility text. */
|
|
182
|
+
xValueFormatter?: (value: Date | string | number, datum: LineChartDatum<TData>, series?: LineChartSeries<TData>) => React.ReactNode;
|
|
183
|
+
/** Formats x-axis tick labels. */
|
|
184
|
+
xTickFormatter?: (value: Date | string | number) => React.ReactNode;
|
|
185
|
+
/** Formats y-axis tick labels. */
|
|
186
|
+
yTickFormatter?: (value: number) => React.ReactNode;
|
|
187
|
+
/** Formats labels rendered near points. */
|
|
188
|
+
labelFormatter?: (datum: LineChartDatum<TData>, index: number, series?: LineChartSeries<TData>) => React.ReactNode;
|
|
189
|
+
/** Custom tooltip renderer. Receives the original datum and its index. */
|
|
190
|
+
tooltipFormatter?: (datum: LineChartDatum<TData>, index: number, series?: LineChartSeries<TData>) => React.ReactNode;
|
|
191
|
+
/** Called when a point is clicked or activated with Enter/Space. */
|
|
192
|
+
onPointClick?: (event: React.MouseEvent<SVGCircleElement | SVGRectElement> | React.KeyboardEvent<SVGCircleElement | SVGRectElement>, datum: LineChartDatum<TData>, series?: LineChartSeries<TData>) => void;
|
|
193
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { ReactElement, RefAttributes } from "react";
|
|
2
|
+
import { ChartHandle } from "../ChartUtils";
|
|
3
|
+
import { PieChartProps } from "./PieChart.types";
|
|
4
|
+
export declare const PieChart: <TData>(props: PieChartProps<TData> & RefAttributes<ChartHandle>) => ReactElement | null;
|