sag_components 2.0.0-beta54 → 2.0.0-beta57

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
@@ -9720,26 +9720,34 @@ const OptionsContainer$4 = styled.div`
9720
9720
  padding-top: 8px;
9721
9721
  `;
9722
9722
 
9723
- const ChervronRightIcon = () => /*#__PURE__*/React$1.createElement("svg", {
9724
- width: "8",
9725
- height: "13",
9723
+ const ChervronRightIcon = ({
9724
+ width = "8",
9725
+ height = "13",
9726
+ fill = "#777575"
9727
+ }) => /*#__PURE__*/React$1.createElement("svg", {
9728
+ width: width,
9729
+ height: height,
9726
9730
  viewBox: "0 0 8 13",
9727
9731
  fill: "none",
9728
9732
  xmlns: "http://www.w3.org/2000/svg"
9729
9733
  }, /*#__PURE__*/React$1.createElement("path", {
9730
9734
  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",
9731
- fill: "#777575"
9735
+ fill: fill
9732
9736
  }));
9733
9737
 
9734
- const ChervronLeftIcon = () => /*#__PURE__*/React$1.createElement("svg", {
9735
- width: "7",
9736
- height: "13",
9738
+ const ChervronLeftIcon = ({
9739
+ width = 7,
9740
+ height = 13,
9741
+ fill = "#777575"
9742
+ }) => /*#__PURE__*/React$1.createElement("svg", {
9743
+ width: width,
9744
+ height: height,
9737
9745
  viewBox: "0 0 7 13",
9738
9746
  fill: "none",
9739
9747
  xmlns: "http://www.w3.org/2000/svg"
9740
9748
  }, /*#__PURE__*/React$1.createElement("path", {
9741
9749
  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",
9742
- fill: "#777575"
9750
+ fill: fill
9743
9751
  }));
9744
9752
 
9745
9753
  /* eslint-disable react/prop-types */
@@ -10330,7 +10338,15 @@ const DateCell$1 = styled.div`
10330
10338
  color: #ccc;
10331
10339
  }
10332
10340
  `;
10333
- const years$1 = [2022, 2023, 2024];
10341
+ const generateYearsArray$1 = (startYear, endDate) => {
10342
+ const years = [];
10343
+ const endYear = endDate.getFullYear();
10344
+ for (let year = startYear; year <= endYear; year++) {
10345
+ years.push(`${year}`);
10346
+ }
10347
+ return years;
10348
+ };
10349
+ const years$1 = generateYearsArray$1(2022, new Date());
10334
10350
  const QuarterPopupPicker = ({
10335
10351
  isOpen,
10336
10352
  onChangeDate,
@@ -10759,7 +10775,15 @@ const DateCell = styled.div`
10759
10775
  color: #ccc;
10760
10776
  }
10761
10777
  `;
10762
- const years = [2022, 2023, 2024];
10778
+ const generateYearsArray = (startYear, endDate) => {
10779
+ const years = [];
10780
+ const endYear = endDate.getFullYear();
10781
+ for (let year = startYear; year <= endYear; year++) {
10782
+ years.push(`${year}`);
10783
+ }
10784
+ return years;
10785
+ };
10786
+ const years = generateYearsArray(2022, new Date());
10763
10787
  const MonthPopupPicker = ({
10764
10788
  isOpen,
10765
10789
  onChangeDate,
@@ -11223,7 +11247,7 @@ const FilterPanel = props => {
11223
11247
  inputSubType: 'year'
11224
11248
  } : ''),
11225
11249
  ...(newPeriodPickerSelectedValue[0]?.value === 'ytd' ? {
11226
- inputSubType: 'daterange'
11250
+ inputSubType: 'ytd'
11227
11251
  } : ''),
11228
11252
  ...(newPeriodPickerSelectedValue[0]?.value === 'month' ? {
11229
11253
  inputSubType: 'month'
@@ -11246,7 +11270,7 @@ const FilterPanel = props => {
11246
11270
  inputSubType: 'year'
11247
11271
  } : ''),
11248
11272
  ...(newPeriodPickerSelectedValue[0]?.value === 'ytd' ? {
11249
- inputSubType: 'daterange'
11273
+ inputSubType: 'ytd'
11250
11274
  } : ''),
11251
11275
  ...(newPeriodPickerSelectedValue[0]?.value === 'month' ? {
11252
11276
  inputSubType: 'month'
@@ -11436,7 +11460,7 @@ const FilterPanel = props => {
11436
11460
  const selectedValue = eventRangePicker && typeof eventRangePicker === 'string' ? `${eventRangePicker}` : undefined;
11437
11461
  const newFieldsDataState = FieldsDataState?.map(itemField => itemField.name === item.name ? {
11438
11462
  ...itemField,
11439
- inputSubType: 'daterange',
11463
+ inputSubType: 'ytd',
11440
11464
  selectedValue: selectedValue ? `${selectedValue}` : undefined
11441
11465
  } : itemField);
11442
11466
  setFieldsDataState(newFieldsDataState);
@@ -11445,14 +11469,14 @@ const FilterPanel = props => {
11445
11469
  changedItem: {
11446
11470
  name: item.name,
11447
11471
  inputType: item.inputType,
11448
- inputSubType: 'daterange',
11472
+ inputSubType: 'ytd',
11449
11473
  selectedValue: selectedValue ? `${selectedValue}` : undefined
11450
11474
  }
11451
11475
  });
11452
11476
  },
11453
11477
  required: item.required,
11454
11478
  placeholder: "Select Date Range ...",
11455
- selectedValue: item.selectedValue || getYTDString(),
11479
+ selectedValue: getYTDString(),
11456
11480
  disabled: true,
11457
11481
  width: "100%",
11458
11482
  height: "55px"
@@ -24104,21 +24128,22 @@ const DeleteIcon = styled.div`
24104
24128
  position: absolute;
24105
24129
  `;
24106
24130
 
24107
- const QuickFilterDropdownSingle = ({
24108
- label,
24109
- hoverColor,
24110
- options,
24111
- selectedValue,
24112
- placeHolder,
24113
- onChange,
24114
- disabled,
24115
- width,
24116
- error,
24117
- errorMessage,
24118
- xIconShow,
24119
- labelColor,
24120
- showLabelOnTop
24121
- }) => {
24131
+ const QuickFilterDropdownSingle = _ref => {
24132
+ let {
24133
+ label,
24134
+ hoverColor,
24135
+ options,
24136
+ selectedValue,
24137
+ placeHolder,
24138
+ onChange,
24139
+ disabled,
24140
+ width,
24141
+ error,
24142
+ errorMessage,
24143
+ xIconShow,
24144
+ labelColor,
24145
+ showLabelOnTop
24146
+ } = _ref;
24122
24147
  const [isFocused, setIsFocused] = useState(false);
24123
24148
  const [showOptions, setShowOptions] = useState(false);
24124
24149
  const [inputValue, setInputValue] = useState("");
@@ -24516,23 +24541,24 @@ const IconContainer$2 = styled.div`
24516
24541
  cursor: pointer;
24517
24542
  `;
24518
24543
 
24519
- const QuickFilterDropdownMultiSelection = ({
24520
- label,
24521
- labelEmptyValue,
24522
- options,
24523
- selectedValue,
24524
- placeHolder,
24525
- onChange,
24526
- required,
24527
- disabled,
24528
- width,
24529
- error,
24530
- errorMessage,
24531
- labelColor,
24532
- xIconShow,
24533
- checkBoxColor,
24534
- showLabelOnTop
24535
- }) => {
24544
+ const QuickFilterDropdownMultiSelection = _ref => {
24545
+ let {
24546
+ label,
24547
+ labelEmptyValue,
24548
+ options,
24549
+ selectedValue,
24550
+ placeHolder,
24551
+ onChange,
24552
+ required,
24553
+ disabled,
24554
+ width,
24555
+ error,
24556
+ errorMessage,
24557
+ labelColor,
24558
+ xIconShow,
24559
+ checkBoxColor,
24560
+ showLabelOnTop
24561
+ } = _ref;
24536
24562
  const [isFocused, setIsFocused] = useState(false);
24537
24563
  const [showOptions, setShowOptions] = useState(false);
24538
24564
  const [inputValue, setInputValue] = useState('');
@@ -25146,8 +25172,8 @@ function styleInject(css, ref) {
25146
25172
  }
25147
25173
  }
25148
25174
 
25149
- var css_248z$1 = "@keyframes react-loading-skeleton {\n 100% {\n transform: translateX(100%);\n }\n}\n\n.react-loading-skeleton {\n --base-color: #ebebeb;\n --highlight-color: #f5f5f5;\n --animation-duration: 1.5s;\n --animation-direction: normal;\n --pseudo-element-display: block; /* Enable animation */\n\n background-color: var(--base-color);\n\n width: 100%;\n border-radius: 0.25rem;\n display: inline-flex;\n line-height: 1;\n\n position: relative;\n user-select: none;\n overflow: hidden;\n}\n\n.react-loading-skeleton::after {\n content: ' ';\n display: var(--pseudo-element-display);\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n height: 100%;\n background-repeat: no-repeat;\n background-image: var(\n --custom-highlight-background,\n linear-gradient(\n 90deg,\n var(--base-color) 0%,\n var(--highlight-color) 50%,\n var(--base-color) 100%\n )\n );\n transform: translateX(-100%);\n\n animation-name: react-loading-skeleton;\n animation-direction: var(--animation-direction);\n animation-duration: var(--animation-duration);\n animation-timing-function: ease-in-out;\n animation-iteration-count: infinite;\n}\n\n@media (prefers-reduced-motion) {\n .react-loading-skeleton {\n --pseudo-element-display: none; /* Disable animation */\n }\n}\n";
25150
- styleInject(css_248z$1);
25175
+ var css_248z = "@keyframes react-loading-skeleton {\n 100% {\n transform: translateX(100%);\n }\n}\n\n.react-loading-skeleton {\n --base-color: #ebebeb;\n --highlight-color: #f5f5f5;\n --animation-duration: 1.5s;\n --animation-direction: normal;\n --pseudo-element-display: block; /* Enable animation */\n\n background-color: var(--base-color);\n\n width: 100%;\n border-radius: 0.25rem;\n display: inline-flex;\n line-height: 1;\n\n position: relative;\n user-select: none;\n overflow: hidden;\n}\n\n.react-loading-skeleton::after {\n content: ' ';\n display: var(--pseudo-element-display);\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n height: 100%;\n background-repeat: no-repeat;\n background-image: var(\n --custom-highlight-background,\n linear-gradient(\n 90deg,\n var(--base-color) 0%,\n var(--highlight-color) 50%,\n var(--base-color) 100%\n )\n );\n transform: translateX(-100%);\n\n animation-name: react-loading-skeleton;\n animation-direction: var(--animation-direction);\n animation-duration: var(--animation-duration);\n animation-timing-function: ease-in-out;\n animation-iteration-count: infinite;\n}\n\n@media (prefers-reduced-motion) {\n .react-loading-skeleton {\n --pseudo-element-display: none; /* Disable animation */\n }\n}\n";
25176
+ styleInject(css_248z);
25151
25177
 
25152
25178
  const OneColumnContainer = props => {
25153
25179
  const {
@@ -31371,83 +31397,102 @@ const BatteryChart = props => {
31371
31397
  }))))))), starText !== "" && /*#__PURE__*/React$1.createElement(StarText, null, starText));
31372
31398
  };
31373
31399
 
31374
- const originalData$1 = [{
31375
- label: "Vendor Selling Event: Week 28",
31376
- inc_unit: 20000,
31377
- inc_roi: 1.2
31378
- }, {
31379
- label: "Vendor Selling Event: Week 29",
31380
- inc_unit: 10000,
31381
- inc_roi: 1.2
31382
- }, {
31383
- label: "Vendor Selling Event: Week 30",
31384
- inc_unit: 8000,
31385
- inc_roi: 0.8
31386
- }, {
31387
- label: "Vendor Selling Event: Week 33",
31388
- inc_unit: 12000,
31389
- inc_roi: 1.1
31390
- }, {
31391
- label: "Vendor Selling Event: Week 36",
31392
- inc_unit: 8000,
31393
- inc_roi: 1.2
31394
- }, {
31395
- label: "Vendor Selling Event: Week 34",
31396
- inc_unit: 8000,
31397
- inc_roi: 0.7
31398
- }, {
31399
- label: "Vendor Selling Event: Week 35",
31400
- inc_unit: 8000,
31401
- inc_roi: 0.8
31402
- }, {
31403
- label: "Vendor Selling Event: Week 38",
31404
- inc_unit: 9000,
31405
- inc_roi: 1.1
31406
- }];
31407
- const dataWithIndex$1 = originalData$1.map((item, index) => ({
31408
- ...item,
31409
- index,
31410
- shortLabel: item.label.replace("Vendor Selling Event: ", "Wk ")
31411
- }));
31412
- const CustomizedTick$1 = ({
31413
- x,
31414
- y,
31415
- payload
31400
+ // const originalData = [
31401
+ // { label: "Vendor Selling Event: Week 34", inc_sales: 20000, inc_roi: 1.2 },
31402
+ // { label: "Vendor Selling Event: Week 36", inc_sales: 10000, inc_roi: 1.2 },
31403
+ // { label: "Vendor Selling Event: Week 38", inc_sales: 8000, inc_roi: 0.8 },
31404
+ // { label: "Vendor Selling Event: Week 33", inc_sales: 12000, inc_roi: 1.1 },
31405
+ // { label: "Vendor Selling Event: Week 29", inc_sales: 8000, inc_roi: 1.2 },
31406
+ // { label: "Vendor Selling Event: Week 28", inc_sales: 8000, inc_roi: 0.7 },
31407
+ // { label: "Vendor Selling Event: Week 35", inc_sales: 8000, inc_roi: 0.8 },
31408
+ // { label: "Vendor Selling Event: Week 30", inc_sales: 9000, inc_roi: 1.1 },
31409
+ // ];
31410
+
31411
+ const SeparatedLineBarChart = ({
31412
+ barlineData = []
31416
31413
  }) => {
31417
- const label = dataWithIndex$1[payload.value]?.label ?? "";
31418
- const parts = label.replace("Vendor Selling Event: ", "").split(" ");
31419
- return /*#__PURE__*/React$1.createElement("g", {
31420
- transform: `translate(${x},${y})`
31421
- }, /*#__PURE__*/React$1.createElement("text", {
31422
- x: 0,
31423
- y: 0,
31424
- dy: 16,
31425
- textAnchor: "middle",
31426
- fill: "#212121",
31427
- fontSize: 11,
31428
- fontWeight: "400",
31429
- fontFamily: "Poppins"
31430
- }, /*#__PURE__*/React$1.createElement("tspan", {
31431
- x: 0,
31432
- dy: 8
31433
- }, "Vendor Selling"), /*#__PURE__*/React$1.createElement("tspan", {
31434
- x: 0,
31435
- dy: 18
31436
- }, "Event: ", parts.join(" "))));
31437
- };
31438
-
31439
- // Common chart configuration
31440
- const chartMargins = {
31441
- top: 15,
31442
- right: 40,
31443
- left: 20,
31444
- bottom: 40
31445
- };
31446
- const SeparatedLineBarChart = () => {
31414
+ // Sort the data by week number extracted from the label
31415
+ const sortedData = barlineData?.sort((a, b) => {
31416
+ const weekA = parseInt(a.label.match(/Week (\d+)/)[1], 10);
31417
+ const weekB = parseInt(b.label.match(/Week (\d+)/)[1], 10);
31418
+ return weekA - weekB;
31419
+ });
31420
+ const dataWithIndex = sortedData.map((item, index) => ({
31421
+ ...item,
31422
+ index,
31423
+ shortLabel: item.label.replace("Vendor Selling Event: ", "Wk ")
31424
+ }));
31425
+ const CustomizedTick = ({
31426
+ x,
31427
+ y,
31428
+ payload,
31429
+ viewableIndices
31430
+ }) => {
31431
+ const label = dataWithIndex[payload.value]?.label ?? "";
31432
+ const parts = label.replace("Vendor Selling Event: ", "").split(" ");
31433
+ if (!viewableIndices.includes(payload.value)) {
31434
+ return null;
31435
+ }
31436
+ return /*#__PURE__*/React$1.createElement("g", {
31437
+ transform: `translate(${x},${y})`
31438
+ }, /*#__PURE__*/React$1.createElement("text", {
31439
+ x: 0,
31440
+ y: 0,
31441
+ dy: 16,
31442
+ textAnchor: "middle",
31443
+ fill: "#212121",
31444
+ fontSize: 11,
31445
+ fontWeight: "400",
31446
+ fontFamily: "Poppins"
31447
+ }, /*#__PURE__*/React$1.createElement("tspan", {
31448
+ x: 0,
31449
+ dy: 8
31450
+ }, "Vendor Selling"), /*#__PURE__*/React$1.createElement("tspan", {
31451
+ x: 0,
31452
+ dy: 18
31453
+ }, "Event: ", parts.join(" "))));
31454
+ };
31455
+ const CustomLabelListFilter = props => {
31456
+ const {
31457
+ viewableIndices,
31458
+ dataKey,
31459
+ position,
31460
+ formatter,
31461
+ fill,
31462
+ fontSize,
31463
+ fontWeight,
31464
+ fontFamily
31465
+ } = props;
31466
+ return /*#__PURE__*/React$1.createElement(LabelList, {
31467
+ dataKey: dataKey,
31468
+ position: position,
31469
+ formatter: (value, name, props) => {
31470
+ if (!viewableIndices.includes(props.index)) {
31471
+ return "";
31472
+ }
31473
+ return formatter ? formatter(value) : value;
31474
+ },
31475
+ fill: fill || "#212121",
31476
+ fontSize: fontSize || 12,
31477
+ fontWeight: fontWeight || "400",
31478
+ fontFamily: fontFamily || "Poppins"
31479
+ });
31480
+ };
31481
+ const chartMargins = {
31482
+ top: 15,
31483
+ right: 40,
31484
+ left: 20,
31485
+ bottom: 40
31486
+ };
31447
31487
  const [viewWindow, setViewWindow] = useState({
31448
31488
  startIndex: 0,
31449
- endIndex: dataWithIndex$1.length - 1
31489
+ endIndex: dataWithIndex.length - 1
31450
31490
  });
31491
+ const viewableIndices = [];
31492
+ for (let i = viewWindow.startIndex; i <= viewWindow.endIndex; i++) {
31493
+ viewableIndices.push(i);
31494
+ }
31495
+ dataWithIndex.filter(item => viewableIndices.includes(item.index));
31451
31496
  return /*#__PURE__*/React$1.createElement("div", {
31452
31497
  style: {
31453
31498
  width: "100%",
@@ -31461,8 +31506,7 @@ const SeparatedLineBarChart = () => {
31461
31506
  width: "100%",
31462
31507
  height: "100%"
31463
31508
  }, /*#__PURE__*/React$1.createElement(LineChart, {
31464
- data: dataWithIndex$1 // Use full dataset for alignment
31465
- ,
31509
+ data: dataWithIndex,
31466
31510
  margin: chartMargins
31467
31511
  }, /*#__PURE__*/React$1.createElement(CartesianGrid, {
31468
31512
  strokeDasharray: "3 3",
@@ -31490,10 +31534,11 @@ const SeparatedLineBarChart = () => {
31490
31534
  },
31491
31535
  activeDot: false,
31492
31536
  name: "INC Sales ROI"
31493
- }, /*#__PURE__*/React$1.createElement(LabelList, {
31537
+ }, /*#__PURE__*/React$1.createElement(CustomLabelListFilter, {
31494
31538
  dataKey: "inc_roi",
31495
31539
  position: "top",
31496
- formatter: value => value.toFixed(1)
31540
+ formatter: value => value.toFixed(1),
31541
+ viewableIndices: viewableIndices
31497
31542
  }))))), /*#__PURE__*/React$1.createElement("div", {
31498
31543
  style: {
31499
31544
  height: "60%"
@@ -31502,7 +31547,7 @@ const SeparatedLineBarChart = () => {
31502
31547
  width: "100%",
31503
31548
  height: "100%"
31504
31549
  }, /*#__PURE__*/React$1.createElement(ComposedChart, {
31505
- data: dataWithIndex$1,
31550
+ data: dataWithIndex,
31506
31551
  margin: chartMargins
31507
31552
  }, /*#__PURE__*/React$1.createElement(CartesianGrid, {
31508
31553
  strokeDasharray: "3 3",
@@ -31515,30 +31560,28 @@ const SeparatedLineBarChart = () => {
31515
31560
  left: 20,
31516
31561
  right: 20
31517
31562
  },
31518
- tick: /*#__PURE__*/React$1.createElement(CustomizedTick$1, null),
31519
- interval: 0 // Force display all ticks
31520
- ,
31563
+ tick: props => /*#__PURE__*/React$1.createElement(CustomizedTick, _extends({}, props, {
31564
+ viewableIndices: viewableIndices
31565
+ })),
31566
+ interval: 0,
31521
31567
  height: 60,
31522
31568
  tickLine: false,
31523
- ticks: dataWithIndex$1.map(item => item.index)
31569
+ ticks: dataWithIndex.map(item => item.index)
31524
31570
  }), /*#__PURE__*/React$1.createElement(YAxis, {
31525
- tickFormatter: v => `$${v / 1000}k`,
31571
+ tickFormatter: v => `${v / 1000}k`,
31526
31572
  hide: true
31527
31573
  }), /*#__PURE__*/React$1.createElement(Tooltip$2, null), /*#__PURE__*/React$1.createElement(Bar, {
31528
- dataKey: "inc_unit",
31574
+ dataKey: "inc_sales",
31529
31575
  fill: "#CCDCDD",
31530
31576
  gap: "4px",
31531
31577
  borderRadius: [4, 4, 0, 8],
31532
31578
  barSize: 40,
31533
31579
  name: "INC Sales"
31534
- }, /*#__PURE__*/React$1.createElement(LabelList, {
31535
- dataKey: "inc_unit",
31580
+ }, /*#__PURE__*/React$1.createElement(CustomLabelListFilter, {
31581
+ dataKey: "inc_sales",
31536
31582
  position: "top",
31537
- formatter: value => `$${value / 1000}k`,
31538
- fill: "#212121",
31539
- fontSize: 12,
31540
- fontWeight: "400",
31541
- fontFamily: "Poppins"
31583
+ formatter: value => `${value / 1000}k`,
31584
+ viewableIndices: viewableIndices
31542
31585
  })), /*#__PURE__*/React$1.createElement(Brush, {
31543
31586
  dataKey: "index",
31544
31587
  height: 30,
@@ -31548,7 +31591,7 @@ const SeparatedLineBarChart = () => {
31548
31591
  onChange: e => {
31549
31592
  setViewWindow({
31550
31593
  startIndex: e.startIndex ?? 0,
31551
- endIndex: e.endIndex ?? dataWithIndex$1.length - 1
31594
+ endIndex: e.endIndex ?? dataWithIndex.length - 1
31552
31595
  });
31553
31596
  },
31554
31597
  travellerWidth: 12
@@ -31569,68 +31612,42 @@ const SeparatedLineBarChart = () => {
31569
31612
  })))));
31570
31613
  };
31571
31614
 
31572
- const originalData = [{
31573
- label: "Vendor Selling Event: Week 28",
31574
- inc_unit: 20000
31575
- }, {
31576
- label: "Vendor Selling Event: Week 29",
31577
- inc_unit: 10000
31578
- }, {
31579
- label: "Vendor Selling Event: Week 30",
31580
- inc_unit: 8000
31581
- }, {
31582
- label: "Vendor Selling Event: Week 33",
31583
- inc_unit: 12000
31584
- }, {
31585
- label: "Vendor Selling Event: Week 36",
31586
- inc_unit: 8000
31587
- }, {
31588
- label: "Vendor Selling Event: Week 34",
31589
- inc_unit: 8000
31590
- }, {
31591
- label: "Vendor Selling Event: Week 35",
31592
- inc_unit: 8000
31593
- }, {
31594
- label: "Vendor Selling Event: Week 38",
31595
- inc_unit: 9000
31596
- }];
31597
-
31598
- // Adding index and shortLabel to original data
31599
- const dataWithIndex = originalData.map((item, index) => ({
31600
- ...item,
31601
- index,
31602
- shortLabel: item.label.replace("Vendor Selling Event: ", "Wk ")
31603
- }));
31604
- const CustomizedTick = ({
31605
- x,
31606
- y,
31607
- payload
31608
- }) => {
31609
- const label = dataWithIndex[payload.value]?.label ?? "";
31610
- const parts = label.replace("Vendor Selling Event: ", "").split(" ");
31611
- return /*#__PURE__*/React$1.createElement("g", {
31612
- transform: `translate(${x},${y})`
31613
- }, /*#__PURE__*/React$1.createElement("text", {
31614
- x: 0,
31615
- y: 0,
31616
- dy: 16,
31617
- textAnchor: "middle",
31618
- fill: "#212121",
31619
- fontSize: 11,
31620
- fontWeight: "400",
31621
- fontFamily: "Poppins"
31622
- }, /*#__PURE__*/React$1.createElement("tspan", {
31623
- x: 0,
31624
- dy: 8
31625
- }, "Vendor Selling"), /*#__PURE__*/React$1.createElement("tspan", {
31626
- x: 0,
31627
- dy: 18
31628
- }, "Event: ", parts.join(" "))));
31629
- };
31630
- const SingleChart = () => {
31615
+ function SingleChart({
31616
+ lineChartData
31617
+ }) {
31618
+ const dataWithIndex = lineChartData?.map((item, index) => ({
31619
+ ...item,
31620
+ index,
31621
+ shortLabel: item.label.replace("Vendor Selling Event: ", "Wk ")
31622
+ }));
31623
+ const CustomizedTick = ({
31624
+ x,
31625
+ y,
31626
+ payload
31627
+ }) => {
31628
+ const label = dataWithIndex[payload.value]?.label ?? "";
31629
+ const parts = label.replace("Vendor Selling Event: ", "").split(" ");
31630
+ return /*#__PURE__*/React$1.createElement("g", {
31631
+ transform: `translate(${x},${y})`
31632
+ }, /*#__PURE__*/React$1.createElement("text", {
31633
+ x: 0,
31634
+ y: 0,
31635
+ dy: 16,
31636
+ textAnchor: "middle",
31637
+ fill: "#212121",
31638
+ fontSize: 11,
31639
+ fontWeight: "400",
31640
+ fontFamily: "Poppins"
31641
+ }, /*#__PURE__*/React$1.createElement("tspan", {
31642
+ x: 0,
31643
+ dy: 8
31644
+ }, "Vendor Selling"), /*#__PURE__*/React$1.createElement("tspan", {
31645
+ x: 0,
31646
+ dy: 18
31647
+ }, "Event: ", parts.join(" "))));
31648
+ };
31631
31649
  const [startIndex, setStartIndex] = useState(0);
31632
- const [endIndex, setEndIndex] = useState(dataWithIndex.length - 1);
31633
- dataWithIndex.slice(startIndex, endIndex + 1);
31650
+ const [endIndex, setEndIndex] = useState(dataWithIndex?.length - 1);
31634
31651
  return /*#__PURE__*/React$1.createElement("div", {
31635
31652
  style: {
31636
31653
  width: "100%",
@@ -31668,14 +31685,14 @@ const SingleChart = () => {
31668
31685
  tickFormatter: v => `$${v / 1000}k`,
31669
31686
  hide: true
31670
31687
  }), /*#__PURE__*/React$1.createElement(Tooltip$2, null), /*#__PURE__*/React$1.createElement(Bar, {
31671
- dataKey: "inc_unit",
31688
+ dataKey: "value",
31672
31689
  fill: "#CCDCDD",
31673
31690
  gap: "4px",
31674
31691
  borderRadius: [4, 4, 0, 8],
31675
31692
  barSize: 40,
31676
31693
  name: "INC Sales"
31677
31694
  }, /*#__PURE__*/React$1.createElement(LabelList, {
31678
- dataKey: "inc_unit",
31695
+ dataKey: "value",
31679
31696
  position: "top",
31680
31697
  formatter: value => `$${value / 1000}k`,
31681
31698
  fill: "#212121",
@@ -31690,7 +31707,7 @@ const SingleChart = () => {
31690
31707
  endIndex: endIndex,
31691
31708
  onChange: e => {
31692
31709
  setStartIndex(e.startIndex ?? 0);
31693
- setEndIndex(e.endIndex ?? dataWithIndex.length - 1);
31710
+ setEndIndex(e.endIndex ?? dataWithIndex?.length - 1);
31694
31711
  },
31695
31712
  travellerWidth: 12
31696
31713
  })), /*#__PURE__*/React$1.createElement(PerformanceAnalyticsLegend, {
@@ -31700,7 +31717,7 @@ const SingleChart = () => {
31700
31717
  title: "INC Units"
31701
31718
  }]
31702
31719
  }))));
31703
- };
31720
+ }
31704
31721
 
31705
31722
  styled.div`
31706
31723
  display: flex;
@@ -31832,15 +31849,17 @@ const SegmentedButton = props => {
31832
31849
  }, [defaultIndex]);
31833
31850
  useEffect(() => {
31834
31851
  const activeSegmentRef = optionsRef[activeIndex].ref;
31835
- const {
31836
- offsetWidth,
31837
- offsetLeft
31838
- } = activeSegmentRef.current;
31839
- const {
31840
- style
31841
- } = controlRef.current;
31842
- style.setProperty('--highlight-width', `${offsetWidth}px`);
31843
- style.setProperty('--highlight-x-pos', `${offsetLeft}px`);
31852
+ setTimeout(() => {
31853
+ const {
31854
+ offsetWidth,
31855
+ offsetLeft
31856
+ } = activeSegmentRef.current;
31857
+ const {
31858
+ style
31859
+ } = controlRef.current;
31860
+ style.setProperty("--highlight-width", `${offsetWidth}px`);
31861
+ style.setProperty("--highlight-x-pos", `${offsetLeft}px`);
31862
+ }, 0);
31844
31863
  }, [activeIndex, controlRef, optionsRef]);
31845
31864
  const onInputChangeHandler = (value, index) => {
31846
31865
  setActiveIndex(index);
@@ -31863,14 +31882,14 @@ const SegmentedButton = props => {
31863
31882
  gap: gap,
31864
31883
  controlradius: controlradius,
31865
31884
  segmentwidth: segmentwidth,
31866
- className: `controls ${componentReady.current ? 'ready' : 'idle'}`
31885
+ className: `controls ${componentReady.current ? "ready" : "idle"}`
31867
31886
  }, optionsRef?.map((item, i) => /*#__PURE__*/React$1.createElement(Segment, {
31868
31887
  id: "Segment",
31869
31888
  key: item.id,
31870
31889
  selectedsegmentcolor: selectedsegmentcolor,
31871
31890
  controlradius: controlradius,
31872
31891
  segmentwidth: segmentwidth,
31873
- className: `${activeIndex === i ? 'active' : 'inactive'}`,
31892
+ className: `${activeIndex === i ? "active" : "inactive"}`,
31874
31893
  ref: item.ref
31875
31894
  }, /*#__PURE__*/React$1.createElement(ControlsInput, {
31876
31895
  type: "radio",
@@ -31884,7 +31903,7 @@ const SegmentedButton = props => {
31884
31903
  selectedtextcolor: selectedtextcolor,
31885
31904
  unselectedtextcolor: unselectedtextcolor,
31886
31905
  segmentheight: height / 5,
31887
- className: `${activeIndex === i ? 'active' : 'inactive'} `,
31906
+ className: `${activeIndex === i ? "active" : "inactive"} `,
31888
31907
  htmlFor: item.value
31889
31908
  }, item.value)))));
31890
31909
  };
@@ -31906,116 +31925,38 @@ SegmentedButton.propTypes = {
31906
31925
  onClick: PropTypes.func
31907
31926
  };
31908
31927
  SegmentedButton.defaultProps = {
31909
- name: '',
31928
+ name: "",
31910
31929
  options: [{
31911
- value: '4 w'
31930
+ value: "4 w"
31912
31931
  }, {
31913
- value: '8 w'
31932
+ value: "8 w"
31914
31933
  }, {
31915
- value: '13 w'
31934
+ value: "13 w"
31916
31935
  }],
31917
31936
  width: 120,
31918
31937
  height: 40,
31919
31938
  controlradius: 8,
31920
31939
  segmentradius: 8,
31921
- gap: '0px',
31940
+ gap: "0px",
31922
31941
  fontSize: 14,
31923
- selectedsegmentcolor: '#3a9df9',
31924
- selectedtextcolor: '#212121',
31925
- unselectedtextcolor: 'black',
31942
+ selectedsegmentcolor: "#3a9df9",
31943
+ selectedtextcolor: "#212121",
31944
+ unselectedtextcolor: "black",
31926
31945
  defaultIndex: 0,
31927
31946
  onClick: () => {}
31928
31947
  };
31929
31948
 
31930
- var css_248z = ".BarLine {\r\n font-family: sans-serif;\r\n text-align: center;\r\n }\r\n \r\n /* Make brush background darker */\r\n /* .recharts-brush .recharts-brush-slide {\r\n fill: #a52a2a !important;\r\n stroke: none;\r\n }\r\n \r\n /* Style draggable handles (travellers) */\r\n /* .recharts-brush-traveller {\r\n fill: limegreen !important; /* bright green like in the image */\r\n /* cursor: ew-resize;\r\n } */\r\n */\r\n \r\n /* Optional: center grip arrows (you can fake it with CSS) */\r\n /* .recharts-brush .recharts-brush-traveller > rect {\r\n rx: 2;\r\n ry: 2;\r\n width: 6;\r\n fill: #a52a2a !important; /* dark gray */\r\n /* } */ */\r\n */\r\n \r\n /* Remove tick labels if needed */\r\n .recharts-brush .recharts-layer text {\r\n display: none;\r\n }\r\n ";
31931
- styleInject(css_248z);
31932
-
31933
- function InnerBarChart() {
31934
- const data = [{
31935
- week: "Week 28",
31936
- total: 20000,
31937
- actual: 4000
31938
- }, {
31939
- week: "Week 29",
31940
- total: 10000,
31941
- actual: 8000
31942
- }, {
31943
- week: "Week 30",
31944
- total: 8000,
31945
- actual: 950
31946
- }, {
31947
- week: "Week 33",
31948
- total: 12000,
31949
- actual: 1000
31950
- }, {
31951
- week: "Week 36",
31952
- total: 16000,
31953
- actual: 13000
31954
- }, {
31955
- week: "Week 34",
31956
- total: 30000,
31957
- actual: 3000
31958
- }, {
31959
- week: "Week 35",
31960
- total: 8000,
31961
- actual: 950
31962
- }, {
31963
- week: "Week 37",
31964
- total: 9000,
31965
- actual: 3000
31966
- }];
31967
- const originalData = [{
31968
- label: "Vendor Selling Event: Week 28",
31969
- inc_unit: 20000,
31970
- inc_roi: 1.2
31971
- }, {
31972
- label: "Vendor Selling Event: Week 29",
31973
- inc_unit: 10000,
31974
- inc_roi: 1.2
31975
- }, {
31976
- label: "Vendor Selling Event: Week 30",
31977
- inc_unit: 8000,
31978
- inc_roi: 0.8
31979
- }, {
31980
- label: "Vendor Selling Event: Week 33",
31981
- inc_unit: 12000,
31982
- inc_roi: 1.1
31983
- }, {
31984
- label: "Vendor Selling Event: Week 36",
31985
- inc_unit: 8000,
31986
- inc_roi: 1.2
31987
- }, {
31988
- label: "Vendor Selling Event: Week 34",
31989
- inc_unit: 8000,
31990
- inc_roi: 0.7
31991
- }, {
31992
- label: "Vendor Selling Event: Week 35",
31993
- inc_unit: 8000,
31994
- inc_roi: 0.8
31995
- }, {
31996
- label: "Vendor Selling Event: Week 38",
31997
- inc_unit: 9000,
31998
- inc_roi: 1.1
31999
- }];
31949
+ function InnerBarChart({
31950
+ data = []
31951
+ }) {
31952
+ const processedData = data.map(item => {
31953
+ const parts = item.label.replace("Vendor Selling Event:", "").trim();
31954
+ return {
31955
+ ...item,
31956
+ shortLabel: parts
31957
+ };
31958
+ });
32000
31959
  const format = v => v >= 1000 ? `${v / 1000}K` : v;
32001
- const CustomBarLabel = ({
32002
- x,
32003
- y,
32004
- width,
32005
- payload
32006
- }) => {
32007
- if (!payload || typeof payload.total === "undefined") {
32008
- console.error("Invalid payload:", payload);
32009
- return null;
32010
- }
32011
- const centerX = x + width / 2;
32012
- return /*#__PURE__*/React$1.createElement("text", {
32013
- x: centerX,
32014
- y: Math.max(y - 8, 10),
32015
- textAnchor: "middle",
32016
- fill: "black"
32017
- }, format(payload.total));
32018
- };
32019
31960
  const BarWithInner = props => {
32020
31961
  const {
32021
31962
  x,
@@ -32070,27 +32011,16 @@ function InnerBarChart() {
32070
32011
  if (!active || !payload || !payload.length) return null;
32071
32012
  const data = payload[0].payload;
32072
32013
  return /*#__PURE__*/React$1.createElement("div", {
32073
- style: {
32074
- background: "white",
32075
- border: "1px solid #ccc",
32076
- padding: "10px",
32077
- borderRadius: "8px",
32078
- fontSize: "14px"
32079
- }
32080
- }, /*#__PURE__*/React$1.createElement("strong", null, label), /*#__PURE__*/React$1.createElement("div", null, "Actual: ", format(data.actual)), /*#__PURE__*/React$1.createElement("div", null, "Total: ", format(data.total)));
32014
+ className: "bg-white border border-gray-300 p-2 rounded-lg text-sm"
32015
+ }, /*#__PURE__*/React$1.createElement("strong", null, data.label), /*#__PURE__*/React$1.createElement("div", null, "Actual: ", format(data.actual)), /*#__PURE__*/React$1.createElement("div", null, "Total: ", format(data.total)));
32081
32016
  };
32082
- const dataWithIndex = originalData.map((item, index) => ({
32083
- ...item,
32084
- index,
32085
- shortLabel: item.label.replace("Vendor Selling Event: ", "Wk ")
32086
- }));
32087
- const CustomizedTick = ({
32088
- x,
32089
- y,
32090
- payload
32091
- }) => {
32092
- const label = dataWithIndex[payload.value]?.label ?? "";
32093
- const parts = label.replace("Vendor Selling Event: ", "").split(" ");
32017
+ const CustomizedTick = props => {
32018
+ const {
32019
+ x,
32020
+ y,
32021
+ payload
32022
+ } = props;
32023
+ const labelText = payload.value.replace("Vendor Selling Event:", "").trim();
32094
32024
  return /*#__PURE__*/React$1.createElement("g", {
32095
32025
  transform: `translate(${x},${y})`
32096
32026
  }, /*#__PURE__*/React$1.createElement("text", {
@@ -32099,54 +32029,75 @@ function InnerBarChart() {
32099
32029
  dy: 16,
32100
32030
  textAnchor: "middle",
32101
32031
  fill: "#212121",
32102
- fontSize: 11,
32103
- fontWeight: "400",
32032
+ fontSize: 10,
32104
32033
  fontFamily: "Poppins"
32105
32034
  }, /*#__PURE__*/React$1.createElement("tspan", {
32106
32035
  x: 0,
32107
- dy: 8
32108
- }, "Vendor Selling"), /*#__PURE__*/React$1.createElement("tspan", {
32036
+ dy: "0.71em"
32037
+ }, "Vendor"), /*#__PURE__*/React$1.createElement("tspan", {
32109
32038
  x: 0,
32110
- dy: 18
32111
- }, "Event: ", parts.join(" "))));
32039
+ dy: "1.2em"
32040
+ }, "Selling"), /*#__PURE__*/React$1.createElement("tspan", {
32041
+ x: 0,
32042
+ dy: "1.2em"
32043
+ }, labelText)));
32112
32044
  };
32113
- return /*#__PURE__*/React$1.createElement(ResponsiveContainer, {
32045
+ return /*#__PURE__*/React$1.createElement("div", {
32046
+ className: "w-full"
32047
+ }, /*#__PURE__*/React$1.createElement("h3", {
32048
+ className: "text-lg font-medium mb-4 text-center"
32049
+ }, "Vendor Selling Events Comparison"), /*#__PURE__*/React$1.createElement(ResponsiveContainer, {
32114
32050
  width: "100%",
32115
- height: 400
32051
+ height: 450
32116
32052
  }, /*#__PURE__*/React$1.createElement(BarChart$1, {
32117
- data: data,
32053
+ data: processedData,
32118
32054
  margin: {
32119
- top: 20,
32055
+ top: 30,
32120
32056
  right: 30,
32121
32057
  left: 20,
32122
- bottom: 10
32058
+ bottom: 60
32123
32059
  }
32124
32060
  }, /*#__PURE__*/React$1.createElement(CartesianGrid, {
32125
32061
  strokeDasharray: "3 3",
32126
32062
  vertical: false
32127
32063
  }), /*#__PURE__*/React$1.createElement(XAxis, {
32128
- dataKey: "week",
32129
- tick: /*#__PURE__*/React$1.createElement(CustomizedTick, null)
32064
+ dataKey: "shortLabel",
32065
+ tick: /*#__PURE__*/React$1.createElement(CustomizedTick, null),
32066
+ height: 70,
32067
+ interval: 0
32130
32068
  }), /*#__PURE__*/React$1.createElement(YAxis, {
32131
32069
  type: "number",
32132
32070
  domain: [0, "dataMax + 2000"],
32133
- hide: true
32071
+ tickFormatter: format
32134
32072
  }), /*#__PURE__*/React$1.createElement(Tooltip$2, {
32135
32073
  content: /*#__PURE__*/React$1.createElement(CustomTooltip, null)
32136
32074
  }), /*#__PURE__*/React$1.createElement(Brush, {
32137
32075
  height: 30,
32138
32076
  travellerWidth: 10,
32139
- startIndex: 1,
32077
+ startIndex: 0,
32140
32078
  endIndex: 5,
32141
- y: 369
32079
+ y: 380
32142
32080
  }), /*#__PURE__*/React$1.createElement(Bar, {
32143
32081
  dataKey: "total",
32144
32082
  shape: /*#__PURE__*/React$1.createElement(BarWithInner, null),
32145
- label: /*#__PURE__*/React$1.createElement(CustomBarLabel, null),
32146
- barSize: 30
32147
- })));
32083
+ barSize: 36
32084
+ }))));
32148
32085
  }
32149
32086
 
32087
+ const Container = styled.div`
32088
+ width: ${props => props.width};
32089
+ height: ${props => props.height};
32090
+ padding: 15px;
32091
+ display: flex;
32092
+ flex-direction: column;
32093
+ #Segment {
32094
+ width: auto;
32095
+ white-space: nowrap;
32096
+ font-size: 14px;
32097
+ font-weight: 500;
32098
+ font-family: "Poppins"
32099
+ }
32100
+ `;
32150
32101
  styled.div`
32151
32102
  font-family: sans-serif;
32152
32103
  text-align: center;
@@ -32163,49 +32114,22 @@ styled.div`
32163
32114
  flex-direction: column;
32164
32115
  background-color: white;
32165
32116
  `;
32166
- const Container = styled.div`
32167
- width: 100%;
32168
- height: 100%;
32169
- display: flex;
32170
- flex-direction: column;
32171
- #Segment {
32172
- width: auto;
32173
- white-space: nowrap;
32174
- font-size: 14px;
32175
- font-weight: 500;
32176
- font-family: "Poppins"
32177
- }
32178
- `;
32179
- /* Make brush background darker */
32180
- /* .recharts-brush .recharts-brush-slide {
32181
- fill: #a52a2a !important;
32182
- stroke: none;
32183
- }
32184
-
32185
- /* Style draggable handles (travellers) */
32186
- /* .recharts-brush-traveller {
32187
- fill: limegreen !important; /* bright green like in the image */
32188
- /* cursor: ew-resize;
32189
- } */
32190
-
32191
- /* Optional: center grip arrows (you can fake it with CSS) */
32192
- /* .recharts-brush .recharts-brush-traveller > rect {
32193
- rx: 2;
32194
- ry: 2;
32195
- width: 6;
32196
- fill: #a52a2a !important; /* dark gray */
32197
- /* } */
32198
32117
 
32199
- /* Remove tick labels if needed */
32200
- // .recharts-brush .recharts-layer text {
32201
- // display: none;
32202
- // }
32203
-
32204
- const BrushChart = () => {
32118
+ const BrushChart = props => {
32119
+ const {
32120
+ width,
32121
+ height,
32122
+ data,
32123
+ barlineData,
32124
+ lineChartData
32125
+ } = props;
32205
32126
  const segmentedbuttonOptions = ["New Shoppers & Repeaters", "INC Sales & ROI", "INC Units", "Basket Lift"];
32206
32127
  const [selectedOption, setSelectedOption] = useState(segmentedbuttonOptions[0]);
32207
- return /*#__PURE__*/React$1.createElement(Container, null, /*#__PURE__*/React$1.createElement(SegmentedButton, {
32208
- gap: '8px',
32128
+ return /*#__PURE__*/React$1.createElement(Container, {
32129
+ height: height,
32130
+ width: width
32131
+ }, /*#__PURE__*/React$1.createElement(SegmentedButton, {
32132
+ gap: "8px",
32209
32133
  options: segmentedbuttonOptions.map(value => ({
32210
32134
  value
32211
32135
  })),
@@ -32215,7 +32139,15 @@ const BrushChart = () => {
32215
32139
  } = _ref;
32216
32140
  return setSelectedOption(value);
32217
32141
  }
32218
- }), selectedOption === "New Shoppers & Repeaters" && /*#__PURE__*/React$1.createElement(InnerBarChart, null), selectedOption === "INC Sales & ROI" && /*#__PURE__*/React$1.createElement(SeparatedLineBarChart, null), selectedOption === "INC Units" && /*#__PURE__*/React$1.createElement(SingleChart, null), selectedOption === "Basket Lift" && /*#__PURE__*/React$1.createElement(SingleChart, null));
32142
+ }), selectedOption === "New Shoppers & Repeaters" && /*#__PURE__*/React$1.createElement(InnerBarChart, {
32143
+ data: data
32144
+ }), selectedOption === "INC Sales & ROI" && /*#__PURE__*/React$1.createElement(SeparatedLineBarChart, {
32145
+ barlineData: barlineData
32146
+ }), selectedOption === "INC Units" && /*#__PURE__*/React$1.createElement(SingleChart, {
32147
+ lineChartData: lineChartData
32148
+ }), selectedOption === "Basket Lift" && /*#__PURE__*/React$1.createElement(SingleChart, {
32149
+ lineChartData: lineChartData
32150
+ }));
32219
32151
  };
32220
32152
 
32221
32153
  export { AreaChart, BannerEventBoxList, BarChart, BarChartsByWeeks, BatteryChart, BreakdownPanel, BrushChart, BubbleChart, Button, CollapseHeader, DialogOverlay, DoubleBarSingleLine, DoublePanelDataRow, EventDetailsCard, EventList, FilterPanel, Heatmap, IconButton, LinkButton, LinnerDataBox, MarketShareDescription, OneColumnContainer, PerformanceAnalyticsLegend, PieChart, PopupCharts, QuickFilter, ReportTable, TabMenu, TopToggleList, TotalDoughnutChart, TotalHorizontalCharts };