@ammarkhalidfarooq/dashboard-package 0.6.106 → 0.6.107

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
@@ -9,6 +9,7 @@ var Grid = require('@mui/material/Grid');
9
9
  var Box = require('@mui/material/Box');
10
10
  var Typography = require('@mui/material/Typography');
11
11
  var ReactApexChart = require('react-apexcharts');
12
+ var CloseIcon = require('@mui/icons-material/Close');
12
13
 
13
14
  var theme = styles.createTheme({
14
15
  cssVariables: true,
@@ -7043,6 +7044,154 @@ var RefundsChargebacksCard = function RefundsChargebacksCard(_ref) {
7043
7044
  });
7044
7045
  };
7045
7046
 
7047
+ var BORDER$1 = "1px solid #e0e0e0";
7048
+ var headerCellSx$1 = {
7049
+ fontWeight: 700,
7050
+ fontSize: "0.78rem",
7051
+ color: "#111",
7052
+ bgcolor: "#f3f3f3",
7053
+ borderBottom: BORDER$1,
7054
+ borderRight: BORDER$1,
7055
+ py: "12px",
7056
+ px: "16px",
7057
+ lineHeight: 1.4,
7058
+ textAlign: "left",
7059
+ "&:last-child": {
7060
+ borderRight: 0
7061
+ }
7062
+ };
7063
+ var cellSx$1 = {
7064
+ fontSize: "0.85rem",
7065
+ color: "#333",
7066
+ borderBottom: BORDER$1,
7067
+ borderRight: BORDER$1,
7068
+ py: "12px",
7069
+ px: "16px",
7070
+ verticalAlign: "middle",
7071
+ textAlign: "left",
7072
+ "&:last-child": {
7073
+ borderRight: 0
7074
+ }
7075
+ };
7076
+ var MOCK_ROWS = [{
7077
+ date: "Jun 1, 2026",
7078
+ campaignName: "Ramadan 2024 - Global Feed",
7079
+ raised: "$4,520.00"
7080
+ }, {
7081
+ date: "Jun 2, 2026",
7082
+ campaignName: "Water for Life - East Africa",
7083
+ raised: "$1,280.00"
7084
+ }, {
7085
+ date: "Jun 3, 2026",
7086
+ campaignName: "Orphan Care - Palestine",
7087
+ raised: "$2,850.00"
7088
+ }, {
7089
+ date: "Jun 4, 2026",
7090
+ campaignName: "Emergency Relief - Yemen",
7091
+ raised: "$1,540.00"
7092
+ }, {
7093
+ date: "Jun 5, 2026",
7094
+ campaignName: "Education Fund - Syria",
7095
+ raised: "$980.00"
7096
+ }, {
7097
+ date: "Jun 6, 2026",
7098
+ campaignName: "Medical Aid - Gaza",
7099
+ raised: "$3,120.00"
7100
+ }, {
7101
+ date: "Jun 7, 2026",
7102
+ campaignName: "Food Security - Sudan",
7103
+ raised: "$760.00"
7104
+ }];
7105
+ var OverallDetailModal = function OverallDetailModal(_ref) {
7106
+ var open = _ref.open,
7107
+ title = _ref.title,
7108
+ onClose = _ref.onClose;
7109
+ return /*#__PURE__*/jsxRuntime.jsxs(material.Dialog, {
7110
+ open: open,
7111
+ onClose: onClose,
7112
+ maxWidth: "md",
7113
+ fullWidth: true,
7114
+ children: [/*#__PURE__*/jsxRuntime.jsxs(material.DialogTitle, {
7115
+ sx: {
7116
+ display: "flex",
7117
+ alignItems: "center",
7118
+ justifyContent: "space-between",
7119
+ pr: 1,
7120
+ pb: 1
7121
+ },
7122
+ children: [/*#__PURE__*/jsxRuntime.jsxs(material.Box, {
7123
+ children: [/*#__PURE__*/jsxRuntime.jsx(material.Typography, {
7124
+ sx: {
7125
+ fontWeight: 700,
7126
+ fontSize: "18px",
7127
+ color: "#000"
7128
+ },
7129
+ children: title
7130
+ }), /*#__PURE__*/jsxRuntime.jsx(material.Typography, {
7131
+ sx: {
7132
+ fontSize: "13px",
7133
+ color: "rgba(0, 0, 0, 0.45)",
7134
+ mt: 0.25
7135
+ },
7136
+ children: "Campaign breakdown"
7137
+ })]
7138
+ }), /*#__PURE__*/jsxRuntime.jsx(material.IconButton, {
7139
+ "aria-label": "Close",
7140
+ onClick: onClose,
7141
+ size: "small",
7142
+ children: /*#__PURE__*/jsxRuntime.jsx(CloseIcon, {})
7143
+ })]
7144
+ }), /*#__PURE__*/jsxRuntime.jsx(material.DialogContent, {
7145
+ sx: {
7146
+ pt: 0
7147
+ },
7148
+ children: /*#__PURE__*/jsxRuntime.jsx(material.TableContainer, {
7149
+ sx: {
7150
+ border: BORDER$1,
7151
+ borderRadius: "12px",
7152
+ overflow: "hidden"
7153
+ },
7154
+ children: /*#__PURE__*/jsxRuntime.jsxs(material.Table, {
7155
+ children: [/*#__PURE__*/jsxRuntime.jsx(material.TableHead, {
7156
+ children: /*#__PURE__*/jsxRuntime.jsxs(material.TableRow, {
7157
+ children: [/*#__PURE__*/jsxRuntime.jsx(material.TableCell, {
7158
+ sx: headerCellSx$1,
7159
+ children: "Date"
7160
+ }), /*#__PURE__*/jsxRuntime.jsx(material.TableCell, {
7161
+ sx: headerCellSx$1,
7162
+ children: "Campaign Name"
7163
+ }), /*#__PURE__*/jsxRuntime.jsx(material.TableCell, {
7164
+ sx: _objectSpread2(_objectSpread2({}, headerCellSx$1), {}, {
7165
+ textAlign: "right"
7166
+ }),
7167
+ children: "Raised"
7168
+ })]
7169
+ })
7170
+ }), /*#__PURE__*/jsxRuntime.jsx(material.TableBody, {
7171
+ children: MOCK_ROWS.map(function (row) {
7172
+ return /*#__PURE__*/jsxRuntime.jsxs(material.TableRow, {
7173
+ children: [/*#__PURE__*/jsxRuntime.jsx(material.TableCell, {
7174
+ sx: cellSx$1,
7175
+ children: row.date
7176
+ }), /*#__PURE__*/jsxRuntime.jsx(material.TableCell, {
7177
+ sx: cellSx$1,
7178
+ children: row.campaignName
7179
+ }), /*#__PURE__*/jsxRuntime.jsx(material.TableCell, {
7180
+ sx: _objectSpread2(_objectSpread2({}, cellSx$1), {}, {
7181
+ textAlign: "right",
7182
+ fontWeight: 600
7183
+ }),
7184
+ children: row.raised
7185
+ })]
7186
+ }, "".concat(row.date, "-").concat(row.campaignName));
7187
+ })
7188
+ })]
7189
+ })
7190
+ })
7191
+ })]
7192
+ });
7193
+ };
7194
+
7046
7195
  var CARD_SX = {
7047
7196
  maxHeight: 280
7048
7197
  };
@@ -7090,7 +7239,30 @@ var OverallDetailsGrid = function OverallDetailsGrid(_ref) {
7090
7239
  _ref.dateName;
7091
7240
  var _ref$numberOfDays = _ref.numberOfDays,
7092
7241
  numberOfDays = _ref$numberOfDays === void 0 ? 30 : _ref$numberOfDays;
7242
+ var _useState = React.useState(null),
7243
+ _useState2 = _slicedToArray(_useState, 2),
7244
+ modalTitle = _useState2[0],
7245
+ setModalTitle = _useState2[1];
7093
7246
  var daysLabel = "".concat(numberOfDays, " day").concat(numberOfDays === 1 ? "" : "s");
7247
+ var openDetailModal = function openDetailModal(title) {
7248
+ if (!exportMode) {
7249
+ setModalTitle(title);
7250
+ }
7251
+ };
7252
+ var closeDetailModal = function closeDetailModal() {
7253
+ return setModalTitle(null);
7254
+ };
7255
+ var withCardClick = function withCardClick(title, card) {
7256
+ return exportMode ? card : /*#__PURE__*/jsxRuntime.jsx(material.Box, {
7257
+ onClick: function onClick() {
7258
+ return openDetailModal(title);
7259
+ },
7260
+ sx: {
7261
+ height: "100%"
7262
+ },
7263
+ children: card
7264
+ });
7265
+ };
7094
7266
  var _donorMix$newDonors = donorMix.newDonors,
7095
7267
  newDonors = _donorMix$newDonors === void 0 ? 0 : _donorMix$newDonors,
7096
7268
  _donorMix$returningDo = donorMix.returningDonors,
@@ -7153,12 +7325,12 @@ var OverallDetailsGrid = function OverallDetailsGrid(_ref) {
7153
7325
  sx: {
7154
7326
  paddingTop: "0px !important"
7155
7327
  },
7156
- children: /*#__PURE__*/jsxRuntime.jsx(ActiveCampaignsCard, {
7328
+ children: withCardClick("Active Campaigns", /*#__PURE__*/jsxRuntime.jsx(ActiveCampaignsCard, {
7157
7329
  title: "Active Campaigns",
7158
7330
  subtitle: "Live fundraisers ranked by velocity",
7159
7331
  columns: ["Campaign", "Raised", "Progress", "Donors", "Avg gift"],
7160
7332
  rows: activeCampaignsRows
7161
- })
7333
+ }))
7162
7334
  }), /*#__PURE__*/jsxRuntime.jsx(material.Grid, {
7163
7335
  item: true,
7164
7336
  xs: 12,
@@ -7171,7 +7343,7 @@ var OverallDetailsGrid = function OverallDetailsGrid(_ref) {
7171
7343
  md: 0
7172
7344
  }
7173
7345
  },
7174
- children: /*#__PURE__*/jsxRuntime.jsx(DonorMixCard, {
7346
+ children: withCardClick("Donor Mix", /*#__PURE__*/jsxRuntime.jsx(DonorMixCard, {
7175
7347
  title: "Donor Mix",
7176
7348
  subtitle: "Acquisition vs retention",
7177
7349
  series: [newDonors, returningDonors],
@@ -7193,29 +7365,29 @@ var OverallDetailsGrid = function OverallDetailsGrid(_ref) {
7193
7365
  sx: {
7194
7366
  width: "100%"
7195
7367
  }
7196
- })
7368
+ }))
7197
7369
  })]
7198
7370
  });
7199
7371
  var middleCards = /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
7200
- children: [/*#__PURE__*/jsxRuntime.jsx(DonationTypeBarChart, {
7372
+ children: [withCardClick("Donation Type", /*#__PURE__*/jsxRuntime.jsx(DonationTypeBarChart, {
7201
7373
  sx: CARD_SX,
7202
7374
  donationTypeData: donationTypeData
7203
- }), /*#__PURE__*/jsxRuntime.jsx(PaidDonorGeographyCard, {
7375
+ })), withCardClick("Paid Donor Geography", /*#__PURE__*/jsxRuntime.jsx(PaidDonorGeographyCard, {
7204
7376
  sx: CARD_SX,
7205
7377
  donorGeographyData: donorGeographyData
7206
- }), /*#__PURE__*/jsxRuntime.jsx(RefundsChargebacksCard, {
7378
+ })), withCardClick("Refunds & Chargebacks", /*#__PURE__*/jsxRuntime.jsx(RefundsChargebacksCard, {
7207
7379
  sx: CARD_SX,
7208
7380
  refundsChargebacksData: refundsChargebacksData,
7209
7381
  numberOfDays: numberOfDays
7210
- }), /*#__PURE__*/jsxRuntime.jsx(TrafficSourceCard, {
7382
+ })), withCardClick("Traffic Source", /*#__PURE__*/jsxRuntime.jsx(TrafficSourceCard, {
7211
7383
  sx: CARD_SX,
7212
7384
  trafficSourceData: (trafficSourceData === null || trafficSourceData === void 0 ? void 0 : trafficSourceData.data) || [],
7213
7385
  total: "$".concat(formatNumber((trafficSourceData === null || trafficSourceData === void 0 ? void 0 : trafficSourceData.totalRevenue) || 0)),
7214
7386
  numberOfDays: numberOfDays
7215
- })]
7387
+ }))]
7216
7388
  });
7217
7389
  var bottomCards = /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
7218
- children: [/*#__PURE__*/jsxRuntime.jsx(MetricSparklineCard, {
7390
+ children: [withCardClick("Order Bump", /*#__PURE__*/jsxRuntime.jsx(MetricSparklineCard, {
7219
7391
  title: "Order Bump",
7220
7392
  subtitle: "Revenue trend - last ".concat(daysLabel),
7221
7393
  value: "$".concat(formatNumber((orderBumpData === null || orderBumpData === void 0 ? void 0 : orderBumpData.totalRevenue) || 0)),
@@ -7240,7 +7412,7 @@ var OverallDetailsGrid = function OverallDetailsGrid(_ref) {
7240
7412
  }],
7241
7413
  sx: CARD_SX,
7242
7414
  bottomSection: true
7243
- }), /*#__PURE__*/jsxRuntime.jsx(MetricDonutCard, {
7415
+ })), withCardClick("Upsell", /*#__PURE__*/jsxRuntime.jsx(MetricDonutCard, {
7244
7416
  title: "Upsell",
7245
7417
  subtitle: "Acceptance & raised",
7246
7418
  acceptanceRate: (upsellData === null || upsellData === void 0 ? void 0 : upsellData.acceptanceRate) || 0,
@@ -7249,7 +7421,7 @@ var OverallDetailsGrid = function OverallDetailsGrid(_ref) {
7249
7421
  raisedVal: "$".concat(formatNumber((upsellData === null || upsellData === void 0 ? void 0 : upsellData.raised) || 0)),
7250
7422
  raisedTrend: "".concat((upsellData === null || upsellData === void 0 ? void 0 : upsellData.raisedGrowth) >= 0 ? "▲" : "▼", " ").concat(Math.abs((upsellData === null || upsellData === void 0 ? void 0 : upsellData.raisedGrowth) || 0).toFixed(1), "%"),
7251
7423
  sx: CARD_SX
7252
- }), /*#__PURE__*/jsxRuntime.jsx(MetricDonutCard, {
7424
+ })), withCardClick("Downsell", /*#__PURE__*/jsxRuntime.jsx(MetricDonutCard, {
7253
7425
  title: "Downsell",
7254
7426
  subtitle: "Acceptance & raised",
7255
7427
  acceptanceRate: (downsellData === null || downsellData === void 0 ? void 0 : downsellData.acceptanceRate) || 0,
@@ -7258,7 +7430,7 @@ var OverallDetailsGrid = function OverallDetailsGrid(_ref) {
7258
7430
  raisedVal: "$".concat(formatNumber((downsellData === null || downsellData === void 0 ? void 0 : downsellData.raised) || 0)),
7259
7431
  raisedTrend: "".concat((downsellData === null || downsellData === void 0 ? void 0 : downsellData.raisedGrowth) >= 0 ? "▲" : "▼", " ").concat(Math.abs((downsellData === null || downsellData === void 0 ? void 0 : downsellData.raisedGrowth) || 0).toFixed(1), "%"),
7260
7432
  sx: CARD_SX
7261
- }), /*#__PURE__*/jsxRuntime.jsx(MetricSparklineCard, {
7433
+ })), withCardClick("Referrals", /*#__PURE__*/jsxRuntime.jsx(MetricSparklineCard, {
7262
7434
  title: "Referrals",
7263
7435
  subtitle: "Revenue trend - last ".concat(daysLabel),
7264
7436
  value: "$".concat(formatNumber((referralData === null || referralData === void 0 ? void 0 : referralData.totalRevenue) || 0)),
@@ -7282,19 +7454,34 @@ var OverallDetailsGrid = function OverallDetailsGrid(_ref) {
7282
7454
  }],
7283
7455
  sx: CARD_SX,
7284
7456
  bottomSection: true
7285
- })]
7286
- });
7287
- if (section === "campaigns") return /*#__PURE__*/jsxRuntime.jsx(material.Box, {
7288
- children: campaignsRow
7289
- });
7290
- if (section === "middle") return /*#__PURE__*/jsxRuntime.jsx(material.Box, {
7291
- sx: fourColGridSx$1(exportMode),
7292
- children: middleCards
7457
+ }))]
7293
7458
  });
7294
- if (section === "bottom") return /*#__PURE__*/jsxRuntime.jsx(material.Box, {
7295
- sx: fourColGridSx$1(exportMode),
7296
- children: bottomCards
7459
+ var detailModal = /*#__PURE__*/jsxRuntime.jsx(OverallDetailModal, {
7460
+ open: Boolean(modalTitle),
7461
+ title: modalTitle || "",
7462
+ onClose: closeDetailModal
7297
7463
  });
7464
+ if (section === "campaigns") {
7465
+ return /*#__PURE__*/jsxRuntime.jsxs(material.Box, {
7466
+ children: [campaignsRow, detailModal]
7467
+ });
7468
+ }
7469
+ if (section === "middle") {
7470
+ return /*#__PURE__*/jsxRuntime.jsxs(material.Box, {
7471
+ children: [/*#__PURE__*/jsxRuntime.jsx(material.Box, {
7472
+ sx: fourColGridSx$1(exportMode),
7473
+ children: middleCards
7474
+ }), detailModal]
7475
+ });
7476
+ }
7477
+ if (section === "bottom") {
7478
+ return /*#__PURE__*/jsxRuntime.jsxs(material.Box, {
7479
+ children: [/*#__PURE__*/jsxRuntime.jsx(material.Box, {
7480
+ sx: fourColGridSx$1(exportMode),
7481
+ children: bottomCards
7482
+ }), detailModal]
7483
+ });
7484
+ }
7298
7485
  return /*#__PURE__*/jsxRuntime.jsxs(material.Box, {
7299
7486
  children: [campaignsRow, /*#__PURE__*/jsxRuntime.jsx(material.Box, {
7300
7487
  sx: fourColGridSx$1(exportMode),
@@ -7302,7 +7489,7 @@ var OverallDetailsGrid = function OverallDetailsGrid(_ref) {
7302
7489
  }), /*#__PURE__*/jsxRuntime.jsx(material.Box, {
7303
7490
  sx: fourColGridSx$1(exportMode),
7304
7491
  children: bottomCards
7305
- })]
7492
+ }), detailModal]
7306
7493
  });
7307
7494
  };
7308
7495