sag_components 2.0.0-beta86 → 2.0.0-beta88

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
@@ -23990,21 +23990,22 @@ const DeleteIcon = styled.div`
23990
23990
  position: absolute;
23991
23991
  `;
23992
23992
 
23993
- const QuickFilterDropdownSingle = ({
23994
- label,
23995
- hoverColor,
23996
- options,
23997
- selectedValue,
23998
- placeHolder,
23999
- onChange,
24000
- disabled,
24001
- width,
24002
- error,
24003
- errorMessage,
24004
- xIconShow,
24005
- labelColor,
24006
- showLabelOnTop
24007
- }) => {
23993
+ const QuickFilterDropdownSingle = _ref => {
23994
+ let {
23995
+ label,
23996
+ hoverColor,
23997
+ options,
23998
+ selectedValue,
23999
+ placeHolder,
24000
+ onChange,
24001
+ disabled,
24002
+ width,
24003
+ error,
24004
+ errorMessage,
24005
+ xIconShow,
24006
+ labelColor,
24007
+ showLabelOnTop
24008
+ } = _ref;
24008
24009
  const [isFocused, setIsFocused] = useState(false);
24009
24010
  const [showOptions, setShowOptions] = useState(false);
24010
24011
  const [inputValue, setInputValue] = useState("");
@@ -24402,23 +24403,24 @@ const IconContainer$2 = styled.div`
24402
24403
  cursor: pointer;
24403
24404
  `;
24404
24405
 
24405
- const QuickFilterDropdownMultiSelection = ({
24406
- label,
24407
- labelEmptyValue,
24408
- options,
24409
- selectedValue,
24410
- placeHolder,
24411
- onChange,
24412
- required,
24413
- disabled,
24414
- width,
24415
- error,
24416
- errorMessage,
24417
- labelColor,
24418
- xIconShow,
24419
- checkBoxColor,
24420
- showLabelOnTop
24421
- }) => {
24406
+ const QuickFilterDropdownMultiSelection = _ref => {
24407
+ let {
24408
+ label,
24409
+ labelEmptyValue,
24410
+ options,
24411
+ selectedValue,
24412
+ placeHolder,
24413
+ onChange,
24414
+ required,
24415
+ disabled,
24416
+ width,
24417
+ error,
24418
+ errorMessage,
24419
+ labelColor,
24420
+ xIconShow,
24421
+ checkBoxColor,
24422
+ showLabelOnTop
24423
+ } = _ref;
24422
24424
  const [isFocused, setIsFocused] = useState(false);
24423
24425
  const [showOptions, setShowOptions] = useState(false);
24424
24426
  const [inputValue, setInputValue] = useState('');
@@ -30414,7 +30416,7 @@ const BubbleChart = _ref => {
30414
30416
  "data-testid": "tooltip-description"
30415
30417
  }, /*#__PURE__*/React$1.createElement("span", null, data.tooltip.description)), /*#__PURE__*/React$1.createElement(TooltipMetric, {
30416
30418
  "data-testid": "tooltip-cost"
30417
- }, /*#__PURE__*/React$1.createElement("span", null, "Total cost:"), /*#__PURE__*/React$1.createElement("span", null, formatCurrency(data.tooltip.cost))), /*#__PURE__*/React$1.createElement(TooltipMetric, {
30419
+ }, /*#__PURE__*/React$1.createElement("span", null, "Total cost:"), /*#__PURE__*/React$1.createElement("span", null, data.tooltip.allSizesEmpty ? 'N/A' : formatCurrency(data.tooltip.cost))), /*#__PURE__*/React$1.createElement(TooltipMetric, {
30418
30420
  "data-testid": "tooltip-sales"
30419
30421
  }, /*#__PURE__*/React$1.createElement("span", null, "INC Sales:"), /*#__PURE__*/React$1.createElement("span", null, formatCurrency(data.tooltip.incSales))), /*#__PURE__*/React$1.createElement(TooltipMetric, {
30420
30422
  "data-testid": "tooltip-roi"
@@ -30427,6 +30429,10 @@ const BubbleChart = _ref => {
30427
30429
 
30428
30430
  // Process all chart data - use original data values
30429
30431
  const allChartData = useMemo(() => {
30432
+ // Check if all size values are empty (0, null, undefined)
30433
+ const allSizesEmpty = data.every(item => !item.size || item.size === 0);
30434
+ const defaultSize = allSizesEmpty ? 10 : null; // Use 10 as default size when all are empty
30435
+
30430
30436
  return data.map((item, index) => {
30431
30437
  if (item.x === undefined || item.y === undefined || item.size === undefined) {
30432
30438
  console.warn('Skipping data item with missing values:', item);
@@ -30439,6 +30445,7 @@ const BubbleChart = _ref => {
30439
30445
  units: item.units || 0,
30440
30446
  roi: item.x || 0,
30441
30447
  incSales: item.y || 0,
30448
+ allSizesEmpty: allSizesEmpty,
30442
30449
  ...(item.tooltip || {})
30443
30450
  };
30444
30451
  return {
@@ -30446,8 +30453,8 @@ const BubbleChart = _ref => {
30446
30453
  // Use original x value
30447
30454
  y: item.y,
30448
30455
  // Use original y value
30449
- z: item.size,
30450
- // Use original size value
30456
+ z: defaultSize || item.size,
30457
+ // Use default size if all sizes are empty, otherwise use original
30451
30458
  tooltip: tooltipInfo,
30452
30459
  fill: getFill(item.x, item.y),
30453
30460
  key: `bubble-${index}` // Use index for stable keys
@@ -31553,7 +31560,6 @@ const TooltipContainer = styled.div`
31553
31560
  border-radius: 5px;
31554
31561
  box-shadow: 0px 2px 10px rgba(0, 0, 0, 0.2);
31555
31562
  border: 1px solid #ddd;
31556
- font-family: Poppins, sans-serif;
31557
31563
  font-weight: 500;
31558
31564
  font-size: 14px;
31559
31565
  `;
@@ -31591,6 +31597,12 @@ const BarLine = props => {
31591
31597
  left: 20,
31592
31598
  bottom: 0
31593
31599
  };
31600
+
31601
+ // Changed to match InnerBar component behavior
31602
+ const [brushRange, setBrushRange] = useState({
31603
+ startIndex: 0,
31604
+ endIndex: Math.min(6, brushAreaBarData.length - 1)
31605
+ });
31594
31606
  const CustomizedTick = /*#__PURE__*/React$1.memo(({
31595
31607
  x,
31596
31608
  y,
@@ -31654,6 +31666,15 @@ const BarLine = props => {
31654
31666
  } = payload[0].payload;
31655
31667
  return /*#__PURE__*/React$1.createElement(TooltipContainer, null, /*#__PURE__*/React$1.createElement(TooltipTitle$4, null, label), /*#__PURE__*/React$1.createElement(TooltipText, null, description), /*#__PURE__*/React$1.createElement(TooltipText, null, `INC Sales: $${getFormattedValue(inc_sales)}${getFormattedUnits(inc_sales)}`), /*#__PURE__*/React$1.createElement(TooltipText, null, `INC Sales ROI: ${getFormattedValue(inc_roi)}${getFormattedUnits(inc_roi)}`));
31656
31668
  });
31669
+
31670
+ // Fixed brush change handler to match InnerBar component
31671
+ const handleBrushChange = range => {
31672
+ setBrushRange(range);
31673
+ };
31674
+
31675
+ // Calculate the number of visible bars like InnerBar component
31676
+ const visibleBarsCount = brushRange.endIndex - brushRange.startIndex + 1;
31677
+ const shouldShowLabels = visibleBarsCount <= 8;
31657
31678
  return /*#__PURE__*/React$1.createElement("div", {
31658
31679
  style: {
31659
31680
  width: "100%",
@@ -31709,12 +31730,13 @@ const BarLine = props => {
31709
31730
  dataKey: "label",
31710
31731
  height: 30,
31711
31732
  stroke: "#212121",
31712
- startIndex: 0,
31713
- endIndex: Math.min(6, brushAreaBarData.length - 1),
31733
+ startIndex: brushRange.startIndex,
31734
+ endIndex: brushRange.endIndex,
31714
31735
  y: 330,
31715
31736
  travellerWidth: 10,
31716
31737
  tickFormatter: (value, index) => index + 1,
31717
- hide: true
31738
+ hide: true,
31739
+ onChange: handleBrushChange
31718
31740
  })))), /*#__PURE__*/React$1.createElement("div", {
31719
31741
  style: {
31720
31742
  height: "65%"
@@ -31732,7 +31754,7 @@ const BarLine = props => {
31732
31754
  vertical: false
31733
31755
  }), /*#__PURE__*/React$1.createElement(XAxis, {
31734
31756
  dataKey: "label",
31735
- tick: /*#__PURE__*/React$1.createElement(CustomizedTick, null),
31757
+ tick: shouldShowLabels ? /*#__PURE__*/React$1.createElement(CustomizedTick, null) : false,
31736
31758
  interval: 0,
31737
31759
  height: 50,
31738
31760
  tickLine: false
@@ -31761,9 +31783,10 @@ const BarLine = props => {
31761
31783
  height: 30,
31762
31784
  fill: "#EFEFEF",
31763
31785
  travellerWidth: 10,
31764
- startIndex: 0,
31765
- endIndex: Math.min(6, brushAreaBarData.length - 1),
31766
- className: "custom-brush"
31786
+ startIndex: brushRange.startIndex,
31787
+ endIndex: brushRange.endIndex,
31788
+ className: "custom-brush",
31789
+ onChange: handleBrushChange
31767
31790
  })))), /*#__PURE__*/React$1.createElement(PerformanceAnalyticsLegend, {
31768
31791
  width: "100%",
31769
31792
  height: "40px",
@@ -31788,11 +31811,20 @@ const SingleChart = props => {
31788
31811
  } = props;
31789
31812
  const MAX_CHARS_PER_LINE = getMaxCharsPerLine(barData.length);
31790
31813
  const MAX_LINES = 2;
31791
- const dataWithIndex = barData?.map((item, index) => ({
31792
- ...item,
31793
- index,
31794
- shortLabel: item.label.replace("Vendor Selling Event: ", "Wk ")
31795
- }));
31814
+
31815
+ // Separate state for brush range
31816
+ const [brushRange, setBrushRange] = useState({
31817
+ startIndex: 0,
31818
+ endIndex: Math.min(6, barData.length - 1)
31819
+ });
31820
+
31821
+ // Remove data transformation - use original data like InnerBar does
31822
+ // const dataWithIndex = barData?.map((item, index) => ({
31823
+ // ...item,
31824
+ // index,
31825
+ // shortLabel: item.label.replace("Vendor Selling Event: ", "Wk "),
31826
+ // }));
31827
+
31796
31828
  const CustomizedTick = /*#__PURE__*/React$1.memo(({
31797
31829
  x,
31798
31830
  y,
@@ -31852,28 +31884,41 @@ const SingleChart = props => {
31852
31884
  if (!data) return null;
31853
31885
  return /*#__PURE__*/React$1.createElement(TooltipContainer, null, /*#__PURE__*/React$1.createElement(TooltipTitle$4, null, `${data.label}`), /*#__PURE__*/React$1.createElement(TooltipText, null, `${data.description}`), /*#__PURE__*/React$1.createElement(TooltipText, null, `${data.typeTitle}: ${getFormattedValue(data.value)}${getFormattedUnits(data.value)}`));
31854
31886
  };
31887
+
31888
+ // Fixed brush change handler - matches the working InnerBar component exactly
31889
+ const handleBrushChange = range => {
31890
+ setBrushRange(range);
31891
+ };
31892
+
31893
+ // Calculate the number of visible bars
31894
+ const visibleBarsCount = brushRange.endIndex - brushRange.startIndex + 1;
31895
+ const shouldShowLabels = visibleBarsCount <= 8;
31855
31896
  return /*#__PURE__*/React$1.createElement("div", {
31856
31897
  style: {
31857
31898
  width: "100%",
31858
- height: "100%"
31899
+ height: "100%",
31900
+ userSelect: "none"
31859
31901
  }
31860
31902
  }, /*#__PURE__*/React$1.createElement(ResponsiveContainer, {
31861
31903
  width: "100%",
31862
31904
  height: "90%"
31863
31905
  }, /*#__PURE__*/React$1.createElement(BarChart$1, {
31864
- data: dataWithIndex,
31906
+ data: barData,
31865
31907
  margin: {
31866
31908
  top: 40,
31867
31909
  right: 40,
31868
31910
  left: 20,
31869
31911
  bottom: 0
31912
+ },
31913
+ style: {
31914
+ userSelect: "none"
31870
31915
  }
31871
31916
  }, /*#__PURE__*/React$1.createElement(CartesianGrid, {
31872
31917
  strokeDasharray: "3 3",
31873
31918
  vertical: false
31874
31919
  }), /*#__PURE__*/React$1.createElement(XAxis, {
31875
31920
  dataKey: "label",
31876
- tick: /*#__PURE__*/React$1.createElement(CustomizedTick, null),
31921
+ tick: shouldShowLabels ? /*#__PURE__*/React$1.createElement(CustomizedTick, null) : false,
31877
31922
  interval: 0,
31878
31923
  height: 50,
31879
31924
  tickLine: false
@@ -31901,9 +31946,10 @@ const SingleChart = props => {
31901
31946
  height: 30,
31902
31947
  fill: "#EFEFEF",
31903
31948
  travellerWidth: 10,
31904
- startIndex: 0,
31905
- endIndex: Math.min(6, barData.length - 1),
31906
- className: "custom-brush"
31949
+ startIndex: brushRange.startIndex,
31950
+ endIndex: brushRange.endIndex,
31951
+ className: "custom-brush",
31952
+ onChange: handleBrushChange
31907
31953
  }))), /*#__PURE__*/React$1.createElement(PerformanceAnalyticsLegend, {
31908
31954
  width: "100%",
31909
31955
  height: "40px",
@@ -31924,6 +31970,12 @@ const InnerBar = props => {
31924
31970
  } = props;
31925
31971
  const MAX_CHARS_PER_LINE = getMaxCharsPerLine(brushInnerBarData.length);
31926
31972
  const MAX_LINES = 2;
31973
+
31974
+ // Separate state for brush range and label display
31975
+ const [brushRange, setBrushRange] = useState({
31976
+ startIndex: 0,
31977
+ endIndex: Math.min(6, brushInnerBarData.length - 1)
31978
+ });
31927
31979
  const BarWithInner = props => {
31928
31980
  const {
31929
31981
  x,
@@ -32034,6 +32086,13 @@ const InnerBar = props => {
32034
32086
  dy: idx === 0 ? "0.71em" : "1.2em"
32035
32087
  }, line))));
32036
32088
  });
32089
+ const handleBrushChange = range => {
32090
+ setBrushRange(range);
32091
+ };
32092
+
32093
+ // Calculate the number of visible bars
32094
+ const visibleBarsCount = brushRange.endIndex - brushRange.startIndex + 1;
32095
+ const shouldShowLabels = visibleBarsCount <= 8;
32037
32096
  return /*#__PURE__*/React$1.createElement("div", {
32038
32097
  style: {
32039
32098
  width: "100%",
@@ -32055,7 +32114,7 @@ const InnerBar = props => {
32055
32114
  vertical: false
32056
32115
  }), /*#__PURE__*/React$1.createElement(XAxis, {
32057
32116
  dataKey: "label",
32058
- tick: /*#__PURE__*/React$1.createElement(CustomizedTick, null),
32117
+ tick: shouldShowLabels ? /*#__PURE__*/React$1.createElement(CustomizedTick, null) : false,
32059
32118
  height: 50,
32060
32119
  tickLine: false,
32061
32120
  interval: 0
@@ -32074,9 +32133,10 @@ const InnerBar = props => {
32074
32133
  height: 30,
32075
32134
  fill: "#EFEFEF",
32076
32135
  travellerWidth: 10,
32077
- startIndex: 0,
32078
- endIndex: Math.min(6, brushInnerBarData.length - 1),
32079
- className: "custom-brush"
32136
+ startIndex: brushRange.startIndex,
32137
+ endIndex: brushRange.endIndex,
32138
+ className: "custom-brush",
32139
+ onChange: handleBrushChange
32080
32140
  }))), /*#__PURE__*/React$1.createElement(PerformanceAnalyticsLegend, {
32081
32141
  width: "100%",
32082
32142
  height: "40px",