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.js CHANGED
@@ -10083,26 +10083,34 @@ const OptionsContainer$4 = styled__default["default"].div`
10083
10083
  padding-top: 8px;
10084
10084
  `;
10085
10085
 
10086
- const ChervronRightIcon = () => /*#__PURE__*/React__default["default"].createElement("svg", {
10087
- width: "8",
10088
- height: "13",
10086
+ const ChervronRightIcon = ({
10087
+ width = "8",
10088
+ height = "13",
10089
+ fill = "#777575"
10090
+ }) => /*#__PURE__*/React__default["default"].createElement("svg", {
10091
+ width: width,
10092
+ height: height,
10089
10093
  viewBox: "0 0 8 13",
10090
10094
  fill: "none",
10091
10095
  xmlns: "http://www.w3.org/2000/svg"
10092
10096
  }, /*#__PURE__*/React__default["default"].createElement("path", {
10093
10097
  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",
10094
- fill: "#777575"
10098
+ fill: fill
10095
10099
  }));
10096
10100
 
10097
- const ChervronLeftIcon = () => /*#__PURE__*/React__default["default"].createElement("svg", {
10098
- width: "7",
10099
- height: "13",
10101
+ const ChervronLeftIcon = ({
10102
+ width = 7,
10103
+ height = 13,
10104
+ fill = "#777575"
10105
+ }) => /*#__PURE__*/React__default["default"].createElement("svg", {
10106
+ width: width,
10107
+ height: height,
10100
10108
  viewBox: "0 0 7 13",
10101
10109
  fill: "none",
10102
10110
  xmlns: "http://www.w3.org/2000/svg"
10103
10111
  }, /*#__PURE__*/React__default["default"].createElement("path", {
10104
10112
  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",
10105
- fill: "#777575"
10113
+ fill: fill
10106
10114
  }));
10107
10115
 
10108
10116
  /* eslint-disable react/prop-types */
@@ -28880,7 +28888,7 @@ const LegendContainer = styled__default["default"].div`
28880
28888
  left: 0;
28881
28889
  text-align: center;
28882
28890
  width: ${props => `${props.width}px`};
28883
- bottom: 30px;
28891
+ bottom: 20px;
28884
28892
  `;
28885
28893
  const Controls$1 = styled__default["default"].div`
28886
28894
  height: calc(100% - 30px);
@@ -28947,31 +28955,14 @@ const DoubleBarSingleLine = props => {
28947
28955
  noDataText
28948
28956
  } = props;
28949
28957
  const [legendData, setLegendData] = React$1.useState([]);
28950
- const containerRef = React$1.useRef(null);
28958
+ const containerRef = React$1.useRef(null); // Create a ref for the container
28951
28959
  const [containerWidth, setContainerWidth] = React$1.useState(0); // State to store the container's width
28952
28960
 
28953
28961
  React$1.useEffect(() => {
28954
- const updateWidth = () => {
28955
- if (containerRef.current) {
28956
- setContainerWidth(containerRef.current.offsetWidth); // Update the width
28957
- }
28958
- };
28959
-
28960
- // Use ResizeObserver to observe changes in the container's size
28961
- const resizeObserver = new ResizeObserver(() => {
28962
- updateWidth();
28963
- });
28964
28962
  if (containerRef.current) {
28965
- resizeObserver.observe(containerRef.current); // Start observing
28963
+ setContainerWidth(containerRef.current.offsetWidth); // Set the width of the container
28966
28964
  }
28967
-
28968
- // Cleanup observer on component unmount
28969
- return () => {
28970
- if (containerRef.current) {
28971
- resizeObserver.unobserve(containerRef.current);
28972
- }
28973
- };
28974
- }, []);
28965
+ }, [containerRef]);
28975
28966
  React$1.useEffect(() => {
28976
28967
  const newLegendData = dataState.map(item => ({
28977
28968
  title: item.name,
@@ -29074,12 +29065,9 @@ const DoubleBarSingleLine = props => {
29074
29065
  } else {
29075
29066
  `${currentTooltipValue.toFixed(1)}`;
29076
29067
  }
29077
- return /*#__PURE__*/React__default["default"].createElement(TooltipDiv, null, /*#__PURE__*/React__default["default"].createElement(TooltipTitle$1, null, `${label}`), payload.map((item, idx) => {
29078
- const dataStateItem = dataState.find(state => state.key === item.dataKey);
29079
- return /*#__PURE__*/React__default["default"].createElement(TooltipLabel, {
29080
- key: item.dataKey || idx
29081
- }, `${dataStateItem?.name || item.dataKey}: ${item.value.toFixed(1)}`);
29082
- }));
29068
+ return /*#__PURE__*/React__default["default"].createElement(TooltipDiv, null, /*#__PURE__*/React__default["default"].createElement(TooltipTitle$1, null, `${label}`), payload.map((item, idx) => /*#__PURE__*/React__default["default"].createElement(TooltipLabel, {
29069
+ key: item.name || idx
29070
+ }, `${item.name}: ${item.value}`)));
29083
29071
  };
29084
29072
  const CustomTickBarChart = props => {
29085
29073
  const {
@@ -29116,27 +29104,6 @@ const DoubleBarSingleLine = props => {
29116
29104
  dy: 22
29117
29105
  }, line))));
29118
29106
  };
29119
-
29120
- // Shared chart syncing configuration
29121
- const syncCharts = {
29122
- syncId: "anyId",
29123
- // This synchronizes the charts
29124
- margin: {
29125
- top: 20,
29126
- right: 35,
29127
- left: 35,
29128
- bottom: 5
29129
- }
29130
- };
29131
- // Transform data to align line points with bar chart centers
29132
- const transformDataForLineChart = originalData => {
29133
- return originalData.map(item => ({
29134
- ...item,
29135
- // Keep the original label for proper X-axis alignment
29136
- originalLabel: item.label
29137
- }));
29138
- };
29139
- const transformedData = transformDataForLineChart(data);
29140
29107
  return /*#__PURE__*/React__default["default"].createElement(DoubleBarSingleLineContainer, {
29141
29108
  ref: containerRef,
29142
29109
  className: className,
@@ -29149,22 +29116,15 @@ const DoubleBarSingleLine = props => {
29149
29116
  className: "Controls"
29150
29117
  }, title && title.trim() !== '' && /*#__PURE__*/React__default["default"].createElement(Title$2, null, title), /*#__PURE__*/React__default["default"].createElement(ChartsWrapper, {
29151
29118
  width: hasScroll ? `${data.length * 178}px` : 'auto'
29152
- }, /*#__PURE__*/React__default["default"].createElement(LineChartWrapper, null, /*#__PURE__*/React__default["default"].createElement(recharts.ResponsiveContainer, null, /*#__PURE__*/React__default["default"].createElement(recharts.LineChart, _extends({
29153
- data: transformedData
29154
- }, syncCharts), /*#__PURE__*/React__default["default"].createElement(recharts.XAxis, {
29155
- dataKey: "label",
29156
- tick: false,
29157
- axisLine: false,
29158
- tickLine: false,
29159
- interval: 0,
29160
- xAxisId: "line"
29161
- // This is important for alignment
29162
- ,
29163
- padding: {
29164
- left: barsWidth,
29165
- right: barsWidth
29119
+ }, /*#__PURE__*/React__default["default"].createElement(LineChartWrapper, null, /*#__PURE__*/React__default["default"].createElement(recharts.ResponsiveContainer, null, /*#__PURE__*/React__default["default"].createElement(recharts.LineChart, {
29120
+ data: data,
29121
+ margin: {
29122
+ top: 10,
29123
+ right: 35,
29124
+ left: 35,
29125
+ bottom: 32
29166
29126
  }
29167
- }), /*#__PURE__*/React__default["default"].createElement(recharts.YAxis, {
29127
+ }, /*#__PURE__*/React__default["default"].createElement(recharts.YAxis, {
29168
29128
  domain: [dataMin => Math.min(dataMin, calculateMinValue(data, dataState)) - 10, dataMax => Math.max(dataMax, calculateMaxValue(data, dataState)) + 10],
29169
29129
  hide: true
29170
29130
  }), dataState.filter(item => item.type === "line").map(obj => /*#__PURE__*/React__default["default"].createElement(recharts.Line, {
@@ -29172,28 +29132,22 @@ const DoubleBarSingleLine = props => {
29172
29132
  key: obj.key,
29173
29133
  dataKey: obj.key,
29174
29134
  stroke: obj.color,
29175
- fill: obj.color
29176
- // dot={{ r: 6, stroke: obj.color, fill: obj.color }}
29177
- ,
29178
- activeDot: {
29179
- r: 8
29180
- },
29181
- isAnimationActive: false,
29182
- xAxisId: "line"
29135
+ fill: obj.color,
29136
+ legendType: "plainline"
29183
29137
  }, /*#__PURE__*/React__default["default"].createElement(recharts.LabelList, {
29184
- content: CustomLabelLine,
29185
- position: "top"
29186
- })))))), /*#__PURE__*/React__default["default"].createElement(BarChartWrapper, null, /*#__PURE__*/React__default["default"].createElement(recharts.ResponsiveContainer, null, /*#__PURE__*/React__default["default"].createElement(recharts.BarChart, _extends({
29138
+ content: CustomLabelLine
29139
+ })))))), /*#__PURE__*/React__default["default"].createElement(BarChartWrapper, null, /*#__PURE__*/React__default["default"].createElement(recharts.ResponsiveContainer, null, /*#__PURE__*/React__default["default"].createElement(recharts.BarChart, {
29187
29140
  data: data,
29188
29141
  barGap: 13,
29189
29142
  barCategoryGap: data.length >= limitViewableItems ? 178 : 50,
29190
- barSize: barsWidth
29191
- }, syncCharts, {
29143
+ barSize: barsWidth,
29192
29144
  margin: {
29193
- ...syncCharts.margin,
29145
+ top: 0,
29146
+ right: 10,
29147
+ left: 10,
29194
29148
  bottom: 120
29195
29149
  }
29196
- }), /*#__PURE__*/React__default["default"].createElement(recharts.Tooltip, {
29150
+ }, /*#__PURE__*/React__default["default"].createElement(recharts.Tooltip, {
29197
29151
  content: /*#__PURE__*/React__default["default"].createElement(CustomTooltip, null)
29198
29152
  }), showBackgroundGrid && /*#__PURE__*/React__default["default"].createElement(recharts.CartesianGrid, {
29199
29153
  vertical: false,
@@ -29208,14 +29162,15 @@ const DoubleBarSingleLine = props => {
29208
29162
  tickLine: false,
29209
29163
  interval: 0
29210
29164
  }), /*#__PURE__*/React__default["default"].createElement(recharts.YAxis, {
29211
- domain: [dataMin => Math.min(dataMin, 0), dataMax => Math.max(dataMax, calculateMaxValue(data, dataState)) * 1.5],
29165
+ domain: [dataMin => Math.min(dataMin, 0),
29166
+ // Handle negative values
29167
+ dataMax => Math.max(dataMax, calculateMaxValue(data, dataState)) * 1.5],
29212
29168
  hide: true
29213
29169
  }), dataState.filter(item => item.type === "bar").map(obj => /*#__PURE__*/React__default["default"].createElement(recharts.Bar, {
29214
29170
  key: obj.key,
29215
29171
  dataKey: obj.key,
29216
29172
  fill: obj.color,
29217
- radius: [4, 4, 0, 0],
29218
- isAnimationActive: false
29173
+ radius: [4, 4, 0, 0]
29219
29174
  }, /*#__PURE__*/React__default["default"].createElement(recharts.LabelList, {
29220
29175
  dataKey: obj.key,
29221
29176
  content: CustomLabel