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