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