@ammarkhalidfarooq/dashboard-package 0.6.113 → 0.6.114

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,7 +9,6 @@ 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');
13
12
 
14
13
  var theme = styles.createTheme({
15
14
  cssVariables: true,
@@ -7056,316 +7055,6 @@ var RefundsChargebacksCard = function RefundsChargebacksCard(_ref) {
7056
7055
  });
7057
7056
  };
7058
7057
 
7059
- var BORDER$1 = "1px solid #e0e0e0";
7060
- var ROWS_PER_PAGE = 10;
7061
- var headerCellSx$1 = {
7062
- fontWeight: 700,
7063
- fontSize: "0.78rem",
7064
- color: "#111",
7065
- bgcolor: "#f3f3f3",
7066
- borderBottom: BORDER$1,
7067
- borderRight: BORDER$1,
7068
- py: "12px",
7069
- px: "16px",
7070
- lineHeight: 1.4,
7071
- textAlign: "left",
7072
- "&:last-child": {
7073
- borderRight: 0
7074
- }
7075
- };
7076
- var cellSx$1 = {
7077
- fontSize: "0.85rem",
7078
- color: "#333",
7079
- borderBottom: BORDER$1,
7080
- borderRight: BORDER$1,
7081
- py: "12px",
7082
- px: "16px",
7083
- verticalAlign: "middle",
7084
- textAlign: "left",
7085
- "&:last-child": {
7086
- borderRight: 0
7087
- }
7088
- };
7089
- var MOCK_ROWS = [{
7090
- date: "Jun 1, 2026",
7091
- campaignName: "Ramadan 2024 - Global Feed",
7092
- donorType: "New Donor",
7093
- raised: "$4,520.00"
7094
- }, {
7095
- date: "Jun 2, 2026",
7096
- campaignName: "Water for Life - East Africa",
7097
- donorType: "Returning",
7098
- raised: "$1,280.00"
7099
- }, {
7100
- date: "Jun 3, 2026",
7101
- campaignName: "Orphan Care - Palestine",
7102
- donorType: "New Donor",
7103
- raised: "$2,850.00"
7104
- }, {
7105
- date: "Jun 4, 2026",
7106
- campaignName: "Emergency Relief - Yemen",
7107
- donorType: "Returning",
7108
- raised: "$1,540.00"
7109
- }, {
7110
- date: "Jun 5, 2026",
7111
- campaignName: "Education Fund - Syria",
7112
- donorType: "New Donor",
7113
- raised: "$980.00"
7114
- }, {
7115
- date: "Jun 6, 2026",
7116
- campaignName: "Medical Aid - Gaza",
7117
- donorType: "Returning",
7118
- raised: "$3,120.00"
7119
- }, {
7120
- date: "Jun 7, 2026",
7121
- campaignName: "Food Security - Sudan",
7122
- donorType: "New Donor",
7123
- raised: "$760.00"
7124
- }, {
7125
- date: "Jun 8, 2026",
7126
- campaignName: "Winter Relief - Afghanistan",
7127
- donorType: "Returning",
7128
- raised: "$2,140.00"
7129
- }, {
7130
- date: "Jun 9, 2026",
7131
- campaignName: "Clean Water - Bangladesh",
7132
- donorType: "New Donor",
7133
- raised: "$890.00"
7134
- }, {
7135
- date: "Jun 10, 2026",
7136
- campaignName: "Shelter Fund - Lebanon",
7137
- donorType: "Returning",
7138
- raised: "$1,675.00"
7139
- }, {
7140
- date: "Jun 11, 2026",
7141
- campaignName: "Qurbani 2026 - Global",
7142
- donorType: "New Donor",
7143
- raised: "$5,230.00"
7144
- }, {
7145
- date: "Jun 12, 2026",
7146
- campaignName: "Maternal Health - Somalia",
7147
- donorType: "Returning",
7148
- raised: "$1,120.00"
7149
- }, {
7150
- date: "Jun 13, 2026",
7151
- campaignName: "School Supplies - Pakistan",
7152
- donorType: "New Donor",
7153
- raised: "$640.00"
7154
- }, {
7155
- date: "Jun 14, 2026",
7156
- campaignName: "Disaster Response - Turkey",
7157
- donorType: "Returning",
7158
- raised: "$3,890.00"
7159
- }, {
7160
- date: "Jun 15, 2026",
7161
- campaignName: "Zakat Distribution - UK",
7162
- donorType: "New Donor",
7163
- raised: "$2,450.00"
7164
- }, {
7165
- date: "Jun 16, 2026",
7166
- campaignName: "Eye Care - Morocco",
7167
- donorType: "Returning",
7168
- raised: "$780.00"
7169
- }, {
7170
- date: "Jun 17, 2026",
7171
- campaignName: "Livelihood Support - Iraq",
7172
- donorType: "New Donor",
7173
- raised: "$1,960.00"
7174
- }, {
7175
- date: "Jun 18, 2026",
7176
- campaignName: "Ramadan Iftar - Jordan",
7177
- donorType: "Returning",
7178
- raised: "$2,310.00"
7179
- }, {
7180
- date: "Jun 19, 2026",
7181
- campaignName: "Children's Fund - Nigeria",
7182
- donorType: "New Donor",
7183
- raised: "$1,430.00"
7184
- }, {
7185
- date: "Jun 20, 2026",
7186
- campaignName: "Housing Rebuild - Libya",
7187
- donorType: "Returning",
7188
- raised: "$3,050.00"
7189
- }];
7190
- var OverallDetailModal = function OverallDetailModal(_ref) {
7191
- var open = _ref.open,
7192
- title = _ref.title,
7193
- onClose = _ref.onClose;
7194
- var _useState = React.useState(1),
7195
- _useState2 = _slicedToArray(_useState, 2),
7196
- page = _useState2[0],
7197
- setPage = _useState2[1];
7198
- var totalPages = Math.ceil(MOCK_ROWS.length / ROWS_PER_PAGE);
7199
- React.useEffect(function () {
7200
- if (open) {
7201
- setPage(1);
7202
- }
7203
- }, [open, title]);
7204
- var paginatedRows = MOCK_ROWS.slice((page - 1) * ROWS_PER_PAGE, page * ROWS_PER_PAGE);
7205
- return /*#__PURE__*/jsxRuntime.jsxs(material.Dialog, {
7206
- open: open,
7207
- onClose: onClose,
7208
- maxWidth: "md",
7209
- fullWidth: true,
7210
- children: [/*#__PURE__*/jsxRuntime.jsxs(material.DialogTitle, {
7211
- sx: {
7212
- display: "flex",
7213
- alignItems: "center",
7214
- justifyContent: "space-between",
7215
- pr: 1,
7216
- pb: 1
7217
- },
7218
- children: [/*#__PURE__*/jsxRuntime.jsxs(material.Box, {
7219
- children: [/*#__PURE__*/jsxRuntime.jsx(material.Typography, {
7220
- sx: {
7221
- fontWeight: 700,
7222
- fontSize: "18px",
7223
- color: "#000"
7224
- },
7225
- children: title
7226
- }), /*#__PURE__*/jsxRuntime.jsx(material.Typography, {
7227
- sx: {
7228
- fontSize: "13px",
7229
- color: "rgba(0, 0, 0, 0.45)",
7230
- mt: 0.25
7231
- },
7232
- children: "Campaign breakdown"
7233
- })]
7234
- }), /*#__PURE__*/jsxRuntime.jsx(material.IconButton, {
7235
- "aria-label": "Close",
7236
- onClick: onClose,
7237
- size: "small",
7238
- children: /*#__PURE__*/jsxRuntime.jsx(CloseIcon, {})
7239
- })]
7240
- }), /*#__PURE__*/jsxRuntime.jsx(material.DialogContent, {
7241
- sx: {
7242
- pt: 0
7243
- },
7244
- children: /*#__PURE__*/jsxRuntime.jsxs(material.Box, {
7245
- sx: {
7246
- border: BORDER$1,
7247
- borderRadius: "12px",
7248
- overflow: "hidden"
7249
- },
7250
- children: [/*#__PURE__*/jsxRuntime.jsx(material.TableContainer, {
7251
- children: /*#__PURE__*/jsxRuntime.jsxs(material.Table, {
7252
- children: [/*#__PURE__*/jsxRuntime.jsx(material.TableHead, {
7253
- children: /*#__PURE__*/jsxRuntime.jsxs(material.TableRow, {
7254
- children: [/*#__PURE__*/jsxRuntime.jsx(material.TableCell, {
7255
- sx: headerCellSx$1,
7256
- children: "Date"
7257
- }), /*#__PURE__*/jsxRuntime.jsx(material.TableCell, {
7258
- sx: headerCellSx$1,
7259
- children: "Campaign Name"
7260
- }), /*#__PURE__*/jsxRuntime.jsx(material.TableCell, {
7261
- sx: headerCellSx$1,
7262
- children: "Donor Type"
7263
- }), /*#__PURE__*/jsxRuntime.jsx(material.TableCell, {
7264
- sx: _objectSpread2(_objectSpread2({}, headerCellSx$1), {}, {
7265
- textAlign: "right"
7266
- }),
7267
- children: "Raised"
7268
- })]
7269
- })
7270
- }), /*#__PURE__*/jsxRuntime.jsx(material.TableBody, {
7271
- children: paginatedRows.map(function (row) {
7272
- return /*#__PURE__*/jsxRuntime.jsxs(material.TableRow, {
7273
- children: [/*#__PURE__*/jsxRuntime.jsx(material.TableCell, {
7274
- sx: cellSx$1,
7275
- children: row.date
7276
- }), /*#__PURE__*/jsxRuntime.jsx(material.TableCell, {
7277
- sx: cellSx$1,
7278
- children: row.campaignName
7279
- }), /*#__PURE__*/jsxRuntime.jsx(material.TableCell, {
7280
- sx: cellSx$1,
7281
- children: row.donorType
7282
- }), /*#__PURE__*/jsxRuntime.jsx(material.TableCell, {
7283
- sx: _objectSpread2(_objectSpread2({}, cellSx$1), {}, {
7284
- textAlign: "right",
7285
- fontWeight: 600
7286
- }),
7287
- children: row.raised
7288
- })]
7289
- }, "".concat(row.date, "-").concat(row.campaignName));
7290
- })
7291
- })]
7292
- })
7293
- }), /*#__PURE__*/jsxRuntime.jsxs(material.Box, {
7294
- sx: {
7295
- display: "flex",
7296
- alignItems: "center",
7297
- justifyContent: "space-between",
7298
- px: 2,
7299
- py: 1.5,
7300
- borderTop: BORDER$1
7301
- },
7302
- children: [/*#__PURE__*/jsxRuntime.jsxs(material.Box, {
7303
- sx: {
7304
- display: "flex",
7305
- gap: 0.5
7306
- },
7307
- children: [Array.from({
7308
- length: totalPages
7309
- }, function (_, index) {
7310
- return index + 1;
7311
- }).map(function (pageNumber) {
7312
- return /*#__PURE__*/jsxRuntime.jsx(material.Box, {
7313
- onClick: function onClick() {
7314
- return setPage(pageNumber);
7315
- },
7316
- sx: {
7317
- width: 32,
7318
- height: 32,
7319
- display: "flex",
7320
- alignItems: "center",
7321
- justifyContent: "center",
7322
- borderRadius: "6px",
7323
- cursor: "pointer",
7324
- fontSize: "13px",
7325
- fontWeight: page === pageNumber ? 700 : 400,
7326
- bgcolor: page === pageNumber ? "primary.main" : "transparent",
7327
- color: page === pageNumber ? "#fff" : "#333",
7328
- border: page === pageNumber ? "none" : "1px solid ".concat(BORDER$1),
7329
- "&:hover": {
7330
- bgcolor: page === pageNumber ? "primary.main" : "#f5f5f5"
7331
- }
7332
- },
7333
- children: pageNumber
7334
- }, pageNumber);
7335
- }), page < totalPages && /*#__PURE__*/jsxRuntime.jsx(material.Box, {
7336
- onClick: function onClick() {
7337
- return setPage(function (current) {
7338
- return Math.min(current + 1, totalPages);
7339
- });
7340
- },
7341
- sx: {
7342
- px: 1.5,
7343
- height: 32,
7344
- display: "flex",
7345
- alignItems: "center",
7346
- gap: 0.5,
7347
- borderRadius: "6px",
7348
- cursor: "pointer",
7349
- fontSize: "13px",
7350
- color: "#333",
7351
- border: "1px solid ".concat(BORDER$1),
7352
- "&:hover": {
7353
- bgcolor: "#f5f5f5"
7354
- }
7355
- },
7356
- children: "Next \u203A"
7357
- })]
7358
- }), /*#__PURE__*/jsxRuntime.jsxs(material.Typography, {
7359
- variant: "caption",
7360
- color: "text.secondary",
7361
- children: [MOCK_ROWS.length, " records"]
7362
- })]
7363
- })]
7364
- })
7365
- })]
7366
- });
7367
- };
7368
-
7369
7058
  var CARD_SX = {
7370
7059
  maxHeight: 280
7371
7060
  };
@@ -7413,30 +7102,7 @@ var OverallDetailsGrid = function OverallDetailsGrid(_ref) {
7413
7102
  _ref.dateName;
7414
7103
  var _ref$numberOfDays = _ref.numberOfDays,
7415
7104
  numberOfDays = _ref$numberOfDays === void 0 ? 30 : _ref$numberOfDays;
7416
- var _useState = React.useState(null),
7417
- _useState2 = _slicedToArray(_useState, 2),
7418
- modalTitle = _useState2[0],
7419
- setModalTitle = _useState2[1];
7420
7105
  var daysLabel = "".concat(numberOfDays, " day").concat(numberOfDays === 1 ? "" : "s");
7421
- var openDetailModal = function openDetailModal(title) {
7422
- if (!exportMode) {
7423
- setModalTitle(title);
7424
- }
7425
- };
7426
- var closeDetailModal = function closeDetailModal() {
7427
- return setModalTitle(null);
7428
- };
7429
- var withCardClick = function withCardClick(title, card) {
7430
- return exportMode ? card : /*#__PURE__*/jsxRuntime.jsx(material.Box, {
7431
- onClick: function onClick() {
7432
- return openDetailModal(title);
7433
- },
7434
- sx: {
7435
- display: "contents"
7436
- },
7437
- children: card
7438
- });
7439
- };
7440
7106
  var _donorMix$newDonors = donorMix.newDonors,
7441
7107
  newDonors = _donorMix$newDonors === void 0 ? 0 : _donorMix$newDonors,
7442
7108
  _donorMix$returningDo = donorMix.returningDonors,
@@ -7499,12 +7165,12 @@ var OverallDetailsGrid = function OverallDetailsGrid(_ref) {
7499
7165
  sx: {
7500
7166
  paddingTop: "0px !important"
7501
7167
  },
7502
- children: withCardClick("Active Campaigns", /*#__PURE__*/jsxRuntime.jsx(ActiveCampaignsCard, {
7168
+ children: /*#__PURE__*/jsxRuntime.jsx(ActiveCampaignsCard, {
7503
7169
  title: "Active Campaigns",
7504
7170
  subtitle: "Live fundraisers ranked by velocity",
7505
7171
  columns: ["Campaign", "Raised", "Progress", "Donors", "Avg gift"],
7506
7172
  rows: activeCampaignsRows
7507
- }))
7173
+ })
7508
7174
  }), /*#__PURE__*/jsxRuntime.jsx(material.Grid, {
7509
7175
  item: true,
7510
7176
  xs: 12,
@@ -7517,7 +7183,7 @@ var OverallDetailsGrid = function OverallDetailsGrid(_ref) {
7517
7183
  md: 0
7518
7184
  }
7519
7185
  },
7520
- children: withCardClick("Donor Mix", /*#__PURE__*/jsxRuntime.jsx(DonorMixCard, {
7186
+ children: /*#__PURE__*/jsxRuntime.jsx(DonorMixCard, {
7521
7187
  title: "Donor Mix",
7522
7188
  subtitle: "Acquisition vs retention",
7523
7189
  series: [newDonors, returningDonors],
@@ -7539,29 +7205,29 @@ var OverallDetailsGrid = function OverallDetailsGrid(_ref) {
7539
7205
  sx: {
7540
7206
  width: "100%"
7541
7207
  }
7542
- }))
7208
+ })
7543
7209
  })]
7544
7210
  });
7545
7211
  var middleCards = /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
7546
- children: [withCardClick("Donation Type", /*#__PURE__*/jsxRuntime.jsx(DonationTypeBarChart, {
7212
+ children: [/*#__PURE__*/jsxRuntime.jsx(DonationTypeBarChart, {
7547
7213
  sx: CARD_SX,
7548
7214
  donationTypeData: donationTypeData
7549
- })), withCardClick("Paid Donor Geography", /*#__PURE__*/jsxRuntime.jsx(PaidDonorGeographyCard, {
7215
+ }), /*#__PURE__*/jsxRuntime.jsx(PaidDonorGeographyCard, {
7550
7216
  sx: CARD_SX,
7551
7217
  donorGeographyData: donorGeographyData
7552
- })), withCardClick("Refunds & Chargebacks", /*#__PURE__*/jsxRuntime.jsx(RefundsChargebacksCard, {
7218
+ }), /*#__PURE__*/jsxRuntime.jsx(RefundsChargebacksCard, {
7553
7219
  sx: CARD_SX,
7554
7220
  refundsChargebacksData: refundsChargebacksData,
7555
7221
  numberOfDays: numberOfDays
7556
- })), withCardClick("Traffic Source", /*#__PURE__*/jsxRuntime.jsx(TrafficSourceCard, {
7222
+ }), /*#__PURE__*/jsxRuntime.jsx(TrafficSourceCard, {
7557
7223
  sx: CARD_SX,
7558
7224
  trafficSourceData: (trafficSourceData === null || trafficSourceData === void 0 ? void 0 : trafficSourceData.data) || [],
7559
7225
  total: "$".concat(formatNumber((trafficSourceData === null || trafficSourceData === void 0 ? void 0 : trafficSourceData.totalRevenue) || 0)),
7560
7226
  numberOfDays: numberOfDays
7561
- }))]
7227
+ })]
7562
7228
  });
7563
7229
  var bottomCards = /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
7564
- children: [withCardClick("Order Bump", /*#__PURE__*/jsxRuntime.jsx(MetricSparklineCard, {
7230
+ children: [/*#__PURE__*/jsxRuntime.jsx(MetricSparklineCard, {
7565
7231
  title: "Order Bump",
7566
7232
  subtitle: "Revenue trend - last ".concat(daysLabel),
7567
7233
  value: "$".concat(formatNumber((orderBumpData === null || orderBumpData === void 0 ? void 0 : orderBumpData.totalRevenue) || 0)),
@@ -7586,7 +7252,7 @@ var OverallDetailsGrid = function OverallDetailsGrid(_ref) {
7586
7252
  }],
7587
7253
  sx: CARD_SX,
7588
7254
  bottomSection: true
7589
- })), withCardClick("Upsell", /*#__PURE__*/jsxRuntime.jsx(MetricDonutCard, {
7255
+ }), /*#__PURE__*/jsxRuntime.jsx(MetricDonutCard, {
7590
7256
  title: "Upsell",
7591
7257
  subtitle: "Acceptance & raised",
7592
7258
  acceptanceRate: (upsellData === null || upsellData === void 0 ? void 0 : upsellData.acceptanceRate) || 0,
@@ -7595,7 +7261,7 @@ var OverallDetailsGrid = function OverallDetailsGrid(_ref) {
7595
7261
  raisedVal: "$".concat(formatNumber((upsellData === null || upsellData === void 0 ? void 0 : upsellData.raised) || 0)),
7596
7262
  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), "%"),
7597
7263
  sx: CARD_SX
7598
- })), withCardClick("Downsell", /*#__PURE__*/jsxRuntime.jsx(MetricDonutCard, {
7264
+ }), /*#__PURE__*/jsxRuntime.jsx(MetricDonutCard, {
7599
7265
  title: "Downsell",
7600
7266
  subtitle: "Acceptance & raised",
7601
7267
  acceptanceRate: (downsellData === null || downsellData === void 0 ? void 0 : downsellData.acceptanceRate) || 0,
@@ -7604,7 +7270,7 @@ var OverallDetailsGrid = function OverallDetailsGrid(_ref) {
7604
7270
  raisedVal: "$".concat(formatNumber((downsellData === null || downsellData === void 0 ? void 0 : downsellData.raised) || 0)),
7605
7271
  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), "%"),
7606
7272
  sx: CARD_SX
7607
- })), withCardClick("Referrals", /*#__PURE__*/jsxRuntime.jsx(MetricSparklineCard, {
7273
+ }), /*#__PURE__*/jsxRuntime.jsx(MetricSparklineCard, {
7608
7274
  title: "Referrals",
7609
7275
  subtitle: "Revenue trend - last ".concat(daysLabel),
7610
7276
  value: "$".concat(formatNumber((referralData === null || referralData === void 0 ? void 0 : referralData.totalRevenue) || 0)),
@@ -7628,32 +7294,27 @@ var OverallDetailsGrid = function OverallDetailsGrid(_ref) {
7628
7294
  }],
7629
7295
  sx: CARD_SX,
7630
7296
  bottomSection: true
7631
- }))]
7632
- });
7633
- var detailModal = /*#__PURE__*/jsxRuntime.jsx(OverallDetailModal, {
7634
- open: Boolean(modalTitle),
7635
- title: modalTitle || "",
7636
- onClose: closeDetailModal
7297
+ })]
7637
7298
  });
7638
7299
  if (section === "campaigns") {
7639
- return /*#__PURE__*/jsxRuntime.jsxs(material.Box, {
7640
- children: [campaignsRow, detailModal]
7300
+ return /*#__PURE__*/jsxRuntime.jsx(material.Box, {
7301
+ children: campaignsRow
7641
7302
  });
7642
7303
  }
7643
7304
  if (section === "middle") {
7644
- return /*#__PURE__*/jsxRuntime.jsxs(material.Box, {
7645
- children: [/*#__PURE__*/jsxRuntime.jsx(material.Box, {
7305
+ return /*#__PURE__*/jsxRuntime.jsx(material.Box, {
7306
+ children: /*#__PURE__*/jsxRuntime.jsx(material.Box, {
7646
7307
  sx: fourColGridSx$1(exportMode),
7647
7308
  children: middleCards
7648
- }), detailModal]
7309
+ })
7649
7310
  });
7650
7311
  }
7651
7312
  if (section === "bottom") {
7652
- return /*#__PURE__*/jsxRuntime.jsxs(material.Box, {
7653
- children: [/*#__PURE__*/jsxRuntime.jsx(material.Box, {
7313
+ return /*#__PURE__*/jsxRuntime.jsx(material.Box, {
7314
+ children: /*#__PURE__*/jsxRuntime.jsx(material.Box, {
7654
7315
  sx: fourColGridSx$1(exportMode),
7655
7316
  children: bottomCards
7656
- }), detailModal]
7317
+ })
7657
7318
  });
7658
7319
  }
7659
7320
  return /*#__PURE__*/jsxRuntime.jsxs(material.Box, {
@@ -7663,7 +7324,7 @@ var OverallDetailsGrid = function OverallDetailsGrid(_ref) {
7663
7324
  }), /*#__PURE__*/jsxRuntime.jsx(material.Box, {
7664
7325
  sx: fourColGridSx$1(exportMode),
7665
7326
  children: bottomCards
7666
- }), detailModal]
7327
+ })]
7667
7328
  });
7668
7329
  };
7669
7330