sag_components 2.0.0-beta49 → 2.0.0-beta50

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,34 +10083,26 @@ const OptionsContainer$4 = styled__default["default"].div`
10083
10083
  padding-top: 8px;
10084
10084
  `;
10085
10085
 
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,
10086
+ const ChervronRightIcon = () => /*#__PURE__*/React__default["default"].createElement("svg", {
10087
+ width: "8",
10088
+ height: "13",
10093
10089
  viewBox: "0 0 8 13",
10094
10090
  fill: "none",
10095
10091
  xmlns: "http://www.w3.org/2000/svg"
10096
10092
  }, /*#__PURE__*/React__default["default"].createElement("path", {
10097
10093
  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",
10098
- fill: fill
10094
+ fill: "#777575"
10099
10095
  }));
10100
10096
 
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,
10097
+ const ChervronLeftIcon = () => /*#__PURE__*/React__default["default"].createElement("svg", {
10098
+ width: "7",
10099
+ height: "13",
10108
10100
  viewBox: "0 0 7 13",
10109
10101
  fill: "none",
10110
10102
  xmlns: "http://www.w3.org/2000/svg"
10111
10103
  }, /*#__PURE__*/React__default["default"].createElement("path", {
10112
10104
  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",
10113
- fill: fill
10105
+ fill: "#777575"
10114
10106
  }));
10115
10107
 
10116
10108
  /* eslint-disable react/prop-types */
@@ -10376,8 +10368,8 @@ const RangePicker = _ref => {
10376
10368
  const dateArray = selectedValue.split('-');
10377
10369
  const startDate = new Date(dateArray[0]);
10378
10370
  const endDate = new Date(dateArray[1]);
10379
- setStartDateValue(moment(startDate).format('DD/MM/YYYY'));
10380
- setEndDateValue(moment(endDate).format('DD/MM/YYYY'));
10371
+ setStartDateValue(moment(startDate).format('MM/DD/YYYY'));
10372
+ setEndDateValue(moment(endDate).format('MM/DD/YYYY'));
10381
10373
  setValue(selectedValue);
10382
10374
  }
10383
10375
  }, [selectedValue]);
@@ -10393,8 +10385,8 @@ const RangePicker = _ref => {
10393
10385
  setIsFocused(false);
10394
10386
  setStartDateValue(startDate);
10395
10387
  setEndDateValue(endDate);
10396
- onChange(`${moment(startDate).format('DD/MM/YYYY')} - ${moment(endDate).format('DD/MM/YYYY')}`);
10397
- setValue(`${moment(startDate).format('DD/MM/YYYY')} - ${moment(endDate).format('DD/MM/YYYY')}`);
10388
+ onChange(`${moment(startDate).format('MM/DD/YYYY')} - ${moment(endDate).format('MM/DD/YYYY')}`);
10389
+ setValue(`${moment(startDate).format('MM/DD/YYYY')} - ${moment(endDate).format('MM/DD/YYYY')}`);
10398
10390
  }
10399
10391
  };
10400
10392
  const onChangeEvent = e => {
@@ -10402,8 +10394,8 @@ const RangePicker = _ref => {
10402
10394
  const arr = dateArray.split(' - ');
10403
10395
  const startDate = new Date(arr[0]);
10404
10396
  const endDate = new Date(arr[1]);
10405
- setStartDateValue(moment(startDate).format('DD/MM/YYYY'));
10406
- setEndDateValue(moment(endDate).format('DD/MM/YYYY'));
10397
+ setStartDateValue(moment(startDate).format('MM/DD/YYYY'));
10398
+ setEndDateValue(moment(endDate).format('MM/DD/YYYY'));
10407
10399
  onChange(e);
10408
10400
  setValue(e.target.value);
10409
10401
  };
@@ -28888,7 +28880,7 @@ const LegendContainer = styled__default["default"].div`
28888
28880
  left: 0;
28889
28881
  text-align: center;
28890
28882
  width: ${props => `${props.width}px`};
28891
- bottom: 20px;
28883
+ bottom: 30px;
28892
28884
  `;
28893
28885
  const Controls$1 = styled__default["default"].div`
28894
28886
  height: calc(100% - 30px);
@@ -28955,14 +28947,31 @@ const DoubleBarSingleLine = props => {
28955
28947
  noDataText
28956
28948
  } = props;
28957
28949
  const [legendData, setLegendData] = React$1.useState([]);
28958
- const containerRef = React$1.useRef(null); // Create a ref for the container
28950
+ const containerRef = React$1.useRef(null);
28959
28951
  const [containerWidth, setContainerWidth] = React$1.useState(0); // State to store the container's width
28960
28952
 
28961
28953
  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
+ });
28962
28964
  if (containerRef.current) {
28963
- setContainerWidth(containerRef.current.offsetWidth); // Set the width of the container
28965
+ resizeObserver.observe(containerRef.current); // Start observing
28964
28966
  }
28965
- }, [containerRef]);
28967
+
28968
+ // Cleanup observer on component unmount
28969
+ return () => {
28970
+ if (containerRef.current) {
28971
+ resizeObserver.unobserve(containerRef.current);
28972
+ }
28973
+ };
28974
+ }, []);
28966
28975
  React$1.useEffect(() => {
28967
28976
  const newLegendData = dataState.map(item => ({
28968
28977
  title: item.name,
@@ -29065,9 +29074,12 @@ const DoubleBarSingleLine = props => {
29065
29074
  } else {
29066
29075
  `${currentTooltipValue.toFixed(1)}`;
29067
29076
  }
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}`)));
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.payload[dataStateItem.tooltipKey]}`);
29082
+ }));
29071
29083
  };
29072
29084
  const CustomTickBarChart = props => {
29073
29085
  const {
@@ -29104,6 +29116,27 @@ const DoubleBarSingleLine = props => {
29104
29116
  dy: 22
29105
29117
  }, line))));
29106
29118
  };
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);
29107
29140
  return /*#__PURE__*/React__default["default"].createElement(DoubleBarSingleLineContainer, {
29108
29141
  ref: containerRef,
29109
29142
  className: className,
@@ -29116,15 +29149,22 @@ const DoubleBarSingleLine = props => {
29116
29149
  className: "Controls"
29117
29150
  }, title && title.trim() !== '' && /*#__PURE__*/React__default["default"].createElement(Title$2, null, title), /*#__PURE__*/React__default["default"].createElement(ChartsWrapper, {
29118
29151
  width: hasScroll ? `${data.length * 178}px` : 'auto'
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
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
29126
29166
  }
29127
- }, /*#__PURE__*/React__default["default"].createElement(recharts.YAxis, {
29167
+ }), /*#__PURE__*/React__default["default"].createElement(recharts.YAxis, {
29128
29168
  domain: [dataMin => Math.min(dataMin, calculateMinValue(data, dataState)) - 10, dataMax => Math.max(dataMax, calculateMaxValue(data, dataState)) + 10],
29129
29169
  hide: true
29130
29170
  }), dataState.filter(item => item.type === "line").map(obj => /*#__PURE__*/React__default["default"].createElement(recharts.Line, {
@@ -29132,22 +29172,28 @@ const DoubleBarSingleLine = props => {
29132
29172
  key: obj.key,
29133
29173
  dataKey: obj.key,
29134
29174
  stroke: obj.color,
29135
- fill: obj.color,
29136
- legendType: "plainline"
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"
29137
29183
  }, /*#__PURE__*/React__default["default"].createElement(recharts.LabelList, {
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, {
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({
29140
29187
  data: data,
29141
29188
  barGap: 13,
29142
29189
  barCategoryGap: data.length >= limitViewableItems ? 178 : 50,
29143
- barSize: barsWidth,
29190
+ barSize: barsWidth
29191
+ }, syncCharts, {
29144
29192
  margin: {
29145
- top: 0,
29146
- right: 10,
29147
- left: 10,
29193
+ ...syncCharts.margin,
29148
29194
  bottom: 120
29149
29195
  }
29150
- }, /*#__PURE__*/React__default["default"].createElement(recharts.Tooltip, {
29196
+ }), /*#__PURE__*/React__default["default"].createElement(recharts.Tooltip, {
29151
29197
  content: /*#__PURE__*/React__default["default"].createElement(CustomTooltip, null)
29152
29198
  }), showBackgroundGrid && /*#__PURE__*/React__default["default"].createElement(recharts.CartesianGrid, {
29153
29199
  vertical: false,
@@ -29162,15 +29208,14 @@ const DoubleBarSingleLine = props => {
29162
29208
  tickLine: false,
29163
29209
  interval: 0
29164
29210
  }), /*#__PURE__*/React__default["default"].createElement(recharts.YAxis, {
29165
- domain: [dataMin => Math.min(dataMin, 0),
29166
- // Handle negative values
29167
- dataMax => Math.max(dataMax, calculateMaxValue(data, dataState)) * 1.5],
29211
+ domain: [dataMin => Math.min(dataMin, 0), dataMax => Math.max(dataMax, calculateMaxValue(data, dataState)) * 1.5],
29168
29212
  hide: true
29169
29213
  }), dataState.filter(item => item.type === "bar").map(obj => /*#__PURE__*/React__default["default"].createElement(recharts.Bar, {
29170
29214
  key: obj.key,
29171
29215
  dataKey: obj.key,
29172
29216
  fill: obj.color,
29173
- radius: [4, 4, 0, 0]
29217
+ radius: [4, 4, 0, 0],
29218
+ isAnimationActive: false
29174
29219
  }, /*#__PURE__*/React__default["default"].createElement(recharts.LabelList, {
29175
29220
  dataKey: obj.key,
29176
29221
  content: CustomLabel