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.js CHANGED
@@ -9730,26 +9730,34 @@ const OptionsContainer$4 = styled__default["default"].div`
9730
9730
  padding-top: 8px;
9731
9731
  `;
9732
9732
 
9733
- const ChervronRightIcon = () => /*#__PURE__*/React__default["default"].createElement("svg", {
9734
- width: "8",
9735
- height: "13",
9733
+ const ChervronRightIcon = ({
9734
+ width = "8",
9735
+ height = "13",
9736
+ fill = "#777575"
9737
+ }) => /*#__PURE__*/React__default["default"].createElement("svg", {
9738
+ width: width,
9739
+ height: height,
9736
9740
  viewBox: "0 0 8 13",
9737
9741
  fill: "none",
9738
9742
  xmlns: "http://www.w3.org/2000/svg"
9739
9743
  }, /*#__PURE__*/React__default["default"].createElement("path", {
9740
9744
  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",
9741
- fill: "#777575"
9745
+ fill: fill
9742
9746
  }));
9743
9747
 
9744
- const ChervronLeftIcon = () => /*#__PURE__*/React__default["default"].createElement("svg", {
9745
- width: "7",
9746
- height: "13",
9748
+ const ChervronLeftIcon = ({
9749
+ width = 7,
9750
+ height = 13,
9751
+ fill = "#777575"
9752
+ }) => /*#__PURE__*/React__default["default"].createElement("svg", {
9753
+ width: width,
9754
+ height: height,
9747
9755
  viewBox: "0 0 7 13",
9748
9756
  fill: "none",
9749
9757
  xmlns: "http://www.w3.org/2000/svg"
9750
9758
  }, /*#__PURE__*/React__default["default"].createElement("path", {
9751
9759
  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",
9752
- fill: "#777575"
9760
+ fill: fill
9753
9761
  }));
9754
9762
 
9755
9763
  /* eslint-disable react/prop-types */
@@ -10340,7 +10348,15 @@ const DateCell$1 = styled__default["default"].div`
10340
10348
  color: #ccc;
10341
10349
  }
10342
10350
  `;
10343
- const years$1 = [2022, 2023, 2024];
10351
+ const generateYearsArray$1 = (startYear, endDate) => {
10352
+ const years = [];
10353
+ const endYear = endDate.getFullYear();
10354
+ for (let year = startYear; year <= endYear; year++) {
10355
+ years.push(`${year}`);
10356
+ }
10357
+ return years;
10358
+ };
10359
+ const years$1 = generateYearsArray$1(2022, new Date());
10344
10360
  const QuarterPopupPicker = ({
10345
10361
  isOpen,
10346
10362
  onChangeDate,
@@ -10769,7 +10785,15 @@ const DateCell = styled__default["default"].div`
10769
10785
  color: #ccc;
10770
10786
  }
10771
10787
  `;
10772
- const years = [2022, 2023, 2024];
10788
+ const generateYearsArray = (startYear, endDate) => {
10789
+ const years = [];
10790
+ const endYear = endDate.getFullYear();
10791
+ for (let year = startYear; year <= endYear; year++) {
10792
+ years.push(`${year}`);
10793
+ }
10794
+ return years;
10795
+ };
10796
+ const years = generateYearsArray(2022, new Date());
10773
10797
  const MonthPopupPicker = ({
10774
10798
  isOpen,
10775
10799
  onChangeDate,
@@ -11233,7 +11257,7 @@ const FilterPanel = props => {
11233
11257
  inputSubType: 'year'
11234
11258
  } : ''),
11235
11259
  ...(newPeriodPickerSelectedValue[0]?.value === 'ytd' ? {
11236
- inputSubType: 'daterange'
11260
+ inputSubType: 'ytd'
11237
11261
  } : ''),
11238
11262
  ...(newPeriodPickerSelectedValue[0]?.value === 'month' ? {
11239
11263
  inputSubType: 'month'
@@ -11256,7 +11280,7 @@ const FilterPanel = props => {
11256
11280
  inputSubType: 'year'
11257
11281
  } : ''),
11258
11282
  ...(newPeriodPickerSelectedValue[0]?.value === 'ytd' ? {
11259
- inputSubType: 'daterange'
11283
+ inputSubType: 'ytd'
11260
11284
  } : ''),
11261
11285
  ...(newPeriodPickerSelectedValue[0]?.value === 'month' ? {
11262
11286
  inputSubType: 'month'
@@ -11446,7 +11470,7 @@ const FilterPanel = props => {
11446
11470
  const selectedValue = eventRangePicker && typeof eventRangePicker === 'string' ? `${eventRangePicker}` : undefined;
11447
11471
  const newFieldsDataState = FieldsDataState?.map(itemField => itemField.name === item.name ? {
11448
11472
  ...itemField,
11449
- inputSubType: 'daterange',
11473
+ inputSubType: 'ytd',
11450
11474
  selectedValue: selectedValue ? `${selectedValue}` : undefined
11451
11475
  } : itemField);
11452
11476
  setFieldsDataState(newFieldsDataState);
@@ -11455,14 +11479,14 @@ const FilterPanel = props => {
11455
11479
  changedItem: {
11456
11480
  name: item.name,
11457
11481
  inputType: item.inputType,
11458
- inputSubType: 'daterange',
11482
+ inputSubType: 'ytd',
11459
11483
  selectedValue: selectedValue ? `${selectedValue}` : undefined
11460
11484
  }
11461
11485
  });
11462
11486
  },
11463
11487
  required: item.required,
11464
11488
  placeholder: "Select Date Range ...",
11465
- selectedValue: item.selectedValue || getYTDString(),
11489
+ selectedValue: getYTDString(),
11466
11490
  disabled: true,
11467
11491
  width: "100%",
11468
11492
  height: "55px"
@@ -24114,21 +24138,22 @@ const DeleteIcon = styled__default["default"].div`
24114
24138
  position: absolute;
24115
24139
  `;
24116
24140
 
24117
- const QuickFilterDropdownSingle = ({
24118
- label,
24119
- hoverColor,
24120
- options,
24121
- selectedValue,
24122
- placeHolder,
24123
- onChange,
24124
- disabled,
24125
- width,
24126
- error,
24127
- errorMessage,
24128
- xIconShow,
24129
- labelColor,
24130
- showLabelOnTop
24131
- }) => {
24141
+ const QuickFilterDropdownSingle = _ref => {
24142
+ let {
24143
+ label,
24144
+ hoverColor,
24145
+ options,
24146
+ selectedValue,
24147
+ placeHolder,
24148
+ onChange,
24149
+ disabled,
24150
+ width,
24151
+ error,
24152
+ errorMessage,
24153
+ xIconShow,
24154
+ labelColor,
24155
+ showLabelOnTop
24156
+ } = _ref;
24132
24157
  const [isFocused, setIsFocused] = React$1.useState(false);
24133
24158
  const [showOptions, setShowOptions] = React$1.useState(false);
24134
24159
  const [inputValue, setInputValue] = React$1.useState("");
@@ -24526,23 +24551,24 @@ const IconContainer$2 = styled__default["default"].div`
24526
24551
  cursor: pointer;
24527
24552
  `;
24528
24553
 
24529
- const QuickFilterDropdownMultiSelection = ({
24530
- label,
24531
- labelEmptyValue,
24532
- options,
24533
- selectedValue,
24534
- placeHolder,
24535
- onChange,
24536
- required,
24537
- disabled,
24538
- width,
24539
- error,
24540
- errorMessage,
24541
- labelColor,
24542
- xIconShow,
24543
- checkBoxColor,
24544
- showLabelOnTop
24545
- }) => {
24554
+ const QuickFilterDropdownMultiSelection = _ref => {
24555
+ let {
24556
+ label,
24557
+ labelEmptyValue,
24558
+ options,
24559
+ selectedValue,
24560
+ placeHolder,
24561
+ onChange,
24562
+ required,
24563
+ disabled,
24564
+ width,
24565
+ error,
24566
+ errorMessage,
24567
+ labelColor,
24568
+ xIconShow,
24569
+ checkBoxColor,
24570
+ showLabelOnTop
24571
+ } = _ref;
24546
24572
  const [isFocused, setIsFocused] = React$1.useState(false);
24547
24573
  const [showOptions, setShowOptions] = React$1.useState(false);
24548
24574
  const [inputValue, setInputValue] = React$1.useState('');
@@ -25156,8 +25182,8 @@ function styleInject(css, ref) {
25156
25182
  }
25157
25183
  }
25158
25184
 
25159
- 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";
25160
- styleInject(css_248z$1);
25185
+ 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";
25186
+ styleInject(css_248z);
25161
25187
 
25162
25188
  const OneColumnContainer = props => {
25163
25189
  const {
@@ -31381,83 +31407,102 @@ const BatteryChart = props => {
31381
31407
  }))))))), starText !== "" && /*#__PURE__*/React__default["default"].createElement(StarText, null, starText));
31382
31408
  };
31383
31409
 
31384
- const originalData$1 = [{
31385
- label: "Vendor Selling Event: Week 28",
31386
- inc_unit: 20000,
31387
- inc_roi: 1.2
31388
- }, {
31389
- label: "Vendor Selling Event: Week 29",
31390
- inc_unit: 10000,
31391
- inc_roi: 1.2
31392
- }, {
31393
- label: "Vendor Selling Event: Week 30",
31394
- inc_unit: 8000,
31395
- inc_roi: 0.8
31396
- }, {
31397
- label: "Vendor Selling Event: Week 33",
31398
- inc_unit: 12000,
31399
- inc_roi: 1.1
31400
- }, {
31401
- label: "Vendor Selling Event: Week 36",
31402
- inc_unit: 8000,
31403
- inc_roi: 1.2
31404
- }, {
31405
- label: "Vendor Selling Event: Week 34",
31406
- inc_unit: 8000,
31407
- inc_roi: 0.7
31408
- }, {
31409
- label: "Vendor Selling Event: Week 35",
31410
- inc_unit: 8000,
31411
- inc_roi: 0.8
31412
- }, {
31413
- label: "Vendor Selling Event: Week 38",
31414
- inc_unit: 9000,
31415
- inc_roi: 1.1
31416
- }];
31417
- const dataWithIndex$1 = originalData$1.map((item, index) => ({
31418
- ...item,
31419
- index,
31420
- shortLabel: item.label.replace("Vendor Selling Event: ", "Wk ")
31421
- }));
31422
- const CustomizedTick$1 = ({
31423
- x,
31424
- y,
31425
- payload
31410
+ // const originalData = [
31411
+ // { label: "Vendor Selling Event: Week 34", inc_sales: 20000, inc_roi: 1.2 },
31412
+ // { label: "Vendor Selling Event: Week 36", inc_sales: 10000, inc_roi: 1.2 },
31413
+ // { label: "Vendor Selling Event: Week 38", inc_sales: 8000, inc_roi: 0.8 },
31414
+ // { label: "Vendor Selling Event: Week 33", inc_sales: 12000, inc_roi: 1.1 },
31415
+ // { label: "Vendor Selling Event: Week 29", inc_sales: 8000, inc_roi: 1.2 },
31416
+ // { label: "Vendor Selling Event: Week 28", inc_sales: 8000, inc_roi: 0.7 },
31417
+ // { label: "Vendor Selling Event: Week 35", inc_sales: 8000, inc_roi: 0.8 },
31418
+ // { label: "Vendor Selling Event: Week 30", inc_sales: 9000, inc_roi: 1.1 },
31419
+ // ];
31420
+
31421
+ const SeparatedLineBarChart = ({
31422
+ barlineData = []
31426
31423
  }) => {
31427
- const label = dataWithIndex$1[payload.value]?.label ?? "";
31428
- const parts = label.replace("Vendor Selling Event: ", "").split(" ");
31429
- return /*#__PURE__*/React__default["default"].createElement("g", {
31430
- transform: `translate(${x},${y})`
31431
- }, /*#__PURE__*/React__default["default"].createElement("text", {
31432
- x: 0,
31433
- y: 0,
31434
- dy: 16,
31435
- textAnchor: "middle",
31436
- fill: "#212121",
31437
- fontSize: 11,
31438
- fontWeight: "400",
31439
- fontFamily: "Poppins"
31440
- }, /*#__PURE__*/React__default["default"].createElement("tspan", {
31441
- x: 0,
31442
- dy: 8
31443
- }, "Vendor Selling"), /*#__PURE__*/React__default["default"].createElement("tspan", {
31444
- x: 0,
31445
- dy: 18
31446
- }, "Event: ", parts.join(" "))));
31447
- };
31448
-
31449
- // Common chart configuration
31450
- const chartMargins = {
31451
- top: 15,
31452
- right: 40,
31453
- left: 20,
31454
- bottom: 40
31455
- };
31456
- const SeparatedLineBarChart = () => {
31424
+ // Sort the data by week number extracted from the label
31425
+ const sortedData = barlineData?.sort((a, b) => {
31426
+ const weekA = parseInt(a.label.match(/Week (\d+)/)[1], 10);
31427
+ const weekB = parseInt(b.label.match(/Week (\d+)/)[1], 10);
31428
+ return weekA - weekB;
31429
+ });
31430
+ const dataWithIndex = sortedData.map((item, index) => ({
31431
+ ...item,
31432
+ index,
31433
+ shortLabel: item.label.replace("Vendor Selling Event: ", "Wk ")
31434
+ }));
31435
+ const CustomizedTick = ({
31436
+ x,
31437
+ y,
31438
+ payload,
31439
+ viewableIndices
31440
+ }) => {
31441
+ const label = dataWithIndex[payload.value]?.label ?? "";
31442
+ const parts = label.replace("Vendor Selling Event: ", "").split(" ");
31443
+ if (!viewableIndices.includes(payload.value)) {
31444
+ return null;
31445
+ }
31446
+ return /*#__PURE__*/React__default["default"].createElement("g", {
31447
+ transform: `translate(${x},${y})`
31448
+ }, /*#__PURE__*/React__default["default"].createElement("text", {
31449
+ x: 0,
31450
+ y: 0,
31451
+ dy: 16,
31452
+ textAnchor: "middle",
31453
+ fill: "#212121",
31454
+ fontSize: 11,
31455
+ fontWeight: "400",
31456
+ fontFamily: "Poppins"
31457
+ }, /*#__PURE__*/React__default["default"].createElement("tspan", {
31458
+ x: 0,
31459
+ dy: 8
31460
+ }, "Vendor Selling"), /*#__PURE__*/React__default["default"].createElement("tspan", {
31461
+ x: 0,
31462
+ dy: 18
31463
+ }, "Event: ", parts.join(" "))));
31464
+ };
31465
+ const CustomLabelListFilter = props => {
31466
+ const {
31467
+ viewableIndices,
31468
+ dataKey,
31469
+ position,
31470
+ formatter,
31471
+ fill,
31472
+ fontSize,
31473
+ fontWeight,
31474
+ fontFamily
31475
+ } = props;
31476
+ return /*#__PURE__*/React__default["default"].createElement(recharts.LabelList, {
31477
+ dataKey: dataKey,
31478
+ position: position,
31479
+ formatter: (value, name, props) => {
31480
+ if (!viewableIndices.includes(props.index)) {
31481
+ return "";
31482
+ }
31483
+ return formatter ? formatter(value) : value;
31484
+ },
31485
+ fill: fill || "#212121",
31486
+ fontSize: fontSize || 12,
31487
+ fontWeight: fontWeight || "400",
31488
+ fontFamily: fontFamily || "Poppins"
31489
+ });
31490
+ };
31491
+ const chartMargins = {
31492
+ top: 15,
31493
+ right: 40,
31494
+ left: 20,
31495
+ bottom: 40
31496
+ };
31457
31497
  const [viewWindow, setViewWindow] = React$1.useState({
31458
31498
  startIndex: 0,
31459
- endIndex: dataWithIndex$1.length - 1
31499
+ endIndex: dataWithIndex.length - 1
31460
31500
  });
31501
+ const viewableIndices = [];
31502
+ for (let i = viewWindow.startIndex; i <= viewWindow.endIndex; i++) {
31503
+ viewableIndices.push(i);
31504
+ }
31505
+ dataWithIndex.filter(item => viewableIndices.includes(item.index));
31461
31506
  return /*#__PURE__*/React__default["default"].createElement("div", {
31462
31507
  style: {
31463
31508
  width: "100%",
@@ -31471,8 +31516,7 @@ const SeparatedLineBarChart = () => {
31471
31516
  width: "100%",
31472
31517
  height: "100%"
31473
31518
  }, /*#__PURE__*/React__default["default"].createElement(recharts.LineChart, {
31474
- data: dataWithIndex$1 // Use full dataset for alignment
31475
- ,
31519
+ data: dataWithIndex,
31476
31520
  margin: chartMargins
31477
31521
  }, /*#__PURE__*/React__default["default"].createElement(recharts.CartesianGrid, {
31478
31522
  strokeDasharray: "3 3",
@@ -31500,10 +31544,11 @@ const SeparatedLineBarChart = () => {
31500
31544
  },
31501
31545
  activeDot: false,
31502
31546
  name: "INC Sales ROI"
31503
- }, /*#__PURE__*/React__default["default"].createElement(recharts.LabelList, {
31547
+ }, /*#__PURE__*/React__default["default"].createElement(CustomLabelListFilter, {
31504
31548
  dataKey: "inc_roi",
31505
31549
  position: "top",
31506
- formatter: value => value.toFixed(1)
31550
+ formatter: value => value.toFixed(1),
31551
+ viewableIndices: viewableIndices
31507
31552
  }))))), /*#__PURE__*/React__default["default"].createElement("div", {
31508
31553
  style: {
31509
31554
  height: "60%"
@@ -31512,7 +31557,7 @@ const SeparatedLineBarChart = () => {
31512
31557
  width: "100%",
31513
31558
  height: "100%"
31514
31559
  }, /*#__PURE__*/React__default["default"].createElement(recharts.ComposedChart, {
31515
- data: dataWithIndex$1,
31560
+ data: dataWithIndex,
31516
31561
  margin: chartMargins
31517
31562
  }, /*#__PURE__*/React__default["default"].createElement(recharts.CartesianGrid, {
31518
31563
  strokeDasharray: "3 3",
@@ -31525,30 +31570,28 @@ const SeparatedLineBarChart = () => {
31525
31570
  left: 20,
31526
31571
  right: 20
31527
31572
  },
31528
- tick: /*#__PURE__*/React__default["default"].createElement(CustomizedTick$1, null),
31529
- interval: 0 // Force display all ticks
31530
- ,
31573
+ tick: props => /*#__PURE__*/React__default["default"].createElement(CustomizedTick, _extends({}, props, {
31574
+ viewableIndices: viewableIndices
31575
+ })),
31576
+ interval: 0,
31531
31577
  height: 60,
31532
31578
  tickLine: false,
31533
- ticks: dataWithIndex$1.map(item => item.index)
31579
+ ticks: dataWithIndex.map(item => item.index)
31534
31580
  }), /*#__PURE__*/React__default["default"].createElement(recharts.YAxis, {
31535
- tickFormatter: v => `$${v / 1000}k`,
31581
+ tickFormatter: v => `${v / 1000}k`,
31536
31582
  hide: true
31537
31583
  }), /*#__PURE__*/React__default["default"].createElement(recharts.Tooltip, null), /*#__PURE__*/React__default["default"].createElement(recharts.Bar, {
31538
- dataKey: "inc_unit",
31584
+ dataKey: "inc_sales",
31539
31585
  fill: "#CCDCDD",
31540
31586
  gap: "4px",
31541
31587
  borderRadius: [4, 4, 0, 8],
31542
31588
  barSize: 40,
31543
31589
  name: "INC Sales"
31544
- }, /*#__PURE__*/React__default["default"].createElement(recharts.LabelList, {
31545
- dataKey: "inc_unit",
31590
+ }, /*#__PURE__*/React__default["default"].createElement(CustomLabelListFilter, {
31591
+ dataKey: "inc_sales",
31546
31592
  position: "top",
31547
- formatter: value => `$${value / 1000}k`,
31548
- fill: "#212121",
31549
- fontSize: 12,
31550
- fontWeight: "400",
31551
- fontFamily: "Poppins"
31593
+ formatter: value => `${value / 1000}k`,
31594
+ viewableIndices: viewableIndices
31552
31595
  })), /*#__PURE__*/React__default["default"].createElement(recharts.Brush, {
31553
31596
  dataKey: "index",
31554
31597
  height: 30,
@@ -31558,7 +31601,7 @@ const SeparatedLineBarChart = () => {
31558
31601
  onChange: e => {
31559
31602
  setViewWindow({
31560
31603
  startIndex: e.startIndex ?? 0,
31561
- endIndex: e.endIndex ?? dataWithIndex$1.length - 1
31604
+ endIndex: e.endIndex ?? dataWithIndex.length - 1
31562
31605
  });
31563
31606
  },
31564
31607
  travellerWidth: 12
@@ -31579,68 +31622,42 @@ const SeparatedLineBarChart = () => {
31579
31622
  })))));
31580
31623
  };
31581
31624
 
31582
- const originalData = [{
31583
- label: "Vendor Selling Event: Week 28",
31584
- inc_unit: 20000
31585
- }, {
31586
- label: "Vendor Selling Event: Week 29",
31587
- inc_unit: 10000
31588
- }, {
31589
- label: "Vendor Selling Event: Week 30",
31590
- inc_unit: 8000
31591
- }, {
31592
- label: "Vendor Selling Event: Week 33",
31593
- inc_unit: 12000
31594
- }, {
31595
- label: "Vendor Selling Event: Week 36",
31596
- inc_unit: 8000
31597
- }, {
31598
- label: "Vendor Selling Event: Week 34",
31599
- inc_unit: 8000
31600
- }, {
31601
- label: "Vendor Selling Event: Week 35",
31602
- inc_unit: 8000
31603
- }, {
31604
- label: "Vendor Selling Event: Week 38",
31605
- inc_unit: 9000
31606
- }];
31607
-
31608
- // Adding index and shortLabel to original data
31609
- const dataWithIndex = originalData.map((item, index) => ({
31610
- ...item,
31611
- index,
31612
- shortLabel: item.label.replace("Vendor Selling Event: ", "Wk ")
31613
- }));
31614
- const CustomizedTick = ({
31615
- x,
31616
- y,
31617
- payload
31618
- }) => {
31619
- const label = dataWithIndex[payload.value]?.label ?? "";
31620
- const parts = label.replace("Vendor Selling Event: ", "").split(" ");
31621
- return /*#__PURE__*/React__default["default"].createElement("g", {
31622
- transform: `translate(${x},${y})`
31623
- }, /*#__PURE__*/React__default["default"].createElement("text", {
31624
- x: 0,
31625
- y: 0,
31626
- dy: 16,
31627
- textAnchor: "middle",
31628
- fill: "#212121",
31629
- fontSize: 11,
31630
- fontWeight: "400",
31631
- fontFamily: "Poppins"
31632
- }, /*#__PURE__*/React__default["default"].createElement("tspan", {
31633
- x: 0,
31634
- dy: 8
31635
- }, "Vendor Selling"), /*#__PURE__*/React__default["default"].createElement("tspan", {
31636
- x: 0,
31637
- dy: 18
31638
- }, "Event: ", parts.join(" "))));
31639
- };
31640
- const SingleChart = () => {
31625
+ function SingleChart({
31626
+ lineChartData
31627
+ }) {
31628
+ const dataWithIndex = lineChartData?.map((item, index) => ({
31629
+ ...item,
31630
+ index,
31631
+ shortLabel: item.label.replace("Vendor Selling Event: ", "Wk ")
31632
+ }));
31633
+ const CustomizedTick = ({
31634
+ x,
31635
+ y,
31636
+ payload
31637
+ }) => {
31638
+ const label = dataWithIndex[payload.value]?.label ?? "";
31639
+ const parts = label.replace("Vendor Selling Event: ", "").split(" ");
31640
+ return /*#__PURE__*/React__default["default"].createElement("g", {
31641
+ transform: `translate(${x},${y})`
31642
+ }, /*#__PURE__*/React__default["default"].createElement("text", {
31643
+ x: 0,
31644
+ y: 0,
31645
+ dy: 16,
31646
+ textAnchor: "middle",
31647
+ fill: "#212121",
31648
+ fontSize: 11,
31649
+ fontWeight: "400",
31650
+ fontFamily: "Poppins"
31651
+ }, /*#__PURE__*/React__default["default"].createElement("tspan", {
31652
+ x: 0,
31653
+ dy: 8
31654
+ }, "Vendor Selling"), /*#__PURE__*/React__default["default"].createElement("tspan", {
31655
+ x: 0,
31656
+ dy: 18
31657
+ }, "Event: ", parts.join(" "))));
31658
+ };
31641
31659
  const [startIndex, setStartIndex] = React$1.useState(0);
31642
- const [endIndex, setEndIndex] = React$1.useState(dataWithIndex.length - 1);
31643
- dataWithIndex.slice(startIndex, endIndex + 1);
31660
+ const [endIndex, setEndIndex] = React$1.useState(dataWithIndex?.length - 1);
31644
31661
  return /*#__PURE__*/React__default["default"].createElement("div", {
31645
31662
  style: {
31646
31663
  width: "100%",
@@ -31678,14 +31695,14 @@ const SingleChart = () => {
31678
31695
  tickFormatter: v => `$${v / 1000}k`,
31679
31696
  hide: true
31680
31697
  }), /*#__PURE__*/React__default["default"].createElement(recharts.Tooltip, null), /*#__PURE__*/React__default["default"].createElement(recharts.Bar, {
31681
- dataKey: "inc_unit",
31698
+ dataKey: "value",
31682
31699
  fill: "#CCDCDD",
31683
31700
  gap: "4px",
31684
31701
  borderRadius: [4, 4, 0, 8],
31685
31702
  barSize: 40,
31686
31703
  name: "INC Sales"
31687
31704
  }, /*#__PURE__*/React__default["default"].createElement(recharts.LabelList, {
31688
- dataKey: "inc_unit",
31705
+ dataKey: "value",
31689
31706
  position: "top",
31690
31707
  formatter: value => `$${value / 1000}k`,
31691
31708
  fill: "#212121",
@@ -31700,7 +31717,7 @@ const SingleChart = () => {
31700
31717
  endIndex: endIndex,
31701
31718
  onChange: e => {
31702
31719
  setStartIndex(e.startIndex ?? 0);
31703
- setEndIndex(e.endIndex ?? dataWithIndex.length - 1);
31720
+ setEndIndex(e.endIndex ?? dataWithIndex?.length - 1);
31704
31721
  },
31705
31722
  travellerWidth: 12
31706
31723
  })), /*#__PURE__*/React__default["default"].createElement(PerformanceAnalyticsLegend, {
@@ -31710,7 +31727,7 @@ const SingleChart = () => {
31710
31727
  title: "INC Units"
31711
31728
  }]
31712
31729
  }))));
31713
- };
31730
+ }
31714
31731
 
31715
31732
  styled__default["default"].div`
31716
31733
  display: flex;
@@ -31842,15 +31859,17 @@ const SegmentedButton = props => {
31842
31859
  }, [defaultIndex]);
31843
31860
  React$1.useEffect(() => {
31844
31861
  const activeSegmentRef = optionsRef[activeIndex].ref;
31845
- const {
31846
- offsetWidth,
31847
- offsetLeft
31848
- } = activeSegmentRef.current;
31849
- const {
31850
- style
31851
- } = controlRef.current;
31852
- style.setProperty('--highlight-width', `${offsetWidth}px`);
31853
- style.setProperty('--highlight-x-pos', `${offsetLeft}px`);
31862
+ setTimeout(() => {
31863
+ const {
31864
+ offsetWidth,
31865
+ offsetLeft
31866
+ } = activeSegmentRef.current;
31867
+ const {
31868
+ style
31869
+ } = controlRef.current;
31870
+ style.setProperty("--highlight-width", `${offsetWidth}px`);
31871
+ style.setProperty("--highlight-x-pos", `${offsetLeft}px`);
31872
+ }, 0);
31854
31873
  }, [activeIndex, controlRef, optionsRef]);
31855
31874
  const onInputChangeHandler = (value, index) => {
31856
31875
  setActiveIndex(index);
@@ -31873,14 +31892,14 @@ const SegmentedButton = props => {
31873
31892
  gap: gap,
31874
31893
  controlradius: controlradius,
31875
31894
  segmentwidth: segmentwidth,
31876
- className: `controls ${componentReady.current ? 'ready' : 'idle'}`
31895
+ className: `controls ${componentReady.current ? "ready" : "idle"}`
31877
31896
  }, optionsRef?.map((item, i) => /*#__PURE__*/React__default["default"].createElement(Segment, {
31878
31897
  id: "Segment",
31879
31898
  key: item.id,
31880
31899
  selectedsegmentcolor: selectedsegmentcolor,
31881
31900
  controlradius: controlradius,
31882
31901
  segmentwidth: segmentwidth,
31883
- className: `${activeIndex === i ? 'active' : 'inactive'}`,
31902
+ className: `${activeIndex === i ? "active" : "inactive"}`,
31884
31903
  ref: item.ref
31885
31904
  }, /*#__PURE__*/React__default["default"].createElement(ControlsInput, {
31886
31905
  type: "radio",
@@ -31894,7 +31913,7 @@ const SegmentedButton = props => {
31894
31913
  selectedtextcolor: selectedtextcolor,
31895
31914
  unselectedtextcolor: unselectedtextcolor,
31896
31915
  segmentheight: height / 5,
31897
- className: `${activeIndex === i ? 'active' : 'inactive'} `,
31916
+ className: `${activeIndex === i ? "active" : "inactive"} `,
31898
31917
  htmlFor: item.value
31899
31918
  }, item.value)))));
31900
31919
  };
@@ -31916,116 +31935,38 @@ SegmentedButton.propTypes = {
31916
31935
  onClick: PropTypes.func
31917
31936
  };
31918
31937
  SegmentedButton.defaultProps = {
31919
- name: '',
31938
+ name: "",
31920
31939
  options: [{
31921
- value: '4 w'
31940
+ value: "4 w"
31922
31941
  }, {
31923
- value: '8 w'
31942
+ value: "8 w"
31924
31943
  }, {
31925
- value: '13 w'
31944
+ value: "13 w"
31926
31945
  }],
31927
31946
  width: 120,
31928
31947
  height: 40,
31929
31948
  controlradius: 8,
31930
31949
  segmentradius: 8,
31931
- gap: '0px',
31950
+ gap: "0px",
31932
31951
  fontSize: 14,
31933
- selectedsegmentcolor: '#3a9df9',
31934
- selectedtextcolor: '#212121',
31935
- unselectedtextcolor: 'black',
31952
+ selectedsegmentcolor: "#3a9df9",
31953
+ selectedtextcolor: "#212121",
31954
+ unselectedtextcolor: "black",
31936
31955
  defaultIndex: 0,
31937
31956
  onClick: () => {}
31938
31957
  };
31939
31958
 
31940
- 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 ";
31941
- styleInject(css_248z);
31942
-
31943
- function InnerBarChart() {
31944
- const data = [{
31945
- week: "Week 28",
31946
- total: 20000,
31947
- actual: 4000
31948
- }, {
31949
- week: "Week 29",
31950
- total: 10000,
31951
- actual: 8000
31952
- }, {
31953
- week: "Week 30",
31954
- total: 8000,
31955
- actual: 950
31956
- }, {
31957
- week: "Week 33",
31958
- total: 12000,
31959
- actual: 1000
31960
- }, {
31961
- week: "Week 36",
31962
- total: 16000,
31963
- actual: 13000
31964
- }, {
31965
- week: "Week 34",
31966
- total: 30000,
31967
- actual: 3000
31968
- }, {
31969
- week: "Week 35",
31970
- total: 8000,
31971
- actual: 950
31972
- }, {
31973
- week: "Week 37",
31974
- total: 9000,
31975
- actual: 3000
31976
- }];
31977
- const originalData = [{
31978
- label: "Vendor Selling Event: Week 28",
31979
- inc_unit: 20000,
31980
- inc_roi: 1.2
31981
- }, {
31982
- label: "Vendor Selling Event: Week 29",
31983
- inc_unit: 10000,
31984
- inc_roi: 1.2
31985
- }, {
31986
- label: "Vendor Selling Event: Week 30",
31987
- inc_unit: 8000,
31988
- inc_roi: 0.8
31989
- }, {
31990
- label: "Vendor Selling Event: Week 33",
31991
- inc_unit: 12000,
31992
- inc_roi: 1.1
31993
- }, {
31994
- label: "Vendor Selling Event: Week 36",
31995
- inc_unit: 8000,
31996
- inc_roi: 1.2
31997
- }, {
31998
- label: "Vendor Selling Event: Week 34",
31999
- inc_unit: 8000,
32000
- inc_roi: 0.7
32001
- }, {
32002
- label: "Vendor Selling Event: Week 35",
32003
- inc_unit: 8000,
32004
- inc_roi: 0.8
32005
- }, {
32006
- label: "Vendor Selling Event: Week 38",
32007
- inc_unit: 9000,
32008
- inc_roi: 1.1
32009
- }];
31959
+ function InnerBarChart({
31960
+ data = []
31961
+ }) {
31962
+ const processedData = data.map(item => {
31963
+ const parts = item.label.replace("Vendor Selling Event:", "").trim();
31964
+ return {
31965
+ ...item,
31966
+ shortLabel: parts
31967
+ };
31968
+ });
32010
31969
  const format = v => v >= 1000 ? `${v / 1000}K` : v;
32011
- const CustomBarLabel = ({
32012
- x,
32013
- y,
32014
- width,
32015
- payload
32016
- }) => {
32017
- if (!payload || typeof payload.total === "undefined") {
32018
- console.error("Invalid payload:", payload);
32019
- return null;
32020
- }
32021
- const centerX = x + width / 2;
32022
- return /*#__PURE__*/React__default["default"].createElement("text", {
32023
- x: centerX,
32024
- y: Math.max(y - 8, 10),
32025
- textAnchor: "middle",
32026
- fill: "black"
32027
- }, format(payload.total));
32028
- };
32029
31970
  const BarWithInner = props => {
32030
31971
  const {
32031
31972
  x,
@@ -32080,27 +32021,16 @@ function InnerBarChart() {
32080
32021
  if (!active || !payload || !payload.length) return null;
32081
32022
  const data = payload[0].payload;
32082
32023
  return /*#__PURE__*/React__default["default"].createElement("div", {
32083
- style: {
32084
- background: "white",
32085
- border: "1px solid #ccc",
32086
- padding: "10px",
32087
- borderRadius: "8px",
32088
- fontSize: "14px"
32089
- }
32090
- }, /*#__PURE__*/React__default["default"].createElement("strong", null, label), /*#__PURE__*/React__default["default"].createElement("div", null, "Actual: ", format(data.actual)), /*#__PURE__*/React__default["default"].createElement("div", null, "Total: ", format(data.total)));
32024
+ className: "bg-white border border-gray-300 p-2 rounded-lg text-sm"
32025
+ }, /*#__PURE__*/React__default["default"].createElement("strong", null, data.label), /*#__PURE__*/React__default["default"].createElement("div", null, "Actual: ", format(data.actual)), /*#__PURE__*/React__default["default"].createElement("div", null, "Total: ", format(data.total)));
32091
32026
  };
32092
- const dataWithIndex = originalData.map((item, index) => ({
32093
- ...item,
32094
- index,
32095
- shortLabel: item.label.replace("Vendor Selling Event: ", "Wk ")
32096
- }));
32097
- const CustomizedTick = ({
32098
- x,
32099
- y,
32100
- payload
32101
- }) => {
32102
- const label = dataWithIndex[payload.value]?.label ?? "";
32103
- const parts = label.replace("Vendor Selling Event: ", "").split(" ");
32027
+ const CustomizedTick = props => {
32028
+ const {
32029
+ x,
32030
+ y,
32031
+ payload
32032
+ } = props;
32033
+ const labelText = payload.value.replace("Vendor Selling Event:", "").trim();
32104
32034
  return /*#__PURE__*/React__default["default"].createElement("g", {
32105
32035
  transform: `translate(${x},${y})`
32106
32036
  }, /*#__PURE__*/React__default["default"].createElement("text", {
@@ -32109,54 +32039,75 @@ function InnerBarChart() {
32109
32039
  dy: 16,
32110
32040
  textAnchor: "middle",
32111
32041
  fill: "#212121",
32112
- fontSize: 11,
32113
- fontWeight: "400",
32042
+ fontSize: 10,
32114
32043
  fontFamily: "Poppins"
32115
32044
  }, /*#__PURE__*/React__default["default"].createElement("tspan", {
32116
32045
  x: 0,
32117
- dy: 8
32118
- }, "Vendor Selling"), /*#__PURE__*/React__default["default"].createElement("tspan", {
32046
+ dy: "0.71em"
32047
+ }, "Vendor"), /*#__PURE__*/React__default["default"].createElement("tspan", {
32119
32048
  x: 0,
32120
- dy: 18
32121
- }, "Event: ", parts.join(" "))));
32049
+ dy: "1.2em"
32050
+ }, "Selling"), /*#__PURE__*/React__default["default"].createElement("tspan", {
32051
+ x: 0,
32052
+ dy: "1.2em"
32053
+ }, labelText)));
32122
32054
  };
32123
- return /*#__PURE__*/React__default["default"].createElement(recharts.ResponsiveContainer, {
32055
+ return /*#__PURE__*/React__default["default"].createElement("div", {
32056
+ className: "w-full"
32057
+ }, /*#__PURE__*/React__default["default"].createElement("h3", {
32058
+ className: "text-lg font-medium mb-4 text-center"
32059
+ }, "Vendor Selling Events Comparison"), /*#__PURE__*/React__default["default"].createElement(recharts.ResponsiveContainer, {
32124
32060
  width: "100%",
32125
- height: 400
32061
+ height: 450
32126
32062
  }, /*#__PURE__*/React__default["default"].createElement(recharts.BarChart, {
32127
- data: data,
32063
+ data: processedData,
32128
32064
  margin: {
32129
- top: 20,
32065
+ top: 30,
32130
32066
  right: 30,
32131
32067
  left: 20,
32132
- bottom: 10
32068
+ bottom: 60
32133
32069
  }
32134
32070
  }, /*#__PURE__*/React__default["default"].createElement(recharts.CartesianGrid, {
32135
32071
  strokeDasharray: "3 3",
32136
32072
  vertical: false
32137
32073
  }), /*#__PURE__*/React__default["default"].createElement(recharts.XAxis, {
32138
- dataKey: "week",
32139
- tick: /*#__PURE__*/React__default["default"].createElement(CustomizedTick, null)
32074
+ dataKey: "shortLabel",
32075
+ tick: /*#__PURE__*/React__default["default"].createElement(CustomizedTick, null),
32076
+ height: 70,
32077
+ interval: 0
32140
32078
  }), /*#__PURE__*/React__default["default"].createElement(recharts.YAxis, {
32141
32079
  type: "number",
32142
32080
  domain: [0, "dataMax + 2000"],
32143
- hide: true
32081
+ tickFormatter: format
32144
32082
  }), /*#__PURE__*/React__default["default"].createElement(recharts.Tooltip, {
32145
32083
  content: /*#__PURE__*/React__default["default"].createElement(CustomTooltip, null)
32146
32084
  }), /*#__PURE__*/React__default["default"].createElement(recharts.Brush, {
32147
32085
  height: 30,
32148
32086
  travellerWidth: 10,
32149
- startIndex: 1,
32087
+ startIndex: 0,
32150
32088
  endIndex: 5,
32151
- y: 369
32089
+ y: 380
32152
32090
  }), /*#__PURE__*/React__default["default"].createElement(recharts.Bar, {
32153
32091
  dataKey: "total",
32154
32092
  shape: /*#__PURE__*/React__default["default"].createElement(BarWithInner, null),
32155
- label: /*#__PURE__*/React__default["default"].createElement(CustomBarLabel, null),
32156
- barSize: 30
32157
- })));
32093
+ barSize: 36
32094
+ }))));
32158
32095
  }
32159
32096
 
32097
+ const Container = styled__default["default"].div`
32098
+ width: ${props => props.width};
32099
+ height: ${props => props.height};
32100
+ padding: 15px;
32101
+ display: flex;
32102
+ flex-direction: column;
32103
+ #Segment {
32104
+ width: auto;
32105
+ white-space: nowrap;
32106
+ font-size: 14px;
32107
+ font-weight: 500;
32108
+ font-family: "Poppins"
32109
+ }
32110
+ `;
32160
32111
  styled__default["default"].div`
32161
32112
  font-family: sans-serif;
32162
32113
  text-align: center;
@@ -32173,49 +32124,22 @@ styled__default["default"].div`
32173
32124
  flex-direction: column;
32174
32125
  background-color: white;
32175
32126
  `;
32176
- const Container = styled__default["default"].div`
32177
- width: 100%;
32178
- height: 100%;
32179
- display: flex;
32180
- flex-direction: column;
32181
- #Segment {
32182
- width: auto;
32183
- white-space: nowrap;
32184
- font-size: 14px;
32185
- font-weight: 500;
32186
- font-family: "Poppins"
32187
- }
32188
- `;
32189
- /* Make brush background darker */
32190
- /* .recharts-brush .recharts-brush-slide {
32191
- fill: #a52a2a !important;
32192
- stroke: none;
32193
- }
32194
-
32195
- /* Style draggable handles (travellers) */
32196
- /* .recharts-brush-traveller {
32197
- fill: limegreen !important; /* bright green like in the image */
32198
- /* cursor: ew-resize;
32199
- } */
32200
-
32201
- /* Optional: center grip arrows (you can fake it with CSS) */
32202
- /* .recharts-brush .recharts-brush-traveller > rect {
32203
- rx: 2;
32204
- ry: 2;
32205
- width: 6;
32206
- fill: #a52a2a !important; /* dark gray */
32207
- /* } */
32208
32127
 
32209
- /* Remove tick labels if needed */
32210
- // .recharts-brush .recharts-layer text {
32211
- // display: none;
32212
- // }
32213
-
32214
- const BrushChart = () => {
32128
+ const BrushChart = props => {
32129
+ const {
32130
+ width,
32131
+ height,
32132
+ data,
32133
+ barlineData,
32134
+ lineChartData
32135
+ } = props;
32215
32136
  const segmentedbuttonOptions = ["New Shoppers & Repeaters", "INC Sales & ROI", "INC Units", "Basket Lift"];
32216
32137
  const [selectedOption, setSelectedOption] = React$1.useState(segmentedbuttonOptions[0]);
32217
- return /*#__PURE__*/React__default["default"].createElement(Container, null, /*#__PURE__*/React__default["default"].createElement(SegmentedButton, {
32218
- gap: '8px',
32138
+ return /*#__PURE__*/React__default["default"].createElement(Container, {
32139
+ height: height,
32140
+ width: width
32141
+ }, /*#__PURE__*/React__default["default"].createElement(SegmentedButton, {
32142
+ gap: "8px",
32219
32143
  options: segmentedbuttonOptions.map(value => ({
32220
32144
  value
32221
32145
  })),
@@ -32225,7 +32149,15 @@ const BrushChart = () => {
32225
32149
  } = _ref;
32226
32150
  return setSelectedOption(value);
32227
32151
  }
32228
- }), selectedOption === "New Shoppers & Repeaters" && /*#__PURE__*/React__default["default"].createElement(InnerBarChart, null), selectedOption === "INC Sales & ROI" && /*#__PURE__*/React__default["default"].createElement(SeparatedLineBarChart, null), selectedOption === "INC Units" && /*#__PURE__*/React__default["default"].createElement(SingleChart, null), selectedOption === "Basket Lift" && /*#__PURE__*/React__default["default"].createElement(SingleChart, null));
32152
+ }), selectedOption === "New Shoppers & Repeaters" && /*#__PURE__*/React__default["default"].createElement(InnerBarChart, {
32153
+ data: data
32154
+ }), selectedOption === "INC Sales & ROI" && /*#__PURE__*/React__default["default"].createElement(SeparatedLineBarChart, {
32155
+ barlineData: barlineData
32156
+ }), selectedOption === "INC Units" && /*#__PURE__*/React__default["default"].createElement(SingleChart, {
32157
+ lineChartData: lineChartData
32158
+ }), selectedOption === "Basket Lift" && /*#__PURE__*/React__default["default"].createElement(SingleChart, {
32159
+ lineChartData: lineChartData
32160
+ }));
32229
32161
  };
32230
32162
 
32231
32163
  exports.AreaChart = AreaChart;