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.js CHANGED
@@ -24000,21 +24000,22 @@ const DeleteIcon = styled__default["default"].div`
24000
24000
  position: absolute;
24001
24001
  `;
24002
24002
 
24003
- const QuickFilterDropdownSingle = ({
24004
- label,
24005
- hoverColor,
24006
- options,
24007
- selectedValue,
24008
- placeHolder,
24009
- onChange,
24010
- disabled,
24011
- width,
24012
- error,
24013
- errorMessage,
24014
- xIconShow,
24015
- labelColor,
24016
- showLabelOnTop
24017
- }) => {
24003
+ const QuickFilterDropdownSingle = _ref => {
24004
+ let {
24005
+ label,
24006
+ hoverColor,
24007
+ options,
24008
+ selectedValue,
24009
+ placeHolder,
24010
+ onChange,
24011
+ disabled,
24012
+ width,
24013
+ error,
24014
+ errorMessage,
24015
+ xIconShow,
24016
+ labelColor,
24017
+ showLabelOnTop
24018
+ } = _ref;
24018
24019
  const [isFocused, setIsFocused] = React$1.useState(false);
24019
24020
  const [showOptions, setShowOptions] = React$1.useState(false);
24020
24021
  const [inputValue, setInputValue] = React$1.useState("");
@@ -24412,23 +24413,24 @@ const IconContainer$2 = styled__default["default"].div`
24412
24413
  cursor: pointer;
24413
24414
  `;
24414
24415
 
24415
- const QuickFilterDropdownMultiSelection = ({
24416
- label,
24417
- labelEmptyValue,
24418
- options,
24419
- selectedValue,
24420
- placeHolder,
24421
- onChange,
24422
- required,
24423
- disabled,
24424
- width,
24425
- error,
24426
- errorMessage,
24427
- labelColor,
24428
- xIconShow,
24429
- checkBoxColor,
24430
- showLabelOnTop
24431
- }) => {
24416
+ const QuickFilterDropdownMultiSelection = _ref => {
24417
+ let {
24418
+ label,
24419
+ labelEmptyValue,
24420
+ options,
24421
+ selectedValue,
24422
+ placeHolder,
24423
+ onChange,
24424
+ required,
24425
+ disabled,
24426
+ width,
24427
+ error,
24428
+ errorMessage,
24429
+ labelColor,
24430
+ xIconShow,
24431
+ checkBoxColor,
24432
+ showLabelOnTop
24433
+ } = _ref;
24432
24434
  const [isFocused, setIsFocused] = React$1.useState(false);
24433
24435
  const [showOptions, setShowOptions] = React$1.useState(false);
24434
24436
  const [inputValue, setInputValue] = React$1.useState('');
@@ -30424,7 +30426,7 @@ const BubbleChart = _ref => {
30424
30426
  "data-testid": "tooltip-description"
30425
30427
  }, /*#__PURE__*/React__default["default"].createElement("span", null, data.tooltip.description)), /*#__PURE__*/React__default["default"].createElement(TooltipMetric, {
30426
30428
  "data-testid": "tooltip-cost"
30427
- }, /*#__PURE__*/React__default["default"].createElement("span", null, "Total cost:"), /*#__PURE__*/React__default["default"].createElement("span", null, formatCurrency(data.tooltip.cost))), /*#__PURE__*/React__default["default"].createElement(TooltipMetric, {
30429
+ }, /*#__PURE__*/React__default["default"].createElement("span", null, "Total cost:"), /*#__PURE__*/React__default["default"].createElement("span", null, data.tooltip.allSizesEmpty ? 'N/A' : formatCurrency(data.tooltip.cost))), /*#__PURE__*/React__default["default"].createElement(TooltipMetric, {
30428
30430
  "data-testid": "tooltip-sales"
30429
30431
  }, /*#__PURE__*/React__default["default"].createElement("span", null, "INC Sales:"), /*#__PURE__*/React__default["default"].createElement("span", null, formatCurrency(data.tooltip.incSales))), /*#__PURE__*/React__default["default"].createElement(TooltipMetric, {
30430
30432
  "data-testid": "tooltip-roi"
@@ -30437,6 +30439,10 @@ const BubbleChart = _ref => {
30437
30439
 
30438
30440
  // Process all chart data - use original data values
30439
30441
  const allChartData = React$1.useMemo(() => {
30442
+ // Check if all size values are empty (0, null, undefined)
30443
+ const allSizesEmpty = data.every(item => !item.size || item.size === 0);
30444
+ const defaultSize = allSizesEmpty ? 10 : null; // Use 10 as default size when all are empty
30445
+
30440
30446
  return data.map((item, index) => {
30441
30447
  if (item.x === undefined || item.y === undefined || item.size === undefined) {
30442
30448
  console.warn('Skipping data item with missing values:', item);
@@ -30449,6 +30455,7 @@ const BubbleChart = _ref => {
30449
30455
  units: item.units || 0,
30450
30456
  roi: item.x || 0,
30451
30457
  incSales: item.y || 0,
30458
+ allSizesEmpty: allSizesEmpty,
30452
30459
  ...(item.tooltip || {})
30453
30460
  };
30454
30461
  return {
@@ -30456,8 +30463,8 @@ const BubbleChart = _ref => {
30456
30463
  // Use original x value
30457
30464
  y: item.y,
30458
30465
  // Use original y value
30459
- z: item.size,
30460
- // Use original size value
30466
+ z: defaultSize || item.size,
30467
+ // Use default size if all sizes are empty, otherwise use original
30461
30468
  tooltip: tooltipInfo,
30462
30469
  fill: getFill(item.x, item.y),
30463
30470
  key: `bubble-${index}` // Use index for stable keys
@@ -31563,7 +31570,6 @@ const TooltipContainer = styled__default["default"].div`
31563
31570
  border-radius: 5px;
31564
31571
  box-shadow: 0px 2px 10px rgba(0, 0, 0, 0.2);
31565
31572
  border: 1px solid #ddd;
31566
- font-family: Poppins, sans-serif;
31567
31573
  font-weight: 500;
31568
31574
  font-size: 14px;
31569
31575
  `;
@@ -31601,6 +31607,12 @@ const BarLine = props => {
31601
31607
  left: 20,
31602
31608
  bottom: 0
31603
31609
  };
31610
+
31611
+ // Changed to match InnerBar component behavior
31612
+ const [brushRange, setBrushRange] = React$1.useState({
31613
+ startIndex: 0,
31614
+ endIndex: Math.min(6, brushAreaBarData.length - 1)
31615
+ });
31604
31616
  const CustomizedTick = /*#__PURE__*/React__default["default"].memo(({
31605
31617
  x,
31606
31618
  y,
@@ -31664,6 +31676,15 @@ const BarLine = props => {
31664
31676
  } = payload[0].payload;
31665
31677
  return /*#__PURE__*/React__default["default"].createElement(TooltipContainer, null, /*#__PURE__*/React__default["default"].createElement(TooltipTitle$4, null, label), /*#__PURE__*/React__default["default"].createElement(TooltipText, null, description), /*#__PURE__*/React__default["default"].createElement(TooltipText, null, `INC Sales: $${getFormattedValue(inc_sales)}${getFormattedUnits(inc_sales)}`), /*#__PURE__*/React__default["default"].createElement(TooltipText, null, `INC Sales ROI: ${getFormattedValue(inc_roi)}${getFormattedUnits(inc_roi)}`));
31666
31678
  });
31679
+
31680
+ // Fixed brush change handler to match InnerBar component
31681
+ const handleBrushChange = range => {
31682
+ setBrushRange(range);
31683
+ };
31684
+
31685
+ // Calculate the number of visible bars like InnerBar component
31686
+ const visibleBarsCount = brushRange.endIndex - brushRange.startIndex + 1;
31687
+ const shouldShowLabels = visibleBarsCount <= 8;
31667
31688
  return /*#__PURE__*/React__default["default"].createElement("div", {
31668
31689
  style: {
31669
31690
  width: "100%",
@@ -31719,12 +31740,13 @@ const BarLine = props => {
31719
31740
  dataKey: "label",
31720
31741
  height: 30,
31721
31742
  stroke: "#212121",
31722
- startIndex: 0,
31723
- endIndex: Math.min(6, brushAreaBarData.length - 1),
31743
+ startIndex: brushRange.startIndex,
31744
+ endIndex: brushRange.endIndex,
31724
31745
  y: 330,
31725
31746
  travellerWidth: 10,
31726
31747
  tickFormatter: (value, index) => index + 1,
31727
- hide: true
31748
+ hide: true,
31749
+ onChange: handleBrushChange
31728
31750
  })))), /*#__PURE__*/React__default["default"].createElement("div", {
31729
31751
  style: {
31730
31752
  height: "65%"
@@ -31742,7 +31764,7 @@ const BarLine = props => {
31742
31764
  vertical: false
31743
31765
  }), /*#__PURE__*/React__default["default"].createElement(recharts.XAxis, {
31744
31766
  dataKey: "label",
31745
- tick: /*#__PURE__*/React__default["default"].createElement(CustomizedTick, null),
31767
+ tick: shouldShowLabels ? /*#__PURE__*/React__default["default"].createElement(CustomizedTick, null) : false,
31746
31768
  interval: 0,
31747
31769
  height: 50,
31748
31770
  tickLine: false
@@ -31771,9 +31793,10 @@ const BarLine = props => {
31771
31793
  height: 30,
31772
31794
  fill: "#EFEFEF",
31773
31795
  travellerWidth: 10,
31774
- startIndex: 0,
31775
- endIndex: Math.min(6, brushAreaBarData.length - 1),
31776
- className: "custom-brush"
31796
+ startIndex: brushRange.startIndex,
31797
+ endIndex: brushRange.endIndex,
31798
+ className: "custom-brush",
31799
+ onChange: handleBrushChange
31777
31800
  })))), /*#__PURE__*/React__default["default"].createElement(PerformanceAnalyticsLegend, {
31778
31801
  width: "100%",
31779
31802
  height: "40px",
@@ -31798,11 +31821,20 @@ const SingleChart = props => {
31798
31821
  } = props;
31799
31822
  const MAX_CHARS_PER_LINE = getMaxCharsPerLine(barData.length);
31800
31823
  const MAX_LINES = 2;
31801
- const dataWithIndex = barData?.map((item, index) => ({
31802
- ...item,
31803
- index,
31804
- shortLabel: item.label.replace("Vendor Selling Event: ", "Wk ")
31805
- }));
31824
+
31825
+ // Separate state for brush range
31826
+ const [brushRange, setBrushRange] = React$1.useState({
31827
+ startIndex: 0,
31828
+ endIndex: Math.min(6, barData.length - 1)
31829
+ });
31830
+
31831
+ // Remove data transformation - use original data like InnerBar does
31832
+ // const dataWithIndex = barData?.map((item, index) => ({
31833
+ // ...item,
31834
+ // index,
31835
+ // shortLabel: item.label.replace("Vendor Selling Event: ", "Wk "),
31836
+ // }));
31837
+
31806
31838
  const CustomizedTick = /*#__PURE__*/React__default["default"].memo(({
31807
31839
  x,
31808
31840
  y,
@@ -31862,28 +31894,41 @@ const SingleChart = props => {
31862
31894
  if (!data) return null;
31863
31895
  return /*#__PURE__*/React__default["default"].createElement(TooltipContainer, null, /*#__PURE__*/React__default["default"].createElement(TooltipTitle$4, null, `${data.label}`), /*#__PURE__*/React__default["default"].createElement(TooltipText, null, `${data.description}`), /*#__PURE__*/React__default["default"].createElement(TooltipText, null, `${data.typeTitle}: ${getFormattedValue(data.value)}${getFormattedUnits(data.value)}`));
31864
31896
  };
31897
+
31898
+ // Fixed brush change handler - matches the working InnerBar component exactly
31899
+ const handleBrushChange = range => {
31900
+ setBrushRange(range);
31901
+ };
31902
+
31903
+ // Calculate the number of visible bars
31904
+ const visibleBarsCount = brushRange.endIndex - brushRange.startIndex + 1;
31905
+ const shouldShowLabels = visibleBarsCount <= 8;
31865
31906
  return /*#__PURE__*/React__default["default"].createElement("div", {
31866
31907
  style: {
31867
31908
  width: "100%",
31868
- height: "100%"
31909
+ height: "100%",
31910
+ userSelect: "none"
31869
31911
  }
31870
31912
  }, /*#__PURE__*/React__default["default"].createElement(recharts.ResponsiveContainer, {
31871
31913
  width: "100%",
31872
31914
  height: "90%"
31873
31915
  }, /*#__PURE__*/React__default["default"].createElement(recharts.BarChart, {
31874
- data: dataWithIndex,
31916
+ data: barData,
31875
31917
  margin: {
31876
31918
  top: 40,
31877
31919
  right: 40,
31878
31920
  left: 20,
31879
31921
  bottom: 0
31922
+ },
31923
+ style: {
31924
+ userSelect: "none"
31880
31925
  }
31881
31926
  }, /*#__PURE__*/React__default["default"].createElement(recharts.CartesianGrid, {
31882
31927
  strokeDasharray: "3 3",
31883
31928
  vertical: false
31884
31929
  }), /*#__PURE__*/React__default["default"].createElement(recharts.XAxis, {
31885
31930
  dataKey: "label",
31886
- tick: /*#__PURE__*/React__default["default"].createElement(CustomizedTick, null),
31931
+ tick: shouldShowLabels ? /*#__PURE__*/React__default["default"].createElement(CustomizedTick, null) : false,
31887
31932
  interval: 0,
31888
31933
  height: 50,
31889
31934
  tickLine: false
@@ -31911,9 +31956,10 @@ const SingleChart = props => {
31911
31956
  height: 30,
31912
31957
  fill: "#EFEFEF",
31913
31958
  travellerWidth: 10,
31914
- startIndex: 0,
31915
- endIndex: Math.min(6, barData.length - 1),
31916
- className: "custom-brush"
31959
+ startIndex: brushRange.startIndex,
31960
+ endIndex: brushRange.endIndex,
31961
+ className: "custom-brush",
31962
+ onChange: handleBrushChange
31917
31963
  }))), /*#__PURE__*/React__default["default"].createElement(PerformanceAnalyticsLegend, {
31918
31964
  width: "100%",
31919
31965
  height: "40px",
@@ -31934,6 +31980,12 @@ const InnerBar = props => {
31934
31980
  } = props;
31935
31981
  const MAX_CHARS_PER_LINE = getMaxCharsPerLine(brushInnerBarData.length);
31936
31982
  const MAX_LINES = 2;
31983
+
31984
+ // Separate state for brush range and label display
31985
+ const [brushRange, setBrushRange] = React$1.useState({
31986
+ startIndex: 0,
31987
+ endIndex: Math.min(6, brushInnerBarData.length - 1)
31988
+ });
31937
31989
  const BarWithInner = props => {
31938
31990
  const {
31939
31991
  x,
@@ -32044,6 +32096,13 @@ const InnerBar = props => {
32044
32096
  dy: idx === 0 ? "0.71em" : "1.2em"
32045
32097
  }, line))));
32046
32098
  });
32099
+ const handleBrushChange = range => {
32100
+ setBrushRange(range);
32101
+ };
32102
+
32103
+ // Calculate the number of visible bars
32104
+ const visibleBarsCount = brushRange.endIndex - brushRange.startIndex + 1;
32105
+ const shouldShowLabels = visibleBarsCount <= 8;
32047
32106
  return /*#__PURE__*/React__default["default"].createElement("div", {
32048
32107
  style: {
32049
32108
  width: "100%",
@@ -32065,7 +32124,7 @@ const InnerBar = props => {
32065
32124
  vertical: false
32066
32125
  }), /*#__PURE__*/React__default["default"].createElement(recharts.XAxis, {
32067
32126
  dataKey: "label",
32068
- tick: /*#__PURE__*/React__default["default"].createElement(CustomizedTick, null),
32127
+ tick: shouldShowLabels ? /*#__PURE__*/React__default["default"].createElement(CustomizedTick, null) : false,
32069
32128
  height: 50,
32070
32129
  tickLine: false,
32071
32130
  interval: 0
@@ -32084,9 +32143,10 @@ const InnerBar = props => {
32084
32143
  height: 30,
32085
32144
  fill: "#EFEFEF",
32086
32145
  travellerWidth: 10,
32087
- startIndex: 0,
32088
- endIndex: Math.min(6, brushInnerBarData.length - 1),
32089
- className: "custom-brush"
32146
+ startIndex: brushRange.startIndex,
32147
+ endIndex: brushRange.endIndex,
32148
+ className: "custom-brush",
32149
+ onChange: handleBrushChange
32090
32150
  }))), /*#__PURE__*/React__default["default"].createElement(PerformanceAnalyticsLegend, {
32091
32151
  width: "100%",
32092
32152
  height: "40px",