@ammarkhalidfarooq/dashboard-package 0.6.79 → 0.6.81
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 +78 -18
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +78 -18
- package/dist/index.es.js.map +1 -1
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -6486,6 +6486,38 @@ var PaidDonorGeographyCard = function PaidDonorGeographyCard(_ref8) {
|
|
|
6486
6486
|
});
|
|
6487
6487
|
};
|
|
6488
6488
|
|
|
6489
|
+
var formatCategoryLabel$1 = function formatCategoryLabel(val) {
|
|
6490
|
+
if (!val || typeof val !== "string") return val;
|
|
6491
|
+
var ddMmYyyy = val.match(/^(\d{2})-(\d{2})-(\d{4})$/);
|
|
6492
|
+
if (ddMmYyyy) {
|
|
6493
|
+
var _ddMmYyyy = _slicedToArray(ddMmYyyy, 4),
|
|
6494
|
+
day = _ddMmYyyy[1],
|
|
6495
|
+
month = _ddMmYyyy[2],
|
|
6496
|
+
year = _ddMmYyyy[3];
|
|
6497
|
+
var _date = new Date(Number(year), Number(month) - 1, Number(day));
|
|
6498
|
+
if (!Number.isNaN(_date.getTime())) {
|
|
6499
|
+
return _date.toLocaleDateString("en-US", {
|
|
6500
|
+
month: "short",
|
|
6501
|
+
day: "numeric"
|
|
6502
|
+
});
|
|
6503
|
+
}
|
|
6504
|
+
}
|
|
6505
|
+
var date = new Date(val);
|
|
6506
|
+
if (!Number.isNaN(date.getTime())) {
|
|
6507
|
+
return date.toLocaleDateString("en-US", {
|
|
6508
|
+
month: "short",
|
|
6509
|
+
day: "numeric"
|
|
6510
|
+
});
|
|
6511
|
+
}
|
|
6512
|
+
return val;
|
|
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
|
+
};
|
|
6489
6521
|
var RefundsChargebacksCard = function RefundsChargebacksCard(_ref) {
|
|
6490
6522
|
var sx = _ref.sx,
|
|
6491
6523
|
_ref$refundsChargebac = _ref.refundsChargebacksData,
|
|
@@ -6520,6 +6552,8 @@ var RefundsChargebacksCard = function RefundsChargebacksCard(_ref) {
|
|
|
6520
6552
|
var dataMax = Math.max.apply(Math, [0].concat(_toConsumableArray(chargebackSeries), _toConsumableArray(refundSeries)));
|
|
6521
6553
|
var hasChartData = dataMax > 0;
|
|
6522
6554
|
var yAxisMax = hasChartData ? Math.ceil(Math.max(dataMax, 1) * 1.2) : 0.5;
|
|
6555
|
+
var showAxisLabels = categories.length <= 15;
|
|
6556
|
+
var axisLabels = showAxisLabels ? buildAxisLabels(categories) : [];
|
|
6523
6557
|
var chartOptions = {
|
|
6524
6558
|
chart: {
|
|
6525
6559
|
type: "area",
|
|
@@ -6561,18 +6595,17 @@ var RefundsChargebacksCard = function RefundsChargebacksCard(_ref) {
|
|
|
6561
6595
|
show: false
|
|
6562
6596
|
},
|
|
6563
6597
|
labels: {
|
|
6564
|
-
show:
|
|
6565
|
-
rotate: -45,
|
|
6566
|
-
style: {
|
|
6567
|
-
colors: "rgba(0, 0, 0, 0.4)",
|
|
6568
|
-
fontSize: "10px"
|
|
6569
|
-
}
|
|
6598
|
+
show: false
|
|
6570
6599
|
}
|
|
6571
6600
|
},
|
|
6572
|
-
yaxis: {
|
|
6601
|
+
yaxis: _objectSpread2(_objectSpread2({
|
|
6573
6602
|
min: 0,
|
|
6574
|
-
max: yAxisMax
|
|
6575
|
-
|
|
6603
|
+
max: yAxisMax
|
|
6604
|
+
}, hasChartData ? {
|
|
6605
|
+
tickAmount: 4
|
|
6606
|
+
} : {
|
|
6607
|
+
stepSize: 0.25
|
|
6608
|
+
}), {}, {
|
|
6576
6609
|
labels: {
|
|
6577
6610
|
formatter: function formatter(val) {
|
|
6578
6611
|
return "".concat(parseFloat(val.toFixed(1)), "%");
|
|
@@ -6586,7 +6619,7 @@ var RefundsChargebacksCard = function RefundsChargebacksCard(_ref) {
|
|
|
6586
6619
|
fontSize: "11px"
|
|
6587
6620
|
}
|
|
6588
6621
|
}
|
|
6589
|
-
},
|
|
6622
|
+
}),
|
|
6590
6623
|
grid: {
|
|
6591
6624
|
borderColor: "#f1f1f1",
|
|
6592
6625
|
strokeDashArray: 4,
|
|
@@ -6626,6 +6659,12 @@ var RefundsChargebacksCard = function RefundsChargebacksCard(_ref) {
|
|
|
6626
6659
|
} : {},
|
|
6627
6660
|
tooltip: {
|
|
6628
6661
|
shared: true,
|
|
6662
|
+
x: {
|
|
6663
|
+
formatter: function formatter(_, _ref2) {
|
|
6664
|
+
var dataPointIndex = _ref2.dataPointIndex;
|
|
6665
|
+
return formatCategoryLabel$1(categories[dataPointIndex]);
|
|
6666
|
+
}
|
|
6667
|
+
},
|
|
6629
6668
|
y: {
|
|
6630
6669
|
formatter: function formatter(val) {
|
|
6631
6670
|
return "".concat(parseFloat(val.toFixed(2)), "%");
|
|
@@ -6796,18 +6835,39 @@ var RefundsChargebacksCard = function RefundsChargebacksCard(_ref) {
|
|
|
6796
6835
|
},
|
|
6797
6836
|
children: ["$", fmt(totalRefundedAmount), " refunded \xB7 ", totalChargebacks, " chargebacks \xB7 ", totalRefunds, " refunds"]
|
|
6798
6837
|
})
|
|
6799
|
-
}), /*#__PURE__*/
|
|
6838
|
+
}), /*#__PURE__*/jsxs(Box, {
|
|
6800
6839
|
sx: {
|
|
6801
|
-
height: 140,
|
|
6802
6840
|
width: "100%",
|
|
6803
6841
|
flexShrink: 0
|
|
6804
6842
|
},
|
|
6805
|
-
children: /*#__PURE__*/jsx(
|
|
6806
|
-
|
|
6807
|
-
|
|
6808
|
-
|
|
6809
|
-
|
|
6810
|
-
|
|
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
|
+
})]
|
|
6811
6871
|
})]
|
|
6812
6872
|
});
|
|
6813
6873
|
};
|