sag_components 2.0.0-beta61 → 2.0.0-beta63

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
@@ -31478,7 +31478,20 @@ const SeparatedLineBarChart = ({
31478
31478
  payload
31479
31479
  } = props;
31480
31480
  const label = payload.value;
31481
- const parts = label.replace("Vendor Selling Event: ", "").split(" ");
31481
+ const words = label.split(' ');
31482
+ const chunks = [];
31483
+ let currentChunk = '';
31484
+ words.forEach(word => {
31485
+ if (currentChunk.length + word.length > 15) {
31486
+ chunks.push(currentChunk.trim());
31487
+ currentChunk = word;
31488
+ } else {
31489
+ currentChunk += (currentChunk ? ' ' : '') + word;
31490
+ }
31491
+ });
31492
+ if (currentChunk) {
31493
+ chunks.push(currentChunk.trim());
31494
+ }
31482
31495
  return /*#__PURE__*/React$1.createElement("g", {
31483
31496
  transform: `translate(${x},${y})`
31484
31497
  }, /*#__PURE__*/React$1.createElement("text", {
@@ -31487,16 +31500,13 @@ const SeparatedLineBarChart = ({
31487
31500
  dy: 16,
31488
31501
  textAnchor: "middle",
31489
31502
  fill: "#212121",
31490
- fontSize: 11,
31491
- fontWeight: 400,
31503
+ fontSize: 10,
31492
31504
  fontFamily: "Poppins"
31493
- }, /*#__PURE__*/React$1.createElement("tspan", {
31494
- x: 0,
31495
- dy: 8
31496
- }, "Vendor Selling"), /*#__PURE__*/React$1.createElement("tspan", {
31505
+ }, chunks.map((chunk, i) => /*#__PURE__*/React$1.createElement("tspan", {
31506
+ key: i,
31497
31507
  x: 0,
31498
- dy: 18
31499
- }, "Event: ", parts.join(" "))));
31508
+ dy: i === 0 ? "0.71em" : "1.2em"
31509
+ }, chunk))));
31500
31510
  };
31501
31511
  const CustomTooltip = ({
31502
31512
  active,
@@ -31603,7 +31613,7 @@ const SeparatedLineBarChart = ({
31603
31613
  dataKey: "label",
31604
31614
  tick: /*#__PURE__*/React$1.createElement(CustomizedTick, null),
31605
31615
  interval: 0,
31606
- height: 60,
31616
+ height: 80,
31607
31617
  tickLine: false
31608
31618
  }), /*#__PURE__*/React$1.createElement(YAxis, {
31609
31619
  tickFormatter: v => `${v / 1000}k`,
@@ -31663,7 +31673,20 @@ function SingleChart({
31663
31673
  payload
31664
31674
  }) => {
31665
31675
  const label = dataWithIndex[payload.value]?.label ?? "";
31666
- const parts = label.replace("Vendor Selling Event: ", "").split(" ");
31676
+ const words = label.split(' ');
31677
+ const chunks = [];
31678
+ let currentChunk = '';
31679
+ words.forEach(word => {
31680
+ if (currentChunk.length + word.length > 15) {
31681
+ chunks.push(currentChunk.trim());
31682
+ currentChunk = word;
31683
+ } else {
31684
+ currentChunk += (currentChunk ? ' ' : '') + word;
31685
+ }
31686
+ });
31687
+ if (currentChunk) {
31688
+ chunks.push(currentChunk.trim());
31689
+ }
31667
31690
  return /*#__PURE__*/React$1.createElement("g", {
31668
31691
  transform: `translate(${x},${y})`
31669
31692
  }, /*#__PURE__*/React$1.createElement("text", {
@@ -31672,16 +31695,13 @@ function SingleChart({
31672
31695
  dy: 16,
31673
31696
  textAnchor: "middle",
31674
31697
  fill: "#212121",
31675
- fontSize: 11,
31676
- fontWeight: "400",
31698
+ fontSize: 10,
31677
31699
  fontFamily: "Poppins"
31678
- }, /*#__PURE__*/React$1.createElement("tspan", {
31679
- x: 0,
31680
- dy: 8
31681
- }, "Vendor Selling"), /*#__PURE__*/React$1.createElement("tspan", {
31700
+ }, chunks.map((chunk, i) => /*#__PURE__*/React$1.createElement("tspan", {
31701
+ key: i,
31682
31702
  x: 0,
31683
- dy: 18
31684
- }, "Event: ", parts.join(" "))));
31703
+ dy: i === 0 ? "0.71em" : "1.2em"
31704
+ }, chunk))));
31685
31705
  };
31686
31706
  const CustomTooltip = ({
31687
31707
  active,
@@ -31690,7 +31710,6 @@ function SingleChart({
31690
31710
  if (!active || !payload || !payload.length) return null;
31691
31711
  const data = payload[0]?.payload;
31692
31712
  if (!data) return null;
31693
- console.log(data);
31694
31713
  return /*#__PURE__*/React$1.createElement(TooltipContainer, null, /*#__PURE__*/React$1.createElement(TooltipTitle, 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)}`));
31695
31714
  };
31696
31715
  return /*#__PURE__*/React$1.createElement("div", {
@@ -31715,7 +31734,7 @@ function SingleChart({
31715
31734
  dataKey: "index",
31716
31735
  tick: /*#__PURE__*/React$1.createElement(CustomizedTick, null),
31717
31736
  interval: 0,
31718
- height: 60,
31737
+ height: 80,
31719
31738
  padding: {
31720
31739
  left: 20,
31721
31740
  right: 20
@@ -31986,13 +32005,6 @@ SegmentedButton.defaultProps = {
31986
32005
  function InnerBarChart({
31987
32006
  brushInnerBarData
31988
32007
  }) {
31989
- const processedData = brushInnerBarData.map(item => {
31990
- const parts = item.label.replace("Vendor Selling Event:", "").trim();
31991
- return {
31992
- ...item,
31993
- shortLabel: parts
31994
- };
31995
- });
31996
32008
  const BarWithInner = props => {
31997
32009
  const {
31998
32010
  x,
@@ -32055,7 +32067,23 @@ function InnerBarChart({
32055
32067
  y,
32056
32068
  payload
32057
32069
  } = props;
32058
- const labelText = payload.value.replace("Vendor Selling Event:", "").trim();
32070
+ const label = payload.value;
32071
+
32072
+ // Split the label into chunks of words
32073
+ const words = label.split(' ');
32074
+ const chunks = [];
32075
+ let currentChunk = '';
32076
+ words.forEach(word => {
32077
+ if (currentChunk.length + word.length > 15) {
32078
+ chunks.push(currentChunk.trim());
32079
+ currentChunk = word;
32080
+ } else {
32081
+ currentChunk += ' ' + word;
32082
+ }
32083
+ });
32084
+ if (currentChunk) {
32085
+ chunks.push(currentChunk.trim());
32086
+ }
32059
32087
  return /*#__PURE__*/React$1.createElement("g", {
32060
32088
  transform: `translate(${x},${y})`
32061
32089
  }, /*#__PURE__*/React$1.createElement("text", {
@@ -32066,37 +32094,30 @@ function InnerBarChart({
32066
32094
  fill: "#212121",
32067
32095
  fontSize: 10,
32068
32096
  fontFamily: "Poppins"
32069
- }, /*#__PURE__*/React$1.createElement("tspan", {
32070
- x: 0,
32071
- dy: "0.71em"
32072
- }, "Vendor"), /*#__PURE__*/React$1.createElement("tspan", {
32097
+ }, chunks.map((chunk, i) => /*#__PURE__*/React$1.createElement("tspan", {
32098
+ key: i,
32073
32099
  x: 0,
32074
- dy: "1.2em"
32075
- }, "Selling"), /*#__PURE__*/React$1.createElement("tspan", {
32076
- x: 0,
32077
- dy: "1.2em"
32078
- }, labelText)));
32100
+ dy: i === 0 ? "0.71em" : "1.2em"
32101
+ }, chunk))));
32079
32102
  };
32080
- return /*#__PURE__*/React$1.createElement("div", {
32081
- className: "w-full"
32082
- }, /*#__PURE__*/React$1.createElement(ResponsiveContainer, {
32103
+ return /*#__PURE__*/React$1.createElement(ResponsiveContainer, {
32083
32104
  width: "100%",
32084
- height: 450
32105
+ height: "100%"
32085
32106
  }, /*#__PURE__*/React$1.createElement(BarChart$1, {
32086
- data: processedData,
32107
+ data: brushInnerBarData,
32087
32108
  margin: {
32088
32109
  top: 30,
32089
32110
  right: 30,
32090
32111
  left: 20,
32091
- bottom: 60
32112
+ bottom: 80
32092
32113
  }
32093
32114
  }, /*#__PURE__*/React$1.createElement(CartesianGrid, {
32094
32115
  strokeDasharray: "3 3",
32095
32116
  vertical: false
32096
32117
  }), /*#__PURE__*/React$1.createElement(XAxis, {
32097
- dataKey: "shortLabel",
32118
+ dataKey: "label",
32098
32119
  tick: /*#__PURE__*/React$1.createElement(CustomizedTick, null),
32099
- height: 70,
32120
+ height: 80,
32100
32121
  interval: 0
32101
32122
  }), /*#__PURE__*/React$1.createElement(YAxis, {
32102
32123
  type: "number",
@@ -32104,17 +32125,16 @@ function InnerBarChart({
32104
32125
  hide: true
32105
32126
  }), /*#__PURE__*/React$1.createElement(Tooltip$2, {
32106
32127
  content: /*#__PURE__*/React$1.createElement(CustomTooltip, null)
32107
- }), /*#__PURE__*/React$1.createElement(Brush, {
32108
- height: 30,
32109
- travellerWidth: 10,
32110
- startIndex: 0,
32111
- endIndex: Math.min(6, processedData.length - 1),
32112
- y: 380
32113
32128
  }), /*#__PURE__*/React$1.createElement(Bar, {
32114
32129
  dataKey: "total",
32115
32130
  shape: /*#__PURE__*/React$1.createElement(BarWithInner, null),
32116
32131
  barSize: 36
32117
- }))));
32132
+ }), /*#__PURE__*/React$1.createElement(Brush, {
32133
+ height: 30,
32134
+ travellerWidth: 10,
32135
+ startIndex: 0,
32136
+ endIndex: Math.min(6, brushInnerBarData.length - 1)
32137
+ })));
32118
32138
  }
32119
32139
 
32120
32140
  const BrushChart = props => {
@@ -32122,7 +32142,8 @@ const BrushChart = props => {
32122
32142
  width,
32123
32143
  height,
32124
32144
  brushInnerBarData,
32125
- barData,
32145
+ brushBarIncData,
32146
+ brushBarBasketData,
32126
32147
  brushAreaBarData,
32127
32148
  title
32128
32149
  } = props;
@@ -32147,9 +32168,9 @@ const BrushChart = props => {
32147
32168
  }), selectedOption === "INC Sales & ROI" && /*#__PURE__*/React$1.createElement(SeparatedLineBarChart, {
32148
32169
  brushAreaBarData: brushAreaBarData
32149
32170
  }), selectedOption === "INC Units" && /*#__PURE__*/React$1.createElement(SingleChart, {
32150
- barData: barData
32171
+ barData: brushBarIncData
32151
32172
  }), selectedOption === "Basket Lift" && /*#__PURE__*/React$1.createElement(SingleChart, {
32152
- barData: barData
32173
+ barData: brushBarBasketData
32153
32174
  }));
32154
32175
  };
32155
32176