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.js CHANGED
@@ -25899,39 +25899,45 @@ const LegendWrapper = styled__default["default"].div`
25899
25899
  padding-top: 15px;
25900
25900
  `;
25901
25901
 
25902
- const LegendUnionIcon = ({
25903
- width = '18',
25904
- height = '5',
25905
- color = '#9CCB3B'
25906
- }) => /*#__PURE__*/React__default["default"].createElement("svg", {
25907
- width: width,
25908
- height: height,
25909
- viewBox: "0 0 18 5",
25910
- fill: "none",
25911
- xmlns: "http://www.w3.org/2000/svg"
25912
- }, /*#__PURE__*/React__default["default"].createElement("path", {
25913
- fillRule: "evenodd",
25914
- clipRule: "evenodd",
25915
- 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",
25916
- fill: color
25917
- }));
25902
+ const LegendUnionIcon = _ref => {
25903
+ let {
25904
+ width = '18',
25905
+ height = '5',
25906
+ color = '#9CCB3B'
25907
+ } = _ref;
25908
+ return /*#__PURE__*/React__default["default"].createElement("svg", {
25909
+ width: width,
25910
+ height: height,
25911
+ viewBox: "0 0 18 5",
25912
+ fill: "none",
25913
+ xmlns: "http://www.w3.org/2000/svg"
25914
+ }, /*#__PURE__*/React__default["default"].createElement("path", {
25915
+ fillRule: "evenodd",
25916
+ clipRule: "evenodd",
25917
+ 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",
25918
+ fill: color
25919
+ }));
25920
+ };
25918
25921
 
25919
- const LegendLineIcon = ({
25920
- width = '19',
25921
- height = '3',
25922
- color = '#9CCB3B'
25923
- }) => /*#__PURE__*/React__default["default"].createElement("svg", {
25924
- width: width,
25925
- height: height,
25926
- viewBox: "0 0 19 3",
25927
- fill: "none",
25928
- xmlns: "http://www.w3.org/2000/svg"
25929
- }, /*#__PURE__*/React__default["default"].createElement("path", {
25930
- fillRule: "evenodd",
25931
- clipRule: "evenodd",
25932
- 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",
25933
- fill: color
25934
- }));
25922
+ const LegendLineIcon = _ref => {
25923
+ let {
25924
+ width = '19',
25925
+ height = '3',
25926
+ color = '#9CCB3B'
25927
+ } = _ref;
25928
+ return /*#__PURE__*/React__default["default"].createElement("svg", {
25929
+ width: width,
25930
+ height: height,
25931
+ viewBox: "0 0 19 3",
25932
+ fill: "none",
25933
+ xmlns: "http://www.w3.org/2000/svg"
25934
+ }, /*#__PURE__*/React__default["default"].createElement("path", {
25935
+ fillRule: "evenodd",
25936
+ clipRule: "evenodd",
25937
+ 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",
25938
+ fill: color
25939
+ }));
25940
+ };
25935
25941
 
25936
25942
  const ControlsContainer$5 = styled__default["default"].div`
25937
25943
  position: relative;
@@ -26506,7 +26512,7 @@ const LegendTitle = styled__default["default"].h5`
26506
26512
  display: flex;
26507
26513
  justify-content: space-between;
26508
26514
  @media (max-width: 1536px) {
26509
- font-size: 0.6875em; /* 11px → 0.6875em */
26515
+ font-size: 0.75em; /* 11px → 0.6875em */
26510
26516
  }
26511
26517
  @media (max-width: 1366px) {
26512
26518
  font-size: 0.625em; /* 10px → 0.625em */
@@ -28860,7 +28866,6 @@ const scrollableStyles$2 = `
28860
28866
  }
28861
28867
  `;
28862
28868
  const DoubleBarSingleLineContainer = styled__default["default"].div`
28863
- position: relative;
28864
28869
  font-family: "Poppins", sans-serif;
28865
28870
  color: #212121;
28866
28871
  background-color: white;
@@ -28871,13 +28876,14 @@ const DoubleBarSingleLineContainer = styled__default["default"].div`
28871
28876
  ${scrollableStyles$2}
28872
28877
  `;
28873
28878
  const LegendContainer = styled__default["default"].div`
28874
- position: sticky;
28879
+ position: absolute;
28880
+ left: 0;
28875
28881
  text-align: center;
28876
- width: ${props => props.width};
28877
- bottom: calc(100% - ${props => props.height});
28882
+ width: ${props => `${props.width}px`};
28883
+ bottom: 30px;
28878
28884
  `;
28879
28885
  const Controls$1 = styled__default["default"].div`
28880
- height: 100%;
28886
+ height: calc(100% - 30px);
28881
28887
  display: flex;
28882
28888
  flex-direction: column;
28883
28889
  background-color: white;
@@ -28929,6 +28935,7 @@ const DoubleBarSingleLine = props => {
28929
28935
  width,
28930
28936
  height,
28931
28937
  title,
28938
+ hasScroll,
28932
28939
  dataState,
28933
28940
  data,
28934
28941
  lineChartValueType,
@@ -28940,6 +28947,31 @@ const DoubleBarSingleLine = props => {
28940
28947
  noDataText
28941
28948
  } = props;
28942
28949
  const [legendData, setLegendData] = React$1.useState([]);
28950
+ const containerRef = React$1.useRef(null);
28951
+ const [containerWidth, setContainerWidth] = React$1.useState(0); // State to store the container's width
28952
+
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
+ });
28964
+ if (containerRef.current) {
28965
+ resizeObserver.observe(containerRef.current); // Start observing
28966
+ }
28967
+
28968
+ // Cleanup observer on component unmount
28969
+ return () => {
28970
+ if (containerRef.current) {
28971
+ resizeObserver.unobserve(containerRef.current);
28972
+ }
28973
+ };
28974
+ }, []);
28943
28975
  React$1.useEffect(() => {
28944
28976
  const newLegendData = dataState.map(item => ({
28945
28977
  title: item.name,
@@ -29042,9 +29074,12 @@ const DoubleBarSingleLine = props => {
29042
29074
  } else {
29043
29075
  `${currentTooltipValue.toFixed(1)}`;
29044
29076
  }
29045
- 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, {
29046
- key: item.name || idx
29047
- }, `${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.value.toFixed(1)}`);
29082
+ }));
29048
29083
  };
29049
29084
  const CustomTickBarChart = props => {
29050
29085
  const {
@@ -29081,26 +29116,55 @@ const DoubleBarSingleLine = props => {
29081
29116
  dy: 22
29082
29117
  }, line))));
29083
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);
29084
29140
  return /*#__PURE__*/React__default["default"].createElement(DoubleBarSingleLineContainer, {
29141
+ ref: containerRef,
29085
29142
  className: className,
29086
29143
  height: height,
29087
29144
  width: width,
29088
- hasScroll: data.length >= limitViewableItems
29145
+ hasScroll: hasScroll
29089
29146
  }, data.length === 0 ? /*#__PURE__*/React__default["default"].createElement(NoDataFoundMessage, {
29090
29147
  noDataText: noDataText
29091
29148
  }) : /*#__PURE__*/React__default["default"].createElement(Controls$1, {
29092
29149
  className: "Controls"
29093
- }, title !== '' && /*#__PURE__*/React__default["default"].createElement(Title$2, null, title), /*#__PURE__*/React__default["default"].createElement(ChartsWrapper, {
29094
- width: data.length >= limitViewableItems ? `${data.length * 178}px` : 'auto'
29095
- }, /*#__PURE__*/React__default["default"].createElement(LineChartWrapper, null, /*#__PURE__*/React__default["default"].createElement(recharts.ResponsiveContainer, null, /*#__PURE__*/React__default["default"].createElement(recharts.LineChart, {
29096
- data: data,
29097
- margin: {
29098
- top: 10,
29099
- right: 35,
29100
- left: 35,
29101
- bottom: 32
29150
+ }, title && title.trim() !== '' && /*#__PURE__*/React__default["default"].createElement(Title$2, null, title), /*#__PURE__*/React__default["default"].createElement(ChartsWrapper, {
29151
+ 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
29102
29166
  }
29103
- }, /*#__PURE__*/React__default["default"].createElement(recharts.YAxis, {
29167
+ }), /*#__PURE__*/React__default["default"].createElement(recharts.YAxis, {
29104
29168
  domain: [dataMin => Math.min(dataMin, calculateMinValue(data, dataState)) - 10, dataMax => Math.max(dataMax, calculateMaxValue(data, dataState)) + 10],
29105
29169
  hide: true
29106
29170
  }), dataState.filter(item => item.type === "line").map(obj => /*#__PURE__*/React__default["default"].createElement(recharts.Line, {
@@ -29108,22 +29172,28 @@ const DoubleBarSingleLine = props => {
29108
29172
  key: obj.key,
29109
29173
  dataKey: obj.key,
29110
29174
  stroke: obj.color,
29111
- fill: obj.color,
29112
- 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"
29113
29183
  }, /*#__PURE__*/React__default["default"].createElement(recharts.LabelList, {
29114
- content: CustomLabelLine
29115
- })))))), /*#__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({
29116
29187
  data: data,
29117
29188
  barGap: 13,
29118
29189
  barCategoryGap: data.length >= limitViewableItems ? 178 : 50,
29119
- barSize: barsWidth,
29190
+ barSize: barsWidth
29191
+ }, syncCharts, {
29120
29192
  margin: {
29121
- top: 0,
29122
- right: 10,
29123
- left: 10,
29193
+ ...syncCharts.margin,
29124
29194
  bottom: 120
29125
29195
  }
29126
- }, /*#__PURE__*/React__default["default"].createElement(recharts.Tooltip, {
29196
+ }), /*#__PURE__*/React__default["default"].createElement(recharts.Tooltip, {
29127
29197
  content: /*#__PURE__*/React__default["default"].createElement(CustomTooltip, null)
29128
29198
  }), showBackgroundGrid && /*#__PURE__*/React__default["default"].createElement(recharts.CartesianGrid, {
29129
29199
  vertical: false,
@@ -29138,20 +29208,19 @@ const DoubleBarSingleLine = props => {
29138
29208
  tickLine: false,
29139
29209
  interval: 0
29140
29210
  }), /*#__PURE__*/React__default["default"].createElement(recharts.YAxis, {
29141
- domain: [dataMin => Math.min(dataMin, 0),
29142
- // Handle negative values
29143
- 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],
29144
29212
  hide: true
29145
29213
  }), dataState.filter(item => item.type === "bar").map(obj => /*#__PURE__*/React__default["default"].createElement(recharts.Bar, {
29146
29214
  key: obj.key,
29147
29215
  dataKey: obj.key,
29148
29216
  fill: obj.color,
29149
- radius: [4, 4, 0, 0]
29217
+ radius: [4, 4, 0, 0],
29218
+ isAnimationActive: false
29150
29219
  }, /*#__PURE__*/React__default["default"].createElement(recharts.LabelList, {
29151
29220
  dataKey: obj.key,
29152
29221
  content: CustomLabel
29153
29222
  }))))))), showLegend && /*#__PURE__*/React__default["default"].createElement(LegendContainer, {
29154
- width: width,
29223
+ width: containerWidth,
29155
29224
  height: height
29156
29225
  }, /*#__PURE__*/React__default["default"].createElement(PerformanceAnalyticsLegend, {
29157
29226
  legendData: legendData
@@ -29335,11 +29404,17 @@ const AreaChart = props => {
29335
29404
  const [areaChartsToDisplay, setAreaChartsToDisplay] = React$1.useState([]);
29336
29405
 
29337
29406
  // Compute max domain values
29338
- const leftKeys = areaChartsState.filter(chart => chart.yAxisId === "left").map(chart => chart.key);
29339
- const rightKeys = areaChartsState.filter(chart => chart.yAxisId === "right").map(chart => chart.key);
29340
- const getMaxDomain = keys => data ? Math.max(...data.flatMap(d => keys.map(key => d[key] ?? 0))) * 1.1 : 0;
29341
- const maxLeftDomain = getMaxDomain(leftKeys);
29342
- const maxRightDomain = getMaxDomain(rightKeys);
29407
+ // const leftKeys = areaChartsState
29408
+ // .filter((chart) => chart.yAxisId === "left")
29409
+ // .map((chart) => chart.key);
29410
+ // const rightKeys = areaChartsState
29411
+ // .filter((chart) => chart.yAxisId === "right")
29412
+ // .map((chart) => chart.key);
29413
+ // const getMaxDomain = (keys) =>
29414
+ // data ? Math.max(...data.flatMap((d) => keys.map((key) => d[key] ?? 0))) * 1.1 : 0;
29415
+ // const maxLeftDomain = getMaxDomain(leftKeys);
29416
+ // const maxRightDomain = getMaxDomain(rightKeys);
29417
+
29343
29418
  React$1.useEffect(() => {
29344
29419
  if (containerRef.current) {
29345
29420
  setContainerWidth(containerRef.current.offsetWidth);
@@ -29557,19 +29632,13 @@ const AreaChart = props => {
29557
29632
  tickLine: false
29558
29633
  }), /*#__PURE__*/React__default["default"].createElement(recharts.YAxis, {
29559
29634
  yAxisId: "left",
29560
- domain: [0, maxLeftDomain],
29561
- hide: true,
29562
- ticks: Array.from({
29563
- length: maxLeftDomain
29564
- }, (_, index) => index)
29635
+ domain: [0, 'dataMax'],
29636
+ hide: true
29565
29637
  }), /*#__PURE__*/React__default["default"].createElement(recharts.YAxis, {
29566
29638
  yAxisId: "right",
29567
29639
  orientation: "right",
29568
- domain: [0, maxRightDomain],
29569
- hide: true,
29570
- ticks: Array.from({
29571
- length: maxRightDomain
29572
- }, (_, index) => index)
29640
+ domain: [0, 'dataMax'],
29641
+ hide: true
29573
29642
  }), /*#__PURE__*/React__default["default"].createElement(recharts.CartesianGrid, {
29574
29643
  stroke: "#D0D0D0",
29575
29644
  strokeDasharray: "4 3",
@@ -30358,6 +30427,7 @@ exports.LinkButton = LinkButton;
30358
30427
  exports.LinnerDataBox = LinnerDataBox;
30359
30428
  exports.MarketShareDescription = MarketShareDescription;
30360
30429
  exports.OneColumnContainer = OneColumnContainer;
30430
+ exports.PerformanceAnalyticsLegend = PerformanceAnalyticsLegend;
30361
30431
  exports.PieChart = PieChart;
30362
30432
  exports.PopupCharts = PopupCharts;
30363
30433
  exports.QuickFilter = QuickFilter;