@lunit/oui 1.3.0 → 2.0.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/dist/assets/ic-copy-coordinates-outlined-20px.js +1 -1
- package/dist/components/Alert/Alert.utils.js +3 -3
- package/dist/components/Chip/Chip.utils.js +3 -3
- package/dist/components/TextField/TextArea.types.d.ts +2 -1
- package/dist/components/TextField/TextInput.js +5 -1
- package/dist/components/TextField/TextInput.styled.js +2 -1
- package/dist/components/TextField/TextInput.types.d.ts +6 -2
- package/dist/components/TextField/TextInput.utils.d.ts +3 -3
- package/dist/components/TextField/TextInput.utils.js +4 -2
- package/dist/components/TextField/components/Buttons.d.ts +7 -1
- package/dist/components/TextField/components/Buttons.js +15 -1
- package/dist/components/TextField/components/FileInput.d.ts +4 -0
- package/dist/components/TextField/components/FileInput.js +21 -0
- package/dist/components/Toggle/Toggle.d.ts +3 -0
- package/dist/components/Toggle/Toggle.js +16 -0
- package/dist/components/Toggle/Toggle.styled.d.ts +7 -0
- package/dist/components/Toggle/Toggle.styled.js +90 -0
- package/dist/components/Toggle/Toggle.types.d.ts +18 -0
- package/dist/components/Toggle/Toggle.types.js +1 -0
- package/dist/components/Toggle/index.d.ts +4 -0
- package/dist/components/Toggle/index.js +2 -0
- package/dist/components/UploadManager/UploadManager.js +2 -2
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +1 -0
- package/dist/icons/index.d.ts +1 -1
- package/dist/icons/index.js +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/presentations/Accordion/Accordion.d.ts +3 -0
- package/dist/presentations/Accordion/Accordion.js +21 -0
- package/dist/presentations/Accordion/Accordion.styled.d.ts +22 -0
- package/dist/presentations/Accordion/Accordion.styled.js +39 -0
- package/dist/presentations/Accordion/Accordion.types.d.ts +22 -0
- package/dist/presentations/Accordion/Accordion.types.js +1 -0
- package/dist/presentations/Accordion/index.d.ts +2 -0
- package/dist/presentations/Accordion/index.js +2 -0
- package/dist/presentations/AnalysisBar/AnalysisBar.d.ts +3 -0
- package/dist/presentations/AnalysisBar/AnalysisBar.js +26 -0
- package/dist/presentations/AnalysisBar/AnalysisBar.styled.d.ts +31 -0
- package/dist/presentations/AnalysisBar/AnalysisBar.styled.js +103 -0
- package/dist/presentations/AnalysisBar/AnalysisBar.types.d.ts +11 -0
- package/dist/presentations/AnalysisBar/AnalysisBar.types.js +1 -0
- package/dist/presentations/AnalysisBar/AnalysisBar.utils.d.ts +5 -0
- package/dist/presentations/AnalysisBar/AnalysisBar.utils.js +34 -0
- package/dist/presentations/AnalysisBar/HeatmapGraphIcon/HeatmapGraphSVG.d.ts +3 -0
- package/dist/presentations/AnalysisBar/HeatmapGraphIcon/HeatmapGraphSVG.js +3 -0
- package/dist/presentations/AnalysisBar/HeatmapGraphIcon/index.d.ts +7 -0
- package/dist/presentations/AnalysisBar/HeatmapGraphIcon/index.js +8 -0
- package/dist/presentations/AnalysisBar/index.d.ts +4 -0
- package/dist/presentations/AnalysisBar/index.js +2 -0
- package/dist/presentations/FreeText/FreeText.d.ts +3 -0
- package/dist/presentations/FreeText/FreeText.js +27 -0
- package/dist/presentations/FreeText/FreeText.types.d.ts +9 -0
- package/dist/presentations/FreeText/FreeText.types.js +1 -0
- package/dist/presentations/FreeText/index.d.ts +4 -0
- package/dist/presentations/FreeText/index.js +2 -0
- package/dist/presentations/Histogram/Histogram.d.ts +3 -0
- package/dist/presentations/Histogram/Histogram.js +15 -0
- package/dist/presentations/Histogram/Histogram.styled.d.ts +23 -0
- package/dist/presentations/Histogram/Histogram.styled.js +47 -0
- package/dist/presentations/Histogram/Histogram.types.d.ts +27 -0
- package/dist/presentations/Histogram/Histogram.types.js +1 -0
- package/dist/presentations/Histogram/Histogram.utils.d.ts +23 -0
- package/dist/presentations/Histogram/Histogram.utils.js +45 -0
- package/dist/presentations/Histogram/HistogramCharts.d.ts +3 -0
- package/dist/presentations/Histogram/HistogramCharts.js +20 -0
- package/dist/presentations/Histogram/HistogramTabs.d.ts +3 -0
- package/dist/presentations/Histogram/HistogramTabs.js +27 -0
- package/dist/presentations/Histogram/index.d.ts +4 -0
- package/dist/presentations/Histogram/index.js +2 -0
- package/dist/presentations/HorizonDivider/HorizonDivider.d.ts +3 -0
- package/dist/presentations/HorizonDivider/HorizonDivider.js +6 -0
- package/dist/presentations/HorizonDivider/HorizonDivider.types.d.ts +4 -0
- package/dist/presentations/HorizonDivider/HorizonDivider.types.js +1 -0
- package/dist/presentations/HorizonDivider/index.d.ts +4 -0
- package/dist/presentations/HorizonDivider/index.js +2 -0
- package/dist/presentations/Score/Score.d.ts +3 -0
- package/dist/presentations/Score/Score.js +9 -0
- package/dist/presentations/Score/Score.types.d.ts +13 -0
- package/dist/presentations/Score/Score.types.js +1 -0
- package/dist/presentations/Score/index.d.ts +4 -0
- package/dist/presentations/Score/index.js +2 -0
- package/dist/presentations/Statistic/Statistic.d.ts +3 -0
- package/dist/presentations/Statistic/Statistic.js +12 -0
- package/dist/presentations/Statistic/Statistic.styled.d.ts +11 -0
- package/dist/presentations/Statistic/Statistic.styled.js +17 -0
- package/dist/presentations/Statistic/Statistic.types.d.ts +11 -0
- package/dist/presentations/Statistic/Statistic.types.js +1 -0
- package/dist/presentations/Statistic/index.d.ts +4 -0
- package/dist/presentations/Statistic/index.js +2 -0
- package/dist/presentations/ToggleControl/ToggleControl.d.ts +3 -0
- package/dist/presentations/ToggleControl/ToggleControl.js +22 -0
- package/dist/presentations/ToggleControl/ToggleControl.styled.d.ts +15 -0
- package/dist/presentations/ToggleControl/ToggleControl.styled.js +27 -0
- package/dist/presentations/ToggleControl/ToggleControl.types.d.ts +21 -0
- package/dist/presentations/ToggleControl/ToggleControl.types.js +1 -0
- package/dist/presentations/ToggleControl/index.d.ts +4 -0
- package/dist/presentations/ToggleControl/index.js +2 -0
- package/dist/presentations/ToggleControlGroup/ToggleControlGroup.d.ts +3 -0
- package/dist/presentations/ToggleControlGroup/ToggleControlGroup.js +32 -0
- package/dist/presentations/ToggleControlGroup/ToggleControlGroup.styled.d.ts +4 -0
- package/dist/presentations/ToggleControlGroup/ToggleControlGroup.styled.js +9 -0
- package/dist/presentations/ToggleControlGroup/ToggleControlGroup.types.d.ts +21 -0
- package/dist/presentations/ToggleControlGroup/ToggleControlGroup.types.js +1 -0
- package/dist/presentations/ToggleControlGroup/index.d.ts +2 -0
- package/dist/presentations/ToggleControlGroup/index.js +2 -0
- package/dist/presentations/index.d.ts +9 -0
- package/dist/presentations/index.js +9 -0
- package/dist/presentations/presentations.styled.d.ts +3 -0
- package/dist/presentations/presentations.styled.js +91 -0
- package/dist/presentations/presentations.types.d.ts +12 -0
- package/dist/presentations/presentations.types.js +1 -0
- package/package.json +3 -1
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Box, styled, Typography } from '@mui/material';
|
|
3
|
+
import { adjustBarLabelPosition, clampBarLabelPosition, parseStringValToNumber, } from './AnalysisBar.utils';
|
|
4
|
+
export const AnalysisBarOuter = styled(Box, {
|
|
5
|
+
shouldForwardProp: (prop) => prop !== 'isDimmed',
|
|
6
|
+
})(({ isDimmed }) => ({
|
|
7
|
+
display: 'flex',
|
|
8
|
+
flexDirection: 'column',
|
|
9
|
+
alignItems: 'center',
|
|
10
|
+
width: '100%',
|
|
11
|
+
gap: '4px',
|
|
12
|
+
opacity: isDimmed ? 0.4 : 1,
|
|
13
|
+
}));
|
|
14
|
+
export const AnalysisBarSegmentContainer = styled(Box)(() => ({
|
|
15
|
+
display: 'flex',
|
|
16
|
+
alignItems: 'center',
|
|
17
|
+
position: 'relative',
|
|
18
|
+
width: '100%',
|
|
19
|
+
}));
|
|
20
|
+
const GraphScoreIndicatorContainer = styled('span')(() => {
|
|
21
|
+
return {
|
|
22
|
+
width: '20px',
|
|
23
|
+
position: 'absolute',
|
|
24
|
+
display: 'flex',
|
|
25
|
+
flexDirection: 'column',
|
|
26
|
+
alignItems: 'center',
|
|
27
|
+
top: '-20px',
|
|
28
|
+
zIndex: 999,
|
|
29
|
+
};
|
|
30
|
+
});
|
|
31
|
+
const GraphScoreIndicatorPip = styled('span')(() => {
|
|
32
|
+
return {
|
|
33
|
+
height: '8px !important',
|
|
34
|
+
width: '8px !important',
|
|
35
|
+
borderRadius: '50%',
|
|
36
|
+
border: '3px solid black',
|
|
37
|
+
background: 'white',
|
|
38
|
+
boxSizing: 'content-box',
|
|
39
|
+
};
|
|
40
|
+
});
|
|
41
|
+
export const GraphScoreIndicator = ({ value, adjustForOnePercent, }) => {
|
|
42
|
+
let leftPos = parseStringValToNumber(value);
|
|
43
|
+
if (adjustForOnePercent) {
|
|
44
|
+
leftPos = adjustBarLabelPosition(leftPos);
|
|
45
|
+
}
|
|
46
|
+
return (_jsxs(GraphScoreIndicatorContainer, { className: "analysis-bar-score-indicator", sx: {
|
|
47
|
+
left: `${leftPos}%`,
|
|
48
|
+
transform: 'translateX(-50%)',
|
|
49
|
+
}, children: [_jsx(Typography, { variant: "small_body_sb1", sx: { textAlign: 'center' }, children: value }), _jsx(GraphScoreIndicatorPip, {})] }));
|
|
50
|
+
};
|
|
51
|
+
const GraphAxisLabelContainer = styled('span')(() => {
|
|
52
|
+
return {
|
|
53
|
+
position: 'absolute',
|
|
54
|
+
width: 'auto',
|
|
55
|
+
height: '10px',
|
|
56
|
+
display: 'flex',
|
|
57
|
+
justifyContent: 'center',
|
|
58
|
+
alignItems: 'center',
|
|
59
|
+
};
|
|
60
|
+
});
|
|
61
|
+
export const GraphAxisLabel = ({ label, leftPos, adjustForOnePercent, }) => {
|
|
62
|
+
const getLeft = (value, adjustForOnePercent) => {
|
|
63
|
+
if (adjustForOnePercent) {
|
|
64
|
+
return `${adjustBarLabelPosition(value)}%`;
|
|
65
|
+
}
|
|
66
|
+
return `${clampBarLabelPosition(value)}%`;
|
|
67
|
+
};
|
|
68
|
+
return (_jsx(GraphAxisLabelContainer, { sx: {
|
|
69
|
+
left: getLeft(leftPos, adjustForOnePercent),
|
|
70
|
+
transform: 'translateX(-50%)',
|
|
71
|
+
}, className: "analysis-bar-axis-label", children: _jsx(Typography, { variant: "small_body_m5", sx: { textAlign: 'center' }, children: label }) }));
|
|
72
|
+
};
|
|
73
|
+
export const AxisLabels = ({ children }) => {
|
|
74
|
+
return (_jsx(Box, { sx: {
|
|
75
|
+
position: 'relative',
|
|
76
|
+
display: 'flex',
|
|
77
|
+
justifyContent: 'space-between',
|
|
78
|
+
width: '100%',
|
|
79
|
+
height: '10px',
|
|
80
|
+
}, className: "analysis-bar-axis-label-box", children: children }));
|
|
81
|
+
};
|
|
82
|
+
export const AnalysisBarCaption = ({ label }) => {
|
|
83
|
+
return (_jsx(GraphAxisLabelContainer, { sx: {
|
|
84
|
+
left: '50%',
|
|
85
|
+
transform: 'translateX(-50%)',
|
|
86
|
+
width: 'auto',
|
|
87
|
+
}, className: "analysis-bar-caption", children: _jsx(Typography, { variant: "small_body_m5", sx: { textAlign: 'center' }, children: label }) }));
|
|
88
|
+
};
|
|
89
|
+
const segmentStyle = (color, width, square) => {
|
|
90
|
+
return {
|
|
91
|
+
backgroundColor: color,
|
|
92
|
+
width: `${width}%`,
|
|
93
|
+
height: '8px',
|
|
94
|
+
borderRadius: square ? '0px' : '12px',
|
|
95
|
+
};
|
|
96
|
+
};
|
|
97
|
+
export const GraphSegment = styled('span', {
|
|
98
|
+
shouldForwardProp: (prop) => !['color', 'width', 'square'].includes(prop.toString()),
|
|
99
|
+
})(({ color, width, square }) => {
|
|
100
|
+
return {
|
|
101
|
+
...segmentStyle(color ?? 'red', width, square ?? false), // fallback color
|
|
102
|
+
};
|
|
103
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare function parseStringValToNumber(val: string): number;
|
|
2
|
+
export declare function adjustBarSegmentWidth(value: number): number;
|
|
3
|
+
export declare function adjustBarLabelPosition(value: number): number;
|
|
4
|
+
export declare function clampNumericalPercentage(value: number): number;
|
|
5
|
+
export declare function clampBarLabelPosition(value: number): number;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export function parseStringValToNumber(val) {
|
|
2
|
+
const value = val.endsWith('%') ? val.slice(0, -1) : val;
|
|
3
|
+
return parseInt(value, 10);
|
|
4
|
+
}
|
|
5
|
+
export function adjustBarSegmentWidth(value) {
|
|
6
|
+
if (value === 0)
|
|
7
|
+
return 0;
|
|
8
|
+
const adjusted = Math.floor((value / 100) * 97);
|
|
9
|
+
return adjusted + 4;
|
|
10
|
+
}
|
|
11
|
+
export function adjustBarLabelPosition(value) {
|
|
12
|
+
if (value === 0)
|
|
13
|
+
return 1;
|
|
14
|
+
if (value === 1)
|
|
15
|
+
return 4;
|
|
16
|
+
if (value === 100)
|
|
17
|
+
return 98;
|
|
18
|
+
const adjusted = Math.floor((value / 100) * 93);
|
|
19
|
+
return adjusted + 6;
|
|
20
|
+
}
|
|
21
|
+
export function clampNumericalPercentage(value) {
|
|
22
|
+
if (value >= 100)
|
|
23
|
+
return 100;
|
|
24
|
+
if (value <= 0)
|
|
25
|
+
return 0;
|
|
26
|
+
return value;
|
|
27
|
+
}
|
|
28
|
+
export function clampBarLabelPosition(value) {
|
|
29
|
+
if (value >= 100)
|
|
30
|
+
return 97;
|
|
31
|
+
if (value <= 0)
|
|
32
|
+
return 1;
|
|
33
|
+
return value;
|
|
34
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
const HeatmapGraphSVG = (props) => (_jsxs("svg", { width: "234", height: "8", viewBox: "0 0 234 8", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props, children: [_jsx("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M1.30733e-07 4C5.85312e-08 1.79086 1.79086 5.86502e-08 4 1.30999e-07L230 7.53243e-06C232.209 7.60478e-06 234 1.79087 234 4.00001C234 6.20915 232.209 8.00001 230 8.00001L4 8C1.79086 8 2.02935e-07 6.20914 1.30733e-07 4Z", fill: "url(#paint0_linear_4060_316245)" }), _jsx("defs", { children: _jsxs("linearGradient", { id: "paint0_linear_4060_316245", x1: "-0.585003", y1: "5.99984", x2: "228.159", y2: "4.97311", gradientUnits: "userSpaceOnUse", children: [_jsx("stop", { stopColor: "#3000FF" }), _jsx("stop", { offset: "0.239583", stopColor: "#5CFFE2" }), _jsx("stop", { offset: "0.447917", stopColor: "#E2FFA4" }), _jsx("stop", { offset: "0.546875", stopColor: "#FCFF75" }), _jsx("stop", { offset: "0.78125", stopColor: "#FDBA73" }), _jsx("stop", { offset: "1", stopColor: "#FF0F00" })] }) })] }));
|
|
3
|
+
export default HeatmapGraphSVG;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import SvgIcon from '@mui/material/SvgIcon';
|
|
3
|
+
import HeatmapGraph from './HeatmapGraphSVG';
|
|
4
|
+
const HeatmapGraphIcon = (props) => {
|
|
5
|
+
return (_jsx(SvgIcon, { ...props, component: HeatmapGraph, inheritViewBox: true }));
|
|
6
|
+
};
|
|
7
|
+
HeatmapGraphIcon.displayName = 'HeatmapGraphIcon';
|
|
8
|
+
export default HeatmapGraphIcon;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Box } from '@mui/material';
|
|
3
|
+
import theme from '../../theme';
|
|
4
|
+
import { PresentationTypography } from '../presentations.styled';
|
|
5
|
+
const FreeText = ({ componentType = 'freeText', size = 'medium', content, height, background = false, }) => {
|
|
6
|
+
return (_jsx(Box, { sx: {
|
|
7
|
+
padding: background ? '8px 6px 8px 16px' : 0,
|
|
8
|
+
borderRadius: background ? '8px' : 0,
|
|
9
|
+
backgroundColor: background ? theme.palette.neutralGrey[75] : 'transparent',
|
|
10
|
+
height: height ? height : 'auto',
|
|
11
|
+
}, children: _jsx(PresentationTypography, { size: size, sx: {
|
|
12
|
+
display: 'flex',
|
|
13
|
+
whiteSpace: 'pre-wrap',
|
|
14
|
+
overflow: 'auto',
|
|
15
|
+
color: background ? '#FFFFFF' : 'inherit',
|
|
16
|
+
height: height ? '100%' : 'auto',
|
|
17
|
+
'&::-webkit-scrollbar': {
|
|
18
|
+
width: '12px',
|
|
19
|
+
},
|
|
20
|
+
'&::-webkit-scrollbar-thumb': {
|
|
21
|
+
width: '6px',
|
|
22
|
+
backgroundColor: theme.palette.neutralGrey[65],
|
|
23
|
+
borderRadius: '6px',
|
|
24
|
+
},
|
|
25
|
+
}, children: content }) }));
|
|
26
|
+
};
|
|
27
|
+
export default FreeText;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { Box } from '@mui/material';
|
|
4
|
+
import { HistogramContainer, HistogramChartContainer, HistogramTitle, HistogramNoData, } from './Histogram.styled';
|
|
5
|
+
import HistogramTabs from './HistogramTabs';
|
|
6
|
+
import HistogramChart from './HistogramCharts';
|
|
7
|
+
const Histogram = ({ componentType = 'histogram', title, xAxisLabels, yAxisLabels, tabs, }) => {
|
|
8
|
+
const [activeIndex, setActiveIndex] = useState(0);
|
|
9
|
+
const noData = tabs[activeIndex].data.length === 0;
|
|
10
|
+
return (_jsxs(HistogramContainer, { children: [noData && _jsx(HistogramNoData, { children: "No Data" }), title && _jsx(HistogramTitle, { children: title }), _jsx(HistogramTabs, { options: tabs.map((tab) => tab.label), active: activeIndex, onChange: setActiveIndex }), _jsx(HistogramChartContainer, { children: _jsx(Box, { sx: {
|
|
11
|
+
position: 'absolute',
|
|
12
|
+
left: '-25px',
|
|
13
|
+
}, children: _jsx(HistogramChart, { dataset: tabs[activeIndex], xAxisLabels: xAxisLabels, yAxisLabels: yAxisLabels }) }) })] }));
|
|
14
|
+
};
|
|
15
|
+
export default Histogram;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const HistogramContainer: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<import("@mui/material").Theme> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
3
|
+
ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
4
|
+
}, keyof import("@mui/system").BoxOwnProps<import("@mui/material").Theme>> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
5
|
+
export declare const HistogramTitle: import("@emotion/styled").StyledComponent<import("@mui/material").TypographyOwnProps & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & {
|
|
6
|
+
ref?: ((instance: HTMLSpanElement | null) => void) | import("react").RefObject<HTMLSpanElement> | null | undefined;
|
|
7
|
+
}, "width" | "zIndex" | "typography" | "color" | "fontFamily" | "fontSize" | "fontWeight" | "lineHeight" | "letterSpacing" | "textTransform" | "alignContent" | "alignItems" | "alignSelf" | "bottom" | "boxShadow" | "boxSizing" | "columnGap" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontStyle" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "height" | "justifyContent" | "justifyItems" | "justifySelf" | "left" | "marginBlockEnd" | "marginBlockStart" | "marginBottom" | "marginInlineEnd" | "marginInlineStart" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "order" | "paddingBlockEnd" | "paddingBlockStart" | "paddingBottom" | "paddingInlineEnd" | "paddingInlineStart" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "right" | "rowGap" | "textAlign" | "textOverflow" | "top" | "visibility" | "whiteSpace" | "border" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "flex" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "marginBlock" | "marginInline" | "overflow" | "padding" | "paddingBlock" | "paddingInline" | "style" | "classes" | "className" | "children" | "sx" | "variant" | "p" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "displayPrint" | "align" | "gutterBottom" | "noWrap" | "paragraph" | "variantMapping"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
8
|
+
export declare const HistogramNoData: import("@emotion/styled").StyledComponent<import("@mui/material").TypographyOwnProps & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & {
|
|
9
|
+
ref?: ((instance: HTMLSpanElement | null) => void) | import("react").RefObject<HTMLSpanElement> | null | undefined;
|
|
10
|
+
}, "width" | "zIndex" | "typography" | "color" | "fontFamily" | "fontSize" | "fontWeight" | "lineHeight" | "letterSpacing" | "textTransform" | "alignContent" | "alignItems" | "alignSelf" | "bottom" | "boxShadow" | "boxSizing" | "columnGap" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontStyle" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "height" | "justifyContent" | "justifyItems" | "justifySelf" | "left" | "marginBlockEnd" | "marginBlockStart" | "marginBottom" | "marginInlineEnd" | "marginInlineStart" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "order" | "paddingBlockEnd" | "paddingBlockStart" | "paddingBottom" | "paddingInlineEnd" | "paddingInlineStart" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "right" | "rowGap" | "textAlign" | "textOverflow" | "top" | "visibility" | "whiteSpace" | "border" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "flex" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "marginBlock" | "marginInline" | "overflow" | "padding" | "paddingBlock" | "paddingInline" | "style" | "classes" | "className" | "children" | "sx" | "variant" | "p" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "displayPrint" | "align" | "gutterBottom" | "noWrap" | "paragraph" | "variantMapping"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
11
|
+
export declare const HistogramTabsContainer: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<import("@mui/material").Theme> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
12
|
+
ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
13
|
+
}, keyof import("@mui/system").BoxOwnProps<import("@mui/material").Theme>> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
14
|
+
export declare const HistogramChartContainer: import("@emotion/styled").StyledComponent<import("@mui/system").BoxOwnProps<import("@mui/material").Theme> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
15
|
+
ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
16
|
+
}, keyof import("@mui/system").BoxOwnProps<import("@mui/material").Theme>> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
17
|
+
export declare const TabButton: import("@emotion/styled").StyledComponent<import("@mui/material").ButtonOwnProps & Omit<import("@mui/material").ButtonBaseOwnProps, "classes"> & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
|
|
18
|
+
ref?: ((instance: HTMLButtonElement | null) => void) | import("react").RefObject<HTMLButtonElement> | null | undefined;
|
|
19
|
+
}, "color" | "disabled" | "size" | "style" | "fullWidth" | "classes" | "className" | "children" | "sx" | "variant" | "tabIndex" | "action" | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "TouchRippleProps" | "touchRippleRef" | "disableElevation" | "disableFocusRipple" | "endIcon" | "href" | "startIcon"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & {
|
|
20
|
+
component?: import("react").ElementType<any> | undefined;
|
|
21
|
+
} & {
|
|
22
|
+
active?: boolean | undefined;
|
|
23
|
+
}, {}, {}>;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { Box, Button, styled, Typography } from '@mui/material';
|
|
2
|
+
export const HistogramContainer = styled(Box)({
|
|
3
|
+
display: 'flex',
|
|
4
|
+
flexDirection: 'column',
|
|
5
|
+
alignItems: 'center',
|
|
6
|
+
gap: '5px',
|
|
7
|
+
position: 'relative',
|
|
8
|
+
});
|
|
9
|
+
export const HistogramTitle = styled(Typography)({
|
|
10
|
+
width: '100%',
|
|
11
|
+
paddingBottom: '12px',
|
|
12
|
+
});
|
|
13
|
+
export const HistogramNoData = styled(Typography)(({ theme }) => ({
|
|
14
|
+
top: '42%',
|
|
15
|
+
position: 'absolute',
|
|
16
|
+
padding: '8px 16px',
|
|
17
|
+
borderRadius: '4px',
|
|
18
|
+
background: theme.palette.neutralGrey[75],
|
|
19
|
+
zIndex: 9999,
|
|
20
|
+
}));
|
|
21
|
+
export const HistogramTabsContainer = styled(Box)({
|
|
22
|
+
width: '100%',
|
|
23
|
+
display: 'grid',
|
|
24
|
+
gridTemplateColumns: '1fr 1fr',
|
|
25
|
+
});
|
|
26
|
+
export const HistogramChartContainer = styled(Box)({
|
|
27
|
+
position: 'relative',
|
|
28
|
+
height: '200px',
|
|
29
|
+
width: '244px',
|
|
30
|
+
marginBottom: '32px',
|
|
31
|
+
});
|
|
32
|
+
export const TabButton = styled(Button, {
|
|
33
|
+
shouldForwardProp: (prop) => prop !== 'active',
|
|
34
|
+
})(({ theme, active = false }) => ({
|
|
35
|
+
borderRadius: '8px',
|
|
36
|
+
backgroundColor: active ? theme.palette.neutralGrey[75] : 'transparent',
|
|
37
|
+
border: `1px solid ${theme.palette.neutralGrey[75]} !important`,
|
|
38
|
+
textTransform: 'none',
|
|
39
|
+
color: active ? theme.palette.neutralGrey[0] : theme.palette.neutralGrey[45],
|
|
40
|
+
cursor: active ? 'default' : 'pointer',
|
|
41
|
+
height: '28px',
|
|
42
|
+
width: '128px',
|
|
43
|
+
minWidth: '128px',
|
|
44
|
+
'&:hover': {
|
|
45
|
+
backgroundColor: active ? theme.palette.neutralGrey[75] : 'transparent',
|
|
46
|
+
},
|
|
47
|
+
}));
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export interface HistogramTab {
|
|
2
|
+
label: string;
|
|
3
|
+
data: number[];
|
|
4
|
+
}
|
|
5
|
+
export interface HistogramProps {
|
|
6
|
+
componentType: 'histogram';
|
|
7
|
+
title?: string;
|
|
8
|
+
xAxisLabels: number[];
|
|
9
|
+
yAxisLabels: number[];
|
|
10
|
+
tabs: HistogramTab[];
|
|
11
|
+
}
|
|
12
|
+
export interface HistogramTabsProps {
|
|
13
|
+
options: string[];
|
|
14
|
+
active: number;
|
|
15
|
+
onChange: (index: number) => void;
|
|
16
|
+
}
|
|
17
|
+
export interface HistogramChartProps {
|
|
18
|
+
dataset: HistogramTab;
|
|
19
|
+
xAxisLabels: number[];
|
|
20
|
+
yAxisLabels: number[];
|
|
21
|
+
}
|
|
22
|
+
interface HistogramDatapoint {
|
|
23
|
+
x: number;
|
|
24
|
+
y: number;
|
|
25
|
+
}
|
|
26
|
+
export type VictoryStructuredData = HistogramDatapoint[];
|
|
27
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { VictoryStructuredData } from './Histogram.types';
|
|
2
|
+
/**
|
|
3
|
+
* Creates an array of data points for the histogram chart.
|
|
4
|
+
*
|
|
5
|
+
* @param sourceData - The source data array.
|
|
6
|
+
* @returns An array of data points for the histogram chart.
|
|
7
|
+
*/
|
|
8
|
+
export declare function makeHistoDataArray(sourceData: number[]): VictoryStructuredData;
|
|
9
|
+
/**
|
|
10
|
+
* Returns the border radius for a tab button based on its index and the total number of tabs.
|
|
11
|
+
*
|
|
12
|
+
* @param idx - The index of the tab button.
|
|
13
|
+
* @param max - The total number of tab buttons.
|
|
14
|
+
* @returns The border radius for the tab button.
|
|
15
|
+
*/
|
|
16
|
+
export declare function doBorderRadius(idx: number, max: number): string;
|
|
17
|
+
/**
|
|
18
|
+
* Calculates the font size for a tab button based on its label.
|
|
19
|
+
*
|
|
20
|
+
* @param text - The label of the tab button.
|
|
21
|
+
* @returns The font size for the tab button.
|
|
22
|
+
*/
|
|
23
|
+
export declare const calculateFontSize: (text: string) => number;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates an array of data points for the histogram chart.
|
|
3
|
+
*
|
|
4
|
+
* @param sourceData - The source data array.
|
|
5
|
+
* @returns An array of data points for the histogram chart.
|
|
6
|
+
*/
|
|
7
|
+
export function makeHistoDataArray(sourceData) {
|
|
8
|
+
const cappedData = sourceData.slice(0, 10);
|
|
9
|
+
return cappedData.map((d, i) => ({
|
|
10
|
+
x: i * 10,
|
|
11
|
+
y: d,
|
|
12
|
+
}));
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Returns the border radius for a tab button based on its index and the total number of tabs.
|
|
16
|
+
*
|
|
17
|
+
* @param idx - The index of the tab button.
|
|
18
|
+
* @param max - The total number of tab buttons.
|
|
19
|
+
* @returns The border radius for the tab button.
|
|
20
|
+
*/
|
|
21
|
+
export function doBorderRadius(idx, max) {
|
|
22
|
+
const BORDER_RADIUS = '6px';
|
|
23
|
+
const borderRadiusMap = {
|
|
24
|
+
0: `${BORDER_RADIUS} 0 0 0`,
|
|
25
|
+
1: `0 ${BORDER_RADIUS} 0 0`,
|
|
26
|
+
[max - 2]: `0 0 0 ${BORDER_RADIUS}`,
|
|
27
|
+
[max - 1]: `0 0 ${BORDER_RADIUS} 0`,
|
|
28
|
+
};
|
|
29
|
+
return borderRadiusMap[idx] || '0';
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Calculates the font size for a tab button based on its label.
|
|
33
|
+
*
|
|
34
|
+
* @param text - The label of the tab button.
|
|
35
|
+
* @returns The font size for the tab button.
|
|
36
|
+
*/
|
|
37
|
+
export const calculateFontSize = (text) => {
|
|
38
|
+
if (text.length <= 9)
|
|
39
|
+
return 14;
|
|
40
|
+
if (text.length <= 12)
|
|
41
|
+
return 12;
|
|
42
|
+
if (text.length <= 15)
|
|
43
|
+
return 11;
|
|
44
|
+
return 9;
|
|
45
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { VictoryAxis, VictoryBar, VictoryChart, VictoryLabel } from 'victory';
|
|
3
|
+
import theme from '../../theme';
|
|
4
|
+
import { makeHistoDataArray } from './Histogram.utils';
|
|
5
|
+
const HistogramChart = ({ dataset, xAxisLabels, yAxisLabels }) => {
|
|
6
|
+
const dataArray = dataset.data;
|
|
7
|
+
return (_jsxs(VictoryChart, { height: 400, width: 470, domain: { x: [0, 100], y: [0, 100] }, children: [_jsx(VictoryAxis, { crossAxis: true, tickValues: xAxisLabels, style: {
|
|
8
|
+
tickLabels: { fill: theme.palette.neutralGrey[0], fontSize: '20px' },
|
|
9
|
+
ticks: { stroke: theme.palette.neutralGrey[50], opacity: 0.5 },
|
|
10
|
+
} }), _jsx(VictoryAxis, { orientation: "right", dependentAxis: true, tickFormat: (t) => (t === 0 ? ' (%)' : `${t}`), tickValues: yAxisLabels, style: {
|
|
11
|
+
tickLabels: {
|
|
12
|
+
fill: theme.palette.neutralGrey[0],
|
|
13
|
+
fontSize: '20px',
|
|
14
|
+
},
|
|
15
|
+
grid: { stroke: theme.palette.neutralGrey[50], strokeDasharray: '10, 5', opacity: 0.5 },
|
|
16
|
+
}, tickLabelComponent: _jsx(VictoryLabel, { dx: 10 }) }), _jsx(VictoryBar, { data: makeHistoDataArray(dataArray), style: {
|
|
17
|
+
data: { fill: theme.palette.lunitTeal[40], width: 34 },
|
|
18
|
+
}, alignment: "start", cornerRadius: { topLeft: 6, topRight: 6 } })] }));
|
|
19
|
+
};
|
|
20
|
+
export default HistogramChart;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Typography } from '@mui/material';
|
|
3
|
+
import { calculateFontSize, doBorderRadius } from './Histogram.utils';
|
|
4
|
+
import { HistogramTabsContainer, TabButton } from './Histogram.styled';
|
|
5
|
+
const HistogramTabs = ({ options, active, onChange }) => {
|
|
6
|
+
return (_jsx(HistogramTabsContainer, { children: options.map((tabLabel, idx) => {
|
|
7
|
+
const fontSize = calculateFontSize(tabLabel);
|
|
8
|
+
const commonButtonProps = {
|
|
9
|
+
key: tabLabel,
|
|
10
|
+
disableRipple: true,
|
|
11
|
+
active: idx === active,
|
|
12
|
+
onClick: () => onChange(idx),
|
|
13
|
+
sx: {
|
|
14
|
+
padding: '4px 6px',
|
|
15
|
+
borderRadius: doBorderRadius(idx, options.length),
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
return (_jsx(TabButton, { ...commonButtonProps, children: _jsx(Typography, { variant: "body_sb1", sx: {
|
|
19
|
+
fontSize: `${fontSize}px`,
|
|
20
|
+
whiteSpace: 'nowrap',
|
|
21
|
+
overflow: 'hidden',
|
|
22
|
+
textOverflow: 'ellipsis',
|
|
23
|
+
width: '100%',
|
|
24
|
+
}, children: tabLabel }) }));
|
|
25
|
+
}) }));
|
|
26
|
+
};
|
|
27
|
+
export default HistogramTabs;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { PresentationTypography } from '../presentations.styled';
|
|
3
|
+
const capitalize = (str) => {
|
|
4
|
+
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
5
|
+
};
|
|
6
|
+
const Score = ({ componentType = 'score', title, size = 'medium', metrics }) => {
|
|
7
|
+
return (_jsxs(PresentationTypography, { size: size, style: { color: metrics.isFullColored ? metrics.color : 'inherit' }, children: [title, ": ", metrics.value, metrics.scoreType && (_jsx("span", { style: { color: metrics.color, marginLeft: 4 }, children: capitalize(metrics.scoreType) }))] }));
|
|
8
|
+
};
|
|
9
|
+
export default Score;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { PresentationElementSize } from '../presentations.types';
|
|
2
|
+
interface ScoreProps {
|
|
3
|
+
componentType: 'score';
|
|
4
|
+
title: string;
|
|
5
|
+
size?: PresentationElementSize;
|
|
6
|
+
metrics: {
|
|
7
|
+
value: string;
|
|
8
|
+
scoreType?: 'positive' | 'negative';
|
|
9
|
+
color?: string;
|
|
10
|
+
isFullColored?: boolean;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
export type { ScoreProps };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|