@ammarkhalidfarooq/dashboard-package 0.6.80 → 0.6.82

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.es.js CHANGED
@@ -2750,7 +2750,7 @@ var PageHeader = function PageHeader(_ref12) {
2750
2750
  fontWeight: 700,
2751
2751
  letterSpacing: "0.3px"
2752
2752
  },
2753
- children: "ACTIVE FILTERS:"
2753
+ children: "Active Filters:"
2754
2754
  }), " ", /*#__PURE__*/jsx("span", {
2755
2755
  style: {
2756
2756
  fontWeight: 500,
@@ -6511,6 +6511,13 @@ var formatCategoryLabel$1 = function formatCategoryLabel(val) {
6511
6511
  }
6512
6512
  return val;
6513
6513
  };
6514
+ var buildAxisLabels = function buildAxisLabels(categories) {
6515
+ if (categories.length <= 1) return categories.map(formatCategoryLabel$1);
6516
+ if (categories.length === 2) {
6517
+ return [formatCategoryLabel$1(categories[0]), formatCategoryLabel$1(categories[categories.length - 1])];
6518
+ }
6519
+ return [formatCategoryLabel$1(categories[0]), formatCategoryLabel$1(categories[Math.floor(categories.length / 2)]), formatCategoryLabel$1(categories[categories.length - 1])];
6520
+ };
6514
6521
  var RefundsChargebacksCard = function RefundsChargebacksCard(_ref) {
6515
6522
  var sx = _ref.sx,
6516
6523
  _ref$refundsChargebac = _ref.refundsChargebacksData,
@@ -6545,8 +6552,8 @@ var RefundsChargebacksCard = function RefundsChargebacksCard(_ref) {
6545
6552
  var dataMax = Math.max.apply(Math, [0].concat(_toConsumableArray(chargebackSeries), _toConsumableArray(refundSeries)));
6546
6553
  var hasChartData = dataMax > 0;
6547
6554
  var yAxisMax = hasChartData ? Math.ceil(Math.max(dataMax, 1) * 1.2) : 0.5;
6548
- var showXAxisLabels = categories.length <= 15;
6549
- var yAxisTickAmount = hasChartData ? 4 : 2;
6555
+ var showAxisLabels = categories.length <= 15;
6556
+ var axisLabels = showAxisLabels ? buildAxisLabels(categories) : [];
6550
6557
  var chartOptions = {
6551
6558
  chart: {
6552
6559
  type: "area",
@@ -6581,7 +6588,6 @@ var RefundsChargebacksCard = function RefundsChargebacksCard(_ref) {
6581
6588
  },
6582
6589
  xaxis: {
6583
6590
  categories: categories,
6584
- tickAmount: 5,
6585
6591
  axisBorder: {
6586
6592
  show: false
6587
6593
  },
@@ -6589,20 +6595,17 @@ var RefundsChargebacksCard = function RefundsChargebacksCard(_ref) {
6589
6595
  show: false
6590
6596
  },
6591
6597
  labels: {
6592
- show: showXAxisLabels,
6593
- rotate: 0,
6594
- hideOverlappingLabels: true,
6595
- formatter: formatCategoryLabel$1,
6596
- style: {
6597
- colors: "rgba(0, 0, 0, 0.4)",
6598
- fontSize: "10px"
6599
- }
6598
+ show: false
6600
6599
  }
6601
6600
  },
6602
- yaxis: {
6601
+ yaxis: _objectSpread2(_objectSpread2({
6603
6602
  min: 0,
6604
- max: yAxisMax,
6605
- tickAmount: yAxisTickAmount,
6603
+ max: yAxisMax
6604
+ }, hasChartData ? {
6605
+ tickAmount: 4
6606
+ } : {
6607
+ stepSize: 0.25
6608
+ }), {}, {
6606
6609
  labels: {
6607
6610
  formatter: function formatter(val) {
6608
6611
  return "".concat(parseFloat(val.toFixed(1)), "%");
@@ -6616,7 +6619,7 @@ var RefundsChargebacksCard = function RefundsChargebacksCard(_ref) {
6616
6619
  fontSize: "11px"
6617
6620
  }
6618
6621
  }
6619
- },
6622
+ }),
6620
6623
  grid: {
6621
6624
  borderColor: "#f1f1f1",
6622
6625
  strokeDashArray: 4,
@@ -6832,18 +6835,39 @@ var RefundsChargebacksCard = function RefundsChargebacksCard(_ref) {
6832
6835
  },
6833
6836
  children: ["$", fmt(totalRefundedAmount), " refunded \xB7 ", totalChargebacks, " chargebacks \xB7 ", totalRefunds, " refunds"]
6834
6837
  })
6835
- }), /*#__PURE__*/jsx(Box, {
6838
+ }), /*#__PURE__*/jsxs(Box, {
6836
6839
  sx: {
6837
- height: showXAxisLabels ? 160 : 140,
6838
6840
  width: "100%",
6839
6841
  flexShrink: 0
6840
6842
  },
6841
- children: /*#__PURE__*/jsx(ReactApexChart, {
6842
- options: chartOptions,
6843
- series: series,
6844
- type: "area",
6845
- height: "100%"
6846
- })
6843
+ children: [/*#__PURE__*/jsx(Box, {
6844
+ sx: {
6845
+ height: 140
6846
+ },
6847
+ children: /*#__PURE__*/jsx(ReactApexChart, {
6848
+ options: chartOptions,
6849
+ series: series,
6850
+ type: "area",
6851
+ height: "100%"
6852
+ })
6853
+ }), axisLabels.length > 0 && /*#__PURE__*/jsx(Box, {
6854
+ sx: {
6855
+ display: "flex",
6856
+ justifyContent: "space-between",
6857
+ mt: 0.5,
6858
+ pl: 3,
6859
+ pr: 0.75
6860
+ },
6861
+ children: axisLabels.map(function (label, idx) {
6862
+ return /*#__PURE__*/jsx(Typography, {
6863
+ sx: {
6864
+ fontSize: "10px",
6865
+ color: "rgba(0, 0, 0, 0.4)"
6866
+ },
6867
+ children: label
6868
+ }, "".concat(label, "-").concat(idx));
6869
+ })
6870
+ })]
6847
6871
  })]
6848
6872
  });
6849
6873
  };