sag_components 2.0.0-beta48 → 2.0.0-beta49

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.esm.js CHANGED
@@ -10073,26 +10073,34 @@ const OptionsContainer$4 = styled.div`
10073
10073
  padding-top: 8px;
10074
10074
  `;
10075
10075
 
10076
- const ChervronRightIcon = () => /*#__PURE__*/React$1.createElement("svg", {
10077
- width: "8",
10078
- height: "13",
10076
+ const ChervronRightIcon = ({
10077
+ width = "8",
10078
+ height = "13",
10079
+ fill = "#777575"
10080
+ }) => /*#__PURE__*/React$1.createElement("svg", {
10081
+ width: width,
10082
+ height: height,
10079
10083
  viewBox: "0 0 8 13",
10080
10084
  fill: "none",
10081
10085
  xmlns: "http://www.w3.org/2000/svg"
10082
10086
  }, /*#__PURE__*/React$1.createElement("path", {
10083
10087
  d: "M7.33984 5.78516C7.58594 6.05859 7.58594 6.46875 7.33984 6.71484L2.08984 11.9648C1.81641 12.2383 1.40625 12.2383 1.16016 11.9648C0.886719 11.7188 0.886719 11.3086 1.16016 11.0625L5.94531 6.27734L1.16016 1.46484C0.886719 1.21875 0.886719 0.808594 1.16016 0.5625C1.40625 0.289062 1.81641 0.289062 2.0625 0.5625L7.33984 5.78516Z",
10084
- fill: "#777575"
10088
+ fill: fill
10085
10089
  }));
10086
10090
 
10087
- const ChervronLeftIcon = () => /*#__PURE__*/React$1.createElement("svg", {
10088
- width: "7",
10089
- height: "13",
10091
+ const ChervronLeftIcon = ({
10092
+ width = 7,
10093
+ height = 13,
10094
+ fill = "#777575"
10095
+ }) => /*#__PURE__*/React$1.createElement("svg", {
10096
+ width: width,
10097
+ height: height,
10090
10098
  viewBox: "0 0 7 13",
10091
10099
  fill: "none",
10092
10100
  xmlns: "http://www.w3.org/2000/svg"
10093
10101
  }, /*#__PURE__*/React$1.createElement("path", {
10094
10102
  d: "M0.410156 5.78516L5.66016 0.5625C5.90625 0.289062 6.31641 0.289062 6.58984 0.5625C6.83594 0.808594 6.83594 1.21875 6.58984 1.46484L1.77734 6.25L6.5625 11.0625C6.83594 11.3086 6.83594 11.7188 6.5625 11.9648C6.31641 12.2383 5.90625 12.2383 5.66016 11.9648L0.410156 6.71484C0.136719 6.46875 0.136719 6.05859 0.410156 5.78516Z",
10095
- fill: "#777575"
10103
+ fill: fill
10096
10104
  }));
10097
10105
 
10098
10106
  /* eslint-disable react/prop-types */
@@ -28870,7 +28878,7 @@ const LegendContainer = styled.div`
28870
28878
  left: 0;
28871
28879
  text-align: center;
28872
28880
  width: ${props => `${props.width}px`};
28873
- bottom: 30px;
28881
+ bottom: 20px;
28874
28882
  `;
28875
28883
  const Controls$1 = styled.div`
28876
28884
  height: calc(100% - 30px);
@@ -28937,31 +28945,14 @@ const DoubleBarSingleLine = props => {
28937
28945
  noDataText
28938
28946
  } = props;
28939
28947
  const [legendData, setLegendData] = useState([]);
28940
- const containerRef = useRef(null);
28948
+ const containerRef = useRef(null); // Create a ref for the container
28941
28949
  const [containerWidth, setContainerWidth] = useState(0); // State to store the container's width
28942
28950
 
28943
28951
  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
28952
  if (containerRef.current) {
28955
- resizeObserver.observe(containerRef.current); // Start observing
28953
+ setContainerWidth(containerRef.current.offsetWidth); // Set the width of the container
28956
28954
  }
28957
-
28958
- // Cleanup observer on component unmount
28959
- return () => {
28960
- if (containerRef.current) {
28961
- resizeObserver.unobserve(containerRef.current);
28962
- }
28963
- };
28964
- }, []);
28955
+ }, [containerRef]);
28965
28956
  useEffect(() => {
28966
28957
  const newLegendData = dataState.map(item => ({
28967
28958
  title: item.name,
@@ -29064,12 +29055,9 @@ const DoubleBarSingleLine = props => {
29064
29055
  } else {
29065
29056
  `${currentTooltipValue.toFixed(1)}`;
29066
29057
  }
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
- }));
29058
+ return /*#__PURE__*/React$1.createElement(TooltipDiv, null, /*#__PURE__*/React$1.createElement(TooltipTitle$1, null, `${label}`), payload.map((item, idx) => /*#__PURE__*/React$1.createElement(TooltipLabel, {
29059
+ key: item.name || idx
29060
+ }, `${item.name}: ${item.value}`)));
29073
29061
  };
29074
29062
  const CustomTickBarChart = props => {
29075
29063
  const {
@@ -29106,27 +29094,6 @@ const DoubleBarSingleLine = props => {
29106
29094
  dy: 22
29107
29095
  }, line))));
29108
29096
  };
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);
29130
29097
  return /*#__PURE__*/React$1.createElement(DoubleBarSingleLineContainer, {
29131
29098
  ref: containerRef,
29132
29099
  className: className,
@@ -29139,22 +29106,15 @@ const DoubleBarSingleLine = props => {
29139
29106
  className: "Controls"
29140
29107
  }, title && title.trim() !== '' && /*#__PURE__*/React$1.createElement(Title$2, null, title), /*#__PURE__*/React$1.createElement(ChartsWrapper, {
29141
29108
  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
29109
+ }, /*#__PURE__*/React$1.createElement(LineChartWrapper, null, /*#__PURE__*/React$1.createElement(ResponsiveContainer, null, /*#__PURE__*/React$1.createElement(LineChart, {
29110
+ data: data,
29111
+ margin: {
29112
+ top: 10,
29113
+ right: 35,
29114
+ left: 35,
29115
+ bottom: 32
29156
29116
  }
29157
- }), /*#__PURE__*/React$1.createElement(YAxis, {
29117
+ }, /*#__PURE__*/React$1.createElement(YAxis, {
29158
29118
  domain: [dataMin => Math.min(dataMin, calculateMinValue(data, dataState)) - 10, dataMax => Math.max(dataMax, calculateMaxValue(data, dataState)) + 10],
29159
29119
  hide: true
29160
29120
  }), dataState.filter(item => item.type === "line").map(obj => /*#__PURE__*/React$1.createElement(Line, {
@@ -29162,28 +29122,22 @@ const DoubleBarSingleLine = props => {
29162
29122
  key: obj.key,
29163
29123
  dataKey: obj.key,
29164
29124
  stroke: obj.color,
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"
29125
+ fill: obj.color,
29126
+ legendType: "plainline"
29173
29127
  }, /*#__PURE__*/React$1.createElement(LabelList, {
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({
29128
+ content: CustomLabelLine
29129
+ })))))), /*#__PURE__*/React$1.createElement(BarChartWrapper, null, /*#__PURE__*/React$1.createElement(ResponsiveContainer, null, /*#__PURE__*/React$1.createElement(BarChart$1, {
29177
29130
  data: data,
29178
29131
  barGap: 13,
29179
29132
  barCategoryGap: data.length >= limitViewableItems ? 178 : 50,
29180
- barSize: barsWidth
29181
- }, syncCharts, {
29133
+ barSize: barsWidth,
29182
29134
  margin: {
29183
- ...syncCharts.margin,
29135
+ top: 0,
29136
+ right: 10,
29137
+ left: 10,
29184
29138
  bottom: 120
29185
29139
  }
29186
- }), /*#__PURE__*/React$1.createElement(Tooltip$2, {
29140
+ }, /*#__PURE__*/React$1.createElement(Tooltip$2, {
29187
29141
  content: /*#__PURE__*/React$1.createElement(CustomTooltip, null)
29188
29142
  }), showBackgroundGrid && /*#__PURE__*/React$1.createElement(CartesianGrid, {
29189
29143
  vertical: false,
@@ -29198,14 +29152,15 @@ const DoubleBarSingleLine = props => {
29198
29152
  tickLine: false,
29199
29153
  interval: 0
29200
29154
  }), /*#__PURE__*/React$1.createElement(YAxis, {
29201
- domain: [dataMin => Math.min(dataMin, 0), dataMax => Math.max(dataMax, calculateMaxValue(data, dataState)) * 1.5],
29155
+ domain: [dataMin => Math.min(dataMin, 0),
29156
+ // Handle negative values
29157
+ dataMax => Math.max(dataMax, calculateMaxValue(data, dataState)) * 1.5],
29202
29158
  hide: true
29203
29159
  }), dataState.filter(item => item.type === "bar").map(obj => /*#__PURE__*/React$1.createElement(Bar, {
29204
29160
  key: obj.key,
29205
29161
  dataKey: obj.key,
29206
29162
  fill: obj.color,
29207
- radius: [4, 4, 0, 0],
29208
- isAnimationActive: false
29163
+ radius: [4, 4, 0, 0]
29209
29164
  }, /*#__PURE__*/React$1.createElement(LabelList, {
29210
29165
  dataKey: obj.key,
29211
29166
  content: CustomLabel