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.esm.js CHANGED
@@ -10073,34 +10073,26 @@ const OptionsContainer$4 = styled.div`
10073
10073
  padding-top: 8px;
10074
10074
  `;
10075
10075
 
10076
- const ChervronRightIcon = ({
10077
- width = "8",
10078
- height = "13",
10079
- fill = "#777575"
10080
- }) => /*#__PURE__*/React$1.createElement("svg", {
10081
- width: width,
10082
- height: height,
10076
+ const ChervronRightIcon = () => /*#__PURE__*/React$1.createElement("svg", {
10077
+ width: "8",
10078
+ height: "13",
10083
10079
  viewBox: "0 0 8 13",
10084
10080
  fill: "none",
10085
10081
  xmlns: "http://www.w3.org/2000/svg"
10086
10082
  }, /*#__PURE__*/React$1.createElement("path", {
10087
10083
  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",
10088
- fill: fill
10084
+ fill: "#777575"
10089
10085
  }));
10090
10086
 
10091
- const ChervronLeftIcon = ({
10092
- width = 7,
10093
- height = 13,
10094
- fill = "#777575"
10095
- }) => /*#__PURE__*/React$1.createElement("svg", {
10096
- width: width,
10097
- height: height,
10087
+ const ChervronLeftIcon = () => /*#__PURE__*/React$1.createElement("svg", {
10088
+ width: "7",
10089
+ height: "13",
10098
10090
  viewBox: "0 0 7 13",
10099
10091
  fill: "none",
10100
10092
  xmlns: "http://www.w3.org/2000/svg"
10101
10093
  }, /*#__PURE__*/React$1.createElement("path", {
10102
10094
  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",
10103
- fill: fill
10095
+ fill: "#777575"
10104
10096
  }));
10105
10097
 
10106
10098
  /* eslint-disable react/prop-types */
@@ -10366,8 +10358,8 @@ const RangePicker = _ref => {
10366
10358
  const dateArray = selectedValue.split('-');
10367
10359
  const startDate = new Date(dateArray[0]);
10368
10360
  const endDate = new Date(dateArray[1]);
10369
- setStartDateValue(moment(startDate).format('DD/MM/YYYY'));
10370
- setEndDateValue(moment(endDate).format('DD/MM/YYYY'));
10361
+ setStartDateValue(moment(startDate).format('MM/DD/YYYY'));
10362
+ setEndDateValue(moment(endDate).format('MM/DD/YYYY'));
10371
10363
  setValue(selectedValue);
10372
10364
  }
10373
10365
  }, [selectedValue]);
@@ -10383,8 +10375,8 @@ const RangePicker = _ref => {
10383
10375
  setIsFocused(false);
10384
10376
  setStartDateValue(startDate);
10385
10377
  setEndDateValue(endDate);
10386
- onChange(`${moment(startDate).format('DD/MM/YYYY')} - ${moment(endDate).format('DD/MM/YYYY')}`);
10387
- setValue(`${moment(startDate).format('DD/MM/YYYY')} - ${moment(endDate).format('DD/MM/YYYY')}`);
10378
+ onChange(`${moment(startDate).format('MM/DD/YYYY')} - ${moment(endDate).format('MM/DD/YYYY')}`);
10379
+ setValue(`${moment(startDate).format('MM/DD/YYYY')} - ${moment(endDate).format('MM/DD/YYYY')}`);
10388
10380
  }
10389
10381
  };
10390
10382
  const onChangeEvent = e => {
@@ -10392,8 +10384,8 @@ const RangePicker = _ref => {
10392
10384
  const arr = dateArray.split(' - ');
10393
10385
  const startDate = new Date(arr[0]);
10394
10386
  const endDate = new Date(arr[1]);
10395
- setStartDateValue(moment(startDate).format('DD/MM/YYYY'));
10396
- setEndDateValue(moment(endDate).format('DD/MM/YYYY'));
10387
+ setStartDateValue(moment(startDate).format('MM/DD/YYYY'));
10388
+ setEndDateValue(moment(endDate).format('MM/DD/YYYY'));
10397
10389
  onChange(e);
10398
10390
  setValue(e.target.value);
10399
10391
  };
@@ -28878,7 +28870,7 @@ const LegendContainer = styled.div`
28878
28870
  left: 0;
28879
28871
  text-align: center;
28880
28872
  width: ${props => `${props.width}px`};
28881
- bottom: 20px;
28873
+ bottom: 30px;
28882
28874
  `;
28883
28875
  const Controls$1 = styled.div`
28884
28876
  height: calc(100% - 30px);
@@ -28945,14 +28937,31 @@ const DoubleBarSingleLine = props => {
28945
28937
  noDataText
28946
28938
  } = props;
28947
28939
  const [legendData, setLegendData] = useState([]);
28948
- const containerRef = useRef(null); // Create a ref for the container
28940
+ const containerRef = useRef(null);
28949
28941
  const [containerWidth, setContainerWidth] = useState(0); // State to store the container's width
28950
28942
 
28951
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
+ });
28952
28954
  if (containerRef.current) {
28953
- setContainerWidth(containerRef.current.offsetWidth); // Set the width of the container
28955
+ resizeObserver.observe(containerRef.current); // Start observing
28954
28956
  }
28955
- }, [containerRef]);
28957
+
28958
+ // Cleanup observer on component unmount
28959
+ return () => {
28960
+ if (containerRef.current) {
28961
+ resizeObserver.unobserve(containerRef.current);
28962
+ }
28963
+ };
28964
+ }, []);
28956
28965
  useEffect(() => {
28957
28966
  const newLegendData = dataState.map(item => ({
28958
28967
  title: item.name,
@@ -29055,9 +29064,12 @@ const DoubleBarSingleLine = props => {
29055
29064
  } else {
29056
29065
  `${currentTooltipValue.toFixed(1)}`;
29057
29066
  }
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}`)));
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.payload[dataStateItem.tooltipKey]}`);
29072
+ }));
29061
29073
  };
29062
29074
  const CustomTickBarChart = props => {
29063
29075
  const {
@@ -29094,6 +29106,27 @@ const DoubleBarSingleLine = props => {
29094
29106
  dy: 22
29095
29107
  }, line))));
29096
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);
29097
29130
  return /*#__PURE__*/React$1.createElement(DoubleBarSingleLineContainer, {
29098
29131
  ref: containerRef,
29099
29132
  className: className,
@@ -29106,15 +29139,22 @@ const DoubleBarSingleLine = props => {
29106
29139
  className: "Controls"
29107
29140
  }, title && title.trim() !== '' && /*#__PURE__*/React$1.createElement(Title$2, null, title), /*#__PURE__*/React$1.createElement(ChartsWrapper, {
29108
29141
  width: hasScroll ? `${data.length * 178}px` : 'auto'
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
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
29116
29156
  }
29117
- }, /*#__PURE__*/React$1.createElement(YAxis, {
29157
+ }), /*#__PURE__*/React$1.createElement(YAxis, {
29118
29158
  domain: [dataMin => Math.min(dataMin, calculateMinValue(data, dataState)) - 10, dataMax => Math.max(dataMax, calculateMaxValue(data, dataState)) + 10],
29119
29159
  hide: true
29120
29160
  }), dataState.filter(item => item.type === "line").map(obj => /*#__PURE__*/React$1.createElement(Line, {
@@ -29122,22 +29162,28 @@ const DoubleBarSingleLine = props => {
29122
29162
  key: obj.key,
29123
29163
  dataKey: obj.key,
29124
29164
  stroke: obj.color,
29125
- fill: obj.color,
29126
- legendType: "plainline"
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"
29127
29173
  }, /*#__PURE__*/React$1.createElement(LabelList, {
29128
- content: CustomLabelLine
29129
- })))))), /*#__PURE__*/React$1.createElement(BarChartWrapper, null, /*#__PURE__*/React$1.createElement(ResponsiveContainer, null, /*#__PURE__*/React$1.createElement(BarChart$1, {
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({
29130
29177
  data: data,
29131
29178
  barGap: 13,
29132
29179
  barCategoryGap: data.length >= limitViewableItems ? 178 : 50,
29133
- barSize: barsWidth,
29180
+ barSize: barsWidth
29181
+ }, syncCharts, {
29134
29182
  margin: {
29135
- top: 0,
29136
- right: 10,
29137
- left: 10,
29183
+ ...syncCharts.margin,
29138
29184
  bottom: 120
29139
29185
  }
29140
- }, /*#__PURE__*/React$1.createElement(Tooltip$2, {
29186
+ }), /*#__PURE__*/React$1.createElement(Tooltip$2, {
29141
29187
  content: /*#__PURE__*/React$1.createElement(CustomTooltip, null)
29142
29188
  }), showBackgroundGrid && /*#__PURE__*/React$1.createElement(CartesianGrid, {
29143
29189
  vertical: false,
@@ -29152,15 +29198,14 @@ const DoubleBarSingleLine = props => {
29152
29198
  tickLine: false,
29153
29199
  interval: 0
29154
29200
  }), /*#__PURE__*/React$1.createElement(YAxis, {
29155
- domain: [dataMin => Math.min(dataMin, 0),
29156
- // Handle negative values
29157
- 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],
29158
29202
  hide: true
29159
29203
  }), dataState.filter(item => item.type === "bar").map(obj => /*#__PURE__*/React$1.createElement(Bar, {
29160
29204
  key: obj.key,
29161
29205
  dataKey: obj.key,
29162
29206
  fill: obj.color,
29163
- radius: [4, 4, 0, 0]
29207
+ radius: [4, 4, 0, 0],
29208
+ isAnimationActive: false
29164
29209
  }, /*#__PURE__*/React$1.createElement(LabelList, {
29165
29210
  dataKey: obj.key,
29166
29211
  content: CustomLabel