sag_components 2.0.0-beta45 → 2.0.0-beta48
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/index.d.ts +3 -1
- package/dist/index.esm.js +151 -82
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +151 -81
- package/dist/index.js.map +1 -1
- package/dist/types/components/DoubleBarSingleLine/DoubleBarSingleLine.stories.d.ts +30 -17
- package/dist/types/index.d.ts +1 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1203,4 +1203,6 @@ declare function LinkButton({ text, type, size, height, width, disabled, textCol
|
|
|
1203
1203
|
|
|
1204
1204
|
declare function BatteryChart(props: any): react_jsx_runtime.JSX.Element;
|
|
1205
1205
|
|
|
1206
|
-
|
|
1206
|
+
declare function PerformanceAnalyticsLegend(props: any): react_jsx_runtime.JSX.Element;
|
|
1207
|
+
|
|
1208
|
+
export { AreaChart, BannerEventBoxList, BarChart, BarChartsByWeeks, BatteryChart, BreakdownPanel, Button, CollapseHeader, DialogOverlay, DoubleBarSingleLine, DoublePanelDataRow, EventDetailsCard, EventList, FilterPanel, Heatmap, IconButton, LinkButton, LinnerDataBox, MarketShareDescription, OneColumnContainer, PerformanceAnalyticsLegend, PieChart, PopupCharts, QuickFilter, ReportTable, TabMenu, TopToggleList, TotalDoughnutChart, TotalHorizontalCharts };
|
package/dist/index.esm.js
CHANGED
|
@@ -25889,39 +25889,45 @@ const LegendWrapper = styled.div`
|
|
|
25889
25889
|
padding-top: 15px;
|
|
25890
25890
|
`;
|
|
25891
25891
|
|
|
25892
|
-
const LegendUnionIcon =
|
|
25893
|
-
|
|
25894
|
-
|
|
25895
|
-
|
|
25896
|
-
|
|
25897
|
-
|
|
25898
|
-
|
|
25899
|
-
|
|
25900
|
-
|
|
25901
|
-
|
|
25902
|
-
|
|
25903
|
-
|
|
25904
|
-
|
|
25905
|
-
|
|
25906
|
-
|
|
25907
|
-
|
|
25892
|
+
const LegendUnionIcon = _ref => {
|
|
25893
|
+
let {
|
|
25894
|
+
width = '18',
|
|
25895
|
+
height = '5',
|
|
25896
|
+
color = '#9CCB3B'
|
|
25897
|
+
} = _ref;
|
|
25898
|
+
return /*#__PURE__*/React$1.createElement("svg", {
|
|
25899
|
+
width: width,
|
|
25900
|
+
height: height,
|
|
25901
|
+
viewBox: "0 0 18 5",
|
|
25902
|
+
fill: "none",
|
|
25903
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
25904
|
+
}, /*#__PURE__*/React$1.createElement("path", {
|
|
25905
|
+
fillRule: "evenodd",
|
|
25906
|
+
clipRule: "evenodd",
|
|
25907
|
+
d: "M11.45 2H17C17.2761 2 17.5 2.22386 17.5 2.5C17.5 2.77614 17.2761 3 17 3H11.45C11.2184 4.14112 10.2095 5 9 5C7.79052 5 6.78164 4.14112 6.55001 3H1C0.723858 3 0.5 2.77614 0.5 2.5C0.5 2.22386 0.723858 2 1 2H6.55001C6.78164 0.85888 7.79052 0 9 0C10.2095 0 11.2184 0.85888 11.45 2Z",
|
|
25908
|
+
fill: color
|
|
25909
|
+
}));
|
|
25910
|
+
};
|
|
25908
25911
|
|
|
25909
|
-
const LegendLineIcon =
|
|
25910
|
-
|
|
25911
|
-
|
|
25912
|
-
|
|
25913
|
-
|
|
25914
|
-
|
|
25915
|
-
|
|
25916
|
-
|
|
25917
|
-
|
|
25918
|
-
|
|
25919
|
-
|
|
25920
|
-
|
|
25921
|
-
|
|
25922
|
-
|
|
25923
|
-
|
|
25924
|
-
|
|
25912
|
+
const LegendLineIcon = _ref => {
|
|
25913
|
+
let {
|
|
25914
|
+
width = '19',
|
|
25915
|
+
height = '3',
|
|
25916
|
+
color = '#9CCB3B'
|
|
25917
|
+
} = _ref;
|
|
25918
|
+
return /*#__PURE__*/React$1.createElement("svg", {
|
|
25919
|
+
width: width,
|
|
25920
|
+
height: height,
|
|
25921
|
+
viewBox: "0 0 19 3",
|
|
25922
|
+
fill: "none",
|
|
25923
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
25924
|
+
}, /*#__PURE__*/React$1.createElement("path", {
|
|
25925
|
+
fillRule: "evenodd",
|
|
25926
|
+
clipRule: "evenodd",
|
|
25927
|
+
d: "M0 1.5C0 0.671573 0.671573 0 1.5 0H17.5C18.3284 0 19 0.671572 19 1.5C19 2.32843 18.3284 3 17.5 3H1.5C0.671575 3 0 2.32843 0 1.5Z",
|
|
25928
|
+
fill: color
|
|
25929
|
+
}));
|
|
25930
|
+
};
|
|
25925
25931
|
|
|
25926
25932
|
const ControlsContainer$5 = styled.div`
|
|
25927
25933
|
position: relative;
|
|
@@ -26496,7 +26502,7 @@ const LegendTitle = styled.h5`
|
|
|
26496
26502
|
display: flex;
|
|
26497
26503
|
justify-content: space-between;
|
|
26498
26504
|
@media (max-width: 1536px) {
|
|
26499
|
-
font-size: 0.
|
|
26505
|
+
font-size: 0.75em; /* 11px → 0.6875em */
|
|
26500
26506
|
}
|
|
26501
26507
|
@media (max-width: 1366px) {
|
|
26502
26508
|
font-size: 0.625em; /* 10px → 0.625em */
|
|
@@ -28850,7 +28856,6 @@ const scrollableStyles$2 = `
|
|
|
28850
28856
|
}
|
|
28851
28857
|
`;
|
|
28852
28858
|
const DoubleBarSingleLineContainer = styled.div`
|
|
28853
|
-
position: relative;
|
|
28854
28859
|
font-family: "Poppins", sans-serif;
|
|
28855
28860
|
color: #212121;
|
|
28856
28861
|
background-color: white;
|
|
@@ -28861,13 +28866,14 @@ const DoubleBarSingleLineContainer = styled.div`
|
|
|
28861
28866
|
${scrollableStyles$2}
|
|
28862
28867
|
`;
|
|
28863
28868
|
const LegendContainer = styled.div`
|
|
28864
|
-
position:
|
|
28869
|
+
position: absolute;
|
|
28870
|
+
left: 0;
|
|
28865
28871
|
text-align: center;
|
|
28866
|
-
width: ${props => props.width};
|
|
28867
|
-
bottom:
|
|
28872
|
+
width: ${props => `${props.width}px`};
|
|
28873
|
+
bottom: 30px;
|
|
28868
28874
|
`;
|
|
28869
28875
|
const Controls$1 = styled.div`
|
|
28870
|
-
height: 100
|
|
28876
|
+
height: calc(100% - 30px);
|
|
28871
28877
|
display: flex;
|
|
28872
28878
|
flex-direction: column;
|
|
28873
28879
|
background-color: white;
|
|
@@ -28919,6 +28925,7 @@ const DoubleBarSingleLine = props => {
|
|
|
28919
28925
|
width,
|
|
28920
28926
|
height,
|
|
28921
28927
|
title,
|
|
28928
|
+
hasScroll,
|
|
28922
28929
|
dataState,
|
|
28923
28930
|
data,
|
|
28924
28931
|
lineChartValueType,
|
|
@@ -28930,6 +28937,31 @@ const DoubleBarSingleLine = props => {
|
|
|
28930
28937
|
noDataText
|
|
28931
28938
|
} = props;
|
|
28932
28939
|
const [legendData, setLegendData] = useState([]);
|
|
28940
|
+
const containerRef = useRef(null);
|
|
28941
|
+
const [containerWidth, setContainerWidth] = useState(0); // State to store the container's width
|
|
28942
|
+
|
|
28943
|
+
useEffect(() => {
|
|
28944
|
+
const updateWidth = () => {
|
|
28945
|
+
if (containerRef.current) {
|
|
28946
|
+
setContainerWidth(containerRef.current.offsetWidth); // Update the width
|
|
28947
|
+
}
|
|
28948
|
+
};
|
|
28949
|
+
|
|
28950
|
+
// Use ResizeObserver to observe changes in the container's size
|
|
28951
|
+
const resizeObserver = new ResizeObserver(() => {
|
|
28952
|
+
updateWidth();
|
|
28953
|
+
});
|
|
28954
|
+
if (containerRef.current) {
|
|
28955
|
+
resizeObserver.observe(containerRef.current); // Start observing
|
|
28956
|
+
}
|
|
28957
|
+
|
|
28958
|
+
// Cleanup observer on component unmount
|
|
28959
|
+
return () => {
|
|
28960
|
+
if (containerRef.current) {
|
|
28961
|
+
resizeObserver.unobserve(containerRef.current);
|
|
28962
|
+
}
|
|
28963
|
+
};
|
|
28964
|
+
}, []);
|
|
28933
28965
|
useEffect(() => {
|
|
28934
28966
|
const newLegendData = dataState.map(item => ({
|
|
28935
28967
|
title: item.name,
|
|
@@ -29032,9 +29064,12 @@ const DoubleBarSingleLine = props => {
|
|
|
29032
29064
|
} else {
|
|
29033
29065
|
`${currentTooltipValue.toFixed(1)}`;
|
|
29034
29066
|
}
|
|
29035
|
-
return /*#__PURE__*/React$1.createElement(TooltipDiv, null, /*#__PURE__*/React$1.createElement(TooltipTitle$1, null, `${label}`), payload.map((item, idx) =>
|
|
29036
|
-
key
|
|
29037
|
-
|
|
29067
|
+
return /*#__PURE__*/React$1.createElement(TooltipDiv, null, /*#__PURE__*/React$1.createElement(TooltipTitle$1, null, `${label}`), payload.map((item, idx) => {
|
|
29068
|
+
const dataStateItem = dataState.find(state => state.key === item.dataKey);
|
|
29069
|
+
return /*#__PURE__*/React$1.createElement(TooltipLabel, {
|
|
29070
|
+
key: item.dataKey || idx
|
|
29071
|
+
}, `${dataStateItem?.name || item.dataKey}: ${item.value.toFixed(1)}`);
|
|
29072
|
+
}));
|
|
29038
29073
|
};
|
|
29039
29074
|
const CustomTickBarChart = props => {
|
|
29040
29075
|
const {
|
|
@@ -29071,26 +29106,55 @@ const DoubleBarSingleLine = props => {
|
|
|
29071
29106
|
dy: 22
|
|
29072
29107
|
}, line))));
|
|
29073
29108
|
};
|
|
29109
|
+
|
|
29110
|
+
// Shared chart syncing configuration
|
|
29111
|
+
const syncCharts = {
|
|
29112
|
+
syncId: "anyId",
|
|
29113
|
+
// This synchronizes the charts
|
|
29114
|
+
margin: {
|
|
29115
|
+
top: 20,
|
|
29116
|
+
right: 35,
|
|
29117
|
+
left: 35,
|
|
29118
|
+
bottom: 5
|
|
29119
|
+
}
|
|
29120
|
+
};
|
|
29121
|
+
// Transform data to align line points with bar chart centers
|
|
29122
|
+
const transformDataForLineChart = originalData => {
|
|
29123
|
+
return originalData.map(item => ({
|
|
29124
|
+
...item,
|
|
29125
|
+
// Keep the original label for proper X-axis alignment
|
|
29126
|
+
originalLabel: item.label
|
|
29127
|
+
}));
|
|
29128
|
+
};
|
|
29129
|
+
const transformedData = transformDataForLineChart(data);
|
|
29074
29130
|
return /*#__PURE__*/React$1.createElement(DoubleBarSingleLineContainer, {
|
|
29131
|
+
ref: containerRef,
|
|
29075
29132
|
className: className,
|
|
29076
29133
|
height: height,
|
|
29077
29134
|
width: width,
|
|
29078
|
-
hasScroll:
|
|
29135
|
+
hasScroll: hasScroll
|
|
29079
29136
|
}, data.length === 0 ? /*#__PURE__*/React$1.createElement(NoDataFoundMessage, {
|
|
29080
29137
|
noDataText: noDataText
|
|
29081
29138
|
}) : /*#__PURE__*/React$1.createElement(Controls$1, {
|
|
29082
29139
|
className: "Controls"
|
|
29083
|
-
}, title !== '' && /*#__PURE__*/React$1.createElement(Title$2, null, title), /*#__PURE__*/React$1.createElement(ChartsWrapper, {
|
|
29084
|
-
width:
|
|
29085
|
-
}, /*#__PURE__*/React$1.createElement(LineChartWrapper, null, /*#__PURE__*/React$1.createElement(ResponsiveContainer, null, /*#__PURE__*/React$1.createElement(LineChart, {
|
|
29086
|
-
data:
|
|
29087
|
-
|
|
29088
|
-
|
|
29089
|
-
|
|
29090
|
-
|
|
29091
|
-
|
|
29140
|
+
}, title && title.trim() !== '' && /*#__PURE__*/React$1.createElement(Title$2, null, title), /*#__PURE__*/React$1.createElement(ChartsWrapper, {
|
|
29141
|
+
width: hasScroll ? `${data.length * 178}px` : 'auto'
|
|
29142
|
+
}, /*#__PURE__*/React$1.createElement(LineChartWrapper, null, /*#__PURE__*/React$1.createElement(ResponsiveContainer, null, /*#__PURE__*/React$1.createElement(LineChart, _extends({
|
|
29143
|
+
data: transformedData
|
|
29144
|
+
}, syncCharts), /*#__PURE__*/React$1.createElement(XAxis, {
|
|
29145
|
+
dataKey: "label",
|
|
29146
|
+
tick: false,
|
|
29147
|
+
axisLine: false,
|
|
29148
|
+
tickLine: false,
|
|
29149
|
+
interval: 0,
|
|
29150
|
+
xAxisId: "line"
|
|
29151
|
+
// This is important for alignment
|
|
29152
|
+
,
|
|
29153
|
+
padding: {
|
|
29154
|
+
left: barsWidth,
|
|
29155
|
+
right: barsWidth
|
|
29092
29156
|
}
|
|
29093
|
-
}, /*#__PURE__*/React$1.createElement(YAxis, {
|
|
29157
|
+
}), /*#__PURE__*/React$1.createElement(YAxis, {
|
|
29094
29158
|
domain: [dataMin => Math.min(dataMin, calculateMinValue(data, dataState)) - 10, dataMax => Math.max(dataMax, calculateMaxValue(data, dataState)) + 10],
|
|
29095
29159
|
hide: true
|
|
29096
29160
|
}), dataState.filter(item => item.type === "line").map(obj => /*#__PURE__*/React$1.createElement(Line, {
|
|
@@ -29098,22 +29162,28 @@ const DoubleBarSingleLine = props => {
|
|
|
29098
29162
|
key: obj.key,
|
|
29099
29163
|
dataKey: obj.key,
|
|
29100
29164
|
stroke: obj.color,
|
|
29101
|
-
fill: obj.color
|
|
29102
|
-
|
|
29165
|
+
fill: obj.color
|
|
29166
|
+
// dot={{ r: 6, stroke: obj.color, fill: obj.color }}
|
|
29167
|
+
,
|
|
29168
|
+
activeDot: {
|
|
29169
|
+
r: 8
|
|
29170
|
+
},
|
|
29171
|
+
isAnimationActive: false,
|
|
29172
|
+
xAxisId: "line"
|
|
29103
29173
|
}, /*#__PURE__*/React$1.createElement(LabelList, {
|
|
29104
|
-
content: CustomLabelLine
|
|
29105
|
-
|
|
29174
|
+
content: CustomLabelLine,
|
|
29175
|
+
position: "top"
|
|
29176
|
+
})))))), /*#__PURE__*/React$1.createElement(BarChartWrapper, null, /*#__PURE__*/React$1.createElement(ResponsiveContainer, null, /*#__PURE__*/React$1.createElement(BarChart$1, _extends({
|
|
29106
29177
|
data: data,
|
|
29107
29178
|
barGap: 13,
|
|
29108
29179
|
barCategoryGap: data.length >= limitViewableItems ? 178 : 50,
|
|
29109
|
-
barSize: barsWidth
|
|
29180
|
+
barSize: barsWidth
|
|
29181
|
+
}, syncCharts, {
|
|
29110
29182
|
margin: {
|
|
29111
|
-
|
|
29112
|
-
right: 10,
|
|
29113
|
-
left: 10,
|
|
29183
|
+
...syncCharts.margin,
|
|
29114
29184
|
bottom: 120
|
|
29115
29185
|
}
|
|
29116
|
-
}, /*#__PURE__*/React$1.createElement(Tooltip$2, {
|
|
29186
|
+
}), /*#__PURE__*/React$1.createElement(Tooltip$2, {
|
|
29117
29187
|
content: /*#__PURE__*/React$1.createElement(CustomTooltip, null)
|
|
29118
29188
|
}), showBackgroundGrid && /*#__PURE__*/React$1.createElement(CartesianGrid, {
|
|
29119
29189
|
vertical: false,
|
|
@@ -29128,20 +29198,19 @@ const DoubleBarSingleLine = props => {
|
|
|
29128
29198
|
tickLine: false,
|
|
29129
29199
|
interval: 0
|
|
29130
29200
|
}), /*#__PURE__*/React$1.createElement(YAxis, {
|
|
29131
|
-
domain: [dataMin => Math.min(dataMin, 0),
|
|
29132
|
-
// Handle negative values
|
|
29133
|
-
dataMax => Math.max(dataMax, calculateMaxValue(data, dataState)) * 1.5],
|
|
29201
|
+
domain: [dataMin => Math.min(dataMin, 0), dataMax => Math.max(dataMax, calculateMaxValue(data, dataState)) * 1.5],
|
|
29134
29202
|
hide: true
|
|
29135
29203
|
}), dataState.filter(item => item.type === "bar").map(obj => /*#__PURE__*/React$1.createElement(Bar, {
|
|
29136
29204
|
key: obj.key,
|
|
29137
29205
|
dataKey: obj.key,
|
|
29138
29206
|
fill: obj.color,
|
|
29139
|
-
radius: [4, 4, 0, 0]
|
|
29207
|
+
radius: [4, 4, 0, 0],
|
|
29208
|
+
isAnimationActive: false
|
|
29140
29209
|
}, /*#__PURE__*/React$1.createElement(LabelList, {
|
|
29141
29210
|
dataKey: obj.key,
|
|
29142
29211
|
content: CustomLabel
|
|
29143
29212
|
}))))))), showLegend && /*#__PURE__*/React$1.createElement(LegendContainer, {
|
|
29144
|
-
width:
|
|
29213
|
+
width: containerWidth,
|
|
29145
29214
|
height: height
|
|
29146
29215
|
}, /*#__PURE__*/React$1.createElement(PerformanceAnalyticsLegend, {
|
|
29147
29216
|
legendData: legendData
|
|
@@ -29325,11 +29394,17 @@ const AreaChart = props => {
|
|
|
29325
29394
|
const [areaChartsToDisplay, setAreaChartsToDisplay] = useState([]);
|
|
29326
29395
|
|
|
29327
29396
|
// Compute max domain values
|
|
29328
|
-
const leftKeys = areaChartsState
|
|
29329
|
-
|
|
29330
|
-
|
|
29331
|
-
const
|
|
29332
|
-
|
|
29397
|
+
// const leftKeys = areaChartsState
|
|
29398
|
+
// .filter((chart) => chart.yAxisId === "left")
|
|
29399
|
+
// .map((chart) => chart.key);
|
|
29400
|
+
// const rightKeys = areaChartsState
|
|
29401
|
+
// .filter((chart) => chart.yAxisId === "right")
|
|
29402
|
+
// .map((chart) => chart.key);
|
|
29403
|
+
// const getMaxDomain = (keys) =>
|
|
29404
|
+
// data ? Math.max(...data.flatMap((d) => keys.map((key) => d[key] ?? 0))) * 1.1 : 0;
|
|
29405
|
+
// const maxLeftDomain = getMaxDomain(leftKeys);
|
|
29406
|
+
// const maxRightDomain = getMaxDomain(rightKeys);
|
|
29407
|
+
|
|
29333
29408
|
useEffect(() => {
|
|
29334
29409
|
if (containerRef.current) {
|
|
29335
29410
|
setContainerWidth(containerRef.current.offsetWidth);
|
|
@@ -29547,19 +29622,13 @@ const AreaChart = props => {
|
|
|
29547
29622
|
tickLine: false
|
|
29548
29623
|
}), /*#__PURE__*/React$1.createElement(YAxis, {
|
|
29549
29624
|
yAxisId: "left",
|
|
29550
|
-
domain: [0,
|
|
29551
|
-
hide: true
|
|
29552
|
-
ticks: Array.from({
|
|
29553
|
-
length: maxLeftDomain
|
|
29554
|
-
}, (_, index) => index)
|
|
29625
|
+
domain: [0, 'dataMax'],
|
|
29626
|
+
hide: true
|
|
29555
29627
|
}), /*#__PURE__*/React$1.createElement(YAxis, {
|
|
29556
29628
|
yAxisId: "right",
|
|
29557
29629
|
orientation: "right",
|
|
29558
|
-
domain: [0,
|
|
29559
|
-
hide: true
|
|
29560
|
-
ticks: Array.from({
|
|
29561
|
-
length: maxRightDomain
|
|
29562
|
-
}, (_, index) => index)
|
|
29630
|
+
domain: [0, 'dataMax'],
|
|
29631
|
+
hide: true
|
|
29563
29632
|
}), /*#__PURE__*/React$1.createElement(CartesianGrid, {
|
|
29564
29633
|
stroke: "#D0D0D0",
|
|
29565
29634
|
strokeDasharray: "4 3",
|
|
@@ -30328,5 +30397,5 @@ const BatteryChart = props => {
|
|
|
30328
30397
|
}))))))), starText !== "" && /*#__PURE__*/React$1.createElement(StarText, null, starText));
|
|
30329
30398
|
};
|
|
30330
30399
|
|
|
30331
|
-
export { AreaChart, BannerEventBoxList, BarChart, BarChartsByWeeks, BatteryChart, BreakdownPanel, Button, CollapseHeader, DialogOverlay, DoubleBarSingleLine, DoublePanelDataRow, EventDetailsCard, EventList, FilterPanel, Heatmap, IconButton, LinkButton, LinnerDataBox, MarketShareDescription, OneColumnContainer, PieChart, PopupCharts, QuickFilter, ReportTable, TabMenu, TopToggleList, TotalDoughnutChart, TotalHorizontalCharts };
|
|
30400
|
+
export { AreaChart, BannerEventBoxList, BarChart, BarChartsByWeeks, BatteryChart, BreakdownPanel, Button, CollapseHeader, DialogOverlay, DoubleBarSingleLine, DoublePanelDataRow, EventDetailsCard, EventList, FilterPanel, Heatmap, IconButton, LinkButton, LinnerDataBox, MarketShareDescription, OneColumnContainer, PerformanceAnalyticsLegend, PieChart, PopupCharts, QuickFilter, ReportTable, TabMenu, TopToggleList, TotalDoughnutChart, TotalHorizontalCharts };
|
|
30332
30401
|
//# sourceMappingURL=index.esm.js.map
|